@manyducks.co/dolla 2.0.0-alpha.52 → 2.0.0-alpha.53

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.
@@ -1,5 +1,6 @@
1
1
  export { $, effect, get, peek } from "./signals.js";
2
2
  export type { MaybeSignal, Signal, Source } from "./signals.js";
3
+ export { ref, type Ref } from "./ref.js";
3
4
  export { constructView } from "./nodes/view.js";
4
5
  export { deepEqual, shallowEqual, strictEqual } from "../utils.js";
5
6
  export { Stores, type StoreContext, type StoreFunction } from "./store.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A hybrid getter/setter function that stores the last value it was called with.
3
+ * Guarantees a value is held at runtime by throwing an error if no value is set.
4
+ */
5
+ export interface Ref<T> {
6
+ /**
7
+ * Returns the currently stored value of the ref, or throws an error if no value has been set.
8
+ */
9
+ (): T;
10
+ /**
11
+ * Stores a new value to the ref and returns that value.
12
+ */
13
+ (value: T): T;
14
+ }
15
+ /**
16
+ * Creates a ref with no initial value.
17
+ */
18
+ export declare function ref<T>(): Ref<T>;
19
+ /**
20
+ * Creates a ref with an initial value.
21
+ */
22
+ export declare function ref<T>(value: T): Ref<T>;
@@ -1,8 +1,8 @@
1
- import { m } from "./view-CY19Cf0X.js";
1
+ import { m } from "./view-CAEIbcZt.js";
2
2
  function a(r, n) {
3
3
  return m("$dynamic", { source: () => r.children });
4
4
  }
5
5
  export {
6
6
  a as F
7
7
  };
