@llui/dom 0.0.19 → 0.0.21
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 +25 -21
- package/dist/addressed.d.ts +1 -1
- package/dist/addressed.d.ts.map +1 -1
- package/dist/addressed.js.map +1 -1
- package/dist/binding.d.ts +2 -2
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +2 -2
- package/dist/binding.js.map +1 -1
- package/dist/devtools.d.ts +3 -3
- package/dist/devtools.d.ts.map +1 -1
- package/dist/devtools.js +14 -12
- package/dist/devtools.js.map +1 -1
- package/dist/el-split.js +3 -3
- package/dist/el-split.js.map +1 -1
- package/dist/el-template.js +3 -3
- package/dist/el-template.js.map +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.js.map +1 -1
- package/dist/hmr.d.ts +2 -1
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +74 -34
- package/dist/hmr.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/lifetime.d.ts +39 -0
- package/dist/lifetime.d.ts.map +1 -0
- package/dist/lifetime.js +250 -0
- package/dist/lifetime.js.map +1 -0
- package/dist/mathml-elements.js +1 -1
- package/dist/mathml-elements.js.map +1 -1
- package/dist/mount.d.ts +41 -7
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +216 -9
- package/dist/mount.js.map +1 -1
- package/dist/primitives/branch.d.ts.map +1 -1
- package/dist/primitives/branch.js +30 -20
- package/dist/primitives/branch.js.map +1 -1
- package/dist/primitives/child.js +12 -12
- package/dist/primitives/child.js.map +1 -1
- package/dist/primitives/context.js +6 -6
- package/dist/primitives/context.js.map +1 -1
- package/dist/primitives/each.d.ts.map +1 -1
- package/dist/primitives/each.js +37 -32
- package/dist/primitives/each.js.map +1 -1
- package/dist/primitives/error-boundary.js +7 -7
- package/dist/primitives/error-boundary.js.map +1 -1
- package/dist/primitives/foreign.js +3 -3
- package/dist/primitives/foreign.js.map +1 -1
- package/dist/primitives/lazy.js +11 -11
- package/dist/primitives/lazy.js.map +1 -1
- package/dist/primitives/on-mount.js +2 -2
- package/dist/primitives/on-mount.js.map +1 -1
- package/dist/primitives/portal.js +4 -4
- package/dist/primitives/portal.js.map +1 -1
- package/dist/primitives/sample.d.ts +18 -0
- package/dist/primitives/sample.d.ts.map +1 -0
- package/dist/primitives/sample.js +22 -0
- package/dist/primitives/sample.js.map +1 -0
- package/dist/primitives/scope.d.ts +25 -0
- package/dist/primitives/scope.d.ts.map +1 -0
- package/dist/primitives/scope.js +36 -0
- package/dist/primitives/scope.js.map +1 -0
- package/dist/primitives/selector.js +4 -4
- package/dist/primitives/selector.js.map +1 -1
- package/dist/primitives/show.d.ts.map +1 -1
- package/dist/primitives/show.js +4 -1
- package/dist/primitives/show.js.map +1 -1
- package/dist/primitives/slice.d.ts.map +1 -1
- package/dist/primitives/slice.js +16 -1
- 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.d.ts +28 -0
- package/dist/primitives/unsafe-html.d.ts.map +1 -0
- package/dist/primitives/unsafe-html.js +82 -0
- package/dist/primitives/unsafe-html.js.map +1 -0
- package/dist/primitives/virtual-each.d.ts.map +1 -1
- package/dist/primitives/virtual-each.js +9 -9
- package/dist/primitives/virtual-each.js.map +1 -1
- package/dist/render-context.d.ts +2 -2
- package/dist/render-context.d.ts.map +1 -1
- package/dist/render-context.js.map +1 -1
- package/dist/ssr.d.ts +4 -4
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +3 -3
- package/dist/ssr.js.map +1 -1
- package/dist/svg-elements.js +1 -1
- package/dist/svg-elements.js.map +1 -1
- package/dist/tracking/disposer-log.d.ts +4 -4
- package/dist/tracking/disposer-log.d.ts.map +1 -1
- package/dist/tracking/disposer-log.js.map +1 -1
- package/dist/types.d.ts +50 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-loop.d.ts +3 -3
- package/dist/update-loop.d.ts.map +1 -1
- package/dist/update-loop.js +12 -8
- package/dist/update-loop.js.map +1 -1
- package/dist/view-helpers.d.ts +15 -1
- package/dist/view-helpers.d.ts.map +1 -1
- package/dist/view-helpers.js +6 -0
- package/dist/view-helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/hmr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { flushInstance } from './update-loop.js';
|
|
2
|
-
import {
|
|
2
|
+
import { createLifetime, disposeLifetime } from './lifetime.js';
|
|
3
3
|
import { setRenderContext, clearRenderContext } from './render-context.js';
|
|
4
4
|
import { setFlatBindings } from './binding.js';
|
|
5
5
|
import { unregisterInstance } from './runtime.js';
|
|
@@ -10,12 +10,23 @@ import { createView } from './view-helpers.js';
|
|
|
10
10
|
* Importing this module registers it with mountApp for hot-swapping.
|
|
11
11
|
*/
|
|
12
12
|
export function enableHmr() {
|
|
13
|
-
_setHmrModule({
|
|
13
|
+
_setHmrModule({
|
|
14
|
+
enableHmr,
|
|
15
|
+
registerForHmr,
|
|
16
|
+
registerForAnchor,
|
|
17
|
+
unregisterForHmr,
|
|
18
|
+
replaceComponent,
|
|
19
|
+
});
|
|
14
20
|
}
|
|
15
21
|
const hmrRegistry = new Map();
|
|
16
22
|
export function registerForHmr(name, inst, container) {
|
|
17
23
|
const entries = hmrRegistry.get(name) ?? [];
|
|
18
|
-
entries.push({ inst: inst, container });
|
|
24
|
+
entries.push({ kind: 'container', inst: inst, container });
|
|
25
|
+
hmrRegistry.set(name, entries);
|
|
26
|
+
}
|
|
27
|
+
export function registerForAnchor(name, inst, anchor, endSentinel) {
|
|
28
|
+
const entries = hmrRegistry.get(name) ?? [];
|
|
29
|
+
entries.push({ kind: 'anchor', inst: inst, anchor, endSentinel });
|
|
19
30
|
hmrRegistry.set(name, entries);
|
|
20
31
|
}
|
|
21
32
|
export function unregisterForHmr(name, inst) {
|
|
@@ -43,9 +54,8 @@ export function replaceComponent(name, newDef) {
|
|
|
43
54
|
if (!entries || entries.length === 0)
|
|
44
55
|
return null;
|
|
45
56
|
let handle = null;
|
|
46
|
-
for (const
|
|
47
|
-
const typedInst = inst;
|
|
48
|
-
// Replace functions on the live definition
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
const typedInst = entry.inst;
|
|
49
59
|
typedInst.def = {
|
|
50
60
|
...typedInst.def,
|
|
51
61
|
update: newDef.update,
|
|
@@ -55,52 +65,82 @@ export function replaceComponent(name, newDef) {
|
|
|
55
65
|
__update: newDef.__update,
|
|
56
66
|
__handlers: newDef.__handlers,
|
|
57
67
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
disposeLifetime(typedInst.rootLifetime);
|
|
69
|
+
// Clear the owned region per-kind.
|
|
70
|
+
if (entry.kind === 'container') {
|
|
71
|
+
entry.container.textContent = '';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// anchor kind — wipe siblings between anchor and endSentinel, keep the
|
|
75
|
+
// anchor AND the end sentinel (they bracket the fresh render).
|
|
76
|
+
let sib = entry.anchor.nextSibling;
|
|
77
|
+
while (sib !== null && sib !== entry.endSentinel) {
|
|
78
|
+
const next = sib.nextSibling;
|
|
79
|
+
sib.parentNode.removeChild(sib);
|
|
80
|
+
sib = next;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
typedInst.rootLifetime = createLifetime(null);
|
|
84
|
+
typedInst.rootLifetime._kind = 'root';
|
|
64
85
|
typedInst.allBindings = [];
|
|
65
86
|
typedInst.structuralBlocks = [];
|
|
66
|
-
// Re-run view with current state
|
|
67
87
|
setFlatBindings(typedInst.allBindings);
|
|
68
88
|
setRenderContext({
|
|
69
|
-
|
|
89
|
+
rootLifetime: typedInst.rootLifetime,
|
|
70
90
|
state: typedInst.state,
|
|
71
91
|
allBindings: typedInst.allBindings,
|
|
72
92
|
structuralBlocks: typedInst.structuralBlocks,
|
|
73
|
-
container,
|
|
93
|
+
container: entry.kind === 'container' ? entry.container : (entry.anchor.parentElement ?? undefined),
|
|
74
94
|
send: typedInst.send,
|
|
75
95
|
instance: typedInst,
|
|
76
96
|
});
|
|
77
97
|
const nodes = typedInst.def.view(createView(typedInst.send));
|
|
78
98
|
clearRenderContext();
|
|
79
99
|
setFlatBindings(null);
|
|
80
|
-
|
|
81
|
-
|
|
100
|
+
if (entry.kind === 'container') {
|
|
101
|
+
for (const node of nodes) {
|
|
102
|
+
entry.container.appendChild(node);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
for (const node of nodes) {
|
|
107
|
+
entry.anchor.parentNode.insertBefore(node, entry.endSentinel);
|
|
108
|
+
}
|
|
82
109
|
}
|
|
83
|
-
// Return AppHandle for the first instance
|
|
84
110
|
if (!handle) {
|
|
85
|
-
handle =
|
|
86
|
-
dispose() {
|
|
87
|
-
unregisterForHmr(name, inst);
|
|
88
|
-
inst.abortController.abort();
|
|
89
|
-
unregisterInstance(inst);
|
|
90
|
-
disposeScope(typedInst.rootScope);
|
|
91
|
-
container.textContent = '';
|
|
92
|
-
},
|
|
93
|
-
flush() {
|
|
94
|
-
flushInstance(inst);
|
|
95
|
-
},
|
|
96
|
-
send(msg) {
|
|
97
|
-
;
|
|
98
|
-
typedInst.send(msg);
|
|
99
|
-
},
|
|
100
|
-
};
|
|
111
|
+
handle = makeReplacementHandle(name, entry, typedInst);
|
|
101
112
|
}
|
|
102
113
|
}
|
|
103
114
|
console.log(`[LLui HMR] ${name} updated — state preserved`);
|
|
104
115
|
return handle;
|
|
105
116
|
}
|
|
117
|
+
function makeReplacementHandle(name, entry, typedInst) {
|
|
118
|
+
return {
|
|
119
|
+
dispose() {
|
|
120
|
+
unregisterForHmr(name, entry.inst);
|
|
121
|
+
entry.inst.abortController.abort();
|
|
122
|
+
unregisterInstance(entry.inst);
|
|
123
|
+
disposeLifetime(typedInst.rootLifetime);
|
|
124
|
+
if (entry.kind === 'container') {
|
|
125
|
+
entry.container.textContent = '';
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
let sib = entry.anchor.nextSibling;
|
|
129
|
+
while (sib !== null && sib !== entry.endSentinel) {
|
|
130
|
+
const next = sib.nextSibling;
|
|
131
|
+
sib.parentNode.removeChild(sib);
|
|
132
|
+
sib = next;
|
|
133
|
+
}
|
|
134
|
+
entry.endSentinel.parentNode?.removeChild(entry.endSentinel);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
flush() {
|
|
138
|
+
flushInstance(entry.inst);
|
|
139
|
+
},
|
|
140
|
+
send(msg) {
|
|
141
|
+
;
|
|
142
|
+
typedInst.send(msg);
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
106
146
|
//# sourceMappingURL=hmr.js.map
|
package/dist/hmr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.js","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,aAAa,CAAC,EAAE,SAAS,EAAE,cAA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IAAI,CAAC,CAAA;QAC7B,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG;gBACP,OAAO;oBACL,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;oBAC5B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;oBAC5B,kBAAkB,CAAC,IAAI,CAAC,CAAA;oBACxB,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;oBACjC,SAAS,CAAC,WAAW,GAAG,EAAE,CAAA;gBAC5B,CAAC;gBACD,KAAK;oBACH,aAAa,CAAC,IAAI,CAAC,CAAA;gBACrB,CAAC;gBACD,IAAI,CAAC,GAAY;oBACf,CAAC;oBAAC,SAAS,CAAC,IAA6B,CAAC,GAAG,CAAC,CAAA;gBAChD,CAAC;aACF,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,4BAA4B,CAAC,CAAA;IAE3D,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { ComponentDef, AppHandle } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport { flushInstance } from './update-loop.js'\nimport { createScope, disposeScope } from './scope.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { unregisterInstance } from './runtime.js'\nimport { _setHmrModule } from './mount.js'\nimport { createView } from './view-helpers.js'\n\n/**\n * Enable HMR state preservation. Called by compiler-generated dev code.\n * Importing this module registers it with mountApp for hot-swapping.\n */\nexport function enableHmr(): void {\n _setHmrModule({ enableHmr, registerForHmr, unregisterForHmr, replaceComponent })\n}\n\n// ── HMR Registry ─────────────────────────────────────────────────\n\ninterface HmrEntry {\n inst: ComponentInstance\n container: HTMLElement\n}\n\nconst hmrRegistry = new Map<string, HmrEntry[]>()\n\nexport function registerForHmr(name: string, inst: object, container: HTMLElement): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ inst: inst as ComponentInstance, container })\n hmrRegistry.set(name, entries)\n}\n\nexport function unregisterForHmr(name: string, inst: object): void {\n const entries = hmrRegistry.get(name)\n if (!entries) return\n const idx = entries.findIndex((e) => e.inst === inst)\n if (idx !== -1) entries.splice(idx, 1)\n if (entries.length === 0) hmrRegistry.delete(name)\n}\n\n/**\n * Hot-swap a component definition on all live instances.\n *\n * Preserves the current state. Replaces update, view, onEffect, and __dirty.\n * Disposes the old scope tree (removing old DOM and bindings),\n * re-runs view(currentState, send) to rebuild fresh DOM.\n *\n * Returns an AppHandle for the first instance (for mountApp compatibility),\n * or null if no instances are registered (first mount).\n */\nexport function replaceComponent<S, M, E>(\n name: string,\n newDef: ComponentDef<S, M, E>,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n\n let handle: AppHandle | null = null\n\n for (const { inst, container } of entries) {\n const typedInst = inst as ComponentInstance<S, M, E>\n\n // Replace functions on the live definition\n typedInst.def = {\n ...typedInst.def,\n update: newDef.update,\n view: newDef.view,\n onEffect: newDef.onEffect,\n __dirty: newDef.__dirty,\n __update: newDef.__update,\n __handlers: newDef.__handlers,\n }\n\n // Dispose old scope tree — removes all old DOM nodes and bindings\n disposeScope(typedInst.rootScope)\n container.textContent = ''\n\n // Create fresh scope tree\n typedInst.rootScope = createScope(null)\n typedInst.rootScope._kind = 'root'\n typedInst.allBindings = []\n typedInst.structuralBlocks = []\n\n // Re-run view with current state\n setFlatBindings(typedInst.allBindings)\n setRenderContext({\n rootScope: typedInst.rootScope,\n state: typedInst.state,\n allBindings: typedInst.allBindings,\n structuralBlocks: typedInst.structuralBlocks,\n container,\n send: typedInst.send as (msg: unknown) => void,\n instance: typedInst as ComponentInstance,\n })\n const nodes = typedInst.def.view(createView<S, M>(typedInst.send))\n clearRenderContext()\n setFlatBindings(null)\n\n for (const node of nodes) {\n container.appendChild(node)\n }\n\n // Return AppHandle for the first instance\n if (!handle) {\n handle = {\n dispose() {\n unregisterForHmr(name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n disposeScope(typedInst.rootScope)\n container.textContent = ''\n },\n flush() {\n flushInstance(inst)\n },\n send(msg: unknown) {\n ;(typedInst.send as (m: unknown) => void)(msg)\n },\n }\n }\n }\n\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n\n return handle\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hmr.js","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,aAAa,CAAC;QACZ,SAAS;QACT,cAAc;QACd,iBAAiB;QACjB,gBAAgB;QAChB,gBAAgB;KACjB,CAAC,CAAA;AACJ,CAAC;AAiBD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAA;AAEjD,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAY,EAAE,SAAsB;IAC/E,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3C,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAyB,EAAE,SAAS,EAAE,CAAC,CAAA;IAC/E,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ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,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBAC/B,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,EAAE,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAA;gBAClC,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC;oBACjD,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,CAAA;oBAC5B,GAAG,CAAC,UAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;oBAChC,GAAG,GAAG,IAAI,CAAA;gBACZ,CAAC;gBACD,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YAC9D,CAAC;QACH,CAAC;QACD,KAAK;YACH,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC;QACD,IAAI,CAAC,GAAY;YACf,CAAC;YAAC,SAAS,CAAC,IAA6B,CAAC,GAAG,CAAC,CAAA;QAChD,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import type { ComponentDef, AppHandle } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport { flushInstance } from './update-loop.js'\nimport { createLifetime, disposeLifetime } from './lifetime.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { unregisterInstance } from './runtime.js'\nimport { _setHmrModule } from './mount.js'\nimport { createView } from './view-helpers.js'\n\n/**\n * Enable HMR state preservation. Called by compiler-generated dev code.\n * Importing this module registers it with mountApp for hot-swapping.\n */\nexport function enableHmr(): void {\n _setHmrModule({\n enableHmr,\n registerForHmr,\n registerForAnchor,\n unregisterForHmr,\n replaceComponent,\n })\n}\n\n// ── HMR Registry ─────────────────────────────────────────────────\n\ntype HmrEntry =\n | {\n kind: 'container'\n inst: ComponentInstance\n container: HTMLElement\n }\n | {\n kind: 'anchor'\n inst: ComponentInstance\n anchor: Comment\n endSentinel: Comment\n }\n\nconst hmrRegistry = new Map<string, HmrEntry[]>()\n\nexport function registerForHmr(name: string, inst: object, container: HTMLElement): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ kind: 'container', inst: inst as ComponentInstance, container })\n hmrRegistry.set(name, entries)\n}\n\nexport function registerForAnchor(\n name: string,\n inst: object,\n anchor: Comment,\n endSentinel: Comment,\n): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ kind: 'anchor', inst: inst as ComponentInstance, anchor, endSentinel })\n hmrRegistry.set(name, entries)\n}\n\nexport function unregisterForHmr(name: string, inst: object): void {\n const entries = hmrRegistry.get(name)\n if (!entries) return\n const idx = entries.findIndex((e) => e.inst === inst)\n if (idx !== -1) entries.splice(idx, 1)\n if (entries.length === 0) hmrRegistry.delete(name)\n}\n\n/**\n * Hot-swap a component definition on all live instances.\n *\n * Preserves the current state. Replaces update, view, onEffect, and __dirty.\n * Disposes the old scope tree (removing old DOM and bindings),\n * re-runs view(currentState, send) to rebuild fresh DOM.\n *\n * Returns an AppHandle for the first instance (for mountApp compatibility),\n * or null if no instances are registered (first mount).\n */\nexport function replaceComponent<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n\n let handle: AppHandle | null = null\n\n for (const entry of entries) {\n const typedInst = entry.inst as ComponentInstance<S, M, E>\n\n typedInst.def = {\n ...typedInst.def,\n update: newDef.update,\n view: newDef.view,\n onEffect: newDef.onEffect,\n __dirty: newDef.__dirty,\n __update: newDef.__update,\n __handlers: newDef.__handlers,\n }\n\n disposeLifetime(typedInst.rootLifetime)\n\n // Clear the owned region per-kind.\n if (entry.kind === 'container') {\n entry.container.textContent = ''\n } else {\n // anchor kind — wipe siblings between anchor and endSentinel, keep the\n // anchor AND the end sentinel (they bracket the fresh render).\n let sib = entry.anchor.nextSibling\n while (sib !== null && sib !== entry.endSentinel) {\n const next = sib.nextSibling\n sib.parentNode!.removeChild(sib)\n sib = next\n }\n }\n\n typedInst.rootLifetime = createLifetime(null)\n typedInst.rootLifetime._kind = 'root'\n typedInst.allBindings = []\n typedInst.structuralBlocks = []\n\n setFlatBindings(typedInst.allBindings)\n setRenderContext({\n rootLifetime: typedInst.rootLifetime,\n state: typedInst.state,\n allBindings: typedInst.allBindings,\n structuralBlocks: typedInst.structuralBlocks,\n container:\n entry.kind === 'container' ? entry.container : (entry.anchor.parentElement ?? undefined),\n send: typedInst.send as (msg: unknown) => void,\n instance: typedInst as ComponentInstance,\n })\n const nodes = typedInst.def.view(createView<S, M>(typedInst.send))\n clearRenderContext()\n setFlatBindings(null)\n\n if (entry.kind === 'container') {\n for (const node of nodes) {\n entry.container.appendChild(node)\n }\n } else {\n for (const node of nodes) {\n entry.anchor.parentNode!.insertBefore(node, entry.endSentinel)\n }\n }\n\n if (!handle) {\n handle = makeReplacementHandle(name, entry, typedInst)\n }\n }\n\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n\n return handle\n}\n\nfunction makeReplacementHandle<S, M, E>(\n name: string,\n entry: HmrEntry,\n typedInst: ComponentInstance<S, M, E>,\n): AppHandle {\n return {\n dispose() {\n unregisterForHmr(name, entry.inst)\n entry.inst.abortController.abort()\n unregisterInstance(entry.inst)\n disposeLifetime(typedInst.rootLifetime)\n if (entry.kind === 'container') {\n entry.container.textContent = ''\n } else {\n let sib = entry.anchor.nextSibling\n while (sib !== null && sib !== entry.endSentinel) {\n const next = sib.nextSibling\n sib.parentNode!.removeChild(sib)\n sib = next\n }\n entry.endSentinel.parentNode?.removeChild(entry.endSentinel)\n }\n },\n flush() {\n flushInstance(entry.inst)\n },\n send(msg: unknown) {\n ;(typedInst.send as (m: unknown) => void)(msg)\n },\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export type { ComponentDef, Send, Props, AppHandle,
|
|
1
|
+
export type { ComponentDef, Send, Props, AppHandle, Lifetime, Binding, BindingKind, TransitionOptions, BranchOptions, ShowOptions, EachOptions, ItemAccessor, PortalOptions, ForeignOptions, ChildOptions, } from './types.js';
|
|
2
2
|
export { component } from './component.js';
|
|
3
3
|
export { createView, type View } from './view-helpers.js';
|
|
4
|
-
export { mountApp, hydrateApp, type MountOptions } from './mount.js';
|
|
4
|
+
export { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js';
|
|
5
5
|
export type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js';
|
|
6
6
|
export type { CoverageSnapshot } from './tracking/coverage.js';
|
|
7
7
|
export type { EachDiff } from './tracking/each-diff.js';
|
|
8
8
|
export type { DisposerEvent } from './tracking/disposer-log.js';
|
|
9
9
|
export type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js';
|
|
10
|
-
export type {
|
|
10
|
+
export type { LifetimeNode } from './types.js';
|
|
11
11
|
export { flush } from './runtime.js';
|
|
12
12
|
export { addressOf } from './addressed.js';
|
|
13
13
|
export { renderToString, renderNodes, serializeNodes } from './ssr.js';
|
|
@@ -16,10 +16,13 @@ export { createContext, provide, provideValue, useContext, useContextValue, type
|
|
|
16
16
|
export { sliceHandler } from './slice-handler.js';
|
|
17
17
|
export { childHandlers, type ChildState, type ChildMsg, type ModuleState, type ModuleMsg, } from './compose.js';
|
|
18
18
|
export { text } from './primitives/text.js';
|
|
19
|
+
export { unsafeHtml } from './primitives/unsafe-html.js';
|
|
19
20
|
export { branch } from './primitives/branch.js';
|
|
20
21
|
export { each } from './primitives/each.js';
|
|
21
22
|
export { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js';
|
|
22
23
|
export { show } from './primitives/show.js';
|
|
24
|
+
export { scope } from './primitives/scope.js';
|
|
25
|
+
export type { ScopeOptions } from './types.js';
|
|
23
26
|
export { slice } from './primitives/slice.js';
|
|
24
27
|
export { portal } from './primitives/portal.js';
|
|
25
28
|
export { foreign } from './primitives/foreign.js';
|
|
@@ -27,6 +30,7 @@ export { child } from './primitives/child.js';
|
|
|
27
30
|
export { lazy, type LazyOptions } from './primitives/lazy.js';
|
|
28
31
|
export type { LazyDef, AnyComponentDef } from './types.js';
|
|
29
32
|
export { memo } from './primitives/memo.js';
|
|
33
|
+
export { sample } from './primitives/sample.js';
|
|
30
34
|
export { selector } from './primitives/selector.js';
|
|
31
35
|
export { onMount } from './primitives/on-mount.js';
|
|
32
36
|
export { errorBoundary } from './primitives/error-boundary.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAA;AAInB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAIzD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAGpG,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC1F,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,YAAY,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,Y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AAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export { component } from './component.js';
|
|
4
4
|
export { createView } from './view-helpers.js';
|
|
5
5
|
// ── Mount ─────────────────────────────────────────────────────────
|
|
6
|
-
export { mountApp, hydrateApp } from './mount.js';
|
|
6
|
+
export { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor } from './mount.js';
|
|
7
7
|
// ── Runtime ───────────────────────────────────────────────────────
|
|
8
8
|
export { flush } from './runtime.js';
|
|
9
9
|
export { addressOf } from './addressed.js';
|
|
@@ -14,16 +14,19 @@ export { sliceHandler } from './slice-handler.js';
|
|
|
14
14
|
export { childHandlers, } from './compose.js';
|
|
15
15
|
// ── View Primitives ───────────────────────────────────────────────
|
|
16
16
|
export { text } from './primitives/text.js';
|
|
17
|
+
export { unsafeHtml } from './primitives/unsafe-html.js';
|
|
17
18
|
export { branch } from './primitives/branch.js';
|
|
18
19
|
export { each } from './primitives/each.js';
|
|
19
20
|
export { virtualEach } from './primitives/virtual-each.js';
|
|
20
21
|
export { show } from './primitives/show.js';
|
|
22
|
+
export { scope } from './primitives/scope.js';
|
|
21
23
|
export { slice } from './primitives/slice.js';
|
|
22
24
|
export { portal } from './primitives/portal.js';
|
|
23
25
|
export { foreign } from './primitives/foreign.js';
|
|
24
26
|
export { child } from './primitives/child.js';
|
|
25
27
|
export { lazy } from './primitives/lazy.js';
|
|
26
28
|
export { memo } from './primitives/memo.js';
|
|
29
|
+
export { sample } from './primitives/sample.js';
|
|
27
30
|
export { selector } from './primitives/selector.js';
|
|
28
31
|
export { onMount } from './primitives/on-mount.js';
|
|
29
32
|
export { errorBoundary } from './primitives/error-boundary.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAoBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AAEzD,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAoBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AAEzD,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAA;AAUpG,qEAAqE;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,UAAU,EACV,eAAe,GAEhB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EACL,aAAa,GAKd,MAAM,cAAc,CAAA;AAErB,qEAAqE;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO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MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AAErD,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["// ── Types ─────────────────────────────────────────────────────────\n\nexport type {\n ComponentDef,\n Send,\n Props,\n AppHandle,\n Lifetime,\n Binding,\n BindingKind,\n TransitionOptions,\n BranchOptions,\n ShowOptions,\n EachOptions,\n ItemAccessor,\n PortalOptions,\n ForeignOptions,\n ChildOptions,\n} from './types.js'\n\n// ── Component ─────────────────────────────────────────────────────\n\nexport { component } from './component.js'\nexport { createView, type View } from './view-helpers.js'\n\n// ── Mount ─────────────────────────────────────────────────────────\n\nexport { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js'\n// installDevTools is NOT re-exported here to keep it out of production bundles.\n// Import directly: import { installDevTools } from '@llui/dom/devtools'\nexport type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js'\nexport type { CoverageSnapshot } from './tracking/coverage.js'\nexport type { EachDiff } from './tracking/each-diff.js'\nexport type { DisposerEvent } from './tracking/disposer-log.js'\nexport type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js'\nexport type { LifetimeNode } from './types.js'\n\n// ── Runtime ───────────────────────────────────────────────────────\n\nexport { flush } from './runtime.js'\nexport { addressOf } from './addressed.js'\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\nexport { mergeHandlers } from './merge-handlers.js'\nexport {\n createContext,\n provide,\n provideValue,\n useContext,\n useContextValue,\n type Context,\n} from './primitives/context.js'\nexport { sliceHandler } from './slice-handler.js'\nexport {\n childHandlers,\n type ChildState,\n type ChildMsg,\n type ModuleState,\n type ModuleMsg,\n} from './compose.js'\n\n// ── View Primitives ───────────────────────────────────────────────\n\nexport { text } from './primitives/text.js'\nexport { unsafeHtml } from './primitives/unsafe-html.js'\nexport { branch } from './primitives/branch.js'\nexport { each } from './primitives/each.js'\nexport { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js'\nexport { show } from './primitives/show.js'\nexport { scope } from './primitives/scope.js'\nexport type { ScopeOptions } from './types.js'\nexport { slice } from './primitives/slice.js'\nexport { portal } from './primitives/portal.js'\nexport { foreign } from './primitives/foreign.js'\nexport { child } from './primitives/child.js'\nexport { lazy, type LazyOptions } from './primitives/lazy.js'\nexport type { LazyDef, AnyComponentDef } from './types.js'\nexport { memo } from './primitives/memo.js'\nexport { sample } from './primitives/sample.js'\nexport { selector } from './primitives/selector.js'\nexport { onMount } from './primitives/on-mount.js'\nexport { errorBoundary } from './primitives/error-boundary.js'\n\n// ── Element Helpers ───────────────────────────────────────────────\n\nexport {\n a,\n abbr,\n article,\n aside,\n b,\n blockquote,\n br,\n button,\n canvas,\n code,\n dd,\n details,\n dialog,\n div,\n dl,\n dt,\n em,\n fieldset,\n figcaption,\n figure,\n footer,\n form,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n header,\n hr,\n i,\n iframe,\n img,\n input,\n label,\n legend,\n li,\n main,\n mark,\n nav,\n ol,\n optgroup,\n option,\n output,\n p,\n pre,\n progress,\n section,\n select,\n small,\n span,\n strong,\n sub,\n summary,\n sup,\n table,\n tbody,\n td,\n textarea,\n tfoot,\n th,\n thead,\n time,\n tr,\n ul,\n video,\n} from './elements.js'\n\n// ── SVG Elements ─────────────────────────────────────────────────\n\nexport {\n svg,\n g,\n defs,\n symbol,\n use,\n circle,\n ellipse,\n line,\n path,\n polygon,\n polyline,\n rect,\n text as svgText,\n tspan,\n textPath,\n clipPath,\n linearGradient,\n radialGradient,\n stop,\n mask,\n pattern,\n marker,\n filter,\n feBlend,\n feColorMatrix,\n feComponentTransfer,\n feComposite,\n feConvolveMatrix,\n feDiffuseLighting,\n feDisplacementMap,\n feDropShadow,\n feFlood,\n feGaussianBlur,\n feImage,\n feMerge,\n feMergeNode,\n feMorphology,\n feOffset,\n feSpecularLighting,\n feTile,\n feTurbulence,\n fePointLight,\n feSpotLight,\n feDistantLight,\n feFuncR,\n feFuncG,\n feFuncB,\n feFuncA,\n image,\n foreignObject,\n animate,\n animateMotion,\n animateTransform,\n set,\n mpath,\n desc,\n title as svgTitle,\n metadata,\n} from './svg-elements.js'\n\n// ── MathML Elements ──────────────────────────────────────────────\n\nexport {\n math,\n mi,\n mn,\n mo,\n ms,\n mtext,\n mrow,\n mfrac,\n msqrt,\n mroot,\n msup,\n msub,\n msubsup,\n munder,\n mover,\n munderover,\n mmultiscripts,\n mprescripts,\n mnone,\n mtable,\n mtr,\n mtd,\n mspace,\n mpadded,\n mphantom,\n menclose,\n merror,\n maction,\n semantics,\n annotation,\n annotationXml,\n} from './mathml-elements.js'\n\n// ── Form Utilities ────────────────────────────────────────────────\n\nexport { applyField, type FieldMsg } from './form.js'\n\n// ── Compiler Target ───────────────────────────────────────────────\n\nexport { elSplit } from './el-split.js'\nexport { elTemplate } from './el-template.js'\nexport { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js'\n"]}
|
package/dist/internal.d.ts
CHANGED
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js';
|
|
20
20
|
export type { RenderContext } from './render-context.js';
|
|
21
|
-
export {
|
|
21
|
+
export { createLifetime, disposeLifetime, addDisposer } from './lifetime.js';
|
|
22
22
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/internal.js
CHANGED
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
* low-level glue.
|
|
18
18
|
*/
|
|
19
19
|
export { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js';
|
|
20
|
-
export {
|
|
20
|
+
export { createLifetime, disposeLifetime, addDisposer } from './lifetime.js';
|
|
21
21
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA","sourcesContent":["/**\n * Internal primitives surface — exported for framework-adapter packages\n * (`@llui/vike`, `@llui/router`, `@llui/transitions`) that need to build\n * their own structural primitives on top of LLui's scope + render-context\n * machinery.\n *\n * **Not part of the public API.** App authors should not import from\n * `@llui/dom/internal`. The shapes here are free to change without a\n * major version bump — the stability contract applies only to the public\n * barrel at `@llui/dom`. Reach for this subpath when you're writing a\n * primitive like `pageSlot()` (from `@llui/vike`) that has to participate\n * in the scope tree, not when you're writing application views.\n *\n * Added in 0.0.16 to support `@llui/vike`'s persistent-layout feature.\n * Any future adapter-level primitive that needs render-context / scope\n * access should re-export from this file rather than duplicating the\n * low-level glue.\n */\n\nexport { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js'\nexport type { RenderContext } from './render-context.js'\nexport { createLifetime, disposeLifetime, addDisposer } from './lifetime.js'\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Lifetime, Binding } from './types.js';
|
|
2
|
+
export declare function createLifetime(parent: Lifetime | null): Lifetime;
|
|
3
|
+
/**
|
|
4
|
+
* Dispose a scope and all its children. By default, detaches the scope
|
|
5
|
+
* from its parent's `children` array via `indexOf + splice` — O(N) per
|
|
6
|
+
* call, which becomes O(N²) when disposing many sibling scopes in bulk
|
|
7
|
+
* (e.g. `each` clearing 1000 rows).
|
|
8
|
+
*
|
|
9
|
+
* Pass `skipParentRemoval = true` when the caller will batch-remove
|
|
10
|
+
* children afterwards (see `removeOrphanedFromParent`). The scope's
|
|
11
|
+
* `parent` pointer is still set to `null` so the caller can identify
|
|
12
|
+
* orphaned entries.
|
|
13
|
+
*/
|
|
14
|
+
export declare function disposeLifetime(scope: Lifetime, skipParentRemoval?: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Batch-remove children with `parent === null` from `parent.children`.
|
|
17
|
+
* Called after a bulk `disposeLifetime(child, true)` pass to collapse the
|
|
18
|
+
* individual O(N) splice operations into one O(N) scan.
|
|
19
|
+
*/
|
|
20
|
+
export declare function removeOrphanedChildren(parent: Lifetime): void;
|
|
21
|
+
/**
|
|
22
|
+
* Bulk dispose an array of sibling scopes — avoids per-scope function call
|
|
23
|
+
* overhead. Used by each() clear path where 1000+ scopes are disposed at once.
|
|
24
|
+
* Caller must call removeOrphanedChildren(parent) afterwards.
|
|
25
|
+
*/
|
|
26
|
+
export declare function disposeLifetimesBulk(scopes: Lifetime[]): void;
|
|
27
|
+
export declare function addBinding(scope: Lifetime, binding: Binding): void;
|
|
28
|
+
export declare function addItemUpdater(scope: Lifetime, updater: () => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* Register a per-item updater that compares the new value against the last
|
|
31
|
+
* value before applying. Shared by `text()`, `elSplit()`, and `elTemplate()`
|
|
32
|
+
* so the equality-check logic lives in one place.
|
|
33
|
+
*
|
|
34
|
+
* @param apply - DOM write: receives the new value when it differs
|
|
35
|
+
* @returns the initial value (caller should apply it to the DOM)
|
|
36
|
+
*/
|
|
37
|
+
export declare function addCheckedItemUpdater<V>(scope: Lifetime, get: () => V, apply: (value: V) => void): V;
|
|
38
|
+
export declare function addDisposer(scope: Lifetime, disposer: () => void): void;
|
|
39
|
+
//# sourceMappingURL=lifetime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifetime.d.ts","sourceRoot":"","sources":["../src/lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AA8CnD,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,CA8BhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,iBAAiB,UAAQ,GAAG,IAAI,CAqEhF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAO7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAuC7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAIlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAGzE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,MAAM,CAAC,EACZ,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GACxB,CAAC,CASH;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAGvE"}
|