@manyducks.co/dolla 3.2.0 → 4.0.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/core/context.d.ts +9 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/root.d.ts +4 -6
- package/dist/core/signals.d.ts +34 -1
- package/dist/{core-2CFW0uRa.js → core-CHBZF6Mb.js} +113 -101
- package/dist/core-CHBZF6Mb.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/router.d.ts +1 -1
- package/dist/router.js +139 -139
- package/dist/router.js.map +1 -1
- package/dist/translate/index.d.ts +1 -1
- package/dist/translate.js +18 -18
- package/dist/translate.js.map +1 -1
- package/package.json +1 -1
- package/dist/core-2CFW0uRa.js.map +0 -1
package/dist/core/context.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Store } from "../types.js";
|
|
2
2
|
import { ViewNode } from "./markup/nodes/view.js";
|
|
3
|
+
import { Unwrapped } from "./signals.js";
|
|
3
4
|
export type LifecycleListener = () => any;
|
|
4
5
|
type ContextState = {
|
|
5
6
|
isMounted: boolean;
|
|
@@ -13,7 +14,15 @@ export declare function mountContext(context: Context): void;
|
|
|
13
14
|
export declare function unmountContext(context: Context): void;
|
|
14
15
|
export declare function onMount(context: Context, fn: LifecycleListener): void;
|
|
15
16
|
export declare function onCleanup(context: Context, fn: LifecycleListener): void;
|
|
17
|
+
/**
|
|
18
|
+
* Creates an effect with auto-tracking for getters called within its callback.
|
|
19
|
+
*/
|
|
16
20
|
export declare function onEffect(context: Context, fn: () => void): void;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an effect that tracks getters in its `deps` array.
|
|
23
|
+
* Unwrapped values from `deps` are passed as arguments to the callback.
|
|
24
|
+
*/
|
|
25
|
+
export declare function onEffect<const T extends readonly any[]>(context: Context, fn: (...values: Unwrapped<T>) => void, deps: T): void;
|
|
17
26
|
/**
|
|
18
27
|
* Returns the parent element of the root we're mounted in.
|
|
19
28
|
*/
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createRoot } from "./root.js";
|
|
2
2
|
export type { DollaPlugin } from "./root.js";
|
|
3
|
-
export { batch, compose, createAtom, createEffect, createStream, peek, subscribe, unwrap } from "./signals.js";
|
|
3
|
+
export { batch, compose, createAtom, createEffect, createSetter, createStream, peek, subscribe, unwrap, } from "./signals.js";
|
|
4
4
|
export type { Getter, Setter } from "./signals.js";
|
|
5
5
|
export { addStore, getNearestViewNode, getRootElement, getStore, onCleanup, onEffect, onMount } from "./context.js";
|
|
6
6
|
export type { Context } from "./context.js";
|
package/dist/core/root.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { Renderable, View } from "../types.js";
|
|
2
2
|
import { type Context } from "./context.js";
|
|
3
|
-
export type CleanupCallback = () => void | Promise<void>;
|
|
4
3
|
/**
|
|
5
|
-
* Plugins
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Hooks can be used inside plugins.
|
|
4
|
+
* Plugins are simply functions that take a context object.
|
|
5
|
+
* A plugin can return a Promise to suspend app mounting.
|
|
6
|
+
* Hooks can be used to attach app lifecycle logic.
|
|
9
7
|
*/
|
|
10
|
-
export type DollaPlugin = (context: Context) =>
|
|
8
|
+
export type DollaPlugin = (context: Context) => any;
|
|
11
9
|
export interface DollaRootOptions {
|
|
12
10
|
/**
|
|
13
11
|
* Adds additional view info to the DOM to help with debugging.
|
package/dist/core/signals.d.ts
CHANGED
|
@@ -42,7 +42,25 @@ export declare function createAtom<T>(): AtomAccessors<T | undefined>;
|
|
|
42
42
|
* getValue("overwritten");
|
|
43
43
|
* getInputValue(); // "overwritten"
|
|
44
44
|
*/
|
|
45
|
-
export declare function createAtom<T>(
|
|
45
|
+
export declare function createAtom<T>(initialValue: Getter<T>): AtomAccessors<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new atom with a value computed from an existing getter.
|
|
48
|
+
* This is usually used to create a 'settable' getter, in which you can store
|
|
49
|
+
* a temporary value until it gets overwritten by a _real_ update.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const [getValue, setValue] = createAtom("");
|
|
53
|
+
* const [getInputValue, setInputValue] = createAtom(getValue);
|
|
54
|
+
*
|
|
55
|
+
* setInputValue("temporary");
|
|
56
|
+
* getValue("");
|
|
57
|
+
* getInputValue(); // "temporary"
|
|
58
|
+
*
|
|
59
|
+
* setValue("overwritten");
|
|
60
|
+
* getValue("overwritten");
|
|
61
|
+
* getInputValue(); // "overwritten"
|
|
62
|
+
*/
|
|
63
|
+
export declare function createAtom<T>(initialValue: MaybeGetter<T>): AtomAccessors<T>;
|
|
46
64
|
/**
|
|
47
65
|
* Creates a new atom with an initial value.
|
|
48
66
|
* Returns a `[getter, setter]` function tuple.
|
|
@@ -51,8 +69,23 @@ export declare function createAtom<T>(compute: Getter<T>): AtomAccessors<T>;
|
|
|
51
69
|
* const [getCount, setCount] = createAtom(5);
|
|
52
70
|
*/
|
|
53
71
|
export declare function createAtom<T>(initialValue: T): AtomAccessors<T>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a customsetter with a `getter` as its source.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createSetter<T>(getter: Getter<T>, callback: (current: T) => T | void): Setter<T>;
|
|
54
76
|
export declare function compose<T>(getter: T | ((previousValue?: T) => Getter<T> | T)): Getter<T>;
|
|
77
|
+
export type Unwrapped<T> = {
|
|
78
|
+
[K in keyof T]: T[K] extends () => infer R ? R : T[K];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Creates an effect with auto-tracking for getters called within its callback.
|
|
82
|
+
*/
|
|
55
83
|
export declare function createEffect(fn: () => void): () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Creates an effect that tracks getters in its `deps` array.
|
|
86
|
+
* Unwrapped values from `deps` are passed as arguments to the callback.
|
|
87
|
+
*/
|
|
88
|
+
export declare function createEffect<const T extends readonly any[]>(fn: (...values: Unwrapped<T>) => void, deps?: T): () => void;
|
|
56
89
|
/**
|
|
57
90
|
* Unwraps a `MaybeGetter<T>` into a plain `T`.
|
|
58
91
|
* Tracks the value if it is a getter.
|
|
@@ -56,7 +56,7 @@ function _(e, t, n) {
|
|
|
56
56
|
i !== void 0 && (i._prevDep = o), r === void 0 ? t._deps = o : r._nextDep = o, a === void 0 ? e._subs = o : a._nextSub = o;
|
|
57
57
|
}
|
|
58
58
|
function ee(e) {
|
|
59
|
-
e._flags & u.Mutable ? e._depsTail !== void 0 && (e._depsTail = void 0, e._flags = u.Mutable | u.Dirty, S(e)) :
|
|
59
|
+
e._flags & u.Mutable ? e._depsTail !== void 0 && (e._depsTail = void 0, e._flags = u.Mutable | u.Dirty, S(e)) : he.call(e);
|
|
60
60
|
}
|
|
61
61
|
function te(e, t = e._sub) {
|
|
62
62
|
let n = e._dep, r = e._prevDep, i = e._nextDep, a = e._nextSub, o = e._prevSub;
|
|
@@ -267,7 +267,11 @@ function pe(e) {
|
|
|
267
267
|
e !== void 0 && (re(e), f || x());
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
function me() {
|
|
270
|
+
function me(e, t) {
|
|
271
|
+
let n = typeof t == "function" ? t(D(this)) : t;
|
|
272
|
+
return e(n) ?? n;
|
|
273
|
+
}
|
|
274
|
+
function he() {
|
|
271
275
|
this._depsTail = void 0, this._flags = u.None, S(this);
|
|
272
276
|
let e = this._subs;
|
|
273
277
|
e !== void 0 && te(e), this._cleanup?.(), this._cleanup = void 0;
|
|
@@ -296,6 +300,9 @@ function C(e) {
|
|
|
296
300
|
return [fe.bind(t), pe.bind(t)];
|
|
297
301
|
}
|
|
298
302
|
}
|
|
303
|
+
function ge(e, t) {
|
|
304
|
+
return me.bind(e, t);
|
|
305
|
+
}
|
|
299
306
|
function w(e) {
|
|
300
307
|
return o(e) ? ue.bind({
|
|
301
308
|
_value: void 0,
|
|
@@ -307,25 +314,33 @@ function w(e) {
|
|
|
307
314
|
_getter: e
|
|
308
315
|
}) : () => e;
|
|
309
316
|
}
|
|
310
|
-
function
|
|
311
|
-
let t =
|
|
312
|
-
|
|
317
|
+
function _e(e) {
|
|
318
|
+
let t = this.map((e) => E(e));
|
|
319
|
+
return D(() => e(...t));
|
|
320
|
+
}
|
|
321
|
+
function T(e, t) {
|
|
322
|
+
let n = {
|
|
323
|
+
_fn: t ? _e.bind(t, e) : e,
|
|
313
324
|
_cleanup: void 0,
|
|
314
325
|
_subs: void 0,
|
|
315
326
|
_subsTail: void 0,
|
|
316
327
|
_deps: void 0,
|
|
317
328
|
_depsTail: void 0,
|
|
318
329
|
_flags: u.Watching | u.RecursedCheck
|
|
319
|
-
},
|
|
320
|
-
|
|
330
|
+
}, r = b(n);
|
|
331
|
+
r !== void 0 && _(n, r, 0);
|
|
321
332
|
try {
|
|
322
|
-
let e =
|
|
323
|
-
o(e) && (
|
|
333
|
+
let e = n._fn();
|
|
334
|
+
o(e) && (n._cleanup = e);
|
|
324
335
|
} finally {
|
|
325
|
-
h =
|
|
336
|
+
h = r, n._flags &= ~u.RecursedCheck;
|
|
326
337
|
}
|
|
327
|
-
return
|
|
338
|
+
return he.bind(n);
|
|
328
339
|
}
|
|
340
|
+
var [ve, ye] = C(5);
|
|
341
|
+
T((e, t) => {
|
|
342
|
+
console.log("count is now", e);
|
|
343
|
+
}, [ve, "on"]);
|
|
329
344
|
function E(e) {
|
|
330
345
|
return o(e) ? e() : e;
|
|
331
346
|
}
|
|
@@ -337,7 +352,7 @@ function D(e) {
|
|
|
337
352
|
b(t);
|
|
338
353
|
}
|
|
339
354
|
}
|
|
340
|
-
function
|
|
355
|
+
function be(e) {
|
|
341
356
|
++f;
|
|
342
357
|
try {
|
|
343
358
|
e();
|
|
@@ -429,7 +444,7 @@ function k({ value: e, signal: t }) {
|
|
|
429
444
|
}
|
|
430
445
|
};
|
|
431
446
|
}
|
|
432
|
-
function
|
|
447
|
+
function xe(e) {
|
|
433
448
|
let t = {
|
|
434
449
|
_currentValue: e?.initialValue,
|
|
435
450
|
_pendingValue: e?.initialValue,
|
|
@@ -447,9 +462,9 @@ function ge(e) {
|
|
|
447
462
|
}
|
|
448
463
|
//#endregion
|
|
449
464
|
//#region src/core/markup/types.ts
|
|
450
|
-
var
|
|
451
|
-
static [
|
|
452
|
-
get [
|
|
465
|
+
var Se = Symbol(), Ce = Symbol(), we = Symbol(), A = class {
|
|
466
|
+
static [we] = !0;
|
|
467
|
+
get [Ce]() {
|
|
453
468
|
return !0;
|
|
454
469
|
}
|
|
455
470
|
}, j = class extends A {
|
|
@@ -470,7 +485,7 @@ var _e = Symbol(), ve = Symbol(), ye = Symbol(), A = class {
|
|
|
470
485
|
e || this.#e.parentNode?.removeChild(this.#e);
|
|
471
486
|
}
|
|
472
487
|
move(e, t) {
|
|
473
|
-
|
|
488
|
+
Fe(e, this.#e, t);
|
|
474
489
|
}
|
|
475
490
|
};
|
|
476
491
|
//#endregion
|
|
@@ -543,7 +558,7 @@ var N = class extends A {
|
|
|
543
558
|
a && (r = a);
|
|
544
559
|
}
|
|
545
560
|
}
|
|
546
|
-
},
|
|
561
|
+
}, Te = Symbol("parentElement"), P = Symbol("debug"), F = Symbol("isSVG"), Ee = ["ref", "children"], De = class extends A {
|
|
547
562
|
#e;
|
|
548
563
|
#t;
|
|
549
564
|
#n;
|
|
@@ -553,7 +568,7 @@ var N = class extends A {
|
|
|
553
568
|
#o;
|
|
554
569
|
constructor(e, t, n) {
|
|
555
570
|
if (super(), this.#t = n, this.#n = e, t === "svg" ? (this.#n = K(e), this.#n[F] = !0, this.#r = !0) : this.#n[F] && t === "foreignObject" && (this.#n = K(e), this.#n[F] = !1, this.#r = !1), this.#n[F] ? this.#e = document.createElementNS("http://www.w3.org/2000/svg", t) : this.#e = document.createElement(t), this.#n[P]) {
|
|
556
|
-
let e =
|
|
571
|
+
let e = Be(this.#n);
|
|
557
572
|
e && (this.#e.dataset.view = e.context.name);
|
|
558
573
|
}
|
|
559
574
|
}
|
|
@@ -565,7 +580,7 @@ var N = class extends A {
|
|
|
565
580
|
}
|
|
566
581
|
mount(e, t) {
|
|
567
582
|
let r = this.isMounted();
|
|
568
|
-
if (!r && (this.#c(this.#e, n(
|
|
583
|
+
if (!r && (this.#c(this.#e, n(Ee, this.#t)), this.#t.children)) {
|
|
569
584
|
this.#i = z(this.#n, this.#t.children);
|
|
570
585
|
for (let e of this.#i) e.mount(this.#e);
|
|
571
586
|
}
|
|
@@ -634,13 +649,13 @@ var N = class extends A {
|
|
|
634
649
|
n.forEach((e) => {
|
|
635
650
|
e(), this.#a.delete(e);
|
|
636
651
|
}), n.clear(), e.style.cssText = "";
|
|
637
|
-
let r =
|
|
652
|
+
let r = ke(t);
|
|
638
653
|
for (let [t, { value: i, priority: a }] of Object.entries(r)) if (o(i)) {
|
|
639
654
|
let r = O(i, (n) => {
|
|
640
|
-
n ? e.style.setProperty(t,
|
|
655
|
+
n ? e.style.setProperty(t, je(n), a) : e.style.removeProperty(t);
|
|
641
656
|
});
|
|
642
657
|
this.#a.add(r), n.add(r);
|
|
643
|
-
} else i != null && e.style.setProperty(t,
|
|
658
|
+
} else i != null && e.style.setProperty(t, je(i), a);
|
|
644
659
|
};
|
|
645
660
|
o(t) ? this.#a.add(O(t, r)) : r(t);
|
|
646
661
|
}
|
|
@@ -649,7 +664,7 @@ var N = class extends A {
|
|
|
649
664
|
n.forEach((e) => {
|
|
650
665
|
e(), this.#a.delete(e);
|
|
651
666
|
}), n.clear(), I(e, "class", null);
|
|
652
|
-
let r =
|
|
667
|
+
let r = Oe(t);
|
|
653
668
|
for (let [t, i] of Object.entries(r)) if (t !== "undefined") if (o(i)) {
|
|
654
669
|
let r = O(i, (n) => e.classList.toggle(t, !!n));
|
|
655
670
|
this.#a.add(r), n.add(r);
|
|
@@ -658,22 +673,22 @@ var N = class extends A {
|
|
|
658
673
|
o(t) ? this.#a.add(O(t, r)) : r(t);
|
|
659
674
|
}
|
|
660
675
|
};
|
|
661
|
-
function
|
|
662
|
-
return a(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(
|
|
676
|
+
function Oe(e) {
|
|
677
|
+
return a(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(Oe)) : l(e) ? e : {};
|
|
663
678
|
}
|
|
664
|
-
function
|
|
679
|
+
function ke(e) {
|
|
665
680
|
return a(e) ? Object.fromEntries(e.split(";").filter((e) => e.trim()).map((e) => {
|
|
666
681
|
let [t, n] = e.split(":");
|
|
667
|
-
return [
|
|
682
|
+
return [Ae(t.trim()), {
|
|
668
683
|
value: n.replace("!important", "").trim(),
|
|
669
684
|
priority: n.includes("!important") ? "important" : ""
|
|
670
685
|
}];
|
|
671
|
-
})) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(
|
|
686
|
+
})) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(ke)) : l(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.startsWith("--") ? e : Ae(e), { value: t }])) : {};
|
|
672
687
|
}
|
|
673
|
-
function
|
|
688
|
+
function Ae(e) {
|
|
674
689
|
return e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e.toLowerCase());
|
|
675
690
|
}
|
|
676
|
-
function
|
|
691
|
+
function je(e) {
|
|
677
692
|
return c(e) ? `${e}px` : e;
|
|
678
693
|
}
|
|
679
694
|
function I(e, t, n) {
|
|
@@ -683,19 +698,19 @@ function I(e, t, n) {
|
|
|
683
698
|
//#region src/core/markup/utils.ts
|
|
684
699
|
function L(e, t) {
|
|
685
700
|
return {
|
|
686
|
-
[
|
|
701
|
+
[Se]: !0,
|
|
687
702
|
type: e,
|
|
688
703
|
props: t
|
|
689
704
|
};
|
|
690
705
|
}
|
|
691
|
-
function
|
|
692
|
-
return e && e[
|
|
706
|
+
function Me(e) {
|
|
707
|
+
return e && e[Se];
|
|
693
708
|
}
|
|
694
|
-
function
|
|
695
|
-
return e && e[
|
|
709
|
+
function Ne(e) {
|
|
710
|
+
return e && e[Ce];
|
|
696
711
|
}
|
|
697
|
-
function
|
|
698
|
-
return e && e[
|
|
712
|
+
function Pe(e) {
|
|
713
|
+
return e && e[we];
|
|
699
714
|
}
|
|
700
715
|
function R(e, t = K()) {
|
|
701
716
|
let n = z(t, e);
|
|
@@ -706,10 +721,10 @@ function z(e, ...t) {
|
|
|
706
721
|
function r(t) {
|
|
707
722
|
if (!(t == null || t === !1)) if (i(t)) for (let e = 0; e < t.length; e++) r(t[e]);
|
|
708
723
|
else if (a(t) || c(t)) n.push(new j(e, V(String(t))));
|
|
709
|
-
else if (
|
|
724
|
+
else if (Me(t)) {
|
|
710
725
|
let { type: r, props: i } = t;
|
|
711
|
-
|
|
712
|
-
} else
|
|
726
|
+
Pe(r) ? n.push(new r(e, ...i.args)) : o(r) ? n.push(new U(e, r, i)) : a(r) && n.push(new De(e, r, i));
|
|
727
|
+
} else Ne(t) ? n.push(t) : t instanceof Node ? n.push(new j(e, t)) : o(t) && n.push(new N(e, t));
|
|
713
728
|
}
|
|
714
729
|
for (let e = 0; e < t.length; e++) r(t[e]);
|
|
715
730
|
return n;
|
|
@@ -720,7 +735,7 @@ function B(e, t, n) {
|
|
|
720
735
|
function V(e) {
|
|
721
736
|
return document.createTextNode(e);
|
|
722
737
|
}
|
|
723
|
-
function
|
|
738
|
+
function Fe(e, t, n) {
|
|
724
739
|
let r = n?.nextSibling ?? null;
|
|
725
740
|
if (e.moveBefore) try {
|
|
726
741
|
e.moveBefore(t, r);
|
|
@@ -733,13 +748,13 @@ function H(e, t, n) {
|
|
|
733
748
|
}
|
|
734
749
|
//#endregion
|
|
735
750
|
//#region src/core/markup/nodes/view.ts
|
|
736
|
-
var
|
|
751
|
+
var Ie = Symbol.for("ViewNode"), U = class extends A {
|
|
737
752
|
#e;
|
|
738
753
|
#t;
|
|
739
754
|
#n;
|
|
740
755
|
context;
|
|
741
756
|
constructor(e, t, n) {
|
|
742
|
-
super(), this.context = K(e), this.context[
|
|
757
|
+
super(), this.context = K(e), this.context[Ie] = this, this.context.name = t.name, this.#e = n, this.#t = t;
|
|
743
758
|
}
|
|
744
759
|
getRoot() {
|
|
745
760
|
return this.#n?.getRoot();
|
|
@@ -766,12 +781,12 @@ function K(e) {
|
|
|
766
781
|
return Object.assign(Object.create(e ?? null), { isMounted: !1 });
|
|
767
782
|
}
|
|
768
783
|
function q(e) {
|
|
769
|
-
e.isMounted || (e.isMounted = !0,
|
|
784
|
+
e.isMounted || (e.isMounted = !0, Le(e, W));
|
|
770
785
|
}
|
|
771
786
|
function J(e) {
|
|
772
|
-
e.isMounted && (e.isMounted = !1,
|
|
787
|
+
e.isMounted && (e.isMounted = !1, Le(e, G));
|
|
773
788
|
}
|
|
774
|
-
function
|
|
789
|
+
function Le(e, t) {
|
|
775
790
|
if (Object.hasOwn(e, t)) {
|
|
776
791
|
for (let n of e[t]) n();
|
|
777
792
|
e[t].length = 0;
|
|
@@ -783,74 +798,71 @@ function Y(e, t) {
|
|
|
783
798
|
function X(e, t) {
|
|
784
799
|
Object.hasOwn(e, G) ? e[G].push(t) : e[G] = [t];
|
|
785
800
|
}
|
|
786
|
-
function
|
|
787
|
-
e.isMounted ? X(e, T(t)) : Y(e, () => {
|
|
788
|
-
X(e, T(t));
|
|
801
|
+
function Re(e, t, n) {
|
|
802
|
+
e.isMounted ? X(e, T(t, n)) : Y(e, () => {
|
|
803
|
+
X(e, T(t, n));
|
|
789
804
|
});
|
|
790
805
|
}
|
|
791
|
-
function
|
|
792
|
-
return e[
|
|
806
|
+
function ze(e) {
|
|
807
|
+
return e[Te];
|
|
793
808
|
}
|
|
794
|
-
function
|
|
795
|
-
return e[
|
|
809
|
+
function Be(e) {
|
|
810
|
+
return e[Ie];
|
|
796
811
|
}
|
|
797
812
|
var Z = Symbol("Dolla.StoreId");
|
|
798
|
-
function
|
|
813
|
+
function Ve(e, t, ...n) {
|
|
799
814
|
t[Z] ??= Symbol(t.name), r(!Object.hasOwn(e, t[Z]), "Store was already provided on this context.");
|
|
800
815
|
let i = K(e);
|
|
801
816
|
return Y(e, () => q(i)), X(e, () => J(i)), i.name = t.name, e[t[Z]] = t.call(i, n[0], i);
|
|
802
817
|
}
|
|
803
|
-
function
|
|
818
|
+
function He(e, t) {
|
|
804
819
|
let n = t[Z], i = n ? e[n] : void 0;
|
|
805
820
|
return r(i != null, `Store '${t.name}' is not provided by this context.`), i;
|
|
806
821
|
}
|
|
807
822
|
//#endregion
|
|
808
823
|
//#region src/core/root.ts
|
|
809
|
-
function
|
|
824
|
+
function Ue(e, t) {
|
|
810
825
|
let n = a(e) ? document.querySelector(e) : e;
|
|
811
826
|
r(n, "Element cannot be null.");
|
|
812
827
|
let i = K();
|
|
813
828
|
i.name = "dolla:root";
|
|
814
|
-
let s = []
|
|
815
|
-
i[
|
|
816
|
-
let
|
|
817
|
-
plugin:
|
|
818
|
-
mount:
|
|
819
|
-
unmount:
|
|
829
|
+
let s = [];
|
|
830
|
+
i[Te] = n, i[P] = !!t?.debug;
|
|
831
|
+
let c = null, l = {
|
|
832
|
+
plugin: u,
|
|
833
|
+
mount: d,
|
|
834
|
+
unmount: f
|
|
820
835
|
};
|
|
821
|
-
function
|
|
822
|
-
return s.push(e),
|
|
836
|
+
function u(e) {
|
|
837
|
+
return s.push(e), l;
|
|
823
838
|
}
|
|
824
|
-
async function
|
|
825
|
-
|
|
826
|
-
let t = await Promise.all(s.map((e) => e(i)));
|
|
827
|
-
for (let e of t) o(e) && c.push(e);
|
|
828
|
-
l = o(e) ? new U(i, e, {}) : R(e, i), l?.mount(n), q(i);
|
|
839
|
+
async function d(e) {
|
|
840
|
+
i.isMounted || (await Promise.all(s.map((e) => e(i))), c = o(e) ? new U(i, e, {}) : R(e, i), c?.mount(n), q(i));
|
|
829
841
|
}
|
|
830
|
-
async function
|
|
831
|
-
i.isMounted && (
|
|
842
|
+
async function f() {
|
|
843
|
+
i.isMounted && (c?.unmount(!1), c = null, J(i));
|
|
832
844
|
}
|
|
833
|
-
return
|
|
845
|
+
return l;
|
|
834
846
|
}
|
|
835
847
|
//#endregion
|
|
836
848
|
//#region src/core/debug.ts
|
|
837
|
-
var
|
|
849
|
+
var We = () => {}, Ge = {
|
|
838
850
|
trace: 1,
|
|
839
851
|
info: 1,
|
|
840
852
|
log: 2,
|
|
841
853
|
warn: 3,
|
|
842
854
|
error: 4,
|
|
843
855
|
silent: 5
|
|
844
|
-
},
|
|
845
|
-
|
|
846
|
-
},
|
|
847
|
-
|
|
856
|
+
}, Ke = 1, qe = (e) => !e.startsWith("dolla:"), Je = (e) => {
|
|
857
|
+
Ke = Ge[e] || 1;
|
|
858
|
+
}, Ye = (e) => {
|
|
859
|
+
qe = e;
|
|
848
860
|
}, Q = globalThis.console || {};
|
|
849
|
-
function
|
|
861
|
+
function Xe(e, ...t) {
|
|
850
862
|
let n = e.name, r, i = (e, i) => {
|
|
851
|
-
if (i <
|
|
863
|
+
if (i < Ke || !qe(n) || !Q[e]) return We;
|
|
852
864
|
if (!r) {
|
|
853
|
-
let e = "%c" + n, i = [`color:${
|
|
865
|
+
let e = "%c" + n, i = [`color:${Qe(n)};font-weight:bold`];
|
|
854
866
|
for (let [n, r] of t) e += `%c[${n}: %c${r}%c]`, i.push("color:#777", "color:#aaa", "color:#777");
|
|
855
867
|
r = [e, ...i];
|
|
856
868
|
}
|
|
@@ -874,18 +886,18 @@ function Ge(e, ...t) {
|
|
|
874
886
|
}
|
|
875
887
|
};
|
|
876
888
|
}
|
|
877
|
-
function
|
|
889
|
+
function Ze(e, ...t) {
|
|
878
890
|
let n = K();
|
|
879
|
-
return n.name = e,
|
|
891
|
+
return n.name = e, Xe(n, ...t);
|
|
880
892
|
}
|
|
881
|
-
function
|
|
893
|
+
function Qe(e) {
|
|
882
894
|
let t = 0;
|
|
883
895
|
for (let n = 0; n < e.length; n++) t = (t + e.charCodeAt(n) * 10) % 360;
|
|
884
896
|
return `oklch(0.68 0.15 ${t}deg)`;
|
|
885
897
|
}
|
|
886
898
|
//#endregion
|
|
887
899
|
//#region src/core/markup/nodes/portal.ts
|
|
888
|
-
var
|
|
900
|
+
var $e = class extends A {
|
|
889
901
|
#e = V("");
|
|
890
902
|
#t;
|
|
891
903
|
#n;
|
|
@@ -907,9 +919,9 @@ var Je = class extends A {
|
|
|
907
919
|
this.isMounted() && (e || this.#e.parentNode?.removeChild(this.#e), this.#i?.isMounted() && this.#i.unmount(!1));
|
|
908
920
|
}
|
|
909
921
|
move(e, t) {
|
|
910
|
-
|
|
922
|
+
Fe(e, this.#e, t);
|
|
911
923
|
}
|
|
912
|
-
},
|
|
924
|
+
}, et = class extends A {
|
|
913
925
|
#e = V("");
|
|
914
926
|
#t;
|
|
915
927
|
#n;
|
|
@@ -947,7 +959,7 @@ var Je = class extends A {
|
|
|
947
959
|
if (!this.isMounted()) return;
|
|
948
960
|
if (e.length === 0) return this._cleanup(!1);
|
|
949
961
|
let t = /* @__PURE__ */ new Map();
|
|
950
|
-
|
|
962
|
+
be(() => {
|
|
951
963
|
let n = new Set(e.map((e, t) => this.#r(e, t)));
|
|
952
964
|
for (let [e, t] of this.#o.entries()) n.has(e) || t._node.unmount(!1);
|
|
953
965
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -976,31 +988,31 @@ var Je = class extends A {
|
|
|
976
988
|
};
|
|
977
989
|
//#endregion
|
|
978
990
|
//#region src/core/markup/helpers.ts
|
|
979
|
-
function
|
|
980
|
-
return o(e) ? L(
|
|
991
|
+
function tt(e, t, n) {
|
|
992
|
+
return o(e) ? L(et, { args: [
|
|
981
993
|
e,
|
|
982
994
|
t,
|
|
983
995
|
n
|
|
984
996
|
] }) : Array.from(e).map((e, t) => n(() => e, () => t));
|
|
985
997
|
}
|
|
986
|
-
function
|
|
998
|
+
function nt(e, t, n) {
|
|
987
999
|
return o(e) ? L(N, { args: [w(() => e() ? t : n)] }) : e ? t : n;
|
|
988
1000
|
}
|
|
989
|
-
function
|
|
990
|
-
return
|
|
1001
|
+
function rt(e, t, n) {
|
|
1002
|
+
return nt(e, t, n);
|
|
991
1003
|
}
|
|
992
|
-
function
|
|
993
|
-
return
|
|
1004
|
+
function it(e, t, n) {
|
|
1005
|
+
return nt(e, n, t);
|
|
994
1006
|
}
|
|
995
|
-
function
|
|
996
|
-
return L(
|
|
1007
|
+
function at(e, t) {
|
|
1008
|
+
return L($e, { args: [t, e] });
|
|
997
1009
|
}
|
|
998
1010
|
//#endregion
|
|
999
1011
|
//#region src/core/markup/html.ts
|
|
1000
1012
|
var $ = /* @__PURE__ */ function(e) {
|
|
1001
1013
|
return e[e.Slash = 0] = "Slash", e[e.Text = 1] = "Text", e[e.Whitespace = 2] = "Whitespace", e[e.TagName = 3] = "TagName", e[e.Comment = 4] = "Comment", e[e.PropSet = 5] = "PropSet", e[e.PropAppend = 6] = "PropAppend", e;
|
|
1002
1014
|
}($ || {});
|
|
1003
|
-
function
|
|
1015
|
+
function ot(e, ...t) {
|
|
1004
1016
|
let n = [e, ...t], r = $.Text, i = "", a = "", o = [0], s = "", c = (e) => {
|
|
1005
1017
|
r === $.Text && (e || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? o.push(e ? n[e] : i) : r === $.TagName && (e || i) ? (o[1] = e ? n[e] : i, r = $.Whitespace) : r === $.Whitespace && i === "..." && e ? o[2] = Object.assign(o[2] || {}, n[e]) : r === $.Whitespace && i && !e ? (o[2] = o[2] || {})[i] = !0 : r >= $.PropSet && (r === $.PropSet ? ((o[2] = o[2] || {})[s] = e ? i ? i + n[e] : n[e] : i, r = $.PropAppend) : (e || i) && (o[2][s] += e ? i + n[e] : i)), i = "";
|
|
1006
1018
|
};
|
|
@@ -1035,13 +1047,13 @@ function tt(e, ...t) {
|
|
|
1035
1047
|
}
|
|
1036
1048
|
//#endregion
|
|
1037
1049
|
//#region src/core/ref.ts
|
|
1038
|
-
function
|
|
1050
|
+
function st() {
|
|
1039
1051
|
let e;
|
|
1040
1052
|
return ((...t) => t.length ? (e = t[0], () => {
|
|
1041
1053
|
e = void 0;
|
|
1042
1054
|
}) : e);
|
|
1043
1055
|
}
|
|
1044
1056
|
//#endregion
|
|
1045
|
-
export { ge as A, R as C, w as D,
|
|
1057
|
+
export { ge as A, t as B, R as C, w as D, be as E, r as F, i as I, o as L, D as M, O as N, C as O, E as P, l as R, L as S, N as T, X as _, it as a, U as b, Xe as c, Ue as d, Ve as f, He as g, ze as h, tt as i, xe as j, T as k, Ye as l, Be as m, ot as n, rt as o, K as p, at as r, Ze as s, st as t, Je as u, Re as v, P as w, H as x, Y as y, a as z };
|
|
1046
1058
|
|
|
1047
|
-
//# sourceMappingURL=core-
|
|
1059
|
+
//# sourceMappingURL=core-CHBZF6Mb.js.map
|