round-core 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -3
- package/dist/cli.js +33 -5
- package/dist/index.d.ts +75 -44
- package/dist/index.js +123 -99
- package/dist/vite-plugin.js +28 -2
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
3
|
let reporter = null;
|
|
3
4
|
function setErrorReporter(fn) {
|
|
4
5
|
reporter = typeof fn === "function" ? fn : null;
|
|
5
6
|
}
|
|
7
|
+
__name(setErrorReporter, "setErrorReporter");
|
|
6
8
|
function reportErrorSafe(error, info) {
|
|
7
9
|
if (!reporter) return;
|
|
8
10
|
try {
|
|
@@ -10,10 +12,12 @@ function reportErrorSafe(error, info) {
|
|
|
10
12
|
} catch {
|
|
11
13
|
}
|
|
12
14
|
}
|
|
15
|
+
__name(reportErrorSafe, "reportErrorSafe");
|
|
13
16
|
const componentStack = [];
|
|
14
17
|
function getCurrentComponent() {
|
|
15
18
|
return componentStack[componentStack.length - 1];
|
|
16
19
|
}
|
|
20
|
+
__name(getCurrentComponent, "getCurrentComponent");
|
|
17
21
|
function runInLifecycle(componentInstance, fn) {
|
|
18
22
|
componentStack.push(componentInstance);
|
|
19
23
|
try {
|
|
@@ -22,6 +26,7 @@ function runInLifecycle(componentInstance, fn) {
|
|
|
22
26
|
componentStack.pop();
|
|
23
27
|
}
|
|
24
28
|
}
|
|
29
|
+
__name(runInLifecycle, "runInLifecycle");
|
|
25
30
|
function createComponentInstance() {
|
|
26
31
|
return {
|
|
27
32
|
mountHooks: [],
|
|
@@ -32,6 +37,7 @@ function createComponentInstance() {
|
|
|
32
37
|
mountTimerId: null
|
|
33
38
|
};
|
|
34
39
|
}
|
|
40
|
+
__name(createComponentInstance, "createComponentInstance");
|
|
35
41
|
function onMount(fn) {
|
|
36
42
|
const component = getCurrentComponent();
|
|
37
43
|
if (component) {
|
|
@@ -44,12 +50,14 @@ function onMount(fn) {
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
53
|
+
__name(onMount, "onMount");
|
|
47
54
|
function onUnmount(fn) {
|
|
48
55
|
const component = getCurrentComponent();
|
|
49
56
|
if (component) {
|
|
50
57
|
component.unmountHooks.push(fn);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
60
|
+
__name(onUnmount, "onUnmount");
|
|
53
61
|
const onCleanup = onUnmount;
|
|
54
62
|
function onUpdate(fn) {
|
|
55
63
|
const component = getCurrentComponent();
|
|
@@ -57,6 +65,7 @@ function onUpdate(fn) {
|
|
|
57
65
|
component.updateHooks.push(fn);
|
|
58
66
|
}
|
|
59
67
|
}
|
|
68
|
+
__name(onUpdate, "onUpdate");
|
|
60
69
|
function mountComponent(component) {
|
|
61
70
|
if (component.isMounted) return;
|
|
62
71
|
try {
|
|
@@ -78,6 +87,7 @@ function mountComponent(component) {
|
|
|
78
87
|
}
|
|
79
88
|
});
|
|
80
89
|
}
|
|
90
|
+
__name(mountComponent, "mountComponent");
|
|
81
91
|
function unmountComponent(component) {
|
|
82
92
|
if (!component.isMounted) return;
|
|
83
93
|
if (component.mountTimerId != null) {
|
|
@@ -96,6 +106,7 @@ function unmountComponent(component) {
|
|
|
96
106
|
}
|
|
97
107
|
});
|
|
98
108
|
}
|
|
109
|
+
__name(unmountComponent, "unmountComponent");
|
|
99
110
|
function triggerUpdate(component) {
|
|
100
111
|
if (!component.isMounted) return;
|
|
101
112
|
component.updateHooks.forEach((hook) => {
|
|
@@ -106,6 +117,7 @@ function triggerUpdate(component) {
|
|
|
106
117
|
}
|
|
107
118
|
});
|
|
108
119
|
}
|
|
120
|
+
__name(triggerUpdate, "triggerUpdate");
|
|
109
121
|
const observer = typeof MutationObserver !== "undefined" ? new MutationObserver((mutations) => {
|
|
110
122
|
mutations.forEach((mutation) => {
|
|
111
123
|
if (mutation.removedNodes.length > 0) {
|
|
@@ -124,11 +136,13 @@ function cleanupNodeRecursively(node) {
|
|
|
124
136
|
}
|
|
125
137
|
node.childNodes.forEach(cleanupNodeRecursively);
|
|
126
138
|
}
|
|
139
|
+
__name(cleanupNodeRecursively, "cleanupNodeRecursively");
|
|
127
140
|
function initLifecycleRoot(rootNode) {
|
|
128
141
|
if (!rootNode) return;
|
|
129
142
|
if (!observer) return;
|
|
130
143
|
observer.observe(rootNode, { childList: true, subtree: true });
|
|
131
144
|
}
|
|
145
|
+
__name(initLifecycleRoot, "initLifecycleRoot");
|
|
132
146
|
const Lifecycle = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
133
147
|
__proto__: null,
|
|
134
148
|
createComponentInstance,
|
|
@@ -150,9 +164,11 @@ let globalVersion = 0;
|
|
|
150
164
|
function isPromiseLike$2(v) {
|
|
151
165
|
return v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
|
|
152
166
|
}
|
|
167
|
+
__name(isPromiseLike$2, "isPromiseLike$2");
|
|
153
168
|
function isSignalLike(v) {
|
|
154
169
|
return typeof v === "function" && typeof v.peek === "function" && "value" in v;
|
|
155
170
|
}
|
|
171
|
+
__name(isSignalLike, "isSignalLike");
|
|
156
172
|
function untrack(fn) {
|
|
157
173
|
const prev = context;
|
|
158
174
|
context = null;
|
|
@@ -162,6 +178,7 @@ function untrack(fn) {
|
|
|
162
178
|
context = prev;
|
|
163
179
|
}
|
|
164
180
|
}
|
|
181
|
+
__name(untrack, "untrack");
|
|
165
182
|
function batch(fn) {
|
|
166
183
|
batchCount++;
|
|
167
184
|
try {
|
|
@@ -177,6 +194,7 @@ function batch(fn) {
|
|
|
177
194
|
}
|
|
178
195
|
}
|
|
179
196
|
}
|
|
197
|
+
__name(batch, "batch");
|
|
180
198
|
function subscribe(sub, dep) {
|
|
181
199
|
let link = sub.deps;
|
|
182
200
|
while (link) {
|
|
@@ -196,6 +214,7 @@ function subscribe(sub, dep) {
|
|
|
196
214
|
if (sub.deps) sub.deps.prevDep = link;
|
|
197
215
|
sub.deps = link;
|
|
198
216
|
}
|
|
217
|
+
__name(subscribe, "subscribe");
|
|
199
218
|
function cleanup(sub) {
|
|
200
219
|
let link = sub.deps;
|
|
201
220
|
while (link) {
|
|
@@ -207,6 +226,7 @@ function cleanup(sub) {
|
|
|
207
226
|
}
|
|
208
227
|
sub.deps = null;
|
|
209
228
|
}
|
|
229
|
+
__name(cleanup, "cleanup");
|
|
210
230
|
function notify(dep) {
|
|
211
231
|
let link = dep.subs;
|
|
212
232
|
while (link) {
|
|
@@ -227,6 +247,7 @@ function notify(dep) {
|
|
|
227
247
|
link = link.nextSub;
|
|
228
248
|
}
|
|
229
249
|
}
|
|
250
|
+
__name(notify, "notify");
|
|
230
251
|
function effect(arg1, arg2, arg3) {
|
|
231
252
|
let callback, explicitDeps = null, options = { onLoad: true };
|
|
232
253
|
let owner = getCurrentComponent();
|
|
@@ -276,7 +297,7 @@ function effect(arg1, arg2, arg3) {
|
|
|
276
297
|
},
|
|
277
298
|
_cleanup: null
|
|
278
299
|
};
|
|
279
|
-
const dispose = () => {
|
|
300
|
+
const dispose = /* @__PURE__ */ __name(() => {
|
|
280
301
|
if (sub._cleanup) {
|
|
281
302
|
try {
|
|
282
303
|
sub._cleanup();
|
|
@@ -285,7 +306,7 @@ function effect(arg1, arg2, arg3) {
|
|
|
285
306
|
sub._cleanup = null;
|
|
286
307
|
}
|
|
287
308
|
cleanup(sub);
|
|
288
|
-
};
|
|
309
|
+
}, "dispose");
|
|
289
310
|
if (options.onLoad) {
|
|
290
311
|
onMount(() => sub.run());
|
|
291
312
|
} else {
|
|
@@ -293,6 +314,7 @@ function effect(arg1, arg2, arg3) {
|
|
|
293
314
|
}
|
|
294
315
|
return dispose;
|
|
295
316
|
}
|
|
317
|
+
__name(effect, "effect");
|
|
296
318
|
function defineBindMarkerIfNeeded(source, target) {
|
|
297
319
|
if (source && source.bind === true) {
|
|
298
320
|
try {
|
|
@@ -302,6 +324,7 @@ function defineBindMarkerIfNeeded(source, target) {
|
|
|
302
324
|
}
|
|
303
325
|
}
|
|
304
326
|
}
|
|
327
|
+
__name(defineBindMarkerIfNeeded, "defineBindMarkerIfNeeded");
|
|
305
328
|
function attachHelpers(s) {
|
|
306
329
|
if (!s || typeof s !== "function") return s;
|
|
307
330
|
if (typeof s.transform === "function" && typeof s.validate === "function" && typeof s.$pick === "function") return s;
|
|
@@ -309,10 +332,10 @@ function attachHelpers(s) {
|
|
|
309
332
|
s.transform = (fromInput, toOutput) => {
|
|
310
333
|
const fromFn = typeof fromInput === "function" ? fromInput : (v) => v;
|
|
311
334
|
const toFn = typeof toOutput === "function" ? toOutput : (v) => v;
|
|
312
|
-
const wrapped = function(...args) {
|
|
335
|
+
const wrapped = /* @__PURE__ */ __name(function(...args) {
|
|
313
336
|
if (args.length > 0) return s(fromFn(args[0]));
|
|
314
337
|
return toFn(s());
|
|
315
|
-
};
|
|
338
|
+
}, "wrapped");
|
|
316
339
|
wrapped.peek = () => toFn(s.peek());
|
|
317
340
|
Object.defineProperty(wrapped, "value", {
|
|
318
341
|
enumerable: true,
|
|
@@ -332,7 +355,7 @@ function attachHelpers(s) {
|
|
|
332
355
|
const error = signal(null);
|
|
333
356
|
const validateOn = options?.validateOn || "input";
|
|
334
357
|
const validateInitial = !!options?.validateInitial;
|
|
335
|
-
const wrapped = function(...args) {
|
|
358
|
+
const wrapped = /* @__PURE__ */ __name(function(...args) {
|
|
336
359
|
if (args.length > 0) {
|
|
337
360
|
const next = args[0];
|
|
338
361
|
if (validateFn) {
|
|
@@ -353,7 +376,7 @@ function attachHelpers(s) {
|
|
|
353
376
|
return s(next);
|
|
354
377
|
}
|
|
355
378
|
return s();
|
|
356
|
-
};
|
|
379
|
+
}, "wrapped");
|
|
357
380
|
wrapped.check = () => {
|
|
358
381
|
if (!validateFn) {
|
|
359
382
|
error(null);
|
|
@@ -397,13 +420,14 @@ function attachHelpers(s) {
|
|
|
397
420
|
};
|
|
398
421
|
return s;
|
|
399
422
|
}
|
|
423
|
+
__name(attachHelpers, "attachHelpers");
|
|
400
424
|
function signal(initialValue) {
|
|
401
425
|
const dep = {
|
|
402
426
|
value: initialValue,
|
|
403
427
|
version: 0,
|
|
404
428
|
subs: null
|
|
405
429
|
};
|
|
406
|
-
const s = function(newValue) {
|
|
430
|
+
const s = /* @__PURE__ */ __name(function(newValue) {
|
|
407
431
|
if (arguments.length > 0) {
|
|
408
432
|
if (dep.value !== newValue) {
|
|
409
433
|
dep.value = newValue;
|
|
@@ -414,7 +438,7 @@ function signal(initialValue) {
|
|
|
414
438
|
}
|
|
415
439
|
if (context) subscribe(context, dep);
|
|
416
440
|
return dep.value;
|
|
417
|
-
};
|
|
441
|
+
}, "s");
|
|
418
442
|
s.peek = () => dep.value;
|
|
419
443
|
Object.defineProperty(s, "value", {
|
|
420
444
|
enumerable: true,
|
|
@@ -428,6 +452,7 @@ function signal(initialValue) {
|
|
|
428
452
|
});
|
|
429
453
|
return attachHelpers(s);
|
|
430
454
|
}
|
|
455
|
+
__name(signal, "signal");
|
|
431
456
|
function bindable(initialValue) {
|
|
432
457
|
const s = signal(initialValue);
|
|
433
458
|
try {
|
|
@@ -437,6 +462,7 @@ function bindable(initialValue) {
|
|
|
437
462
|
}
|
|
438
463
|
return attachHelpers(s);
|
|
439
464
|
}
|
|
465
|
+
__name(bindable, "bindable");
|
|
440
466
|
function getIn(obj, path) {
|
|
441
467
|
let cur = obj;
|
|
442
468
|
for (let i = 0; i < path.length; i++) {
|
|
@@ -445,6 +471,7 @@ function getIn(obj, path) {
|
|
|
445
471
|
}
|
|
446
472
|
return cur;
|
|
447
473
|
}
|
|
474
|
+
__name(getIn, "getIn");
|
|
448
475
|
function setIn(obj, path, value) {
|
|
449
476
|
if (!Array.isArray(path) || path.length === 0) return value;
|
|
450
477
|
const root = obj && typeof obj === "object" ? obj : {};
|
|
@@ -462,22 +489,24 @@ function setIn(obj, path, value) {
|
|
|
462
489
|
curOut[path[path.length - 1]] = value;
|
|
463
490
|
return out;
|
|
464
491
|
}
|
|
492
|
+
__name(setIn, "setIn");
|
|
465
493
|
function parsePath(path) {
|
|
466
494
|
if (Array.isArray(path)) return path.map((p) => String(p));
|
|
467
495
|
if (typeof path === "string") return path.split(".").filter(Boolean);
|
|
468
496
|
return [String(path)];
|
|
469
497
|
}
|
|
498
|
+
__name(parsePath, "parsePath");
|
|
470
499
|
function pick(root, path) {
|
|
471
500
|
if (!isSignalLike(root)) throw new Error("[round] pick() expects a signal.");
|
|
472
501
|
const pathArr = parsePath(path);
|
|
473
|
-
const view = function(...args) {
|
|
502
|
+
const view = /* @__PURE__ */ __name(function(...args) {
|
|
474
503
|
if (args.length > 0) {
|
|
475
504
|
const nextRoot = setIn(root.peek(), pathArr, args[0]);
|
|
476
505
|
return root(nextRoot);
|
|
477
506
|
}
|
|
478
507
|
const v = root();
|
|
479
508
|
return getIn(v, pathArr);
|
|
480
|
-
};
|
|
509
|
+
}, "view");
|
|
481
510
|
view.peek = () => getIn(root.peek(), pathArr);
|
|
482
511
|
Object.defineProperty(view, "value", {
|
|
483
512
|
enumerable: true,
|
|
@@ -498,6 +527,7 @@ function pick(root, path) {
|
|
|
498
527
|
}
|
|
499
528
|
return view;
|
|
500
529
|
}
|
|
530
|
+
__name(pick, "pick");
|
|
501
531
|
function createBindableObjectProxy(root, basePath) {
|
|
502
532
|
const cache = /* @__PURE__ */ new Map();
|
|
503
533
|
const handler = {
|
|
@@ -547,10 +577,10 @@ function createBindableObjectProxy(root, basePath) {
|
|
|
547
577
|
return v != null && Object.prototype.hasOwnProperty.call(v, prop);
|
|
548
578
|
}
|
|
549
579
|
};
|
|
550
|
-
const fn = function(...args) {
|
|
580
|
+
const fn = /* @__PURE__ */ __name(function(...args) {
|
|
551
581
|
if (args.length > 0) return basePath.length ? pick(root, basePath)(args[0]) : root(args[0]);
|
|
552
582
|
return basePath.length ? pick(root, basePath)() : root();
|
|
553
|
-
};
|
|
583
|
+
}, "fn");
|
|
554
584
|
fn.peek = () => basePath.length ? pick(root, basePath).peek() : root.peek();
|
|
555
585
|
Object.defineProperty(fn, "value", { enumerable: true, configurable: true, get() {
|
|
556
586
|
return fn.peek();
|
|
@@ -564,6 +594,7 @@ function createBindableObjectProxy(root, basePath) {
|
|
|
564
594
|
}
|
|
565
595
|
return new Proxy(fn, handler);
|
|
566
596
|
}
|
|
597
|
+
__name(createBindableObjectProxy, "createBindableObjectProxy");
|
|
567
598
|
bindable.object = function(initialObject = {}) {
|
|
568
599
|
const root = bindable(initialObject && typeof initialObject === "object" ? initialObject : {});
|
|
569
600
|
return createBindableObjectProxy(root, []);
|
|
@@ -590,11 +621,11 @@ function derive(fn) {
|
|
|
590
621
|
}
|
|
591
622
|
}
|
|
592
623
|
};
|
|
593
|
-
const s = function() {
|
|
624
|
+
const s = /* @__PURE__ */ __name(function() {
|
|
594
625
|
if (dep.version === -1 || dep.depsVersion < globalVersion) dep.run();
|
|
595
626
|
if (context) subscribe(context, dep);
|
|
596
627
|
return dep.value;
|
|
597
|
-
};
|
|
628
|
+
}, "s");
|
|
598
629
|
s.peek = () => {
|
|
599
630
|
if (dep.version === -1 || dep.depsVersion < globalVersion) dep.run();
|
|
600
631
|
return dep.value;
|
|
@@ -604,6 +635,7 @@ function derive(fn) {
|
|
|
604
635
|
} });
|
|
605
636
|
return attachHelpers(s);
|
|
606
637
|
}
|
|
638
|
+
__name(derive, "derive");
|
|
607
639
|
const Signals = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
608
640
|
__proto__: null,
|
|
609
641
|
batch,
|
|
@@ -619,9 +651,11 @@ const contextStack = [];
|
|
|
619
651
|
function pushContext(values) {
|
|
620
652
|
contextStack.push(values);
|
|
621
653
|
}
|
|
654
|
+
__name(pushContext, "pushContext");
|
|
622
655
|
function popContext() {
|
|
623
656
|
contextStack.pop();
|
|
624
657
|
}
|
|
658
|
+
__name(popContext, "popContext");
|
|
625
659
|
function readContext(ctx) {
|
|
626
660
|
for (let i = contextStack.length - 1; i >= 0; i--) {
|
|
627
661
|
const layer = contextStack[i];
|
|
@@ -631,6 +665,7 @@ function readContext(ctx) {
|
|
|
631
665
|
}
|
|
632
666
|
return ctx.defaultValue;
|
|
633
667
|
}
|
|
668
|
+
__name(readContext, "readContext");
|
|
634
669
|
function createContext(defaultValue) {
|
|
635
670
|
const ctx = {
|
|
636
671
|
id: nextContextId++,
|
|
@@ -654,9 +689,11 @@ function createContext(defaultValue) {
|
|
|
654
689
|
popContext();
|
|
655
690
|
}
|
|
656
691
|
}
|
|
692
|
+
__name(Provider, "Provider");
|
|
657
693
|
ctx.Provider = Provider;
|
|
658
694
|
return ctx;
|
|
659
695
|
}
|
|
696
|
+
__name(createContext, "createContext");
|
|
660
697
|
function bindContext(ctx) {
|
|
661
698
|
return () => {
|
|
662
699
|
const provided = readContext(ctx);
|
|
@@ -670,9 +707,11 @@ function bindContext(ctx) {
|
|
|
670
707
|
return provided;
|
|
671
708
|
};
|
|
672
709
|
}
|
|
710
|
+
__name(bindContext, "bindContext");
|
|
673
711
|
function captureContext() {
|
|
674
712
|
return contextStack.slice();
|
|
675
713
|
}
|
|
714
|
+
__name(captureContext, "captureContext");
|
|
676
715
|
function runInContext(snapshot, fn) {
|
|
677
716
|
const prev = contextStack.slice();
|
|
678
717
|
contextStack.length = 0;
|
|
@@ -684,6 +723,7 @@ function runInContext(snapshot, fn) {
|
|
|
684
723
|
contextStack.push(...prev);
|
|
685
724
|
}
|
|
686
725
|
}
|
|
726
|
+
__name(runInContext, "runInContext");
|
|
687
727
|
const Context = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
688
728
|
__proto__: null,
|
|
689
729
|
bindContext,
|
|
@@ -695,6 +735,7 @@ const Context = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
695
735
|
function isPromiseLike$1(v) {
|
|
696
736
|
return v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
|
|
697
737
|
}
|
|
738
|
+
__name(isPromiseLike$1, "isPromiseLike$1");
|
|
698
739
|
const SuspenseContext = createContext(null);
|
|
699
740
|
function lazy(loader) {
|
|
700
741
|
if (typeof loader !== "function") {
|
|
@@ -716,7 +757,8 @@ function lazy(loader) {
|
|
|
716
757
|
if (fns.length === 1) return fns[0];
|
|
717
758
|
return null;
|
|
718
759
|
}
|
|
719
|
-
|
|
760
|
+
__name(pickComponent, "pickComponent");
|
|
761
|
+
return /* @__PURE__ */ __name(function LazyComponent(props = {}) {
|
|
720
762
|
if (status === "resolved") {
|
|
721
763
|
return createElement(component, props);
|
|
722
764
|
}
|
|
@@ -744,15 +786,16 @@ function lazy(loader) {
|
|
|
744
786
|
}
|
|
745
787
|
}
|
|
746
788
|
throw promise;
|
|
747
|
-
};
|
|
789
|
+
}, "LazyComponent");
|
|
748
790
|
}
|
|
791
|
+
__name(lazy, "lazy");
|
|
749
792
|
function Suspense(props = {}) {
|
|
750
793
|
const tick = signal(0);
|
|
751
794
|
const pending = /* @__PURE__ */ new Set();
|
|
752
795
|
const waiting = /* @__PURE__ */ new Set();
|
|
753
796
|
const child = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
754
797
|
const childFn = typeof child === "function" ? child : () => child;
|
|
755
|
-
const register = (promise) => {
|
|
798
|
+
const register = /* @__PURE__ */ __name((promise) => {
|
|
756
799
|
if (!waiting.has(promise)) {
|
|
757
800
|
waiting.add(promise);
|
|
758
801
|
pending.add(promise);
|
|
@@ -769,7 +812,7 @@ function Suspense(props = {}) {
|
|
|
769
812
|
}
|
|
770
813
|
);
|
|
771
814
|
}
|
|
772
|
-
};
|
|
815
|
+
}, "register");
|
|
773
816
|
return createElement(SuspenseContext.Provider, {
|
|
774
817
|
value: { register }
|
|
775
818
|
}, () => {
|
|
@@ -793,6 +836,7 @@ function Suspense(props = {}) {
|
|
|
793
836
|
}
|
|
794
837
|
});
|
|
795
838
|
}
|
|
839
|
+
__name(Suspense, "Suspense");
|
|
796
840
|
const Suspense$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
797
841
|
__proto__: null,
|
|
798
842
|
Suspense,
|
|
@@ -803,6 +847,7 @@ const warnedSignals = /* @__PURE__ */ new Set();
|
|
|
803
847
|
function isPromiseLike(v) {
|
|
804
848
|
return v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
|
|
805
849
|
}
|
|
850
|
+
__name(isPromiseLike, "isPromiseLike");
|
|
806
851
|
function warnSignalDirectUsage(fn, kind) {
|
|
807
852
|
try {
|
|
808
853
|
if (typeof fn !== "function") return;
|
|
@@ -817,6 +862,7 @@ function warnSignalDirectUsage(fn, kind) {
|
|
|
817
862
|
} catch {
|
|
818
863
|
}
|
|
819
864
|
}
|
|
865
|
+
__name(warnSignalDirectUsage, "warnSignalDirectUsage");
|
|
820
866
|
function createElement(tag, props = {}, ...children) {
|
|
821
867
|
if (typeof tag === "function") {
|
|
822
868
|
const componentInstance = createComponentInstance();
|
|
@@ -905,7 +951,7 @@ function createElement(tag, props = {}, ...children) {
|
|
|
905
951
|
}
|
|
906
952
|
return;
|
|
907
953
|
}
|
|
908
|
-
const coerceFromDom = () => {
|
|
954
|
+
const coerceFromDom = /* @__PURE__ */ __name(() => {
|
|
909
955
|
if (isCheckedBinding) {
|
|
910
956
|
if (type === "radio") {
|
|
911
957
|
return Boolean(el.checked);
|
|
@@ -926,8 +972,8 @@ function createElement(tag, props = {}, ...children) {
|
|
|
926
972
|
}
|
|
927
973
|
}
|
|
928
974
|
return el.value;
|
|
929
|
-
};
|
|
930
|
-
const writeToDom = (v) => {
|
|
975
|
+
}, "coerceFromDom");
|
|
976
|
+
const writeToDom = /* @__PURE__ */ __name((v) => {
|
|
931
977
|
if (isCheckedBinding) {
|
|
932
978
|
const b = Boolean(v);
|
|
933
979
|
if (type === "radio") {
|
|
@@ -948,8 +994,8 @@ function createElement(tag, props = {}, ...children) {
|
|
|
948
994
|
return;
|
|
949
995
|
}
|
|
950
996
|
el.value = v ?? "";
|
|
951
|
-
};
|
|
952
|
-
const warnTypeMismatch = (next) => {
|
|
997
|
+
}, "writeToDom");
|
|
998
|
+
const warnTypeMismatch = /* @__PURE__ */ __name((next) => {
|
|
953
999
|
try {
|
|
954
1000
|
if (isCheckedBinding && typeof next !== "boolean") {
|
|
955
1001
|
console.warn("[round] bind:checked expects a boolean signal value.");
|
|
@@ -962,7 +1008,7 @@ function createElement(tag, props = {}, ...children) {
|
|
|
962
1008
|
}
|
|
963
1009
|
} catch {
|
|
964
1010
|
}
|
|
965
|
-
};
|
|
1011
|
+
}, "warnTypeMismatch");
|
|
966
1012
|
effect(() => {
|
|
967
1013
|
const v = value();
|
|
968
1014
|
warnTypeMismatch(v);
|
|
@@ -1048,6 +1094,7 @@ function createElement(tag, props = {}, ...children) {
|
|
|
1048
1094
|
children.forEach((child) => appendChild(element, child));
|
|
1049
1095
|
return element;
|
|
1050
1096
|
}
|
|
1097
|
+
__name(createElement, "createElement");
|
|
1051
1098
|
function appendChild(parent, child) {
|
|
1052
1099
|
if (child === null || child === void 0) return;
|
|
1053
1100
|
if (Array.isArray(child)) {
|
|
@@ -1124,9 +1171,11 @@ function appendChild(parent, child) {
|
|
|
1124
1171
|
return;
|
|
1125
1172
|
}
|
|
1126
1173
|
}
|
|
1174
|
+
__name(appendChild, "appendChild");
|
|
1127
1175
|
function Fragment(props) {
|
|
1128
1176
|
return props.children;
|
|
1129
1177
|
}
|
|
1178
|
+
__name(Fragment, "Fragment");
|
|
1130
1179
|
const DOM = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1131
1180
|
__proto__: null,
|
|
1132
1181
|
Fragment,
|
|
@@ -1151,12 +1200,15 @@ function ensureListener() {
|
|
|
1151
1200
|
currentPath(window.location.pathname);
|
|
1152
1201
|
});
|
|
1153
1202
|
}
|
|
1203
|
+
__name(ensureListener, "ensureListener");
|
|
1154
1204
|
function getPathname() {
|
|
1155
1205
|
return normalizePathname(currentPath());
|
|
1156
1206
|
}
|
|
1207
|
+
__name(getPathname, "getPathname");
|
|
1157
1208
|
function usePathname() {
|
|
1158
1209
|
return () => normalizePathname(currentPath());
|
|
1159
1210
|
}
|
|
1211
|
+
__name(usePathname, "usePathname");
|
|
1160
1212
|
function getLocation() {
|
|
1161
1213
|
if (!hasWindow$1) {
|
|
1162
1214
|
return { pathname: normalizePathname("/"), search: "", hash: "" };
|
|
@@ -1167,6 +1219,7 @@ function getLocation() {
|
|
|
1167
1219
|
hash: window.location.hash ?? ""
|
|
1168
1220
|
};
|
|
1169
1221
|
}
|
|
1222
|
+
__name(getLocation, "getLocation");
|
|
1170
1223
|
function useLocation() {
|
|
1171
1224
|
return () => {
|
|
1172
1225
|
const pathname = normalizePathname(currentPath());
|
|
@@ -1174,22 +1227,26 @@ function useLocation() {
|
|
|
1174
1227
|
return { pathname, search: window.location.search ?? "", hash: window.location.hash ?? "" };
|
|
1175
1228
|
};
|
|
1176
1229
|
}
|
|
1230
|
+
__name(useLocation, "useLocation");
|
|
1177
1231
|
function getRouteReady() {
|
|
1178
1232
|
const pathname = normalizePathname(currentPath());
|
|
1179
1233
|
return Boolean(pathEvalReady()) && lastPathEvaluated === pathname;
|
|
1180
1234
|
}
|
|
1235
|
+
__name(getRouteReady, "getRouteReady");
|
|
1181
1236
|
function useRouteReady() {
|
|
1182
1237
|
return () => {
|
|
1183
1238
|
const pathname = normalizePathname(currentPath());
|
|
1184
1239
|
return Boolean(pathEvalReady()) && lastPathEvaluated === pathname;
|
|
1185
1240
|
};
|
|
1186
1241
|
}
|
|
1242
|
+
__name(useRouteReady, "useRouteReady");
|
|
1187
1243
|
function getIsNotFound() {
|
|
1188
1244
|
const pathname = normalizePathname(currentPath());
|
|
1189
1245
|
if (pathname === "/") return false;
|
|
1190
1246
|
if (!(Boolean(pathEvalReady()) && lastPathEvaluated === pathname)) return false;
|
|
1191
1247
|
return !Boolean(pathHasMatch());
|
|
1192
1248
|
}
|
|
1249
|
+
__name(getIsNotFound, "getIsNotFound");
|
|
1193
1250
|
function useIsNotFound() {
|
|
1194
1251
|
return () => {
|
|
1195
1252
|
const pathname = normalizePathname(currentPath());
|
|
@@ -1198,6 +1255,7 @@ function useIsNotFound() {
|
|
|
1198
1255
|
return !Boolean(pathHasMatch());
|
|
1199
1256
|
};
|
|
1200
1257
|
}
|
|
1258
|
+
__name(useIsNotFound, "useIsNotFound");
|
|
1201
1259
|
function mountAutoNotFound() {
|
|
1202
1260
|
if (!hasWindow$1 || autoNotFoundMounted) return;
|
|
1203
1261
|
autoNotFoundMounted = true;
|
|
@@ -1227,6 +1285,7 @@ function mountAutoNotFound() {
|
|
|
1227
1285
|
});
|
|
1228
1286
|
root.appendChild(view);
|
|
1229
1287
|
}
|
|
1288
|
+
__name(mountAutoNotFound, "mountAutoNotFound");
|
|
1230
1289
|
function navigate(to, options = {}) {
|
|
1231
1290
|
if (!hasWindow$1) return;
|
|
1232
1291
|
ensureListener();
|
|
@@ -1236,6 +1295,7 @@ function navigate(to, options = {}) {
|
|
|
1236
1295
|
else window.history.pushState({}, "", normalizedTo);
|
|
1237
1296
|
currentPath(window.location.pathname);
|
|
1238
1297
|
}
|
|
1298
|
+
__name(navigate, "navigate");
|
|
1239
1299
|
function applyHead({ title, meta, links, icon, favicon }) {
|
|
1240
1300
|
if (!hasWindow$1) return;
|
|
1241
1301
|
if (typeof title === "string") {
|
|
@@ -1292,9 +1352,11 @@ function applyHead({ title, meta, links, icon, favicon }) {
|
|
|
1292
1352
|
});
|
|
1293
1353
|
}
|
|
1294
1354
|
}
|
|
1355
|
+
__name(applyHead, "applyHead");
|
|
1295
1356
|
function startHead(_head) {
|
|
1296
1357
|
return _head;
|
|
1297
1358
|
}
|
|
1359
|
+
__name(startHead, "startHead");
|
|
1298
1360
|
function splitUrl(url) {
|
|
1299
1361
|
const str = String(url ?? "");
|
|
1300
1362
|
const hashIdx = str.indexOf("#");
|
|
@@ -1303,6 +1365,7 @@ function splitUrl(url) {
|
|
|
1303
1365
|
if (cutIdx === -1) return { path: str, suffix: "" };
|
|
1304
1366
|
return { path: str.slice(0, cutIdx), suffix: str.slice(cutIdx) };
|
|
1305
1367
|
}
|
|
1368
|
+
__name(splitUrl, "splitUrl");
|
|
1306
1369
|
function normalizePathname(p) {
|
|
1307
1370
|
let pathname = String(p ?? "/");
|
|
1308
1371
|
if (!pathname.startsWith("/")) pathname = "/" + pathname;
|
|
@@ -1315,17 +1378,20 @@ function normalizePathname(p) {
|
|
|
1315
1378
|
}
|
|
1316
1379
|
return pathname;
|
|
1317
1380
|
}
|
|
1381
|
+
__name(normalizePathname, "normalizePathname");
|
|
1318
1382
|
function normalizeTo(to) {
|
|
1319
1383
|
const { path, suffix } = splitUrl(to);
|
|
1320
1384
|
if (!path.startsWith("/")) return String(to ?? "");
|
|
1321
1385
|
return normalizePathname(path) + suffix;
|
|
1322
1386
|
}
|
|
1387
|
+
__name(normalizeTo, "normalizeTo");
|
|
1323
1388
|
function matchRoute(route, pathname, exact = true) {
|
|
1324
1389
|
const r = normalizePathname(route);
|
|
1325
1390
|
const p = normalizePathname(pathname);
|
|
1326
1391
|
if (exact) return r === p;
|
|
1327
1392
|
return p === r || p.startsWith(r.endsWith("/") ? r : r + "/");
|
|
1328
1393
|
}
|
|
1394
|
+
__name(matchRoute, "matchRoute");
|
|
1329
1395
|
function beginPathEvaluation(pathname) {
|
|
1330
1396
|
if (pathname !== lastPathEvaluated) {
|
|
1331
1397
|
lastPathEvaluated = pathname;
|
|
@@ -1337,9 +1403,11 @@ function beginPathEvaluation(pathname) {
|
|
|
1337
1403
|
}, 0);
|
|
1338
1404
|
}
|
|
1339
1405
|
}
|
|
1406
|
+
__name(beginPathEvaluation, "beginPathEvaluation");
|
|
1340
1407
|
function setNotFound(Component) {
|
|
1341
1408
|
defaultNotFoundComponent = Component;
|
|
1342
1409
|
}
|
|
1410
|
+
__name(setNotFound, "setNotFound");
|
|
1343
1411
|
function Route(props = {}) {
|
|
1344
1412
|
ensureListener();
|
|
1345
1413
|
return createElement("span", { style: { display: "contents" } }, () => {
|
|
@@ -1378,6 +1446,7 @@ function Route(props = {}) {
|
|
|
1378
1446
|
return createElement(RoutingContext.Provider, { value: fullRoute }, props.children);
|
|
1379
1447
|
});
|
|
1380
1448
|
}
|
|
1449
|
+
__name(Route, "Route");
|
|
1381
1450
|
function Page(props = {}) {
|
|
1382
1451
|
ensureListener();
|
|
1383
1452
|
return createElement("span", { style: { display: "contents" } }, () => {
|
|
@@ -1416,6 +1485,7 @@ function Page(props = {}) {
|
|
|
1416
1485
|
return createElement(RoutingContext.Provider, { value: fullRoute }, props.children);
|
|
1417
1486
|
});
|
|
1418
1487
|
}
|
|
1488
|
+
__name(Page, "Page");
|
|
1419
1489
|
function NotFound(props = {}) {
|
|
1420
1490
|
ensureListener();
|
|
1421
1491
|
userProvidedNotFound = true;
|
|
@@ -1441,13 +1511,14 @@ function NotFound(props = {}) {
|
|
|
1441
1511
|
);
|
|
1442
1512
|
});
|
|
1443
1513
|
}
|
|
1514
|
+
__name(NotFound, "NotFound");
|
|
1444
1515
|
function Link(props = {}) {
|
|
1445
1516
|
ensureListener();
|
|
1446
1517
|
const rawHref = props.href ?? props.to ?? "#";
|
|
1447
1518
|
const href = spaNormalizeHref(rawHref);
|
|
1448
1519
|
const spa = props.spa !== void 0 ? Boolean(props.spa) : true;
|
|
1449
1520
|
const reload = Boolean(props.reload);
|
|
1450
|
-
const onClick = (e) => {
|
|
1521
|
+
const onClick = /* @__PURE__ */ __name((e) => {
|
|
1451
1522
|
if (typeof props.onClick === "function") props.onClick(e);
|
|
1452
1523
|
if (e.defaultPrevented) return;
|
|
1453
1524
|
if (props.target === "_blank") return;
|
|
@@ -1458,16 +1529,18 @@ function Link(props = {}) {
|
|
|
1458
1529
|
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
1459
1530
|
e.preventDefault();
|
|
1460
1531
|
navigate(href);
|
|
1461
|
-
};
|
|
1532
|
+
}, "onClick");
|
|
1462
1533
|
const { children, to, ...rest } = props;
|
|
1463
1534
|
const normalizedChildren = Array.isArray(children) ? children : children === void 0 || children === null ? [] : [children];
|
|
1464
1535
|
return createElement("a", { ...rest, href, onClick }, ...normalizedChildren);
|
|
1465
1536
|
}
|
|
1537
|
+
__name(Link, "Link");
|
|
1466
1538
|
function spaNormalizeHref(href) {
|
|
1467
1539
|
const str = String(href ?? "#");
|
|
1468
1540
|
if (!str.startsWith("/")) return str;
|
|
1469
1541
|
return normalizeTo(str);
|
|
1470
1542
|
}
|
|
1543
|
+
__name(spaNormalizeHref, "spaNormalizeHref");
|
|
1471
1544
|
const Router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1472
1545
|
__proto__: null,
|
|
1473
1546
|
Link,
|
|
@@ -1486,65 +1559,6 @@ const Router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
1486
1559
|
usePathname,
|
|
1487
1560
|
useRouteReady
|
|
1488
1561
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1489
|
-
const mdLoaders = typeof import.meta !== "undefined" && typeof import.meta.glob === "function" ? /* @__PURE__ */ Object.assign({}) : {};
|
|
1490
|
-
function Markdown(props = {}) {
|
|
1491
|
-
const html = signal("");
|
|
1492
|
-
const parse = (md) => {
|
|
1493
|
-
try {
|
|
1494
|
-
return marked.parse(md ?? "");
|
|
1495
|
-
} catch {
|
|
1496
|
-
return "";
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
if (typeof props.content === "string") {
|
|
1500
|
-
html(parse(props.content));
|
|
1501
|
-
}
|
|
1502
|
-
onMount(async () => {
|
|
1503
|
-
if (typeof props.src !== "string") return;
|
|
1504
|
-
const base = typeof props.base === "string" ? props.base : "/src";
|
|
1505
|
-
const resolved = props.src.startsWith("./") ? base + props.src.slice(1) : props.src;
|
|
1506
|
-
const loader = mdLoaders[resolved];
|
|
1507
|
-
if (typeof loader === "function") {
|
|
1508
|
-
try {
|
|
1509
|
-
const text = await loader();
|
|
1510
|
-
html(parse(text ?? ""));
|
|
1511
|
-
return;
|
|
1512
|
-
} catch (e) {
|
|
1513
|
-
reportErrorSafe(e instanceof Error ? e : new Error(`Failed to load markdown: ${resolved}`), { phase: "markdown.load", component: "Markdown" });
|
|
1514
|
-
html("");
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
try {
|
|
1519
|
-
const r = await fetch(resolved);
|
|
1520
|
-
if (!r.ok) {
|
|
1521
|
-
reportErrorSafe(new Error(`Markdown not found: ${resolved} (HTTP ${r.status})`), { phase: "markdown.fetch", component: "Markdown" });
|
|
1522
|
-
html("");
|
|
1523
|
-
return;
|
|
1524
|
-
}
|
|
1525
|
-
const text = await r.text();
|
|
1526
|
-
const looksLikeHtml = /^\s*<!doctype\s+html\b|^\s*<html\b/i.test(text);
|
|
1527
|
-
if (looksLikeHtml) {
|
|
1528
|
-
reportErrorSafe(new Error(`Markdown not found (served HTML fallback): ${resolved}`), { phase: "markdown.fetch", component: "Markdown" });
|
|
1529
|
-
html("");
|
|
1530
|
-
return;
|
|
1531
|
-
}
|
|
1532
|
-
html(parse(text));
|
|
1533
|
-
} catch (e) {
|
|
1534
|
-
reportErrorSafe(e instanceof Error ? e : new Error(`Failed to fetch markdown: ${resolved}`), { phase: "markdown.fetch", component: "Markdown" });
|
|
1535
|
-
html("");
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1538
|
-
const className = props.className ?? props.theme ?? "";
|
|
1539
|
-
return createElement("div", {
|
|
1540
|
-
className,
|
|
1541
|
-
dangerouslySetInnerHTML: () => ({ __html: html() })
|
|
1542
|
-
});
|
|
1543
|
-
}
|
|
1544
|
-
const Markdown$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1545
|
-
__proto__: null,
|
|
1546
|
-
Markdown
|
|
1547
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1548
1562
|
const errors = signal([]);
|
|
1549
1563
|
let lastSentKey = null;
|
|
1550
1564
|
let lastSentAt = 0;
|
|
@@ -1596,12 +1610,15 @@ function reportError(error, info = {}) {
|
|
|
1596
1610
|
} catch {
|
|
1597
1611
|
}
|
|
1598
1612
|
}
|
|
1613
|
+
__name(reportError, "reportError");
|
|
1599
1614
|
function clearErrors() {
|
|
1600
1615
|
errors([]);
|
|
1601
1616
|
}
|
|
1617
|
+
__name(clearErrors, "clearErrors");
|
|
1602
1618
|
function useErrors() {
|
|
1603
1619
|
return errors;
|
|
1604
1620
|
}
|
|
1621
|
+
__name(useErrors, "useErrors");
|
|
1605
1622
|
setErrorReporter(reportError);
|
|
1606
1623
|
function ErrorProvider(props = {}) {
|
|
1607
1624
|
return createElement("span", { style: { display: "contents" } }, () => {
|
|
@@ -1670,19 +1687,19 @@ function ErrorProvider(props = {}) {
|
|
|
1670
1687
|
borderRadius: "10px",
|
|
1671
1688
|
cursor: "pointer"
|
|
1672
1689
|
},
|
|
1673
|
-
onMouseOver: (e) => {
|
|
1690
|
+
onMouseOver: /* @__PURE__ */ __name((e) => {
|
|
1674
1691
|
try {
|
|
1675
1692
|
e.currentTarget.style.background = "rgba(255,255,255,0.12)";
|
|
1676
1693
|
} catch {
|
|
1677
1694
|
}
|
|
1678
|
-
},
|
|
1679
|
-
onMouseOut: (e) => {
|
|
1695
|
+
}, "onMouseOver"),
|
|
1696
|
+
onMouseOut: /* @__PURE__ */ __name((e) => {
|
|
1680
1697
|
try {
|
|
1681
1698
|
e.currentTarget.style.background = "rgba(255,255,255,0.08)";
|
|
1682
1699
|
} catch {
|
|
1683
1700
|
}
|
|
1684
|
-
},
|
|
1685
|
-
onClick: () => clearErrors()
|
|
1701
|
+
}, "onMouseOut"),
|
|
1702
|
+
onClick: /* @__PURE__ */ __name(() => clearErrors(), "onClick")
|
|
1686
1703
|
}, "Dismiss")
|
|
1687
1704
|
),
|
|
1688
1705
|
createElement(
|
|
@@ -1719,6 +1736,7 @@ function ErrorProvider(props = {}) {
|
|
|
1719
1736
|
);
|
|
1720
1737
|
});
|
|
1721
1738
|
}
|
|
1739
|
+
__name(ErrorProvider, "ErrorProvider");
|
|
1722
1740
|
function initErrorHandling(container) {
|
|
1723
1741
|
if (typeof document === "undefined") return;
|
|
1724
1742
|
if (!container || !(container instanceof Element)) return;
|
|
@@ -1750,6 +1768,7 @@ function initErrorHandling(container) {
|
|
|
1750
1768
|
});
|
|
1751
1769
|
}
|
|
1752
1770
|
}
|
|
1771
|
+
__name(initErrorHandling, "initErrorHandling");
|
|
1753
1772
|
const Errors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1754
1773
|
__proto__: null,
|
|
1755
1774
|
ErrorProvider,
|
|
@@ -1791,9 +1810,11 @@ function ErrorBoundary(props = {}) {
|
|
|
1791
1810
|
}
|
|
1792
1811
|
});
|
|
1793
1812
|
}
|
|
1813
|
+
__name(ErrorBoundary, "ErrorBoundary");
|
|
1794
1814
|
function hasWindow() {
|
|
1795
1815
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
1796
1816
|
}
|
|
1817
|
+
__name(hasWindow, "hasWindow");
|
|
1797
1818
|
function createStore(initialState = {}, actions = null) {
|
|
1798
1819
|
const state = initialState && typeof initialState === "object" ? initialState : {};
|
|
1799
1820
|
const signals = /* @__PURE__ */ Object.create(null);
|
|
@@ -1820,12 +1841,14 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1820
1841
|
}
|
|
1821
1842
|
return v;
|
|
1822
1843
|
}
|
|
1844
|
+
__name(setKey, "setKey");
|
|
1823
1845
|
function patch(obj) {
|
|
1824
1846
|
if (!obj || typeof obj !== "object") return;
|
|
1825
1847
|
for (const [k, v] of Object.entries(obj)) {
|
|
1826
1848
|
setKey(k, v);
|
|
1827
1849
|
}
|
|
1828
1850
|
}
|
|
1851
|
+
__name(patch, "patch");
|
|
1829
1852
|
function getSnapshot(reactive = false) {
|
|
1830
1853
|
const out = {};
|
|
1831
1854
|
for (const k of Object.keys(signals)) {
|
|
@@ -1833,6 +1856,7 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1833
1856
|
}
|
|
1834
1857
|
return out;
|
|
1835
1858
|
}
|
|
1859
|
+
__name(getSnapshot, "getSnapshot");
|
|
1836
1860
|
const store = {
|
|
1837
1861
|
use(key) {
|
|
1838
1862
|
const k = String(key);
|
|
@@ -1871,7 +1895,7 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1871
1895
|
if (actions && typeof actions === "object") {
|
|
1872
1896
|
Object.entries(actions).forEach(([name, reducer]) => {
|
|
1873
1897
|
if (typeof reducer !== "function") return;
|
|
1874
|
-
const fn = (...args) => {
|
|
1898
|
+
const fn = /* @__PURE__ */ __name((...args) => {
|
|
1875
1899
|
try {
|
|
1876
1900
|
const next = reducer(getSnapshot(false), ...args);
|
|
1877
1901
|
if (next && typeof next === "object") {
|
|
@@ -1881,7 +1905,7 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1881
1905
|
} catch (e) {
|
|
1882
1906
|
reportErrorSafe(e, { phase: "store.action", component: String(name) });
|
|
1883
1907
|
}
|
|
1884
|
-
};
|
|
1908
|
+
}, "fn");
|
|
1885
1909
|
store.actions[name] = fn;
|
|
1886
1910
|
store[name] = fn;
|
|
1887
1911
|
});
|
|
@@ -1905,7 +1929,7 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1905
1929
|
}
|
|
1906
1930
|
} catch {
|
|
1907
1931
|
}
|
|
1908
|
-
const persistNow = () => {
|
|
1932
|
+
const persistNow = /* @__PURE__ */ __name(() => {
|
|
1909
1933
|
try {
|
|
1910
1934
|
persistState.persisting = true;
|
|
1911
1935
|
const snap = getSnapshot(false);
|
|
@@ -1915,9 +1939,9 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1915
1939
|
} finally {
|
|
1916
1940
|
persistState.persisting = false;
|
|
1917
1941
|
}
|
|
1918
|
-
};
|
|
1942
|
+
}, "persistNow");
|
|
1919
1943
|
let debounceId = null;
|
|
1920
|
-
const schedulePersist = () => {
|
|
1944
|
+
const schedulePersist = /* @__PURE__ */ __name(() => {
|
|
1921
1945
|
if (debounceMs <= 0) return persistNow();
|
|
1922
1946
|
try {
|
|
1923
1947
|
if (debounceId != null) clearTimeout(debounceId);
|
|
@@ -1927,7 +1951,7 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1927
1951
|
debounceId = null;
|
|
1928
1952
|
persistNow();
|
|
1929
1953
|
}, debounceMs);
|
|
1930
|
-
};
|
|
1954
|
+
}, "schedulePersist");
|
|
1931
1955
|
persistState.enabled = true;
|
|
1932
1956
|
persistState.key = storageKey;
|
|
1933
1957
|
persistState.storage = st;
|
|
@@ -1964,6 +1988,7 @@ function createStore(initialState = {}, actions = null) {
|
|
|
1964
1988
|
};
|
|
1965
1989
|
return store;
|
|
1966
1990
|
}
|
|
1991
|
+
__name(createStore, "createStore");
|
|
1967
1992
|
const Store = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1968
1993
|
__proto__: null,
|
|
1969
1994
|
createStore
|
|
@@ -1978,12 +2003,12 @@ function render(Component, container) {
|
|
|
1978
2003
|
reportError(e, { phase: "render", component: Component?.name ?? "App" });
|
|
1979
2004
|
}
|
|
1980
2005
|
}
|
|
2006
|
+
__name(render, "render");
|
|
1981
2007
|
const index = {
|
|
1982
2008
|
...Signals,
|
|
1983
2009
|
...DOM,
|
|
1984
2010
|
...Lifecycle,
|
|
1985
2011
|
...Router,
|
|
1986
|
-
...Markdown$1,
|
|
1987
2012
|
...Errors,
|
|
1988
2013
|
...Suspense$1,
|
|
1989
2014
|
...Context,
|
|
@@ -1995,7 +2020,6 @@ export {
|
|
|
1995
2020
|
ErrorProvider,
|
|
1996
2021
|
Fragment,
|
|
1997
2022
|
Link,
|
|
1998
|
-
Markdown,
|
|
1999
2023
|
NotFound,
|
|
2000
2024
|
Page,
|
|
2001
2025
|
Route,
|