monowind 0.2.6 → 0.2.8
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/README.md +24 -4
- package/dist/cdn.js +104 -93
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/focus.d.ts +39 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/glyph-box.d.ts +35 -0
- package/dist/glyph-box.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1862 -1307
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/multicol.d.ts.map +1 -1
- package/dist/paint.d.ts +15 -1
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +44 -6
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/pointer.d.ts +18 -1
- package/dist/pointer.d.ts.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/selection.d.ts +19 -0
- package/dist/selection.d.ts.map +1 -1
- package/dist/style.d.ts +9 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/tree.d.ts +7 -0
- package/dist/tree.d.ts.map +1 -1
- package/dist/width.d.ts +22 -0
- package/dist/width.d.ts.map +1 -0
- package/dist/wrap.d.ts +1 -1
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/styles.css +49 -48
package/dist/layout.d.ts.map
CHANGED
|
@@ -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;AAkB1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EAET,UAAU,EAEV,cAAc,EACd,OAAO,EACP,IAAI,EACJ,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB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,KAAK,EAAE,cAAc,GACpB,MAAM,CAYR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAcpF"}
|
package/dist/multicol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multicol.d.ts","sourceRoot":"","sources":["../src/multicol.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"multicol.d.ts","sourceRoot":"","sources":["../src/multicol.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,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,EAChB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAKpD;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EACzC,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,oBAAoB,CAmCtB;AAwID;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAoBjD;AAED;;2DAE2D;AAC3D,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CAkCN;AAkRD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,cAAc,GACpB,MAAM,CA2QR"}
|
package/dist/paint.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import type { GlyphBoxes } from "./glyph-box.ts";
|
|
2
|
+
import type { RenderOptions } from "./plain-text.ts";
|
|
1
3
|
import type { LayoutNode } from "./types.ts";
|
|
4
|
+
export interface PaintOptions {
|
|
5
|
+
/** Defer structural rebuilds while a primary press is down. */
|
|
6
|
+
holdStructural?: boolean;
|
|
7
|
+
glyphs?: GlyphBoxes;
|
|
8
|
+
selection?: RenderOptions["selection"];
|
|
9
|
+
}
|
|
2
10
|
/** Returns false when the paint was HELD: the caller asked to defer
|
|
3
11
|
* structural rebuilds (a primary press is down) and a selection
|
|
4
12
|
* anchor is in the grid — repeat the paint on release. */
|
|
5
|
-
export declare function paintGrid(root: LayoutNode, target: HTMLElement,
|
|
13
|
+
export declare function paintGrid(root: LayoutNode, target: HTMLElement, options?: PaintOptions): boolean;
|
|
14
|
+
/** The painted cell strings, for callers walking the grid by cell. */
|
|
15
|
+
export declare function paintedCell(target: HTMLElement, col: number, row: number): string | undefined;
|
|
16
|
+
/** The grid's flat text offset of a cell (cell-model.md "Selection"):
|
|
17
|
+
* rows are joined by newlines, and a cell's code units are its cluster's
|
|
18
|
+
* — none for a continuation cell. Clamped to the grid. */
|
|
19
|
+
export declare function gridOffsetAt(target: HTMLElement, col: number, row: number): number;
|
|
6
20
|
export declare function nodeAtOffset(target: HTMLElement, offset: number): [Text, number] | null;
|
|
7
21
|
//# sourceMappingURL=paint.d.ts.map
|
package/dist/paint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../src/paint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../src/paint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAoC7C,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACxC;AAQD;;0DAE0D;AAC1D,wBAAgB,SAAS,CACvB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAgET;AAuBD,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7F;AA6CD;;0DAE0D;AAC1D,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAUlF;AAkED,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAUvF"}
|
package/dist/plain-text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LayoutNode } from "./types.ts";
|
|
1
|
+
import type { LayoutNode, Rect } from "./types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Render a laid-out tree as plain text ("ASCII art", though the border
|
|
4
4
|
* glyphs are Unicode box drawing): leaf text word-wrapped inside its
|
|
@@ -12,6 +12,9 @@ import type { LayoutNode } from "./types.ts";
|
|
|
12
12
|
*
|
|
13
13
|
* The grid covers the layout's ink extent (layoutRoot grows the root
|
|
14
14
|
* to it); ink above or left of the origin has no cells and is dropped.
|
|
15
|
+
* A wide cluster (specs/wide-characters.md) sits in its first cell with
|
|
16
|
+
* empty continuation cells after it, so a joined row reads at the
|
|
17
|
+
* width a terminal shows it.
|
|
15
18
|
*/
|
|
16
19
|
export declare function renderPlainText(root: LayoutNode): string;
|
|
17
20
|
/** Per-cell paint; every field optional so spans only carry what
|
|
@@ -31,20 +34,46 @@ export interface CellPaint {
|
|
|
31
34
|
* blends with what's behind the HOST, never with covered cells.
|
|
32
35
|
* `"0"` still paints: the glyphs stay selectable in grid mode. */
|
|
33
36
|
opacity?: string;
|
|
37
|
+
/** The cell is inside a light-DOM selection (specs/wide-characters.md
|
|
38
|
+
* "The grid paints the selection"): painted with its color and
|
|
39
|
+
* background swapped. */
|
|
40
|
+
selected?: true;
|
|
34
41
|
}
|
|
35
|
-
/** One row of same-paint runs. Joining every segment's text
|
|
36
|
-
*
|
|
37
|
-
*
|
|
42
|
+
/** One row of same-paint runs. Joining every segment's text gives the
|
|
43
|
+
* row at the grid's full width (specs/cell-model.md "Selection"): the
|
|
44
|
+
* <pre> is a rectangle of cells, so a drag's highlight sweeps whole
|
|
45
|
+
* rows and a copy is the visible rectangle. A boxed segment is one
|
|
46
|
+
* cluster the font does not draw at its cell count, to be painted in a
|
|
47
|
+
* box of exactly `cells` cells. */
|
|
38
48
|
export interface CellSegment extends CellPaint {
|
|
39
49
|
text: string;
|
|
50
|
+
cells?: number;
|
|
51
|
+
box?: true;
|
|
52
|
+
}
|
|
53
|
+
/** What the DOM adapter knows and the plain-text model does not: which
|
|
54
|
+
* clusters its font draws off their cell count (`boxed`), and which
|
|
55
|
+
* leaves hold the light-DOM selection, as character ranges. */
|
|
56
|
+
export interface RenderOptions {
|
|
57
|
+
boxed?: (cluster: string, cells: number, paint: CellPaint | undefined) => boolean;
|
|
58
|
+
selection?: Map<LayoutNode, {
|
|
59
|
+
start: number;
|
|
60
|
+
end: number;
|
|
61
|
+
}>;
|
|
40
62
|
}
|
|
41
63
|
/** Row-major cell segments. Each row is `rowSegments(grid[y],
|
|
42
64
|
* paints[y])` — the DOM adapter (paint.ts) uses this, and tests
|
|
43
65
|
* assert paint fields against it. */
|
|
44
|
-
export declare function renderCellSegments(root: LayoutNode): CellSegment[][];
|
|
66
|
+
export declare function renderCellSegments(root: LayoutNode, options?: RenderOptions): CellSegment[][];
|
|
67
|
+
/** The segments plus the cell strings they were built from — the cell ↔
|
|
68
|
+
* code-unit map a row needs once a cluster spans cells or code units. */
|
|
69
|
+
export declare function renderGridRows(root: LayoutNode, options?: RenderOptions): {
|
|
70
|
+
segments: CellSegment[][];
|
|
71
|
+
cells: string[][];
|
|
72
|
+
};
|
|
45
73
|
export declare function samePaint(a: CellPaint, b: CellPaint | undefined): boolean;
|
|
46
74
|
/** Apply a `CellPaint` to a `CSSStyleDeclaration`. Kept in this file
|
|
47
|
-
* alongside samePaint / textPaint so the paint schema has one home.
|
|
75
|
+
* alongside samePaint / textPaint so the paint schema has one home. A
|
|
76
|
+
* selected cell swaps its colors — the theme's, for an unstyled cell. */
|
|
48
77
|
export declare function applyCellPaint(paint: CellPaint, style: CSSStyleDeclaration): void;
|
|
49
78
|
/** True when a segment carries no paint — the DOM adapter emits a bare
|
|
50
79
|
* text node for these instead of an empty <span>. */
|
|
@@ -59,6 +88,15 @@ export declare function leafLineCovers(node: LayoutNode, absX: number, absY: num
|
|
|
59
88
|
* null for a blank cell (specs/semantic-selection.md). `absX/absY` is
|
|
60
89
|
* the leaf's painted border-box origin as hitStack reports it. */
|
|
61
90
|
export declare function charIndexAtCell(node: LayoutNode, absX: number, absY: number, col: number, row: number): number | null;
|
|
91
|
+
/** The cells a leaf's inline elements cover, one rect per element per
|
|
92
|
+
* row — the span of its characters and pad cells there, an outer
|
|
93
|
+
* element's including its inline descendants' — in run order then row
|
|
94
|
+
* order, elements without a cell left out (specs/focus-navigation.md).
|
|
95
|
+
* `absX/absY` as for charIndexAtCell. */
|
|
96
|
+
export declare function inlineElementRects(node: LayoutNode, absX: number, absY: number): {
|
|
97
|
+
element: Element;
|
|
98
|
+
rect: Rect;
|
|
99
|
+
}[];
|
|
62
100
|
/** Where a container's bars paint, in absolute cells from its
|
|
63
101
|
* border-box origin (specs/scrolling.md): each bar sits at the inner
|
|
64
102
|
* edge of its reserved band (`scrollbar-inset` moves it inward, the
|
package/dist/plain-text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAA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AAChC,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;wEAIwE;AACxE,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAM7B"}
|
package/dist/pointer.d.ts
CHANGED
|
@@ -20,6 +20,23 @@ export interface HitEntry {
|
|
|
20
20
|
* TOPMOST in paint order (z-index, document-order ties), matching
|
|
21
21
|
* what the grid shows at that cell. */
|
|
22
22
|
export declare function hitStack(root: LayoutNode, col: number, row: number): HitEntry[];
|
|
23
|
-
/**
|
|
23
|
+
/** Inside an `inert` subtree: absent for user interaction, as natively
|
|
24
|
+
* — no hover, no wheel routing, no thumb drag, no focus, no text
|
|
25
|
+
* selection. */
|
|
26
|
+
export declare function isInert(element: Element): boolean;
|
|
27
|
+
/** The hit stack's elements — what the synthesized states mark — cut
|
|
28
|
+
* at the first inert one, where native :hover stops too. */
|
|
24
29
|
export declare function hitChain(root: LayoutNode, col: number, row: number): Element[];
|
|
30
|
+
/** The cells to try for the character nearest `(col, row)`, in the
|
|
31
|
+
* order the browser's closest-position rule would (specs/
|
|
32
|
+
* wide-characters.md): the cell itself, then its row leftward — a hit
|
|
33
|
+
* there is the point AFTER that character — and rightward (BEFORE it),
|
|
34
|
+
* then the rows above and below, farther out each step, an upper row
|
|
35
|
+
* from its end and a lower one from its start. The cell is clamped to
|
|
36
|
+
* the grid, so a pointer past the host runs to the text's ends. */
|
|
37
|
+
export declare function nearestCells(width: number, height: number, col: number, row: number): Generator<{
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
edge: "self" | "start" | "end";
|
|
41
|
+
}>;
|
|
25
42
|
//# sourceMappingURL=pointer.d.ts.map
|
package/dist/pointer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../src/pointer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB;4CACwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;uCAKuC;AACvC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CA6B/E;AAED,
|
|
1
|
+
{"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../src/pointer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB;4CACwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;uCAKuC;AACvC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CA6B/E;AAED;;gBAEgB;AAChB,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAGjD;AAED;4DAC4D;AAC5D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAO9E;AAED;;;;;;mEAMmE;AACnE,wBAAiB,YAAY,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,SAAS,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;CAAE,CAAC,CAWrE"}
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAW,MAAM,YAAY,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAY7C"}
|
package/dist/selection.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ export declare function selectionRangeThrough(shadowRoot: ShadowRoot): BoundaryP
|
|
|
38
38
|
* or anywhere else — including straddling the two. */
|
|
39
39
|
export type SelectionKind = "grid" | "light" | "outside";
|
|
40
40
|
export declare function classifySelection(host: Element, grid: Element, range: BoundaryPoints): SelectionKind;
|
|
41
|
+
/** The text leaves a light-DOM range reaches, each with the character
|
|
42
|
+
* range the paint inverts (specs/wide-characters.md "The grid paints
|
|
43
|
+
* the selection"): a leaf inside the range whole, a boundary leaf from
|
|
44
|
+
* or to the point's character, a renderer leaf whole. */
|
|
45
|
+
export declare function selectedRanges(root: LayoutNode, points: BoundaryPoints): Map<LayoutNode, {
|
|
46
|
+
start: number;
|
|
47
|
+
end: number;
|
|
48
|
+
}>;
|
|
41
49
|
/** `text/plain` for a light-DOM selection (specs/semantic-selection.md
|
|
42
50
|
* "Copy serialization"): every node the range intersects, in tree
|
|
43
51
|
* order, laid out by the `innerText` rules — a `<p>` surrounded by a
|
|
@@ -47,6 +55,16 @@ export declare function classifySelection(host: Element, grid: Element, range: B
|
|
|
47
55
|
* engine's out-of-flow boxes; this restores what they would have
|
|
48
56
|
* produced in flow. */
|
|
49
57
|
export declare function serializeSelection(root: LayoutNode, points: BoundaryPoints): string;
|
|
58
|
+
interface Point {
|
|
59
|
+
node: Node;
|
|
60
|
+
offset: number;
|
|
61
|
+
}
|
|
62
|
+
/** The DOM extent of a leaf's run — its first mapped character or
|
|
63
|
+
* inline box through its last; null for a run with neither. */
|
|
64
|
+
export declare function leafExtent(leaf: LayoutNode): {
|
|
65
|
+
start: Point;
|
|
66
|
+
end: Point;
|
|
67
|
+
} | null;
|
|
50
68
|
/** A node whose text is painted: text and no in-flow children (the
|
|
51
69
|
* paint walk's own test); renderer leaves included. */
|
|
52
70
|
export declare function isTextLeaf(node: LayoutNode): boolean;
|
|
@@ -58,4 +76,5 @@ export declare function wordAt(leaf: LayoutNode, index: number): {
|
|
|
58
76
|
start: number;
|
|
59
77
|
end: number;
|
|
60
78
|
} | null;
|
|
79
|
+
export {};
|
|
61
80
|
//# sourceMappingURL=selection.d.ts.map
|
package/dist/selection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../src/selection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;;;;GAKG;AAEH,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAShG;AAED;;;;+CAI+C;AAC/C,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAwBrF;AAED;kEACkE;AAClE,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,IAAI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;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAMpD;AAuDD;;;qCAGqC;AACrC,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAe7F"}
|
package/dist/style.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CellMetrics, CellStyle, GridAreas, GridLine, GridTemplate } from "./types.ts";
|
|
1
|
+
import type { Overflow, CellMetrics, CellStyle, GridAreas, GridLine, GridTemplate } from "./types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Read the interpreted CellStyle for an element from its computed CSS.
|
|
4
4
|
*
|
|
@@ -17,6 +17,14 @@ export declare function readCellStyle(el: Element, rootFontSizePx: number, metri
|
|
|
17
17
|
* cover happy-dom (test env), which leaves some computed values
|
|
18
18
|
* unresolved. */
|
|
19
19
|
export declare function isTransparentColor(value: string): boolean;
|
|
20
|
+
/** Per-axis overflow (specs/scrolling.md). Longhands read first (the
|
|
21
|
+
* shorthand sets both in real browsers; happy-dom may leave them "",
|
|
22
|
+
* hence the fallback), then the CSS coercion: one non-visible axis
|
|
23
|
+
* forces the other's `visible` to compute `auto`. */
|
|
24
|
+
export declare function readOverflow(cs: CSSStyleDeclaration): Overflow;
|
|
25
|
+
/** The text properties a leaf takes from its own element — the host's
|
|
26
|
+
* contribution to the root leaf too (specs/host-leaf.md). */
|
|
27
|
+
export declare function readTextStyle(el: Element, cs: CSSStyleDeclaration, rootFontSizePx: number): Pick<CellStyle, "whiteSpace" | "tabSize" | "textOverflow" | "textDecorationLine" | "textAlignBlocked" | "textAlign" | "textIndent">;
|
|
20
28
|
/** Extra cells after each character: floor((letter-spacing − root
|
|
21
29
|
* letter-spacing) ÷ 0.025em), never negative (specs/cell-model.md). The
|
|
22
30
|
* root's own letter-spacing is part of the cell, so only the excess over
|
package/dist/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,QAAQ,EAIR,WAAW,EACX,SAAS,EAIT,SAAS,EAET,QAAQ,EACR,YAAY,EAUb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,OAAO,EACX,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,WAAW,GACpB,SAAS,CAqQX;AA8BD;;;;iBAIiB;AACjB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CASzD;AAmFD;;;qDAGqD;AACrD,wBAAgB,YAAY,CAAC,EAAE,EAAE,mBAAmB,GAAG,QAAQ,CAM9D;AAqED;6DAC6D;AAC7D,wBAAgB,aAAa,CAC3B,EAAE,EAAE,OAAO,EACX,EAAE,EAAE,mBAAmB,EACvB,cAAc,EAAE,MAAM,GACrB,IAAI,CACL,SAAS,EACP,YAAY,GACZ,SAAS,GACT,cAAc,GACd,oBAAoB,GACpB,kBAAkB,GAClB,WAAW,GACX,YAAY,CACf,CAkBA;AAqLD;;;uCAGuC;AACvC,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CAKR;AAufD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,YAAY,CAsDtF;AAgCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAoCtE;AA8GD;;yEAEyE;AACzE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CA0BrD"}
|
package/dist/tree.d.ts
CHANGED
|
@@ -22,11 +22,18 @@ export type TextareaWidths = Map<HTMLTextAreaElement, number>;
|
|
|
22
22
|
* - Elements with at least one in-flow block-level element child become
|
|
23
23
|
* **containers** and recurse. Direct text nodes on containers (uncommon
|
|
24
24
|
* in utility-first markup) are not laid out — a documented deviation.
|
|
25
|
+
* - The host follows the same rule through `buildRootLeaf`
|
|
26
|
+
* (specs/host-leaf.md).
|
|
25
27
|
*
|
|
26
28
|
* `cellMetrics` (measured by the host) is the basis for leading and
|
|
27
29
|
* tracking; absent in headless tests (see readCellStyle).
|
|
28
30
|
*/
|
|
29
31
|
export declare function buildTree(root: Element, rootFontSizePx: number, cellMetrics?: CellMetrics, textareaWidths?: TextareaWidths): LayoutNode | null;
|
|
32
|
+
/** The host's own inline content as the ROOT leaf (specs/host-leaf.md):
|
|
33
|
+
* null when an element child is block-level (the host is a container)
|
|
34
|
+
* or there is no inline content at all (the empty root). The metrics
|
|
35
|
+
* probe is never part of the run. */
|
|
36
|
+
export declare function buildRootLeaf(host: Element, rootFontSizePx: number, cellMetrics?: CellMetrics, textareaWidths?: TextareaWidths): LayoutNode | null;
|
|
30
37
|
/** True if `el` has any direct text child that isn't just whitespace. */
|
|
31
38
|
export declare function hasDirectText(el: Element): boolean;
|
|
32
39
|
/** Author-facing warning when direct text can't be laid out alongside
|
package/dist/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../src/tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../src/tree.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAA4B,UAAU,EAAW,MAAM,YAAY,CAAC;AAE7F;;;;4DAI4D;AAC5D,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,cAAc,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,WAAW,EACzB,cAAc,CAAC,EAAE,cAAc,GAC9B,UAAU,GAAG,IAAI,CAwCnB;AAQD;;;qCAGqC;AACrC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,OAAO,EACb,cAAc,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,WAAW,EACzB,cAAc,CAAC,EAAE,cAAc,GAC9B,UAAU,GAAG,IAAI,CAWnB;AAopBD,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAIlD;AAED;;oCAEoC;AACpC,eAAO,MAAM,mBAAmB,QAE6B,CAAC;AAE9D;8DAC8D;AAC9D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
package/dist/width.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell widths of grapheme clusters (specs/wide-characters.md): the
|
|
3
|
+
* `wcwidth` convention terminals use, from Unicode tables rather than
|
|
4
|
+
* the font — East Asian Wide and Fullwidth clusters and
|
|
5
|
+
* emoji-presentation clusters take two cells, default-ignorable
|
|
6
|
+
* clusters none, everything else one. The layout is therefore the same
|
|
7
|
+
* in every engine and font, and the Node renderer needs no font.
|
|
8
|
+
*/
|
|
9
|
+
/** Cells one grapheme cluster occupies. */
|
|
10
|
+
export declare function clusterWidth(cluster: string): 0 | 1 | 2;
|
|
11
|
+
/** The grapheme clusters of `text`, in order. ASCII text needs no
|
|
12
|
+
* segmentation; without `Intl.Segmenter` code points stand in. */
|
|
13
|
+
export declare function graphemes(text: string): string[];
|
|
14
|
+
/** A cluster's cells plus `tracking`; a 0-width cluster gets neither. */
|
|
15
|
+
export declare function clusterAdvance(cluster: string, tracking: number): number;
|
|
16
|
+
/** Code-unit-indexed advances for `text`: a cluster's advance on its
|
|
17
|
+
* first unit, 0 on the rest — the shape every per-character array
|
|
18
|
+
* takes (specs/wide-characters.md). */
|
|
19
|
+
export declare function clusterAdvances(text: string, tracking?: number): number[];
|
|
20
|
+
/** Cells `text` occupies on one line. */
|
|
21
|
+
export declare function textCells(text: string): number;
|
|
22
|
+
//# sourceMappingURL=width.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"width.d.ts","sourceRoot":"","sources":["../src/width.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+EH,2CAA2C;AAC3C,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAoBvD;AAMD;kEACkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAUhD;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED;;uCAEuC;AACvC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,EAAE,CAOpE;AAED,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9C"}
|
package/dist/wrap.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare function advanceOf(start: number, end: number, advances?: number[
|
|
|
53
53
|
* tracked inline element's larger gap stays counted: browsers keep it at a
|
|
54
54
|
* line end, and the engine doesn't cancel it (uniform across engines).
|
|
55
55
|
*/
|
|
56
|
-
export declare function lineAdvance(start: number, end: number, advances?: number[], tracking?: number): number;
|
|
56
|
+
export declare function lineAdvance(text: string, start: number, end: number, advances?: number[], tracking?: number): number;
|
|
57
57
|
/** Widest unbreakable unit (breakable segment) in the text — the
|
|
58
58
|
* min-content width of a wrapping leaf. */
|
|
59
59
|
export declare function longestSegmentAdvance(text: string, options?: WrapOptions): number;
|
package/dist/wrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../src/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../src/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,wEAAwE;AACxE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;mEAE+D;IAC/D,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,EAAE,CAE1F;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAE5F;AAUD,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAUtD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,QAAQ,EAAE,CAgBhG;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAKjF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,QAAQ,SAAI,GACX,MAAM,CAGR;AAaD;2CAC2C;AAC3C,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAYrF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED;;sCAEsC;AACtC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C;;;;;;2DAM2D;AAC3D,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC;;iBAEiB;AACjB,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EACvB,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GACnD,IAAI,CAON"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monowind",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Text-based user interfaces (TUI) on the web, from ordinary HTML and Tailwind utility classes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ascii",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@tailwindcss/browser": "^4.3.3",
|
|
39
39
|
"@vitest/coverage-v8": "4.1.11",
|
|
40
|
-
"happy-dom": "^20.
|
|
40
|
+
"happy-dom": "^20.14.0",
|
|
41
41
|
"tailwindcss": "^4.3.3",
|
|
42
42
|
"typescript": "^7.0.2",
|
|
43
43
|
"vite": "^8.2.2",
|
package/src/styles.css
CHANGED
|
@@ -188,23 +188,28 @@ mono-wind[select="grid"][data-mw-dragging]
|
|
|
188
188
|
* would select it. Lifted with a semantic selection
|
|
189
189
|
* (specs/semantic-selection.md). Editable controls keep their own
|
|
190
190
|
* selection (Firefox honors an explicit `none` on a text field's
|
|
191
|
-
* value; the slot's inherited value never reached it).
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
* value; the slot's inherited value never reached it). `:where()` keeps
|
|
192
|
+
* the rule at base specificity so the coarse-pointer rule below wins.
|
|
193
|
+
* The host's own text (specs/host-leaf.md) takes the host's value in
|
|
194
|
+
* Firefox, so the leaf host is locked too. */
|
|
195
|
+
mono-wind[select="grid"]:where(:not([data-mw-semantic-selection]))[data-mw-leaf],
|
|
196
|
+
mono-wind[select="grid"]:where(:not([data-mw-semantic-selection]))
|
|
197
|
+
:where(:not(input, textarea, [contenteditable], [contenteditable] *)) {
|
|
194
198
|
user-select: none;
|
|
195
199
|
-webkit-user-select: none;
|
|
196
200
|
}
|
|
197
201
|
/* Touch panning (specs/scrolling.md): where the primary pointer is a
|
|
198
|
-
* finger, scroll
|
|
199
|
-
* drag pans
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
202
|
+
* finger, a scroll container's subtree takes pointer events in grid
|
|
203
|
+
* mode so a drag pans it NATIVELY (physics, momentum, chaining — the
|
|
204
|
+
* pan reaches the container from any descendant) and a long-press
|
|
205
|
+
* selects the element's text under the finger (an element selection,
|
|
206
|
+
* copied by the engine like a semantic one). The leaves must take the
|
|
207
|
+
* touch themselves: WebKit resolves the pressed text position inside
|
|
208
|
+
* the touched element, and on the container it falls back to the
|
|
209
|
+
* first positioned leaf. */
|
|
203
210
|
@media (pointer: coarse) {
|
|
204
|
-
mono-wind[select="grid"] [data-mw-scroll] {
|
|
205
|
-
pointer-events: auto !important;
|
|
206
|
-
}
|
|
207
211
|
mono-wind[select="grid"] :is([data-mw-scroll], [data-mw-scroll] *) {
|
|
212
|
+
pointer-events: auto !important;
|
|
208
213
|
user-select: text;
|
|
209
214
|
-webkit-user-select: text;
|
|
210
215
|
}
|
|
@@ -258,28 +263,24 @@ mono-wind:not([data-mw-ready]) {
|
|
|
258
263
|
visibility: hidden !important;
|
|
259
264
|
}
|
|
260
265
|
|
|
261
|
-
/*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
mono-wind:not([measuring]) :focus-visible::selection {
|
|
280
|
-
color: var(--mw-fg, canvastext) !important;
|
|
281
|
-
text-shadow: 0 0 0 var(--mw-fg, canvastext) !important;
|
|
282
|
-
background: var(--mw-bg, canvas) !important;
|
|
266
|
+
/* A light-DOM selection is painted on the grid — inverted cells from the
|
|
267
|
+
* live range (specs/wide-characters.md "The grid paints the selection")
|
|
268
|
+
* — so the browser's own highlight on the invisible native text stays
|
|
269
|
+
* invisible: every field, as some engines keep an OS default background
|
|
270
|
+
* when only `color` is set, and Safari's text-shadow ink. Shadow scopes
|
|
271
|
+
* can't share the rule: element.ts (the slot) and @monowind/ascii's
|
|
272
|
+
* transcript restate it — update all three together. Form controls
|
|
273
|
+
* render their own text and keep their native highlight; forced
|
|
274
|
+
* colors paint selections themselves and strip backgrounds, so the
|
|
275
|
+
* native highlight stays there. */
|
|
276
|
+
@media (forced-colors: none) {
|
|
277
|
+
mono-wind:not([measuring])[data-mw-leaf]::selection,
|
|
278
|
+
mono-wind:not([measuring])
|
|
279
|
+
:where(:not(input, textarea, select, [contenteditable], [contenteditable] *))::selection {
|
|
280
|
+
color: transparent !important;
|
|
281
|
+
text-shadow: none !important;
|
|
282
|
+
background: transparent !important;
|
|
283
|
+
}
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
/* === Typography locks and measuring gates ============================ */
|
|
@@ -372,7 +373,11 @@ mono-wind:not([measuring]) * {
|
|
|
372
373
|
* the ink while computed `color` stays LIVE — authored transitions run
|
|
373
374
|
* on it for real and the engine samples true mid-fade values (the
|
|
374
375
|
* animation loop, element.ts). Decoration ink follows `color`, so it
|
|
375
|
-
* needs its own transparent lock (the grid paints decorations).
|
|
376
|
+
* needs its own transparent lock (the grid paints decorations).
|
|
377
|
+
* `[data-mw-leaf]` is the host with its own text as the root leaf
|
|
378
|
+
* (specs/host-leaf.md): every rule that shapes a leaf's native text
|
|
379
|
+
* carries this host variant — render.ts writes the host's flags. */
|
|
380
|
+
mono-wind:not([measuring])[data-mw-leaf],
|
|
376
381
|
mono-wind:not([measuring]) *:not(input):not(textarea):not(select) {
|
|
377
382
|
-webkit-text-fill-color: transparent !important;
|
|
378
383
|
text-decoration-color: transparent !important;
|
|
@@ -391,6 +396,7 @@ mono-wind:not([measuring]) select {
|
|
|
391
396
|
/* Author-requested `white-space: nowrap` (or `pre`) — the engine sized this
|
|
392
397
|
* box for unwrapped hard lines, so the browser must not wrap either. Wins
|
|
393
398
|
* over the lock above on specificity. */
|
|
399
|
+
mono-wind:not([measuring])[data-mw-nowrap],
|
|
394
400
|
mono-wind:not([measuring]) [data-mw-nowrap] {
|
|
395
401
|
white-space: nowrap !important;
|
|
396
402
|
}
|
|
@@ -400,6 +406,8 @@ mono-wind:not([measuring]) [data-mw-nowrap] {
|
|
|
400
406
|
* them too — on the leaf AND its inline descendants (the lock above would
|
|
401
407
|
* collapse text inside nested spans). Later than the nowrap rule, so it
|
|
402
408
|
* wins on the leaf itself at equal specificity. */
|
|
409
|
+
mono-wind:not([measuring])[data-mw-pre],
|
|
410
|
+
mono-wind:not([measuring])[data-mw-pre] *,
|
|
403
411
|
mono-wind:not([measuring]) [data-mw-pre],
|
|
404
412
|
mono-wind:not([measuring]) [data-mw-pre] * {
|
|
405
413
|
white-space: pre !important;
|
|
@@ -603,20 +611,12 @@ mono-wind:not([measuring]) [data-mw-multicol-flow] {
|
|
|
603
611
|
* root font size, not the cell width, so the transparent light-DOM
|
|
604
612
|
* text drifts out from under the grid's paint. Rewrite it in cells so
|
|
605
613
|
* the two agree — selection ranges land exactly where the glyphs are. */
|
|
614
|
+
mono-wind:not([measuring])[data-mw-leaf],
|
|
606
615
|
mono-wind:not([measuring]) [data-mw-laid-out],
|
|
607
616
|
mono-wind:not([measuring]) [data-mw-multicol-flow] {
|
|
608
617
|
text-indent: calc(var(--mw-ti, 0) * var(--mw-cw, 1px)) !important;
|
|
609
618
|
}
|
|
610
619
|
|
|
611
|
-
/* Centered text with uniform odd leftover (specs/cell-model.md "Text
|
|
612
|
-
* alignment"): the browser's fractional centering sits half a cell
|
|
613
|
-
* right of the grid's floor()'d paint — nudge the native copy onto the
|
|
614
|
-
* glyphs. `transform`, not `translate`: the spanner rule owns the
|
|
615
|
-
* latter, and the two compose. */
|
|
616
|
-
mono-wind:not([measuring]) [data-mw-center-nudge] {
|
|
617
|
-
transform: translateX(calc(-0.5 * var(--mw-cw, 1px))) !important;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
620
|
/* In-flow multicol SPANNER (specs/multicol.md): a normally laid-out box
|
|
621
621
|
* that stays in the native flow so paragraphs fragment around it —
|
|
622
622
|
* engine-forced geometry (the shared rule above), quantized margins,
|
|
@@ -687,11 +687,11 @@ mono-wind:not([measuring]) [data-mw-inline-inset] {
|
|
|
687
687
|
|
|
688
688
|
/* A container whose direct text was dropped (mixed text + block children,
|
|
689
689
|
* cell-model deviation): the browser would paint that text unpositioned
|
|
690
|
-
* over the laid-out children, so hide it
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
|
|
690
|
+
* over the laid-out children, so hide it — the host's own through its
|
|
691
|
+
* shadow slot (element.ts), a nested container's through itself.
|
|
692
|
+
* `visibility` is inherited AND resettable, so the laid-out children come
|
|
693
|
+
* back — only in this warned state, which is why the reset may also
|
|
694
|
+
* override an authored `invisible` utility there. */
|
|
695
695
|
mono-wind:not([measuring]) [data-mw-dropped-text] {
|
|
696
696
|
visibility: hidden !important;
|
|
697
697
|
}
|
|
@@ -709,6 +709,7 @@ mono-wind:not([measuring]) [data-mw-table-hidden] {
|
|
|
709
709
|
/* Force off-grid text alignments back to `start`. `text-left`/`right`/`start`/
|
|
710
710
|
* `end` all land on whole cells (offset = (W - N) × cell width); `center` and
|
|
711
711
|
* `justify` produce fractional per-line offsets we can't snap to the grid. */
|
|
712
|
+
mono-wind:not([measuring])[data-mw-text-align-blocked],
|
|
712
713
|
mono-wind:not([measuring]) [data-mw-text-align-blocked] {
|
|
713
714
|
text-align: start !important;
|
|
714
715
|
}
|