rosetack 0.1.4 → 0.1.5
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/deploy/api/rosetack.ts +11 -21
- package/deploy/server.cjs +4 -0
- package/dist-cli/compiler.mjs +761 -137
- package/dist-cli/edge.mjs +88 -8
- package/dist-cli/rosetack.mjs +966 -188
- package/dist-cli/runtime.mjs +698 -29
- package/dist-cli/test.mjs +786 -142
- package/package.json +9 -1
- package/src/FRAMEWORK_VERSION +1 -1
- package/src/cli/edge.ts +13 -3
- package/src/cli/index.ts +51 -37
- package/src/cli/origin.ts +9 -0
- package/src/cli/prod-server.ts +179 -28
- package/src/cli/prompt.ts +53 -4
- package/src/cli/shell.ts +40 -5
- package/src/cli/shutdown.ts +54 -0
- package/src/compiler/index.ts +709 -64
- package/src/runtime/index.ts +786 -43
- package/src/types/rosetack.d.ts +3 -0
package/dist-cli/runtime.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/runtime/index.ts
|
|
2
2
|
var currentEffect = null;
|
|
3
|
+
var trackingDeps = null;
|
|
3
4
|
var signalMap = globalThis.__rosetack_signalMap ?? /* @__PURE__ */ new Map();
|
|
4
5
|
globalThis.__rosetack_signalMap = signalMap;
|
|
5
6
|
function entry(key, initial) {
|
|
@@ -11,23 +12,46 @@ function state(key, initial) {
|
|
|
11
12
|
ownerKeys()?.add(key);
|
|
12
13
|
const e = entry(key, initial);
|
|
13
14
|
const getter = () => {
|
|
14
|
-
if (currentEffect)
|
|
15
|
+
if (currentEffect) {
|
|
16
|
+
e.subs.add(currentEffect);
|
|
17
|
+
if (trackingDeps) trackingDeps.add(e);
|
|
18
|
+
}
|
|
15
19
|
return e.value;
|
|
16
20
|
};
|
|
17
21
|
const setter = (v) => {
|
|
18
|
-
e.value
|
|
22
|
+
const next = typeof v === "function" ? v(e.value) : v;
|
|
23
|
+
e.value = next;
|
|
24
|
+
const prevEffect = currentEffect;
|
|
25
|
+
const prevTracking = trackingDeps;
|
|
26
|
+
currentEffect = null;
|
|
27
|
+
trackingDeps = null;
|
|
19
28
|
e.subs.forEach((fn) => fn());
|
|
20
|
-
|
|
29
|
+
currentEffect = prevEffect;
|
|
30
|
+
trackingDeps = prevTracking;
|
|
31
|
+
if (persistedKeys.has(key)) writeStorage(key, next);
|
|
21
32
|
};
|
|
22
33
|
return [getter, setter];
|
|
23
34
|
}
|
|
24
35
|
function hasState(key) {
|
|
25
36
|
return signalMap.has(key);
|
|
26
37
|
}
|
|
38
|
+
var seededKeys = /* @__PURE__ */ new Set();
|
|
39
|
+
function isSeeded(key) {
|
|
40
|
+
return seededKeys.has(key);
|
|
41
|
+
}
|
|
42
|
+
function markSeeded(key) {
|
|
43
|
+
seededKeys.add(key);
|
|
44
|
+
}
|
|
27
45
|
function setState(key, value) {
|
|
28
46
|
const e = entry(key, value);
|
|
29
47
|
e.value = value;
|
|
48
|
+
const prevEffect = currentEffect;
|
|
49
|
+
const prevTracking = trackingDeps;
|
|
50
|
+
currentEffect = null;
|
|
51
|
+
trackingDeps = null;
|
|
30
52
|
e.subs.forEach((fn) => fn());
|
|
53
|
+
currentEffect = prevEffect;
|
|
54
|
+
trackingDeps = prevTracking;
|
|
31
55
|
if (persistedKeys.has(key)) writeStorage(key, value);
|
|
32
56
|
}
|
|
33
57
|
var persistedKeys = /* @__PURE__ */ new Set();
|
|
@@ -96,7 +120,7 @@ function resetContainerFx(container) {
|
|
|
96
120
|
keys.forEach((k) => signalMap.delete(k));
|
|
97
121
|
keysByOwner.delete(container);
|
|
98
122
|
}
|
|
99
|
-
|
|
123
|
+
renderMaps().data.clear();
|
|
100
124
|
pendingDeltas.clear();
|
|
101
125
|
}
|
|
102
126
|
function effect(fn) {
|
|
@@ -117,6 +141,61 @@ function effect(fn) {
|
|
|
117
141
|
fxSet().add(cleanup);
|
|
118
142
|
return cleanup;
|
|
119
143
|
}
|
|
144
|
+
function $effect(fn) {
|
|
145
|
+
if (typeof document === "undefined") return () => {
|
|
146
|
+
};
|
|
147
|
+
const deps = /* @__PURE__ */ new Set();
|
|
148
|
+
let cleanup;
|
|
149
|
+
let scheduled = false;
|
|
150
|
+
let disposed = false;
|
|
151
|
+
const detach = () => {
|
|
152
|
+
deps.forEach((e) => e.subs.delete(wrapped));
|
|
153
|
+
deps.clear();
|
|
154
|
+
};
|
|
155
|
+
const run = () => {
|
|
156
|
+
if (disposed) return;
|
|
157
|
+
scheduled = true;
|
|
158
|
+
detach();
|
|
159
|
+
if (typeof cleanup === "function") {
|
|
160
|
+
try {
|
|
161
|
+
cleanup();
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const prevEffect = currentEffect;
|
|
166
|
+
const prevTracking = trackingDeps;
|
|
167
|
+
currentEffect = wrapped;
|
|
168
|
+
trackingDeps = deps;
|
|
169
|
+
try {
|
|
170
|
+
const ret = fn();
|
|
171
|
+
cleanup = typeof ret === "function" ? ret : void 0;
|
|
172
|
+
} catch {
|
|
173
|
+
}
|
|
174
|
+
currentEffect = prevEffect;
|
|
175
|
+
trackingDeps = prevTracking;
|
|
176
|
+
scheduled = false;
|
|
177
|
+
};
|
|
178
|
+
const wrapped = () => {
|
|
179
|
+
if (scheduled || disposed) return;
|
|
180
|
+
scheduled = true;
|
|
181
|
+
queueMicrotask(run);
|
|
182
|
+
};
|
|
183
|
+
const owner = fxSet();
|
|
184
|
+
const dispose = () => {
|
|
185
|
+
disposed = true;
|
|
186
|
+
detach();
|
|
187
|
+
if (typeof cleanup === "function") {
|
|
188
|
+
try {
|
|
189
|
+
cleanup();
|
|
190
|
+
} catch {
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
owner.delete(dispose);
|
|
194
|
+
};
|
|
195
|
+
owner.add(dispose);
|
|
196
|
+
queueMicrotask(run);
|
|
197
|
+
return dispose;
|
|
198
|
+
}
|
|
120
199
|
var ESC_MAP = {
|
|
121
200
|
"&": "&",
|
|
122
201
|
"<": "<",
|
|
@@ -131,9 +210,22 @@ function textMark(closes, fn, pair, arg) {
|
|
|
131
210
|
const i = closes.push(fn) - 1;
|
|
132
211
|
return `<!--\u27E6m:${i}\u27E7-->` + esc(fn(arg)) + (pair ? `<!--\u27E6/m:${i}\u27E7-->` : "");
|
|
133
212
|
}
|
|
213
|
+
function attrValueString(name, v) {
|
|
214
|
+
if (v == null) return "";
|
|
215
|
+
if (typeof v === "object") {
|
|
216
|
+
if (name === "class") {
|
|
217
|
+
return Object.entries(v).filter(([, x]) => x).map(([k]) => k).join(" ");
|
|
218
|
+
}
|
|
219
|
+
if (name === "style") {
|
|
220
|
+
return Object.entries(v).filter(([, x]) => x != null && x !== false && x !== "").map(([k, x]) => `${k}: ${x}`).join("; ");
|
|
221
|
+
}
|
|
222
|
+
return JSON.stringify(v);
|
|
223
|
+
}
|
|
224
|
+
return String(v);
|
|
225
|
+
}
|
|
134
226
|
function attrMark(closes, fn, name, arg) {
|
|
135
227
|
const i = closes.push(fn) - 1;
|
|
136
|
-
return `${name}="${esc(fn(arg))}" data-b${i}="${name}"`;
|
|
228
|
+
return `${name}="${esc(attrValueString(name, fn(arg)))}" data-b${i}="${name}"`;
|
|
137
229
|
}
|
|
138
230
|
function boolAttrMark(closes, fn, name, arg) {
|
|
139
231
|
const i = closes.push(fn) - 1;
|
|
@@ -154,9 +246,12 @@ function ifMark(closes, cond, fn, scope) {
|
|
|
154
246
|
const r = closes[i]();
|
|
155
247
|
return `<!--\u27E6i:${i}\u27E7-->` + (r ? r.html : "") + `<!--\u27E6/i:${i}\u27E7-->`;
|
|
156
248
|
}
|
|
157
|
-
|
|
249
|
+
var EACH_REUSE_FORBID = /data-(?:on|use|bind-this|transition|animate)|data-rosetack-c|data-rv-island/;
|
|
250
|
+
var EACH_HTML_NORM = (h) => h.replace(/\u27e6\/?[a-z]+:\d+\u27e7/g, "").replace(/data-b\d+/g, "data-b");
|
|
251
|
+
var normHtml = (row) => row.norm ??= EACH_HTML_NORM(row.html);
|
|
252
|
+
function eachMark(closes, items, fn, key) {
|
|
158
253
|
const i = closes.push(() => items().map((v, vi) => {
|
|
159
|
-
return { html: String(fn(v, closes, vi)), closes, scope: v };
|
|
254
|
+
return { html: String(fn(v, closes, vi)), closes, scope: v, keyed: !!key, key: key ? String(key(v, vi)) : void 0 };
|
|
160
255
|
})) - 1;
|
|
161
256
|
let h = `<!--\u27E6l:${i}\u27E7-->`;
|
|
162
257
|
for (const r of closes[i]()) h += r.html;
|
|
@@ -232,6 +327,36 @@ function applyHead(html) {
|
|
|
232
327
|
function clearHead() {
|
|
233
328
|
document.head.querySelectorAll(`[${HEAD_ATTR}]`).forEach((el) => el.remove());
|
|
234
329
|
}
|
|
330
|
+
var TRANSITION_POSES = {
|
|
331
|
+
fade: { opacity: "0" },
|
|
332
|
+
slide: { transform: "translateY(20px)", opacity: "0" },
|
|
333
|
+
fly: { transform: "translateX(-30px) rotate(-5deg)", opacity: "0" },
|
|
334
|
+
zoom: { transform: "scale(0.8)", opacity: "0" },
|
|
335
|
+
"slide-up": { transform: "translateY(30px)", opacity: "0" },
|
|
336
|
+
"slide-down": { transform: "translateY(-30px)", opacity: "0" },
|
|
337
|
+
"slide-left": { transform: "translateX(30px)", opacity: "0" },
|
|
338
|
+
"slide-right": { transform: "translateX(-30px)", opacity: "0" },
|
|
339
|
+
scale: { transform: "scale(0.7)", opacity: "0" },
|
|
340
|
+
spin: { transform: "rotate(-90deg)", opacity: "0" },
|
|
341
|
+
blur: { filter: "blur(8px)", opacity: "0" },
|
|
342
|
+
stagger: { transform: "translateY(10px)", opacity: "0" }
|
|
343
|
+
};
|
|
344
|
+
function parseTransitionParams(pstr) {
|
|
345
|
+
const out = {};
|
|
346
|
+
if (!pstr) return out;
|
|
347
|
+
const trimmed = pstr.trim();
|
|
348
|
+
if (/^\d+$/.test(trimmed)) {
|
|
349
|
+
out.duration = Number(trimmed);
|
|
350
|
+
return out;
|
|
351
|
+
}
|
|
352
|
+
const dM = /duration\s*:\s*(\d+)/.exec(pstr);
|
|
353
|
+
if (dM) out.duration = Number(dM[1]);
|
|
354
|
+
const dlM = /delay\s*:\s*(\d+)/.exec(pstr);
|
|
355
|
+
if (dlM) out.delay = Number(dlM[1]);
|
|
356
|
+
const eM = /easing\s*:\s*(['"])(.*?)\1/.exec(pstr);
|
|
357
|
+
if (eM) out.easing = eM[2];
|
|
358
|
+
return out;
|
|
359
|
+
}
|
|
235
360
|
function wire(root, closes, scope) {
|
|
236
361
|
let holder = root;
|
|
237
362
|
if (root.nodeType === 11) {
|
|
@@ -393,13 +518,61 @@ function wire(root, closes, scope) {
|
|
|
393
518
|
st.__disp = void 0;
|
|
394
519
|
}
|
|
395
520
|
const items = closes[idx](scope);
|
|
521
|
+
const parent = start.parentNode;
|
|
522
|
+
const keyed = items.length > 0 && items.every((r) => r.keyed);
|
|
523
|
+
if (keyed) {
|
|
524
|
+
const prev = st.__kmap ?? /* @__PURE__ */ new Map();
|
|
525
|
+
const counts = /* @__PURE__ */ new Map();
|
|
526
|
+
for (const r of items) counts.set(r.key, (counts.get(r.key) ?? 0) + 1);
|
|
527
|
+
const keep = /* @__PURE__ */ new Set();
|
|
528
|
+
const nextMap = /* @__PURE__ */ new Map();
|
|
529
|
+
const used = /* @__PURE__ */ new Set();
|
|
530
|
+
const decisions = [];
|
|
531
|
+
for (const r of items) {
|
|
532
|
+
const k = r.key;
|
|
533
|
+
let keepRow;
|
|
534
|
+
if (counts.get(k) === 1 && !used.has(k)) {
|
|
535
|
+
const cand = prev.get(k);
|
|
536
|
+
if (cand && normHtml(cand) === normHtml(r) && !EACH_REUSE_FORBID.test(r.html)) {
|
|
537
|
+
keepRow = cand;
|
|
538
|
+
used.add(k);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
decisions.push({ row: r, keepRow });
|
|
542
|
+
if (keepRow) for (const nd of keepRow.nodes ?? []) keep.add(nd);
|
|
543
|
+
}
|
|
544
|
+
let n2 = start.nextSibling;
|
|
545
|
+
while (n2 && n2 !== end) {
|
|
546
|
+
const nx = n2.nextSibling;
|
|
547
|
+
if (!keep.has(n2)) n2.remove();
|
|
548
|
+
n2 = nx;
|
|
549
|
+
}
|
|
550
|
+
const disps2 = [];
|
|
551
|
+
for (const d of decisions) {
|
|
552
|
+
if (d.keepRow) {
|
|
553
|
+
disps2.push(d.keepRow.disp);
|
|
554
|
+
nextMap.set(d.row.key, d.keepRow);
|
|
555
|
+
for (const nd of d.keepRow.nodes ?? []) parent.insertBefore(nd, end);
|
|
556
|
+
} else {
|
|
557
|
+
const frag = tpl(d.row.html);
|
|
558
|
+
const disp = wire(frag, d.row.closes, d.row.scope);
|
|
559
|
+
disps2.push(disp);
|
|
560
|
+
const nodes = Array.from(frag.childNodes);
|
|
561
|
+
for (const nd of nodes) parent.insertBefore(nd, end);
|
|
562
|
+
if (counts.get(d.row.key) === 1) nextMap.set(d.row.key, { ...d.row, nodes, disp });
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
st.__kmap = nextMap;
|
|
566
|
+
st.__disp = () => disps2.forEach((d) => d());
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
st.__kmap = void 0;
|
|
396
570
|
let n = start.nextSibling;
|
|
397
571
|
while (n && n !== end) {
|
|
398
572
|
const nx = n.nextSibling;
|
|
399
573
|
n.remove();
|
|
400
574
|
n = nx;
|
|
401
575
|
}
|
|
402
|
-
const parent = start.parentNode;
|
|
403
576
|
const disps = [];
|
|
404
577
|
for (const r of items) {
|
|
405
578
|
const frag = tpl(r.html);
|
|
@@ -450,8 +623,16 @@ function wire(root, closes, scope) {
|
|
|
450
623
|
if (attr === "value") {
|
|
451
624
|
weff(() => {
|
|
452
625
|
const v = effect2();
|
|
626
|
+
const out = v == null ? "" : v;
|
|
453
627
|
const inp = el;
|
|
454
|
-
if (inp.value !==
|
|
628
|
+
if (inp.value !== out) inp.value = out;
|
|
629
|
+
});
|
|
630
|
+
} else if (attr === "data-selmulti") {
|
|
631
|
+
weff(() => {
|
|
632
|
+
const vals = effect2().split(",");
|
|
633
|
+
for (const o of Array.from(el.options)) {
|
|
634
|
+
o.selected = vals.includes(o.value);
|
|
635
|
+
}
|
|
455
636
|
});
|
|
456
637
|
} else if (attr.startsWith("!")) {
|
|
457
638
|
const name = attr.slice(1);
|
|
@@ -465,7 +646,8 @@ function wire(root, closes, scope) {
|
|
|
465
646
|
});
|
|
466
647
|
} else {
|
|
467
648
|
weff(() => {
|
|
468
|
-
|
|
649
|
+
const out = attrValueString(attr, closes[idx](scope));
|
|
650
|
+
if (el.getAttribute(attr) !== out) el.setAttribute(attr, out);
|
|
469
651
|
});
|
|
470
652
|
}
|
|
471
653
|
}
|
|
@@ -475,10 +657,7 @@ function wire(root, closes, scope) {
|
|
|
475
657
|
if (islandSkip && el.closest("[data-rv-island]")) return;
|
|
476
658
|
const name = el.getAttribute("data-use");
|
|
477
659
|
const fn = directives[name];
|
|
478
|
-
if (!fn)
|
|
479
|
-
console.warn(`rosetack: use:${name} has no registered action (directives.${name}?)`);
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
660
|
+
if (!fn) return;
|
|
482
661
|
const rawParam = el.getAttribute("data-use-param");
|
|
483
662
|
let initial = rawParam ?? void 0;
|
|
484
663
|
if (typeof initial === "string") {
|
|
@@ -501,6 +680,434 @@ function wire(root, closes, scope) {
|
|
|
501
680
|
setState(key, el);
|
|
502
681
|
created.push(() => setState(key, null));
|
|
503
682
|
});
|
|
683
|
+
if (holder.querySelectorAll("[data-transition]").length > 0) {
|
|
684
|
+
const trans = holder.querySelectorAll("[data-transition]");
|
|
685
|
+
trans.forEach((el) => {
|
|
686
|
+
if (islandSkip && el.closest("[data-rv-island]")) return;
|
|
687
|
+
const transAttr = el.getAttribute("data-transition");
|
|
688
|
+
const parts = transAttr.split("|");
|
|
689
|
+
for (const part of parts) {
|
|
690
|
+
const segs = part.split(":");
|
|
691
|
+
const dir = segs[0] === "in" || segs[0] === "out" ? segs[0] : "";
|
|
692
|
+
const name = (dir ? segs[1] : segs[0]) ?? "";
|
|
693
|
+
const pstr = (dir ? segs.slice(2) : segs.slice(1)).join(":");
|
|
694
|
+
const params = parseTransitionParams(pstr);
|
|
695
|
+
const duration = params.duration != null ? Number(params.duration) : 300;
|
|
696
|
+
if (dir === "out") {
|
|
697
|
+
const pose2 = TRANSITION_POSES[name];
|
|
698
|
+
if (pose2) {
|
|
699
|
+
const parent = el.parentElement;
|
|
700
|
+
const idx = parent ? Math.max(0, Array.from(parent.children).indexOf(el)) : 0;
|
|
701
|
+
const vDelay = params.delay != null ? Number(params.delay) : null;
|
|
702
|
+
const delay = name === "stagger" ? vDelay != null ? Math.max(0, vDelay) : idx * (duration / 10) : vDelay != null ? vDelay : 0;
|
|
703
|
+
const easing = params.easing || "ease";
|
|
704
|
+
created.push(() => {
|
|
705
|
+
const parts2 = [pose2.transform ? `transform ${duration}ms ${easing} ${delay}ms` : "", pose2.filter ? `filter ${duration}ms ${easing} ${delay}ms` : "", `opacity ${duration}ms ${easing} ${delay}ms`].filter(Boolean);
|
|
706
|
+
el.style.transition = parts2.join(", ");
|
|
707
|
+
if (pose2.transform) el.style.transform = pose2.transform;
|
|
708
|
+
if (pose2.filter) el.style.filter = pose2.filter;
|
|
709
|
+
el.style.opacity = pose2.opacity;
|
|
710
|
+
setTimeout(() => {
|
|
711
|
+
el.style.transform = "";
|
|
712
|
+
el.style.filter = "";
|
|
713
|
+
el.style.opacity = "";
|
|
714
|
+
el.style.transition = "";
|
|
715
|
+
}, duration + delay);
|
|
716
|
+
});
|
|
717
|
+
} else {
|
|
718
|
+
const custom = globalThis.__rosetackTransitions?.[name];
|
|
719
|
+
if (custom) {
|
|
720
|
+
const ret = custom(el, duration, "out");
|
|
721
|
+
if (typeof ret === "function") created.push(ret);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
const exitStart = created.length;
|
|
727
|
+
const pose = TRANSITION_POSES[name];
|
|
728
|
+
if (pose) {
|
|
729
|
+
const parent = el.parentElement;
|
|
730
|
+
const idx = parent ? Math.max(0, Array.from(parent.children).indexOf(el)) : 0;
|
|
731
|
+
const vDelay = params.delay != null ? Number(params.delay) : null;
|
|
732
|
+
const delay = name === "stagger" ? vDelay != null ? Math.max(0, vDelay) : idx * (duration / 10) : vDelay != null ? vDelay : 0;
|
|
733
|
+
const easing = params.easing || "ease";
|
|
734
|
+
const cssParts = [];
|
|
735
|
+
if (pose.transform) cssParts.push(`transform ${duration}ms ${easing} ${delay}ms`);
|
|
736
|
+
if (pose.filter) cssParts.push(`filter ${duration}ms ${easing} ${delay}ms`);
|
|
737
|
+
cssParts.push(`opacity ${duration}ms ${easing} ${delay}ms`);
|
|
738
|
+
const tcss = cssParts.join(", ");
|
|
739
|
+
el.style.opacity = "0";
|
|
740
|
+
if (pose.transform) el.style.transform = pose.transform;
|
|
741
|
+
if (pose.filter) el.style.filter = pose.filter;
|
|
742
|
+
el.style.transition = tcss;
|
|
743
|
+
requestAnimationFrame(() => {
|
|
744
|
+
requestAnimationFrame(() => {
|
|
745
|
+
el.style.transform = "";
|
|
746
|
+
el.style.filter = "";
|
|
747
|
+
el.style.opacity = "1";
|
|
748
|
+
});
|
|
749
|
+
});
|
|
750
|
+
created.push(() => {
|
|
751
|
+
el.style.opacity = "0";
|
|
752
|
+
if (pose.transform) el.style.transform = pose.transform;
|
|
753
|
+
if (pose.filter) el.style.filter = pose.filter;
|
|
754
|
+
setTimeout(() => {
|
|
755
|
+
el.style.opacity = "";
|
|
756
|
+
el.style.transform = "";
|
|
757
|
+
el.style.filter = "";
|
|
758
|
+
el.style.transition = "";
|
|
759
|
+
}, duration + delay);
|
|
760
|
+
});
|
|
761
|
+
} else {
|
|
762
|
+
const custom = globalThis.__rosetackTransitions?.[name];
|
|
763
|
+
if (custom) {
|
|
764
|
+
const ret = custom(el, duration, dir || "both");
|
|
765
|
+
if (typeof ret === "function") created.push(ret);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
if (dir === "in") created.length = exitStart;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
if (holder.querySelectorAll("[data-animate]").length > 0) {
|
|
773
|
+
const anim = holder.querySelectorAll("[data-animate]");
|
|
774
|
+
anim.forEach((el) => {
|
|
775
|
+
if (islandSkip && el.closest("[data-rv-island]")) return;
|
|
776
|
+
const animAttr = el.getAttribute("data-animate");
|
|
777
|
+
const parts = animAttr.split("|");
|
|
778
|
+
for (const part of parts) {
|
|
779
|
+
const [name] = part.split(":");
|
|
780
|
+
const rest = part.slice(name.length + 1);
|
|
781
|
+
const duration = Number((/(\d+)\s*\}?\s*$/.exec(rest) ?? [])[1]) || 300;
|
|
782
|
+
if (name === "flip") {
|
|
783
|
+
const firstRect = el.getBoundingClientRect();
|
|
784
|
+
const firstTop = firstRect.top;
|
|
785
|
+
const firstLeft = firstRect.left;
|
|
786
|
+
requestAnimationFrame(() => {
|
|
787
|
+
requestAnimationFrame(() => {
|
|
788
|
+
const lastRect = el.getBoundingClientRect();
|
|
789
|
+
const deltaTop = lastRect.top - firstTop;
|
|
790
|
+
const deltaLeft = lastRect.left - firstLeft;
|
|
791
|
+
if (Math.abs(deltaTop) < 0.5 && Math.abs(deltaLeft) < 0.5) return;
|
|
792
|
+
el.style.transform = `translate(${-deltaLeft}px, ${-deltaTop}px)`;
|
|
793
|
+
el.style.transition = "none";
|
|
794
|
+
requestAnimationFrame(() => {
|
|
795
|
+
requestAnimationFrame(() => {
|
|
796
|
+
el.style.transition = `transform ${duration}ms ease`;
|
|
797
|
+
el.style.transform = "";
|
|
798
|
+
});
|
|
799
|
+
});
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
} else if (name === "pulse") {
|
|
803
|
+
el.style.transform = "scale(1)";
|
|
804
|
+
el.style.transition = `transform ${duration}ms ease`;
|
|
805
|
+
requestAnimationFrame(() => {
|
|
806
|
+
requestAnimationFrame(() => {
|
|
807
|
+
el.style.transform = "scale(1.1)";
|
|
808
|
+
setTimeout(() => {
|
|
809
|
+
el.style.transform = "scale(1)";
|
|
810
|
+
}, duration);
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
} else if (name === "bounce") {
|
|
814
|
+
el.style.transform = "translateY(0)";
|
|
815
|
+
el.style.transition = `transform ${duration}ms ease`;
|
|
816
|
+
requestAnimationFrame(() => {
|
|
817
|
+
requestAnimationFrame(() => {
|
|
818
|
+
el.style.transform = "translateY(-15px)";
|
|
819
|
+
setTimeout(() => {
|
|
820
|
+
el.style.transform = "translateY(0)";
|
|
821
|
+
}, duration);
|
|
822
|
+
});
|
|
823
|
+
});
|
|
824
|
+
} else if (name === "shake") {
|
|
825
|
+
el.style.transform = "translateX(0)";
|
|
826
|
+
el.style.transition = `transform ${duration / 4}ms ease-in-out`;
|
|
827
|
+
requestAnimationFrame(() => {
|
|
828
|
+
requestAnimationFrame(() => {
|
|
829
|
+
el.style.transform = "translateX(-8px)";
|
|
830
|
+
setTimeout(() => {
|
|
831
|
+
el.style.transform = "translateX(8px)";
|
|
832
|
+
setTimeout(() => {
|
|
833
|
+
el.style.transform = "translateX(-8px)";
|
|
834
|
+
setTimeout(() => {
|
|
835
|
+
el.style.transform = "translateX(8px)";
|
|
836
|
+
setTimeout(() => {
|
|
837
|
+
el.style.transform = "translateX(0)";
|
|
838
|
+
el.style.transition = "";
|
|
839
|
+
}, duration / 4);
|
|
840
|
+
}, duration / 4);
|
|
841
|
+
}, duration / 4);
|
|
842
|
+
}, duration / 4);
|
|
843
|
+
}, duration / 4);
|
|
844
|
+
});
|
|
845
|
+
} else if (name === "scale") {
|
|
846
|
+
el.style.transform = "scale(0.5)";
|
|
847
|
+
el.style.opacity = "0";
|
|
848
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
849
|
+
requestAnimationFrame(() => {
|
|
850
|
+
requestAnimationFrame(() => {
|
|
851
|
+
el.style.transform = "";
|
|
852
|
+
el.style.opacity = "1";
|
|
853
|
+
});
|
|
854
|
+
});
|
|
855
|
+
created.push(() => {
|
|
856
|
+
el.style.transform = "scale(0.5)";
|
|
857
|
+
el.style.opacity = "0";
|
|
858
|
+
setTimeout(() => {
|
|
859
|
+
el.style.transform = "";
|
|
860
|
+
el.style.opacity = "";
|
|
861
|
+
el.style.transition = "";
|
|
862
|
+
}, duration);
|
|
863
|
+
});
|
|
864
|
+
} else if (name === "rotate") {
|
|
865
|
+
el.style.transform = "rotate(-180deg)";
|
|
866
|
+
el.style.opacity = "0";
|
|
867
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
868
|
+
requestAnimationFrame(() => {
|
|
869
|
+
requestAnimationFrame(() => {
|
|
870
|
+
el.style.transform = "";
|
|
871
|
+
el.style.opacity = "1";
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
created.push(() => {
|
|
875
|
+
el.style.transform = "rotate(-180deg)";
|
|
876
|
+
el.style.opacity = "0";
|
|
877
|
+
setTimeout(() => {
|
|
878
|
+
el.style.transform = "";
|
|
879
|
+
el.style.opacity = "";
|
|
880
|
+
el.style.transition = "";
|
|
881
|
+
}, duration);
|
|
882
|
+
});
|
|
883
|
+
} else if (name === "fade-in") {
|
|
884
|
+
el.style.opacity = "0";
|
|
885
|
+
el.style.transition = `opacity ${duration}ms ease`;
|
|
886
|
+
requestAnimationFrame(() => {
|
|
887
|
+
requestAnimationFrame(() => {
|
|
888
|
+
el.style.opacity = "1";
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
created.push(() => {
|
|
892
|
+
el.style.opacity = "0";
|
|
893
|
+
setTimeout(() => {
|
|
894
|
+
el.style.opacity = "";
|
|
895
|
+
el.style.transition = "";
|
|
896
|
+
}, duration);
|
|
897
|
+
});
|
|
898
|
+
} else if (name === "fade-out") {
|
|
899
|
+
el.style.opacity = "1";
|
|
900
|
+
el.style.transition = `opacity ${duration}ms ease`;
|
|
901
|
+
requestAnimationFrame(() => {
|
|
902
|
+
requestAnimationFrame(() => {
|
|
903
|
+
el.style.opacity = "0";
|
|
904
|
+
});
|
|
905
|
+
});
|
|
906
|
+
created.push(() => {
|
|
907
|
+
el.style.opacity = "1";
|
|
908
|
+
setTimeout(() => {
|
|
909
|
+
el.style.opacity = "";
|
|
910
|
+
el.style.transition = "";
|
|
911
|
+
}, duration);
|
|
912
|
+
});
|
|
913
|
+
} else if (name === "stagger") {
|
|
914
|
+
const parent = el.parentElement;
|
|
915
|
+
if (parent) {
|
|
916
|
+
const siblings = Array.from(parent.children);
|
|
917
|
+
const index = siblings.indexOf(el);
|
|
918
|
+
const delay = index * (duration / 10);
|
|
919
|
+
el.style.opacity = "0";
|
|
920
|
+
el.style.transform = "translateY(10px)";
|
|
921
|
+
el.style.transition = `opacity ${duration}ms ease ${delay}ms, transform ${duration}ms ease ${delay}ms`;
|
|
922
|
+
requestAnimationFrame(() => {
|
|
923
|
+
requestAnimationFrame(() => {
|
|
924
|
+
el.style.opacity = "1";
|
|
925
|
+
el.style.transform = "";
|
|
926
|
+
});
|
|
927
|
+
});
|
|
928
|
+
created.push(() => {
|
|
929
|
+
el.style.opacity = "0";
|
|
930
|
+
el.style.transform = "translateY(10px)";
|
|
931
|
+
setTimeout(() => {
|
|
932
|
+
el.style.opacity = "";
|
|
933
|
+
el.style.transform = "";
|
|
934
|
+
el.style.transition = "";
|
|
935
|
+
}, duration + delay);
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
} else if (name === "zoom-in") {
|
|
939
|
+
el.style.transform = "scale(0)";
|
|
940
|
+
el.style.opacity = "0";
|
|
941
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
942
|
+
requestAnimationFrame(() => {
|
|
943
|
+
requestAnimationFrame(() => {
|
|
944
|
+
el.style.transform = "";
|
|
945
|
+
el.style.opacity = "1";
|
|
946
|
+
});
|
|
947
|
+
});
|
|
948
|
+
created.push(() => {
|
|
949
|
+
el.style.transform = "scale(0)";
|
|
950
|
+
el.style.opacity = "0";
|
|
951
|
+
setTimeout(() => {
|
|
952
|
+
el.style.transform = "";
|
|
953
|
+
el.style.opacity = "";
|
|
954
|
+
el.style.transition = "";
|
|
955
|
+
}, duration);
|
|
956
|
+
});
|
|
957
|
+
} else if (name === "zoom-out") {
|
|
958
|
+
el.style.transform = "scale(1)";
|
|
959
|
+
el.style.opacity = "1";
|
|
960
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
961
|
+
requestAnimationFrame(() => {
|
|
962
|
+
requestAnimationFrame(() => {
|
|
963
|
+
el.style.transform = "scale(0)";
|
|
964
|
+
el.style.opacity = "0";
|
|
965
|
+
});
|
|
966
|
+
});
|
|
967
|
+
created.push(() => {
|
|
968
|
+
el.style.transform = "scale(1)";
|
|
969
|
+
el.style.opacity = "1";
|
|
970
|
+
setTimeout(() => {
|
|
971
|
+
el.style.transform = "";
|
|
972
|
+
el.style.opacity = "";
|
|
973
|
+
el.style.transition = "";
|
|
974
|
+
}, duration);
|
|
975
|
+
});
|
|
976
|
+
} else if (name === "slide-up-fade") {
|
|
977
|
+
el.style.transform = "translateY(30px)";
|
|
978
|
+
el.style.opacity = "0";
|
|
979
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
980
|
+
requestAnimationFrame(() => {
|
|
981
|
+
requestAnimationFrame(() => {
|
|
982
|
+
el.style.transform = "";
|
|
983
|
+
el.style.opacity = "1";
|
|
984
|
+
});
|
|
985
|
+
});
|
|
986
|
+
created.push(() => {
|
|
987
|
+
el.style.transform = "translateY(30px)";
|
|
988
|
+
el.style.opacity = "0";
|
|
989
|
+
setTimeout(() => {
|
|
990
|
+
el.style.transform = "";
|
|
991
|
+
el.style.opacity = "";
|
|
992
|
+
el.style.transition = "";
|
|
993
|
+
}, duration);
|
|
994
|
+
});
|
|
995
|
+
} else if (name === "slide-down-fade") {
|
|
996
|
+
el.style.transform = "translateY(-30px)";
|
|
997
|
+
el.style.opacity = "0";
|
|
998
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
999
|
+
requestAnimationFrame(() => {
|
|
1000
|
+
requestAnimationFrame(() => {
|
|
1001
|
+
el.style.transform = "";
|
|
1002
|
+
el.style.opacity = "1";
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
created.push(() => {
|
|
1006
|
+
el.style.transform = "translateY(-30px)";
|
|
1007
|
+
el.style.opacity = "0";
|
|
1008
|
+
setTimeout(() => {
|
|
1009
|
+
el.style.transform = "";
|
|
1010
|
+
el.style.opacity = "";
|
|
1011
|
+
el.style.transition = "";
|
|
1012
|
+
}, duration);
|
|
1013
|
+
});
|
|
1014
|
+
} else if (name === "flip-x") {
|
|
1015
|
+
el.style.transform = "rotateX(90deg)";
|
|
1016
|
+
el.style.opacity = "0";
|
|
1017
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
1018
|
+
requestAnimationFrame(() => {
|
|
1019
|
+
requestAnimationFrame(() => {
|
|
1020
|
+
el.style.transform = "";
|
|
1021
|
+
el.style.opacity = "1";
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
created.push(() => {
|
|
1025
|
+
el.style.transform = "rotateX(90deg)";
|
|
1026
|
+
el.style.opacity = "0";
|
|
1027
|
+
setTimeout(() => {
|
|
1028
|
+
el.style.transform = "";
|
|
1029
|
+
el.style.opacity = "";
|
|
1030
|
+
el.style.transition = "";
|
|
1031
|
+
}, duration);
|
|
1032
|
+
});
|
|
1033
|
+
} else if (name === "flip-y") {
|
|
1034
|
+
el.style.transform = "rotateY(90deg)";
|
|
1035
|
+
el.style.opacity = "0";
|
|
1036
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
1037
|
+
requestAnimationFrame(() => {
|
|
1038
|
+
requestAnimationFrame(() => {
|
|
1039
|
+
el.style.transform = "";
|
|
1040
|
+
el.style.opacity = "1";
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
1043
|
+
created.push(() => {
|
|
1044
|
+
el.style.transform = "rotateY(90deg)";
|
|
1045
|
+
el.style.opacity = "0";
|
|
1046
|
+
setTimeout(() => {
|
|
1047
|
+
el.style.transform = "";
|
|
1048
|
+
el.style.opacity = "";
|
|
1049
|
+
el.style.transition = "";
|
|
1050
|
+
}, duration);
|
|
1051
|
+
});
|
|
1052
|
+
} else if (name === "spin") {
|
|
1053
|
+
el.style.transform = "rotate(-360deg)";
|
|
1054
|
+
el.style.opacity = "0";
|
|
1055
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
1056
|
+
requestAnimationFrame(() => {
|
|
1057
|
+
requestAnimationFrame(() => {
|
|
1058
|
+
el.style.transform = "";
|
|
1059
|
+
el.style.opacity = "1";
|
|
1060
|
+
});
|
|
1061
|
+
});
|
|
1062
|
+
created.push(() => {
|
|
1063
|
+
el.style.transform = "rotate(-360deg)";
|
|
1064
|
+
el.style.opacity = "0";
|
|
1065
|
+
setTimeout(() => {
|
|
1066
|
+
el.style.transform = "";
|
|
1067
|
+
el.style.opacity = "";
|
|
1068
|
+
el.style.transition = "";
|
|
1069
|
+
}, duration);
|
|
1070
|
+
});
|
|
1071
|
+
} else if (name === "pop") {
|
|
1072
|
+
el.style.transform = "scale(0.3)";
|
|
1073
|
+
el.style.opacity = "0";
|
|
1074
|
+
el.style.transition = `transform ${duration}ms ease, opacity ${duration}ms ease`;
|
|
1075
|
+
requestAnimationFrame(() => {
|
|
1076
|
+
requestAnimationFrame(() => {
|
|
1077
|
+
el.style.transform = "scale(1.1)";
|
|
1078
|
+
setTimeout(() => {
|
|
1079
|
+
el.style.transform = "";
|
|
1080
|
+
}, duration / 3);
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
created.push(() => {
|
|
1084
|
+
el.style.transform = "scale(0.3)";
|
|
1085
|
+
el.style.opacity = "0";
|
|
1086
|
+
setTimeout(() => {
|
|
1087
|
+
el.style.transform = "";
|
|
1088
|
+
el.style.opacity = "";
|
|
1089
|
+
el.style.transition = "";
|
|
1090
|
+
}, duration);
|
|
1091
|
+
});
|
|
1092
|
+
} else if (name === "blink") {
|
|
1093
|
+
el.style.opacity = "0";
|
|
1094
|
+
el.style.transition = `opacity ${duration}ms ease`;
|
|
1095
|
+
requestAnimationFrame(() => {
|
|
1096
|
+
requestAnimationFrame(() => {
|
|
1097
|
+
el.style.opacity = "1";
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
created.push(() => {
|
|
1101
|
+
el.style.opacity = "0";
|
|
1102
|
+
setTimeout(() => {
|
|
1103
|
+
el.style.opacity = "";
|
|
1104
|
+
el.style.transition = "";
|
|
1105
|
+
}, duration);
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
504
1111
|
const DELEGATED_SET = /* @__PURE__ */ new Set(["click", "input", "change", "submit"]);
|
|
505
1112
|
const evRoot = holder;
|
|
506
1113
|
const evTargets = [evRoot, ...Array.from(evRoot.querySelectorAll("*"))];
|
|
@@ -530,7 +1137,7 @@ function wire(root, closes, scope) {
|
|
|
530
1137
|
const h = handlers[spec];
|
|
531
1138
|
if (h) h(e);
|
|
532
1139
|
};
|
|
533
|
-
target.addEventListener(ev, listener);
|
|
1140
|
+
target.addEventListener(ev, listener, ev === "scroll" ? { passive: true } : void 0);
|
|
534
1141
|
created.push(() => {
|
|
535
1142
|
target.removeEventListener(ev, listener);
|
|
536
1143
|
const s = directBound.get(el);
|
|
@@ -549,20 +1156,34 @@ function resetEffects() {
|
|
|
549
1156
|
pendingIslandObservers.forEach((io) => io.disconnect());
|
|
550
1157
|
pendingIslandObservers.clear();
|
|
551
1158
|
}
|
|
552
|
-
var dataCache = /* @__PURE__ */ new Map();
|
|
553
1159
|
function $data(fn) {
|
|
1160
|
+
const cache = renderMaps().data;
|
|
554
1161
|
const key = fn.toString();
|
|
555
|
-
let p =
|
|
1162
|
+
let p = cache.get(key);
|
|
556
1163
|
if (!p) {
|
|
557
1164
|
p = Promise.resolve(fn());
|
|
558
|
-
|
|
1165
|
+
cache.set(key, p);
|
|
559
1166
|
}
|
|
560
1167
|
return p;
|
|
561
1168
|
}
|
|
562
1169
|
function clearRequestState() {
|
|
563
1170
|
signalMap.clear();
|
|
564
|
-
|
|
1171
|
+
renderMaps().data.clear();
|
|
565
1172
|
pendingDeltas.clear();
|
|
1173
|
+
seededKeys = /* @__PURE__ */ new Set();
|
|
1174
|
+
}
|
|
1175
|
+
async function isolateRender(fn) {
|
|
1176
|
+
const savedSignals = signalMap;
|
|
1177
|
+
const savedSeeded = seededKeys;
|
|
1178
|
+
signalMap = /* @__PURE__ */ new Map();
|
|
1179
|
+
seededKeys = /* @__PURE__ */ new Set();
|
|
1180
|
+
renderMaps().data.clear();
|
|
1181
|
+
try {
|
|
1182
|
+
return await fn();
|
|
1183
|
+
} finally {
|
|
1184
|
+
signalMap = savedSignals;
|
|
1185
|
+
seededKeys = savedSeeded;
|
|
1186
|
+
}
|
|
566
1187
|
}
|
|
567
1188
|
var requestQuery = {};
|
|
568
1189
|
var prefetchOverride = null;
|
|
@@ -582,22 +1203,55 @@ function setPrefetchOverride(q) {
|
|
|
582
1203
|
prefetchOverride = q;
|
|
583
1204
|
}
|
|
584
1205
|
var requestContext = {};
|
|
1206
|
+
var contextStore = null;
|
|
1207
|
+
var RENDER_MAPS = Symbol("renderMaps");
|
|
1208
|
+
var fallbackRenderMaps = { data: /* @__PURE__ */ new Map(), signals: /* @__PURE__ */ new Map(), seeded: /* @__PURE__ */ new Set() };
|
|
1209
|
+
function renderMaps() {
|
|
1210
|
+
const scoped = contextStore?.getStore();
|
|
1211
|
+
if (!scoped) return fallbackRenderMaps;
|
|
1212
|
+
let m = scoped[RENDER_MAPS];
|
|
1213
|
+
if (!m) {
|
|
1214
|
+
m = { data: /* @__PURE__ */ new Map(), signals: /* @__PURE__ */ new Map(), seeded: /* @__PURE__ */ new Set() };
|
|
1215
|
+
scoped[RENDER_MAPS] = m;
|
|
1216
|
+
}
|
|
1217
|
+
return m;
|
|
1218
|
+
}
|
|
1219
|
+
function installContextStore(store) {
|
|
1220
|
+
contextStore = store;
|
|
1221
|
+
}
|
|
585
1222
|
function getContext() {
|
|
586
|
-
|
|
1223
|
+
const scoped = contextStore?.getStore();
|
|
1224
|
+
return scoped ?? requestContext;
|
|
587
1225
|
}
|
|
588
1226
|
function resetRequestContext() {
|
|
1227
|
+
if (contextStore) {
|
|
1228
|
+
const scoped = contextStore.getStore();
|
|
1229
|
+
if (scoped) {
|
|
1230
|
+
for (const k of Object.keys(scoped)) delete scoped[k];
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
589
1234
|
requestContext = {};
|
|
590
1235
|
}
|
|
1236
|
+
function runWithContext(fn) {
|
|
1237
|
+
if (contextStore) return contextStore.run({}, fn);
|
|
1238
|
+
const saved = requestContext;
|
|
1239
|
+
requestContext = {};
|
|
1240
|
+
try {
|
|
1241
|
+
return fn();
|
|
1242
|
+
} finally {
|
|
1243
|
+
requestContext = saved;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
591
1246
|
async function isolateStateAsync(fn) {
|
|
592
1247
|
const savedSignals = signalMap;
|
|
593
|
-
const savedData = dataCache;
|
|
594
1248
|
const savedDeltas = new Map(pendingDeltas);
|
|
595
1249
|
pendingDeltas.clear();
|
|
596
1250
|
const savedMounts = mountQueue.splice(0, mountQueue.length);
|
|
597
1251
|
const savedCleanups = new Set(cleanups);
|
|
598
1252
|
cleanups.clear();
|
|
599
1253
|
signalMap = /* @__PURE__ */ new Map();
|
|
600
|
-
|
|
1254
|
+
renderMaps().data.clear();
|
|
601
1255
|
try {
|
|
602
1256
|
const result = await fn();
|
|
603
1257
|
return {
|
|
@@ -608,7 +1262,6 @@ async function isolateStateAsync(fn) {
|
|
|
608
1262
|
};
|
|
609
1263
|
} finally {
|
|
610
1264
|
signalMap = savedSignals;
|
|
611
|
-
dataCache = savedData;
|
|
612
1265
|
pendingDeltas.clear();
|
|
613
1266
|
savedDeltas.forEach((d, k) => pendingDeltas.set(k, d));
|
|
614
1267
|
mountQueue.splice(0, 0, ...savedMounts);
|
|
@@ -630,6 +1283,7 @@ function resumeState(json) {
|
|
|
630
1283
|
const obj = JSON.parse(json);
|
|
631
1284
|
Object.entries(obj).forEach(([k, v]) => {
|
|
632
1285
|
entry(k, v).value = v;
|
|
1286
|
+
seededKeys.add(k);
|
|
633
1287
|
});
|
|
634
1288
|
} catch {
|
|
635
1289
|
}
|
|
@@ -789,10 +1443,17 @@ var ActionError = class extends Error {
|
|
|
789
1443
|
this.field = field;
|
|
790
1444
|
}
|
|
791
1445
|
};
|
|
1446
|
+
function $actionPending() {
|
|
1447
|
+
const entry2 = signalMap.get("actionPending");
|
|
1448
|
+
return entry2 ? entry2.value === true : false;
|
|
1449
|
+
}
|
|
792
1450
|
function $actionError() {
|
|
793
1451
|
const e = signalMap.get("actionError");
|
|
794
1452
|
if (!e) return null;
|
|
795
|
-
if (currentEffect)
|
|
1453
|
+
if (currentEffect) {
|
|
1454
|
+
e.subs.add(currentEffect);
|
|
1455
|
+
if (trackingDeps) trackingDeps.add(e);
|
|
1456
|
+
}
|
|
796
1457
|
return e.value ?? null;
|
|
797
1458
|
}
|
|
798
1459
|
function $actionErrorOrThrow() {
|
|
@@ -809,9 +1470,9 @@ var StateDelta = class {
|
|
|
809
1470
|
this.value = value;
|
|
810
1471
|
}
|
|
811
1472
|
};
|
|
812
|
-
var $append = (value) => new StateDelta("
|
|
813
|
-
var $prepend = (value) => new StateDelta("
|
|
814
|
-
var $merge = (value) => new StateDelta("
|
|
1473
|
+
var $append = (value) => new StateDelta("a", value);
|
|
1474
|
+
var $prepend = (value) => new StateDelta("p", value);
|
|
1475
|
+
var $merge = (value) => new StateDelta("m", value);
|
|
815
1476
|
var pendingDeltas = /* @__PURE__ */ new Map();
|
|
816
1477
|
function setStateDelta(key, delta) {
|
|
817
1478
|
pendingDeltas.set(key, delta);
|
|
@@ -825,12 +1486,12 @@ function applyStateDeltas() {
|
|
|
825
1486
|
}
|
|
826
1487
|
function applyStateDelta(key, delta) {
|
|
827
1488
|
const cur = signalMap.get(key)?.value;
|
|
828
|
-
if (delta.op === "
|
|
1489
|
+
if (delta.op === "m") {
|
|
829
1490
|
setState(key, { ...cur, ...delta.value });
|
|
830
1491
|
return;
|
|
831
1492
|
}
|
|
832
1493
|
const list = (v) => v == null ? [] : Array.isArray(v) ? v : [v];
|
|
833
|
-
const merged = delta.op === "
|
|
1494
|
+
const merged = delta.op === "a" ? [...list(cur), ...list(delta.value)] : [...list(delta.value), ...list(cur)];
|
|
834
1495
|
setState(key, merged);
|
|
835
1496
|
}
|
|
836
1497
|
function $cookies(request) {
|
|
@@ -890,11 +1551,13 @@ function reportVitals() {
|
|
|
890
1551
|
export {
|
|
891
1552
|
$actionError,
|
|
892
1553
|
$actionErrorOrThrow,
|
|
1554
|
+
$actionPending,
|
|
893
1555
|
$append,
|
|
894
1556
|
$boundaryError,
|
|
895
1557
|
$boundaryFallback,
|
|
896
1558
|
$cookies,
|
|
897
1559
|
$data,
|
|
1560
|
+
$effect,
|
|
898
1561
|
$merge,
|
|
899
1562
|
$prepend,
|
|
900
1563
|
$query,
|
|
@@ -912,6 +1575,7 @@ export {
|
|
|
912
1575
|
applyStateDeltas,
|
|
913
1576
|
applyStorePatch,
|
|
914
1577
|
attrMark,
|
|
1578
|
+
attrValueString,
|
|
915
1579
|
bestLocale,
|
|
916
1580
|
boolAttrMark,
|
|
917
1581
|
clearHead,
|
|
@@ -928,11 +1592,15 @@ export {
|
|
|
928
1592
|
hasState,
|
|
929
1593
|
headMark,
|
|
930
1594
|
ifMark,
|
|
1595
|
+
installContextStore,
|
|
931
1596
|
isLocale,
|
|
1597
|
+
isSeeded,
|
|
1598
|
+
isolateRender,
|
|
932
1599
|
isolateStateAsync,
|
|
933
1600
|
loadLocale,
|
|
934
1601
|
localeDir,
|
|
935
1602
|
localeList,
|
|
1603
|
+
markSeeded,
|
|
936
1604
|
notFound,
|
|
937
1605
|
onCleanup,
|
|
938
1606
|
onMount,
|
|
@@ -946,6 +1614,7 @@ export {
|
|
|
946
1614
|
resetRequestContext,
|
|
947
1615
|
restoreState,
|
|
948
1616
|
resumeState,
|
|
1617
|
+
runWithContext,
|
|
949
1618
|
serializeState,
|
|
950
1619
|
setActionDispatcher,
|
|
951
1620
|
setFxOwner,
|