HTML box types
HtmlBoxFocusState
Section titled “HtmlBoxFocusState”Readonly isFocusWithin and isFocusVisible booleans describe the whole native
region. Native descendants keep their browser focus and focus rings.
See HtmlBox.
HtmlBoxProps
Section titled “HtmlBoxProps”data is the opaque application payload, mount is its mount callback,
pointerEvents is "auto" | "none", and optional onFocusChange observes the
region snapshot. Read a Pibbl signal with .get() to subscribe the enclosing
component when replacing data. data is not recursively resolved.
HtmlBoxEventHandlers
Section titled “HtmlBoxEventHandlers”Optional native handler props use PibblEventHandlers names and payloads, including
capture variants. Coordinate events add readonly localX and localY measured
from the HtmlBox border origin before padding; x and y remain root-logical.
Keyboard, input, focus, composition and clipboard events do not gain coordinates.
The native DOM target remains available through originalEvent.target.
HtmlBoxProps extends this handler map. target identifies the logical HtmlBox
and its pointer-capture methods use the native content DIV. currentTarget follows
the Pibbl ancestor path. Native descendant handlers stay between logical capture
and bubble; cancellation and the original DOM bubbling flag are preserved.
See HtmlBox for a complete example.
HtmlBoxStyle
Section titled “HtmlBoxStyle”Pibbl box/layout fields and Group affine transform fields, plus opacity. Width and height default to the parent’s allocation; DOM content does not define intrinsic size. Overflow defaults to clip. Canvas filters enclosing HtmlBox are unsupported.
HtmlMountCallback
Section titled “HtmlMountCallback”type HtmlMountCallback<Props> = ( element: HTMLDivElement, initialProps: Props, signal: AbortSignal,) => HtmlUpdateFunction<Props>;Creates content once in a connected DIV and returns its updater. Use the native AbortSignal for listener and resource cleanup before the DIV is removed.
HtmlUpdateFunction
Section titled “HtmlUpdateFunction”type HtmlUpdateFunction<Props> = (props: Props) => void;Updates persistent content after subsequent successful component renders. A clean Layer reprojection does not call the updater. Return a no-op if updates are unused.
API details from source
Section titled “API details from source”
HtmlBoxEventHandlers
Section titled “HtmlBoxEventHandlers”Optional native event callbacks using Pibbl event names and capture/bubble phases. Coordinate events retain root-logical x/y and add border-local localX/localY, before padding and independent of the current ancestor handler. The originalEvent retains the real DOM target; target/currentTarget identify the logical Pibbl path. Native editing, cancellation and pointer capture remain browser-owned.
type HtmlBoxEventHandlers = { [Key in keyof PibblEventHandlers]: (event: HtmlBoxEvent<Parameters<NonNullable<PibblEventHandlers[Key]>>[0]>) => void;}Related API: HtmlBoxEventHandlers, PibblEventHandlers.
See also
Section titled “See also”View source — packages/core/src/lib/html/types.ts:59
HtmlBoxProps
Section titled “HtmlBoxProps”Props for a DOM-hosting region, including mount ownership, updates, and focus behavior.
interface HtmlBoxProps<Props> extends HtmlBoxEventHandlersRelated API: HtmlBoxProps, HtmlBoxEventHandlers.
See also
Section titled “See also”View source — packages/core/src/lib/html/types.ts:69
Properties and methods
Section titled “Properties and methods”
data
data: PropsApplication data supplied to the component or reported by the event. See HtmlBoxProps .
mount
mount: HtmlMountCallback<Props>Related API: HtmlMountCallback.
Creates mounted content and its owned lifecycle controls. See HtmlMountCallback.
pointerEvents (optional)
pointerEvents?: "auto" | "none" | undefinedWhether this content participates in pointer targeting. See HtmlBoxProps.
onFocusChange (optional)
onFocusChange?: ((state: Readonly<HtmlBoxFocusState>) => void) | undefinedRelated API: HtmlBoxFocusState.
Receives changes to focus within the hosted HTML region. See HtmlBoxFocusState.
Parameters
Section titled “Parameters”state— Current DOM and Pibbl focus ownership for the HTML region. See HtmlBoxFocusState .
HtmlBoxStyle
Section titled “HtmlBoxStyle”Layout and presentation of an application-owned HTML region anchored to Canvas geometry.
interface HtmlBoxStyle extends GStyleRelated API: HtmlBoxStyle, GStyle.
See also
Section titled “See also”View source — packages/core/src/lib/html/types.ts:92
Properties and methods
Section titled “Properties and methods”
opacity (optional)
opacity?: number | undefinedRelated API: opacity.
Opacity of the painted result. See HtmlBoxStyle.
position (optional)
position?: "absolute" | "relative" | "static" | undefinedExperimental direct-Flex placement mode. In a finite Flex, static keeps the allocated slot and ignores insets; relative offsets final geometry once without moving siblings. Primitive static/relative leaves support every main/writing direction and wrapping mode. Wrapped parents admit fixed numeric direct Flex owners that remain internally nowrap; non-row chains use the same fixed owner restriction, with zero grow/shrink and omitted or automatic basis; physical offsets retain their sign through main reversal. Absolute stays out of sibling allocation, using the padding box for explicit insets and content alignment for omitted axes. Fixed numeric, percentage and admitted automatic absolute profiles support all main directions and RTL, with numeric or percentage bounds applied before placement. In every wrapping mode, omitted axes use whole-content main/cross alignment; wrap-reverse reverses omitted cross alignment and combines with column RTL exactly once. Paired natural providers keep their exact/unbounded query in every admitted direction. Direct wrapped Text with a generic pixel font and visible fit/overflow may measure automatic height at a resolved numeric or percentage width through the same owned query. Unwrapped Text may measure automatic width at a resolved numeric or percentage height, using its existing Canvas ink-bounds width before bounds and physical anchoring. Generic unwrapped Text also supports natural ink height and both automatic dimensions through one unbounded query before independent numeric clamps; mixed opposing-pair/natural feedback and both-auto aspect remain excluded. On the documented finite direct-child path, automatic absolute axes resolve from opposing numeric or percentage physical insets. With a positive finite aspectRatio, exactly one automatic axis can instead derive from its resolved declared finite numeric or percentage opposite axis. Opposing insets win. Finite numeric or percentage min/max bounds clamp used axes independently after derivation; a clamp does not recouple aspectRatio, and a numeric minimum above its maximum rejects. A direct custom primitive with paired pure measurement providers may instead measure natural automatic width at a declared numeric or percentage height, or natural height at a declared numeric or percentage width. The automatic axis is unbounded; the exact axis uses its declared resolved padding-box value before bounds clamp the used dimensions. In direct declarative Flex chains, static Flex passes the containing box outward while relative Flex owns a local box. Omission retains the legacy local Flex boundary and left/top behavior.
View source — packages/core/src/lib/style/positioning.ts:194
left (optional)
left?: number | `${number}%` | undefinedLeft edge coordinate or inset. Explicit absolute Flex insets accept finite numbers or percentages of the containing padding-box axis; relative percentages use the parent content-box axis. See Length.
View source — packages/core/src/lib/style/positioning.ts:196
right (optional)
right?: number | `${number}%` | undefinedRight edge inset. Absolute Flex accepts finite numbers or percentages of the containing padding-box width; relative percentages use the parent content-box width. See Length.
View source — packages/core/src/lib/style/positioning.ts:198
top (optional)
top?: number | `${number}%` | undefinedTop edge coordinate or inset. Explicit absolute Flex insets accept finite numbers or percentages of the containing padding-box axis; relative percentages use the parent content-box axis. See Length.
View source — packages/core/src/lib/style/positioning.ts:200
bottom (optional)
bottom?: number | `${number}%` | undefinedBottom edge inset. Absolute Flex accepts finite numbers or percentages of the containing padding-box height; relative percentages use the parent content-box height. See Length.
View source — packages/core/src/lib/style/positioning.ts:202
insetStart (optional)
insetStart?: number | `${number}%` | undefinedExperimental direct absolute Flex inline-start inset, mapped through the receiving Flex direction. Overrides the corresponding physical edge, including zero. Percentages use the selected containing padding-box width. See Length.
View source — packages/core/src/lib/style/positioning.ts:204
insetEnd (optional)
insetEnd?: number | `${number}%` | undefinedExperimental direct absolute Flex inline-end inset, mapped through the receiving Flex direction. Overrides the corresponding physical edge. See Length.
View source — packages/core/src/lib/style/positioning.ts:206
aspectRatio (optional)
aspectRatio?: number | undefinedPositive finite width/height ratio. A declared definite axis derives the automatic axis before its bounds; boxSizing selects content or border geometry. See resolveBox.
boxSizing (optional)
boxSizing?: "border-box" | "content-box" | undefinedSelects whether dimensions, bounds and Flex basis include padding and layout borders. Defaults to content-box. Border-box content floors at zero and the outer box floors at total axis padding plus layout borders. Painted stroke widths remain independent. See ResolvedBoxStyle.
width (optional)
width?: SizingLength | undefinedRelated API: SizingLength.
Horizontal extent in the units of the containing geometry or surface. See SizingLength.
height (optional)
height?: SizingLength | undefinedRelated API: SizingLength.
Vertical extent in the units of the containing geometry or surface. See SizingLength.
minWidth (optional)
minWidth?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefinedRelated API: FitContent, SizingKeyword.
Minimum permitted horizontal width. Finite horizontal Flex intrinsic owners also accept intrinsic sizing requests; automatic remains invalid. See SizingLength.
maxWidth (optional)
maxWidth?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefinedRelated API: FitContent, SizingKeyword.
Maximum permitted horizontal width. Finite horizontal Flex intrinsic owners also accept intrinsic sizing requests; automatic remains invalid. See SizingLength.
minHeight (optional)
minHeight?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefinedRelated API: FitContent, SizingKeyword.
Minimum permitted height. See Length.
maxHeight (optional)
maxHeight?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefinedRelated API: FitContent, SizingKeyword.
Maximum permitted height. See Length.
padding (optional)
padding?: EdgeValues<number | `${number}%`> | undefinedRelated API: EdgeValues.
Padding inside layout borders. Experimental allocated Flex percentages use owner content width for every edge. See EdgeValues, Percentage.
paddingStart (optional)
paddingStart?: number | `${number}%` | undefinedNonnegative inline-start padding overriding its physical padding edge. Experimental percentages require an allocated Flex owner and use its content width. See BoxStyle.
paddingEnd (optional)
paddingEnd?: number | `${number}%` | undefinedNonnegative inline-end padding overriding its physical padding edge. See BoxStyle.
borderWidth (optional)
borderWidth?: EdgeValues<number> | undefinedRelated API: EdgeValues.
Layout-only physical border insets, in logical pixels. Defaults to zero; does not paint a stroke. See EdgeValues.
borderStartWidth (optional)
borderStartWidth?: number | undefinedExperimental nonnegative numeric inline-start layout border overriding its physical borderWidth edge. Does not paint a stroke. See BoxStyle.
borderEndWidth (optional)
borderEndWidth?: number | undefinedExperimental nonnegative numeric inline-end layout border overriding its physical borderWidth edge. See BoxStyle.
overflow (optional)
overflow?: "clip" | "visible" | undefinedSelects "visible", "clip" for overflow. See BoxStyle.
margin (optional)
margin?: FlexMargin | undefinedRelated API: FlexMargin.
Uniform physical margin in logical Canvas units, a percentage of allocated Flex content width, or auto on supported finite Flex axes. Finite negatives are allowed; specific edges override this value. Consumed by experimental Flex only. See LayoutItemStyle.
marginTop (optional)
marginTop?: FlexMargin | undefinedRelated API: FlexMargin.
Physical top margin overriding margin. See LayoutItemStyle.
marginRight (optional)
marginRight?: FlexMargin | undefinedRelated API: FlexMargin.
Physical right margin overriding margin. See LayoutItemStyle.
marginBottom (optional)
marginBottom?: FlexMargin | undefinedRelated API: FlexMargin.
Physical bottom margin overriding margin. See LayoutItemStyle.
marginLeft (optional)
marginLeft?: FlexMargin | undefinedRelated API: FlexMargin.
Physical left margin overriding margin. See LayoutItemStyle.
marginStart (optional)
marginStart?: FlexMargin | undefinedRelated API: FlexMargin.
Inline-start margin overriding the corresponding physical edge and margin shorthand in experimental Flex. Signed percentages use allocated content width. See LayoutItemStyle.
marginEnd (optional)
marginEnd?: FlexMargin | undefinedRelated API: FlexMargin.
Inline-end margin overriding the corresponding physical edge and margin shorthand in experimental Flex. See LayoutItemStyle.
alignSelf (optional)
alignSelf?: "auto" | "center" | "end" | "flex-end" | "flex-start" | "start" | "stretch" | undefinedThis child’s cross-axis or block-axis alignment override. See LayoutItemStyle.
justifySelf (optional)
justifySelf?: "auto" | "center" | "end" | "start" | "stretch" | undefinedThis child’s inline-axis alignment override. See LayoutItemStyle.
flexBasis (optional)
flexBasis?: SizingLength | undefinedRelated API: SizingLength.
Initial main-axis size before flex growth or shrinkage. See SizingLength.
flexGrow (optional)
flexGrow?: number | undefinedRelative share of positive free space assigned to this child. See LayoutItemStyle.
flexShrink (optional)
flexShrink?: number | undefinedRelative factor used when reducing main-axis size. See LayoutItemStyle.
gridColumnStart (optional)
gridColumnStart?: number | undefinedExplicit starting grid column. See LayoutItemStyle.
gridColumnSpan (optional)
gridColumnSpan?: number | undefinedNumber of columns occupied by this child. See LayoutItemStyle.
gridRowStart (optional)
gridRowStart?: number | undefinedExplicit starting grid row. See LayoutItemStyle.
gridRowSpan (optional)
gridRowSpan?: number | undefinedNumber of rows occupied by this child. See LayoutItemStyle.
scaleX (optional)
scaleX?: number | undefinedHorizontal scale factor. See GStyle.
scaleY (optional)
scaleY?: number | undefinedVertical scale factor. See GStyle.
rotationDegrees (optional)
rotationDegrees?: number | undefinedClockwise rotation in degrees.
rotationOrigin (optional)
rotationOrigin?: [number, number] | undefinedPoint around which the rotation is applied. See GStyle.
translateX (optional)
translateX?: number | undefinedHorizontal translation in the current logical coordinate system. See GStyle.
translateY (optional)
translateY?: number | undefinedVertical translation in the current logical coordinate system. See GStyle.
skewX (optional)
skewX?: number | undefinedHorizontal skew angle in degrees.
skewY (optional)
skewY?: number | undefinedVertical skew angle in degrees.
layoutParticipation (optional)
layoutParticipation?: "contents" | "hidden" | "normal" | undefinedNumeric layout participation. Hidden subtrees retain mounted ownership without geometry or paint; contents retains logical ancestry without owning a box. See SystemStyle.
transition (optional)
transition?: PibblTransitionBinding | undefinedRelated API: PibblTransitionBinding.
Visibility-transition binding applied to this primitive and its captured descendants. See SystemStyle.
custom (optional)
custom?: unknownApplication-defined style payload passed through the runtime. See SystemStyle.
filter (optional)
filter?: PibblFilter | readonly PibblFilter[] | undefinedRelated API: PibblFilter.
Ordered pixel-only filters applied to the receiving primitive and its descendants. See PibblFilter.
HtmlMountCallback
Section titled “HtmlMountCallback”Mounts application HTML into the supplied host and returns its prop-update callback; the abort signal marks teardown.
type HtmlMountCallback<Props> = (element: HTMLDivElement, initialProps: Props, signal: AbortSignal) => HtmlUpdateFunction<Props>Related API: HtmlMountCallback, signal, HtmlUpdateFunction.
Parameters
Section titled “Parameters”-
element— Pibbl-owned host div into which application content may be mounted. -
initialProps— Props from the initial mount. -
signal— Lifetime signal aborted when the host is disposed.
Returns
Section titled “Returns”An update callback for subsequent props; release application resources when the signal aborts. See HtmlUpdateFunction .
See also
Section titled “See also”View source — packages/core/src/lib/html/types.ts:31
HtmlUpdateFunction
Section titled “HtmlUpdateFunction”Updates mounted application HTML when the owning HtmlBox receives new props.
type HtmlUpdateFunction<Props> = (props: Props) => voidRelated API: HtmlUpdateFunction.
Parameters
Section titled “Parameters”props— Latest props for the mounted HTML content.
See also
Section titled “See also”View source — packages/core/src/lib/html/types.ts:16
HtmlBoxFocusState
Section titled “HtmlBoxFocusState”Focus state shared between an HTML host and Pibbl’s logical focus management.
interface HtmlBoxFocusStateRelated API: HtmlBoxFocusState.
See also
Section titled “See also”View source — packages/core/src/lib/html/types.ts:37
Properties and methods
Section titled “Properties and methods”
isFocusWithin
readonly isFocusWithin: booleanWhether an element inside the hosted HTML region currently has focus. See HtmlBoxFocusState.
isFocusVisible
readonly isFocusVisible: booleanWhether focus should be presented as keyboard-visible. See HtmlBoxFocusState.
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Input, focus, and native HTML companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Host a native button in Pibbl: Mount and update native HTML inside an HtmlBox, with typed event handlers, local coordinates, native clicks and focus. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision a1dcf8e. ALPHA — NOT FOR PRODUCTION USE.