monowind 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +29 -28
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +843 -753
- package/dist/index.js.map +1 -1
- package/dist/leaf.d.ts +73 -0
- package/dist/leaf.d.ts.map +1 -0
- package/dist/tree.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/leaf.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public leaf-renderer API (specs/leaf-renderers.md): a custom element
|
|
3
|
+
* registers as a GRID LEAF and supplies its own cell content instead
|
|
4
|
+
* of laid-out children — the generalization of what the tree builder
|
|
5
|
+
* special-cases for form controls. `@monowind/ascii` is the first
|
|
6
|
+
* consumer.
|
|
7
|
+
*
|
|
8
|
+
* Stability contract: this surface is public — every future change is
|
|
9
|
+
* ADDITIVE (new optional fields/parameters), per the spec's evolution
|
|
10
|
+
* policy.
|
|
11
|
+
*/
|
|
12
|
+
/** Per-cell styling for a run — an extensible subset of what the grid
|
|
13
|
+
* paints. Color values are CSS `<color>` strings, vars welcome
|
|
14
|
+
* (`var(--mw-ansi-red)`); they resolve at paint time against the
|
|
15
|
+
* host, so themes restyle content with no re-render. */
|
|
16
|
+
export interface LeafPaint {
|
|
17
|
+
color?: string;
|
|
18
|
+
backgroundColor?: string;
|
|
19
|
+
fontWeight?: string;
|
|
20
|
+
fontStyle?: string;
|
|
21
|
+
textDecorationLine?: string;
|
|
22
|
+
}
|
|
23
|
+
/** One painted span of a content line: cells `[start, end)` of
|
|
24
|
+
* `lines[line]`. */
|
|
25
|
+
export interface LeafRun {
|
|
26
|
+
line: number;
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
paint: LeafPaint;
|
|
30
|
+
}
|
|
31
|
+
/** What a renderer returns: preformatted content lines (the leaf's
|
|
32
|
+
* intrinsic width is the longest line, height the line count —
|
|
33
|
+
* white-space styling does not apply to renderer content) plus
|
|
34
|
+
* optional paint runs. */
|
|
35
|
+
export interface LeafContent {
|
|
36
|
+
lines: string[];
|
|
37
|
+
runs?: LeafRun[];
|
|
38
|
+
}
|
|
39
|
+
export interface LeafRegistration {
|
|
40
|
+
/** Custom-element tag name (must contain a hyphen — built-ins are
|
|
41
|
+
* never claimable). Stored lowercased. */
|
|
42
|
+
tag: string;
|
|
43
|
+
/** SYNCHRONOUS and DOM-read-only; called each layout pass (caching
|
|
44
|
+
* is the renderer's own business). Asynchrony (font loading, …)
|
|
45
|
+
* lives outside: finish the work, then `invalidateLeaves()`. Must
|
|
46
|
+
* also run under happy-dom/Node — `renderPlainText` traverses the
|
|
47
|
+
* same tree. */
|
|
48
|
+
render: (el: Element) => LeafContent;
|
|
49
|
+
/** Attributes whose changes re-render this leaf (merged into the
|
|
50
|
+
* host's mutation-observer filter; `class`/`style` and character
|
|
51
|
+
* data are always observed). */
|
|
52
|
+
observedAttributes?: string[];
|
|
53
|
+
}
|
|
54
|
+
/** Register (or last-wins replace, with a warning) a leaf renderer.
|
|
55
|
+
* Connected hosts relayout, so registration after first paint is
|
|
56
|
+
* safe — the post-hoc-registration idiom every monowind registry
|
|
57
|
+
* shares. */
|
|
58
|
+
export declare function registerLeafRenderer(registration: LeafRegistration): void;
|
|
59
|
+
/** Relayout every connected host — the invalidation hook for leaf
|
|
60
|
+
* content whose inputs changed outside the DOM (a font finished
|
|
61
|
+
* registering, …). Coalesced per frame by the hosts themselves. */
|
|
62
|
+
export declare function invalidateLeaves(): void;
|
|
63
|
+
export declare function leafRendererFor(tagName: string): LeafRegistration | undefined;
|
|
64
|
+
/** The union of every registration's observed attributes — the host
|
|
65
|
+
* extends its MutationObserver filter with these. */
|
|
66
|
+
export declare function leafObservedAttributes(): string[];
|
|
67
|
+
/** Host subscription to registry changes (registration or
|
|
68
|
+
* invalidation); returns the unsubscriber. Internal to the engine. */
|
|
69
|
+
export declare function onLeafRegistryChange(listener: () => void): () => void;
|
|
70
|
+
/** Run a renderer with the spec's error contract: a throw must never
|
|
71
|
+
* break layout — warn once per element and render nothing this pass. */
|
|
72
|
+
export declare function renderLeafContent(leaf: LeafRegistration, el: Element): LeafContent | null;
|
|
73
|
+
//# sourceMappingURL=leaf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leaf.d.ts","sourceRoot":"","sources":["../src/leaf.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH;;;wDAGwD;AACxD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;oBACoB;AACpB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;0BAG0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B;8CAC0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;oBAIgB;IAChB,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,WAAW,CAAC;IACrC;;oCAEgC;IAChC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAKD;;;aAGa;AACb,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAezE;AAED;;mEAEmE;AACnE,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE7E;AAED;qDACqD;AACrD,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAMjD;AAED;sEACsE;AACtE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAGrE;AAED;wEACwE;AACxE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAOzF"}
|
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":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAW,MAAM,YAAY,CAAC;AAEnE;;;;4DAI4D;AAC5D,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;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,CAmKnB;AAgZD,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"}
|