Skip to content

HTML box types

Read as Markdown

Readonly isFocusWithin and isFocusVisible booleans describe the whole native region. Native descendants keep their browser focus and focus rings.

See HtmlBox.

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.

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.

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.

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.

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.

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.

PibblEventHandlers

HtmlBoxProps

HtmlBox

View source — packages/core/src/lib/html/types.ts:59

Props for a DOM-hosting region, including mount ownership, updates, and focus behavior.

interface HtmlBoxProps<Props> extends HtmlBoxEventHandlers

Related API: HtmlBoxProps, HtmlBoxEventHandlers.

HtmlMountCallback

HtmlBoxFocusState

HtmlBox

View source — packages/core/src/lib/html/types.ts:69

data
data: Props

Application data supplied to the component or reported by the event. See HtmlBoxProps .

View source — packages/core/src/lib/html/types.ts:74

mount
mount: HtmlMountCallback<Props>

Related API: HtmlMountCallback.

Creates mounted content and its owned lifecycle controls. See HtmlMountCallback.

View source — packages/core/src/lib/html/types.ts:76

pointerEvents (optional)
pointerEvents?: "auto" | "none" | undefined

Whether this content participates in pointer targeting. See HtmlBoxProps.

View source — packages/core/src/lib/html/types.ts:78

onFocusChange (optional)
onFocusChange?: ((state: Readonly<HtmlBoxFocusState>) => void) | undefined

Related API: HtmlBoxFocusState.

Receives changes to focus within the hosted HTML region. See HtmlBoxFocusState.

  • state — Current DOM and Pibbl focus ownership for the HTML region. See HtmlBoxFocusState .

View source — packages/core/src/lib/html/types.ts:84

Layout and presentation of an application-owned HTML region anchored to Canvas geometry.

interface HtmlBoxStyle extends GStyle

Related API: HtmlBoxStyle, GStyle.

GStyle

HtmlBox

View source — packages/core/src/lib/html/types.ts:92

opacity (optional)
opacity?: number | undefined

Related API: opacity.

Opacity of the painted result. See HtmlBoxStyle.

View source — packages/core/src/lib/html/types.ts:94

position (optional)
position?: "absolute" | "relative" | "static" | undefined

Experimental 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}%` | undefined

Left 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}%` | undefined

Right 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}%` | undefined

Top 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}%` | undefined

Bottom 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}%` | undefined

Experimental 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}%` | undefined

Experimental 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 | undefined

Positive finite width/height ratio. A declared definite axis derives the automatic axis before its bounds; boxSizing selects content or border geometry. See resolveBox.

View source — packages/core/src/lib/style/types.ts:84

boxSizing (optional)
boxSizing?: "border-box" | "content-box" | undefined

Selects 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.

View source — packages/core/src/lib/style/types.ts:89

width (optional)
width?: SizingLength | undefined

Related API: SizingLength.

Horizontal extent in the units of the containing geometry or surface. See SizingLength.

View source — packages/core/src/lib/style/types.ts:91

height (optional)
height?: SizingLength | undefined

Related API: SizingLength.

Vertical extent in the units of the containing geometry or surface. See SizingLength.

View source — packages/core/src/lib/style/types.ts:93

minWidth (optional)
minWidth?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefined

Related API: FitContent, SizingKeyword.

Minimum permitted horizontal width. Finite horizontal Flex intrinsic owners also accept intrinsic sizing requests; automatic remains invalid. See SizingLength.

View source — packages/core/src/lib/style/types.ts:95

maxWidth (optional)
maxWidth?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefined

Related API: FitContent, SizingKeyword.

Maximum permitted horizontal width. Finite horizontal Flex intrinsic owners also accept intrinsic sizing requests; automatic remains invalid. See SizingLength.

View source — packages/core/src/lib/style/types.ts:97

minHeight (optional)
minHeight?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefined

Related API: FitContent, SizingKeyword.

Minimum permitted height. See Length.

