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/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AA2KA,QAAA,MAAM,eAAe,EAEhB,OAAO,WAAW,CAAC;AAExB,qBAAa,eAAgB,SAAQ,eAAe;;IAClD,MAAM,CAAC,kBAAkB,WAAuB;IAyHhD,cAsBC;IAED,iBAAiB,IAAI,IAAI,CAmGxB;IAED,oBAAoB,IAAI,IAAI,CAyC3B;IAmgCD,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CA+B1F;IAED;;;;0DAIsD;IACtD,WAAW,IAAI,MAAM,CAIpB;CA+PF;AAED;+DAC+D;AAC/D,wBAAgB,cAAc,IAAI,IAAI,CAIrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF;AA+CD;;;;;;;;;yDASyD;AACzD,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR"}
|
package/dist/focus.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { LayoutNode, Rect } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Arrow-key focus navigation (specs/focus-navigation.md): the pure
|
|
4
|
+
* part. From the focused element's painted cells, an arrow moves to
|
|
5
|
+
* the nearest focusable element entirely beyond that edge; the element
|
|
6
|
+
* side (`focus="arrows"`) is plumbing around `nextFocus`.
|
|
7
|
+
*/
|
|
8
|
+
export type Direction = "up" | "down" | "left" | "right";
|
|
9
|
+
export interface Focusable {
|
|
10
|
+
element: Element;
|
|
11
|
+
rect: Rect;
|
|
12
|
+
}
|
|
13
|
+
/** The direction an arrow key names; null for any other key. */
|
|
14
|
+
export declare function directionOf(key: string): Direction | null;
|
|
15
|
+
/** The candidate to focus for an arrow from `current`: entirely beyond
|
|
16
|
+
* the edge in that direction; one overlapping `current` across the
|
|
17
|
+
* other axis (aligned) before any that does not; then the nearest
|
|
18
|
+
* along the axis; then the smaller cross-axis gap; then the first in
|
|
19
|
+
* `candidates` (document order). null when nothing lies beyond the
|
|
20
|
+
* edge — no wrap. */
|
|
21
|
+
export declare function nextFocus(direction: Direction, current: Rect, candidates: Focusable[]): Element | null;
|
|
22
|
+
/** Every focusable element the layout knows, with its painted cells
|
|
23
|
+
* (ancestor scroll offsets applied, as the paint walk descends), in
|
|
24
|
+
* tree order: laid-out boxes and atomic inline boxes at their border
|
|
25
|
+
* boxes, a text leaf's inline elements one rect per line they cover
|
|
26
|
+
* (a wrapped link is reachable from each of its lines). The root
|
|
27
|
+
* itself — the host — is the navigation's container, never a
|
|
28
|
+
* candidate. */
|
|
29
|
+
export declare function focusableRects(root: LayoutNode): Focusable[];
|
|
30
|
+
/** An element's own extent: the union of its rects (a wrapped inline
|
|
31
|
+
* element has one per line); null when it has none. */
|
|
32
|
+
export declare function extentOf(rects: Focusable[], element: Element): Rect | null;
|
|
33
|
+
/** Whether an arrow key pressed on `element` belongs to the control:
|
|
34
|
+
* caret movement in text fields (Left/Right in a single-line input,
|
|
35
|
+
* all four in a textarea or contenteditable), a radio group's own
|
|
36
|
+
* selection, a listbox select's, a value change on a stepped input
|
|
37
|
+
* (number, range, dates, color), and a single select's open picker. */
|
|
38
|
+
export declare function arrowIsNative(element: Element, key: string, pickerOpen?: boolean): boolean;
|
|
39
|
+
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../src/focus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;GAKG;AAEH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;CACZ;AASD,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAEzD;AAED;;;;;qBAKqB;AACrB,wBAAgB,SAAS,CACvB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,IAAI,EACb,UAAU,EAAE,SAAS,EAAE,GACtB,OAAO,GAAG,IAAI,CAWhB;AA+BD;;;;;;gBAMgB;AAChB,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,CAqB5D;AAED;uDACuD;AACvD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAe1E;AAcD;;;;uEAIuE;AACvE,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,OAAO,CAiBxF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CellPaint } from "./plain-text.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Which clusters the grid's font draws off their cell count, and how
|
|
4
|
+
* to fit them (specs/wide-characters.md "The grid stays on its cells
|
|
5
|
+
* in any font"): each distinct non-ASCII cluster is measured once per
|
|
6
|
+
* font — family, size, weight, and style — with canvas `measureText`.
|
|
7
|
+
* A mismatch is painted in a box of exactly its cells, the glyph
|
|
8
|
+
* scaled to fill the box, capped so its ink stays inside the row and
|
|
9
|
+
* the box. Without a canvas (headless tests) nothing is boxed.
|
|
10
|
+
*/
|
|
11
|
+
export declare class GlyphBoxes {
|
|
12
|
+
#private;
|
|
13
|
+
/** The grid's font and cell; a change forgets every measurement. */
|
|
14
|
+
configure(font: {
|
|
15
|
+
style: string;
|
|
16
|
+
weight: string;
|
|
17
|
+
size: string;
|
|
18
|
+
family: string;
|
|
19
|
+
}, cell: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
letterSpacing: number;
|
|
23
|
+
}): void;
|
|
24
|
+
/** Forget every measurement: a font finished loading, so the same
|
|
25
|
+
* cluster may draw differently now (the fallback's measurements would
|
|
26
|
+
* otherwise stay cached under the same font name). */
|
|
27
|
+
invalidate(): void;
|
|
28
|
+
/** The box for a cluster painted with `paint`, or null when the font
|
|
29
|
+
* draws it at `cells` cells within 0.01 cell. Nothing is cached while
|
|
30
|
+
* fonts are still loading. */
|
|
31
|
+
box(cluster: string, cells: number, paint?: CellPaint): {
|
|
32
|
+
scale: number;
|
|
33
|
+
} | null;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=glyph-box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glyph-box.d.ts","sourceRoot":"","sources":["../src/glyph-box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;GAQG;AACH,qBAAa,UAAU;;IAMrB,oEAAoE;IACpE,SAAS,CACP,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EACrE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAC7D,IAAI,CAaN;IAED;;0DAEsD;IACtD,UAAU,IAAI,IAAI,CAEjB;IAED;;kCAE8B;IAC9B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAc/E;CAkCF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { invalidateLeaves, registerLeafRenderer } from "./leaf.ts";
|
|
|
5
5
|
export type { LeafContent, LeafPaint, LeafRegistration, LeafRun } from "./leaf.ts";
|
|
6
6
|
export { renderPlainText } from "./plain-text.ts";
|
|
7
7
|
export { wrapLines } from "./wrap.ts";
|
|
8
|
+
export { clusterAdvances, clusterWidth, graphemes, textCells } from "./width.ts";
|
|
8
9
|
export { multicolLines } from "./multicol.ts";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|