Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485import type { ReactNode, Ref } from "react";import type { BurokkuElement, BurokkuEventMap, BurokkuStyle, BurokkuTagName,} from "@burokku/runtime";
/** Each event handler prop and the type of the event it handles. */interface EventHandlerTypes { onClick: "click"; onKeyDown: "keydown"; onKeyUp: "keyup"; onPointerDown: "pointerdown"; onPointerUp: "pointerup"; onPointerMove: "pointermove"; onPointerEnter: "pointerenter"; onPointerLeave: "pointerleave"; onPointerCancel: "pointercancel"; onGotPointerCapture: "gotpointercapture"; onLostPointerCapture: "lostpointercapture"; onWheel: "wheel"; onScroll: "scroll"; onFocus: "focus"; onBlur: "blur"; onFocusIn: "focusin"; onFocusOut: "focusout"; onBeforeInput: "beforeinput"; onInput: "input"; onCompositionStart: "compositionstart"; onCompositionUpdate: "compositionupdate"; onCompositionEnd: "compositionend";}
/** * Handlers for the events every element dispatches. Each handles the event of * its name after `on` in lower case, so `onFocus` does not bubble. */export type BurokkuEventHandlers = { [Prop in keyof EventHandlerTypes]?: (event: BurokkuEventMap[EventHandlerTypes[Prop]]) => void;};
/** * A tag's styles in JSX, where a key set to `null` is removed as one set to * `undefined` is. A key the tag does not support takes neither. */export type BurokkuStyleProp<Tag extends BurokkuTagName> = { readonly [Key in keyof BurokkuStyle<Tag>]?: [ Exclude<BurokkuStyle<Tag>[Key], undefined>, ] extends [never] ? never : BurokkuStyle<Tag>[Key] | null;};
/** Props every Burokku element takes in JSX; `null` removes an attribute. */export interface BurokkuElementProps<Tag extends BurokkuTagName> extends BurokkuEventHandlers { children?: ReactNode; ref?: Ref<BurokkuElement<Tag>>; style?: BurokkuStyleProp<Tag>; /** An integer makes the element focusable, in the tab order unless negative. */ tabindex?: number | null;}
/** A window's props: its title and opening size are attributes. */export interface BurokkuWindowProps extends BurokkuElementProps<"window"> { title?: string | null; /** The width in logical pixels the window opens at; later changes do not resize it. */ width?: number | null; /** The height in logical pixels the window opens at; later changes do not resize it. */ height?: number | null; /** Fires when the user asks to close the window; see `BurokkuEventMap`. */ onClose?: (event: BurokkuEventMap["close"]) => void;}
/** The props of each Burokku tag in JSX. */export interface BurokkuIntrinsicElements { div: BurokkuElementProps<"div">; flex: BurokkuElementProps<"flex">; grid: BurokkuElementProps<"grid">; /** Its value is its text, bare or in styled `text` runs. */ input: BurokkuElementProps<"input">; text: BurokkuElementProps<"text">; window: BurokkuWindowProps;}