View source — packages/core/src/lib/style/types.ts:99

maxHeight (optional)
maxHeight?: number | "stretch" | FitContent | `${number}%` | SizingKeyword | undefined

Related API: FitContent, SizingKeyword.

Maximum permitted height. See Length.

View source — packages/core/src/lib/style/types.ts:101

padding (optional)
padding?: EdgeValues<number | `${number}%`> | undefined

Related API: EdgeValues.

Padding inside layout borders. Experimental allocated Flex percentages use owner content width for every edge. See EdgeValues, Percentage.

View source — packages/core/src/lib/style/types.ts:103

paddingStart (optional)
paddingStart?: number | `${number}%` | undefined

Nonnegative inline-start padding overriding its physical padding edge. Experimental percentages require an allocated Flex owner and use its content width. See BoxStyle.

View source — packages/core/src/lib/style/types.ts:105

paddingEnd (optional)
paddingEnd?: number | `${number}%` | undefined

Nonnegative inline-end padding overriding its physical padding edge. See BoxStyle.

View source — packages/core/src/lib/style/types.ts:107

borderWidth (optional)
borderWidth?: EdgeValues<number> | undefined

Related API: EdgeValues.

Layout-only physical border insets, in logical pixels. Defaults to zero; does not paint a stroke. See EdgeValues.

View source — packages/core/src/lib/style/types.ts:109

borderStartWidth (optional)
borderStartWidth?: number | undefined

Experimental nonnegative numeric inline-start layout border overriding its physical borderWidth edge. Does not paint a stroke. See BoxStyle.

View source — packages/core/src/lib/style/types.ts:111

borderEndWidth (optional)
borderEndWidth?: number | undefined

Experimental nonnegative numeric inline-end layout border overriding its physical borderWidth edge. See BoxStyle.

View source — packages/core/src/lib/style/types.ts:113

overflow (optional)
overflow?: "clip" | "visible" | undefined

Selects "visible", "clip" for overflow. See BoxStyle.

View source — packages/core/src/lib/style/types.ts:115

margin (optional)
margin?: FlexMargin | undefined

Related 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.

View source — packages/core/src/lib/style/types.ts:146

marginTop (optional)
marginTop?: FlexMargin | undefined

Related API: FlexMargin.

Physical top margin overriding margin. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:148

marginRight (optional)
marginRight?: FlexMargin | undefined

Related API: FlexMargin.

Physical right margin overriding margin. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:150

marginBottom (optional)
marginBottom?: FlexMargin | undefined

Related API: FlexMargin.

Physical bottom margin overriding margin. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:152

marginLeft (optional)
marginLeft?: FlexMargin | undefined

Related API: FlexMargin.

Physical left margin overriding margin. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:154

marginStart (optional)
marginStart?: FlexMargin | undefined

Related API: FlexMargin.

Inline-start margin overriding the corresponding physical edge and margin shorthand in experimental Flex. Signed percentages use allocated content width. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:156

marginEnd (optional)
marginEnd?: FlexMargin | undefined

Related API: FlexMargin.

Inline-end margin overriding the corresponding physical edge and margin shorthand in experimental Flex. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:158

alignSelf (optional)
alignSelf?: "auto" | "center" | "end" | "flex-end" | "flex-start" | "start" | "stretch" | undefined

This child’s cross-axis or block-axis alignment override. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:160

justifySelf (optional)
justifySelf?: "auto" | "center" | "end" | "start" | "stretch" | undefined

This child’s inline-axis alignment override. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:162

flexBasis (optional)
flexBasis?: SizingLength | undefined

Related API: SizingLength.

Initial main-axis size before flex growth or shrinkage. See SizingLength.

View source — packages/core/src/lib/style/types.ts:164

flexGrow (optional)
flexGrow?: number | undefined

Relative share of positive free space assigned to this child. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:166

flexShrink (optional)
flexShrink?: number | undefined

Relative factor used when reducing main-axis size. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:168

gridColumnStart (optional)
gridColumnStart?: number | undefined

