@manyducks.co/dolla 3.3.0 → 4.1.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/README.md CHANGED
@@ -39,7 +39,7 @@ And here's a counter with a lot more going on, plus some comments to explain wha
39
39
  ```jsx
40
40
  import { html, createAtom, createRoot, onMount, onCleanup, onEffect, showIf } from "@manyducks.co/dolla";
41
41
 
42
- function Counter() {
42
+ function Counter(props) {
43
43
  // An atom is the basic building block of dynamic state.
44
44
  // It consists of a getter function and a setter function, returned as a tuple:
45
45
  const [count, setCount] = createAtom(0);
@@ -1,5 +1,6 @@
1
- import type { Store } from "../types.js";
1
+ import { 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
  */
@@ -29,4 +38,9 @@ export declare function addStore<Props, Returns>(context: Context, store: Store<
29
38
  export declare function getStore<Returns>(context: Context, store: Store<any, Returns> & {
30
39
  [STORE_ID]?: symbol;
31
40
  }): Returns;
41
+ type AddStoreHook<Props, Returns> = Props extends undefined ? (context: Context) => Returns : (context: Context, props: Props) => Returns;
42
+ type GetStoreHook<Returns> = (context: Context) => Returns;
43
+ type StoreHooks<Props, Returns> = [AddStoreHook<Props, Returns>, GetStoreHook<Returns>];
44
+ export declare function createStore<Returns, Props = undefined>(name: string, fn: (context: Context, props: Props) => Returns): StoreHooks<Props, Returns>;
45
+ export declare function createStore<Returns, Props = undefined>(fn: (context: Context, props: Props) => Returns): StoreHooks<Props, Returns>;
32
46
  export {};
@@ -1,9 +1,9 @@
1
- import { Context } from "./context.js";
1
+ import { Context } from "./context";
2
2
  export declare const noOp: () => void;
3
3
  export type LogLevel = "info" | "log" | "warn" | "error" | "silent";
4
4
  export declare const setLogLevel: (level: LogLevel) => void;
5
5
  export declare const setLogFilter: (filter: (name: string) => boolean) => void;
6
- export declare function getDebug(context: Context, ...tags: [string, any][]): {
6
+ export declare function getDebug(c: Context, ...tags: [string, any][]): {
7
7
  readonly info: (...args: any[]) => void;
8
8
  readonly trace: (...args: any[]) => void;
9
9
  readonly log: (...args: any[]) => void;
@@ -2,12 +2,12 @@ export { createRoot } from "./root.js";
2
2
  export type { DollaPlugin } from "./root.js";
3
3
  export { batch, compose, createAtom, createEffect, createSetter, createStream, peek, subscribe, unwrap, } from "./signals.js";
4
4
  export type { Getter, Setter } from "./signals.js";
5
- export { addStore, getNearestViewNode, getRootElement, getStore, onCleanup, onEffect, onMount } from "./context.js";
5
+ export { addStore, createStore, getNearestViewNode, getRootElement, getStore, onCleanup, onEffect, onMount, } from "./context.js";
6
6
  export type { Context } from "./context.js";
7
7
  export { createDebug, getDebug, setLogFilter, setLogLevel } from "./debug.js";
8
8
  export { createPortal, forEach, hideIf, showIf } from "./markup/helpers.js";
9
9
  export { html } from "./markup/html.js";
10
- export { ViewNode } from "./markup/nodes/view.js";
10
+ export { createView, ViewNode } from "./markup/nodes/view.js";
11
11
  export type { Markup, MarkupNode } from "./markup/types.js";
12
12
  export { createMarkup, render } from "./markup/utils.js";
13
13
  export { createRef } from "./ref.js";
@@ -1,4 +1,4 @@
1
- import type { View } from "../../../types.js";
1
+ import type { Renderable, View } from "../../../types.js";
2
2
  import { ComponentState, Context } from "../../context.js";
3
3
  import { MarkupNode } from "../types.js";
4
4
  export declare const VIEW: unique symbol;
@@ -15,3 +15,9 @@ export declare class ViewNode<P> extends MarkupNode {
15
15
  unmount(skipDOM?: boolean): void;
16
16
  move(parent: Element, after?: Node): void;
17
17
  }
18
+ type GenericProps = {
19
+ [prop: string]: any;
20
+ };
21
+ export declare function createView<Props = GenericProps>(name: string, callback: (context: Context, props: Props) => Renderable): View<Props>;
22
+ export declare function createView<Props = GenericProps>(callback: (context: Context, props: Props) => Renderable): View<Props>;
23
+ export {};
@@ -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 run before the app is mounted. If they return a promise, mounting will be delayed until the promise resolves.
6
- * If a cleanup function is returned, it will be called before the app is unmounted. The cleanup function's promise will delay unmounting.
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) => Promise<CleanupCallback | void> | CleanupCallback | void;
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.
@@ -74,7 +74,18 @@ export declare function createAtom<T>(initialValue: T): AtomAccessors<T>;
74
74
  */
75
75
  export declare function createSetter<T>(getter: Getter<T>, callback: (current: T) => T | void): Setter<T>;
76
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
+ */
77
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;
78
89
  /**
79
90
  * Unwraps a `MaybeGetter<T>` into a plain `T`.
80
91
  * Tracks the value if it is a getter.
@@ -314,25 +314,33 @@ function w(e) {
314
314
  _getter: e
315
315
  }) : () => e;
316
316
  }
317
- function T(e) {
318
- let t = {
319
- _fn: e,
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,
320
324
  _cleanup: void 0,
321
325
  _subs: void 0,
322
326
  _subsTail: void 0,
323
327
  _deps: void 0,
324
328
  _depsTail: void 0,
325
329
  _flags: u.Watching | u.RecursedCheck
326
- }, n = b(t);
327
- n !== void 0 && _(t, n, 0);
330
+ }, r = b(n);
331
+ r !== void 0 && _(n, r, 0);
328
332
  try {
329
- let e = t._fn();
330
- o(e) && (t._cleanup = e);
333
+ let e = n._fn();
334
+ o(e) && (n._cleanup = e);
331
335
  } finally {
332
- h = n, t._flags &= ~u.RecursedCheck;
336
+ h = r, n._flags &= ~u.RecursedCheck;
333
337
  }
334
- return he.bind(t);
338
+ return he.bind(n);
335
339
  }
340
+ var [ve, ye] = C(5);
341
+ T((e, t) => {
342
+ console.log("count is now", e);
343
+ }, [ve, "on"]);
336
344
  function E(e) {
337
345
  return o(e) ? e() : e;
338
346
  }
@@ -344,7 +352,7 @@ function D(e) {
344
352
  b(t);
345
353
  }
346
354
  }
347
- function _e(e) {
355
+ function be(e) {
348
356
  ++f;
349
357
  try {
350
358
  e();
@@ -436,7 +444,7 @@ function k({ value: e, signal: t }) {
436
444
  }
437
445
  };
438
446
  }
439
- function ve(e) {
447
+ function xe(e) {
440
448
  let t = {
441
449
  _currentValue: e?.initialValue,
442
450
  _pendingValue: e?.initialValue,
@@ -454,9 +462,9 @@ function ve(e) {
454
462
  }
455
463
  //#endregion
456
464
  //#region src/core/markup/types.ts
457
- var ye = Symbol(), be = Symbol(), xe = Symbol(), A = class {
458
- static [xe] = !0;
459
- get [be]() {
465
+ var Se = Symbol.for("$_IS_MARKUP"), Ce = Symbol.for("$_IS_MARKUP_NODE"), we = Symbol.for("$_IS_MARKUP_NODE_CLASS"), A = class {
466
+ static [we] = !0;
467
+ get [Ce]() {
460
468
  return !0;
461
469
  }
462
470
  }, j = class extends A {
@@ -477,7 +485,7 @@ var ye = Symbol(), be = Symbol(), xe = Symbol(), A = class {
477
485
  e || this.#e.parentNode?.removeChild(this.#e);
478
486
  }
479
487
  move(e, t) {
480
- Me(e, this.#e, t);
488
+ Fe(e, this.#e, t);
481
489
  }
482
490
  };
483
491
  //#endregion
@@ -550,7 +558,7 @@ var N = class extends A {
550
558
  a && (r = a);
551
559
  }
552
560
  }
553
- }, Se = Symbol("parentElement"), P = Symbol("debug"), F = Symbol("isSVG"), Ce = ["ref", "children"], we = class extends A {
561
+ }, Te = Symbol.for("$_PARENT_ELEMENT"), P = Symbol.for("$_DEBUG"), F = Symbol.for("$_IS_SVG"), Ee = ["ref", "children"], De = class extends A {
554
562
  #e;
555
563
  #t;
556
564
  #n;
@@ -560,7 +568,7 @@ var N = class extends A {
560
568
  #o;
561
569
  constructor(e, t, n) {
562
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]) {
563
- let e = Le(this.#n);
571
+ let e = Ve(this.#n);
564
572
  e && (this.#e.dataset.view = e.context.name);
565
573
  }
566
574
  }
@@ -572,7 +580,7 @@ var N = class extends A {
572
580
  }
573
581
  mount(e, t) {
574
582
  let r = this.isMounted();
575
- if (!r && (this.#c(this.#e, n(Ce, this.#t)), this.#t.children)) {
583
+ if (!r && (this.#c(this.#e, n(Ee, this.#t)), this.#t.children)) {
576
584
  this.#i = z(this.#n, this.#t.children);
577
585
  for (let e of this.#i) e.mount(this.#e);
578
586
  }
@@ -641,13 +649,13 @@ var N = class extends A {
641
649
  n.forEach((e) => {
642
650
  e(), this.#a.delete(e);
643
651
  }), n.clear(), e.style.cssText = "";
644
- let r = Ee(t);
652
+ let r = ke(t);
645
653
  for (let [t, { value: i, priority: a }] of Object.entries(r)) if (o(i)) {
646
654
  let r = O(i, (n) => {
647
- n ? e.style.setProperty(t, Oe(n), a) : e.style.removeProperty(t);
655
+ n ? e.style.setProperty(t, je(n), a) : e.style.removeProperty(t);
648
656
  });
649
657
  this.#a.add(r), n.add(r);
650
- } else i != null && e.style.setProperty(t, Oe(i), a);
658
+ } else i != null && e.style.setProperty(t, je(i), a);
651
659
  };
652
660
  o(t) ? this.#a.add(O(t, r)) : r(t);
653
661
  }
@@ -656,7 +664,7 @@ var N = class extends A {
656
664
  n.forEach((e) => {
657
665
  e(), this.#a.delete(e);
658
666
  }), n.clear(), I(e, "class", null);
659
- let r = Te(t);
667
+ let r = Oe(t);
660
668
  for (let [t, i] of Object.entries(r)) if (t !== "undefined") if (o(i)) {
661
669
  let r = O(i, (n) => e.classList.toggle(t, !!n));
662
670
  this.#a.add(r), n.add(r);
@@ -665,22 +673,22 @@ var N = class extends A {
665
673
  o(t) ? this.#a.add(O(t, r)) : r(t);
666
674
  }
667
675
  };
668
- function Te(e) {
669
- return a(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(Te)) : l(e) ? e : {};
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 : {};
670
678
  }
671
- function Ee(e) {
679
+ function ke(e) {
672
680
  return a(e) ? Object.fromEntries(e.split(";").filter((e) => e.trim()).map((e) => {
673
681
  let [t, n] = e.split(":");
674
- return [De(t.trim()), {
682
+ return [Ae(t.trim()), {
675
683
  value: n.replace("!important", "").trim(),
676
684
  priority: n.includes("!important") ? "important" : ""
677
685
  }];
678
- })) : i(e) ? Object.assign({}, ...e.filter(Boolean).map(Ee)) : l(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.startsWith("--") ? e : De(e), { value: t }])) : {};
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 }])) : {};
679
687
  }
680
- function De(e) {
688
+ function Ae(e) {
681
689
  return e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e.toLowerCase());
682
690
  }
683
- function Oe(e) {
691
+ function je(e) {
684
692
  return c(e) ? `${e}px` : e;
685
693
  }
686
694
  function I(e, t, n) {
@@ -690,19 +698,19 @@ function I(e, t, n) {
690
698
  //#region src/core/markup/utils.ts
691
699
  function L(e, t) {
692
700
  return {
693
- [ye]: !0,
701
+ [Se]: !0,
694
702
  type: e,
695
703
  props: t
696
704
  };
697
705
  }
698
- function ke(e) {
699
- return e && e[ye];
706
+ function Me(e) {
707
+ return e && e[Se];
700
708
  }
701
- function Ae(e) {
702
- return e && e[be];
709
+ function Ne(e) {
710
+ return e && e[Ce];
703
711
  }
704
- function je(e) {
705
- return e && e[xe];
712
+ function Pe(e) {
713
+ return e && e[we];
706
714
  }
707
715
  function R(e, t = K()) {
708
716
  let n = z(t, e);
@@ -713,10 +721,10 @@ function z(e, ...t) {
713
721
  function r(t) {
714
722
  if (!(t == null || t === !1)) if (i(t)) for (let e = 0; e < t.length; e++) r(t[e]);
715
723
  else if (a(t) || c(t)) n.push(new j(e, V(String(t))));
716
- else if (ke(t)) {
724
+ else if (Me(t)) {
717
725
  let { type: r, props: i } = t;
718
- je(r) ? n.push(new r(e, ...i.args)) : o(r) ? n.push(new U(e, r, i)) : a(r) && n.push(new we(e, r, i));
719
- } else Ae(t) ? n.push(t) : t instanceof Node ? n.push(new j(e, t)) : o(t) && n.push(new N(e, t));
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));
720
728
  }
721
729
  for (let e = 0; e < t.length; e++) r(t[e]);
722
730
  return n;
@@ -727,7 +735,7 @@ function B(e, t, n) {
727
735
  function V(e) {
728
736
  return document.createTextNode(e);
729
737
  }
730
- function Me(e, t, n) {
738
+ function Fe(e, t, n) {
731
739
  let r = n?.nextSibling ?? null;
732
740
  if (e.moveBefore) try {
733
741
  e.moveBefore(t, r);
@@ -740,13 +748,13 @@ function H(e, t, n) {
740
748
  }
741
749
  //#endregion
742
750
  //#region src/core/markup/nodes/view.ts
743
- var Ne = Symbol.for("ViewNode"), U = class extends A {
751
+ var Ie = Symbol.for("$_VIEW_NODE"), U = class extends A {
744
752
  #e;
745
753
  #t;
746
754
  #n;
747
755
  context;
748
756
  constructor(e, t, n) {
749
- super(), this.context = K(e), this.context[Ne] = this, this.context.name = t.name, this.#e = n, this.#t = t;
757
+ super(), this.context = K(e), this.context[Ie] = this, this.context.name = t.name, this.#e = n, this.#t = t;
750
758
  }
751
759
  getRoot() {
752
760
  return this.#n?.getRoot();
@@ -768,17 +776,26 @@ var Ne = Symbol.for("ViewNode"), U = class extends A {
768
776
  move(e, t) {
769
777
  this.#n?.move(e, t);
770
778
  }
771
- }, W = Symbol("Context.mountListeners"), G = Symbol("Context.cleanupListeners");
779
+ };
780
+ function Le(...e) {
781
+ let t, n;
782
+ return e.length === 2 ? (r(typeof e[0] == "string", "When 2 args, the first must be a string"), r(typeof e[1] == "function", "When 2 args, the second must be a function"), t = e[0], n = e[1]) : e.length === 1 && (r(typeof e[0] == "function", "When 1 arg, the value must be a function"), n = e[0]), function(e) {
783
+ return t && (this.name = t), n(this, e);
784
+ };
785
+ }
786
+ //#endregion
787
+ //#region src/core/context.ts
788
+ var W = Symbol.for("$_CONTEXT_MOUNT_LISTENERS"), G = Symbol.for("$_CONTEXT_CLEANUP_LISTENERS");
772
789
  function K(e) {
773
790
  return Object.assign(Object.create(e ?? null), { isMounted: !1 });
774
791
  }
775
792
  function q(e) {
776
- e.isMounted || (e.isMounted = !0, Pe(e, W));
793
+ e.isMounted || (e.isMounted = !0, Re(e, W));
777
794
  }
778
795
  function J(e) {
779
- e.isMounted && (e.isMounted = !1, Pe(e, G));
796
+ e.isMounted && (e.isMounted = !1, Re(e, G));
780
797
  }
781
- function Pe(e, t) {
798
+ function Re(e, t) {
782
799
  if (Object.hasOwn(e, t)) {
783
800
  for (let n of e[t]) n();
784
801
  e[t].length = 0;
@@ -790,109 +807,133 @@ function Y(e, t) {
790
807
  function X(e, t) {
791
808
  Object.hasOwn(e, G) ? e[G].push(t) : e[G] = [t];
792
809
  }
793
- function Fe(e, t) {
794
- e.isMounted ? X(e, T(t)) : Y(e, () => {
795
- X(e, T(t));
810
+ function ze(e, t, n) {
811
+ e.isMounted ? X(e, T(t, n)) : Y(e, () => {
812
+ X(e, T(t, n));
796
813
  });
797
814
  }
798
- function Ie(e) {
799
- return e[Se];
815
+ function Be(e) {
816
+ return e[Te];
800
817
  }
801
- function Le(e) {
802
- return e[Ne];
818
+ function Ve(e) {
819
+ return e[Ie];
803
820
  }
804
- var Z = Symbol("Dolla.StoreId");
805
- function Re(e, t, ...n) {
821
+ var Z = Symbol.for("$_STORE_ID");
822
+ function He(e, t, ...n) {
806
823
  t[Z] ??= Symbol(t.name), r(!Object.hasOwn(e, t[Z]), "Store was already provided on this context.");
807
824
  let i = K(e);
808
825
  return Y(e, () => q(i)), X(e, () => J(i)), i.name = t.name, e[t[Z]] = t.call(i, n[0], i);
809
826
  }
810
- function ze(e, t) {
827
+ function Ue(e, t) {
811
828
  let n = t[Z], i = n ? e[n] : void 0;
812
829
  return r(i != null, `Store '${t.name}' is not provided by this context.`), i;
813
830
  }
831
+ function We(e, t) {
832
+ r(!Object.hasOwn(e, this.id), "Store was already provided on this context.");
833
+ let n = K(e);
834
+ return Y(e, () => q(n)), X(e, () => J(n)), this.name && (n.name = this.name), e[this.id] = this.fn(n, t);
835
+ }
836
+ function Ge(e) {
837
+ let t = e[this.id];
838
+ return r(t != null, "Store is not provided by this context."), t;
839
+ }
840
+ function Ke(...e) {
841
+ if (e.length === 2) {
842
+ r(typeof e[0] == "string", "When 2 args are present the first must be a string"), r(typeof e[1] == "function", "When 2 args are present the second must be a function"), e[1][Z] ??= Symbol(e[0]);
843
+ let t = {
844
+ id: Symbol(),
845
+ fn: e[1],
846
+ name: e[0]
847
+ };
848
+ return [We.bind(t), Ge.bind(t)];
849
+ } else {
850
+ r(e.length === 1 && typeof e[0] == "function", "Expected one function as an argument"), e[0][Z] ??= Symbol();
851
+ let t = {
852
+ id: Symbol(),
853
+ fn: e[0],
854
+ name: e[0].name
855
+ };
856
+ return [We.bind(t), Ge.bind(t)];
857
+ }
858
+ }
814
859
  //#endregion
815
860
  //#region src/core/root.ts
816
- function Be(e, t) {
861
+ function qe(e, t) {
817
862
  let n = a(e) ? document.querySelector(e) : e;
818
863
  r(n, "Element cannot be null.");
819
864
  let i = K();
820
865
  i.name = "dolla:root";
821
- let s = [], c = [];
822
- i[Se] = n, i[P] = !!t?.debug;
823
- let l = null, u = {
824
- plugin: d,
825
- mount: f,
826
- unmount: p
866
+ let s = [];
867
+ i[Te] = n, i[P] = !!t?.debug;
868
+ let c = null, l = {
869
+ plugin: u,
870
+ mount: d,
871
+ unmount: f
827
872
  };
828
- function d(e) {
829
- return s.push(e), u;
873
+ function u(e) {
874
+ return s.push(e), l;
830
875
  }
831
- async function f(e) {
832
- if (i.isMounted) return;
833
- let t = await Promise.all(s.map((e) => e(i)));
834
- for (let e of t) o(e) && c.push(e);
835
- l = o(e) ? new U(i, e, {}) : R(e, i), l?.mount(n), q(i);
876
+ async function d(e) {
877
+ 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));
836
878
  }
837
- async function p() {
838
- i.isMounted && (l?.unmount(!1), l = null, J(i), await Promise.all(c.map((e) => e())), c.length = 0);
879
+ async function f() {
880
+ i.isMounted && (c?.unmount(!1), c = null, J(i));
839
881
  }
840
- return u;
882
+ return l;
841
883
  }
842
884
  //#endregion
843
885
  //#region src/core/debug.ts
844
- var Ve = () => {}, He = {
886
+ var Je = () => {}, Ye = {
845
887
  trace: 1,
846
888
  info: 1,
847
889
  log: 2,
848
890
  warn: 3,
849
891
  error: 4,
850
892
  silent: 5
851
- }, Ue = 1, We = (e) => !e.startsWith("dolla:"), Ge = (e) => {
852
- Ue = He[e] || 1;
853
- }, Ke = (e) => {
854
- We = e;
893
+ }, Xe = 1, Ze = (e) => !e.startsWith("dolla:"), Qe = (e) => {
894
+ Xe = Ye[e] || 1;
895
+ }, $e = (e) => {
896
+ Ze = e;
855
897
  }, Q = globalThis.console || {};
856
- function qe(e, ...t) {
857
- let n = e.name, r, i = (e, i) => {
858
- if (i < Ue || !We(n) || !Q[e]) return Ve;
859
- if (!r) {
860
- let e = "%c" + n, i = [`color:${Ye(n)};font-weight:bold`];
861
- for (let [n, r] of t) e += `%c[${n}: %c${r}%c]`, i.push("color:#777", "color:#aaa", "color:#777");
862
- r = [e, ...i];
898
+ function et(e, ...t) {
899
+ return tt(e.name, ...t);
900
+ }
901
+ function tt(e, ...t) {
902
+ let n, r = (r, i) => {
903
+ if (i < Xe || !Ze(e) || !Q[r]) return Je;
904
+ if (!n) {
905
+ let r = "%c" + e, i = [`color:${nt(e)};font-weight:bold`];
906
+ for (let [e, n] of t) r += `%c[${e}: %c${n}%c]`, i.push("color:#777", "color:#aaa", "color:#777");
907
+ n = [r, ...i];
863
908
  }
864
- return Q[e].bind(Q, ...r);
909
+ return Q[r].bind(Q, ...n);
865
910
  };
866
911
  return {
867
912
  get info() {
868
- return i("info", 1);
913
+ return r("info", 1);
869
914
  },
870
915
  get trace() {
871
- return i("trace", 1);
916
+ return r("trace", 1);
872
917
  },
873
918
  get log() {
874
- return i("log", 2);
919
+ return r("log", 2);
875
920
  },
876
921
  get warn() {
877
- return i("warn", 3);
922
+ return r("warn", 3);
878
923
  },
879
924
  get error() {
880
- return i("error", 4);
925
+ return r("error", 4);
881
926
  }
882
927
  };
883
928
  }
884
- function Je(e, ...t) {
885
- let n = K();
886
- return n.name = e, qe(n, ...t);
887
- }
888
- function Ye(e) {
929
+ function nt(e) {
889
930
  let t = 0;
890
931
  for (let n = 0; n < e.length; n++) t = (t + e.charCodeAt(n) * 10) % 360;
891
932
  return `oklch(0.68 0.15 ${t}deg)`;
892
933
  }
893
934
  //#endregion
894
935
  //#region src/core/markup/nodes/portal.ts
895
- var Xe = class extends A {
936
+ var rt = class extends A {
896
937
  #e = V("");
897
938
  #t;
898
939
  #n;
@@ -914,9 +955,9 @@ var Xe = class extends A {
914
955
  this.isMounted() && (e || this.#e.parentNode?.removeChild(this.#e), this.#i?.isMounted() && this.#i.unmount(!1));
915
956
  }
916
957
  move(e, t) {
917
- Me(e, this.#e, t);
958
+ Fe(e, this.#e, t);
918
959
  }
919
- }, Ze = class extends A {
960
+ }, it = class extends A {
920
961
  #e = V("");
921
962
  #t;
922
963
  #n;
@@ -954,7 +995,7 @@ var Xe = class extends A {
954
995
  if (!this.isMounted()) return;
955
996
  if (e.length === 0) return this._cleanup(!1);
956
997
  let t = /* @__PURE__ */ new Map();
957
- _e(() => {
998
+ be(() => {
958
999
  let n = new Set(e.map((e, t) => this.#r(e, t)));
959
1000
  for (let [e, t] of this.#o.entries()) n.has(e) || t._node.unmount(!1);
960
1001
  for (let r = 0; r < e.length; r++) {
@@ -983,31 +1024,31 @@ var Xe = class extends A {
983
1024
  };
984
1025
  //#endregion
985
1026
  //#region src/core/markup/helpers.ts
986
- function Qe(e, t, n) {
987
- return o(e) ? L(Ze, { args: [
1027
+ function at(e, t, n) {
1028
+ return o(e) ? L(it, { args: [
988
1029
  e,
989
1030
  t,
990
1031
  n
991
1032
  ] }) : Array.from(e).map((e, t) => n(() => e, () => t));
992
1033
  }
993
- function $e(e, t, n) {
1034
+ function ot(e, t, n) {
994
1035
  return o(e) ? L(N, { args: [w(() => e() ? t : n)] }) : e ? t : n;
995
1036
  }
996
- function et(e, t, n) {
997
- return $e(e, t, n);
1037
+ function st(e, t, n) {
1038
+ return ot(e, t, n);
998
1039
  }
999
- function tt(e, t, n) {
1000
- return $e(e, n, t);
1040
+ function ct(e, t, n) {
1041
+ return ot(e, n, t);
1001
1042
  }
1002
- function nt(e, t) {
1003
- return L(Xe, { args: [t, e] });
1043
+ function lt(e, t) {
1044
+ return L(rt, { args: [t, e] });
1004
1045
  }
1005
1046
  //#endregion
1006
1047
  //#region src/core/markup/html.ts
1007
1048
  var $ = /* @__PURE__ */ function(e) {
1008
1049
  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;
1009
1050
  }($ || {});
1010
- function rt(e, ...t) {
1051
+ function ut(e, ...t) {
1011
1052
  let n = [e, ...t], r = $.Text, i = "", a = "", o = [0], s = "", c = (e) => {
1012
1053
  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 = "";
1013
1054
  };
@@ -1042,13 +1083,13 @@ function rt(e, ...t) {
1042
1083
  }
1043
1084
  //#endregion
1044
1085
  //#region src/core/ref.ts
1045
- function it() {
1086
+ function dt() {
1046
1087
  let e;
1047
1088
  return ((...t) => t.length ? (e = t[0], () => {
1048
1089
  e = void 0;
1049
1090
  }) : e);
1050
1091
  }
1051
1092
  //#endregion
1052
- export { ge as A, t as B, R as C, w as D, _e 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 _, tt as a, U as b, qe as c, Be as d, Re as f, ze as g, Ie as h, Qe as i, ve as j, T as k, Ke as l, Le as m, rt as n, et as o, K as p, nt as r, Je as s, it as t, Ge as u, Fe as v, P as w, H as x, Y as y, a as z };
1093
+ export { T as A, a as B, L as C, be as D, N as E, E as F, r as I, i as L, xe as M, D as N, w as O, O as P, o as R, H as S, P as T, t as V, X as _, ct as a, U as b, et as c, qe as d, He as f, Ue as g, Be as h, at as i, ge as j, C as k, $e as l, Ve as m, ut as n, st as o, Ke as p, lt as r, tt as s, dt as t, Qe as u, ze as v, R as w, Le as x, Y as y, l as z };
1053
1094
 
1054
- //# sourceMappingURL=core-BRSu5hVw.js.map
1095
+ //# sourceMappingURL=core-C4DWUGxz.js.map