8
- //# sourceMappingURL=fragment-DSGTP-XE.js.map
8
+ //# sourceMappingURL=fragment-DFnx8z2z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-DSGTP-XE.js","sources":["../src/core/views/fragment.ts"],"sourcesContent":["import type { Renderable } from \"../../types.js\";\nimport { markup } from \"../markup.js\";\nimport { type ViewContext } from \"../nodes/view.js\";\n\n/**\n * A utility view that displays its children.\n */\nexport function Fragment(props: { children?: Renderable }, ctx: ViewContext) {\n return markup(\"$dynamic\", { source: () => props.children });\n}\n"],"names":["Fragment","props","ctx","markup"],"mappings":";AAOgB,SAAAA,EAASC,GAAkCC,GAAkB;AAC3E,SAAOC,EAAO,YAAY,EAAE,QAAQ,MAAMF,EAAM,UAAU;AAC5D;"}
1
+ {"version":3,"file":"fragment-DFnx8z2z.js","sources":["../src/core/views/fragment.ts"],"sourcesContent":["import type { Renderable } from \"../../types.js\";\nimport { markup } from \"../markup.js\";\nimport { type ViewContext } from \"../nodes/view.js\";\n\n/**\n * A utility view that displays its children.\n */\nexport function Fragment(props: { children?: Renderable }, ctx: ViewContext) {\n return markup(\"$dynamic\", { source: () => props.children });\n}\n"],"names":["Fragment","props","ctx","markup"],"mappings":";AAOgB,SAAAA,EAASC,GAAkCC,GAAkB;AAC3E,SAAOC,EAAO,YAAY,EAAE,QAAQ,MAAMF,EAAM,UAAU;AAC5D;"}
package/dist/i18n.js CHANGED
@@ -5,7 +5,7 @@ var z = (o) => {
5
5
  var J = (o, t, e) => t in o ? B(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
6
  var O = (o, t, e) => J(o, typeof t != "symbol" ? t + "" : t, e), _ = (o, t, e) => t.has(o) || z("Cannot " + e);
7
7
  var i = (o, t, e) => (_(o, t, "read from private field"), e ? e.call(o) : t.get(o)), m = (o, t, e) => t.has(o) ? z("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), N = (o, t, e, n) => (_(o, t, "write to private field"), n ? n.call(o, e) : t.set(o, e), e), g = (o, t, e) => (_(o, t, "access private method"), e);
8
- import { $, f as K, d as Q, g as x } from "./logger-CSRDjb4e.js";
8
+ import { $, f as K, d as Q, g as x } from "./logger-CByUPmlz.js";
9
9
  import { i as C, b as j, c as U, t as P } from "./typeChecking-EAVNeFyB.js";
10
10
  var I, F, p, S, G;
11
11
  class W {
package/dist/index.js CHANGED
@@ -1,11 +1,24 @@
1
- import { o as d } from "./logger-CSRDjb4e.js";
2
- import { $ as O, f as v, d as F, e as N, g as T, b as U, p as B, c as P, h as $, i as z, s as D, a as I } from "./logger-CSRDjb4e.js";
3
- import { m as t, w as p, c, r as g } from "./view-CY19Cf0X.js";
4
- import { S as A, b as G, p as _, a as j, u as H } from "./view-CY19Cf0X.js";
5
- import { R as h, a as y, M as E, U as b } from "./router-BYOH-To5.js";
6
- import { i as w, a as u } from "./typeChecking-EAVNeFyB.js";
7
- function k(e) {
8
- return t(
1
+ import { o as g } from "./logger-CByUPmlz.js";
2
+ import { $ as O, f as P, d as B, e as N, g as U, b as v, p as $, c as z, h as D, i as I, s as W, a as Y } from "./logger-CByUPmlz.js";
3
+ import { m as o, w as p, c as u, r as h } from "./view-CAEIbcZt.js";
4
+ import { S as A, b as G, p as j, a as H, u as J } from "./view-CAEIbcZt.js";
5
+ import { R as y, a as E, M as w, U as b } from "./router-W2HPWbeI.js";
6
+ import { i as x, a as c } from "./typeChecking-EAVNeFyB.js";
7
+ const f = Symbol("Ref.EMPTY");
8
+ function T(e = f) {
9
+ return function() {
10
+ if (arguments.length === 0) {
11
+ if (e === f)
12
+ throw new Error("Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.");
13
+ } else if (arguments.length === 1)
14
+ e = arguments[0];
15
+ else
16
+ throw new Error("Ref called with too many arguments. Expected 0 or 1 arguments.");
17
+ return e;
18
+ };
19
+ }
20
+ function R(e) {
21
+ return o(
9
22
  "div",
10
23
  {
11
24
  style: {
@@ -17,15 +30,15 @@ function k(e) {
17
30
  fontSize: "20px"
18
31
  }
19
32
  },
20
- t("h1", { style: { marginBottom: "0.5rem" } }, "The app has crashed"),
21
- t(
33
+ o("h1", { style: { marginBottom: "0.5rem" } }, "The app has crashed"),
34
+ o(
22
35
  "p",
23
36
  { style: { marginBottom: "0.25rem" } },
24
- t("span", { style: { fontFamily: "monospace" } }, e.loggerName),
25
- p(e.uid, t("span", { style: { fontFamily: "monospace", opacity: 0.5 } }, ` [uid: ${e.uid}]`)),
37
+ o("span", { style: { fontFamily: "monospace" } }, e.loggerName),
38
+ p(e.uid, o("span", { style: { fontFamily: "monospace", opacity: 0.5 } }, ` [uid: ${e.uid}]`)),
26
39
  " says:"
27
40
  ),
28
- t(
41
+ o(
29
42
  "blockquote",
30
43
  {
31
44
  style: {
@@ -36,7 +49,7 @@ function k(e) {
36
49
  marginBottom: "1rem"
37
50
  }
38
51
  },
39
- t(
52
+ o(
40
53
  "span",
41
54
  {
42
55
  style: {
@@ -53,33 +66,33 @@ function k(e) {
53
66
  ),
54
67
  e.error.message
55
68
  ),
56
- t("p", {}, "Please see the browser console for details.")
69
+ o("p", {}, "Please see the browser console for details.")
57
70
  );
58
71
  }
59
- let r = !1;
60
- async function R(e, n, i) {
61
- if (r)
72
+ let s = !1;
73
+ async function q(e, n, i) {
74
+ if (s)
62
75
  throw new Error("A Dolla app is already mounted.");
63
- let o, l, s, f = (i == null ? void 0 : i.crashView) ?? k;
64
- if (w(e)) {
65
- const a = document.querySelector(e);
66
- u(Element, a, `Selector '${e}' did not match any element.`), o = a;
76
+ let a, l, r, d = (i == null ? void 0 : i.crashView) ?? R;
77
+ if (x(e)) {
78
+ const t = document.querySelector(e);
79
+ c(Element, t, `Selector '${e}' did not match any element.`), a = t;
67
80
  } else
68
- u(Element, e, "Expected an element or a selector string. Got type: %t, value: %v"), o = e;
69
- if (n instanceof h)
70
- s = n, l = n[y];
81
+ c(Element, e, "Expected an element or a selector string. Got type: %t, value: %v"), a = e;
82
+ if (n instanceof y)
83
+ r = n, l = n[E];
71
84
  else {
72
- const a = t(n);
73
- l = c(a.type, a.props);
85
+ const t = o(n);
86
+ l = u(t.type, t.props);
74
87
  }
75
- d((a) => {
76
- r && (m(), c(f, a).mount(o));
88
+ g((t) => {
89
+ s && (m(), u(d, t).mount(a));
77
90
  });
78
- for (const a of g.stores.values())
79
- a.handleMount();
80
- s && await s[E](o), l.mount(o), r = !0;
91
+ for (const t of h.stores.values())
92
+ t.handleMount();
93
+ r && await r[w](a), l.mount(a), s = !0;
81
94
  async function m() {
82
- r && (l.unmount(!1), s && await s[b](), r = !1);
95
+ s && (l.unmount(!1), r && await r[b](), s = !1);
83
96
  }
84
97
  return m;
85
98
  }
@@ -87,23 +100,24 @@ export {
87
100
  O as $,
88
101
  A as Stores,
89
102
  G as constructMarkup,
90
- c as constructView,
91
- v as createLogger,
92
- F as deepEqual,
103
+ u as constructView,
104
+ P as createLogger,
105
+ B as deepEqual,
93
106
  N as effect,
94
- T as get,
95
- U as getEnv,
96
- t as markup,
97
- R as mount,
98
- B as peek,
99
- _ as portal,
100
- j as repeat,
101
- P as setEnv,
102
- $ as setLogFilter,
103
- z as setLogLevels,
104
- D as shallowEqual,
105
- I as strictEqual,
106
- H as unless,
107
+ U as get,
108
+ v as getEnv,
109
+ o as markup,
110
+ q as mount,
111
+ $ as peek,
112
+ j as portal,
113
+ T as ref,
114
+ H as repeat,
115
+ z as setEnv,
116
+ D as setLogFilter,
117
+ I as setLogLevels,
118
+ W as shallowEqual,
119
+ Y as strictEqual,
120
+ J as unless,
107
121
  p as when
108
122
  };
109
123
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/core/views/default-crash-view.ts","../src/core/mount.ts"],"sourcesContent":["import { when, markup as m } from \"../markup.js\";\n\n/**\n * Props passed to the crash view when a crash occurs.\n */\nexport type CrashViewProps = {\n /**\n * JavaScript Error object.\n */\n error: Error;\n\n /**\n * A string to identify the logger that reported this error.\n */\n loggerName: string;\n\n /**\n * Unique identifier to pinpoint the specific view that reported the crash.\n */\n uid?: string;\n};\n\nexport function DefaultCrashView(props: CrashViewProps) {\n return m(\n \"div\",\n {\n style: {\n backgroundColor: \"#880000\",\n color: \"#fff\",\n padding: \"2rem\",\n position: \"fixed\",\n inset: 0,\n fontSize: \"20px\",\n },\n },\n m(\"h1\", { style: { marginBottom: \"0.5rem\" } }, \"The app has crashed\"),\n m(\n \"p\",\n { style: { marginBottom: \"0.25rem\" } },\n m(\"span\", { style: { fontFamily: \"monospace\" } }, props.loggerName),\n when(props.uid, m(\"span\", { style: { fontFamily: \"monospace\", opacity: 0.5 } }, ` [uid: ${props.uid}]`)),\n \" says:\",\n ),\n m(\n \"blockquote\",\n {\n style: {\n backgroundColor: \"#991111\",\n padding: \"0.25em\",\n borderRadius: \"6px\",\n fontFamily: \"monospace\",\n marginBottom: \"1rem\",\n },\n },\n m(\n \"span\",\n {\n style: {\n display: \"inline-block\",\n backgroundColor: \"red\",\n padding: \"0.1em 0.4em\",\n marginRight: \"0.5em\",\n borderRadius: \"4px\",\n fontSize: \"0.9em\",\n fontWeight: \"bold\",\n },\n },\n props.error.name,\n ),\n props.error.message,\n ),\n m(\"p\", {}, \"Please see the browser console for details.\"),\n );\n}\n","import { MOUNT, ROOT_VIEW, UNMOUNT, Router } from \"../router/router\";\nimport { assertInstanceOf, isString } from \"../typeChecking\";\nimport { rootElementContext } from \"./context\";\nimport { type LoggerErrorContext, onLoggerCrash } from \"./logger\";\nimport { markup } from \"./markup\";\nimport { constructView, type ViewElement, type ViewFunction } from \"./nodes/view\";\nimport { DefaultCrashView } from \"./views/default-crash-view\";\n\nlet isMounted = false;\n\nexport type UnmountFn = () => Promise<void>;\nexport interface MountOptions {\n crashView?: ViewFunction<LoggerErrorContext>;\n}\n\nexport async function mount(parent: Element, view: any, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(parent: Element, router: any, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(parent: string, view: any, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(parent: string, router: any, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(target: any, view: any, options?: MountOptions): Promise<UnmountFn> {\n if (isMounted) {\n throw new Error(`A Dolla app is already mounted.`);\n }\n\n let rootElement: Element;\n let rootView: ViewElement;\n let router: any | undefined;\n let crashView = options?.crashView ?? DefaultCrashView;\n\n if (isString(target)) {\n const match = document.querySelector<Element>(target);\n assertInstanceOf(Element, match, `Selector '${target}' did not match any element.`);\n rootElement = match!;\n } else {\n assertInstanceOf(Element, target, \"Expected an element or a selector string. Got type: %t, value: %v\");\n rootElement = target;\n }\n\n if (view instanceof Router) {\n router = view;\n rootView = view[ROOT_VIEW];\n } else {\n // First, initialize the root view. The router store needs this to connect the initial route.\n const rootViewMarkup = markup(view);\n rootView = constructView(rootViewMarkup.type as ViewFunction<any>, rootViewMarkup.props);\n }\n\n onLoggerCrash((ctx) => {\n if (isMounted) {\n // Unmount the app.\n unmount();\n\n // Mount the crash page\n const crashPage = constructView(crashView, ctx);\n crashPage.mount(rootElement!);\n }\n });\n\n // Run onMount for stores.\n for (const store of rootElementContext.stores.values()) {\n store.handleMount();\n }\n\n if (router) {\n await router[MOUNT](rootElement);\n }\n\n rootView.mount(rootElement);\n isMounted = true;\n\n async function unmount() {\n if (!isMounted) return;\n\n rootView.unmount(false);\n\n if (router) {\n await router[UNMOUNT]();\n }\n\n isMounted = false;\n }\n\n return unmount;\n}\n"],"names":["DefaultCrashView","props","m","when","isMounted","mount","target","view","options","rootElement","rootView","router","crashView","isString","match","assertInstanceOf","Router","ROOT_VIEW","rootViewMarkup","markup","constructView","onLoggerCrash","ctx","unmount","store","rootElementContext","MOUNT","UNMOUNT"],"mappings":";;;;;;AAsBO,SAASA,EAAiBC,GAAuB;AAC/C,SAAAC;AAAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,QACL,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,SAAS;AAAA,QACT,UAAU;AAAA,QACV,OAAO;AAAA,QACP,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,IACAA,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,SAAA,EAAW,GAAG,qBAAqB;AAAA,IACpEA;AAAAA,MACE;AAAA,MACA,EAAE,OAAO,EAAE,cAAc,YAAY;AAAA,MACrCA,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,YAAY,EAAA,GAAKD,EAAM,UAAU;AAAA,MAClEE,EAAKF,EAAM,KAAKC,EAAE,QAAQ,EAA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,GAGUH,EAAcR,GAAWU,CAAG,EACpC,MAAMb,CAAY;AAAA,EAC9B,CACD;AAGD,aAAWe,KAASC,EAAmB,OAAO,OAAA;AAC5C,IAAAD,EAAM,YAAY;AAGpB,EAAIb,KACI,MAAAA,EAAOe,CAAK,EAAEjB,CAAW,GAGjCC,EAAS,MAAMD,CAAW,GACdL,IAAA;AAEZ,iBAAemB,IAAU;AACvB,IAAKnB,MAELM,EAAS,QAAQ,EAAK,GAElBC,KACI,MAAAA,EAAOgB,CAAO,EAAE,GAGZvB,IAAA;AAAA,EAAA;AAGP,SAAAmB;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../src/core/ref.ts","../src/core/views/default-crash-view.ts","../src/core/mount.ts"],"sourcesContent":["const EMPTY_REF = Symbol(\"Ref.EMPTY\");\n\n/**\n * A hybrid getter/setter function that stores the last value it was called with.\n * Guarantees a value is held at runtime by throwing an error if no value is set.\n */\nexport interface Ref<T> {\n /**\n * Returns the currently stored value of the ref, or throws an error if no value has been set.\n */\n (): T;\n\n /**\n * Stores a new value to the ref and returns that value.\n */\n (value: T): T;\n}\n\n/**\n * Creates a ref with no initial value.\n */\nexport function ref<T>(): Ref<T>;\n\n/**\n * Creates a ref with an initial value.\n */\nexport function ref<T>(value: T): Ref<T>;\n\nexport function ref(value = EMPTY_REF) {\n return function () {\n if (arguments.length === 0) {\n if (value === EMPTY_REF) {\n throw new Error(`Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.`);\n }\n } else if (arguments.length === 1) {\n value = arguments[0];\n } else {\n throw new Error(`Ref called with too many arguments. Expected 0 or 1 arguments.`);\n }\n\n return value;\n };\n}\n","import { when, markup as m } from \"../markup.js\";\n\n/**\n * Props passed to the crash view when a crash occurs.\n */\nexport type CrashViewProps = {\n /**\n * JavaScript Error object.\n */\n error: Error;\n\n /**\n * A string to identify the logger that reported this error.\n */\n loggerName: string;\n\n /**\n * Unique identifier to pinpoint the specific view that reported the crash.\n */\n uid?: string;\n};\n\nexport function DefaultCrashView(props: CrashViewProps) {\n return m(\n \"div\",\n {\n style: {\n backgroundColor: \"#880000\",\n color: \"#fff\",\n padding: \"2rem\",\n position: \"fixed\",\n inset: 0,\n fontSize: \"20px\",\n },\n },\n m(\"h1\", { style: { marginBottom: \"0.5rem\" } }, \"The app has crashed\"),\n m(\n \"p\",\n { style: { marginBottom: \"0.25rem\" } },\n m(\"span\", { style: { fontFamily: \"monospace\" } }, props.loggerName),\n when(props.uid, m(\"span\", { style: { fontFamily: \"monospace\", opacity: 0.5 } }, ` [uid: ${props.uid}]`)),\n \" says:\",\n ),\n m(\n \"blockquote\",\n {\n style: {\n backgroundColor: \"#991111\",\n padding: \"0.25em\",\n borderRadius: \"6px\",\n fontFamily: \"monospace\",\n marginBottom: \"1rem\",\n },\n },\n m(\n \"span\",\n {\n style: {\n display: \"inline-block\",\n backgroundColor: \"red\",\n padding: \"0.1em 0.4em\",\n marginRight: \"0.5em\",\n borderRadius: \"4px\",\n fontSize: \"0.9em\",\n fontWeight: \"bold\",\n },\n },\n props.error.name,\n ),\n props.error.message,\n ),\n m(\"p\", {}, \"Please see the browser console for details.\"),\n );\n}\n","import { MOUNT, ROOT_VIEW, UNMOUNT, Router } from \"../router/router\";\nimport { assertInstanceOf, isString } from \"../typeChecking\";\nimport { rootElementContext } from \"./context\";\nimport { type LoggerErrorContext, onLoggerCrash } from \"./logger\";\nimport { markup } from \"./markup\";\nimport { constructView, type ViewElement, type ViewFunction } from \"./nodes/view\";\nimport { DefaultCrashView } from \"./views/default-crash-view\";\n\nlet isMounted = false;\n\nexport type UnmountFn = () => Promise<void>;\nexport interface MountOptions {\n crashView?: ViewFunction<LoggerErrorContext>;\n}\n\nexport async function mount(parent: Element, view: any, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(parent: Element, router: any, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(parent: string, view: any, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(parent: string, router: any, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(target: any, view: any, options?: MountOptions): Promise<UnmountFn> {\n if (isMounted) {\n throw new Error(`A Dolla app is already mounted.`);\n }\n\n let rootElement: Element;\n let rootView: ViewElement;\n let router: any | undefined;\n let crashView = options?.crashView ?? DefaultCrashView;\n\n if (isString(target)) {\n const match = document.querySelector<Element>(target);\n assertInstanceOf(Element, match, `Selector '${target}' did not match any element.`);\n rootElement = match!;\n } else {\n assertInstanceOf(Element, target, \"Expected an element or a selector string. Got type: %t, value: %v\");\n rootElement = target;\n }\n\n if (view instanceof Router) {\n router = view;\n rootView = view[ROOT_VIEW];\n } else {\n // First, initialize the root view. The router store needs this to connect the initial route.\n const rootViewMarkup = markup(view);\n rootView = constructView(rootViewMarkup.type as ViewFunction<any>, rootViewMarkup.props);\n }\n\n onLoggerCrash((ctx) => {\n if (isMounted) {\n // Unmount the app.\n unmount();\n\n // Mount the crash page\n const crashPage = constructView(crashView, ctx);\n crashPage.mount(rootElement!);\n }\n });\n\n // Run onMount for stores.\n for (const store of rootElementContext.stores.values()) {\n store.handleMount();\n }\n\n if (router) {\n await router[MOUNT](rootElement);\n }\n\n rootView.mount(rootElement);\n isMounted = true;\n\n async function unmount() {\n if (!isMounted) return;\n\n rootView.unmount(false);\n\n if (router) {\n await router[UNMOUNT]();\n }\n\n isMounted = false;\n }\n\n return unmount;\n}\n"],"names":["EMPTY_REF","ref","value","DefaultCrashView","props","m","when","isMounted","mount","target","view","options","rootElement","rootView","router","crashView","isString","match","assertInstanceOf","Router","ROOT_VIEW","rootViewMarkup","markup","constructView","onLoggerCrash","ctx","unmount","store","rootElementContext","MOUNT","UNMOUNT"],"mappings":";;;;;;AAAA,MAAMA,IAAY,OAAO,WAAW;AA4BpB,SAAAC,EAAIC,IAAQF,GAAW;AACrC,SAAO,WAAY;AACb,QAAA,UAAU,WAAW;AACvB,UAAIE,MAAUF;AACN,cAAA,IAAI,MAAM,8FAA8F;AAAA,eAEvG,UAAU,WAAW;AAC9B,MAAAE,IAAQ,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9F,MAAIJ;AACI,UAAA,IAAI,MAAM,iCAAiC;AAG/C,MAAAK,GACAC,GACAC,GACAC,KAAYJ,KAAA,gBAAAA,EAAS,cAAaR;AAElC,MAAAa,EAASP,CAAM,GAAG;AACd,UAAAQ,IAAQ,SAAS,cAAuBR,CAAM;AACpD,IAAAS,EAAiB,SAASD,GAAO,aAAaR,CAAM,8BAA8B,GACpEG,IAAAK;AAAA,EAAA;AAEG,IAAAC,EAAA,SAAST,GAAQ,mEAAmE,GACvFG,IAAAH;AAGhB,MAAIC,aAAgBS;AACT,IAAAL,IAAAJ,GACTG,IAAWH,EAAKU,CAAS;AAAA,OACpB;AAEC,UAAAC,IAAiBC,EAAOZ,CAAI;AAClC,IAAAG,IAAWU,EAAcF,EAAe,MAA2BA,EAAe,KAAK;AAAA,EAAA;AAGzF,EAAAG,EAAc,CAACC,MAAQ;AACrB,IAAIlB,MAEMmB,EAAA,GAGUH,EAAcR,GAAWU,CAAG,EACpC,MAAMb,CAAY;AAAA,EAC9B,CACD;AAGD,aAAWe,KAASC,EAAmB,OAAO,OAAA;AAC5C,IAAAD,EAAM,YAAY;AAGpB,EAAIb,KACI,MAAAA,EAAOe,CAAK,EAAEjB,CAAW,GAGjCC,EAAS,MAAMD,CAAW,GACdL,IAAA;AAEZ,iBAAemB,IAAU;AACvB,IAAKnB,MAELM,EAAS,QAAQ,EAAK,GAElBC,KACI,MAAAA,EAAOgB,CAAO,EAAE,GAGZvB,IAAA;AAAA,EAAA;AAGP,SAAAmB;AACT;"}
@@ -1,5 +1,5 @@
1
- import { m as s } from "./view-CY19Cf0X.js";
2
- import { F as h } from "./fragment-DSGTP-XE.js";
1
+ import { m as s } from "./view-CAEIbcZt.js";
2
+ import { F as h } from "./fragment-DFnx8z2z.js";
3
3
  function d(e, r, t, n, l, u) {
4
4
  const i = { ...o(["children", "key"], r) }, c = Array.isArray(r.children) ? r.children : [r.children];
5
5
  return s(e, i, ...c);
@@ -1,5 +1,5 @@
1
- import { m as t } from "./view-CY19Cf0X.js";
2
- import { F as k } from "./fragment-DSGTP-XE.js";
1
+ import { m as t } from "./view-CAEIbcZt.js";
2
+ import { F as k } from "./fragment-DFnx8z2z.js";
3
3
  function d(e, n, r) {
4
4
  return t(e, n ? { ...u(["children", "key"], n) } : void 0, n.children);
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { c as T, t as N, i as B } from "./typeChecking-EAVNeFyB.js";
2
2
  var v = /* @__PURE__ */ ((e) => (e[e.Computed = 1] = "Computed", e[e.Effect = 2] = "Effect", e[e.Tracking = 4] = "Tracking", e[e.Notified = 8] = "Notified", e[e.Recursed = 16] = "Recursed", e[e.Dirty = 32] = "Dirty", e[e.PendingComputed = 64] = "PendingComputed", e[e.PendingEffect = 128] = "PendingEffect", e[e.Propagated = 224] = "Propagated", e))(v || {});
3
- function L({
3
+ function _({
4
4
  updateComputed: e,
5
5
  notifyEffect: t
6
6
  }) {
@@ -115,7 +115,7 @@ function L({
115
115
  processComputedUpdate(n, s) {
116
116
  if ((s & 32 || (a(n.deps) || (n.flags = s & -65, !1))) && e(n)) {
117
117
  const f = n.subs;
118
- f !== void 0 && p(f);
118
+ f !== void 0 && d(f);
119
119
  }
120
120
  },
121
121
  /**
@@ -179,7 +179,7 @@ function L({
179
179
  if ((o & 33) === 33) {
180
180
  if (e(c)) {
181
181
  const l = c.subs;
182
- l.nextSub !== void 0 && p(l), f = !0;
182
+ l.nextSub !== void 0 && d(l), f = !0;
183
183
  }
184
184
  } else if ((o & 65) === 65) {
185
185
  const l = c.subs;
@@ -198,7 +198,7 @@ function L({
198
198
  const l = o.subs;
199
199
  if (f) {
200
200
  if (e(o)) {
201
- (n = l.prevSub) !== void 0 ? (l.prevSub = void 0, p(o.subs), o = n.sub) : o = l.sub;
201
+ (n = l.prevSub) !== void 0 ? (l.prevSub = void 0, d(o.subs), o = n.sub) : o = l.sub;
202
202
  continue;
203
203
  }
204
204
  } else
@@ -220,7 +220,7 @@ function L({
220
220
  return f;
221
221
  } while (!0);
222
222
  }
223
- function p(n) {
223
+ function d(n) {
224
224
  do {
225
225
  const s = n.sub, f = s.flags;
226
226
  (f & 96) === 64 && (s.flags = f | 32 | 8, (f & 10) === 2 && (r !== void 0 ? r.depsTail.nextDep = s.deps : i = s, r = s)), n = n.nextSub;
@@ -260,14 +260,14 @@ var {
260
260
  link: ce,
261
261
  propagate: le,
262
262
  updateDirtyFlag: X,
263
- startTracking: _,
263
+ startTracking: L,
264
264
  endTracking: A,
265
265
  processEffectNotifications: ae,
266
266
  processComputedUpdate: de,
267
267
  processPendingInnerEffects: I
268
- } = L({
268
+ } = _({
269
269
  updateComputed(e) {
270
- _(e);
270
+ L(e);
271
271
  try {
272
272
  const t = e.currentValue, i = e.getter(t);
273
273
  return t !== i ? (e.currentValue = i, !0) : !1;
@@ -280,7 +280,7 @@ var {
280
280
  }
281
281
  });
282
282
  function H(e) {
283
- _(e);
283
+ L(e);
284
284
  try {
285
285
  e.fn();
286
286
  } finally {
@@ -303,15 +303,15 @@ const {
303
303
  processEffectNotifications: Z,
304
304
  processComputedUpdate: F,
305
305
  processPendingInnerEffects: ee
306
- } = L({
306
+ } = _({
307
307
  updateComputed(e) {
308
- const t = d;
309
- d = e, b(e);
308
+ const t = p;
309
+ p = e, b(e);
310
310
  try {
311
311
  const i = e.current, r = e.getter(i);
312
312
  return e.equals(i, r) ? !1 : (e.current = r, !0);
313
313
  } finally {
314
- d = t, C(e);
314
+ p = t, C(e);
315
315
  }
316
316
  },
317
317
  notifyEffect(e) {
@@ -319,19 +319,19 @@ const {
319
319
  return t & v.Dirty || t & v.PendingComputed && Y(e, t) ? V(e) : ee(e, e.flags), !0;
320
320
  }
321
321
  });
322
- let d;
322
+ let p;
323
323
  const h = [];
324
324
  let S = !1;
325
325
  function te() {
326
326
  S || (S = !0, queueMicrotask(() => {
327
327
  S = !1;
328
328
  for (let e = 0; e < h.length; e++) {
329
- const t = h[e], i = d;
330
- d = t, b(t);
329
+ const t = h[e], i = p;
330
+ p = t, b(t);
331
331
  try {
332
332
  t.cleanup && (z(), t.cleanup(), R()), t.cleanup = t.fn() ?? void 0;
333
333
  } finally {
334
- d = i, C(t);
334
+ p = i, C(t);
335
335
  }
336
336
  }
337
337
  h.length = 0;
@@ -347,10 +347,10 @@ function ne() {
347
347
  }
348
348
  const k = [];
349
349
  function z() {
350
- k.push(d), d = void 0;
350
+ k.push(p), p = void 0;
351
351
  }
352
352
  function R() {
353
- d = k.pop();
353
+ p = k.pop();
354
354
  }
355
355
  const j = Symbol("SIGNAL"), U = Symbol("SOURCE");
356
356
  function pe(e) {
@@ -369,7 +369,7 @@ function ge(e) {
369
369
  depsTail: void 0,
370
370
  flags: v.Effect
371
371
  };
372
- return d !== void 0 && O(t, d), V(t), ne.bind(t);
372
+ return p !== void 0 && O(t, p), V(t), ne.bind(t);
373
373
  }
374
374
  function ve(e, t) {
375
375
  return T(e) ? re(e, t) : $(e === void 0 ? void 0 : e, t);
@@ -384,11 +384,11 @@ function $(e, t) {
384
384
  let a = arguments[0];
385
385
  if (typeof a == "function" && (a = a(i.current)), !r(i.current, a)) {
386
386
  i.current = a;
387
- const p = i.subs;
388
- p !== void 0 && (Q(p), Z());
387
+ const d = i.subs;
388
+ d !== void 0 && (Q(d), Z());
389
389
  }
390
390
  } else
391
- return d !== void 0 && O(i, d), i.current;
391
+ return p !== void 0 && O(i, p), i.current;
392
392
  };
393
393
  return u._type = U, u;
394
394
  }
@@ -410,7 +410,7 @@ function re(e, t) {
410
410
  }, r = function() {
411
411
  if (arguments.length > 0)
412
412
  throw new Error("Signals cannot be set as their values are derived from the sources they depend on.");
413
- d !== void 0 && O(i, d);
413
+ p !== void 0 && O(i, p);
414
414
  const u = i.flags;
415
415
  return u & (v.Dirty | v.PendingComputed) && F(i, u), i.current;
416
416
  };
@@ -527,7 +527,7 @@ function M(e) {
527
527
  }
528
528
  return function(r) {
529
529
  const { positive: u, negative: a } = t;
530
- return !(a.some((p) => p(r)) || u.length > 0 && !u.some((p) => p(r)));
530
+ return !(a.some((d) => d(r)) || u.length > 0 && !u.some((d) => d(r)));
531
531
  };
532
532
  }
533
533
  let G = "production";
@@ -550,14 +550,15 @@ function Ee(e) {
550
550
  }
551
551
  function Se(e, t) {
552
552
  const i = (t == null ? void 0 : t.console) ?? oe(), r = (u) => {
553
- if (y[u] === !1 || B(y[u]) && y[u] !== fe() || !W(D(e)))
553
+ let a = D(e);
554
+ if (y[u] === !1 || B(y[u]) && y[u] !== fe() || !W(a))
554
555
  return se;
555
556
  {
556
- let a = `%c${e}`;
557
- return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", i[u].bind(
557
+ let d = `%c${a}`;
558
+ return t != null && t.uid ? d += ` %c[uid: %c${t.uid}%c]` : d += "%c%c%c", i[u].bind(
558
559
  i,
559
- a,
560
- `color:${ie(a)};font-weight:bold`,
560
+ d,
561
+ `color:${ie(d)};font-weight:bold`,
561
562
  "color:#777",
562
563
  "color:#aaa",
563
564
  "color:#777"
@@ -583,8 +584,8 @@ function Se(e, t) {
583
584
  loggerName: D(e),
584
585
  uid: t == null ? void 0 : t.uid
585
586
  };
586
- for (const p of x)
587
- p(a);
587
+ for (const d of x)
588
+ d(a);
588
589
  }
589
590
  };
590
591
  }
@@ -620,4 +621,4 @@ export {
620
621
  pe as p,
621
622
  xe as s
622
623
  };
623
- //# sourceMappingURL=logger-CSRDjb4e.js.map
624
+ //# sourceMappingURL=logger-CByUPmlz.js.map