monowind 0.2.7 → 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.
@@ -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;;;;;;;GAOG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAiBvF;AAED,qDAAqD;AACrD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAErD;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEtD;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACxC;wEACoE;IACpE,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjE;8CAC0C;IAC1C,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;CAC3C;AAED,wBAAgB,kBAAkB,IAAI,cAAc,CAOnD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,E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gB,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, holdStructural?: boolean): boolean;
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
@@ -1 +1 @@
1
- {"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../src/paint.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA+B7C;;0DAE0D;AAC1D,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,UAAQ,GAAG,OAAO,CAmDhG;AAwFD,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAUvF"}
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"}
@@ -12,6 +12,9 @@ import type { LayoutNode, Rect } 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,21 +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
42
  /** One row of same-paint runs. Joining every segment's text gives the
36
43
  * row at the grid's full width (specs/cell-model.md "Selection"): the
37
44
  * <pre> is a rectangle of cells, so a drag's highlight sweeps whole
38
- * rows and a copy is the visible rectangle. */
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. */
39
48
  export interface CellSegment extends CellPaint {
40
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
+ }>;
41
62
  }
42
63
  /** Row-major cell segments. Each row is `rowSegments(grid[y],
43
64
  * paints[y])` — the DOM adapter (paint.ts) uses this, and tests
44
65
  * assert paint fields against it. */
45
- 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
+ };
46
73
  export declare function samePaint(a: CellPaint, b: CellPaint | undefined): boolean;
47
74
  /** Apply a `CellPaint` to a `CSSStyleDeclaration`. Kept in this file
48
- * 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. */
49
77
  export declare function applyCellPaint(paint: CellPaint, style: CSSStyleDeclaration): void;
50
78
  /** True when a segment carries no paint — the DOM adapter emits a bare
51
79
  * text node for these instead of an empty <span>. */
@@ -1 +1 @@
1
- {"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAIxD;AAED;;;uEAGuE;AACvE,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;sEACkE;IAClE,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;sEAGkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;+CAG+C;AAC/C,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;AAgBD,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CASzE;AAED;uEACuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,E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AAW,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
@@ -27,4 +27,16 @@ export declare function isInert(element: Element): boolean;
27
27
  /** The hit stack's elements — what the synthesized states mark — cut
28
28
  * at the first inert one, where native :hover stops too. */
29
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
+ }>;
30
42
  //# sourceMappingURL=pointer.d.ts.map
@@ -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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.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"}
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"}
@@ -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
@@ -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;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AW,CAAC,EAAE,WAAW,EACzB,cAAc,CAAC,EAAE,cAAc,GAC9B,UAAU,GAAG,IAAI,CAWnB;AAioBD,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"}
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"}
@@ -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;
@@ -1 +1 @@
1
- {"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../src/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,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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+ "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",
package/src/styles.css CHANGED
@@ -199,16 +199,17 @@ mono-wind[select="grid"]:where(:not([data-mw-semantic-selection]))
199
199
  -webkit-user-select: none;
200
200
  }
201
201
  /* Touch panning (specs/scrolling.md): where the primary pointer is a
202
- * finger, scroll containers take pointer events in grid mode so a
203
- * drag pans them NATIVELY (physics, momentum, chaining)their
204
- * children stay inert, so the touch lands on the container itself.
205
- * A long-press there selects the element's text (an element
206
- * selection, copied by the engine like a semantic one). */
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. */
207
210
  @media (pointer: coarse) {
208
- mono-wind[select="grid"] [data-mw-scroll] {
209
- pointer-events: auto !important;
210
- }
211
211
  mono-wind[select="grid"] :is([data-mw-scroll], [data-mw-scroll] *) {
212
+ pointer-events: auto !important;
212
213
  user-select: text;
213
214
  -webkit-user-select: text;
214
215
  }
@@ -262,29 +263,24 @@ mono-wind:not([data-mw-ready]) {
262
263
  visibility: hidden !important;
263
264
  }
264
265
 
265
- /* Full invert on selectionTHE CANONICAL RULE; shadow scopes can't
266
- * share it, so it's restated in element.ts (the grid) and in
267
- * @monowind/ascii's transcript: update all three together. Both
268
- * fields spelled out setting only `color` makes some engines drop
269
- * the OS default background. The text-shadow is the ink in Safari:
270
- * it paints selection text with the element's text-fill-color — which
271
- * the invisibility lock holds transparent so a zero-offset shadow
272
- * draws the glyph copy that `color` draws in other engines (where the
273
- * identical-color shadow hides beneath it). Native copy still yields
274
- * the real text (the DOM the browser reads). */
275
- mono-wind:not([measuring])[data-mw-leaf]::selection,
276
- mono-wind:not([measuring]) *::selection {
277
- color: var(--mw-bg, canvas) !important;
278
- text-shadow: 0 0 0 var(--mw-bg, canvas) !important;
279
- background: var(--mw-fg, canvastext) !important;
280
- }
281
- /* Focus-invert already flipped the element's colors, so re-flipping in
282
- * ::selection would land on the same colors as the focused bg and hide
283
- * the selection. Swap them back for the focused element. */
284
- mono-wind:not([measuring]) :focus-visible::selection {
285
- color: var(--mw-fg, canvastext) !important;
286
- text-shadow: 0 0 0 var(--mw-fg, canvastext) !important;
287
- 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
+ }
288
284
  }
289
285
 
290
286
  /* === Typography locks and measuring gates ============================ */
@@ -621,15 +617,6 @@ mono-wind:not([measuring]) [data-mw-multicol-flow] {
621
617
  text-indent: calc(var(--mw-ti, 0) * var(--mw-cw, 1px)) !important;
622
618
  }
623
619
 
624
- /* Centered text with uniform odd leftover (specs/cell-model.md "Text
625
- * alignment"): the browser's fractional centering sits half a cell
626
- * right of the grid's floor()'d paint — nudge the native copy onto the
627
- * glyphs. `transform`, not `translate`: the spanner rule owns the
628
- * latter, and the two compose. */
629
- mono-wind:not([measuring]) [data-mw-center-nudge] {
630
- transform: translateX(calc(-0.5 * var(--mw-cw, 1px))) !important;
631
- }
632
-
633
620
  /* In-flow multicol SPANNER (specs/multicol.md): a normally laid-out box
634
621
  * that stays in the native flow so paragraphs fragment around it —
635
622
  * engine-forced geometry (the shared rule above), quantized margins,