Explicit starting grid column. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:170

gridColumnSpan (optional)
gridColumnSpan?: number | undefined

Number of columns occupied by this child. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:172

gridRowStart (optional)
gridRowStart?: number | undefined

Explicit starting grid row. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:174

gridRowSpan (optional)
gridRowSpan?: number | undefined

Number of rows occupied by this child. See LayoutItemStyle.

View source — packages/core/src/lib/style/types.ts:176

scaleX (optional)
scaleX?: number | undefined

Horizontal scale factor. See GStyle.

View source — packages/core/src/lib/components/g.ts:46

scaleY (optional)
scaleY?: number | undefined

Vertical scale factor. See GStyle.

View source — packages/core/src/lib/components/g.ts:48

rotationDegrees (optional)
rotationDegrees?: number | undefined

Clockwise rotation in degrees.

View source — packages/core/src/lib/components/g.ts:50

rotationOrigin (optional)
rotationOrigin?: [number, number] | undefined

Point around which the rotation is applied. See GStyle.

View source — packages/core/src/lib/components/g.ts:52

translateX (optional)
translateX?: number | undefined

Horizontal translation in the current logical coordinate system. See GStyle.

View source — packages/core/src/lib/components/g.ts:54

translateY (optional)
translateY?: number | undefined

Vertical translation in the current logical coordinate system. See GStyle.

View source — packages/core/src/lib/components/g.ts:56

skewX (optional)
skewX?: number | undefined

Horizontal skew angle in degrees.

View source — packages/core/src/lib/components/g.ts:58

skewY (optional)
skewY?: number | undefined

Vertical skew angle in degrees.

View source — packages/core/src/lib/components/g.ts:60

layoutParticipation (optional)
layoutParticipation?: "contents" | "hidden" | "normal" | undefined

Numeric layout participation. Hidden subtrees retain mounted ownership without geometry or paint; contents retains logical ancestry without owning a box. See SystemStyle.

View source — packages/core/src/lib/types.ts:69

transition (optional)
transition?: PibblTransitionBinding | undefined

Related API: PibblTransitionBinding.

Visibility-transition binding applied to this primitive and its captured descendants. See SystemStyle.

View source — packages/core/src/lib/types.ts:71

custom (optional)
custom?: unknown

Application-defined style payload passed through the runtime. See SystemStyle.

View source — packages/core/src/lib/types.ts:73

filter (optional)
filter?: PibblFilter | readonly PibblFilter[] | undefined

Related API: PibblFilter.

Ordered pixel-only filters applied to the receiving primitive and its descendants. See PibblFilter.

View source — packages/core/src/lib/types.ts:78

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.

  • 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.

An update callback for subsequent props; release application resources when the signal aborts. See HtmlUpdateFunction .

HtmlUpdateFunction

HtmlBoxProps

HtmlBox

View source — packages/core/src/lib/html/types.ts:31

Updates mounted application HTML when the owning HtmlBox receives new props.

type HtmlUpdateFunction<Props> = (props: Props) => void

Related API: HtmlUpdateFunction.

  • props — Latest props for the mounted HTML content.

HtmlMountCallback

View source — packages/core/src/lib/html/types.ts:16

Focus state shared between an HTML host and Pibbl’s logical focus management.

interface HtmlBoxFocusState

Related API: HtmlBoxFocusState.

HtmlBoxProps

View source — packages/core/src/lib/html/types.ts:37

isFocusWithin
readonly isFocusWithin: boolean

Whether an element inside the hosted HTML region currently has focus. See HtmlBoxFocusState.

View source — packages/core/src/lib/html/types.ts:42

isFocusVisible
readonly isFocusVisible: boolean

Whether focus should be presented as keyboard-visible. See HtmlBoxFocusState.

View source — packages/core/src/lib/html/types.ts:44

Read the Input, focus, and native HTML companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision a1dcf8e. ALPHA — NOT FOR PRODUCTION USE.