@llui/dom 0.0.22 → 0.0.24
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 +26 -21
- package/dist/dom-env.d.ts +67 -0
- package/dist/dom-env.d.ts.map +1 -0
- package/dist/dom-env.js +61 -0
- package/dist/dom-env.js.map +1 -0
- package/dist/el-split.d.ts.map +1 -1
- package/dist/el-split.js +4 -4
- package/dist/el-split.js.map +1 -1
- package/dist/el-template.d.ts +14 -1
- package/dist/el-template.d.ts.map +1 -1
- package/dist/el-template.js +41 -7
- package/dist/el-template.js.map +1 -1
- package/dist/elements.js +2 -2
- package/dist/elements.js.map +1 -1
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +1 -0
- package/dist/hmr.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mathml-elements.js +2 -2
- package/dist/mathml-elements.js.map +1 -1
- package/dist/mount.d.ts +8 -0
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +14 -9
- package/dist/mount.js.map +1 -1
- package/dist/primitives/branch.js +1 -1
- package/dist/primitives/branch.js.map +1 -1
- package/dist/primitives/child.d.ts.map +1 -1
- package/dist/primitives/child.js +5 -2
- package/dist/primitives/child.js.map +1 -1
- package/dist/primitives/client-only.d.ts +108 -0
- package/dist/primitives/client-only.d.ts.map +1 -0
- package/dist/primitives/client-only.js +110 -0
- package/dist/primitives/client-only.js.map +1 -0
- package/dist/primitives/each.d.ts.map +1 -1
- package/dist/primitives/each.js +19 -9
- package/dist/primitives/each.js.map +1 -1
- package/dist/primitives/foreign.d.ts.map +1 -1
- package/dist/primitives/foreign.js +83 -44
- package/dist/primitives/foreign.js.map +1 -1
- package/dist/primitives/lazy.js +2 -2
- package/dist/primitives/lazy.js.map +1 -1
- package/dist/primitives/selector.js +1 -1
- package/dist/primitives/selector.js.map +1 -1
- package/dist/primitives/slice.d.ts.map +1 -1
- package/dist/primitives/slice.js +14 -0
- package/dist/primitives/slice.js.map +1 -1
- package/dist/primitives/text.js +3 -3
- package/dist/primitives/text.js.map +1 -1
- package/dist/primitives/unsafe-html.js +11 -13
- package/dist/primitives/unsafe-html.js.map +1 -1
- package/dist/primitives/virtual-each.d.ts.map +1 -1
- package/dist/primitives/virtual-each.js +5 -3
- package/dist/primitives/virtual-each.js.map +1 -1
- package/dist/render-context.d.ts +9 -0
- package/dist/render-context.d.ts.map +1 -1
- package/dist/render-context.js.map +1 -1
- package/dist/ssr/jsdom.d.ts +18 -0
- package/dist/ssr/jsdom.d.ts.map +1 -0
- package/dist/ssr/jsdom.js +38 -0
- package/dist/ssr/jsdom.js.map +1 -0
- package/dist/ssr/legacy.d.ts +25 -0
- package/dist/ssr/legacy.d.ts.map +1 -0
- package/dist/ssr/legacy.js +61 -0
- package/dist/ssr/legacy.js.map +1 -0
- package/dist/ssr/linkedom.d.ts +17 -0
- package/dist/ssr/linkedom.d.ts.map +1 -0
- package/dist/ssr/linkedom.js +36 -0
- package/dist/ssr/linkedom.js.map +1 -0
- package/dist/ssr-dom.d.ts +11 -7
- package/dist/ssr-dom.d.ts.map +1 -1
- package/dist/ssr-dom.js +10 -31
- package/dist/ssr-dom.js.map +1 -1
- package/dist/ssr.d.ts +10 -5
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +11 -7
- package/dist/ssr.js.map +1 -1
- package/dist/svg-elements.js +2 -2
- package/dist/svg-elements.js.map +1 -1
- package/dist/types.d.ts +27 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-loop.d.ts +3 -1
- package/dist/update-loop.d.ts.map +1 -1
- package/dist/update-loop.js +15 -1
- package/dist/update-loop.js.map +1 -1
- package/dist/view-helpers.d.ts +7 -0
- package/dist/view-helpers.d.ts.map +1 -1
- package/dist/view-helpers.js +2 -0
- package/dist/view-helpers.js.map +1 -1
- package/package.json +25 -1
- package/dist/scope.d.ts +0 -39
- package/dist/scope.d.ts.map +0 -1
- package/dist/scope.js +0 -250
- package/dist/scope.js.map +0 -1
package/dist/ssr-dom.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Must be called (and awaited) once before renderToString on the server.
|
|
4
|
-
* Uses jsdom — the calling package must have jsdom as a dependency.
|
|
2
|
+
* `@llui/dom/ssr` — the generic SSR entry.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Exports the render API + the `DomEnv` contract + a `browserEnv()`
|
|
5
|
+
* helper. Does NOT import jsdom, linkedom, or any DOM implementation.
|
|
6
|
+
* Consumers pick their DOM via a sub-entry (`@llui/dom/ssr/jsdom` or
|
|
7
|
+
* `@llui/dom/ssr/linkedom`) and pass the resulting env to
|
|
8
|
+
* `renderToString` / `renderNodes` explicitly.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
+
* The deprecated `initSsrDom()` shim lives in `@llui/dom/ssr/legacy`
|
|
11
|
+
* so bundles that don't import it don't pay jsdom's bundle cost.
|
|
10
12
|
*/
|
|
11
|
-
export
|
|
13
|
+
export type { DomEnv } from './dom-env.js';
|
|
14
|
+
export { browserEnv } from './dom-env.js';
|
|
15
|
+
export { renderToString, renderNodes, serializeNodes } from './ssr.js';
|
|
12
16
|
//# sourceMappingURL=ssr-dom.d.ts.map
|
package/dist/ssr-dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-dom.d.ts","sourceRoot":"","sources":["../src/ssr-dom.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ssr-dom.d.ts","sourceRoot":"","sources":["../src/ssr-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/ssr-dom.js
CHANGED
|
@@ -1,36 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Must be called (and awaited) once before renderToString on the server.
|
|
4
|
-
* Uses jsdom — the calling package must have jsdom as a dependency.
|
|
2
|
+
* `@llui/dom/ssr` — the generic SSR entry.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Exports the render API + the `DomEnv` contract + a `browserEnv()`
|
|
5
|
+
* helper. Does NOT import jsdom, linkedom, or any DOM implementation.
|
|
6
|
+
* Consumers pick their DOM via a sub-entry (`@llui/dom/ssr/jsdom` or
|
|
7
|
+
* `@llui/dom/ssr/linkedom`) and pass the resulting env to
|
|
8
|
+
* `renderToString` / `renderNodes` explicitly.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
+
* The deprecated `initSsrDom()` shim lives in `@llui/dom/ssr/legacy`
|
|
11
|
+
* so bundles that don't import it don't pay jsdom's bundle cost.
|
|
10
12
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
return;
|
|
14
|
-
// @ts-expect-error — jsdom is an optional peer dependency, not typed
|
|
15
|
-
const jsdomMod = await import('jsdom');
|
|
16
|
-
const jsdom = jsdomMod;
|
|
17
|
-
const dom = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
18
|
-
const g = globalThis;
|
|
19
|
-
const win = dom.window;
|
|
20
|
-
for (const key of [
|
|
21
|
-
'document',
|
|
22
|
-
'HTMLElement',
|
|
23
|
-
'Element',
|
|
24
|
-
'Node',
|
|
25
|
-
'Text',
|
|
26
|
-
'Comment',
|
|
27
|
-
'MouseEvent',
|
|
28
|
-
'ShadowRoot',
|
|
29
|
-
'DocumentFragment',
|
|
30
|
-
'HTMLTemplateElement',
|
|
31
|
-
]) {
|
|
32
|
-
if (win[key] !== undefined)
|
|
33
|
-
g[key] = win[key];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
13
|
+
export { browserEnv } from './dom-env.js';
|
|
14
|
+
export { renderToString, renderNodes, serializeNodes } from './ssr.js';
|
|
36
15
|
//# sourceMappingURL=ssr-dom.js.map
|
package/dist/ssr-dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-dom.js","sourceRoot":"","sources":["../src/ssr-dom.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ssr-dom.js","sourceRoot":"","sources":["../src/ssr-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA","sourcesContent":["/**\n * `@llui/dom/ssr` — the generic SSR entry.\n *\n * Exports the render API + the `DomEnv` contract + a `browserEnv()`\n * helper. Does NOT import jsdom, linkedom, or any DOM implementation.\n * Consumers pick their DOM via a sub-entry (`@llui/dom/ssr/jsdom` or\n * `@llui/dom/ssr/linkedom`) and pass the resulting env to\n * `renderToString` / `renderNodes` explicitly.\n *\n * The deprecated `initSsrDom()` shim lives in `@llui/dom/ssr/legacy`\n * so bundles that don't import it don't pay jsdom's bundle cost.\n */\n\nexport type { DomEnv } from './dom-env.js'\nexport { browserEnv } from './dom-env.js'\n\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\n"]}
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { ComponentDef, Lifetime, Binding } from './types.js';
|
|
2
2
|
import { type ComponentInstance } from './update-loop.js';
|
|
3
|
+
import type { DomEnv } from './dom-env.js';
|
|
3
4
|
/**
|
|
4
5
|
* Render a component to DOM nodes for SSR, returning both the produced
|
|
5
6
|
* nodes and the component instance (so callers can compose trees before
|
|
6
7
|
* serializing — e.g. `@llui/vike` stitches layout + page nodes at the
|
|
7
8
|
* `pageSlot()` marker position before one final serialization pass).
|
|
8
9
|
*
|
|
10
|
+
* `env` is the `DomEnv` backing this render pass — obtain one from
|
|
11
|
+
* `@llui/dom/ssr/jsdom` (`jsdomEnv()`) or `@llui/dom/ssr/linkedom`
|
|
12
|
+
* (`linkedomEnv()`). Passing the env per call keeps SSR concurrent-safe
|
|
13
|
+
* and lets a single process host multiple DOM implementations.
|
|
14
|
+
*
|
|
9
15
|
* Accepts an optional `parentLifetime` so the rendered instance's rootLifetime
|
|
10
16
|
* becomes a child of an existing scope tree — used by persistent layouts
|
|
11
17
|
* so contexts provided by an outer layout are reachable from an inner
|
|
12
18
|
* page via `useContext`.
|
|
13
|
-
*
|
|
14
|
-
* Call `initSsrDom()` once before using this on the server.
|
|
15
19
|
*/
|
|
16
|
-
export declare function renderNodes<S, M, E, D = void>(def: ComponentDef<S, M, E, D>, initialState
|
|
20
|
+
export declare function renderNodes<S, M, E, D = void>(def: ComponentDef<S, M, E, D>, initialState: S | undefined, env: DomEnv, parentLifetime?: Lifetime): {
|
|
17
21
|
nodes: Node[];
|
|
18
22
|
inst: ComponentInstance<S, M, E>;
|
|
19
23
|
};
|
|
@@ -33,10 +37,11 @@ export declare function serializeNodes(nodes: Node[], bindings: Binding[]): stri
|
|
|
33
37
|
* serializes the DOM to HTML, and adds data-llui-hydrate markers
|
|
34
38
|
* on nodes with reactive bindings.
|
|
35
39
|
*
|
|
36
|
-
*
|
|
40
|
+
* `env` is the `DomEnv` backing this render pass — obtain one from
|
|
41
|
+
* `@llui/dom/ssr/jsdom` or `@llui/dom/ssr/linkedom`.
|
|
37
42
|
*
|
|
38
43
|
* For persistent layouts, use `renderNodes` + `serializeNodes` directly
|
|
39
44
|
* so layout and page nodes can be composed before serialization.
|
|
40
45
|
*/
|
|
41
|
-
export declare function renderToString<S, M, E, D = void>(def: ComponentDef<S, M, E, D>, initialState
|
|
46
|
+
export declare function renderToString<S, M, E, D = void>(def: ComponentDef<S, M, E, D>, initialState: S | undefined, env: DomEnv): string;
|
|
42
47
|
//# sourceMappingURL=ssr.d.ts.map
|
package/dist/ssr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAIlF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAC3C,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7B,YAAY,EAAE,CAAC,GAAG,SAAS,EAC3B,GAAG,EAAE,MAAM,EACX,cAAc,CAAC,EAAE,QAAQ,GACxB;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAAE,CAiBrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAezE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAC9C,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7B,YAAY,EAAE,CAAC,GAAG,SAAS,EAC3B,GAAG,EAAE,MAAM,GACV,MAAM,CAGR"}
|
package/dist/ssr.js
CHANGED
|
@@ -8,15 +8,18 @@ import { createView } from './view-helpers.js';
|
|
|
8
8
|
* serializing — e.g. `@llui/vike` stitches layout + page nodes at the
|
|
9
9
|
* `pageSlot()` marker position before one final serialization pass).
|
|
10
10
|
*
|
|
11
|
+
* `env` is the `DomEnv` backing this render pass — obtain one from
|
|
12
|
+
* `@llui/dom/ssr/jsdom` (`jsdomEnv()`) or `@llui/dom/ssr/linkedom`
|
|
13
|
+
* (`linkedomEnv()`). Passing the env per call keeps SSR concurrent-safe
|
|
14
|
+
* and lets a single process host multiple DOM implementations.
|
|
15
|
+
*
|
|
11
16
|
* Accepts an optional `parentLifetime` so the rendered instance's rootLifetime
|
|
12
17
|
* becomes a child of an existing scope tree — used by persistent layouts
|
|
13
18
|
* so contexts provided by an outer layout are reachable from an inner
|
|
14
19
|
* page via `useContext`.
|
|
15
|
-
*
|
|
16
|
-
* Call `initSsrDom()` once before using this on the server.
|
|
17
20
|
*/
|
|
18
|
-
export function renderNodes(def, initialState, parentLifetime) {
|
|
19
|
-
const inst = createComponentInstance(def, undefined, parentLifetime ?? null);
|
|
21
|
+
export function renderNodes(def, initialState, env, parentLifetime) {
|
|
22
|
+
const inst = createComponentInstance(def, undefined, parentLifetime ?? null, env);
|
|
20
23
|
if (initialState !== undefined) {
|
|
21
24
|
inst.state = initialState;
|
|
22
25
|
}
|
|
@@ -63,13 +66,14 @@ export function serializeNodes(nodes, bindings) {
|
|
|
63
66
|
* serializes the DOM to HTML, and adds data-llui-hydrate markers
|
|
64
67
|
* on nodes with reactive bindings.
|
|
65
68
|
*
|
|
66
|
-
*
|
|
69
|
+
* `env` is the `DomEnv` backing this render pass — obtain one from
|
|
70
|
+
* `@llui/dom/ssr/jsdom` or `@llui/dom/ssr/linkedom`.
|
|
67
71
|
*
|
|
68
72
|
* For persistent layouts, use `renderNodes` + `serializeNodes` directly
|
|
69
73
|
* so layout and page nodes can be composed before serialization.
|
|
70
74
|
*/
|
|
71
|
-
export function renderToString(def, initialState) {
|
|
72
|
-
const { nodes, inst } = renderNodes(def, initialState);
|
|
75
|
+
export function renderToString(def, initialState, env) {
|
|
76
|
+
const { nodes, inst } = renderNodes(def, initialState, env);
|
|
73
77
|
return serializeNodes(nodes, inst.allBindings);
|
|
74
78
|
}
|
|
75
79
|
function nodeToStringWithMarkers(node, bindingNodes) {
|
package/dist/ssr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.js","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAA0B,MAAM,kBAAkB,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"ssr.js","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAA0B,MAAM,kBAAkB,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CACzB,GAA6B,EAC7B,YAA2B,EAC3B,GAAW,EACX,cAAyB;IAEzB,MAAM,IAAI,GAAG,uBAAuB,CAAC,GAAG,EAAE,SAAS,EAAE,cAAc,IAAI,IAAI,EAA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AAG,CAAC,GAAG,CAAC,CAAA;AAC/B,CAAC","sourcesContent":["import type { ComponentDef, Lifetime, Binding } from './types.js'\nimport { createComponentInstance, type ComponentInstance } from './update-loop.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { createView } from './view-helpers.js'\nimport type { DomEnv } from './dom-env.js'\n\n/**\n * Render a component to DOM nodes for SSR, returning both the produced\n * nodes and the component instance (so callers can compose trees before\n * serializing — e.g. `@llui/vike` stitches layout + page nodes at the\n * `pageSlot()` marker position before one final serialization pass).\n *\n * `env` is the `DomEnv` backing this render pass — obtain one from\n * `@llui/dom/ssr/jsdom` (`jsdomEnv()`) or `@llui/dom/ssr/linkedom`\n * (`linkedomEnv()`). Passing the env per call keeps SSR concurrent-safe\n * and lets a single process host multiple DOM implementations.\n *\n * Accepts an optional `parentLifetime` so the rendered instance's rootLifetime\n * becomes a child of an existing scope tree — used by persistent layouts\n * so contexts provided by an outer layout are reachable from an inner\n * page via `useContext`.\n */\nexport function renderNodes<S, M, E, D = void>(\n def: ComponentDef<S, M, E, D>,\n initialState: S | undefined,\n env: DomEnv,\n parentLifetime?: Lifetime,\n): { nodes: Node[]; inst: ComponentInstance<S, M, E> } {\n const inst = createComponentInstance(def, undefined, parentLifetime ?? null, env)\n if (initialState !== undefined) {\n inst.state = initialState\n }\n\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n\n return { nodes, inst }\n}\n\n/**\n * Serialize an array of DOM nodes to an HTML string, adding\n * `data-llui-hydrate` markers on elements that own reactive bindings.\n *\n * Accepts a flat binding list so compositions of multiple instances\n * (layout + page, for persistent-layout SSR) produce correct markers\n * across the whole tree. Pass the union of every composed instance's\n * `allBindings`.\n */\nexport function serializeNodes(nodes: Node[], bindings: Binding[]): string {\n const hydrateElements = new Set<Node>()\n for (const binding of bindings) {\n const node = binding.node\n if (node.nodeType === 1) {\n hydrateElements.add(node)\n } else if (node.parentNode && node.parentNode.nodeType === 1) {\n hydrateElements.add(node.parentNode)\n }\n }\n let html = ''\n for (const node of nodes) {\n html += nodeToStringWithMarkers(node, hydrateElements)\n }\n return html\n}\n\n/**\n * Render a component to an HTML string for SSR.\n * Evaluates view() against the initial state (or provided data),\n * serializes the DOM to HTML, and adds data-llui-hydrate markers\n * on nodes with reactive bindings.\n *\n * `env` is the `DomEnv` backing this render pass — obtain one from\n * `@llui/dom/ssr/jsdom` or `@llui/dom/ssr/linkedom`.\n *\n * For persistent layouts, use `renderNodes` + `serializeNodes` directly\n * so layout and page nodes can be composed before serialization.\n */\nexport function renderToString<S, M, E, D = void>(\n def: ComponentDef<S, M, E, D>,\n initialState: S | undefined,\n env: DomEnv,\n): string {\n const { nodes, inst } = renderNodes(def, initialState, env)\n return serializeNodes(nodes, inst.allBindings)\n}\n\nfunction nodeToStringWithMarkers(node: Node, bindingNodes: Set<Node>): string {\n if (node.nodeType === 3) {\n return escapeHtml(node.textContent ?? '')\n }\n if (node.nodeType === 8) {\n return `<!--${node.textContent ?? ''}-->`\n }\n if (node.nodeType === 1) {\n const el = node as Element\n return elementToString(el, bindingNodes)\n }\n return ''\n}\n\nfunction elementToString(el: Element, bindingNodes: Set<Node>): string {\n const tag = el.tagName.toLowerCase()\n let attrs = ''\n\n for (let i = 0; i < el.attributes.length; i++) {\n const attr = el.attributes[i]!\n // Skip event handler attributes\n if (attr.name.startsWith('on')) continue\n attrs += ` ${attr.name}=\"${escapeAttr(attr.value)}\"`\n }\n\n // Add hydrate marker if this element or any of its text children have bindings\n if (bindingNodes.has(el)) {\n attrs += ' data-llui-hydrate'\n }\n\n // Void elements\n if (isVoidElement(tag)) {\n return `<${tag}${attrs} />`\n }\n\n let children = ''\n for (let i = 0; i < el.childNodes.length; i++) {\n children += nodeToStringWithMarkers(el.childNodes[i]!, bindingNodes)\n }\n\n return `<${tag}${attrs}>${children}</${tag}>`\n}\n\nfunction escapeHtml(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')\n}\n\nfunction escapeAttr(s: string): string {\n return s.replace(/&/g, '&').replace(/\"/g, '"')\n}\n\nconst VOID_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n])\n\nfunction isVoidElement(tag: string): boolean {\n return VOID_ELEMENTS.has(tag)\n}\n"]}
|
package/dist/svg-elements.js
CHANGED
|
@@ -3,8 +3,8 @@ import { createBinding, applyBinding } from './binding.js';
|
|
|
3
3
|
import { FULL_MASK } from './update-loop.js';
|
|
4
4
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
5
5
|
function createSvgElement(tag, propsOrChildren, maybeChildren) {
|
|
6
|
-
const el = document.createElementNS(SVG_NS, tag);
|
|
7
6
|
const ctx = getRenderContext();
|
|
7
|
+
const el = ctx.dom.createElementNS(SVG_NS, tag);
|
|
8
8
|
const props = Array.isArray(propsOrChildren)
|
|
9
9
|
? undefined
|
|
10
10
|
: propsOrChildren;
|
|
@@ -49,7 +49,7 @@ function createSvgElement(tag, propsOrChildren, maybeChildren) {
|
|
|
49
49
|
if (children) {
|
|
50
50
|
for (const child of children) {
|
|
51
51
|
if (typeof child === 'string') {
|
|
52
|
-
el.appendChild(
|
|
52
|
+
el.appendChild(ctx.dom.createTextNode(child));
|
|
53
53
|
}
|
|
54
54
|
else if (Array.isArray(child)) {
|
|
55
55
|
for (const node of child)
|
package/dist/svg-elements.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg-elements.js","sourceRoot":"","sources":["../src/svg-elements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM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,CAAC,OAAO,EAAE,CAAC,CAAC,CAAgB,CAAA;AAExF,cAAc;AACd,kBAAkB;AAClB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;AAC9G,kBAAkB;AAClB,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;AAChH,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;AACtH,oBAAoB","sourcesContent":["import type { BindingKind } from './types.js'\nimport { getRenderContext } from './render-context.js'\nimport { createBinding, applyBinding } from './binding.js'\nimport { FULL_MASK } from './update-loop.js'\n\nconst SVG_NS = 'http://www.w3.org/2000/svg'\n\ntype ElementProps = Record<string, unknown>\ntype Child = Node | string | Node[]\ntype Children = Child[]\n\nfunction createSvgElement(\n tag: string,\n propsOrChildren?: ElementProps | Children,\n maybeChildren?: Children,\n): SVGElement {\n const el = document.createElementNS(SVG_NS, tag)\n const ctx = getRenderContext()\n\n const props: ElementProps | undefined = Array.isArray(propsOrChildren)\n ? undefined\n : propsOrChildren\n const children: Children | undefined = Array.isArray(propsOrChildren)\n ? propsOrChildren\n : maybeChildren\n\n if (props) {\n for (const [rawKey, value] of Object.entries(props)) {\n if (rawKey === 'key') continue\n\n if (/^on[A-Z]/.test(rawKey)) {\n const eventName = rawKey.slice(2).toLowerCase()\n el.addEventListener(eventName, value as EventListener)\n continue\n }\n\n if (typeof value === 'function') {\n const kind: BindingKind = rawKey === 'class' || rawKey === 'className' ? 'class' : 'attr'\n const key = kind === 'class' ? undefined : rawKey\n const accessor = value as (state: never) => unknown\n const perItem = value.length === 0\n\n const binding = createBinding(ctx.rootLifetime, {\n mask: FULL_MASK,\n accessor,\n kind,\n node: el,\n key,\n perItem,\n })\n\n const initialValue = perItem ? (value as () => unknown)() : accessor(ctx.state as never)\n binding.lastValue = initialValue\n applyBinding({ kind, node: el, key }, initialValue)\n continue\n }\n\n if (rawKey === 'class' || rawKey === 'className') {\n applyBinding({ kind: 'class', node: el, key: undefined }, value)\n } else {\n applyBinding({ kind: 'attr', node: el, key: rawKey }, value)\n }\n }\n }\n\n if (children) {\n for (const child of children) {\n if (typeof child === 'string') {\n el.appendChild(document.createTextNode(child))\n } else if (Array.isArray(child)) {\n for (const node of child) el.appendChild(node)\n } else {\n el.appendChild(child)\n }\n }\n }\n\n return el\n}\n\ntype SvgElFn = {\n (): SVGElement\n (props: ElementProps, children?: Children): SVGElement\n (children: Children): SVGElement\n}\n\ntype SvgVoidElFn = {\n (): SVGElement\n (props: ElementProps): SVGElement\n}\n\n/* v8 ignore start — mechanical tag wrappers */\n// Container / structural\n// prettier-ignore\nexport const svg = ((p?: ElementProps | Children, c?: Children) => createSvgElement('svg', p, c)) as SvgElFn\n// prettier-ignore\nexport const g = ((p?: ElementProps | Children, c?: Children) => createSvgElement('g', p, c)) as SvgElFn\n// prettier-ignore\nexport const defs = ((p?: ElementProps | Children, c?: Children) => createSvgElement('defs', p, c)) as SvgElFn\n// prettier-ignore\nexport const symbol = ((p?: ElementProps | Children, c?: Children) => createSvgElement('symbol', p, c)) as SvgElFn\n// prettier-ignore\nexport const use = ((p?: ElementProps | Children, c?: Children) => createSvgElement('use', p, c)) as SvgElFn\n\n// Shapes\n// prettier-ignore\nexport const circle = ((p?: ElementProps | Children, c?: Children) => createSvgElement('circle', p, c)) as SvgElFn\n// prettier-ignore\nexport const ellipse = ((p?: ElementProps | Children, c?: Children) => createSvgElement('ellipse', p, c)) as SvgElFn\n// prettier-ignore\nexport const line = ((p?: ElementProps | Children, c?: Children) => createSvgElement('line', p, c)) as SvgElFn\n// prettier-ignore\nexport const path = ((p?: ElementProps | Children, c?: Children) => createSvgElement('path', p, c)) as SvgElFn\n// prettier-ignore\nexport const polygon = ((p?: ElementProps) => createSvgElement('polygon', p)) as SvgVoidElFn\n// prettier-ignore\nexport const polyline = ((p?: ElementProps) => createSvgElement('polyline', p)) as SvgVoidElFn\n// prettier-ignore\nexport const rect = ((p?: ElementProps | Children, c?: Children) => createSvgElement('rect', p, c)) as SvgElFn\n\n// Text\n// prettier-ignore\nexport const text = ((p?: ElementProps | Children, c?: Children) => createSvgElement('text', p, c)) as SvgElFn\n// prettier-ignore\nexport const tspan = ((p?: ElementProps | Children, c?: Children) => createSvgElement('tspan', p, c)) as SvgElFn\n// prettier-ignore\nexport const textPath = ((p?: ElementProps | Children, c?: Children) => createSvgElement('textPath', p, c)) as SvgElFn\n\n// Paint server / clipping / masking\n// prettier-ignore\nexport const clipPath = ((p?: ElementProps | Children, c?: Children) => createSvgElement('clipPath', p, c)) as SvgElFn\n// prettier-ignore\nexport const linearGradient = ((p?: ElementProps | Children, c?: Children) => createSvgElement('linearGradient', p, c)) as SvgElFn\n// prettier-ignore\nexport const radialGradient = ((p?: ElementProps | Children, c?: Children) => createSvgElement('radialGradient', p, c)) as SvgElFn\n// prettier-ignore\nexport const stop = ((p?: ElementProps) => createSvgElement('stop', p)) as SvgVoidElFn\n// prettier-ignore\nexport const mask = ((p?: ElementProps | Children, c?: Children) => createSvgElement('mask', p, c)) as SvgElFn\n// prettier-ignore\nexport const pattern = ((p?: ElementProps | Children, c?: Children) => createSvgElement('pattern', p, c)) as SvgElFn\n// prettier-ignore\nexport const marker = ((p?: ElementProps | Children, c?: Children) => createSvgElement('marker', p, c)) as SvgElFn\n\n// Filters\n// prettier-ignore\nexport const filter = ((p?: ElementProps | Children, c?: Children) => createSvgElement('filter', p, c)) as SvgElFn\n// prettier-ignore\nexport const feBlend = ((p?: ElementProps) => createSvgElement('feBlend', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feColorMatrix = ((p?: ElementProps) => createSvgElement('feColorMatrix', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feComponentTransfer = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feComponentTransfer', p, c)) as SvgElFn\n// prettier-ignore\nexport const feComposite = ((p?: ElementProps) => createSvgElement('feComposite', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feConvolveMatrix = ((p?: ElementProps) => createSvgElement('feConvolveMatrix', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feDiffuseLighting = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feDiffuseLighting', p, c)) as SvgElFn\n// prettier-ignore\nexport const feDisplacementMap = ((p?: ElementProps) => createSvgElement('feDisplacementMap', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feDropShadow = ((p?: ElementProps) => createSvgElement('feDropShadow', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFlood = ((p?: ElementProps) => createSvgElement('feFlood', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feGaussianBlur = ((p?: ElementProps) => createSvgElement('feGaussianBlur', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feImage = ((p?: ElementProps) => createSvgElement('feImage', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feMerge = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feMerge', p, c)) as SvgElFn\n// prettier-ignore\nexport const feMergeNode = ((p?: ElementProps) => createSvgElement('feMergeNode', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feMorphology = ((p?: ElementProps) => createSvgElement('feMorphology', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feOffset = ((p?: ElementProps) => createSvgElement('feOffset', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feSpecularLighting = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feSpecularLighting', p, c)) as SvgElFn\n// prettier-ignore\nexport const feTile = ((p?: ElementProps) => createSvgElement('feTile', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feTurbulence = ((p?: ElementProps) => createSvgElement('feTurbulence', p)) as SvgVoidElFn\n// prettier-ignore\nexport const fePointLight = ((p?: ElementProps) => createSvgElement('fePointLight', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feSpotLight = ((p?: ElementProps) => createSvgElement('feSpotLight', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feDistantLight = ((p?: ElementProps) => createSvgElement('feDistantLight', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncR = ((p?: ElementProps) => createSvgElement('feFuncR', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncG = ((p?: ElementProps) => createSvgElement('feFuncG', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncB = ((p?: ElementProps) => createSvgElement('feFuncB', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncA = ((p?: ElementProps) => createSvgElement('feFuncA', p)) as SvgVoidElFn\n\n// Embedded content\n// prettier-ignore\nexport const image = ((p?: ElementProps | Children, c?: Children) => createSvgElement('image', p, c)) as SvgElFn\n// prettier-ignore\nexport const foreignObject = ((p?: ElementProps | Children, c?: Children) => createSvgElement('foreignObject', p, c)) as SvgElFn\n\n// Animation\n// prettier-ignore\nexport const animate = ((p?: ElementProps) => createSvgElement('animate', p)) as SvgVoidElFn\n// prettier-ignore\nexport const animateMotion = ((p?: ElementProps | Children, c?: Children) => createSvgElement('animateMotion', p, c)) as SvgElFn\n// prettier-ignore\nexport const animateTransform = ((p?: ElementProps) => createSvgElement('animateTransform', p)) as SvgVoidElFn\n// prettier-ignore\nexport const set = ((p?: ElementProps) => createSvgElement('set', p)) as SvgVoidElFn\n// prettier-ignore\nexport const mpath = ((p?: ElementProps) => createSvgElement('mpath', p)) as SvgVoidElFn\n\n// Descriptive\n// prettier-ignore\nexport const desc = ((p?: ElementProps | Children, c?: Children) => createSvgElement('desc', p, c)) as SvgElFn\n// prettier-ignore\nexport const title = ((p?: ElementProps | Children, c?: Children) => createSvgElement('title', p, c)) as SvgElFn\n// prettier-ignore\nexport const metadata = ((p?: ElementProps | Children, c?: Children) => createSvgElement('metadata', p, c)) as SvgElFn\n/* v8 ignore stop */\n"]}
|
|
1
|
+
{"version":3,"file":"svg-elements.js","sourceRoot":"","sources":["../src/svg-elements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAA;AAM3C,SAAS,gBAAgB,CACvB,GAAW,EACX,eAAyC,EACzC,aAAwB;IAExB,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAA;IAC9B,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAe,CAAA;IAE7D,MAAM,KAAK,GAA6B,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QACpE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,eAAe,CAAA;IACnB,MAAM,QAAQ,GAAyB,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QACnE,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,aAAa,CAAA;IAEjB,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,IAAI,MAAM,KAAK,KAAK;gBAAE,SAAQ;YAE9B,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;gBAC/C,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAsB,CAAC,CAAA;gBACtD,SAAQ;YACV,CAAC;YAED,IAAI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E,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAgB,CAAA;AAC9G,kBAAkB;AAClB,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAgB,CAAA;AACpF,kBAAkB;AAClB,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAgB,CAAA;AAExF,cAAc;AACd,kBAAkB;AAClB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;AAC9G,kBAAkB;AAClB,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;AAChH,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;AACtH,oBAAoB","sourcesContent":["import type { BindingKind } from './types.js'\nimport { getRenderContext } from './render-context.js'\nimport { createBinding, applyBinding } from './binding.js'\nimport { FULL_MASK } from './update-loop.js'\n\nconst SVG_NS = 'http://www.w3.org/2000/svg'\n\ntype ElementProps = Record<string, unknown>\ntype Child = Node | string | Node[]\ntype Children = Child[]\n\nfunction createSvgElement(\n tag: string,\n propsOrChildren?: ElementProps | Children,\n maybeChildren?: Children,\n): SVGElement {\n const ctx = getRenderContext()\n const el = ctx.dom.createElementNS(SVG_NS, tag) as SVGElement\n\n const props: ElementProps | undefined = Array.isArray(propsOrChildren)\n ? undefined\n : propsOrChildren\n const children: Children | undefined = Array.isArray(propsOrChildren)\n ? propsOrChildren\n : maybeChildren\n\n if (props) {\n for (const [rawKey, value] of Object.entries(props)) {\n if (rawKey === 'key') continue\n\n if (/^on[A-Z]/.test(rawKey)) {\n const eventName = rawKey.slice(2).toLowerCase()\n el.addEventListener(eventName, value as EventListener)\n continue\n }\n\n if (typeof value === 'function') {\n const kind: BindingKind = rawKey === 'class' || rawKey === 'className' ? 'class' : 'attr'\n const key = kind === 'class' ? undefined : rawKey\n const accessor = value as (state: never) => unknown\n const perItem = value.length === 0\n\n const binding = createBinding(ctx.rootLifetime, {\n mask: FULL_MASK,\n accessor,\n kind,\n node: el,\n key,\n perItem,\n })\n\n const initialValue = perItem ? (value as () => unknown)() : accessor(ctx.state as never)\n binding.lastValue = initialValue\n applyBinding({ kind, node: el, key }, initialValue)\n continue\n }\n\n if (rawKey === 'class' || rawKey === 'className') {\n applyBinding({ kind: 'class', node: el, key: undefined }, value)\n } else {\n applyBinding({ kind: 'attr', node: el, key: rawKey }, value)\n }\n }\n }\n\n if (children) {\n for (const child of children) {\n if (typeof child === 'string') {\n el.appendChild(ctx.dom.createTextNode(child))\n } else if (Array.isArray(child)) {\n for (const node of child) el.appendChild(node)\n } else {\n el.appendChild(child)\n }\n }\n }\n\n return el\n}\n\ntype SvgElFn = {\n (): SVGElement\n (props: ElementProps, children?: Children): SVGElement\n (children: Children): SVGElement\n}\n\ntype SvgVoidElFn = {\n (): SVGElement\n (props: ElementProps): SVGElement\n}\n\n/* v8 ignore start — mechanical tag wrappers */\n// Container / structural\n// prettier-ignore\nexport const svg = ((p?: ElementProps | Children, c?: Children) => createSvgElement('svg', p, c)) as SvgElFn\n// prettier-ignore\nexport const g = ((p?: ElementProps | Children, c?: Children) => createSvgElement('g', p, c)) as SvgElFn\n// prettier-ignore\nexport const defs = ((p?: ElementProps | Children, c?: Children) => createSvgElement('defs', p, c)) as SvgElFn\n// prettier-ignore\nexport const symbol = ((p?: ElementProps | Children, c?: Children) => createSvgElement('symbol', p, c)) as SvgElFn\n// prettier-ignore\nexport const use = ((p?: ElementProps | Children, c?: Children) => createSvgElement('use', p, c)) as SvgElFn\n\n// Shapes\n// prettier-ignore\nexport const circle = ((p?: ElementProps | Children, c?: Children) => createSvgElement('circle', p, c)) as SvgElFn\n// prettier-ignore\nexport const ellipse = ((p?: ElementProps | Children, c?: Children) => createSvgElement('ellipse', p, c)) as SvgElFn\n// prettier-ignore\nexport const line = ((p?: ElementProps | Children, c?: Children) => createSvgElement('line', p, c)) as SvgElFn\n// prettier-ignore\nexport const path = ((p?: ElementProps | Children, c?: Children) => createSvgElement('path', p, c)) as SvgElFn\n// prettier-ignore\nexport const polygon = ((p?: ElementProps) => createSvgElement('polygon', p)) as SvgVoidElFn\n// prettier-ignore\nexport const polyline = ((p?: ElementProps) => createSvgElement('polyline', p)) as SvgVoidElFn\n// prettier-ignore\nexport const rect = ((p?: ElementProps | Children, c?: Children) => createSvgElement('rect', p, c)) as SvgElFn\n\n// Text\n// prettier-ignore\nexport const text = ((p?: ElementProps | Children, c?: Children) => createSvgElement('text', p, c)) as SvgElFn\n// prettier-ignore\nexport const tspan = ((p?: ElementProps | Children, c?: Children) => createSvgElement('tspan', p, c)) as SvgElFn\n// prettier-ignore\nexport const textPath = ((p?: ElementProps | Children, c?: Children) => createSvgElement('textPath', p, c)) as SvgElFn\n\n// Paint server / clipping / masking\n// prettier-ignore\nexport const clipPath = ((p?: ElementProps | Children, c?: Children) => createSvgElement('clipPath', p, c)) as SvgElFn\n// prettier-ignore\nexport const linearGradient = ((p?: ElementProps | Children, c?: Children) => createSvgElement('linearGradient', p, c)) as SvgElFn\n// prettier-ignore\nexport const radialGradient = ((p?: ElementProps | Children, c?: Children) => createSvgElement('radialGradient', p, c)) as SvgElFn\n// prettier-ignore\nexport const stop = ((p?: ElementProps) => createSvgElement('stop', p)) as SvgVoidElFn\n// prettier-ignore\nexport const mask = ((p?: ElementProps | Children, c?: Children) => createSvgElement('mask', p, c)) as SvgElFn\n// prettier-ignore\nexport const pattern = ((p?: ElementProps | Children, c?: Children) => createSvgElement('pattern', p, c)) as SvgElFn\n// prettier-ignore\nexport const marker = ((p?: ElementProps | Children, c?: Children) => createSvgElement('marker', p, c)) as SvgElFn\n\n// Filters\n// prettier-ignore\nexport const filter = ((p?: ElementProps | Children, c?: Children) => createSvgElement('filter', p, c)) as SvgElFn\n// prettier-ignore\nexport const feBlend = ((p?: ElementProps) => createSvgElement('feBlend', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feColorMatrix = ((p?: ElementProps) => createSvgElement('feColorMatrix', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feComponentTransfer = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feComponentTransfer', p, c)) as SvgElFn\n// prettier-ignore\nexport const feComposite = ((p?: ElementProps) => createSvgElement('feComposite', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feConvolveMatrix = ((p?: ElementProps) => createSvgElement('feConvolveMatrix', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feDiffuseLighting = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feDiffuseLighting', p, c)) as SvgElFn\n// prettier-ignore\nexport const feDisplacementMap = ((p?: ElementProps) => createSvgElement('feDisplacementMap', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feDropShadow = ((p?: ElementProps) => createSvgElement('feDropShadow', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFlood = ((p?: ElementProps) => createSvgElement('feFlood', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feGaussianBlur = ((p?: ElementProps) => createSvgElement('feGaussianBlur', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feImage = ((p?: ElementProps) => createSvgElement('feImage', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feMerge = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feMerge', p, c)) as SvgElFn\n// prettier-ignore\nexport const feMergeNode = ((p?: ElementProps) => createSvgElement('feMergeNode', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feMorphology = ((p?: ElementProps) => createSvgElement('feMorphology', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feOffset = ((p?: ElementProps) => createSvgElement('feOffset', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feSpecularLighting = ((p?: ElementProps | Children, c?: Children) => createSvgElement('feSpecularLighting', p, c)) as SvgElFn\n// prettier-ignore\nexport const feTile = ((p?: ElementProps) => createSvgElement('feTile', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feTurbulence = ((p?: ElementProps) => createSvgElement('feTurbulence', p)) as SvgVoidElFn\n// prettier-ignore\nexport const fePointLight = ((p?: ElementProps) => createSvgElement('fePointLight', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feSpotLight = ((p?: ElementProps) => createSvgElement('feSpotLight', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feDistantLight = ((p?: ElementProps) => createSvgElement('feDistantLight', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncR = ((p?: ElementProps) => createSvgElement('feFuncR', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncG = ((p?: ElementProps) => createSvgElement('feFuncG', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncB = ((p?: ElementProps) => createSvgElement('feFuncB', p)) as SvgVoidElFn\n// prettier-ignore\nexport const feFuncA = ((p?: ElementProps) => createSvgElement('feFuncA', p)) as SvgVoidElFn\n\n// Embedded content\n// prettier-ignore\nexport const image = ((p?: ElementProps | Children, c?: Children) => createSvgElement('image', p, c)) as SvgElFn\n// prettier-ignore\nexport const foreignObject = ((p?: ElementProps | Children, c?: Children) => createSvgElement('foreignObject', p, c)) as SvgElFn\n\n// Animation\n// prettier-ignore\nexport const animate = ((p?: ElementProps) => createSvgElement('animate', p)) as SvgVoidElFn\n// prettier-ignore\nexport const animateMotion = ((p?: ElementProps | Children, c?: Children) => createSvgElement('animateMotion', p, c)) as SvgElFn\n// prettier-ignore\nexport const animateTransform = ((p?: ElementProps) => createSvgElement('animateTransform', p)) as SvgVoidElFn\n// prettier-ignore\nexport const set = ((p?: ElementProps) => createSvgElement('set', p)) as SvgVoidElFn\n// prettier-ignore\nexport const mpath = ((p?: ElementProps) => createSvgElement('mpath', p)) as SvgVoidElFn\n\n// Descriptive\n// prettier-ignore\nexport const desc = ((p?: ElementProps | Children, c?: Children) => createSvgElement('desc', p, c)) as SvgElFn\n// prettier-ignore\nexport const title = ((p?: ElementProps | Children, c?: Children) => createSvgElement('title', p, c)) as SvgElFn\n// prettier-ignore\nexport const metadata = ((p?: ElementProps | Children, c?: Children) => createSvgElement('metadata', p, c)) as SvgElFn\n/* v8 ignore stop */\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -175,12 +175,12 @@ export interface TransitionOptions {
|
|
|
175
175
|
parent: Node;
|
|
176
176
|
}) => void | Promise<void>;
|
|
177
177
|
}
|
|
178
|
-
interface BranchOptionsBase
|
|
178
|
+
interface BranchOptionsBase extends TransitionOptions {
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* All cases covered by `cases` — no default allowed (would be dead code).
|
|
182
182
|
*/
|
|
183
|
-
type BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase
|
|
183
|
+
type BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase & {
|
|
184
184
|
on: (s: S) => K;
|
|
185
185
|
cases: {
|
|
186
186
|
[P in K]: (h: View<S, M>) => Node[];
|
|
@@ -190,7 +190,7 @@ type BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase<S, M> &
|
|
|
190
190
|
/**
|
|
191
191
|
* `cases` may cover some but not all keys; `default` handles the rest.
|
|
192
192
|
*/
|
|
193
|
-
type BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase
|
|
193
|
+
type BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase & {
|
|
194
194
|
on: (s: S) => K;
|
|
195
195
|
cases?: {
|
|
196
196
|
[P in K]?: (h: View<S, M>) => Node[];
|
|
@@ -204,7 +204,7 @@ type BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase<S, M
|
|
|
204
204
|
* continue to compile. Authors who want the gate opt in by narrowing
|
|
205
205
|
* `on`'s return type to a literal union.
|
|
206
206
|
*/
|
|
207
|
-
type BranchOptionsWide<S, M> = BranchOptionsBase
|
|
207
|
+
type BranchOptionsWide<S, M> = BranchOptionsBase & {
|
|
208
208
|
on: (s: S) => string;
|
|
209
209
|
cases?: Record<string, (h: View<S, M>) => Node[]>;
|
|
210
210
|
default?: (h: View<S, M>) => Node[];
|
|
@@ -284,6 +284,14 @@ export interface EachOptions<S, T, M = unknown> extends TransitionOptions {
|
|
|
284
284
|
*/
|
|
285
285
|
acc: <R>(selector: (t: T) => R) => () => R;
|
|
286
286
|
index: () => number;
|
|
287
|
+
/**
|
|
288
|
+
* The component's View bag (`h.text`, `h.show`, `h.branch`,
|
|
289
|
+
* `h.scope`, `h.sample`, …). Each-render callers used to reach
|
|
290
|
+
* for the top-level imports; the bag form is symmetric with how
|
|
291
|
+
* `branch.cases[k]`, `show.render`, and `scope.render` receive it.
|
|
292
|
+
* Both still work — destructure whichever is more convenient.
|
|
293
|
+
*/
|
|
294
|
+
h: View<S, M>;
|
|
287
295
|
}) => Node[];
|
|
288
296
|
}
|
|
289
297
|
export interface PortalOptions {
|
|
@@ -291,10 +299,24 @@ export interface PortalOptions {
|
|
|
291
299
|
render: () => Node[];
|
|
292
300
|
}
|
|
293
301
|
export interface ForeignOptions<S, M, T extends Record<string, unknown>, Instance> {
|
|
302
|
+
/**
|
|
303
|
+
* Construct the imperative instance. Can be async — return a
|
|
304
|
+
* `Promise<Instance>` to defer construction until e.g. a dynamic
|
|
305
|
+
* `import()` resolves. While the promise is pending:
|
|
306
|
+
*
|
|
307
|
+
* - The container element is in the DOM immediately (so layout
|
|
308
|
+
* doesn't shift when the instance arrives).
|
|
309
|
+
* - `sync` is NOT called. State changes are tracked by the
|
|
310
|
+
* primitive and the latest props are applied as the initial
|
|
311
|
+
* sync right after the promise resolves.
|
|
312
|
+
* - If the owning scope disposes before the promise resolves,
|
|
313
|
+
* `destroy(instance)` runs on resolution — no matter how long
|
|
314
|
+
* the promise takes.
|
|
315
|
+
*/
|
|
294
316
|
mount: (ctx: {
|
|
295
317
|
container: HTMLElement;
|
|
296
318
|
send: Send<M>;
|
|
297
|
-
}) => Instance
|
|
319
|
+
}) => Instance | Promise<Instance>;
|
|
298
320
|
props: (s: S) => T;
|
|
299
321
|
sync: ((ctx: {
|
|
300
322
|
instance: Instance;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAK7C,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACtC,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAA;IAG3E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAChD,QAAQ,CAAC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KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAA;CACxC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qEAAqE","sourcesContent":["// ── Component Definition ──────────────────────────────────────────\n\nimport type { View } from './view-helpers.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DisposerEvent } from './tracking/disposer-log.js'\n\nexport interface ComponentDef<S, M, E = never, D = void> {\n name: string\n init: (data: D) => [S, E[]]\n update: (state: S, msg: M) => [S, E[]]\n view: (h: View<S, M>) => Node[]\n onEffect?: (ctx: { effect: E; send: Send<M>; signal: AbortSignal }) => void\n\n // Level 2 composition\n propsMsg?: (props: Record<string, unknown>) => M\n receives?: Record<string, (params: unknown) => M>\n\n /** @internal Compiler-injected */\n __dirty?: (oldState: S, newState: S) => number | [number, number]\n /** @internal Compiler-injected */\n __renderToString?: (state: S) => string\n /** @internal Compiler-injected */\n __msgSchema?: object\n /** @internal Compiler-injected — maps top-level state field → dirty-mask bit(s) */\n __maskLegend?: Record<string, number>\n /** @internal Compiler-injected — source-file location of the component() call */\n __componentMeta?: { file: string; line: number }\n /** @internal Compiler-injected — shape of the State type (for introspection) */\n __stateSchema?: object\n /** @internal Compiler-injected — Effect union schema (for introspection) */\n __effectSchema?: object\n /** @internal Compiler-injected — replaces generic Phase 1 + Phase 2 loop */\n __update?: (\n state: S,\n dirty: number,\n bindings: Binding[],\n blocks: StructuralBlock[],\n bindingsBeforePhase1: number,\n ) => void\n /** @internal Compiler-injected — per-message-type specialized handlers.\n * Bypass the entire processMessages pipeline for single-message updates. */\n __handlers?: Record<string, (inst: object, msg: unknown) => [S, E[]]>\n}\n\nexport type Send<M> = (msg: M) => void\n\n/**\n * Type-erased component definition for use at module boundaries where\n * the consumer's `S`, `M`, `E` are internal and invisible to the caller.\n *\n * Why this exists: `ComponentDef<S, M, E, D>` uses property syntax for\n * its callable fields (`init: (data: D) => ...`), and TypeScript\n * checks property syntax with strict (contravariant) variance. That's\n * the right call for user-facing type safety when authoring a\n * component (a narrower `Msg` type can't accidentally satisfy the\n * `update`'s param), but it means `ComponentDef<MyState, MyMsg, MyEffect, MyData>`\n * is NOT structurally assignable to `ComponentDef<unknown, unknown, unknown, unknown>`\n * — the `init: (data: MyData) => ...` field is contravariant in `MyData`,\n * so widening to `unknown` is rejected.\n *\n * `AnyComponentDef` (and `LazyDef<D>` below) declare the same fields\n * using **method syntax** (`init(data: D): ...`), which TypeScript\n * checks bivariantly. Concrete `ComponentDef<S, M, E, D>` assigns into\n * these structurally without any `widenDef` helper at the callsite.\n *\n * Used by every API that accepts an opaque component definition at a\n * module boundary:\n *\n * - `child({ def })`\n * - `lazy({ loader })` — returns `LazyDef<D>` so the loader's `D` survives\n * - `createOnRenderClient({ Layout })` (from `@llui/vike`)\n * - `createOnRenderHtml({ Layout })` (from `@llui/vike`)\n *\n * The `D` parameter is `unknown` here — `child()` doesn't pass init\n * data through, and `Layout` callers pass route-supplied data whose\n * shape is unknown at the type-erased boundary. Use `LazyDef<D>` when\n * you need to preserve the init data shape (the lazy loader case).\n */\nexport interface AnyComponentDef {\n name: string\n init(data: unknown): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n propsMsg?: unknown\n receives?: unknown\n __dirty?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Type-erased component definition for use at module boundaries where the\n * loaded component's S, M, E are internal and invisible to the caller.\n * Only `D` (init data) survives because the caller provides it.\n *\n * `ComponentDef<S, M, E, D>` is structurally assignable to `LazyDef<D>`\n * for any S, M, E — `view: (h: unknown) => Node[]` accepts any View via\n * contravariance, and all other fields widen to `unknown` return types.\n *\n * Used by `lazy()` as the loader's return type. Use `AnyComponentDef`\n * (above) when D is also opaque — most other adapter-layer APIs.\n */\nexport interface LazyDef<D = void> {\n name: string\n // Method syntax — TypeScript checks methods bivariantly, so\n // ComponentDef<S, M, E, D>'s concrete (state: S, msg: M) => ...\n // assigns here even though S/M ≠ unknown. Property syntax would\n // be contravariant and reject the assignment.\n init(data: D): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n propsMsg?: unknown\n receives?: unknown\n __dirty?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Maps a value shape to a reactive-props shape: every field becomes an accessor\n * `(s: S) => V`. Use for Level-1 view function signatures.\n *\n * ```ts\n * type ToolbarData = { tools: Tool[]; theme: 'light' | 'dark' }\n *\n * export function toolbar<S>(props: Props<ToolbarData, S>, send: Send<Msg>) {\n * return [div({ class: props.theme }, [each({ items: props.tools, ... })])]\n * }\n *\n * // Caller — TypeScript enforces per-field accessors; passing a raw value errors:\n * toolbar({ tools: (s: State) => s.tools, theme: (s) => s.theme }, send)\n * ```\n */\nexport type Props<T, S> = {\n [K in keyof T]: (s: S) => T[K]\n}\n\n// ── App Handle ────────────────────────────────────────────────────\n\nexport interface AppHandle {\n dispose(): void\n flush(): void\n /**\n * Dispatch a message into the mounted instance from outside its\n * normal view-bound `send` channel. Useful for adapter layers that\n * need to push updates into a long-lived instance — e.g.\n * `@llui/vike`'s persistent-layout chain pushes layout-data updates\n * into surviving layer instances on client navigation when their\n * `propsMsg` translates the new data into a state-update message.\n *\n * Messages are queued through the same path as `view`-side `send`\n * calls — they batch into the next microtask and process via the\n * normal update loop. Calling `send` after `dispose` is a no-op.\n */\n send(msg: unknown): void\n}\n\n// ── Lifetime ─────────────────────────────────────────────────────────\n\nexport interface Lifetime {\n id: number\n parent: Lifetime | null\n children: Lifetime[]\n disposers: Array<() => void>\n bindings: Binding[]\n /** Per-item updaters — called directly by each() when item changes, bypassing Phase 2 */\n itemUpdaters: Array<() => void>\n /**\n * @internal dev-only back-reference to the owning ComponentInstance.\n * Populated on the root scope by `installDevTools` so `disposeLifetime`\n * can walk up the scope chain and emit DisposerEvents into the\n * instance's `_disposerLog`. Undefined in production.\n */\n instance?: ComponentInstance\n /**\n * @internal dev-only cause hint. Structural primitives (branch, each,\n * child, mountApp teardown) set this field immediately before calling\n * `disposeLifetime`; the dispose path reads it once to stamp the emitted\n * DisposerEvent. Left undefined, `disposeLifetime` falls back to\n * `'component-unmount'`. Undefined in production.\n */\n disposalCause?: DisposerEvent['cause']\n /** @internal dev-only — populated by structural primitives for scope-tree classification */\n _kind?: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n}\n\nexport interface LifetimeNode {\n scopeId: string\n kind: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n active: boolean\n children: LifetimeNode[]\n}\n\n// ── Binding ───────────────────────────────────────────────────────\n\n/**\n * Binding output kinds.\n *\n * `'text' | 'prop' | 'attr' | 'class' | 'style'` write their accessor's\n * return value to the DOM. `'effect'` is a side-effect-only watcher:\n * the accessor is invoked every Phase 2 tick its mask is hit, but its\n * return value is discarded and `applyBinding` is a no-op. Used by\n * `child()` to fire the prop-diff/propsMsg cascade on parent updates\n * without the cost of stringifying the returned props bag onto a\n * detached anchor node every render.\n */\nexport type BindingKind = 'text' | 'prop' | 'attr' | 'class' | 'style' | 'effect'\n\nexport interface Binding {\n mask: number\n accessor: (state: unknown) => unknown\n lastValue: unknown\n kind: BindingKind\n node: Node\n key?: string\n ownerLifetime: Lifetime\n perItem: boolean\n dead: boolean\n}\n\n// ── Structural Primitives ─────────────────────────────────────────\n\nexport interface TransitionOptions {\n enter?: (nodes: Node[]) => void | Promise<void>\n leave?: (nodes: Node[]) => void | Promise<void>\n onTransition?: (ctx: { entering: Node[]; leaving: Node[]; parent: Node }) => void | Promise<void>\n}\n\ninterface BranchOptionsBase<_S, _M> extends TransitionOptions {\n /**\n * @internal Set by `show()` / `scope()` sugar when delegating to\n * `branch()`, so the dev-only disposer log can report `'show-hide'` /\n * `'scope-rebuild'` instead of the default `'branch-swap'` for the\n * leaving arm. User code should not set this directly.\n */\n __disposalCause?: DisposerEvent['cause']\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * All cases covered by `cases` — no default allowed (would be dead code).\n */\ntype BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase<S, M> & {\n on: (s: S) => K\n cases: { [P in K]: (h: View<S, M>) => Node[] }\n default?: never\n}\n\n/**\n * `cases` may cover some but not all keys; `default` handles the rest.\n */\ntype BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase<S, M> & {\n on: (s: S) => K\n cases?: { [P in K]?: (h: View<S, M>) => Node[] }\n default: (h: View<S, M>) => Node[]\n}\n\n/**\n * `on` returns a wide `string` — exhaustiveness cannot be verified at\n * compile time (the key domain is infinite). Lenient: `default` is\n * optional so existing call sites that predate exhaustiveness typing\n * continue to compile. Authors who want the gate opt in by narrowing\n * `on`'s return type to a literal union.\n */\ntype BranchOptionsWide<S, M> = BranchOptionsBase<S, M> & {\n on: (s: S) => string\n cases?: Record<string, (h: View<S, M>) => Node[]>\n default?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `branch()`.\n *\n * When `on` returns a literal string union (e.g. `'idle' | 'loading'\n * | 'done'`), TypeScript enforces exhaustiveness: either every union\n * member has a case (and `default` is disallowed as unreachable), or\n * `default` is required to cover the remainder. When `on` returns a\n * wide `string`, `default` stays optional — exhaustiveness isn't\n * meaningful for an unbounded domain.\n *\n * `cases` is optional when `default` is present; `branch({ on, default })`\n * is the canonical dynamic-rebuild shape — `scope()` sugar wraps\n * exactly this form.\n */\nexport type BranchOptions<S, M = unknown, K extends string = string> = string extends K\n ? BranchOptionsWide<S, M>\n : BranchOptionsExhaustive<S, M, K> | BranchOptionsNonExhaustive<S, M, K>\n\nexport interface ShowOptions<S, M = unknown> extends TransitionOptions {\n when: (s: S) => boolean\n render: (h: View<S, M>) => Node[]\n fallback?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `scope()` — rebuilds a subtree when `on(state)` changes.\n *\n * Sugar over `branch({ on, cases: {}, default: render, __disposalCause: 'scope-rebuild' })`.\n * Use when the key is dynamic (e.g. an epoch counter bumped from the\n * outside) and you want a fresh arm — fresh lifetime, fresh bindings —\n * each time it changes. Combine with `sample()` inside `render` for a\n * one-shot current-state read.\n */\nexport interface ScopeOptions<S, M = unknown> extends TransitionOptions {\n on: (s: S) => string\n render: (h: View<S, M>) => Node[]\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * Options for `each()`. The inherited `enter` / `leave` callbacks fire **per item**:\n * `enter(nodes)` runs after an item's DOM is inserted (including initial mount);\n * `leave(nodes)` runs before an item's DOM is removed and may return a Promise\n * to hold the DOM until the animation resolves. Setting `leave` disables the\n * bulk-clear / full-replace fast paths.\n */\n/**\n * Per-item accessor. Two access forms:\n * - `item.field` — shorthand, returns accessor for `item.current[field]`\n * - `item(t => t.expr)` — computed expressions\n *\n * In both cases the returned value is a `() => V` accessor.\n * Invoke it (`item.field()`) to read the current value imperatively.\n */\nexport type ItemAccessor<T> = {\n <R>(selector: (t: T) => R): () => R\n} & {\n [K in keyof T]-?: () => T[K]\n} & {\n /**\n * Read the whole current item. Needed when T is a primitive (where the\n * field-map branch collapses to method names like `toString`) or when\n * you want to sample the entire record rather than a single field.\n *\n * Shadows any literal `current` field on T — if T has such a field,\n * use `item(r => r.current)` to disambiguate.\n */\n current(): T\n}\n\nexport interface EachOptions<S, T, M = unknown> extends TransitionOptions {\n items: (s: S) => T[]\n key: (item: T) => string | number\n render: (opts: {\n send: Send<M>\n item: ItemAccessor<T>\n /**\n * Plain (non-Proxy) accessor factory. Compiler-output path; avoid in user code\n * (use `item.field` / `item(fn)` — more ergonomic and bypasses Proxy when compiled).\n */\n acc: <R>(selector: (t: T) => R) => () => R\n index: () => number\n /** @internal Compiler-injected — entry reference for row factory */\n entry?: Record<string, unknown>\n }) => Node[]\n}\n\nexport interface PortalOptions {\n target: HTMLElement | string\n render: () => Node[]\n}\n\nexport interface ForeignOptions<S, M, T extends Record<string, unknown>, Instance> {\n mount: (ctx: { container: HTMLElement; send: Send<M> }) => Instance\n props: (s: S) => T\n sync:\n | ((ctx: { instance: Instance; props: T; prev: T | undefined }) => void)\n | {\n [K in keyof T]?: (ctx: { instance: Instance; value: T[K]; prev: T[K] | undefined }) => void\n }\n destroy: (instance: Instance) => void\n container?: { tag?: string; attrs?: Record<string, string> }\n}\n\nexport interface ChildOptions<S, ChildM> {\n // Type-erased via AnyComponentDef so callers can pass any concrete\n // ComponentDef<S, M, E, D> without a widening helper. The runtime\n // narrows the message shape via the user-supplied `onMsg` callback,\n // which keeps `ChildM` typed at this boundary even though the def\n // itself is opaque.\n def: AnyComponentDef\n key: string | number\n props: (s: S) => Record<string, unknown>\n onMsg?: (msg: ChildM) => unknown | null\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qEAAqE","sourcesContent":["// ── Component Definition ──────────────────────────────────────────\n\nimport type { View } from './view-helpers.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DisposerEvent } from './tracking/disposer-log.js'\n\nexport interface ComponentDef<S, M, E = never, D = void> {\n name: string\n init: (data: D) => [S, E[]]\n update: (state: S, msg: M) => [S, E[]]\n view: (h: View<S, M>) => Node[]\n onEffect?: (ctx: { effect: E; send: Send<M>; signal: AbortSignal }) => void\n\n // Level 2 composition\n propsMsg?: (props: Record<string, unknown>) => M\n receives?: Record<string, (params: unknown) => M>\n\n /** @internal Compiler-injected */\n __dirty?: (oldState: S, newState: S) => number | [number, number]\n /** @internal Compiler-injected */\n __renderToString?: (state: S) => string\n /** @internal Compiler-injected */\n __msgSchema?: object\n /** @internal Compiler-injected — maps top-level state field → dirty-mask bit(s) */\n __maskLegend?: Record<string, number>\n /** @internal Compiler-injected — source-file location of the component() call */\n __componentMeta?: { file: string; line: number }\n /** @internal Compiler-injected — shape of the State type (for introspection) */\n __stateSchema?: object\n /** @internal Compiler-injected — Effect union schema (for introspection) */\n __effectSchema?: object\n /** @internal Compiler-injected — replaces generic Phase 1 + Phase 2 loop */\n __update?: (\n state: S,\n dirty: number,\n bindings: Binding[],\n blocks: StructuralBlock[],\n bindingsBeforePhase1: number,\n ) => void\n /** @internal Compiler-injected — per-message-type specialized handlers.\n * Bypass the entire processMessages pipeline for single-message updates. */\n __handlers?: Record<string, (inst: object, msg: unknown) => [S, E[]]>\n}\n\nexport type Send<M> = (msg: M) => void\n\n/**\n * Type-erased component definition for use at module boundaries where\n * the consumer's `S`, `M`, `E` are internal and invisible to the caller.\n *\n * Why this exists: `ComponentDef<S, M, E, D>` uses property syntax for\n * its callable fields (`init: (data: D) => ...`), and TypeScript\n * checks property syntax with strict (contravariant) variance. That's\n * the right call for user-facing type safety when authoring a\n * component (a narrower `Msg` type can't accidentally satisfy the\n * `update`'s param), but it means `ComponentDef<MyState, MyMsg, MyEffect, MyData>`\n * is NOT structurally assignable to `ComponentDef<unknown, unknown, unknown, unknown>`\n * — the `init: (data: MyData) => ...` field is contravariant in `MyData`,\n * so widening to `unknown` is rejected.\n *\n * `AnyComponentDef` (and `LazyDef<D>` below) declare the same fields\n * using **method syntax** (`init(data: D): ...`), which TypeScript\n * checks bivariantly. Concrete `ComponentDef<S, M, E, D>` assigns into\n * these structurally without any `widenDef` helper at the callsite.\n *\n * Used by every API that accepts an opaque component definition at a\n * module boundary:\n *\n * - `child({ def })`\n * - `lazy({ loader })` — returns `LazyDef<D>` so the loader's `D` survives\n * - `createOnRenderClient({ Layout })` (from `@llui/vike`)\n * - `createOnRenderHtml({ Layout })` (from `@llui/vike`)\n *\n * The `D` parameter is `unknown` here — `child()` doesn't pass init\n * data through, and `Layout` callers pass route-supplied data whose\n * shape is unknown at the type-erased boundary. Use `LazyDef<D>` when\n * you need to preserve the init data shape (the lazy loader case).\n */\nexport interface AnyComponentDef {\n name: string\n init(data: unknown): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n propsMsg?: unknown\n receives?: unknown\n __dirty?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Type-erased component definition for use at module boundaries where the\n * loaded component's S, M, E are internal and invisible to the caller.\n * Only `D` (init data) survives because the caller provides it.\n *\n * `ComponentDef<S, M, E, D>` is structurally assignable to `LazyDef<D>`\n * for any S, M, E — `view: (h: unknown) => Node[]` accepts any View via\n * contravariance, and all other fields widen to `unknown` return types.\n *\n * Used by `lazy()` as the loader's return type. Use `AnyComponentDef`\n * (above) when D is also opaque — most other adapter-layer APIs.\n */\nexport interface LazyDef<D = void> {\n name: string\n // Method syntax — TypeScript checks methods bivariantly, so\n // ComponentDef<S, M, E, D>'s concrete (state: S, msg: M) => ...\n // assigns here even though S/M ≠ unknown. Property syntax would\n // be contravariant and reject the assignment.\n init(data: D): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n propsMsg?: unknown\n receives?: unknown\n __dirty?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Maps a value shape to a reactive-props shape: every field becomes an accessor\n * `(s: S) => V`. Use for Level-1 view function signatures.\n *\n * ```ts\n * type ToolbarData = { tools: Tool[]; theme: 'light' | 'dark' }\n *\n * export function toolbar<S>(props: Props<ToolbarData, S>, send: Send<Msg>) {\n * return [div({ class: props.theme }, [each({ items: props.tools, ... })])]\n * }\n *\n * // Caller — TypeScript enforces per-field accessors; passing a raw value errors:\n * toolbar({ tools: (s: State) => s.tools, theme: (s) => s.theme }, send)\n * ```\n */\nexport type Props<T, S> = {\n [K in keyof T]: (s: S) => T[K]\n}\n\n// ── App Handle ────────────────────────────────────────────────────\n\nexport interface AppHandle {\n dispose(): void\n flush(): void\n /**\n * Dispatch a message into the mounted instance from outside its\n * normal view-bound `send` channel. Useful for adapter layers that\n * need to push updates into a long-lived instance — e.g.\n * `@llui/vike`'s persistent-layout chain pushes layout-data updates\n * into surviving layer instances on client navigation when their\n * `propsMsg` translates the new data into a state-update message.\n *\n * Messages are queued through the same path as `view`-side `send`\n * calls — they batch into the next microtask and process via the\n * normal update loop. Calling `send` after `dispose` is a no-op.\n */\n send(msg: unknown): void\n}\n\n// ── Lifetime ─────────────────────────────────────────────────────────\n\nexport interface Lifetime {\n id: number\n parent: Lifetime | null\n children: Lifetime[]\n disposers: Array<() => void>\n bindings: Binding[]\n /** Per-item updaters — called directly by each() when item changes, bypassing Phase 2 */\n itemUpdaters: Array<() => void>\n /**\n * @internal dev-only back-reference to the owning ComponentInstance.\n * Populated on the root scope by `installDevTools` so `disposeLifetime`\n * can walk up the scope chain and emit DisposerEvents into the\n * instance's `_disposerLog`. Undefined in production.\n */\n instance?: ComponentInstance\n /**\n * @internal dev-only cause hint. Structural primitives (branch, each,\n * child, mountApp teardown) set this field immediately before calling\n * `disposeLifetime`; the dispose path reads it once to stamp the emitted\n * DisposerEvent. Left undefined, `disposeLifetime` falls back to\n * `'component-unmount'`. Undefined in production.\n */\n disposalCause?: DisposerEvent['cause']\n /** @internal dev-only — populated by structural primitives for scope-tree classification */\n _kind?: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n}\n\nexport interface LifetimeNode {\n scopeId: string\n kind: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n active: boolean\n children: LifetimeNode[]\n}\n\n// ── Binding ───────────────────────────────────────────────────────\n\n/**\n * Binding output kinds.\n *\n * `'text' | 'prop' | 'attr' | 'class' | 'style'` write their accessor's\n * return value to the DOM. `'effect'` is a side-effect-only watcher:\n * the accessor is invoked every Phase 2 tick its mask is hit, but its\n * return value is discarded and `applyBinding` is a no-op. Used by\n * `child()` to fire the prop-diff/propsMsg cascade on parent updates\n * without the cost of stringifying the returned props bag onto a\n * detached anchor node every render.\n */\nexport type BindingKind = 'text' | 'prop' | 'attr' | 'class' | 'style' | 'effect'\n\nexport interface Binding {\n mask: number\n accessor: (state: unknown) => unknown\n lastValue: unknown\n kind: BindingKind\n node: Node\n key?: string\n ownerLifetime: Lifetime\n perItem: boolean\n dead: boolean\n}\n\n// ── Structural Primitives ─────────────────────────────────────────\n\nexport interface TransitionOptions {\n enter?: (nodes: Node[]) => void | Promise<void>\n leave?: (nodes: Node[]) => void | Promise<void>\n onTransition?: (ctx: { entering: Node[]; leaving: Node[]; parent: Node }) => void | Promise<void>\n}\n\ninterface BranchOptionsBase extends TransitionOptions {\n /**\n * @internal Set by `show()` / `scope()` sugar when delegating to\n * `branch()`, so the dev-only disposer log can report `'show-hide'` /\n * `'scope-rebuild'` instead of the default `'branch-swap'` for the\n * leaving arm. User code should not set this directly.\n */\n __disposalCause?: DisposerEvent['cause']\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * All cases covered by `cases` — no default allowed (would be dead code).\n */\ntype BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase & {\n on: (s: S) => K\n cases: { [P in K]: (h: View<S, M>) => Node[] }\n default?: never\n}\n\n/**\n * `cases` may cover some but not all keys; `default` handles the rest.\n */\ntype BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase & {\n on: (s: S) => K\n cases?: { [P in K]?: (h: View<S, M>) => Node[] }\n default: (h: View<S, M>) => Node[]\n}\n\n/**\n * `on` returns a wide `string` — exhaustiveness cannot be verified at\n * compile time (the key domain is infinite). Lenient: `default` is\n * optional so existing call sites that predate exhaustiveness typing\n * continue to compile. Authors who want the gate opt in by narrowing\n * `on`'s return type to a literal union.\n */\ntype BranchOptionsWide<S, M> = BranchOptionsBase & {\n on: (s: S) => string\n cases?: Record<string, (h: View<S, M>) => Node[]>\n default?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `branch()`.\n *\n * When `on` returns a literal string union (e.g. `'idle' | 'loading'\n * | 'done'`), TypeScript enforces exhaustiveness: either every union\n * member has a case (and `default` is disallowed as unreachable), or\n * `default` is required to cover the remainder. When `on` returns a\n * wide `string`, `default` stays optional — exhaustiveness isn't\n * meaningful for an unbounded domain.\n *\n * `cases` is optional when `default` is present; `branch({ on, default })`\n * is the canonical dynamic-rebuild shape — `scope()` sugar wraps\n * exactly this form.\n */\nexport type BranchOptions<S, M = unknown, K extends string = string> = string extends K\n ? BranchOptionsWide<S, M>\n : BranchOptionsExhaustive<S, M, K> | BranchOptionsNonExhaustive<S, M, K>\n\nexport interface ShowOptions<S, M = unknown> extends TransitionOptions {\n when: (s: S) => boolean\n render: (h: View<S, M>) => Node[]\n fallback?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `scope()` — rebuilds a subtree when `on(state)` changes.\n *\n * Sugar over `branch({ on, cases: {}, default: render, __disposalCause: 'scope-rebuild' })`.\n * Use when the key is dynamic (e.g. an epoch counter bumped from the\n * outside) and you want a fresh arm — fresh lifetime, fresh bindings —\n * each time it changes. Combine with `sample()` inside `render` for a\n * one-shot current-state read.\n */\nexport interface ScopeOptions<S, M = unknown> extends TransitionOptions {\n on: (s: S) => string\n render: (h: View<S, M>) => Node[]\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * Options for `each()`. The inherited `enter` / `leave` callbacks fire **per item**:\n * `enter(nodes)` runs after an item's DOM is inserted (including initial mount);\n * `leave(nodes)` runs before an item's DOM is removed and may return a Promise\n * to hold the DOM until the animation resolves. Setting `leave` disables the\n * bulk-clear / full-replace fast paths.\n */\n/**\n * Per-item accessor. Two access forms:\n * - `item.field` — shorthand, returns accessor for `item.current[field]`\n * - `item(t => t.expr)` — computed expressions\n *\n * In both cases the returned value is a `() => V` accessor.\n * Invoke it (`item.field()`) to read the current value imperatively.\n */\nexport type ItemAccessor<T> = {\n <R>(selector: (t: T) => R): () => R\n} & {\n [K in keyof T]-?: () => T[K]\n} & {\n /**\n * Read the whole current item. Needed when T is a primitive (where the\n * field-map branch collapses to method names like `toString`) or when\n * you want to sample the entire record rather than a single field.\n *\n * Shadows any literal `current` field on T — if T has such a field,\n * use `item(r => r.current)` to disambiguate.\n */\n current(): T\n}\n\nexport interface EachOptions<S, T, M = unknown> extends TransitionOptions {\n items: (s: S) => T[]\n key: (item: T) => string | number\n render: (opts: {\n send: Send<M>\n item: ItemAccessor<T>\n /**\n * Plain (non-Proxy) accessor factory. Compiler-output path; avoid in user code\n * (use `item.field` / `item(fn)` — more ergonomic and bypasses Proxy when compiled).\n */\n acc: <R>(selector: (t: T) => R) => () => R\n index: () => number\n /**\n * The component's View bag (`h.text`, `h.show`, `h.branch`,\n * `h.scope`, `h.sample`, …). Each-render callers used to reach\n * for the top-level imports; the bag form is symmetric with how\n * `branch.cases[k]`, `show.render`, and `scope.render` receive it.\n * Both still work — destructure whichever is more convenient.\n */\n h: View<S, M>\n /** @internal Compiler-injected — entry reference for row factory */\n entry?: Record<string, unknown>\n }) => Node[]\n}\n\nexport interface PortalOptions {\n target: HTMLElement | string\n render: () => Node[]\n}\n\nexport interface ForeignOptions<S, M, T extends Record<string, unknown>, Instance> {\n /**\n * Construct the imperative instance. Can be async — return a\n * `Promise<Instance>` to defer construction until e.g. a dynamic\n * `import()` resolves. While the promise is pending:\n *\n * - The container element is in the DOM immediately (so layout\n * doesn't shift when the instance arrives).\n * - `sync` is NOT called. State changes are tracked by the\n * primitive and the latest props are applied as the initial\n * sync right after the promise resolves.\n * - If the owning scope disposes before the promise resolves,\n * `destroy(instance)` runs on resolution — no matter how long\n * the promise takes.\n */\n mount: (ctx: { container: HTMLElement; send: Send<M> }) => Instance | Promise<Instance>\n props: (s: S) => T\n sync:\n | ((ctx: { instance: Instance; props: T; prev: T | undefined }) => void)\n | {\n [K in keyof T]?: (ctx: { instance: Instance; value: T[K]; prev: T[K] | undefined }) => void\n }\n destroy: (instance: Instance) => void\n container?: { tag?: string; attrs?: Record<string, string> }\n}\n\nexport interface ChildOptions<S, ChildM> {\n // Type-erased via AnyComponentDef so callers can pass any concrete\n // ComponentDef<S, M, E, D> without a widening helper. The runtime\n // narrows the message shape via the user-supplied `onMsg` callback,\n // which keeps `ChildM` typed at this boundary even though the def\n // itself is opaque.\n def: AnyComponentDef\n key: string | number\n props: (s: S) => Record<string, unknown>\n onMsg?: (msg: ChildM) => unknown | null\n}\n"]}
|
package/dist/update-loop.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentDef, Lifetime, Binding } from './types.js';
|
|
2
2
|
import type { StructuralBlock } from './structural.js';
|
|
3
|
+
import { type DomEnv } from './dom-env.js';
|
|
3
4
|
export declare const FULL_MASK: number;
|
|
4
5
|
export declare function setAddressedDispatcher(fn: (eff: {
|
|
5
6
|
__targetKey: string | number;
|
|
@@ -10,6 +11,7 @@ export interface ComponentInstance<S = unknown, M = unknown, E = unknown> {
|
|
|
10
11
|
state: S;
|
|
11
12
|
initialEffects: E[];
|
|
12
13
|
rootLifetime: Lifetime;
|
|
14
|
+
dom: DomEnv;
|
|
13
15
|
allBindings: Binding[];
|
|
14
16
|
structuralBlocks: StructuralBlock[];
|
|
15
17
|
queue: M[];
|
|
@@ -20,7 +22,7 @@ export interface ComponentInstance<S = unknown, M = unknown, E = unknown> {
|
|
|
20
22
|
signal: AbortSignal;
|
|
21
23
|
abortController: AbortController;
|
|
22
24
|
}
|
|
23
|
-
export declare function createComponentInstance<S, M, E, D = void>(def: ComponentDef<S, M, E, D>, data?: D, parentLifetime?: Lifetime | null): ComponentInstance<S, M, E>;
|
|
25
|
+
export declare function createComponentInstance<S, M, E, D = void>(def: ComponentDef<S, M, E, D>, data?: D, parentLifetime?: Lifetime | null, dom?: DomEnv): ComponentInstance<S, M, E>;
|
|
24
26
|
export declare function flushInstance<S, M, E>(inst: ComponentInstance<S, M, E>): void;
|
|
25
27
|
/**
|
|
26
28
|
* Dev-only: overwrite instance state and re-run both phases with FULL_MASK
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-loop.d.ts","sourceRoot":"","sources":["../src/update-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"update-loop.d.ts","sourceRoot":"","sources":["../src/update-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,cAAc,CAAA;AAmBtD,eAAO,MAAM,SAAS,QAAiB,CAAA;AAMvC,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,CAAC,GAAG,EAAE;IAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAClE,IAAI,CAEN;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,O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