monowind 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/layout.d.ts CHANGED
@@ -47,20 +47,33 @@ export declare function layoutNode(node: LayoutNode, availableWidth: number, ava
47
47
  height?: number | undefined;
48
48
  }): void;
49
49
  export declare function clampSize(value: number, min: number, max: number | undefined): number;
50
- /**
51
- * A text leaf's wrapped lines with their vertical geometry. Lines are one
52
- * row tall unless an atomic inline box on the line is taller — the line
53
- * grows to the tallest box (per CSS line-box growth), and later lines
54
- * shift down. `lineGap` rows separate lines as usual. Requires the leaf's
55
- * inline boxes to be laid out already (their rect heights are read here);
56
- * marker advances must be resolved.
57
- */
50
+ /** A single-column text leaf's wrapped lines with their vertical
51
+ * geometry: `lineGap` rows between lines, per-line heights and text
52
+ * drops from leafLineMetrics (multicol leaves fragment through
53
+ * multicolLeafGeometry instead). Marker advances must be resolved. */
58
54
  export declare function leafLineGeometry(node: LayoutNode, contentWidth: number): {
59
55
  spans: LineSpan[];
60
56
  lineY: number[];
61
57
  textY: number[];
62
58
  totalRows: number;
63
59
  };
60
+ /** A leaf's line spans: hard `<br>` lines under nowrap/pre, greedy
61
+ * word-wrap at the content width otherwise. */
62
+ export declare function leafLineSpans(node: LayoutNode, contentWidth: number): LineSpan[];
63
+ /**
64
+ * Per-line height and text drop for a leaf's wrapped lines. Lines are one
65
+ * row tall unless an atomic inline box on the line is taller — the line
66
+ * grows to the tallest box (per CSS line-box growth). `vertical-align:
67
+ * bottom` on a box drops the line's TEXT to the box's last row
68
+ * (grid-exact in every engine, probed); the largest such box wins.
69
+ * top/middle/baseline behave as top (cell-model deviation — middle and
70
+ * baseline are off-grid). Requires the leaf's inline boxes to be laid
71
+ * out already (their rect heights are read here).
72
+ */
73
+ export declare function leafLineMetrics(node: LayoutNode, spans: LineSpan[]): {
74
+ heights: number[];
75
+ textOffsets: number[];
76
+ };
64
77
  /** The used gap in an axis: the resolved gap floored at the axis's rule
65
78
  * width (specs/gap-decorations.md deviation 1 — rules take layout
66
79
  * space, so `rule` alone behaves as `gap-1 rule`). */
