@elurjs/core 3.6.1 → 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 +2 -2
- package/dist/lib/elur/router.cjs.map +1 -1
- package/dist/lib/elur/router.js +2 -2
- package/dist/lib/elur/router.js.map +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 +180 -108
- 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 +10 -4
- package/dist/lib/elur/store.js.map +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 +2 -2
- package/dist/lib/router.js +2 -2
- package/dist/lib/server.cjs +1 -1
- package/dist/lib/server.js +180 -108
- 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 +10 -4
- 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
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
import { inputPending as e, yieldControl as t } from "./scheduler.js";
|
|
2
|
+
//#region src/elur/next-2/reactivity.ts
|
|
3
|
+
var n = 0, r = 1, i = 2, a = 4, o = 8, s = 16, c = 32, l = 0, u = 0, d = null, f = null, p = 1, ee = 2, m = 4, h = 8, g = [], _ = [], te = class {
|
|
4
|
+
childrenHead = null;
|
|
5
|
+
childCount = 0;
|
|
6
|
+
cleanups = null;
|
|
7
|
+
parent = null;
|
|
8
|
+
nextOwned = null;
|
|
9
|
+
prevOwned = null;
|
|
10
|
+
onOwnerError;
|
|
11
|
+
_disposed = !1;
|
|
12
|
+
dispose() {
|
|
13
|
+
this._disposed || (this._disposed = !0, v(this), b(this));
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function v(e) {
|
|
17
|
+
if (e.cleanups) {
|
|
18
|
+
for (let t of e.cleanups) t();
|
|
19
|
+
e.cleanups = null;
|
|
20
|
+
}
|
|
21
|
+
let t = e.childrenHead;
|
|
22
|
+
for (e.childrenHead = null, e.childCount = 0; t;) {
|
|
23
|
+
let e = t.nextOwned;
|
|
24
|
+
t.nextOwned = null, t.prevOwned = null, t.parent = null, t.dispose(), t = e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function y(e) {
|
|
28
|
+
if (!f) return;
|
|
29
|
+
e.parent = f;
|
|
30
|
+
let t = f.childrenHead;
|
|
31
|
+
e.nextOwned = t, e.prevOwned = null, t && (t.prevOwned = e), f.childrenHead = e, f.childCount++;
|
|
32
|
+
}
|
|
33
|
+
function b(e) {
|
|
34
|
+
let t = e.parent;
|
|
35
|
+
e.parent = null, e.prevOwned ? e.prevOwned.nextOwned = e.nextOwned : t && (t.childrenHead = e.nextOwned), e.nextOwned && (e.nextOwned.prevOwned = e.prevOwned), e.nextOwned = null, e.prevOwned = null, t && t.childCount--;
|
|
36
|
+
}
|
|
37
|
+
function ne() {
|
|
38
|
+
return f;
|
|
39
|
+
}
|
|
40
|
+
function re(e, t) {
|
|
41
|
+
let n = f, r = d;
|
|
42
|
+
f = e, d = null;
|
|
43
|
+
try {
|
|
44
|
+
return t();
|
|
45
|
+
} finally {
|
|
46
|
+
f = n, d = r;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function ie(e) {
|
|
50
|
+
let t = new te();
|
|
51
|
+
return t.parent = f, re(t, () => e(() => t.dispose()));
|
|
52
|
+
}
|
|
53
|
+
function ae(e) {
|
|
54
|
+
f && (f.cleanups ??= []).push(e);
|
|
55
|
+
}
|
|
56
|
+
var oe = 1e4, se = 100, ce = class extends Error {
|
|
57
|
+
constructor(e, t) {
|
|
58
|
+
let n = [];
|
|
59
|
+
for (let t = e.sourcesHead; t; t = t.nextSource) {
|
|
60
|
+
let e = t.source;
|
|
61
|
+
if (n.push(e instanceof Q ? `computed(v${e.version})` : `signal(v${e.version})`), n.length >= 8) {
|
|
62
|
+
n.push("…");
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
super(`[elur] Maximum effect re-execution depth exceeded (possible infinite loop). Ciclo de efectos: un effect corrió ${t} veces en un solo flush (límite por nodo ${se}). Fuentes del effect: [${n.join(", ")}]. Probable write-inside-effect que se re-encola a sí mismo.`), this.name = "ReactiveCycleError";
|
|
67
|
+
}
|
|
68
|
+
}, le = [], x = null;
|
|
69
|
+
function ue(e) {
|
|
70
|
+
le.push(x), x = e;
|
|
71
|
+
}
|
|
72
|
+
function de() {
|
|
73
|
+
x = le.pop() ?? null;
|
|
74
|
+
}
|
|
75
|
+
var S = null, C = null;
|
|
76
|
+
function w() {
|
|
77
|
+
let e = C;
|
|
78
|
+
if (!e || e.size === 0) {
|
|
79
|
+
S = null;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (e.size === 1) {
|
|
83
|
+
S = e.values().next().value ?? null;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
S = {
|
|
87
|
+
onCreate(t, n) {
|
|
88
|
+
for (let r of e) r.onCreate?.(t, n);
|
|
89
|
+
},
|
|
90
|
+
onWrite(t, n) {
|
|
91
|
+
for (let r of e) r.onWrite?.(t, n);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function fe(e) {
|
|
96
|
+
let t = /* @__PURE__ */ new Set();
|
|
97
|
+
e && t.add(e), C = t, w();
|
|
98
|
+
}
|
|
99
|
+
function pe(e) {
|
|
100
|
+
let t = C;
|
|
101
|
+
return t || (t = /* @__PURE__ */ new Set(), S && t.add(S), C = t), t.add(e), w(), () => {
|
|
102
|
+
t.delete(e), w();
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function me() {
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
var T = [], E = [], D = null, O = 0, he = 8192;
|
|
109
|
+
function k(e, t, n, r) {
|
|
110
|
+
let i = D;
|
|
111
|
+
return i ? (D = i.nextSource, O--, i.source = e, i.target = t, i.seenVersion = n, i.mark = r, i.linked = !1, i.prevSource = null, i.nextTarget = null, i.prevTarget = null, i) : {
|
|
112
|
+
source: e,
|
|
113
|
+
target: t,
|
|
114
|
+
seenVersion: n,
|
|
115
|
+
mark: r,
|
|
116
|
+
linked: !1,
|
|
117
|
+
nextSource: null,
|
|
118
|
+
prevSource: null,
|
|
119
|
+
nextTarget: null,
|
|
120
|
+
prevTarget: null
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function A(e) {
|
|
124
|
+
O >= he || (e.source = null, e.target = null, e.nextTarget = null, e.prevTarget = null, e.prevSource = null, e.nextSource = D, D = e, O++);
|
|
125
|
+
}
|
|
126
|
+
function j(e, t) {
|
|
127
|
+
t.nextTarget = e.consumersHead, t.prevTarget = null, e.consumersHead && (e.consumersHead.prevTarget = t), e.consumersHead = t, t.linked = !0, e.liveCount++, e.liveCount === 1 && e instanceof Q && T.push(e);
|
|
128
|
+
}
|
|
129
|
+
function M(e, t) {
|
|
130
|
+
t.linked && (t.prevTarget ? t.prevTarget.nextTarget = t.nextTarget : e.consumersHead = t.nextTarget, t.nextTarget && (t.nextTarget.prevTarget = t.prevTarget), t.linked = !1, e.liveCount--, e.liveCount === 0 && e instanceof Q && E.push(e));
|
|
131
|
+
}
|
|
132
|
+
function N() {
|
|
133
|
+
for (; T.length;) {
|
|
134
|
+
let e = T.pop();
|
|
135
|
+
for (let t = e.sourcesHead; t; t = t.nextSource) t.linked || j(t.source, t);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function P() {
|
|
139
|
+
for (; E.length;) {
|
|
140
|
+
let e = E.pop();
|
|
141
|
+
for (let t = e.sourcesHead; t; t = t.nextSource) M(t.source, t);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function ge(e, t) {
|
|
145
|
+
if (e.durable) return;
|
|
146
|
+
for (let n = t.sourcesHead; n; n = n.nextSource) if (n.source === e) {
|
|
147
|
+
n.seenVersion = e.version, n.mark = t.evalMark;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let n = k(e, t, e.version, t.evalMark);
|
|
151
|
+
n.nextSource = t.sourcesHead, t.sourcesHead && (t.sourcesHead.prevSource = n), t.sourcesHead = n, t.live() && (j(e, n), T.length && N());
|
|
152
|
+
}
|
|
153
|
+
function F(e) {
|
|
154
|
+
let t = e.sourcesHead;
|
|
155
|
+
for (; t;) {
|
|
156
|
+
let n = t.nextSource;
|
|
157
|
+
t.mark !== e.evalMark && (t.prevSource ? t.prevSource.nextSource = t.nextSource : e.sourcesHead = t.nextSource, t.nextSource && (t.nextSource.prevSource = t.prevSource), M(t.source, t), A(t)), t = n;
|
|
158
|
+
}
|
|
159
|
+
E.length && P();
|
|
160
|
+
}
|
|
161
|
+
var I = [];
|
|
162
|
+
function _e(e) {
|
|
163
|
+
if (!(e.state & (i | s)) && !(e instanceof Q && e.state & a)) if (e.state = i, e instanceof Q) {
|
|
164
|
+
for (let t = e.consumersHead; t; t = t.nextTarget) {
|
|
165
|
+
let e = t.target;
|
|
166
|
+
e.state === n && (e.state = r, e instanceof Q ? I.push(t) : H(e));
|
|
167
|
+
}
|
|
168
|
+
for (; I.length;) {
|
|
169
|
+
let e = I.pop();
|
|
170
|
+
for (let t = e.target.consumersHead; t; t = t.nextTarget) {
|
|
171
|
+
let e = t.target;
|
|
172
|
+
e.state === n && (e.state = r, e instanceof Q ? I.push(t) : H(e));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
} else H(e);
|
|
176
|
+
}
|
|
177
|
+
function ve(e) {
|
|
178
|
+
for (let t = e.consumersHead; t; t = t.nextTarget) _e(t.target);
|
|
179
|
+
u === 0 && ke();
|
|
180
|
+
}
|
|
181
|
+
function L(e) {
|
|
182
|
+
(e.childrenHead !== null || e.cleanups !== null) && v(e), e.evalMark++;
|
|
183
|
+
let t = d, r = f;
|
|
184
|
+
d = e, f = e, e.state = a;
|
|
185
|
+
let o, s = !0;
|
|
186
|
+
try {
|
|
187
|
+
o = e.fn(), s = !1;
|
|
188
|
+
} finally {
|
|
189
|
+
d = t, f = r, s && e.state & a && (e.state = i);
|
|
190
|
+
}
|
|
191
|
+
F(e), e.state = n, e.lastCleanEpoch = l, (!(e.flags & p) || !e.equals(o, e._value)) && (e._value = o, e.flags |= p, e.version++);
|
|
192
|
+
}
|
|
193
|
+
var R = 64, z = 128, B = 256, V = z | 320, ye = [], be = 0;
|
|
194
|
+
function xe(e) {
|
|
195
|
+
let t = e.state & (i | 5);
|
|
196
|
+
if (e.state & s) return;
|
|
197
|
+
if (t === a) throw Error("[elur-next] Ciclo reactivo detectado en computed().");
|
|
198
|
+
if (t === 0 && e.flags & p && (e.live() || e.lastCleanEpoch === l)) return;
|
|
199
|
+
let r = t === i || !(e.flags & p), o = !1;
|
|
200
|
+
for (let t = e.sourcesHead; t; t = t.nextSource) {
|
|
201
|
+
let e = t.source;
|
|
202
|
+
if (e instanceof Q && (!(e.flags & p) || e.state !== n || !e.live() && e.lastCleanEpoch !== l)) {
|
|
203
|
+
o = !0;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
!r && e.version !== t.seenVersion && (r = !0);
|
|
207
|
+
}
|
|
208
|
+
if (!o) {
|
|
209
|
+
if (r) L(e);
|
|
210
|
+
else {
|
|
211
|
+
e.state = n, e.lastCleanEpoch = l;
|
|
212
|
+
for (let t = e.sourcesHead; t; t = t.nextSource) t.seenVersion = t.source.version;
|
|
213
|
+
}
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
let u = be++ === 0 ? ye : [];
|
|
217
|
+
try {
|
|
218
|
+
let t = e;
|
|
219
|
+
for (; t;) {
|
|
220
|
+
if (!(t.state & R)) {
|
|
221
|
+
t.state |= R, t._pCursor = null, t._pLink = null;
|
|
222
|
+
let e = t.state & (i | 5);
|
|
223
|
+
if (t.state & s) {
|
|
224
|
+
t.state &= ~c, t.state &= ~V, t = u.pop();
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (e === a && Se(u, t), e === 0 && t.flags & p && (t.live() || t.lastCleanEpoch === l)) {
|
|
228
|
+
t.state &= ~V, t = u.pop();
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
t.state |= c, e === i && (t.state |= z), t._pCursor = t.sourcesHead;
|
|
232
|
+
}
|
|
233
|
+
if (t._pLink) {
|
|
234
|
+
let e = t._pLink;
|
|
235
|
+
t._pLink = null, e.source.version !== e.seenVersion && (t.state |= B);
|
|
236
|
+
}
|
|
237
|
+
let e = !1;
|
|
238
|
+
for (; t._pCursor;) {
|
|
239
|
+
let r = t._pCursor;
|
|
240
|
+
t._pCursor = r.nextSource;
|
|
241
|
+
let i = r.source;
|
|
242
|
+
if (i instanceof Q && (!(i.flags & p) || i.state !== n || !i.live() && i.lastCleanEpoch !== l)) {
|
|
243
|
+
i.state & c && Se(u, t), t._pLink = r, u.push(t), i.state |= c, t = i, e = !0;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
i.version !== r.seenVersion && (t.state |= B);
|
|
247
|
+
}
|
|
248
|
+
if (!e) {
|
|
249
|
+
if (t.state &= ~c, t.state & (z | B) || !(t.flags & p)) L(t);
|
|
250
|
+
else {
|
|
251
|
+
t.state = n, t.lastCleanEpoch = l;
|
|
252
|
+
for (let e = t.sourcesHead; e; e = e.nextSource) e.seenVersion = e.source.version;
|
|
253
|
+
}
|
|
254
|
+
t.state &= ~V, t._pCursor = null, t._pLink = null, t = u.pop();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
} finally {
|
|
258
|
+
be--;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function Se(e, t) {
|
|
262
|
+
for (let t of e) t.state &= ~(c | V), t._pCursor = null, t._pLink = null;
|
|
263
|
+
throw t.state &= ~(c | V), e.length = 0, Error("[elur-next] Ciclo reactivo detectado en computed().");
|
|
264
|
+
}
|
|
265
|
+
function Ce(e) {
|
|
266
|
+
(e.state !== n || !e.live() && e.lastCleanEpoch !== l) && xe(e);
|
|
267
|
+
}
|
|
268
|
+
function we(e) {
|
|
269
|
+
let t = !1;
|
|
270
|
+
for (let n = e.sourcesHead; n; n = n.nextSource) n.source instanceof Q && Ce(n.source), n.source.version !== n.seenVersion && (t = !0);
|
|
271
|
+
return t;
|
|
272
|
+
}
|
|
273
|
+
function H(e) {
|
|
274
|
+
e.state & (o | s) || (e.state |= o, (e.flags & m ? g : _).push(e));
|
|
275
|
+
}
|
|
276
|
+
var U = !1, W = 0, G = 0, K = 0, Te = 0, q = 0, J = !1, Ee = 256, Y = () => {
|
|
277
|
+
g.length = 0, _.length = 0, G = 0, K = 0;
|
|
278
|
+
};
|
|
279
|
+
function X() {
|
|
280
|
+
W++, U = !1;
|
|
281
|
+
}
|
|
282
|
+
function De() {
|
|
283
|
+
for (; G < g.length || K < _.length;) {
|
|
284
|
+
if (++Te > oe) throw Y(), Error("[elur] Maximum effect re-execution depth exceeded (possible infinite loop).");
|
|
285
|
+
if (q++, G >= g.length && K < _.length && q > Ee && e()) {
|
|
286
|
+
Oe();
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
let t = G < g.length ? g[G++] : _[K++];
|
|
290
|
+
if (t.state &= ~o, t.state & s) continue;
|
|
291
|
+
if (t.state !== i && !we(t)) {
|
|
292
|
+
t.state = n;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
let r = Math.floor(t._flush / 1024), a = (r === W ? t._flush - r * 1024 : 0) + 1;
|
|
296
|
+
if (t._flush = W * 1024 + a, a > se) throw Y(), new ce(t, a);
|
|
297
|
+
t.run();
|
|
298
|
+
}
|
|
299
|
+
Y();
|
|
300
|
+
}
|
|
301
|
+
function Oe() {
|
|
302
|
+
J || (J = !0, t().then(() => {
|
|
303
|
+
J = !1, q = 0;
|
|
304
|
+
try {
|
|
305
|
+
De();
|
|
306
|
+
} catch (e) {
|
|
307
|
+
X(), queueMicrotask(() => {
|
|
308
|
+
throw e;
|
|
309
|
+
});
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
J || X();
|
|
313
|
+
}));
|
|
314
|
+
}
|
|
315
|
+
function ke() {
|
|
316
|
+
if (!U) {
|
|
317
|
+
U = !0, Te = 0, q = 0;
|
|
318
|
+
try {
|
|
319
|
+
De();
|
|
320
|
+
} catch (e) {
|
|
321
|
+
throw X(), e;
|
|
322
|
+
}
|
|
323
|
+
J || X();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
var Z = class {
|
|
327
|
+
version = 0;
|
|
328
|
+
liveCount = 0;
|
|
329
|
+
durable = !1;
|
|
330
|
+
consumersHead = null;
|
|
331
|
+
_v;
|
|
332
|
+
constructor(e) {
|
|
333
|
+
this._v = e, S?.onCreate?.(this, e);
|
|
334
|
+
}
|
|
335
|
+
get value() {
|
|
336
|
+
return d && ge(this, d), this._v;
|
|
337
|
+
}
|
|
338
|
+
set value(e) {
|
|
339
|
+
if (this.durable) {
|
|
340
|
+
console.warn("[elur-next2] constSignal: write ignorada — el producer es estático (B.12.4).");
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
Object.is(this._v, e) || (this._v = e, S?.onWrite?.(this, e), this.version++, l++, ve(this));
|
|
344
|
+
}
|
|
345
|
+
update(e) {
|
|
346
|
+
this.value = e(this._v);
|
|
347
|
+
}
|
|
348
|
+
peek() {
|
|
349
|
+
return this._v;
|
|
350
|
+
}
|
|
351
|
+
dispose() {
|
|
352
|
+
for (; this.consumersHead;) {
|
|
353
|
+
let e = this.consumersHead;
|
|
354
|
+
M(this, e), e.prevSource ? e.prevSource.nextSource = e.nextSource : e.target.sourcesHead = e.nextSource, e.nextSource && (e.nextSource.prevSource = e.prevSource), A(e);
|
|
355
|
+
}
|
|
356
|
+
P();
|
|
357
|
+
}
|
|
358
|
+
}, Q = class extends Z {
|
|
359
|
+
state = n;
|
|
360
|
+
sourcesHead = null;
|
|
361
|
+
evalMark = 0;
|
|
362
|
+
lastCleanEpoch = -1;
|
|
363
|
+
childrenHead = null;
|
|
364
|
+
childCount = 0;
|
|
365
|
+
nextOwned = null;
|
|
366
|
+
prevOwned = null;
|
|
367
|
+
cleanups = null;
|
|
368
|
+
parent = null;
|
|
369
|
+
_value;
|
|
370
|
+
fn;
|
|
371
|
+
equals;
|
|
372
|
+
flags = 0;
|
|
373
|
+
_pCursor = null;
|
|
374
|
+
_pLink = null;
|
|
375
|
+
constructor(e, t = Object.is) {
|
|
376
|
+
super(void 0), this.fn = e, this.equals = t, y(this);
|
|
377
|
+
}
|
|
378
|
+
live() {
|
|
379
|
+
return this.consumersHead !== null;
|
|
380
|
+
}
|
|
381
|
+
get value() {
|
|
382
|
+
return this.flags & ee || (this.flags |= ee, this.state = i), Ce(this), d && ge(this, d), this._value;
|
|
383
|
+
}
|
|
384
|
+
peek() {
|
|
385
|
+
return this._value;
|
|
386
|
+
}
|
|
387
|
+
dispose() {
|
|
388
|
+
this.state = s, v(this), this.evalMark++, F(this);
|
|
389
|
+
let e = this.consumersHead;
|
|
390
|
+
for (; e;) {
|
|
391
|
+
let t = e.nextTarget;
|
|
392
|
+
M(this, e), e.prevSource ? e.prevSource.nextSource = e.nextSource : e.target.sourcesHead = e.nextSource, e.nextSource && (e.nextSource.prevSource = e.prevSource), A(e), e = t;
|
|
393
|
+
}
|
|
394
|
+
this.sourcesHead = null, P(), b(this);
|
|
395
|
+
}
|
|
396
|
+
}, Ae = class {
|
|
397
|
+
state = n;
|
|
398
|
+
sourcesHead = null;
|
|
399
|
+
evalMark = 0;
|
|
400
|
+
childrenHead = null;
|
|
401
|
+
childCount = 0;
|
|
402
|
+
nextOwned = null;
|
|
403
|
+
prevOwned = null;
|
|
404
|
+
cleanups = null;
|
|
405
|
+
parent = null;
|
|
406
|
+
flags = 0;
|
|
407
|
+
_flush = 0;
|
|
408
|
+
_fn;
|
|
409
|
+
_cleanup = void 0;
|
|
410
|
+
_errorHandler;
|
|
411
|
+
constructor(e, t = !1) {
|
|
412
|
+
this._fn = e, t && (this.flags |= m), this._errorHandler = x, y(this);
|
|
413
|
+
}
|
|
414
|
+
live() {
|
|
415
|
+
return !0;
|
|
416
|
+
}
|
|
417
|
+
run() {
|
|
418
|
+
if (this.flags & h) return;
|
|
419
|
+
if (this.state & a) throw Error("[elur-next] Effect re-entrante detectado.");
|
|
420
|
+
typeof this._cleanup == "function" && this._cleanup(), (this.childrenHead !== null || this.cleanups !== null) && v(this), this.evalMark++;
|
|
421
|
+
let e = d, t = f;
|
|
422
|
+
d = this, f = this, this.state = a;
|
|
423
|
+
let r = !0;
|
|
424
|
+
try {
|
|
425
|
+
this._cleanup = this._fn(), r = !1;
|
|
426
|
+
} catch (e) {
|
|
427
|
+
if (this._errorHandler) this._errorHandler(e), r = !1;
|
|
428
|
+
else {
|
|
429
|
+
let t = !1;
|
|
430
|
+
for (let n = this.parent; n; n = n.parent) if (n.onOwnerError?.(e)) {
|
|
431
|
+
t = !0;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
if (t) r = !1;
|
|
435
|
+
else throw e;
|
|
436
|
+
}
|
|
437
|
+
} finally {
|
|
438
|
+
d = e, f = t, r && this.state & a && (this.state = i);
|
|
439
|
+
}
|
|
440
|
+
F(this), this.state = n;
|
|
441
|
+
}
|
|
442
|
+
dispose() {
|
|
443
|
+
this.flags & h || (this.flags |= h, this.state = s, typeof this._cleanup == "function" && this._cleanup(), v(this), this.evalMark++, F(this), b(this));
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function je(e) {
|
|
447
|
+
return new Z(e);
|
|
448
|
+
}
|
|
449
|
+
function Me(e) {
|
|
450
|
+
let t = new Z(e);
|
|
451
|
+
return t.durable = !0, t;
|
|
452
|
+
}
|
|
453
|
+
function Ne(e, t = Object.is) {
|
|
454
|
+
return new Q(e, t);
|
|
455
|
+
}
|
|
456
|
+
function Pe(e) {
|
|
457
|
+
let t = new Ae(e);
|
|
458
|
+
return t.run(), () => t.dispose();
|
|
459
|
+
}
|
|
460
|
+
function Fe(e) {
|
|
461
|
+
let t = new Ae(e, !0);
|
|
462
|
+
return t.run(), () => t.dispose();
|
|
463
|
+
}
|
|
464
|
+
function Ie(e) {
|
|
465
|
+
u++;
|
|
466
|
+
try {
|
|
467
|
+
return e();
|
|
468
|
+
} finally {
|
|
469
|
+
u--, u === 0 && ke();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function $(e) {
|
|
473
|
+
let t = d;
|
|
474
|
+
d = null;
|
|
475
|
+
try {
|
|
476
|
+
return e();
|
|
477
|
+
} finally {
|
|
478
|
+
d = t;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function Le(e, t, n = {}) {
|
|
482
|
+
let { immediate: r = !1, once: i = !1 } = n, a = e instanceof Z ? () => e.value : e, o = !0, s, c = () => {};
|
|
483
|
+
return c = Pe(() => {
|
|
484
|
+
let e = a();
|
|
485
|
+
if (o && (o = !1, !r)) {
|
|
486
|
+
s = e;
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
t(e, s), s = e, i && c();
|
|
490
|
+
}), c;
|
|
491
|
+
}
|
|
492
|
+
function Re(e) {
|
|
493
|
+
return Promise.resolve().then(e);
|
|
494
|
+
}
|
|
495
|
+
var ze = class {
|
|
496
|
+
state = n;
|
|
497
|
+
flags = m;
|
|
498
|
+
_flush = 0;
|
|
499
|
+
sourcesHead = null;
|
|
500
|
+
evalMark = 0;
|
|
501
|
+
childrenHead = null;
|
|
502
|
+
childCount = 0;
|
|
503
|
+
nextOwned = null;
|
|
504
|
+
prevOwned = null;
|
|
505
|
+
cleanups = null;
|
|
506
|
+
parent = null;
|
|
507
|
+
_fn;
|
|
508
|
+
_node;
|
|
509
|
+
constructor(e, t) {
|
|
510
|
+
this._fn = e, this._node = t, y(this);
|
|
511
|
+
}
|
|
512
|
+
live() {
|
|
513
|
+
return !0;
|
|
514
|
+
}
|
|
515
|
+
run() {
|
|
516
|
+
if (this.flags & h || this.state & a) return;
|
|
517
|
+
(this.childrenHead !== null || this.cleanups !== null) && v(this), this.evalMark++;
|
|
518
|
+
let e = d, t = f;
|
|
519
|
+
d = this, f = this, this.state = a;
|
|
520
|
+
try {
|
|
521
|
+
let e = this._fn();
|
|
522
|
+
this._node.nodeValue = e == null || e === !1 ? "" : String(e);
|
|
523
|
+
} finally {
|
|
524
|
+
d = e, f = t;
|
|
525
|
+
}
|
|
526
|
+
F(this), this.state = n;
|
|
527
|
+
}
|
|
528
|
+
dispose() {
|
|
529
|
+
this.flags & h || (this.flags |= h, this.state = s, v(this), this.evalMark++, F(this), b(this));
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
function Be(e, t) {
|
|
533
|
+
let n = new ze(t, e);
|
|
534
|
+
return n.run(), () => n.dispose();
|
|
535
|
+
}
|
|
536
|
+
var Ve = class {
|
|
537
|
+
state = n;
|
|
538
|
+
flags = m;
|
|
539
|
+
_flush = 0;
|
|
540
|
+
sourcesHead = null;
|
|
541
|
+
evalMark = 0;
|
|
542
|
+
childrenHead = null;
|
|
543
|
+
childCount = 0;
|
|
544
|
+
nextOwned = null;
|
|
545
|
+
prevOwned = null;
|
|
546
|
+
cleanups = null;
|
|
547
|
+
parent = null;
|
|
548
|
+
_source;
|
|
549
|
+
_link = null;
|
|
550
|
+
_write;
|
|
551
|
+
_prev;
|
|
552
|
+
constructor(e, t) {
|
|
553
|
+
if (this._source = e, this._write = t, this._prev = e instanceof Q ? $(() => e.value) : e.peek(), t(this._prev), y(this), !e.durable) {
|
|
554
|
+
let t = k(e, this, e.version, 0);
|
|
555
|
+
t.nextSource = null, this._link = t, this.sourcesHead = t, j(e, t), T.length && N();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
live() {
|
|
559
|
+
return !0;
|
|
560
|
+
}
|
|
561
|
+
run() {
|
|
562
|
+
let e = this._source.peek();
|
|
563
|
+
this._link && (this._link.seenVersion = this._source.version), e !== this._prev && (this._prev = e, this._write(e)), this.state = n;
|
|
564
|
+
}
|
|
565
|
+
dispose() {
|
|
566
|
+
this.flags & h || (this.flags |= h, this.state = s, this._link && (M(this._source, this._link), A(this._link), this._link = null, this.sourcesHead = null), b(this));
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
function He(e, t) {
|
|
570
|
+
let n = new Ve(e, t);
|
|
571
|
+
return () => n.dispose();
|
|
572
|
+
}
|
|
573
|
+
var Ue = class {
|
|
574
|
+
state = n;
|
|
575
|
+
flags = m;
|
|
576
|
+
_flush = 0;
|
|
577
|
+
sourcesHead = null;
|
|
578
|
+
evalMark = 0;
|
|
579
|
+
childrenHead = null;
|
|
580
|
+
childCount = 0;
|
|
581
|
+
nextOwned = null;
|
|
582
|
+
prevOwned = null;
|
|
583
|
+
cleanups = null;
|
|
584
|
+
parent = null;
|
|
585
|
+
_source;
|
|
586
|
+
_link = null;
|
|
587
|
+
_get;
|
|
588
|
+
_write;
|
|
589
|
+
_prev;
|
|
590
|
+
constructor(e, t, n) {
|
|
591
|
+
if (this._source = e, this._get = t, this._write = n, this._prev = $(t), n(this._prev), y(this), !e.durable) {
|
|
592
|
+
let t = k(e, this, e.version, 0);
|
|
593
|
+
t.nextSource = null, this._link = t, this.sourcesHead = t, j(e, t), T.length && N();
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
live() {
|
|
597
|
+
return !0;
|
|
598
|
+
}
|
|
599
|
+
run() {
|
|
600
|
+
let e = $(this._get);
|
|
601
|
+
this._link && (this._link.seenVersion = this._source.version), e !== this._prev && (this._prev = e, this._write(e)), this.state = n;
|
|
602
|
+
}
|
|
603
|
+
dispose() {
|
|
604
|
+
this.flags & h || (this.flags |= h, this.state = s, this._link && (M(this._source, this._link), A(this._link), this._link = null, this.sourcesHead = null), b(this));
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
function We(e, t, n) {
|
|
608
|
+
let r = new Ue(e, t, n);
|
|
609
|
+
return () => r.dispose();
|
|
610
|
+
}
|
|
611
|
+
//#endregion
|
|
612
|
+
export { Q as Computed, te as Owner, ce as ReactiveCycleError, Z as Signal, pe as _addSignalDebugHooks, We as _bindDerived, He as _bindSignal, Be as _bindText, me as _getNotifyBufSize, de as _popErrorHandler, ue as _pushErrorHandler, Fe as _renderEffect, fe as _setSignalDebugHooks, Ie as batch, Ne as computed, Me as constSignal, ie as createRoot, Pe as effect, ne as getOwner, Re as nextTick, ae as onCleanup, re as runWithOwner, je as signal, $ as untrack, Le as watch };
|
|
613
|
+
|
|
614
|
+
//# sourceMappingURL=reactivity.js.map
|