monowind 0.2.5 → 0.2.7
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 +12 -0
- package/dist/cdn.js +99 -41
- 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/index.js +1520 -1256
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/paint.d.ts +1 -0
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +14 -4
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/pointer.d.ts +6 -1
- package/dist/pointer.d.ts.map +1 -1
- package/dist/selection.d.ts +11 -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/package.json +2 -2
- package/src/styles.css +57 -8
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;;;;;;;GAOG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EA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and a selection
|
|
4
4
|
* anchor is in the grid — repeat the paint on release. */
|
|
5
5
|
export declare function paintGrid(root: LayoutNode, target: HTMLElement, holdStructural?: boolean): boolean;
|
|
6
|
+
export declare function nodeAtOffset(target: HTMLElement, offset: number): [Text, number] | null;
|
|
6
7
|
//# 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":"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"}
|
|
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"}
|
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
|
|
@@ -32,9 +32,10 @@ export interface CellPaint {
|
|
|
32
32
|
* `"0"` still paints: the glyphs stay selectable in grid mode. */
|
|
33
33
|
opacity?: string;
|
|
34
34
|
}
|
|
35
|
-
/** One row of same-paint runs. Joining every segment's text
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
/** One row of same-paint runs. Joining every segment's text gives the
|
|
36
|
+
* row at the grid's full width (specs/cell-model.md "Selection"): the
|
|
37
|
+
* <pre> is a rectangle of cells, so a drag's highlight sweeps whole
|
|
38
|
+
* rows and a copy is the visible rectangle. */
|
|
38
39
|
export interface CellSegment extends CellPaint {
|
|
39
40
|
text: string;
|
|
40
41
|
}
|
|
@@ -59,6 +60,15 @@ export declare function leafLineCovers(node: LayoutNode, absX: number, absY: num
|
|
|
59
60
|
* null for a blank cell (specs/semantic-selection.md). `absX/absY` is
|
|
60
61
|
* the leaf's painted border-box origin as hitStack reports it. */
|
|
61
62
|
export declare function charIndexAtCell(node: LayoutNode, absX: number, absY: number, col: number, row: number): number | null;
|
|
63
|
+
/** The cells a leaf's inline elements cover, one rect per element per
|
|
64
|
+
* row — the span of its characters and pad cells there, an outer
|
|
65
|
+
* element's including its inline descendants' — in run order then row
|
|
66
|
+
* order, elements without a cell left out (specs/focus-navigation.md).
|
|
67
|
+
* `absX/absY` as for charIndexAtCell. */
|
|
68
|
+
export declare function inlineElementRects(node: LayoutNode, absX: number, absY: number): {
|
|
69
|
+
element: Element;
|
|
70
|
+
rect: Rect;
|
|
71
|
+
}[];
|
|
62
72
|
/** Where a container's bars paint, in absolute cells from its
|
|
63
73
|
* border-box origin (specs/scrolling.md): each bar sits at the inner
|
|
64
74
|
* 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,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../src/plain-text.ts"],"names":[],"mappings":"AAMA,OAAO,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AAE,MAAM,GACV,MAAM,GAAG,IAAI,CAWf;AAED;;;;yCAIyC;AACzC,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EAAE,CAkCpC;AAED;;;;;;4BAM4B;AAC5B,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX;IAAE,CAAC,CAAC,EAAE,SAAS,CAAC;IAAC,CAAC,CAAC,EAAE,SAAS,CAAA;CAAE,CA8BlC;AAED;gCACgC;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,11 @@ 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[];
|
|
25
30
|
//# 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"}
|
package/dist/selection.d.ts
CHANGED
|
@@ -47,6 +47,16 @@ export declare function classifySelection(host: Element, grid: Element, range: B
|
|
|
47
47
|
* engine's out-of-flow boxes; this restores what they would have
|
|
48
48
|
* produced in flow. */
|
|
49
49
|
export declare function serializeSelection(root: LayoutNode, points: BoundaryPoints): string;
|
|
50
|
+
interface Point {
|
|
51
|
+
node: Node;
|
|
52
|
+
offset: number;
|
|
53
|
+
}
|
|
54
|
+
/** The DOM extent of a leaf's run — its first mapped character or
|
|
55
|
+
* inline box through its last; null for a run with neither. */
|
|
56
|
+
export declare function leafExtent(leaf: LayoutNode): {
|
|
57
|
+
start: Point;
|
|
58
|
+
end: Point;
|
|
59
|
+
} | null;
|
|
50
60
|
/** A node whose text is painted: text and no in-flow children (the
|
|
51
61
|
* paint walk's own test); renderer leaves included. */
|
|
52
62
|
export declare function isTextLeaf(node: LayoutNode): boolean;
|
|
@@ -58,4 +68,5 @@ export declare function wordAt(leaf: LayoutNode, index: number): {
|
|
|
58
68
|
start: number;
|
|
59
69
|
end: number;
|
|
60
70
|
} | null;
|
|
71
|
+
export {};
|
|
61
72
|
//# 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,K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,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":"AAqBA,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;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monowind",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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
|
@@ -149,6 +149,14 @@
|
|
|
149
149
|
color: var(--mw-bg);
|
|
150
150
|
caret-color: var(--mw-bg);
|
|
151
151
|
}
|
|
152
|
+
/* Grid-mode light elements carry the grid's text cursor: Firefox
|
|
153
|
+
* hit-tests a multicol spanner's anonymous wrapper as its container
|
|
154
|
+
* despite `pointer-events: none`, and would show an arrow there.
|
|
155
|
+
* Interactives keep their own (UA and authored cursors win). */
|
|
156
|
+
mono-wind[select="grid"]
|
|
157
|
+
[data-mw-laid-out]:not(a, button, input, select, textarea, label, [tabindex], [role="button"]) {
|
|
158
|
+
cursor: text;
|
|
159
|
+
}
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
/* === Modes and selection (engine-owned from here down) =============== */
|
|
@@ -156,7 +164,9 @@
|
|
|
156
164
|
/* select="grid": pass pointer events through non-interactive light-DOM
|
|
157
165
|
* elements so drag lands on the grid <pre> (native drag-selection of
|
|
158
166
|
* the ASCII); interactives opt back into `auto` so clicks still work.
|
|
159
|
-
* (The slot itself is pointer-events: none in the shadow CSS.)
|
|
167
|
+
* (The slot itself is pointer-events: none in the shadow CSS.) The
|
|
168
|
+
* interactive list is mirrored by INTERACTIVE in element.ts and by the
|
|
169
|
+
* two rules below — change all of them together. */
|
|
160
170
|
mono-wind[select="grid"] * {
|
|
161
171
|
pointer-events: none !important;
|
|
162
172
|
}
|
|
@@ -164,15 +174,44 @@ mono-wind[select="grid"]
|
|
|
164
174
|
:is(a, button, input, select, textarea, label, [tabindex], [role="button"]) {
|
|
165
175
|
pointer-events: auto !important;
|
|
166
176
|
}
|
|
177
|
+
/* While a drag that began on the grid is in flight, interactives drop
|
|
178
|
+
* their pointer events too, so the native selection sweeps through
|
|
179
|
+
* their cells instead of stalling at their edge (a click is a press and
|
|
180
|
+
* release in place — unaffected). */
|
|
181
|
+
mono-wind[select="grid"][data-mw-dragging]
|
|
182
|
+
:is(a, button, input, select, textarea, label, [tabindex], [role="button"]) {
|
|
183
|
+
pointer-events: none !important;
|
|
184
|
+
}
|
|
185
|
+
/* The grid-mode selection lock, explicit on the light DOM: the shadow
|
|
186
|
+
* slot's `user-select: none` reaches slotted content in Chromium and
|
|
187
|
+
* WebKit but not Firefox, where a drag that strays onto a light element
|
|
188
|
+
* would select it. Lifted with a semantic selection
|
|
189
|
+
* (specs/semantic-selection.md). Editable controls keep their own
|
|
190
|
+
* selection (Firefox honors an explicit `none` on a text field's
|
|
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] *)) {
|
|
198
|
+
user-select: none;
|
|
199
|
+
-webkit-user-select: none;
|
|
200
|
+
}
|
|
167
201
|
/* Touch panning (specs/scrolling.md): where the primary pointer is a
|
|
168
202
|
* finger, scroll containers take pointer events in grid mode so a
|
|
169
203
|
* drag pans them NATIVELY (physics, momentum, chaining) — their
|
|
170
204
|
* children stay inert, so the touch lands on the container itself.
|
|
171
|
-
*
|
|
205
|
+
* A long-press there selects the element's text (an element
|
|
206
|
+
* selection, copied by the engine like a semantic one). */
|
|
172
207
|
@media (pointer: coarse) {
|
|
173
208
|
mono-wind[select="grid"] [data-mw-scroll] {
|
|
174
209
|
pointer-events: auto !important;
|
|
175
210
|
}
|
|
211
|
+
mono-wind[select="grid"] :is([data-mw-scroll], [data-mw-scroll] *) {
|
|
212
|
+
user-select: text;
|
|
213
|
+
-webkit-user-select: text;
|
|
214
|
+
}
|
|
176
215
|
}
|
|
177
216
|
|
|
178
217
|
/* Scroll containers (specs/scrolling.md): the gutter ink IS the
|
|
@@ -233,6 +272,7 @@ mono-wind:not([data-mw-ready]) {
|
|
|
233
272
|
* draws the glyph copy that `color` draws in other engines (where the
|
|
234
273
|
* identical-color shadow hides beneath it). Native copy still yields
|
|
235
274
|
* the real text (the DOM the browser reads). */
|
|
275
|
+
mono-wind:not([measuring])[data-mw-leaf]::selection,
|
|
236
276
|
mono-wind:not([measuring]) *::selection {
|
|
237
277
|
color: var(--mw-bg, canvas) !important;
|
|
238
278
|
text-shadow: 0 0 0 var(--mw-bg, canvas) !important;
|
|
@@ -337,7 +377,11 @@ mono-wind:not([measuring]) * {
|
|
|
337
377
|
* the ink while computed `color` stays LIVE — authored transitions run
|
|
338
378
|
* on it for real and the engine samples true mid-fade values (the
|
|
339
379
|
* animation loop, element.ts). Decoration ink follows `color`, so it
|
|
340
|
-
* needs its own transparent lock (the grid paints decorations).
|
|
380
|
+
* needs its own transparent lock (the grid paints decorations).
|
|
381
|
+
* `[data-mw-leaf]` is the host with its own text as the root leaf
|
|
382
|
+
* (specs/host-leaf.md): every rule that shapes a leaf's native text
|
|
383
|
+
* carries this host variant — render.ts writes the host's flags. */
|
|
384
|
+
mono-wind:not([measuring])[data-mw-leaf],
|
|
341
385
|
mono-wind:not([measuring]) *:not(input):not(textarea):not(select) {
|
|
342
386
|
-webkit-text-fill-color: transparent !important;
|
|
343
387
|
text-decoration-color: transparent !important;
|
|
@@ -356,6 +400,7 @@ mono-wind:not([measuring]) select {
|
|
|
356
400
|
/* Author-requested `white-space: nowrap` (or `pre`) — the engine sized this
|
|
357
401
|
* box for unwrapped hard lines, so the browser must not wrap either. Wins
|
|
358
402
|
* over the lock above on specificity. */
|
|
403
|
+
mono-wind:not([measuring])[data-mw-nowrap],
|
|
359
404
|
mono-wind:not([measuring]) [data-mw-nowrap] {
|
|
360
405
|
white-space: nowrap !important;
|
|
361
406
|
}
|
|
@@ -365,6 +410,8 @@ mono-wind:not([measuring]) [data-mw-nowrap] {
|
|
|
365
410
|
* them too — on the leaf AND its inline descendants (the lock above would
|
|
366
411
|
* collapse text inside nested spans). Later than the nowrap rule, so it
|
|
367
412
|
* wins on the leaf itself at equal specificity. */
|
|
413
|
+
mono-wind:not([measuring])[data-mw-pre],
|
|
414
|
+
mono-wind:not([measuring])[data-mw-pre] *,
|
|
368
415
|
mono-wind:not([measuring]) [data-mw-pre],
|
|
369
416
|
mono-wind:not([measuring]) [data-mw-pre] * {
|
|
370
417
|
white-space: pre !important;
|
|
@@ -568,6 +615,7 @@ mono-wind:not([measuring]) [data-mw-multicol-flow] {
|
|
|
568
615
|
* root font size, not the cell width, so the transparent light-DOM
|
|
569
616
|
* text drifts out from under the grid's paint. Rewrite it in cells so
|
|
570
617
|
* the two agree — selection ranges land exactly where the glyphs are. */
|
|
618
|
+
mono-wind:not([measuring])[data-mw-leaf],
|
|
571
619
|
mono-wind:not([measuring]) [data-mw-laid-out],
|
|
572
620
|
mono-wind:not([measuring]) [data-mw-multicol-flow] {
|
|
573
621
|
text-indent: calc(var(--mw-ti, 0) * var(--mw-cw, 1px)) !important;
|
|
@@ -652,11 +700,11 @@ mono-wind:not([measuring]) [data-mw-inline-inset] {
|
|
|
652
700
|
|
|
653
701
|
/* A container whose direct text was dropped (mixed text + block children,
|
|
654
702
|
* cell-model deviation): the browser would paint that text unpositioned
|
|
655
|
-
* over the laid-out children, so hide it
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
|
|
703
|
+
* over the laid-out children, so hide it — the host's own through its
|
|
704
|
+
* shadow slot (element.ts), a nested container's through itself.
|
|
705
|
+
* `visibility` is inherited AND resettable, so the laid-out children come
|
|
706
|
+
* back — only in this warned state, which is why the reset may also
|
|
707
|
+
* override an authored `invisible` utility there. */
|
|
660
708
|
mono-wind:not([measuring]) [data-mw-dropped-text] {
|
|
661
709
|
visibility: hidden !important;
|
|
662
710
|
}
|
|
@@ -674,6 +722,7 @@ mono-wind:not([measuring]) [data-mw-table-hidden] {
|
|
|
674
722
|
/* Force off-grid text alignments back to `start`. `text-left`/`right`/`start`/
|
|
675
723
|
* `end` all land on whole cells (offset = (W - N) × cell width); `center` and
|
|
676
724
|
* `justify` produce fractional per-line offsets we can't snap to the grid. */
|
|
725
|
+
mono-wind:not([measuring])[data-mw-text-align-blocked],
|
|
677
726
|
mono-wind:not([measuring]) [data-mw-text-align-blocked] {
|
|
678
727
|
text-align: start !important;
|
|
679
728
|
}
|