@elurjs/core 3.6.2 → 3.7.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/async.cjs +1 -1
- package/dist/lib/async.js +1 -1
- package/dist/lib/component.cjs +1 -2
- package/dist/lib/component.js +2 -66
- package/dist/lib/context.cjs +1 -1
- package/dist/lib/context.js +35 -23
- package/dist/lib/devtools.cjs +1 -1
- package/dist/lib/devtools.js +1 -1
- package/dist/lib/elur/async.cjs +1 -1
- package/dist/lib/elur/async.cjs.map +1 -1
- package/dist/lib/elur/async.js +1 -1
- package/dist/lib/elur/component.cjs +1 -2
- package/dist/lib/elur/component.d.cts +1 -17
- package/dist/lib/elur/component.d.ts +1 -17
- package/dist/lib/elur/component.js +2 -66
- package/dist/lib/elur/context.cjs +1 -1
- package/dist/lib/elur/context.cjs.map +1 -1
- package/dist/lib/elur/context.d.cts +5 -0
- package/dist/lib/elur/context.d.ts +5 -0
- package/dist/lib/elur/context.js +35 -23
- package/dist/lib/elur/context.js.map +1 -1
- package/dist/lib/elur/devtools.cjs +1 -1
- package/dist/lib/elur/devtools.cjs.map +1 -1
- package/dist/lib/elur/devtools.js +1 -1
- package/dist/lib/elur/form.cjs +1 -1
- package/dist/lib/elur/form.cjs.map +1 -1
- package/dist/lib/elur/form.js +1 -1
- package/dist/lib/elur/hydrate/index.cjs +1 -2
- package/dist/lib/elur/hydrate/index.d.cts +1 -13
- package/dist/lib/elur/hydrate/index.d.ts +1 -13
- package/dist/lib/elur/hydrate/index.js +2 -410
- package/dist/lib/elur/lifecycle.cjs +1 -1
- package/dist/lib/elur/lifecycle.cjs.map +1 -1
- package/dist/lib/elur/lifecycle.d.cts +27 -0
- package/dist/lib/elur/lifecycle.d.ts +27 -0
- package/dist/lib/elur/lifecycle.js +4 -0
- package/dist/lib/elur/lifecycle.js.map +1 -1
- package/dist/lib/elur/next/component.d.cts +281 -0
- package/dist/lib/elur/next/component.d.ts +281 -0
- package/dist/lib/elur/next/dom-write.d.cts +18 -0
- package/dist/lib/elur/next/dom-write.d.ts +18 -0
- package/dist/lib/elur/next/hydrate.d.cts +14 -0
- package/dist/lib/elur/next/hydrate.d.ts +14 -0
- package/dist/lib/elur/next/keyed-diff.d.cts +46 -0
- package/dist/lib/elur/next/keyed-diff.d.ts +46 -0
- package/dist/lib/elur/next/mount-helpers.d.cts +25 -0
- package/dist/lib/elur/next/mount-helpers.d.ts +25 -0
- package/dist/lib/elur/next/mount.d.cts +29 -0
- package/dist/lib/elur/next/mount.d.ts +29 -0
- package/dist/lib/elur/next/node-binding.d.cts +6 -0
- package/dist/lib/elur/next/node-binding.d.ts +6 -0
- package/dist/lib/elur/next/reactivity.d.cts +193 -0
- package/dist/lib/elur/next/reactivity.d.ts +193 -0
- package/dist/lib/elur/next-2/component.cjs +2 -0
- package/dist/lib/elur/next-2/component.cjs.map +1 -0
- package/dist/lib/elur/next-2/component.d.cts +283 -0
- package/dist/lib/elur/next-2/component.d.ts +283 -0
- package/dist/lib/elur/next-2/component.js +340 -0
- package/dist/lib/elur/next-2/component.js.map +1 -0
- package/dist/lib/elur/next-2/dom-write.cjs +2 -0
- package/dist/lib/elur/next-2/dom-write.cjs.map +1 -0
- package/dist/lib/elur/next-2/dom-write.d.cts +18 -0
- package/dist/lib/elur/next-2/dom-write.d.ts +18 -0
- package/dist/lib/elur/next-2/dom-write.js +31 -0
- package/dist/lib/elur/next-2/dom-write.js.map +1 -0
- package/dist/lib/elur/next-2/hydrate.cjs +2 -0
- package/dist/lib/elur/next-2/hydrate.cjs.map +1 -0
- package/dist/lib/elur/next-2/hydrate.d.cts +30 -0
- package/dist/lib/elur/next-2/hydrate.d.ts +30 -0
- package/dist/lib/elur/next-2/hydrate.js +449 -0
- package/dist/lib/elur/next-2/hydrate.js.map +1 -0
- package/dist/lib/elur/next-2/keyed-diff.cjs +2 -0
- package/dist/lib/elur/next-2/keyed-diff.cjs.map +1 -0
- package/dist/lib/elur/next-2/keyed-diff.d.cts +79 -0
- package/dist/lib/elur/next-2/keyed-diff.d.ts +79 -0
- package/dist/lib/elur/next-2/keyed-diff.js +208 -0
- package/dist/lib/elur/next-2/keyed-diff.js.map +1 -0
- package/dist/lib/elur/next-2/mount-helpers.cjs +2 -0
- package/dist/lib/elur/next-2/mount-helpers.cjs.map +1 -0
- package/dist/lib/elur/next-2/mount-helpers.d.cts +25 -0
- package/dist/lib/elur/next-2/mount-helpers.d.ts +25 -0
- package/dist/lib/elur/next-2/mount-helpers.js +87 -0
- package/dist/lib/elur/next-2/mount-helpers.js.map +1 -0
- package/dist/lib/elur/next-2/mount.cjs +2 -0
- package/dist/lib/elur/next-2/mount.cjs.map +1 -0
- package/dist/lib/elur/next-2/mount.d.cts +29 -0
- package/dist/lib/elur/next-2/mount.d.ts +29 -0
- package/dist/lib/elur/next-2/mount.js +34 -0
- package/dist/lib/elur/next-2/mount.js.map +1 -0
- package/dist/lib/elur/next-2/node-binding.cjs +2 -0
- package/dist/lib/elur/next-2/node-binding.cjs.map +1 -0
- package/dist/lib/elur/next-2/node-binding.d.cts +6 -0
- package/dist/lib/elur/next-2/node-binding.d.ts +6 -0
- package/dist/lib/elur/next-2/node-binding.js +130 -0
- package/dist/lib/elur/next-2/node-binding.js.map +1 -0
- package/dist/lib/elur/next-2/reactivity.cjs +2 -0
- package/dist/lib/elur/next-2/reactivity.cjs.map +1 -0
- package/dist/lib/elur/next-2/reactivity.d.cts +220 -0
- package/dist/lib/elur/next-2/reactivity.d.ts +220 -0
- package/dist/lib/elur/next-2/reactivity.js +614 -0
- package/dist/lib/elur/next-2/reactivity.js.map +1 -0
- package/dist/lib/elur/next-2/scheduler.cjs +2 -0
- package/dist/lib/elur/next-2/scheduler.cjs.map +1 -0
- package/dist/lib/elur/next-2/scheduler.d.cts +23 -0
- package/dist/lib/elur/next-2/scheduler.d.ts +23 -0
- package/dist/lib/elur/next-2/scheduler.js +26 -0
- package/dist/lib/elur/next-2/scheduler.js.map +1 -0
- package/dist/lib/elur/plugins.cjs +1 -1
- package/dist/lib/elur/plugins.cjs.map +1 -1
- package/dist/lib/elur/plugins.js +1 -1
- package/dist/lib/elur/reactivity.cjs +1 -2
- package/dist/lib/elur/reactivity.d.cts +1 -67
- package/dist/lib/elur/reactivity.d.ts +1 -67
- package/dist/lib/elur/reactivity.js +2 -218
- package/dist/lib/elur/router.cjs +1 -1
- package/dist/lib/elur/router.cjs.map +1 -1
- package/dist/lib/elur/router.js +1 -1
- package/dist/lib/elur/server/index.cjs +1 -1
- package/dist/lib/elur/server/index.cjs.map +1 -1
- package/dist/lib/elur/server/index.js +175 -107
- package/dist/lib/elur/server/index.js.map +1 -1
- package/dist/lib/elur/store.cjs +1 -1
- package/dist/lib/elur/store.cjs.map +1 -1
- package/dist/lib/elur/store.js +1 -1
- package/dist/lib/elur/template/bindings.cjs +1 -1
- package/dist/lib/elur/template/bindings.cjs.map +1 -1
- package/dist/lib/elur/template/bindings.js +98 -84
- package/dist/lib/elur/template/bindings.js.map +1 -1
- package/dist/lib/elur/template/dom-write.d.cts +1 -5
- package/dist/lib/elur/template/dom-write.d.ts +1 -5
- package/dist/lib/elur/template/error-boundary.cjs +1 -1
- package/dist/lib/elur/template/error-boundary.cjs.map +1 -1
- package/dist/lib/elur/template/error-boundary.js +56 -50
- package/dist/lib/elur/template/error-boundary.js.map +1 -1
- package/dist/lib/elur/template/html.cjs +1 -1
- package/dist/lib/elur/template/html.cjs.map +1 -1
- package/dist/lib/elur/template/html.js +40 -37
- package/dist/lib/elur/template/html.js.map +1 -1
- package/dist/lib/elur/template/index.cjs +1 -1
- package/dist/lib/elur/template/index.d.cts +2 -1
- package/dist/lib/elur/template/index.d.ts +2 -1
- package/dist/lib/elur/template/index.js +13 -12
- package/dist/lib/elur/template/keyed-diff.d.cts +1 -32
- package/dist/lib/elur/template/keyed-diff.d.ts +1 -32
- package/dist/lib/elur/template/keyed.cjs +1 -1
- package/dist/lib/elur/template/keyed.cjs.map +1 -1
- package/dist/lib/elur/template/keyed.d.cts +10 -2
- package/dist/lib/elur/template/keyed.d.ts +10 -2
- package/dist/lib/elur/template/keyed.js +12 -1
- package/dist/lib/elur/template/keyed.js.map +1 -1
- package/dist/lib/elur/template/mount-helpers.d.cts +1 -29
- package/dist/lib/elur/template/mount-helpers.d.ts +1 -29
- package/dist/lib/elur/template/node-binding.d.cts +1 -6
- package/dist/lib/elur/template/node-binding.d.ts +1 -6
- package/dist/lib/elur/template/portal.cjs +1 -1
- package/dist/lib/elur/template/portal.cjs.map +1 -1
- package/dist/lib/elur/template/portal.js +1 -1
- package/dist/lib/elur/template/transitions.cjs +1 -1
- package/dist/lib/elur/template/transitions.cjs.map +1 -1
- package/dist/lib/elur/template/transitions.js +2 -2
- package/dist/lib/elur/template/types.cjs +1 -1
- package/dist/lib/elur/template/types.cjs.map +1 -1
- package/dist/lib/elur/template/types.d.cts +55 -0
- package/dist/lib/elur/template/types.d.ts +55 -0
- package/dist/lib/elur/template/types.js +5 -1
- package/dist/lib/elur/template/types.js.map +1 -1
- package/dist/lib/elur.cjs +1 -1
- package/dist/lib/elur.js +2 -2
- package/dist/lib/form.cjs +1 -1
- package/dist/lib/form.js +1 -1
- package/dist/lib/hydrate.cjs +1 -2
- package/dist/lib/hydrate.js +2 -410
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.js +2 -2
- package/dist/lib/lifecycle.cjs +1 -1
- package/dist/lib/lifecycle.js +4 -0
- package/dist/lib/plugins.cjs +1 -1
- package/dist/lib/plugins.js +1 -1
- package/dist/lib/router.cjs +1 -1
- package/dist/lib/router.js +1 -1
- package/dist/lib/server.cjs +1 -1
- package/dist/lib/server.js +175 -107
- package/dist/lib/signals.cjs +1 -2
- package/dist/lib/signals.js +2 -218
- package/dist/lib/store.cjs +1 -1
- package/dist/lib/store.js +1 -1
- package/dist/lib/template.cjs +1 -1
- package/dist/lib/template.js +13 -12
- package/package.json +7 -9
- package/dist/lib/elur/component.cjs.map +0 -1
- package/dist/lib/elur/component.js.map +0 -1
- package/dist/lib/elur/hydrate/index.cjs.map +0 -1
- package/dist/lib/elur/hydrate/index.js.map +0 -1
- package/dist/lib/elur/reactivity.cjs.map +0 -1
- package/dist/lib/elur/reactivity.js.map +0 -1
- package/dist/lib/elur/template/dom-write.cjs +0 -2
- package/dist/lib/elur/template/dom-write.cjs.map +0 -1
- package/dist/lib/elur/template/dom-write.js +0 -16
- package/dist/lib/elur/template/dom-write.js.map +0 -1
- package/dist/lib/elur/template/keyed-diff.cjs +0 -2
- package/dist/lib/elur/template/keyed-diff.cjs.map +0 -1
- package/dist/lib/elur/template/keyed-diff.js +0 -100
- package/dist/lib/elur/template/keyed-diff.js.map +0 -1
- package/dist/lib/elur/template/mount-helpers.cjs +0 -2
- package/dist/lib/elur/template/mount-helpers.cjs.map +0 -1
- package/dist/lib/elur/template/mount-helpers.js +0 -132
- package/dist/lib/elur/template/mount-helpers.js.map +0 -1
- package/dist/lib/elur/template/node-binding.cjs +0 -2
- package/dist/lib/elur/template/node-binding.cjs.map +0 -1
- package/dist/lib/elur/template/node-binding.js +0 -95
- package/dist/lib/elur/template/node-binding.js.map +0 -1
package/dist/lib/signals.js
CHANGED
|
@@ -1,218 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return {
|
|
4
|
-
ctxPool: [],
|
|
5
|
-
ctxStack: [],
|
|
6
|
-
activeEffect: null,
|
|
7
|
-
activeDeps: null,
|
|
8
|
-
activeErrorHandler: null,
|
|
9
|
-
errorHandlerStack: [],
|
|
10
|
-
batchLevel: 0,
|
|
11
|
-
pendingEffectsSet: /* @__PURE__ */ new Set(),
|
|
12
|
-
pendingEffectsArr: [],
|
|
13
|
-
effectDepth: 0,
|
|
14
|
-
notifyBuf: [],
|
|
15
|
-
notifyBase: 0,
|
|
16
|
-
signalDebugHooks: null
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
var t = Symbol.for("@elurjs/core/reactivity-state"), n = globalThis, r = (() => {
|
|
20
|
-
let r = n[t];
|
|
21
|
-
if (r) {
|
|
22
|
-
let t = e(), n = r;
|
|
23
|
-
for (let e of Object.keys(t)) e in n || (n[e] = t[e]);
|
|
24
|
-
return r;
|
|
25
|
-
}
|
|
26
|
-
let i = e();
|
|
27
|
-
return n[t] = i, i;
|
|
28
|
-
})();
|
|
29
|
-
function i(e) {
|
|
30
|
-
r.errorHandlerStack.push(r.activeErrorHandler), r.activeErrorHandler = e;
|
|
31
|
-
}
|
|
32
|
-
function a() {
|
|
33
|
-
r.activeErrorHandler = r.errorHandlerStack.pop() ?? null;
|
|
34
|
-
}
|
|
35
|
-
var o = 100, s = 64, c = 16, l = 32;
|
|
36
|
-
function u() {
|
|
37
|
-
let e = r.signalDebugHookSet;
|
|
38
|
-
if (!e || e.size === 0) {
|
|
39
|
-
r.signalDebugHooks = null;
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (e.size === 1) {
|
|
43
|
-
r.signalDebugHooks = e.values().next().value ?? null;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
r.signalDebugHooks = {
|
|
47
|
-
onCreate(t, n) {
|
|
48
|
-
for (let r of e) r.onCreate?.(t, n);
|
|
49
|
-
},
|
|
50
|
-
onWrite(t, n) {
|
|
51
|
-
for (let r of e) r.onWrite?.(t, n);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function d(e) {
|
|
56
|
-
let t = /* @__PURE__ */ new Set();
|
|
57
|
-
e && t.add(e), r.signalDebugHookSet = t, u();
|
|
58
|
-
}
|
|
59
|
-
function f(e) {
|
|
60
|
-
let t = r.signalDebugHookSet;
|
|
61
|
-
return t || (t = /* @__PURE__ */ new Set(), r.signalDebugHooks && t.add(r.signalDebugHooks), r.signalDebugHookSet = t), t.add(e), u(), () => {
|
|
62
|
-
t.delete(e), u();
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function p() {
|
|
66
|
-
return r.notifyBuf.length;
|
|
67
|
-
}
|
|
68
|
-
var m = class {
|
|
69
|
-
_value;
|
|
70
|
-
_subs = /* @__PURE__ */ new Set();
|
|
71
|
-
constructor(e) {
|
|
72
|
-
this._value = e, r.signalDebugHooks?.onCreate?.(this, e);
|
|
73
|
-
}
|
|
74
|
-
get value() {
|
|
75
|
-
return r.activeEffect && (this._subs.add(r.activeEffect), r.activeDeps?.add(this)), this._value;
|
|
76
|
-
}
|
|
77
|
-
set value(e) {
|
|
78
|
-
Object.is(this._value, e) || (this._value = e, r.signalDebugHooks?.onWrite?.(this, e), this._notify());
|
|
79
|
-
}
|
|
80
|
-
update(e) {
|
|
81
|
-
this.value = e(this._value);
|
|
82
|
-
}
|
|
83
|
-
peek() {
|
|
84
|
-
return this._value;
|
|
85
|
-
}
|
|
86
|
-
_removeSub(e) {
|
|
87
|
-
this._subs.delete(e);
|
|
88
|
-
}
|
|
89
|
-
_notify() {
|
|
90
|
-
if (r.batchLevel > 0) {
|
|
91
|
-
for (let e of this._subs) r.pendingEffectsSet.has(e) || (r.pendingEffectsSet.add(e), r.pendingEffectsArr.push(e));
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
let e = r.notifyBase, t = 0;
|
|
95
|
-
for (let n of this._subs) r.notifyBuf[e + t++] = n;
|
|
96
|
-
r.notifyBase = e + t;
|
|
97
|
-
try {
|
|
98
|
-
for (let n = 0; n < t; n++) {
|
|
99
|
-
let t = r.notifyBuf[e + n];
|
|
100
|
-
r.notifyBuf[e + n] = null, t?.();
|
|
101
|
-
}
|
|
102
|
-
} finally {
|
|
103
|
-
r.notifyBase = e, e === 0 && r.notifyBuf.length > s && t < c && (r.notifyBuf.length = l);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
dispose() {
|
|
107
|
-
this._subs.clear();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
function h(e) {
|
|
111
|
-
return new m(e);
|
|
112
|
-
}
|
|
113
|
-
function g(e) {
|
|
114
|
-
let t = !1, n, i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = r.activeErrorHandler, c = () => {
|
|
115
|
-
if (t) return;
|
|
116
|
-
typeof n == "function" && n();
|
|
117
|
-
let l = i;
|
|
118
|
-
i = a, a = l, a.clear();
|
|
119
|
-
let u = r.ctxPool.length > 0 ? r.ctxPool.pop() : {
|
|
120
|
-
effect: null,
|
|
121
|
-
deps: null
|
|
122
|
-
};
|
|
123
|
-
if (u.effect = r.activeEffect, u.deps = r.activeDeps, r.ctxStack.push(u), r.activeEffect = c, r.activeDeps = a, r.effectDepth++, r.effectDepth > o) {
|
|
124
|
-
r.effectDepth = 0;
|
|
125
|
-
let e = r.ctxStack.pop();
|
|
126
|
-
throw r.activeEffect = e.effect, r.activeDeps = e.deps, e.effect = null, e.deps = null, r.ctxPool.push(e), Error("[elur] Maximum effect re-execution depth exceeded (possible infinite loop).");
|
|
127
|
-
}
|
|
128
|
-
try {
|
|
129
|
-
n = e();
|
|
130
|
-
} catch (e) {
|
|
131
|
-
if (s) s(e);
|
|
132
|
-
else throw e;
|
|
133
|
-
} finally {
|
|
134
|
-
r.effectDepth--;
|
|
135
|
-
let e = r.ctxStack.pop();
|
|
136
|
-
r.activeEffect = e.effect, r.activeDeps = e.deps, e.effect = null, e.deps = null, r.ctxPool.push(e);
|
|
137
|
-
for (let e of i) a.has(e) || e._removeSub(c);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
return c(), () => {
|
|
141
|
-
t = !0, typeof n == "function" && n();
|
|
142
|
-
for (let e of a) e._removeSub(c);
|
|
143
|
-
a.clear(), i.clear();
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
var _ = Symbol("elur-computed-uninitialized");
|
|
147
|
-
function v(e, t = Object.is) {
|
|
148
|
-
let n = new m(_), r = null, i = !1, a = !1, o = () => {
|
|
149
|
-
i || a || (i = !0, b(() => {
|
|
150
|
-
r = g(() => {
|
|
151
|
-
let r = e(), i = n.peek();
|
|
152
|
-
(i === _ || !t(r, i)) && (n.value = r);
|
|
153
|
-
});
|
|
154
|
-
}));
|
|
155
|
-
}, s = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n), "value");
|
|
156
|
-
if (!s?.get || !s?.set) throw Error("[elur] Internal error: Signal.value descriptor not found.");
|
|
157
|
-
Object.defineProperty(n, "value", {
|
|
158
|
-
get() {
|
|
159
|
-
return o(), s.get.call(this);
|
|
160
|
-
},
|
|
161
|
-
set(e) {
|
|
162
|
-
s.set.call(this, e);
|
|
163
|
-
},
|
|
164
|
-
configurable: !0
|
|
165
|
-
});
|
|
166
|
-
let c = n.dispose;
|
|
167
|
-
return n.dispose = () => {
|
|
168
|
-
a = !0, r?.(), r = null, c.call(n);
|
|
169
|
-
}, n;
|
|
170
|
-
}
|
|
171
|
-
function y(e) {
|
|
172
|
-
r.batchLevel++;
|
|
173
|
-
try {
|
|
174
|
-
e();
|
|
175
|
-
} finally {
|
|
176
|
-
if (r.batchLevel--, r.batchLevel === 0 && r.pendingEffectsArr.length > 0) {
|
|
177
|
-
let e = r.pendingEffectsArr.length;
|
|
178
|
-
for (let t = 0; t < e; t++) r.pendingEffectsArr[t]();
|
|
179
|
-
r.pendingEffectsArr.length = 0, r.pendingEffectsSet.clear();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function b(e) {
|
|
184
|
-
let t = r.activeEffect, n = r.activeDeps;
|
|
185
|
-
r.activeEffect = null, r.activeDeps = null;
|
|
186
|
-
try {
|
|
187
|
-
return e();
|
|
188
|
-
} finally {
|
|
189
|
-
r.activeEffect = t, r.activeDeps = n;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function x(e, t, n = {}) {
|
|
193
|
-
let { immediate: r = !1, once: i = !1 } = n, a = e instanceof m ? () => e.value : e, o, s = !0, c = !1, l = g(() => {
|
|
194
|
-
let e = a();
|
|
195
|
-
if (s) {
|
|
196
|
-
if (s = !1, r && !c) {
|
|
197
|
-
let n = e;
|
|
198
|
-
b(() => t(n, void 0)), i && (c = !0, Promise.resolve().then(l));
|
|
199
|
-
}
|
|
200
|
-
o = e;
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (!c) {
|
|
204
|
-
let n = e, r = o;
|
|
205
|
-
o = e, b(() => t(n, r)), i && (c = !0, Promise.resolve().then(l));
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
return () => {
|
|
209
|
-
c = !0, l();
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
function S(e) {
|
|
213
|
-
return e ? Promise.resolve().then(e) : Promise.resolve();
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
export { m as Signal, f as _addSignalDebugHooks, p as _getNotifyBufSize, a as _popErrorHandler, i as _pushErrorHandler, d as _setSignalDebugHooks, y as batch, v as computed, g as effect, S as nextTick, h as signal, b as untrack, x as watch };
|
|
217
|
-
|
|
218
|
-
//# sourceMappingURL=signals.js.map
|
|
1
|
+
import { Computed as e, Owner as t, ReactiveCycleError as n, Signal as r, _addSignalDebugHooks as i, _bindDerived as a, _bindSignal as o, _bindText as s, _getNotifyBufSize as c, _popErrorHandler as l, _pushErrorHandler as u, _renderEffect as d, _setSignalDebugHooks as f, batch as p, computed as m, constSignal as h, createRoot as g, effect as _, getOwner as v, nextTick as y, onCleanup as b, runWithOwner as x, signal as S, untrack as C, watch as w } from "./elur/next-2/reactivity.js";
|
|
2
|
+
export { e as Computed, t as Owner, n as ReactiveCycleError, r as Signal, i as _addSignalDebugHooks, a as _bindDerived, o as _bindSignal, s as _bindText, c as _getNotifyBufSize, l as _popErrorHandler, u as _pushErrorHandler, d as _renderEffect, f as _setSignalDebugHooks, p as batch, m as computed, h as constSignal, g as createRoot, _ as effect, v as getOwner, y as nextTick, b as onCleanup, x as runWithOwner, S as signal, C as untrack, w as watch };
|
package/dist/lib/store.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./elur/next-2/reactivity.cjs`);var t=class extends e.Signal{label;constructor(e,t=`ReadonlySignal`){super(e.peek()),this.label=t,Object.defineProperty(this,`value`,{get:()=>e.value,set:()=>{throw Error(`[elur] "${this.label}" is read-only.`)},configurable:!1}),this.update=()=>{throw Error(`[elur] "${this.label}" is read-only.`)},this.dispose=()=>{throw Error(`[elur] Cannot dispose "${this.label}" directly.`)}}},n=new Set([`$id`,`$state`,`$stateSignal`,`$snapshot`,`$reset`,`$patch`,`$watch`,`$dispose`]);function r(e){if(e===`__proto__`||e===`constructor`||e===`prototype`)throw Error(`[elur] Store key "${e}" is not allowed for security reasons.`);if(n.has(e))throw Error(`[elur] Store key "${e}" is reserved.`)}function i(e,t){return n.has(e)?(console.warn(`[elur] Store ${t} "${e}" is reserved and will be ignored.`),!1):!0}function a(e,n){return new t(e,n)}function o(t,o){let{name:s=`store`,actions:c,getters:l,plugins:u=[],serialize:d}=o??{},f=Object.keys(t),p={};for(let n of f)r(n),p[n]=e.signal(t[n]);let m=p,h=e.computed(()=>{let e={};for(let t of f)e[t]=p[t].value;return e}),g=a(h,`store "${s}".$stateSignal`),_;try{_=d?d(t):structuredClone(t)}catch(e){throw Error(`[elur] Store "${s}" initialState contains non-serializable data (functions, DOM nodes, Symbols, or WeakRefs). Provide a custom \`serialize\` option or remove these before creating the store. Original error: ${e}`)}let v=[];function y(){let t=x(),n=_;for(let e of v){let r=e(n,t);r!==void 0&&(n={...n,...r})}e.batch(()=>{for(let e of f)p[e].value=n[e]})}function b(t){let n=t,r=x();for(let e of v){let t=e(n,r);t!==void 0&&(n=t)}e.batch(()=>{for(let e of Object.keys(n))Object.prototype.hasOwnProperty.call(p,e)&&(p[e].value=n[e])})}function x(){let e={};for(let t of f)e[t]=p[t].peek();return e}function S(t,n){return e.watch(h,t,n)}let C=Object.assign(Object.create(null),m,{$reset:y,$patch:b,$watch:S,$snapshot:x});Object.defineProperty(C,`$id`,{value:s,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(C,`$state`,{get(){return h.value},enumerable:!0,configurable:!1}),Object.defineProperty(C,`$stateSignal`,{value:g,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(C,`_guardFns`,{value:v,writable:!1,enumerable:!1,configurable:!1});let w=new Set([...f,...Array.from(n)]);if(c){let e=c(m);for(let t of Object.keys(e))if(i(t,`action`)){if(w.has(t)){console.warn(`[elur] Store "${s}": action "${t}" collides with an existing signal or getter and will be ignored.`);continue}w.add(t),C[t]=e[t]}}if(l){let t=l(m);for(let n of Object.keys(t)){if(!i(n,`getter`))continue;if(w.has(n)){console.warn(`[elur] Store "${s}": getter "${n}" collides with an existing signal or action and will be ignored.`);continue}let r=t[n];if(!(r instanceof e.Signal))throw TypeError(`[elur] Store "${s}": getter "${n}" must return a Signal (wrap it with computed()). Got: ${typeof r}`);w.add(n),C[n]=a(r,`getter "${n}" in store "${s}"`)}}let T=[()=>h.dispose()];for(let e of u)try{let t=e(C);typeof t==`function`&&T.push(t)}catch(e){console.error(`[elur] Plugin initialization failed for store "${s}":`,e)}return C.$dispose=()=>{for(let e of T)e()},C}exports.ReadonlySignal=t,exports.createStore=o;
|
|
2
2
|
//# sourceMappingURL=store.cjs.map
|
package/dist/lib/store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signal as e, batch as t, computed as n, signal as r, watch as i } from "./
|
|
1
|
+
import { Signal as e, batch as t, computed as n, signal as r, watch as i } from "./elur/next-2/reactivity.js";
|
|
2
2
|
//#region src/elur/store.ts
|
|
3
3
|
var a = class extends e {
|
|
4
4
|
label;
|
package/dist/lib/template.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./elur/template/types.cjs`),t=require(`./elur/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./elur/template/types.cjs`),t=require(`./elur/next-2/mount-helpers.cjs`),n=require(`./elur/template/keyed.cjs`),r=require(`./elur/next-2/keyed-diff.cjs`),i=require(`./elur/next-2/dom-write.cjs`),a=require(`./elur/next-2/node-binding.cjs`),o=require(`./elur/template/sanitize.cjs`),s=require(`./elur/template/bindings.cjs`),c=require(`./elur/template/html.cjs`),l=require(`./elur/template/raw.cjs`),u=require(`./elur/template/transitions.cjs`),d=require(`./elur/template/portal.cjs`),f=require(`./elur/template/error-boundary.cjs`);exports.COMMENT=e.COMMENT,exports.ELUR_RENDER_PROTOCOL=e.ELUR_RENDER_PROTOCOL,exports.ELUR_TEMPLATE_DESCRIPTOR=e.ELUR_TEMPLATE_DESCRIPTOR,exports._activateBindingsWithNodes=s._activateBindingsWithNodes,exports._activateDelegatedEvent=s.activateDelegatedEvent,exports._activateNodeBinding=a.activateNodeBinding,exports._createKeyedMount=r.createKeyedMount,exports._deferOnMount=t._deferOnMount,exports._ensureDelegatedEvent=s._ensureDelegatedEvent,exports._getKeyedSequence=n.getSequence,exports._keyedItemsEqual=n._keyedItemsEqual,exports._postMountScope=t._postMountScope,exports._postMountScopeSub=t._postMountScopeSub,exports._queueDOMWrite=i.queueDOMWrite,exports._reconcileKeyedList=r.reconcileKeyedList,exports._setDelegatedEvent=s._setDelegatedEvent,exports.buildHTML=c.buildHTML,exports.createErrorBoundary=f.createErrorBoundary,exports.createPortalOutlet=d.createPortalOutlet,exports.html=c.html,exports.injectOutlet=d.injectOutlet,exports.isElurTemplate=e.isElurTemplate,exports.isExecutableAttrName=o.isExecutableAttrName,exports.isKeyedList=e.isKeyedList,exports.isUrlAttrName=o.isUrlAttrName,exports.portal=d.portal,exports.portalOutlet=d.portalOutlet,exports.provideOutlet=d.provideOutlet,exports.raw=l.raw,exports.ref=e.ref,exports.repeat=n.repeat,exports.sanitizeUrl=o.sanitizeUrl,exports.showWhen=s.showWhen,exports.templateFeatures=e.templateFeatures,exports.transition=u.transition;
|
package/dist/lib/template.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { COMMENT as e, ELUR_RENDER_PROTOCOL as t, ELUR_TEMPLATE_DESCRIPTOR as n, isElurTemplate as r, isKeyedList as i, ref as a, templateFeatures as o } from "./elur/template/types.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
2
|
+
import { _deferOnMount as s, _postMountScope as c, _postMountScopeSub as l } from "./elur/next-2/mount-helpers.js";
|
|
3
|
+
import { _keyedItemsEqual as u, getSequence as d, repeat as f } from "./elur/template/keyed.js";
|
|
4
|
+
import { createKeyedMount as p, reconcileKeyedList as m } from "./elur/next-2/keyed-diff.js";
|
|
5
|
+
import { queueDOMWrite as h } from "./elur/next-2/dom-write.js";
|
|
6
|
+
import { activateNodeBinding as g } from "./elur/next-2/node-binding.js";
|
|
7
|
+
import { isExecutableAttrName as _, isUrlAttrName as v, sanitizeUrl as y } from "./elur/template/sanitize.js";
|
|
8
|
+
import { _activateBindingsWithNodes as b, _ensureDelegatedEvent as x, _setDelegatedEvent as S, activateDelegatedEvent as C, showWhen as w } from "./elur/template/bindings.js";
|
|
9
|
+
import { buildHTML as T, html as E } from "./elur/template/html.js";
|
|
10
|
+
import { raw as D } from "./elur/template/raw.js";
|
|
11
|
+
import { transition as O } from "./elur/template/transitions.js";
|
|
12
|
+
import { createPortalOutlet as k, injectOutlet as A, portal as j, portalOutlet as M, provideOutlet as N } from "./elur/template/portal.js";
|
|
13
|
+
import { createErrorBoundary as P } from "./elur/template/error-boundary.js";
|
|
14
|
+
export { e as COMMENT, t as ELUR_RENDER_PROTOCOL, n as ELUR_TEMPLATE_DESCRIPTOR, b as _activateBindingsWithNodes, C as _activateDelegatedEvent, g as _activateNodeBinding, p as _createKeyedMount, s as _deferOnMount, x as _ensureDelegatedEvent, d as _getKeyedSequence, u as _keyedItemsEqual, c as _postMountScope, l as _postMountScopeSub, h as _queueDOMWrite, m as _reconcileKeyedList, S as _setDelegatedEvent, T as buildHTML, P as createErrorBoundary, k as createPortalOutlet, E as html, A as injectOutlet, r as isElurTemplate, _ as isExecutableAttrName, i as isKeyedList, v as isUrlAttrName, j as portal, M as portalOutlet, N as provideOutlet, D as raw, a as ref, f as repeat, y as sanitizeUrl, w as showWhen, o as templateFeatures, O as transition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elurjs/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-beta.0",
|
|
4
4
|
"description": "A lightweight, fully reactive framework — no virtual DOM, no compiler, just signals and tagged templates.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Deiver Vasquez",
|
|
@@ -196,9 +196,7 @@
|
|
|
196
196
|
"node": ">=20.19.0"
|
|
197
197
|
},
|
|
198
198
|
"scripts": {
|
|
199
|
-
"
|
|
200
|
-
"build": "tsc && vite build",
|
|
201
|
-
"preview": "vite preview",
|
|
199
|
+
"build": "bun run build:lib",
|
|
202
200
|
"build:lib": "vite build --config vite.lib.config.ts && tsc --project tsconfig.lib.json && node scripts/copy-dcts.mjs",
|
|
203
201
|
"typecheck": "tsc --noEmit",
|
|
204
202
|
"test": "vitest run",
|
|
@@ -213,15 +211,15 @@
|
|
|
213
211
|
"devDependencies": {
|
|
214
212
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
215
213
|
"@playwright/test": "^1.62.1",
|
|
216
|
-
"@types/node": "^
|
|
217
|
-
"@vitest/coverage-v8": "^
|
|
214
|
+
"@types/node": "^26.5.0",
|
|
215
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
218
216
|
"happy-dom": "^20.8.3",
|
|
219
217
|
"terser": "^5.46.0",
|
|
220
|
-
"typescript": "~
|
|
218
|
+
"typescript": "~7.0.2",
|
|
221
219
|
"vite": "^8.0.0",
|
|
222
|
-
"vitest": "^
|
|
220
|
+
"vitest": "^5.0.0"
|
|
223
221
|
},
|
|
224
222
|
"overrides": {
|
|
225
223
|
"vite": "^8.0.0"
|
|
226
224
|
}
|
|
227
|
-
}
|
|
225
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.cjs","names":[],"sources":["../../src/elur/component.ts"],"sourcesContent":["import type { ElurTemplate, ElurMountHandle } from \"./template/index.js\";\nimport {\n isElurComponent,\n _debugComponentMountStart,\n _debugComponentMountEnd,\n _debugComponentUnmount,\n type ElurComponent,\n} from \"./lifecycle.js\";\nimport { _pushComponentContext, _popComponentContext, provide } from \"./context.js\";\nimport { RouterKey, _debugRegisterRouter, _debugUnregisterRouter } from \"./router-registry.js\";\nimport type { Router } from \"./router.js\";\n\nexport interface MountOptions {\n router?: Router;\n}\n\nfunction _resolveContainer(container: Element | string): Element {\n const el =\n typeof container === \"string\"\n ? (document.querySelector(container) as Element)\n : container;\n if (!el) {\n throw new Error(`[elur] mount: container not found: ${container}`);\n }\n return el;\n}\n\n/**\n * Mounts a ElurTemplate or ElurComponent into the DOM.\n *\n * mount(Counter(), \"#app\"); // ElurTemplate (function component)\n * mount(new Timer(), \"#app\"); // ElurComponent (class with lifecycle)\n *\n * @param component ElurTemplate (result of html``) or a ElurComponent instance.\n * @param container CSS selector or HTMLElement to mount into.\n * @returns { unmount() } — disposes effects and removes DOM.\n */\nexport function mount(\n component: ElurTemplate | ElurComponent,\n container: Element | string,\n options?: MountOptions\n): ElurMountHandle {\n if (isElurComponent(component)) {\n const el = _resolveContainer(container);\n\n _debugComponentMountStart(component);\n _pushComponentContext();\n let cleanup: () => void = () => { };\n let renderFailed = false;\n try {\n if (options?.router) {\n provide(RouterKey, options.router);\n _debugRegisterRouter(options.router);\n }\n try { component.onInit?.(); } catch (e) { if (component.onError) component.onError(e); else throw e; }\n try {\n cleanup = component.render()._render(el, null);\n } catch (e) {\n if (component.onError) {\n component.onError(e);\n cleanup = () => { };\n renderFailed = true;\n } else {\n throw e;\n }\n }\n } finally {\n _debugComponentMountEnd(component);\n _popComponentContext();\n }\n\n let mountCleanup: (() => void) | undefined;\n if (!renderFailed) {\n try {\n const ret = component.onMount?.();\n if (typeof ret === \"function\") mountCleanup = ret;\n } catch (e) {\n if (component.onError) component.onError(e);\n else throw e;\n }\n }\n\n return {\n unmount() {\n try { component.onUnmount?.(); } catch { /* ignore */ }\n try { mountCleanup?.(); } catch { /* ignore */ }\n cleanup();\n if (options?.router) _debugUnregisterRouter(options.router);\n _debugComponentUnmount(component);\n },\n };\n }\n\n if (!options?.router) {\n // ElurTemplate: delegar al método .mount() interno\n return (component as ElurTemplate).mount(container);\n }\n\n // For template roots, create a context frame so elurRouter()/inject() can resolve.\n const el = _resolveContainer(container);\n _pushComponentContext();\n let cleanup: () => void;\n try {\n provide(RouterKey, options.router);\n _debugRegisterRouter(options.router);\n cleanup = (component as ElurTemplate)._render(el, null);\n } finally {\n _popComponentContext();\n }\n\n return {\n unmount() {\n cleanup();\n _debugUnregisterRouter(options.router!);\n },\n };\n}\n"],"mappings":"yKAgBA,SAAS,EAAkB,EAAsC,CAC7D,IAAM,EACF,OAAO,GAAc,SACd,SAAS,cAAc,EAAU,CAClC,EACV,GAAI,CAAC,EACD,MAAU,MAAM,sCAAsC,IAAY,CAEtE,OAAO,EAaX,SAAgB,EACZ,EACA,EACA,EACe,CACf,GAAI,EAAA,gBAAgB,EAAU,CAAE,CAC5B,IAAM,EAAK,EAAkB,EAAU,CAEvC,EAAA,0BAA0B,EAAU,CACpC,EAAA,uBAAuB,CACvB,IAAI,MAA4B,GAC5B,EAAe,GACnB,GAAI,CACI,GAAS,SACT,EAAA,QAAQ,EAAA,UAAW,EAAQ,OAAO,CAClC,EAAA,qBAAqB,EAAQ,OAAO,EAExC,GAAI,CAAE,EAAU,UAAU,OAAW,EAAG,CAAE,GAAI,EAAU,QAAS,EAAU,QAAQ,EAAE,MAAO,MAAM,EAClG,GAAI,CACA,EAAU,EAAU,QAAQ,CAAC,QAAQ,EAAI,KAAK,OACzC,EAAG,CACR,GAAI,EAAU,QACV,EAAU,QAAQ,EAAE,CACpB,MAAgB,GAChB,EAAe,QAEf,MAAM,UAGR,CACN,EAAA,wBAAwB,EAAU,CAClC,EAAA,sBAAsB,CAG1B,IAAI,EACJ,GAAI,CAAC,EACD,GAAI,CACA,IAAM,EAAM,EAAU,WAAW,CAC7B,OAAO,GAAQ,aAAY,EAAe,SACzC,EAAG,CACR,GAAI,EAAU,QAAS,EAAU,QAAQ,EAAE,MACtC,MAAM,EAInB,MAAO,CACH,SAAU,CACN,GAAI,CAAE,EAAU,aAAa,MAAU,EACvC,GAAI,CAAE,KAAgB,MAAU,EAChC,GAAS,CACL,GAAS,QAAQ,EAAA,uBAAuB,EAAQ,OAAO,CAC3D,EAAA,uBAAuB,EAAU,EAExC,CAGL,GAAI,CAAC,GAAS,OAEV,OAAQ,EAA2B,MAAM,EAAU,CAIvD,IAAM,EAAK,EAAkB,EAAU,CACvC,EAAA,uBAAuB,CACvB,IAAI,EACJ,GAAI,CACA,EAAA,QAAQ,EAAA,UAAW,EAAQ,OAAO,CAClC,EAAA,qBAAqB,EAAQ,OAAO,CACpC,EAAW,EAA2B,QAAQ,EAAI,KAAK,QACjD,CACN,EAAA,sBAAsB,CAG1B,MAAO,CACH,SAAU,CACN,GAAS,CACT,EAAA,uBAAuB,EAAQ,OAAQ,EAE9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","names":[],"sources":["../../src/elur/component.ts"],"sourcesContent":["import type { ElurTemplate, ElurMountHandle } from \"./template/index.js\";\nimport {\n isElurComponent,\n _debugComponentMountStart,\n _debugComponentMountEnd,\n _debugComponentUnmount,\n type ElurComponent,\n} from \"./lifecycle.js\";\nimport { _pushComponentContext, _popComponentContext, provide } from \"./context.js\";\nimport { RouterKey, _debugRegisterRouter, _debugUnregisterRouter } from \"./router-registry.js\";\nimport type { Router } from \"./router.js\";\n\nexport interface MountOptions {\n router?: Router;\n}\n\nfunction _resolveContainer(container: Element | string): Element {\n const el =\n typeof container === \"string\"\n ? (document.querySelector(container) as Element)\n : container;\n if (!el) {\n throw new Error(`[elur] mount: container not found: ${container}`);\n }\n return el;\n}\n\n/**\n * Mounts a ElurTemplate or ElurComponent into the DOM.\n *\n * mount(Counter(), \"#app\"); // ElurTemplate (function component)\n * mount(new Timer(), \"#app\"); // ElurComponent (class with lifecycle)\n *\n * @param component ElurTemplate (result of html``) or a ElurComponent instance.\n * @param container CSS selector or HTMLElement to mount into.\n * @returns { unmount() } — disposes effects and removes DOM.\n */\nexport function mount(\n component: ElurTemplate | ElurComponent,\n container: Element | string,\n options?: MountOptions\n): ElurMountHandle {\n if (isElurComponent(component)) {\n const el = _resolveContainer(container);\n\n _debugComponentMountStart(component);\n _pushComponentContext();\n let cleanup: () => void = () => { };\n let renderFailed = false;\n try {\n if (options?.router) {\n provide(RouterKey, options.router);\n _debugRegisterRouter(options.router);\n }\n try { component.onInit?.(); } catch (e) { if (component.onError) component.onError(e); else throw e; }\n try {\n cleanup = component.render()._render(el, null);\n } catch (e) {\n if (component.onError) {\n component.onError(e);\n cleanup = () => { };\n renderFailed = true;\n } else {\n throw e;\n }\n }\n } finally {\n _debugComponentMountEnd(component);\n _popComponentContext();\n }\n\n let mountCleanup: (() => void) | undefined;\n if (!renderFailed) {\n try {\n const ret = component.onMount?.();\n if (typeof ret === \"function\") mountCleanup = ret;\n } catch (e) {\n if (component.onError) component.onError(e);\n else throw e;\n }\n }\n\n return {\n unmount() {\n try { component.onUnmount?.(); } catch { /* ignore */ }\n try { mountCleanup?.(); } catch { /* ignore */ }\n cleanup();\n if (options?.router) _debugUnregisterRouter(options.router);\n _debugComponentUnmount(component);\n },\n };\n }\n\n if (!options?.router) {\n // ElurTemplate: delegar al método .mount() interno\n return (component as ElurTemplate).mount(container);\n }\n\n // For template roots, create a context frame so elurRouter()/inject() can resolve.\n const el = _resolveContainer(container);\n _pushComponentContext();\n let cleanup: () => void;\n try {\n provide(RouterKey, options.router);\n _debugRegisterRouter(options.router);\n cleanup = (component as ElurTemplate)._render(el, null);\n } finally {\n _popComponentContext();\n }\n\n return {\n unmount() {\n cleanup();\n _debugUnregisterRouter(options.router!);\n },\n };\n}\n"],"mappings":";;;;AAgBA,SAAS,EAAkB,GAAsC;CAC7D,IAAM,IACF,OAAO,KAAc,WACd,SAAS,cAAc,EAAU,GAClC;AACV,KAAI,CAAC,EACD,OAAU,MAAM,sCAAsC,IAAY;AAEtE,QAAO;;AAaX,SAAgB,EACZ,GACA,GACA,GACe;AACf,KAAI,EAAgB,EAAU,EAAE;EAC5B,IAAM,IAAK,EAAkB,EAAU;AAGvC,EADA,EAA0B,EAAU,EACpC,GAAuB;EACvB,IAAI,UAA4B,IAC5B,IAAe;AACnB,MAAI;AACA,GAAI,GAAS,WACT,EAAQ,GAAW,EAAQ,OAAO,EAClC,EAAqB,EAAQ,OAAO;AAExC,OAAI;AAAE,MAAU,UAAU;YAAW,GAAG;AAAE,QAAI,EAAU,QAAS,GAAU,QAAQ,EAAE;QAAO,OAAM;;AAClG,OAAI;AACA,QAAU,EAAU,QAAQ,CAAC,QAAQ,GAAI,KAAK;YACzC,GAAG;AACR,QAAI,EAAU,QAGV,CAFA,EAAU,QAAQ,EAAE,EACpB,UAAgB,IAChB,IAAe;QAEf,OAAM;;YAGR;AAEN,GADA,EAAwB,EAAU,EAClC,GAAsB;;EAG1B,IAAI;AACJ,MAAI,CAAC,EACD,KAAI;GACA,IAAM,IAAM,EAAU,WAAW;AACjC,GAAI,OAAO,KAAQ,eAAY,IAAe;WACzC,GAAG;AACR,OAAI,EAAU,QAAS,GAAU,QAAQ,EAAE;OACtC,OAAM;;AAInB,SAAO,EACH,UAAU;AACN,OAAI;AAAE,MAAU,aAAa;WAAU;AACvC,OAAI;AAAE,SAAgB;WAAU;AAGhC,GAFA,GAAS,EACL,GAAS,UAAQ,EAAuB,EAAQ,OAAO,EAC3D,EAAuB,EAAU;KAExC;;AAGL,KAAI,CAAC,GAAS,OAEV,QAAQ,EAA2B,MAAM,EAAU;CAIvD,IAAM,IAAK,EAAkB,EAAU;AACvC,IAAuB;CACvB,IAAI;AACJ,KAAI;AAGA,EAFA,EAAQ,GAAW,EAAQ,OAAO,EAClC,EAAqB,EAAQ,OAAO,EACpC,IAAW,EAA2B,QAAQ,GAAI,KAAK;WACjD;AACN,KAAsB;;AAG1B,QAAO,EACH,UAAU;AAEN,EADA,GAAS,EACT,EAAuB,EAAQ,OAAQ;IAE9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.cjs","names":[],"sources":["../../src/elur/hydrate/index.ts"],"sourcesContent":["import { _captureContextSnapshot, _popComponentContext, _pushComponentContext } from \"../context.js\";\nimport { isElurComponent, type ElurComponent } from \"../lifecycle.js\";\nimport { effect } from \"../reactivity.js\";\nimport { sanitizeUrl } from \"../template/sanitize.js\";\nimport { activateDelegatedEvent, isDelegableEvent } from \"../template/bindings.js\";\nimport {\n isKeyedList,\n isElurTemplate,\n ELUR_RENDER_PROTOCOL,\n ELUR_TEMPLATE_DESCRIPTOR,\n type KEntry,\n type ElurMountHandle,\n type ElurRef,\n type ElurTemplate,\n type TemplateDescriptor,\n} from \"../template/types.js\";\nimport {\n deserializeRepeatKey,\n normalizeRepeatKey,\n serializeRepeatKey,\n type RepeatKey,\n} from \"../template/keyed.js\";\nimport { createKeyedMount, reconcileKeyedList } from \"../template/keyed-diff.js\";\n\nexport interface HydrateOptions {\n mismatch?: \"throw\" | \"warn-remount\" | \"remount\";\n onMismatch?: (error: HydrationMismatch) => void;\n context?: unknown;\n}\n\nexport interface HydrationMismatch {\n index: number;\n kind: \"node\" | \"attribute\" | \"event\" | \"descriptor\" | \"keyed\";\n message: string;\n}\n\ninterface MarkerRange {\n start: Comment;\n end: Comment;\n}\n\ninterface KeyedMarkerRange {\n start: Comment;\n end: Comment;\n serializedKey: string;\n}\n\ninterface ScannedMarkers {\n nodes: Map<number, MarkerRange>;\n attributes: Map<number, Element>;\n events: Map<number, Element>;\n keyed: Map<number, KeyedMarkerRange[]>;\n arrayItems: Map<number, MarkerRange[]>;\n}\n\nexport function hydrate(\n value: ElurTemplate | ElurComponent,\n container: Element,\n options: HydrateOptions = {},\n): ElurMountHandle {\n try {\n if (isElurComponent(value)) return hydrateComponent(value, container, options);\n const descriptor = value[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Template has no hydration descriptor\");\n const cleanup = hydrateDescriptor(descriptor!, container, options);\n return { unmount: cleanup };\n } catch (error) {\n if (options.mismatch === \"throw\") throw error;\n if (options.mismatch !== \"remount\") console.warn(\"[elur] Hydration mismatch; remounting root:\", error);\n container.replaceChildren();\n const cleanup = isElurComponent(value)\n ? value.render()._render(container, null)\n : value._render(container, null);\n return { unmount: cleanup };\n }\n}\n\nfunction hydrateComponent(\n component: ElurComponent,\n container: Element,\n options: HydrateOptions,\n): ElurMountHandle {\n _pushComponentContext();\n let cleanup = () => { };\n try {\n try {\n component.onInit?.();\n } catch (error) {\n if (component.onError) component.onError(error);\n else throw error;\n }\n const template = component.render();\n const descriptor = template[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Component template has no hydration descriptor\");\n cleanup = hydrateDescriptor(descriptor!, container, options);\n } finally {\n _popComponentContext();\n }\n const mountCleanup = component.onMount?.();\n return {\n unmount() {\n component.onUnmount?.();\n if (typeof mountCleanup === \"function\") mountCleanup();\n cleanup();\n },\n };\n}\n\nfunction hydrateDescriptor(\n descriptor: TemplateDescriptor,\n root: ParentNode,\n options: HydrateOptions,\n bounds?: MarkerRange,\n): () => void {\n const markers = scanMarkers(root, bounds);\n const cleanups: Array<() => void> = [];\n\n for (let index = 0; index < descriptor.contexts.length; index++) {\n const context = descriptor.contexts[index];\n const value = descriptor.values[index];\n if (context.type === \"event\") {\n const element = markers.events.get(index);\n if (!element) throwMismatch(options, index, \"event\", `Missing event marker ${index}`);\n element!.removeAttribute(`data-elur-e-${index}`);\n cleanups.push(activateEvent(element!, context.eventName, context.modifiers, value));\n continue;\n }\n if (context.type === \"attr\") {\n const element = markers.attributes.get(index);\n if (!element) throwMismatch(options, index, \"attribute\", `Missing attribute marker ${index}`);\n element!.removeAttribute(`data-elur-a-${index}`);\n cleanups.push(activateAttribute(element!, context.attrName, context.url === true, value));\n continue;\n }\n\n const range = markers.nodes.get(index);\n if (!range) throwMismatch(options, index, \"node\", `Missing node marker ${index}`);\n const cleanup = activateNode(range!, value, options, markers.keyed.get(index), markers.arrayItems.get(index));\n if (cleanup) cleanups.push(cleanup);\n }\n\n return () => {\n for (let index = cleanups.length - 1; index >= 0; index--) cleanups[index]();\n };\n}\n\nfunction scanMarkers(root: ParentNode, bounds?: MarkerRange): ScannedMarkers {\n const nodes = new Map<number, MarkerRange>();\n const starts = new Map<number, Comment>();\n const attributes = new Map<number, Element>();\n const events = new Map<number, Element>();\n const keyed = new Map<number, KeyedMarkerRange[]>();\n const arrayItems = new Map<number, MarkerRange[]>();\n const stack: number[] = [];\n const keyedStack: Array<{ start: Comment; serializedKey: string; parentIndex: number }> = [];\n const arrayStack: Array<{ start: Comment; parentIndex: number }> = [];\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT);\n let current: Node | null;\n\n while ((current = walker.nextNode())) {\n if (bounds && !isInsideRange(current, bounds)) continue;\n if (current.nodeType === Node.COMMENT_NODE) {\n const comment = current as Comment;\n const startMatch = /^elur-(\\d+)$/.exec(comment.data);\n if (startMatch) {\n const index = Number(startMatch[1]);\n if (stack.length === 0) starts.set(index, comment);\n stack.push(index);\n continue;\n }\n const endMatch = /^elur-end-(\\d+)$/.exec(comment.data);\n if (endMatch) {\n const index = Number(endMatch[1]);\n const active = stack.pop();\n if (active === index && stack.length === 0) {\n const start = starts.get(index);\n if (start) nodes.set(index, { start, end: comment });\n }\n continue;\n }\n const keyedStartMatch = /^elur-ki:(.+)$/.exec(comment.data);\n if (keyedStartMatch) {\n const serializedKey = keyedStartMatch[1];\n if (keyedStack.length === 0 && stack.length === 1) {\n keyedStack.push({ start: comment, serializedKey, parentIndex: stack[stack.length - 1] });\n } else {\n keyedStack.push({ start: comment, serializedKey, parentIndex: -1 });\n }\n continue;\n }\n if (comment.data === \"elur-ke\") {\n const active = keyedStack.pop();\n if (active) {\n if (active.parentIndex >= 0) {\n const list = keyed.get(active.parentIndex) ?? [];\n list.push({ start: active.start, end: comment, serializedKey: active.serializedKey });\n keyed.set(active.parentIndex, list);\n }\n } else {\n throw new Error(\"[elur] Hydration marker mismatch: orphan keyed end marker (elur-ke)\");\n }\n continue;\n }\n if (comment.data === \"elur-ai\") {\n if (arrayStack.length === 0 && stack.length === 1) {\n arrayStack.push({ start: comment, parentIndex: stack[stack.length - 1] });\n } else {\n arrayStack.push({ start: comment, parentIndex: -1 });\n }\n continue;\n }\n if (comment.data === \"elur-aiend\") {\n const active = arrayStack.pop();\n if (active && active.parentIndex >= 0) {\n const list = arrayItems.get(active.parentIndex) ?? [];\n list.push({ start: active.start, end: comment });\n arrayItems.set(active.parentIndex, list);\n }\n continue;\n }\n continue;\n }\n if (stack.length > 0) continue;\n const element = current as Element;\n for (const attribute of Array.from(element.attributes)) {\n const eventMatch = /^data-elur-e-(\\d+)$/.exec(attribute.name);\n if (eventMatch) events.set(Number(eventMatch[1]), element);\n const attributeMatch = /^data-elur-a-(\\d+)$/.exec(attribute.name);\n if (attributeMatch) attributes.set(Number(attributeMatch[1]), element);\n }\n }\n\n return { nodes, attributes, events, keyed, arrayItems };\n}\n\nfunction isInsideRange(node: Node, range: MarkerRange): boolean {\n const domRange = document.createRange();\n domRange.setStartAfter(range.start);\n domRange.setEndBefore(range.end);\n return domRange.intersectsNode(node);\n}\n\nfunction activateEvent(\n element: Element,\n eventName: string,\n modifiers: readonly string[],\n value: unknown,\n): () => void {\n if (typeof value !== \"function\") throw new TypeError(`Event \"${eventName}\" requires a function`);\n const rawHandler = value as EventListener;\n\n // Use global delegation for delegable events without capture/once mods,\n // matching the mount-time behavior in bindings.ts. The element must be\n // connected to the document for delegation to work (events bubble to\n // document where the delegated listener is registered).\n const canDelegate =\n isDelegableEvent(eventName) &&\n !modifiers.includes(\"capture\") &&\n !modifiers.includes(\"once\") &&\n document.body.contains(element);\n\n if (canDelegate) {\n return activateDelegatedEvent(element, eventName, modifiers, rawHandler);\n }\n\n // Non-delegable events or disconnected elements: use addEventListener directly.\n const options: AddEventListenerOptions = {\n once: modifiers.includes(\"once\"),\n capture: modifiers.includes(\"capture\"),\n passive: modifiers.includes(\"passive\"),\n };\n const listener = (event: Event) => {\n if (modifiers.includes(\"prevent\")) event.preventDefault();\n if (modifiers.includes(\"stop\")) event.stopPropagation();\n if (modifiers.includes(\"self\") && event.target !== event.currentTarget) return;\n rawHandler(event);\n };\n element.addEventListener(eventName, listener, options);\n return () => element.removeEventListener(eventName, listener, options);\n}\n\nfunction activateAttribute(\n element: Element,\n name: string,\n url: boolean,\n value: unknown,\n): () => void {\n if (name === \"ref\") {\n const reference = value as ElurRef<Element>;\n reference.el = element;\n return () => { reference.el = null; };\n }\n\n const isProperty = (name === \"value\" || name === \"checked\" || name === \"selected\") && name in element;\n let firstRun = true;\n let pendingSync = false;\n const update = (resolved: unknown) => {\n if (isProperty) {\n if (!firstRun) {\n (element as any)[name] = resolved ?? \"\";\n } else {\n // Interaction before hydration: the DOM may hold a value the\n // user (or a hydration race with lazy island directives like\n // \"visible\") wrote before the binding activated. The DOM is\n // authoritative; keep it and propagate it to reactive model\n // sources once every handler is attached (microtask) so a\n // late @input/@change listener picks up the real value.\n const current = (element as any)[name];\n const model = resolved ?? \"\";\n if (String(current) !== String(model) && !pendingSync) {\n pendingSync = true;\n const eventName = name === \"checked\" || name === \"selected\" ? \"change\" : \"input\";\n queueMicrotask(() => {\n pendingSync = false;\n element.dispatchEvent(new Event(eventName, { bubbles: true }));\n });\n }\n }\n } else if (resolved === null || resolved === undefined || resolved === false) {\n element.removeAttribute(name);\n } else {\n const serialized = url ? sanitizeUrl(String(resolved)) : String(resolved);\n element.setAttribute(name, serialized);\n }\n firstRun = false;\n };\n\n if (typeof value === \"function\") {\n return effect(() => update((value as () => unknown)()));\n }\n update(value);\n return () => { };\n}\n\nfunction activateNode(\n range: MarkerRange,\n value: unknown,\n options: HydrateOptions,\n keyedItems?: KeyedMarkerRange[],\n arrayItems?: MarkerRange[],\n): (() => void) | undefined {\n if (typeof value !== \"function\") return hydrateNodeValue(range, value, options, keyedItems, arrayItems);\n\n let firstRun = true;\n let nestedCleanup: (() => void) | undefined;\n let textNode = findTextNode(range);\n let keyed: { state: Map<RepeatKey, KEntry>; prevOrder: RepeatKey[] } | null = null;\n const ctxSnapshot = _captureContextSnapshot();\n const keyedMount = createKeyedMount(ctxSnapshot);\n\n const warnDuplicate = (key: RepeatKey) => {\n console.warn(`[elur] repeat(): duplicate key \"${key}\". Keys must be unique; the previous entry leaks (orphaned nodes + live effects).`);\n };\n\n const dispose = effect(() => {\n const resolved = (value as () => unknown)();\n\n if (isKeyedList(resolved)) {\n if (firstRun && !keyed) {\n // First resolution is a keyed list: adopt the SSR markers when\n // present. Afterwards we converge with the current model, which\n // handles count/ordering drift without recreating surviving nodes.\n const adopted = adoptKeyedRange(resolved, keyedItems, options);\n keyed = { state: adopted.state, prevOrder: adopted.prevOrder };\n nestedCleanup = adopted.cleanup;\n reconcileKeyedList({\n zoneStart: range.start,\n anchor: range.end,\n state: keyed.state,\n prevOrder: keyed.prevOrder,\n list: resolved,\n mount: keyedMount,\n ctxSnapshot,\n onDuplicateKey: warnDuplicate,\n });\n textNode = null;\n firstRun = false;\n return;\n }\n if (!keyed) {\n // The binding became keyed after another value: the SSR markers\n // were already consumed (or never existed), so mount fresh.\n nestedCleanup?.();\n clearRange(range);\n keyed = { state: new Map(), prevOrder: [] };\n nestedCleanup = () => {\n for (const entry of keyed!.state.values()) entry.cleanup();\n };\n }\n reconcileKeyedList({\n zoneStart: range.start,\n anchor: range.end,\n state: keyed.state,\n prevOrder: keyed.prevOrder,\n list: resolved,\n mount: keyedMount,\n ctxSnapshot,\n onDuplicateKey: warnDuplicate,\n });\n textNode = null;\n firstRun = false;\n return;\n }\n\n // Non-keyed value: tear down any keyed zone first.\n if (keyed) {\n nestedCleanup?.();\n clearRange(range);\n keyed = null;\n nestedCleanup = undefined;\n }\n\n if (typeof resolved === \"string\" || typeof resolved === \"number\" || typeof resolved === \"bigint\") {\n if (!textNode) {\n textNode = document.createTextNode(String(resolved));\n range.end.parentNode!.insertBefore(textNode, range.end);\n } else if (textNode.nodeValue !== String(resolved)) {\n textNode.nodeValue = String(resolved);\n }\n } else if (firstRun) {\n nestedCleanup = hydrateNodeValue(range, resolved, options, keyedItems, arrayItems);\n } else {\n nestedCleanup?.();\n clearRange(range);\n nestedCleanup = mountNodeValue(range, resolved);\n textNode = findTextNode(range);\n }\n firstRun = false;\n });\n\n return () => {\n dispose();\n nestedCleanup?.();\n };\n}\n\nfunction hydrateNodeValue(\n range: MarkerRange,\n value: unknown,\n options: HydrateOptions,\n keyedItems?: KeyedMarkerRange[],\n arrayItems?: MarkerRange[],\n): (() => void) | undefined {\n if (isKeyedList(value)) {\n const ctxSnapshot = _captureContextSnapshot();\n const adopted = adoptKeyedRange(value, keyedItems, options);\n reconcileKeyedList({\n zoneStart: range.start,\n anchor: range.end,\n state: adopted.state,\n prevOrder: adopted.prevOrder,\n list: value,\n mount: createKeyedMount(ctxSnapshot),\n ctxSnapshot,\n onDuplicateKey: (key) => {\n console.warn(`[elur] repeat(): duplicate key \"${key}\". Keys must be unique; the previous entry leaks (orphaned nodes + live effects).`);\n },\n });\n return adopted.cleanup;\n }\n if (Array.isArray(value)) {\n const cleanups: Array<() => void> = [];\n const hasMarkers = arrayItems !== undefined && arrayItems.length > 0;\n for (let index = 0; index < value.length; index++) {\n const item = value[index];\n const itemBounds = arrayItems?.[index];\n if (hasMarkers && itemBounds) {\n // Hydrate each item within its own SSR-delimited range so\n // repeated marker indices across items never collide.\n const cleanup = hydrateNodeValue(itemBounds, item, options);\n if (cleanup) cleanups.push(cleanup);\n } else if (hasMarkers) {\n // Client item with no SSR slot: mount it fresh at the end.\n const cleanup = mountNodeValue(range, item);\n if (cleanup) cleanups.push(cleanup);\n } else {\n const cleanup = hydrateNodeValue(range, item, options);\n if (cleanup) cleanups.push(cleanup);\n }\n }\n return cleanups.length ? () => { for (let i = cleanups.length - 1; i >= 0; i--) cleanups[i](); } : undefined;\n }\n if (isElurTemplate(value)) {\n const descriptor = value[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Nested template has no hydration descriptor\");\n return hydrateDescriptor(descriptor!, range.start.parentNode as ParentNode, options, range);\n }\n if (isElurComponent(value)) {\n _pushComponentContext();\n let result: (() => void) | undefined;\n try {\n try {\n value.onInit?.();\n } catch (error) {\n if (value.onError) value.onError(error);\n else throw error;\n }\n const template = value.render();\n const descriptor = template[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Nested component has no hydration descriptor\");\n const cleanup = hydrateDescriptor(descriptor!, range.start.parentNode as ParentNode, options, range);\n const mountCleanup = value.onMount?.();\n result = () => {\n value.onUnmount?.();\n if (typeof mountCleanup === \"function\") mountCleanup();\n cleanup();\n };\n } finally {\n _popComponentContext();\n }\n return result;\n }\n if (value != null && typeof value === \"object\") {\n const protocol = (value as Record<PropertyKey, unknown>)[ELUR_RENDER_PROTOCOL] as\n | { hydrateDom?: (ctx: import(\"../template/types.js\").HydrationProtocolContext) => (() => void) | void }\n | undefined;\n if (protocol?.hydrateDom) {\n return protocol.hydrateDom({\n parent: range.start.parentNode!,\n bounds: range,\n context: options.context,\n render: (nested) => hydrateNodeValue(range, nested, options),\n }) ?? undefined;\n }\n }\n return undefined;\n}\n\nfunction adoptKeyedRange(\n list: import(\"../template/types.js\").KeyedList,\n keyedItems: KeyedMarkerRange[] | undefined,\n options: HydrateOptions,\n): { state: Map<RepeatKey, KEntry>; prevOrder: RepeatKey[]; cleanup: () => void } {\n const state = new Map<RepeatKey, KEntry>();\n const prevOrder: RepeatKey[] = [];\n\n if (!keyedItems || keyedItems.length === 0) {\n return { state, prevOrder, cleanup: () => { } };\n }\n\n const clientByKey = new Map<string, number>();\n for (let j = 0; j < list.items.length; j++) {\n const key = normalizeRepeatKey(list.keyFn(list.items[j], j), j);\n const serialized = serializeRepeatKey(key);\n if (clientByKey.has(serialized)) {\n console.warn(\n `[elur] repeat(): duplicate client key \"${key}\" during hydration. ` +\n \"Keys must be unique; entries after the first leak.\",\n );\n }\n clientByKey.set(serialized, j);\n }\n\n for (const marker of keyedItems) {\n const clientIndex = clientByKey.get(marker.serializedKey);\n if (clientIndex === undefined) {\n // SSR item not present in the client model → remove its DOM.\n removeKeyedMarker(marker);\n continue;\n }\n const item = list.items[clientIndex];\n const key = normalizeRepeatKey(list.keyFn(item, clientIndex), clientIndex);\n if (serializeRepeatKey(key) !== marker.serializedKey) {\n console.warn(\n `[elur] repeat(): hydration key mismatch at index ${clientIndex} ` +\n `(${deserializeRepeatKey(marker.serializedKey)} != ${key}). The SSR item is adopted by position.`,\n );\n }\n if (state.has(key)) {\n console.warn(`[elur] repeat(): duplicate key \"${key}\" during hydration; removing duplicate SSR node.`);\n removeKeyedMarker(marker);\n continue;\n }\n const rendered = list.renderFn(item, clientIndex);\n const cleanup = hydrateNodeValue(\n { start: marker.start, end: marker.end },\n rendered,\n options,\n );\n state.set(key, { start: marker.start, end: marker.end, cleanup: cleanup ?? (() => { }) });\n prevOrder.push(key);\n }\n\n return {\n state,\n prevOrder,\n cleanup: () => {\n for (const entry of state.values()) entry.cleanup();\n },\n };\n}\n\nfunction removeKeyedMarker(marker: KeyedMarkerRange): void {\n let node: Node | null = marker.start.nextSibling;\n while (node && node !== marker.end) {\n const next = node.nextSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n marker.start.parentNode?.removeChild(marker.start);\n marker.end.parentNode?.removeChild(marker.end);\n}\n\nfunction mountNodeValue(range: MarkerRange, value: unknown): (() => void) | undefined {\n if (value === null || value === undefined || value === false || value === true) return undefined;\n if (Array.isArray(value)) {\n const cleanups: Array<() => void> = [];\n for (const item of value) {\n const cleanup = mountNodeValue(range, item);\n if (cleanup) cleanups.push(cleanup);\n }\n return cleanups.length ? () => { for (let i = cleanups.length - 1; i >= 0; i--) cleanups[i](); } : undefined;\n }\n if (isElurTemplate(value)) return value._render(range.end.parentNode!, range.end);\n if (isElurComponent(value)) return value.render()._render(range.end.parentNode!, range.end);\n const node = document.createTextNode(String(value));\n range.end.parentNode!.insertBefore(node, range.end);\n return () => node.parentNode?.removeChild(node);\n}\n\nfunction findTextNode(range: MarkerRange): Text | null {\n let node = range.start.nextSibling;\n while (node && node !== range.end) {\n if (node.nodeType === Node.TEXT_NODE) return node as Text;\n node = node.nextSibling;\n }\n return null;\n}\n\nfunction clearRange(range: MarkerRange): void {\n let node = range.start.nextSibling;\n while (node && node !== range.end) {\n const next = node.nextSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n}\n\nfunction throwMismatch(\n options: HydrateOptions,\n index: number,\n kind: HydrationMismatch[\"kind\"],\n message: string,\n): never {\n const mismatch = { index, kind, message } satisfies HydrationMismatch;\n options.onMismatch?.(mismatch);\n const error = new Error(`[elur] Hydration marker mismatch: ${message}`);\n Object.assign(error, { mismatch });\n throw error;\n}"],"mappings":"0WAuDA,SAAgB,EACZ,EACA,EACA,EAA0B,EAAE,CACb,CACf,GAAI,CACA,GAAI,EAAA,gBAAgB,EAAM,CAAE,OAAO,EAAiB,EAAO,EAAW,EAAQ,CAC9E,IAAM,EAAa,EAAM,EAAA,0BAGzB,OAFK,GAAY,EAAc,EAAS,GAAI,aAAc,uCAAuC,CAE1F,CAAE,QADO,EAAkB,EAAa,EAAW,EAAQ,CACvC,OACtB,EAAO,CACZ,GAAI,EAAQ,WAAa,QAAS,MAAM,EAMxC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,EAAK,CAGnD,SAAS,EAAa,EAAiC,CACnD,IAAI,EAAO,EAAM,MAAM,YACvB,KAAO,GAAQ,IAAS,EAAM,KAAK,CAC/B,GAAI,EAAK,WAAa,KAAK,UAAW,OAAO,EAC7C,EAAO,EAAK,YAEhB,OAAO,KAGX,SAAS,EAAW,EAA0B,CAC1C,IAAI,EAAO,EAAM,MAAM,YACvB,KAAO,GAAQ,IAAS,EAAM,KAAK,CAC/B,IAAM,EAAO,EAAK,YAClB,EAAK,YAAY,YAAY,EAAK,CAClC,EAAO,GAIf,SAAS,EACL,EACA,EACA,EACA,EACK,CACL,IAAM,EAAW,CAAE,QAAO,OAAM,UAAS,CACzC,EAAQ,aAAa,EAAS,CAC9B,IAAM,EAAY,MAAM,qCAAqC,IAAU,CAEvE,MADA,OAAO,OAAO,EAAO,CAAE,WAAU,CAAC,CAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.js","names":[],"sources":["../../src/elur/hydrate/index.ts"],"sourcesContent":["import { _captureContextSnapshot, _popComponentContext, _pushComponentContext } from \"../context.js\";\nimport { isElurComponent, type ElurComponent } from \"../lifecycle.js\";\nimport { effect } from \"../reactivity.js\";\nimport { sanitizeUrl } from \"../template/sanitize.js\";\nimport { activateDelegatedEvent, isDelegableEvent } from \"../template/bindings.js\";\nimport {\n isKeyedList,\n isElurTemplate,\n ELUR_RENDER_PROTOCOL,\n ELUR_TEMPLATE_DESCRIPTOR,\n type KEntry,\n type ElurMountHandle,\n type ElurRef,\n type ElurTemplate,\n type TemplateDescriptor,\n} from \"../template/types.js\";\nimport {\n deserializeRepeatKey,\n normalizeRepeatKey,\n serializeRepeatKey,\n type RepeatKey,\n} from \"../template/keyed.js\";\nimport { createKeyedMount, reconcileKeyedList } from \"../template/keyed-diff.js\";\n\nexport interface HydrateOptions {\n mismatch?: \"throw\" | \"warn-remount\" | \"remount\";\n onMismatch?: (error: HydrationMismatch) => void;\n context?: unknown;\n}\n\nexport interface HydrationMismatch {\n index: number;\n kind: \"node\" | \"attribute\" | \"event\" | \"descriptor\" | \"keyed\";\n message: string;\n}\n\ninterface MarkerRange {\n start: Comment;\n end: Comment;\n}\n\ninterface KeyedMarkerRange {\n start: Comment;\n end: Comment;\n serializedKey: string;\n}\n\ninterface ScannedMarkers {\n nodes: Map<number, MarkerRange>;\n attributes: Map<number, Element>;\n events: Map<number, Element>;\n keyed: Map<number, KeyedMarkerRange[]>;\n arrayItems: Map<number, MarkerRange[]>;\n}\n\nexport function hydrate(\n value: ElurTemplate | ElurComponent,\n container: Element,\n options: HydrateOptions = {},\n): ElurMountHandle {\n try {\n if (isElurComponent(value)) return hydrateComponent(value, container, options);\n const descriptor = value[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Template has no hydration descriptor\");\n const cleanup = hydrateDescriptor(descriptor!, container, options);\n return { unmount: cleanup };\n } catch (error) {\n if (options.mismatch === \"throw\") throw error;\n if (options.mismatch !== \"remount\") console.warn(\"[elur] Hydration mismatch; remounting root:\", error);\n container.replaceChildren();\n const cleanup = isElurComponent(value)\n ? value.render()._render(container, null)\n : value._render(container, null);\n return { unmount: cleanup };\n }\n}\n\nfunction hydrateComponent(\n component: ElurComponent,\n container: Element,\n options: HydrateOptions,\n): ElurMountHandle {\n _pushComponentContext();\n let cleanup = () => { };\n try {\n try {\n component.onInit?.();\n } catch (error) {\n if (component.onError) component.onError(error);\n else throw error;\n }\n const template = component.render();\n const descriptor = template[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Component template has no hydration descriptor\");\n cleanup = hydrateDescriptor(descriptor!, container, options);\n } finally {\n _popComponentContext();\n }\n const mountCleanup = component.onMount?.();\n return {\n unmount() {\n component.onUnmount?.();\n if (typeof mountCleanup === \"function\") mountCleanup();\n cleanup();\n },\n };\n}\n\nfunction hydrateDescriptor(\n descriptor: TemplateDescriptor,\n root: ParentNode,\n options: HydrateOptions,\n bounds?: MarkerRange,\n): () => void {\n const markers = scanMarkers(root, bounds);\n const cleanups: Array<() => void> = [];\n\n for (let index = 0; index < descriptor.contexts.length; index++) {\n const context = descriptor.contexts[index];\n const value = descriptor.values[index];\n if (context.type === \"event\") {\n const element = markers.events.get(index);\n if (!element) throwMismatch(options, index, \"event\", `Missing event marker ${index}`);\n element!.removeAttribute(`data-elur-e-${index}`);\n cleanups.push(activateEvent(element!, context.eventName, context.modifiers, value));\n continue;\n }\n if (context.type === \"attr\") {\n const element = markers.attributes.get(index);\n if (!element) throwMismatch(options, index, \"attribute\", `Missing attribute marker ${index}`);\n element!.removeAttribute(`data-elur-a-${index}`);\n cleanups.push(activateAttribute(element!, context.attrName, context.url === true, value));\n continue;\n }\n\n const range = markers.nodes.get(index);\n if (!range) throwMismatch(options, index, \"node\", `Missing node marker ${index}`);\n const cleanup = activateNode(range!, value, options, markers.keyed.get(index), markers.arrayItems.get(index));\n if (cleanup) cleanups.push(cleanup);\n }\n\n return () => {\n for (let index = cleanups.length - 1; index >= 0; index--) cleanups[index]();\n };\n}\n\nfunction scanMarkers(root: ParentNode, bounds?: MarkerRange): ScannedMarkers {\n const nodes = new Map<number, MarkerRange>();\n const starts = new Map<number, Comment>();\n const attributes = new Map<number, Element>();\n const events = new Map<number, Element>();\n const keyed = new Map<number, KeyedMarkerRange[]>();\n const arrayItems = new Map<number, MarkerRange[]>();\n const stack: number[] = [];\n const keyedStack: Array<{ start: Comment; serializedKey: string; parentIndex: number }> = [];\n const arrayStack: Array<{ start: Comment; parentIndex: number }> = [];\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT);\n let current: Node | null;\n\n while ((current = walker.nextNode())) {\n if (bounds && !isInsideRange(current, bounds)) continue;\n if (current.nodeType === Node.COMMENT_NODE) {\n const comment = current as Comment;\n const startMatch = /^elur-(\\d+)$/.exec(comment.data);\n if (startMatch) {\n const index = Number(startMatch[1]);\n if (stack.length === 0) starts.set(index, comment);\n stack.push(index);\n continue;\n }\n const endMatch = /^elur-end-(\\d+)$/.exec(comment.data);\n if (endMatch) {\n const index = Number(endMatch[1]);\n const active = stack.pop();\n if (active === index && stack.length === 0) {\n const start = starts.get(index);\n if (start) nodes.set(index, { start, end: comment });\n }\n continue;\n }\n const keyedStartMatch = /^elur-ki:(.+)$/.exec(comment.data);\n if (keyedStartMatch) {\n const serializedKey = keyedStartMatch[1];\n if (keyedStack.length === 0 && stack.length === 1) {\n keyedStack.push({ start: comment, serializedKey, parentIndex: stack[stack.length - 1] });\n } else {\n keyedStack.push({ start: comment, serializedKey, parentIndex: -1 });\n }\n continue;\n }\n if (comment.data === \"elur-ke\") {\n const active = keyedStack.pop();\n if (active) {\n if (active.parentIndex >= 0) {\n const list = keyed.get(active.parentIndex) ?? [];\n list.push({ start: active.start, end: comment, serializedKey: active.serializedKey });\n keyed.set(active.parentIndex, list);\n }\n } else {\n throw new Error(\"[elur] Hydration marker mismatch: orphan keyed end marker (elur-ke)\");\n }\n continue;\n }\n if (comment.data === \"elur-ai\") {\n if (arrayStack.length === 0 && stack.length === 1) {\n arrayStack.push({ start: comment, parentIndex: stack[stack.length - 1] });\n } else {\n arrayStack.push({ start: comment, parentIndex: -1 });\n }\n continue;\n }\n if (comment.data === \"elur-aiend\") {\n const active = arrayStack.pop();\n if (active && active.parentIndex >= 0) {\n const list = arrayItems.get(active.parentIndex) ?? [];\n list.push({ start: active.start, end: comment });\n arrayItems.set(active.parentIndex, list);\n }\n continue;\n }\n continue;\n }\n if (stack.length > 0) continue;\n const element = current as Element;\n for (const attribute of Array.from(element.attributes)) {\n const eventMatch = /^data-elur-e-(\\d+)$/.exec(attribute.name);\n if (eventMatch) events.set(Number(eventMatch[1]), element);\n const attributeMatch = /^data-elur-a-(\\d+)$/.exec(attribute.name);\n if (attributeMatch) attributes.set(Number(attributeMatch[1]), element);\n }\n }\n\n return { nodes, attributes, events, keyed, arrayItems };\n}\n\nfunction isInsideRange(node: Node, range: MarkerRange): boolean {\n const domRange = document.createRange();\n domRange.setStartAfter(range.start);\n domRange.setEndBefore(range.end);\n return domRange.intersectsNode(node);\n}\n\nfunction activateEvent(\n element: Element,\n eventName: string,\n modifiers: readonly string[],\n value: unknown,\n): () => void {\n if (typeof value !== \"function\") throw new TypeError(`Event \"${eventName}\" requires a function`);\n const rawHandler = value as EventListener;\n\n // Use global delegation for delegable events without capture/once mods,\n // matching the mount-time behavior in bindings.ts. The element must be\n // connected to the document for delegation to work (events bubble to\n // document where the delegated listener is registered).\n const canDelegate =\n isDelegableEvent(eventName) &&\n !modifiers.includes(\"capture\") &&\n !modifiers.includes(\"once\") &&\n document.body.contains(element);\n\n if (canDelegate) {\n return activateDelegatedEvent(element, eventName, modifiers, rawHandler);\n }\n\n // Non-delegable events or disconnected elements: use addEventListener directly.\n const options: AddEventListenerOptions = {\n once: modifiers.includes(\"once\"),\n capture: modifiers.includes(\"capture\"),\n passive: modifiers.includes(\"passive\"),\n };\n const listener = (event: Event) => {\n if (modifiers.includes(\"prevent\")) event.preventDefault();\n if (modifiers.includes(\"stop\")) event.stopPropagation();\n if (modifiers.includes(\"self\") && event.target !== event.currentTarget) return;\n rawHandler(event);\n };\n element.addEventListener(eventName, listener, options);\n return () => element.removeEventListener(eventName, listener, options);\n}\n\nfunction activateAttribute(\n element: Element,\n name: string,\n url: boolean,\n value: unknown,\n): () => void {\n if (name === \"ref\") {\n const reference = value as ElurRef<Element>;\n reference.el = element;\n return () => { reference.el = null; };\n }\n\n const isProperty = (name === \"value\" || name === \"checked\" || name === \"selected\") && name in element;\n let firstRun = true;\n let pendingSync = false;\n const update = (resolved: unknown) => {\n if (isProperty) {\n if (!firstRun) {\n (element as any)[name] = resolved ?? \"\";\n } else {\n // Interaction before hydration: the DOM may hold a value the\n // user (or a hydration race with lazy island directives like\n // \"visible\") wrote before the binding activated. The DOM is\n // authoritative; keep it and propagate it to reactive model\n // sources once every handler is attached (microtask) so a\n // late @input/@change listener picks up the real value.\n const current = (element as any)[name];\n const model = resolved ?? \"\";\n if (String(current) !== String(model) && !pendingSync) {\n pendingSync = true;\n const eventName = name === \"checked\" || name === \"selected\" ? \"change\" : \"input\";\n queueMicrotask(() => {\n pendingSync = false;\n element.dispatchEvent(new Event(eventName, { bubbles: true }));\n });\n }\n }\n } else if (resolved === null || resolved === undefined || resolved === false) {\n element.removeAttribute(name);\n } else {\n const serialized = url ? sanitizeUrl(String(resolved)) : String(resolved);\n element.setAttribute(name, serialized);\n }\n firstRun = false;\n };\n\n if (typeof value === \"function\") {\n return effect(() => update((value as () => unknown)()));\n }\n update(value);\n return () => { };\n}\n\nfunction activateNode(\n range: MarkerRange,\n value: unknown,\n options: HydrateOptions,\n keyedItems?: KeyedMarkerRange[],\n arrayItems?: MarkerRange[],\n): (() => void) | undefined {\n if (typeof value !== \"function\") return hydrateNodeValue(range, value, options, keyedItems, arrayItems);\n\n let firstRun = true;\n let nestedCleanup: (() => void) | undefined;\n let textNode = findTextNode(range);\n let keyed: { state: Map<RepeatKey, KEntry>; prevOrder: RepeatKey[] } | null = null;\n const ctxSnapshot = _captureContextSnapshot();\n const keyedMount = createKeyedMount(ctxSnapshot);\n\n const warnDuplicate = (key: RepeatKey) => {\n console.warn(`[elur] repeat(): duplicate key \"${key}\". Keys must be unique; the previous entry leaks (orphaned nodes + live effects).`);\n };\n\n const dispose = effect(() => {\n const resolved = (value as () => unknown)();\n\n if (isKeyedList(resolved)) {\n if (firstRun && !keyed) {\n // First resolution is a keyed list: adopt the SSR markers when\n // present. Afterwards we converge with the current model, which\n // handles count/ordering drift without recreating surviving nodes.\n const adopted = adoptKeyedRange(resolved, keyedItems, options);\n keyed = { state: adopted.state, prevOrder: adopted.prevOrder };\n nestedCleanup = adopted.cleanup;\n reconcileKeyedList({\n zoneStart: range.start,\n anchor: range.end,\n state: keyed.state,\n prevOrder: keyed.prevOrder,\n list: resolved,\n mount: keyedMount,\n ctxSnapshot,\n onDuplicateKey: warnDuplicate,\n });\n textNode = null;\n firstRun = false;\n return;\n }\n if (!keyed) {\n // The binding became keyed after another value: the SSR markers\n // were already consumed (or never existed), so mount fresh.\n nestedCleanup?.();\n clearRange(range);\n keyed = { state: new Map(), prevOrder: [] };\n nestedCleanup = () => {\n for (const entry of keyed!.state.values()) entry.cleanup();\n };\n }\n reconcileKeyedList({\n zoneStart: range.start,\n anchor: range.end,\n state: keyed.state,\n prevOrder: keyed.prevOrder,\n list: resolved,\n mount: keyedMount,\n ctxSnapshot,\n onDuplicateKey: warnDuplicate,\n });\n textNode = null;\n firstRun = false;\n return;\n }\n\n // Non-keyed value: tear down any keyed zone first.\n if (keyed) {\n nestedCleanup?.();\n clearRange(range);\n keyed = null;\n nestedCleanup = undefined;\n }\n\n if (typeof resolved === \"string\" || typeof resolved === \"number\" || typeof resolved === \"bigint\") {\n if (!textNode) {\n textNode = document.createTextNode(String(resolved));\n range.end.parentNode!.insertBefore(textNode, range.end);\n } else if (textNode.nodeValue !== String(resolved)) {\n textNode.nodeValue = String(resolved);\n }\n } else if (firstRun) {\n nestedCleanup = hydrateNodeValue(range, resolved, options, keyedItems, arrayItems);\n } else {\n nestedCleanup?.();\n clearRange(range);\n nestedCleanup = mountNodeValue(range, resolved);\n textNode = findTextNode(range);\n }\n firstRun = false;\n });\n\n return () => {\n dispose();\n nestedCleanup?.();\n };\n}\n\nfunction hydrateNodeValue(\n range: MarkerRange,\n value: unknown,\n options: HydrateOptions,\n keyedItems?: KeyedMarkerRange[],\n arrayItems?: MarkerRange[],\n): (() => void) | undefined {\n if (isKeyedList(value)) {\n const ctxSnapshot = _captureContextSnapshot();\n const adopted = adoptKeyedRange(value, keyedItems, options);\n reconcileKeyedList({\n zoneStart: range.start,\n anchor: range.end,\n state: adopted.state,\n prevOrder: adopted.prevOrder,\n list: value,\n mount: createKeyedMount(ctxSnapshot),\n ctxSnapshot,\n onDuplicateKey: (key) => {\n console.warn(`[elur] repeat(): duplicate key \"${key}\". Keys must be unique; the previous entry leaks (orphaned nodes + live effects).`);\n },\n });\n return adopted.cleanup;\n }\n if (Array.isArray(value)) {\n const cleanups: Array<() => void> = [];\n const hasMarkers = arrayItems !== undefined && arrayItems.length > 0;\n for (let index = 0; index < value.length; index++) {\n const item = value[index];\n const itemBounds = arrayItems?.[index];\n if (hasMarkers && itemBounds) {\n // Hydrate each item within its own SSR-delimited range so\n // repeated marker indices across items never collide.\n const cleanup = hydrateNodeValue(itemBounds, item, options);\n if (cleanup) cleanups.push(cleanup);\n } else if (hasMarkers) {\n // Client item with no SSR slot: mount it fresh at the end.\n const cleanup = mountNodeValue(range, item);\n if (cleanup) cleanups.push(cleanup);\n } else {\n const cleanup = hydrateNodeValue(range, item, options);\n if (cleanup) cleanups.push(cleanup);\n }\n }\n return cleanups.length ? () => { for (let i = cleanups.length - 1; i >= 0; i--) cleanups[i](); } : undefined;\n }\n if (isElurTemplate(value)) {\n const descriptor = value[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Nested template has no hydration descriptor\");\n return hydrateDescriptor(descriptor!, range.start.parentNode as ParentNode, options, range);\n }\n if (isElurComponent(value)) {\n _pushComponentContext();\n let result: (() => void) | undefined;\n try {\n try {\n value.onInit?.();\n } catch (error) {\n if (value.onError) value.onError(error);\n else throw error;\n }\n const template = value.render();\n const descriptor = template[ELUR_TEMPLATE_DESCRIPTOR];\n if (!descriptor) throwMismatch(options, -1, \"descriptor\", \"Nested component has no hydration descriptor\");\n const cleanup = hydrateDescriptor(descriptor!, range.start.parentNode as ParentNode, options, range);\n const mountCleanup = value.onMount?.();\n result = () => {\n value.onUnmount?.();\n if (typeof mountCleanup === \"function\") mountCleanup();\n cleanup();\n };\n } finally {\n _popComponentContext();\n }\n return result;\n }\n if (value != null && typeof value === \"object\") {\n const protocol = (value as Record<PropertyKey, unknown>)[ELUR_RENDER_PROTOCOL] as\n | { hydrateDom?: (ctx: import(\"../template/types.js\").HydrationProtocolContext) => (() => void) | void }\n | undefined;\n if (protocol?.hydrateDom) {\n return protocol.hydrateDom({\n parent: range.start.parentNode!,\n bounds: range,\n context: options.context,\n render: (nested) => hydrateNodeValue(range, nested, options),\n }) ?? undefined;\n }\n }\n return undefined;\n}\n\nfunction adoptKeyedRange(\n list: import(\"../template/types.js\").KeyedList,\n keyedItems: KeyedMarkerRange[] | undefined,\n options: HydrateOptions,\n): { state: Map<RepeatKey, KEntry>; prevOrder: RepeatKey[]; cleanup: () => void } {\n const state = new Map<RepeatKey, KEntry>();\n const prevOrder: RepeatKey[] = [];\n\n if (!keyedItems || keyedItems.length === 0) {\n return { state, prevOrder, cleanup: () => { } };\n }\n\n const clientByKey = new Map<string, number>();\n for (let j = 0; j < list.items.length; j++) {\n const key = normalizeRepeatKey(list.keyFn(list.items[j], j), j);\n const serialized = serializeRepeatKey(key);\n if (clientByKey.has(serialized)) {\n console.warn(\n `[elur] repeat(): duplicate client key \"${key}\" during hydration. ` +\n \"Keys must be unique; entries after the first leak.\",\n );\n }\n clientByKey.set(serialized, j);\n }\n\n for (const marker of keyedItems) {\n const clientIndex = clientByKey.get(marker.serializedKey);\n if (clientIndex === undefined) {\n // SSR item not present in the client model → remove its DOM.\n removeKeyedMarker(marker);\n continue;\n }\n const item = list.items[clientIndex];\n const key = normalizeRepeatKey(list.keyFn(item, clientIndex), clientIndex);\n if (serializeRepeatKey(key) !== marker.serializedKey) {\n console.warn(\n `[elur] repeat(): hydration key mismatch at index ${clientIndex} ` +\n `(${deserializeRepeatKey(marker.serializedKey)} != ${key}). The SSR item is adopted by position.`,\n );\n }\n if (state.has(key)) {\n console.warn(`[elur] repeat(): duplicate key \"${key}\" during hydration; removing duplicate SSR node.`);\n removeKeyedMarker(marker);\n continue;\n }\n const rendered = list.renderFn(item, clientIndex);\n const cleanup = hydrateNodeValue(\n { start: marker.start, end: marker.end },\n rendered,\n options,\n );\n state.set(key, { start: marker.start, end: marker.end, cleanup: cleanup ?? (() => { }) });\n prevOrder.push(key);\n }\n\n return {\n state,\n prevOrder,\n cleanup: () => {\n for (const entry of state.values()) entry.cleanup();\n },\n };\n}\n\nfunction removeKeyedMarker(marker: KeyedMarkerRange): void {\n let node: Node | null = marker.start.nextSibling;\n while (node && node !== marker.end) {\n const next = node.nextSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n marker.start.parentNode?.removeChild(marker.start);\n marker.end.parentNode?.removeChild(marker.end);\n}\n\nfunction mountNodeValue(range: MarkerRange, value: unknown): (() => void) | undefined {\n if (value === null || value === undefined || value === false || value === true) return undefined;\n if (Array.isArray(value)) {\n const cleanups: Array<() => void> = [];\n for (const item of value) {\n const cleanup = mountNodeValue(range, item);\n if (cleanup) cleanups.push(cleanup);\n }\n return cleanups.length ? () => { for (let i = cleanups.length - 1; i >= 0; i--) cleanups[i](); } : undefined;\n }\n if (isElurTemplate(value)) return value._render(range.end.parentNode!, range.end);\n if (isElurComponent(value)) return value.render()._render(range.end.parentNode!, range.end);\n const node = document.createTextNode(String(value));\n range.end.parentNode!.insertBefore(node, range.end);\n return () => node.parentNode?.removeChild(node);\n}\n\nfunction findTextNode(range: MarkerRange): Text | null {\n let node = range.start.nextSibling;\n while (node && node !== range.end) {\n if (node.nodeType === Node.TEXT_NODE) return node as Text;\n node = node.nextSibling;\n }\n return null;\n}\n\nfunction clearRange(range: MarkerRange): void {\n let node = range.start.nextSibling;\n while (node && node !== range.end) {\n const next = node.nextSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n}\n\nfunction throwMismatch(\n options: HydrateOptions,\n index: number,\n kind: HydrationMismatch[\"kind\"],\n message: string,\n): never {\n const mismatch = { index, kind, message } satisfies HydrationMismatch;\n options.onMismatch?.(mismatch);\n const error = new Error(`[elur] Hydration marker mismatch: ${message}`);\n Object.assign(error, { mismatch });\n throw error;\n}"],"mappings":";;;;;;;;;AAuDA,SAAgB,EACZ,GACA,GACA,IAA0B,EAAE,EACb;AACf,KAAI;AACA,MAAI,EAAgB,EAAM,CAAE,QAAO,EAAiB,GAAO,GAAW,EAAQ;EAC9E,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A;;AAEvG,KAAI,EAAe,EAAM,CAAE,QAAO,EAAM,QAAQ,EAAM,IAAI,YAAa,EAAM,IAAI;AACjF,KAAI,EAAgB,EAAM,CAAE,QAAO,EAAM,QAAQ,CAAC,QAAQ,EAAM,IAAI,YAAa,EAAM,IAAI;CAC3F,IAAM,IAAO,SAAS,eAAe,OAAO,EAAM,CAAC;AAEnD,QADA,EAAM,IAAI,WAAY,aAAa,GAAM,EAAM,IAAI,QACtC,EAAK,YAAY,YAAY,EAAK;;AAGnD,SAAS,EAAa,GAAiC;CACnD,IAAI,IAAO,EAAM,MAAM;AACvB,QAAO,KAAQ,MAAS,EAAM,MAAK;AAC/B,MAAI,EAAK,aAAa,KAAK,UAAW,QAAO;AAC7C,MAAO,EAAK;;AAEhB,QAAO;;AAGX,SAAS,EAAW,GAA0B;CAC1C,IAAI,IAAO,EAAM,MAAM;AACvB,QAAO,KAAQ,MAAS,EAAM,MAAK;EAC/B,IAAM,IAAO,EAAK;AAElB,EADA,EAAK,YAAY,YAAY,EAAK,EAClC,IAAO;;;AAIf,SAAS,EACL,GACA,GACA,GACA,GACK;CACL,IAAM,IAAW;EAAE;EAAO;EAAM;EAAS;AACzC,GAAQ,aAAa,EAAS;CAC9B,IAAM,IAAQ,gBAAI,MAAM,qCAAqC,IAAU;AAEvE,OADA,OAAO,OAAO,GAAO,EAAE,aAAU,CAAC,EAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signals.cjs","names":[],"sources":["../../src/elur/reactivity.ts"],"sourcesContent":["// --- Dependency tracking ---\n\ninterface _EffectCtx {\n effect: (() => void) | null;\n deps: Set<Signal<any>> | null;\n}\n\ninterface _ReactivityGlobalState {\n ctxPool: _EffectCtx[];\n ctxStack: _EffectCtx[];\n activeEffect: (() => void) | null;\n activeDeps: Set<Signal<any>> | null;\n activeErrorHandler: ((err: unknown) => void) | null;\n errorHandlerStack: (((err: unknown) => void) | null)[];\n batchLevel: number;\n pendingEffectsSet: Set<() => void>;\n pendingEffectsArr: (() => void)[];\n effectDepth: number;\n notifyBuf: ((() => void) | null)[];\n notifyBase: number;\n signalDebugHooks: _SignalDebugHooks | null;\n /**\n * @internal Multi-subscriber registry backing `signalDebugHooks`.\n * The hot path always reads the single `signalDebugHooks` object; this\n * set only exists so devtools-style consumers can coexist.\n */\n signalDebugHookSet?: Set<_SignalDebugHooks>;\n /**\n * @internal Component debug hooks live here (not module-local) so they\n * work across duplicated module instances. Managed by lifecycle.ts.\n */\n componentDebugHooks?: {\n onMountStart?: (inst: unknown) => void;\n onMountEnd?: (inst: unknown) => void;\n onUnmount?: (inst: unknown) => void;\n } | null;\n /** @internal Multi-subscriber registry backing `componentDebugHooks`. */\n componentDebugHookSet?: Set<NonNullable<_ReactivityGlobalState[\"componentDebugHooks\"]>>;\n}\n\nfunction _createReactivityState(): _ReactivityGlobalState {\n return {\n ctxPool: [],\n ctxStack: [],\n activeEffect: null,\n activeDeps: null,\n activeErrorHandler: null,\n errorHandlerStack: [],\n batchLevel: 0,\n pendingEffectsSet: new Set<() => void>(),\n pendingEffectsArr: [],\n effectDepth: 0,\n notifyBuf: [],\n notifyBase: 0,\n signalDebugHooks: null,\n };\n}\n\nconst _reactivityStateKey = Symbol.for(\"@elurjs/core/reactivity-state\");\nconst _globalObj = globalThis as Record<PropertyKey, unknown>;\nconst _state = (() => {\n const existing = _globalObj[_reactivityStateKey] as _ReactivityGlobalState | undefined;\n if (existing) {\n // Another module may have pre-created the state object with only a\n // subset of fields (e.g. lifecycle.ts registering component hooks\n // before this module evaluated). Fill in any missing defaults.\n const defaults = _createReactivityState() as unknown as Record<string, unknown>;\n const target = existing as unknown as Record<string, unknown>;\n for (const key of Object.keys(defaults)) {\n if (!(key in target)) target[key] = defaults[key];\n }\n return existing;\n }\n const created = _createReactivityState();\n _globalObj[_reactivityStateKey] = created;\n return created;\n})();\n\n// --- Error boundary support ---\n\n/**\n * @internal — Register an error boundary handler. All `effect()` calls made\n * synchronously while this handler is active will capture it. When those\n * effects re-run and throw, the captured handler is invoked.\n */\nexport function _pushErrorHandler(h: (err: unknown) => void): void {\n _state.errorHandlerStack.push(_state.activeErrorHandler);\n _state.activeErrorHandler = h;\n}\n\n/** @internal — Restore the previous error boundary handler. */\nexport function _popErrorHandler(): void {\n _state.activeErrorHandler = _state.errorHandlerStack.pop() ?? null;\n}\n\n// --- Batching ---\n\n/**\n * Guards against synchronous effect re-entrancy.\n *\n * Effects re-run synchronously when a signal they depend on changes. If an\n * effect writes to a signal it also reads, this creates a synchronous loop.\n * The guard below caps re-execution at MAX_EFFECT_DEPTH (100) iterations and\n * throws an error to prevent stack overflow.\n *\n * Throwing is deliberate: when the guard fires, the reactive graph is in an\n * inconsistent state — the effect partially executed, dependencies may be\n * stale, and continuing could produce incorrect UI. Throwing surfaces the\n * bug immediately instead of silently degrading.\n *\n * To avoid re-entrancy:\n * 1. Use `computed()` for derived state — computed signals cache their result\n * and only recompute when dependencies change. They never write to other\n * signals, so they can't loop.\n * 2. Use `watch()` for side effects — watch callbacks receive the new value;\n * if you need to update other signals, do it inside `batch()` to coalesce\n * notifications.\n * 3. Never write to a signal you read in the same effect — this is the direct\n * cause of re-entrancy. If you need to transform a value, use `computed()`\n * instead.\n * 4. Use `batch()` to group writes — batched writes flush once at the end,\n * preventing intermediate re-runs.\n */\n\nconst MAX_EFFECT_DEPTH = 100;\nconst _NOTIFY_SHRINK_TRIGGER = 64;\nconst _NOTIFY_LOW_USAGE = 16;\nconst _NOTIFY_SHRINK_TO = 32;\n\nexport interface _SignalDebugHooks {\n onCreate?: (signal: Signal<any>, initialValue: unknown) => void;\n onWrite?: (signal: Signal<any>, value: unknown) => void;\n}\n\n/**\n * Keeps `signalDebugHooks` as a single object on the hot path. Only when\n * more than one subscriber is registered do we install a dispatcher.\n */\nfunction _syncSignalDebugHooks(): void {\n const set = _state.signalDebugHookSet;\n if (!set || set.size === 0) {\n _state.signalDebugHooks = null;\n return;\n }\n if (set.size === 1) {\n _state.signalDebugHooks = set.values().next().value ?? null;\n return;\n }\n _state.signalDebugHooks = {\n onCreate(signal, initialValue) {\n for (const hooks of set) hooks.onCreate?.(signal, initialValue);\n },\n onWrite(signal, value) {\n for (const hooks of set) hooks.onWrite?.(signal, value);\n },\n };\n}\n\nexport function _setSignalDebugHooks(hooks: _SignalDebugHooks | null): void {\n const set = new Set<_SignalDebugHooks>();\n if (hooks) set.add(hooks);\n _state.signalDebugHookSet = set;\n _syncSignalDebugHooks();\n}\n\n/**\n * @internal — Adds a debug hook subscriber WITHOUT replacing existing ones\n * (unlike `_setSignalDebugHooks`). Returns an unsubscribe function.\n * Zero cost when no subscribers are registered: the setter keeps reading a\n * single `signalDebugHooks` object.\n */\nexport function _addSignalDebugHooks(hooks: _SignalDebugHooks): () => void {\n let set = _state.signalDebugHookSet;\n if (!set) {\n set = new Set<_SignalDebugHooks>();\n if (_state.signalDebugHooks) set.add(_state.signalDebugHooks);\n _state.signalDebugHookSet = set;\n }\n set.add(hooks);\n _syncSignalDebugHooks();\n return () => {\n set.delete(hooks);\n _syncSignalDebugHooks();\n };\n}\n\n/** @internal — notify buffer capacity, exposed for tests. */\nexport function _getNotifyBufSize(): number {\n return _state.notifyBuf.length;\n}\n\n// --- Signal ---\n\nexport class Signal<T> {\n private _value: T;\n private _subs = new Set<() => void>();\n\n constructor(initialValue: T) {\n this._value = initialValue;\n _state.signalDebugHooks?.onCreate?.(this, initialValue);\n }\n\n /** Read the current value. Subscribes the active effect if one exists. */\n get value(): T {\n if (_state.activeEffect) {\n this._subs.add(_state.activeEffect);\n _state.activeDeps?.add(this);\n }\n return this._value;\n }\n\n /** Write a new value. Notifies subscribers when the value changes. */\n set value(newValue: T) {\n if (Object.is(this._value, newValue)) return;\n this._value = newValue;\n _state.signalDebugHooks?.onWrite?.(this, newValue);\n this._notify();\n }\n\n /** Mutate the value via a updater function. */\n update(fn: (current: T) => T): void {\n this.value = fn(this._value);\n }\n\n /** Read without subscribing the active effect. */\n peek(): T {\n return this._value;\n }\n\n /** @internal */\n _removeSub(sub: () => void): void {\n this._subs.delete(sub);\n }\n\n private _notify(): void {\n if (_state.batchLevel > 0) {\n for (const s of this._subs) {\n if (!_state.pendingEffectsSet.has(s)) {\n _state.pendingEffectsSet.add(s);\n _state.pendingEffectsArr.push(s);\n }\n }\n return;\n }\n const base = _state.notifyBase;\n let len = 0;\n for (const s of this._subs) _state.notifyBuf[base + len++] = s;\n _state.notifyBase = base + len;\n try {\n for (let i = 0; i < len; i++) {\n const fn = _state.notifyBuf[base + i];\n _state.notifyBuf[base + i] = null!;\n fn?.();\n }\n } finally {\n _state.notifyBase = base;\n // Shrink oversized notify buffer after a low-usage top-level flush.\n if (\n base === 0 &&\n _state.notifyBuf.length > _NOTIFY_SHRINK_TRIGGER &&\n len < _NOTIFY_LOW_USAGE\n ) {\n _state.notifyBuf.length = _NOTIFY_SHRINK_TO;\n }\n }\n }\n\n dispose(): void {\n this._subs.clear();\n }\n}\n\n// --- Factories ---\n\nexport function signal<T>(initialValue: T): Signal<T> {\n return new Signal(initialValue);\n}\n\n/**\n * Runs `fn` and re-runs it whenever any signal read inside changes.\n * Returns a dispose function to tear down the effect.\n * If `fn` returns a function, it is called as cleanup before each re-run\n * and on disposal.\n */\nexport function effect(fn: () => void | (() => void)): () => void {\n let disposed = false;\n let cleanup: (() => void) | void;\n\n // Opt: Double buffering para evitar crear `new Set()` en cada ejecución\n let deps = new Set<Signal<any>>();\n let newDeps = new Set<Signal<any>>();\n\n const capturedErrorHandler = _state.activeErrorHandler;\n\n const execute = () => {\n if (disposed) return;\n if (typeof cleanup === \"function\") cleanup();\n\n // Intercambiamos los buffers. 'deps' ahora tiene los viejos, 'newDeps' está limpio para recolectar.\n const temp = deps;\n deps = newDeps;\n newDeps = temp;\n newDeps.clear();\n\n const ctx = _state.ctxPool.length > 0 ? _state.ctxPool.pop()! : { effect: null, deps: null };\n ctx.effect = _state.activeEffect;\n ctx.deps = _state.activeDeps;\n _state.ctxStack.push(ctx);\n _state.activeEffect = execute;\n _state.activeDeps = newDeps;\n\n _state.effectDepth++;\n if (_state.effectDepth > MAX_EFFECT_DEPTH) {\n _state.effectDepth = 0;\n // Restaurar desde el stack unificado\n const restored = _state.ctxStack.pop()!;\n _state.activeEffect = restored.effect;\n _state.activeDeps = restored.deps;\n restored.effect = null;\n restored.deps = null;\n _state.ctxPool.push(restored);\n throw new Error(\n \"[elur] Maximum effect re-execution depth exceeded (possible infinite loop).\"\n );\n }\n\n try {\n cleanup = fn();\n } catch (err) {\n if (capturedErrorHandler) {\n capturedErrorHandler(err);\n } else {\n throw err;\n }\n } finally {\n _state.effectDepth--;\n const restored = _state.ctxStack.pop()!;\n _state.activeEffect = restored.effect;\n _state.activeDeps = restored.deps;\n restored.effect = null; // limpiar referencias para GC\n restored.deps = null;\n _state.ctxPool.push(restored); // devolver al pool para reutilizar\n\n\n // Cleanup phase: Desuscribirse de señales que estaban en 'deps' pero NO en 'newDeps'\n for (const oldDep of deps) {\n if (!newDeps.has(oldDep)) {\n oldDep._removeSub(execute);\n }\n }\n }\n };\n\n execute();\n\n return () => {\n disposed = true;\n if (typeof cleanup === \"function\") cleanup();\n // Al desechar, usamos newDeps porque es el que quedó activo después del último execute\n for (const dep of newDeps) {\n dep._removeSub(execute);\n }\n newDeps.clear();\n deps.clear();\n };\n}\n\n/** Derived signal that recalculates when its dependencies change. */\nconst _computedSentinel = Symbol(\"elur-computed-uninitialized\");\n\nexport function computed<T>(\n fn: () => T,\n equals: (a: T, b: T) => boolean = Object.is,\n): Signal<T> & { dispose(): void } {\n const s = new Signal<T | typeof _computedSentinel>(_computedSentinel);\n let disposeEffect: (() => void) | null = null;\n let initialized = false;\n let disposed = false;\n\n const ensureInitialized = () => {\n if (initialized || disposed) return;\n initialized = true;\n // Important: initialize untracked so first computed evaluation does not\n // accidentally subscribe the currently running external effect.\n untrack(() => {\n disposeEffect = effect(() => {\n const next = fn();\n const prev = s.peek();\n // The first computed value must always be written; afterwards use\n // the supplied equality comparator (defaults to Object.is).\n if (prev === _computedSentinel || !equals(next, prev)) {\n s.value = next;\n }\n });\n });\n };\n\n const signalProto = Object.getPrototypeOf(s) as Signal<T>;\n const valueDescriptor = Object.getOwnPropertyDescriptor(signalProto, \"value\");\n if (!valueDescriptor?.get || !valueDescriptor?.set) {\n throw new Error(\"[elur] Internal error: Signal.value descriptor not found.\");\n }\n\n Object.defineProperty(s, \"value\", {\n get() {\n ensureInitialized();\n return valueDescriptor.get!.call(this) as T;\n },\n set(v: T) {\n valueDescriptor.set!.call(this, v);\n },\n configurable: true,\n });\n\n const originalDispose = s.dispose;\n\n s.dispose = () => {\n disposed = true;\n disposeEffect?.();\n disposeEffect = null;\n originalDispose.call(s); // Opt: Evitar el uso lento de .bind()\n };\n return s as Signal<T> & { dispose(): void };\n}\n\n/** Groups multiple signal writes so effects flush once at the end. */\nexport function batch(fn: () => void): void {\n _state.batchLevel++;\n try {\n fn();\n } finally {\n _state.batchLevel--;\n if (_state.batchLevel === 0 && _state.pendingEffectsArr.length > 0) {\n const len = _state.pendingEffectsArr.length;\n for (let i = 0; i < len; i++) _state.pendingEffectsArr[i]();\n _state.pendingEffectsArr.length = 0; // reset O(1) sin GC — key del cambio\n _state.pendingEffectsSet.clear();\n }\n }\n}\n\n/** Executes `fn` without subscribing to any signals read inside it. */\nexport function untrack<T>(fn: () => T): T {\n const prevEffect = _state.activeEffect;\n const prevDeps = _state.activeDeps;\n _state.activeEffect = null;\n _state.activeDeps = null;\n try {\n return fn();\n } finally {\n _state.activeEffect = prevEffect;\n _state.activeDeps = prevDeps;\n }\n}\n\n// --- watch ---\n\nexport interface WatchOptions {\n /** Fire the callback immediately with the current value. Default: `false`. */\n immediate?: boolean;\n /** Automatically dispose after the first callback invocation. Default: `false`. */\n once?: boolean;\n}\n\n/**\n * Watches a reactive source and calls `callback(newValue, oldValue)` on each change.\n * Accepts a Signal or a getter function. Returns a dispose function.\n */\nexport function watch<T>(\n source: Signal<T> | (() => T),\n callback: (newValue: T, oldValue: T | undefined) => void,\n options: WatchOptions = {}\n): () => void {\n const { immediate = false, once = false } = options;\n\n const getter: () => T =\n source instanceof Signal ? () => source.value : source;\n\n let oldValue: T | undefined;\n let isFirst = true;\n let disposed = false;\n\n const dispose = effect(() => {\n const newValue = getter();\n\n if (isFirst) {\n isFirst = false;\n if (immediate && !disposed) {\n const snap = newValue;\n untrack(() => callback(snap, undefined));\n if (once) { disposed = true; Promise.resolve().then(dispose); }\n }\n oldValue = newValue;\n return;\n }\n\n if (!disposed) {\n const snap = newValue;\n const prev = oldValue;\n oldValue = newValue;\n untrack(() => callback(snap, prev));\n if (once) { disposed = true; Promise.resolve().then(dispose); }\n }\n });\n\n return () => {\n disposed = true;\n dispose();\n };\n}\n\n// --- nextTick ---\n\n/** Returns a promise that resolves on the next microtask. Accepts an optional callback. */\nexport function nextTick(fn?: () => void): Promise<void> {\n return fn ? Promise.resolve().then(fn) : Promise.resolve();\n}"],"mappings":"mEAwCA,SAAS,GAAiD,CACtD,MAAO,CACH,QAAS,EAAE,CACX,SAAU,EAAE,CACZ,aAAc,KACd,WAAY,KACZ,mBAAoB,KACpB,kBAAmB,EAAE,CACrB,WAAY,EACZ,kBAAmB,IAAI,IACvB,kBAAmB,EAAE,CACrB,YAAa,EACb,UAAW,EAAE,CACb,WAAY,EACZ,iBAAkB,KACrB,CAGL,IAAM,EAAsB,OAAO,IAAI,gCAAgC,CACjE,EAAa,WACb,OAAgB,CAClB,IAAM,EAAW,EAAW,GAC5B,GAAI,EAAU,CAIV,IAAM,EAAW,GAAwB,CACnC,EAAS,EACf,IAAK,IAAM,KAAO,OAAO,KAAK,EAAS,CAC7B,KAAO,IAAS,EAAO,GAAO,EAAS,IAEjD,OAAO,EAEX,IAAM,EAAU,GAAwB,CAExC,MADA,GAAW,GAAuB,EAC3B,KACP,CASJ,SAAgB,EAAkB,EAAiC,CAC/D,EAAO,kBAAkB,KAAK,EAAO,mBAAmB,CACxD,EAAO,mBAAqB,EAIhC,SAAgB,GAAyB,CACrC,EAAO,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