import { r as DisplayListBuilder } from "./displayList.js"; import { J as TextMeasurer, U as NodeProps, V as Node, W as PropInit, o as Group, z as EvalContext } from "./nodes.js"; import { r as LayoutContainerSpec } from "./layoutEngine.js"; import { BindableSignal } from "@glissade/core"; //#region src/layoutCtors.d.ts interface LayoutProps extends NodeProps { children?: Node[]; /** 'auto': the axis sizes itself from content (Yoga content sizing). */ width?: PropInit | 'auto'; height?: PropInit | 'auto'; direction?: 'row' | 'column'; gap?: PropInit; padding?: PropInit; justify?: LayoutContainerSpec['justify']; align?: LayoutContainerSpec['align']; } /** * Flexbox container (center-anchored like every node). Flowable children * (intrinsicSize ≠ null) are placed by the engine anchor-aware via * flowOffset(): shapes center into their box, Text aligns its baseline * origin to the box edge — labels in a column share a true left edge. * Non-flowable children (e.g. Groups) emit untouched at the layout origin, * BEFORE the flow — their dominant use is backgrounds. Flowed paint order is * zIndex-sorted; flow order is array order. */ declare class Layout extends Group { #private; /** CLI/host detection marker — avoids importing this entry just to instanceof. */ static readonly isLayoutNode = true; /** * Taxonomy name pinned literally (survives IIFE minification — see {@link Group}). * Overrides Group's `'Group'`; `Stack`/`Row`/`Column` are factories returning a * `Layout`, so they inherit `'Layout'` and the bind-guard names their construction * props (`direction`/`justify`/`align`/`children`) correctly in the minified bundle. */ get describeType(): string; readonly width: BindableSignal; readonly height: BindableSignal; readonly gap: BindableSignal; readonly padding: BindableSignal; readonly direction: 'row' | 'column'; readonly justify: LayoutContainerSpec['justify']; readonly align: LayoutContainerSpec['align']; /** Content-sized axes ('auto'): the size signal is ignored, Yoga computes it. */ readonly autoWidth: boolean; readonly autoHeight: boolean; constructor(props?: LayoutProps); intrinsicSize(measurer?: TextMeasurer, opts?: { estimate?: boolean; }): { w: number; h: number; }; /** * The resolved container size — content-driven on 'auto' axes. Pure pull: * reads the same signals the flow reads, so a sibling bound to it * (e.g. panelBg height = () => panel.computedSize().h) tracks every input. * The measurer defaults to the scene-injected one (estimating pre-scene). */ computedSize(measurer?: TextMeasurer, opts?: { estimate?: boolean; }): { w: number; h: number; }; /** * Cut 3 — the per-flowable-child boxes the flow placed (top-left `{x,y}` relative * to the container's top-left, plus `{w,h}`), in child (flow) order. ONE-SOURCE: * routes through the SAME memoized `#compute` the DisplayList origins came from * (never a re-compute), so `computedBoxes()` is byte-exactly what `draw()` rendered — * a pure read (goldens unchanged). Same measurer-fail-loud gate as {@link computedSize}. */ computedBoxes(measurer?: TextMeasurer, opts?: { estimate?: boolean; }): readonly { x: number; y: number; w: number; h: number; }[]; /** * Cut 3 — the resolved padding inset (px). The `padding` signal IS the one source * the memoized `#compute` reads, so this is that same value (no re-compute). Padding * is measurer-independent; the optional args mirror the sibling accessors' shape. */ computedPadding(_measurer?: TextMeasurer, _opts?: { estimate?: boolean; }): number; /** * Cut 3 — the ACTUAL inter-child gaps along the main axis (px), derived from the * SAME memoized `#compute` (`result.boxes`): children sorted on the main axis, each * gap = `box[i+1].start − box[i].end`. Empty when < 2 flowable children. ONE-SOURCE * with the rendered boxes; same measurer-fail-loud gate as {@link computedSize}. */ computedGaps(measurer?: TextMeasurer, opts?: { estimate?: boolean; }): readonly number[]; protected draw(out: DisplayListBuilder, ctx: EvalContext): void; } /** * Stack-ergonomic props — a more DISCOVERABLE surface over {@link LayoutProps}. * Everything `Layout` accepts (id, position, opacity, width/height, gap, * padding, justify, children, …) passes through unchanged; the only difference * from constructing `Layout` directly is the defaulting `Stack()` applies. */ interface StackProps extends LayoutProps {} /** * Thin convenience factory over the Yoga-backed {@link Layout} node — NOT a new * class and NOT new signals, so a `Stack` inherits Layout's memoized, pure, * dependency-tracked resolve verbatim: `Stack(props)` and the equivalent * hand-written `Layout({...})` produce identical child positions. * * Stack-ergonomic defaults (the ONLY divergence from `Layout`): * - `direction` defaults to `'column'` (the common vertical stack; Layout's own * default is `'row'`). * - `align` defaults to `'start'` — a true left edge for a label column (the * dogfooding use case). This DIVERGES from `Layout`'s `'center'` default. * * Every other prop passes straight through to `Layout`. */ declare function Stack(props?: StackProps): Layout; /** * `Row`/`Column` props — `Stack`'s surface MINUS `direction` (the alias pins it). * Omitting `direction` from the type means an explicit one can't even be passed, * so `Row({...})` is unambiguously a row and `Column({...})` a column. */ interface RowProps extends Omit {} /** * `Stack({ direction: 'row' })` read as a name — a horizontal stack. Inherits * Stack's `align:'start'` default and Layout's pure memoized resolve; the only * difference from `Stack` is the pinned `direction`. */ declare function Row(props?: RowProps): Layout; /** * `Stack({ direction: 'column' })` read as a name — a vertical stack (the same * direction `Stack` already defaults to, made explicit at the call site). */ declare function Column(props?: RowProps): Layout; //#endregion export { Column, Layout, LayoutProps, Row, RowProps, Stack, StackProps };