@@ -80,6 +93,17 @@ export declare function resolveLimit(limit: SizeLimit | "auto" | undefined, avai
80
93
  * keywords (`max-w-max` = max-content, …) resolve against the node's
81
94
  * content. */
82
95
  export declare function resolveWidthLimit(limit: SizeLimit | "auto" | undefined, available: number, node: LayoutNode, cache: IntrinsicCache): number | undefined;
96
+ /** Horizontal placement of a box inside its block-flow slot: `auto`
97
+ * margins center or end-align, fixed margins offset (CSS block flow;
98
+ * multicol columns use the same rule). */
99
+ export declare function blockCrossOffset(margin: NullableInsets, slotWidth: number, boxWidth: number): number;
100
+ /**
101
+ * CSS margin-collapsing rule for two adjacent block-flow margins:
102
+ * - both positive → the larger absorbs the smaller.
103
+ * - both negative → the more negative absorbs the less negative.
104
+ * - mixed → they sum (positive shrunk by the negative).
105
+ */
106
+ export declare function collapseMargins(a: number, b: number): number;
83
107
  /** Resolve a definite Size against an available extent (`auto` falls back
84
108
  * to max-content — callers handle the auto/fill distinction themselves). */
85
109
  export declare function resolveSizeAgainst(size: Size, available: number, node: LayoutNode, cache: IntrinsicCache): number;
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAU1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EAET,UAAU,EACV,cAAc,EACd,OAAO,EACP,IAAI,EACJ,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAQvF;AAED,qDAAqD;AACrD,wBAAgB,WAA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AG,MAAM,CAGpE;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;cAQc;AACd,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW,CAIrF;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;cAQc;AACd,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW,CAUrF;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
@@ -0,0 +1,77 @@
1
+ import type { IntrinsicCache } from "./layout.ts";
2
+ import type { CellStyle, Insets, LayoutNode, MulticolLeafGeometry } from "./types.ts";
3
+ /** Column tracks for an element-children container: base width
4
+ * `floor((available − (count − 1) × gap) / count)` with the remainder
5
+ * distributed one cell per column left to right. */
6
+ export declare function resolveColumnTracks(style: CellStyle, available: number, gap: number): number[];
7
+ /** Max-content inner width: `count × content + (count − 1) × gap` when
8
+ * `column-count` drives the count (probed: all three engines agree);
9
+ * with only `column-width`, the content's own max-content floored at
10
+ * one `W`-wide column (Chromium/WebKit; Firefox clamps to `W` — a
11
+ * documented divergence, specs/multicol.md). */
12
+ export declare function multicolIntrinsicInnerWidth(style: CellStyle, contentMax: number): number;
13
+ /** The column-height restriction (css-multicol §7): the smaller of the
14
+ * definite height and the max-height, either alone, or none. */
15
+ export declare function restrictingHeight(definite: number | undefined, max: number | undefined): number | undefined;
16
+ /** Column geometry for a TEXT LEAF: all columns equal at the base width,
17
+ * the remainder reported so layout can fold it into the engine-owned
18
+ * right padding — the browser's equal fractional columns then start on
19
+ * the same whole cells as the engine's. */
20
+ export declare function resolveLeafColumns(style: CellStyle, available: number, gap: number): {
21
+ count: number;
22
+ width: number;
23
+ leftover: number;
24
+ };
25
+ /**
26
+ * Fragment a multicol text leaf into columns (specs/multicol.md "Direct
27
+ * text"): wrap at the column width, then fill columns sequentially into
28
+ * the fill height — every line box spans its own leading (`height +
29
+ * lineGap` rows, the browser's line-box model), and a line never splits
30
+ * across columns. `balance` packs into the minimal height that needs at
31
+ * most `count` columns (clamped to a definite height); `auto` with a
32
+ * definite height fills each column to it, overflow columns catching
33
+ * the rest.
34
+ */
35
+ export declare function multicolLeafGeometry(node: LayoutNode, columns: {
36
+ count: number;
37
+ width: number;
38
+ }, gap: number, definiteHeight: number | undefined): MulticolLeafGeometry;
39
+ /**
40
+ * Predict a multicol TEXT LEAF's fragmentation — the multicol analogue
41
+ * of `wrapLines`, sharing the engine's wrap and fill code so a
42
+ * prediction can never drift from the layout. Returns each line with
43
+ * its column and its TIGHT top row within the column. `restrictingHeight`
44
+ * (the content-box height in rows, e.g. read from a rendered element)
45
+ * reproduces any final layout — sequential fill into the final height
46
+ * IS the layout, whatever fill mode produced it; without it, lines
47
+ * balance into `columnCount` columns.
48
+ */
49
+ export declare function multicolLines(text: string, options: {
50
+ columnWidth: number;
51
+ columnCount: number;
52
+ tracking?: number;
53
+ lineGap?: number;
54
+ restrictingHeight?: number;
55
+ /** `text-indent` charged to the first line (cells). */
56
+ firstLineIndent?: number;
57
+ }): {
58
+ text: string;
59
+ column: number;
60
+ top: number;
61
+ }[];
62
+ /** Column rules for a multicol leaf or paragraph-flow container: one
63
+ * band per gap per SEGMENT (a spanless geometry paints one full-height
64
+ * segment), visibility per the side columns' occupancy. */
65
+ export declare function multicolLeafRuleRuns(node: LayoutNode, geometry: MulticolLeafGeometry, border: Insets, padding: Insets): void;
66
+ /**
67
+ * Lay out a multicol container's element children (specs/multicol.md
68
+ * "Element children"): children are atomic (never split across columns),
69
+ * measured at the column width, and packed sequentially — a new column
70
+ * when the next child would exceed the fill height or at a forced break.
71
+ * Adjacent margins collapse within a column; a margin at a column break
72
+ * truncates at the column top. `column-span: all` children split the
73
+ * flow into stacked segments that each balance independently. Returns
74
+ * content height (rows used).
75
+ */
76
+ export declare function layoutMulticol(node: LayoutNode, innerWidth: number, definiteInnerHeight: number | undefined, maxInnerHeight: number | undefined, border: Insets, padding: Insets, cache: IntrinsicCache): number;
77
+ //# sourceMappingURL=multicol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multicol.d.ts","sourceRoot":"","sources":["../src/multicol.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EACV,SAAS,EACT,MAAM,EACN,UAAU,EACV,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAuBpB;;oDAEoD;AACpD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAK9F;AAED;;;;gDAIgD;AAChD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAMxF;AAED;gEACgE;AAChE,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,GAAG,SAAS,CAIpB;AAYD;;;2CAG2C;AAC3C,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,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
@@ -0,0 +1,3 @@
1
+ import type { LayoutNode } from "./types.ts";
2
+ export declare function paintGrid(root: LayoutNode, target: HTMLElement): void;
3
+ //# sourceMappingURL=paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../src/paint.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAa7C,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAoBrE"}
@@ -13,19 +13,31 @@ import type { LayoutNode } from "./types.ts";
13
13
  * Content that overflows the root box is clipped at the grid edges.
14
14
  */
15
15
  export declare function renderPlainText(root: LayoutNode): string;
16
- /** Paint-through styling for one cell; every field optional so spans
17
- * only carry what differs from the host's inherited text style. */
16
+ /** Per-cell paint; every field optional so spans only carry what
17
+ * differs from the host's inherited text style. `color` paints the
18
+ * glyph, `backgroundColor` fills the cell (the light DOM's own bg is
19
+ * neutralized in styles.css so the grid owns backgrounds outright). */
18
20
  export interface CellPaint {
19
21
  color?: string;
22
+ backgroundColor?: string;
20
23
  fontWeight?: string;
21
24
  fontStyle?: string;
22
25
  textDecorationLine?: string;
23
26
  }
24
- /** One row of same-styled text runs. Joining every segment's text
25
- * reproduces the `renderPlainText` row — the plain-text mode builds
26
- * spans from these, so a copy still yields the pure text. */
27
- export interface PlainTextSegment extends CellPaint {
27
+ /** One row of same-paint runs. Joining every segment's text reproduces
28
+ * the `renderPlainText` row, so a copy from the DOM adapter (paint.ts)
29
+ * still yields the pure text. */
30
+ export interface CellSegment extends CellPaint {
28
31
  text: string;
29
32
  }
30
- export declare function renderPlainTextSegments(root: LayoutNode): PlainTextSegment[][];
33
+ /** Row-major cell segments. Each row is `rowSegments(grid[y],
34
+ * paints[y])` — the DOM adapter (paint.ts) uses this, and tests
35
+ * assert paint fields against it. */
36
+ export declare function renderCellSegments(root: LayoutNode): CellSegment[][];
37
+ /** Apply a `CellPaint` to a `CSSStyleDeclaration`. Kept in this file
38
+ * alongside samePaint / textPaint so the paint schema has one home. */
39
+ export declare function applyCellPaint(paint: CellPaint, style: CSSStyleDeclaration): void;
40
+ /** True when a segment carries no paint — the DOM adapter emits a bare
41
+ * text node for these instead of an empty <span>. */
42
+ export declare function isBarePaint(paint: CellPaint): boolean;
31
43
  //# sourceMappingURL=plain-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAIxD;AAED;mEACmE;AACnE,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;6DAE6D;AAC7D,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,EAAE,EAAE,CAe9E"}
1
+ {"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAIxD;AAED;;;uEAGuE;AACvE,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;iCAEiC;AACjC,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;qCAEqC;AACrC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,EAAE,EAAE,CAGpE;AA8BD;uEACuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAMjF;AAED;qDACqD;AACrD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAQrD"}
package/dist/render.d.ts CHANGED
@@ -1,9 +1,16 @@
1
1
  import type { LayoutNode } from "./types.ts";
2
2
  /**
3
- * Write geometry custom properties on each source element and (re)paint the
4
- * decoration layer. Coordinates on LayoutNode are parent-relative; borders
5
- * are painted in absolute coordinates so we accumulate the parent origin as
6
- * we walk.
3
+ * Write geometry custom properties, quantized inline padding, and z-index
4
+ * markers on each source element in the light DOM. Coordinates on
5
+ * LayoutNode are parent-relative; the companion stylesheet turns them
6
+ * into px via the measured cell size. No painting: decoration and text
7
+ * glyphs land in the shadow grid via `paint.ts`.
8
+ *
9
+ * Every write is change-checked: a relayout that computes the same
10
+ * result mutates nothing. Chrome dismisses an open <select> popup on
11
+ * style mutations near it, and the dynamic-state listeners relayout on
12
+ * the very events that open one (focusin/pointerover) — idempotent
13
+ * writes keep the popup up.
7
14
  */
8
- export declare function render(root: LayoutNode, decorationLayer: HTMLElement): void;
15
+ export declare function render(root: LayoutNode): void;
9
16
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAW,MAAM,YAAY,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,GAAG,IAAI,CAc3E"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAW,MAAM,YAAY,CAAC;AAGtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAY7C"}
package/dist/sort.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":""}