@manyducks.co/dolla 2.0.0-alpha.45 → 2.0.0-alpha.46

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.
@@ -70,8 +70,17 @@ export declare function markup<I>(type: ViewFunction<I>, attributes?: I, ...chil
70
70
  */
71
71
  /**
72
72
  * Displays content conditionally. When `condition` holds a truthy value, `thenContent` is displayed; when `condition` holds a falsy value, `elseContent` is displayed.
73
+ * @deprecated
73
74
  */
74
75
  export declare function cond(condition: MaybeReactive<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
76
+ /**
77
+ * Displays `thenContent` when `condition` is truthy and `elseContent` when falsy.
78
+ */
79
+ export declare function when(condition: MaybeReactive<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
80
+ /**
81
+ * Inverted `when`. Displays `thenContent` when `condition` is falsy and `elseContent` when truthy.
82
+ */
83
+ export declare function unless(condition: MaybeReactive<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
75
84
  /**
76
85
  * Calls `renderFn` for each item in `items`. Dynamically adds and removes views as items change.
77
86
  * The result of `keyFn` is used to compare items and decide if item was added, removed or updated.
@@ -1,7 +1,7 @@
1
1
  import type { ComponentContext, ElementContext, StoreConsumerContext, StoreProviderContext } from "../context.js";
2
2
  import type { Logger } from "../dolla.js";
3
3
  import { type Markup, type MarkupElement } from "../markup.js";
4
- import { type EffectCallback, type Reactive, type UnsubscribeFunction } from "../signals.js";
4
+ import { type EffectCallback, type EffectOptions, type Reactive, type UnsubscribeFunction } from "../signals.js";
5
5
  import { IS_MARKUP_ELEMENT } from "../symbols.js";
6
6
  /**
7
7
  * Any valid value that a View can return.
@@ -12,9 +12,6 @@ export type ViewFunction<P> = (this: ViewContext, props: P, context: ViewContext
12
12
  * A view that has been constructed into DOM nodes.
13
13
  */
14
14
  export interface ViewElement extends MarkupElement {
15
- /**
16
- * Take a ViewFunction and render it as a child of this view.
17
- */
18
15
  setRouteView(view: ViewFunction<{}>): ViewElement;
19
16
  }
20
17
  export interface ViewContext extends Omit<Logger, "setName">, ComponentContext, StoreProviderContext, StoreConsumerContext {
@@ -46,7 +43,7 @@ export interface ViewContext extends Omit<Logger, "setName">, ComponentContext,
46
43
  * Passes a getter function to `callback` that will track reactive states and return their current values.
47
44
  * Callback will be run each time a tracked state gets a new value.
48
45
  */
49
- effect(callback: EffectCallback): UnsubscribeFunction;
46
+ effect(callback: EffectCallback, options?: EffectOptions): UnsubscribeFunction;
50
47
  /**
51
48
  * Displays this view's subroutes if mounted as a router view.
52
49
  */
@@ -49,7 +49,8 @@ export interface ReactiveOptions<T> {
49
49
  }
50
50
  export declare class Atom<T> implements Reactive<T> {
51
51
  #private;
52
- readonly name?: string;
52
+ get name(): string;
53
+ get [Symbol.toStringTag](): string;
53
54
  constructor(value: T, options?: ReactiveOptions<T>);
54
55
  /**
55
56
  * Returns the latest value. The signal is tracked as a dependency if called within `effect` or `compose`.
@@ -187,6 +188,7 @@ export declare function untrack(fn: () => void): void;
187
188
  */
188
189
  export declare function getTracked(fn: (tracked: Reactive<unknown>[]) => void): void;
189
190
  export type EffectCallback = () => void;
191
+ export type EffectOptions = {};
190
192
  /**
191
193
  * Creates a tracked scope that re-runs whenever the values of any tracked reactives changes.
192
194
  * Reactives are tracked by accessing their `value` within the body of the function.
@@ -194,5 +196,5 @@ export type EffectCallback = () => void;
194
196
  * NOTE: You must call the unsubscribe function to stop watching for changes.
195
197
  * If you are using an effect inside a View or Store, use `ctx.effect` instead, which cleans up automatically when the component unmounts.
196
198
  */
197
- export declare function effect(fn: EffectCallback): UnsubscribeFunction;
199
+ export declare function effect(fn: EffectCallback, options?: EffectOptions): UnsubscribeFunction;
198
200
  export {};
@@ -1,6 +1,6 @@
1
- import type { StoreConsumerContext, ComponentContext, ElementContext } from "./context.js";
1
+ import type { ComponentContext, ElementContext, StoreConsumerContext } from "./context.js";
2
2
  import type { Logger } from "./dolla.js";
3
- import { EffectCallback, UnsubscribeFunction } from "./signals.js";
3
+ import { type EffectCallback, type EffectOptions, type UnsubscribeFunction } from "./signals.js";
4
4
  export type StoreFunction<Options, Value> = (this: StoreContext, options: Options, context: StoreContext) => Value;
5
5
  export type StoreFactory<Options, Value> = Options extends undefined ? () => Store<Options, Value> : (options: Options) => Store<Options, Value>;
6
6
  export interface StoreContext extends Omit<Logger, "setName">, ComponentContext, StoreConsumerContext {
@@ -20,7 +20,7 @@ export interface StoreContext extends Omit<Logger, "setName">, ComponentContext,
20
20
  * Passes a getter function to `callback` that will track reactive states and return their current values.
21
21
  * Callback will be run each time a tracked state gets a new value.
22
22
  */
23
- effect(callback: EffectCallback): UnsubscribeFunction;
23
+ effect(callback: EffectCallback, options?: EffectOptions): UnsubscribeFunction;
24
24
  }
25
25
  export declare class Store<Options, Value> {
26
26
  readonly fn: StoreFunction<Options, Value>;
@@ -1,8 +1,8 @@
1
- import { m, d as o } from "./markup-DZcvFR50.js";
1
+ import { m, d as o } from "./markup-BJffA2Ls.js";
2
2
  function e(r, a) {
3
3
  return m("$dynamic", { source: o(() => r.children) });
4
4
  }
5
5
  export {
6
6
  e as F
7
7
  };
8
- //# sourceMappingURL=fragment-HanpB-Z6.js.map
8
+ //# sourceMappingURL=fragment-CYt92o5I.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-HanpB-Z6.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\";\nimport { compose } from \"../signals.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: compose(() => props.children) });\n}\n"],"names":["Fragment","props","ctx","markup","compose"],"mappings":";AAQgB,SAAAA,EAASC,GAAkCC,GAAkB;AACpE,SAAAC,EAAO,YAAY,EAAE,QAAQC,EAAQ,MAAMH,EAAM,QAAQ,GAAG;AACrE;"}
1
+ {"version":3,"file":"fragment-CYt92o5I.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\";\nimport { compose } from \"../signals.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: compose(() => props.children) });\n}\n"],"names":["Fragment","props","ctx","markup","compose"],"mappings":";AAQgB,SAAAA,EAASC,GAAkCC,GAAkB;AACpE,SAAAC,EAAO,YAAY,EAAE,QAAQC,EAAQ,MAAMH,EAAM,QAAQ,GAAG;AACrE;"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { deepEqual, shallowEqual, strictEqual } from "./utils.js";
4
4
  export { ref, type Ref } from "./core/ref.js";
5
5
  export { type StoreContext, type StoreFunction } from "./core/store.js";
6
6
  export { createRouter, type Router, type RouterOptions } from "./router/index.js";
7
- export { cond, list, markup, portal } from "./core/markup.js";
7
+ export { cond, list, markup, portal, unless, when } from "./core/markup.js";
8
8
  export type { Markup, MarkupElement } from "./core/markup.js";
9
9
  import { Dolla } from "./core/dolla.js";
10
10
  declare const dolla: Dolla;
package/dist/index.js CHANGED
@@ -13,8 +13,8 @@ var _t = (a, t, e, s) => ({
13
13
  return i(a, t, s);
14
14
  }
15
15
  });
16
- import { a as Kt, b as Pt, i as H, I as Ft, c as Ot, d as U, s as St, e as Qt, f as M, g as D, h as Jt, t as Mt, j as ht, m as $, k as Xt, l as xt, S as Yt, n as Tt, o as Lt, V as Zt, p as te, q as ee, r as se, u as re } from "./markup-DZcvFR50.js";
17
- import { v as je, w as Ce, B as Ie, x as Ve, C as De, y as qe, A as Ge, z as We } from "./markup-DZcvFR50.js";
16
+ import { a as Kt, b as Pt, i as H, I as Ft, c as Ot, d as U, s as St, e as Qt, f as M, g as V, h as Jt, t as Mt, j as ht, m as $, k as Xt, l as xt, S as Yt, n as Tt, o as Lt, V as Zt, p as te, q as ee, r as se, u as re } from "./markup-BJffA2Ls.js";
17
+ import { v as je, w as Ce, B as De, x as Ie, C as Ve, y as qe, A as Ge, D as We, z as Ae, E as He } from "./markup-BJffA2Ls.js";
18
18
  function Te(a) {
19
19
  return function() {
20
20
  if (arguments.length === 1)
@@ -80,29 +80,29 @@ function jt(a, t, e = {}) {
80
80
  continue t;
81
81
  const b = [];
82
82
  e: for (let h = 0; h < l.length; h++) {
83
- const x = r[h], k = l[h];
84
- if (x == null && k.type !== 3)
83
+ const x = r[h], E = l[h];
84
+ if (x == null && E.type !== 3)
85
85
  continue t;
86
- switch (k.type) {
86
+ switch (E.type) {
87
87
  case 1:
88
- if (k.name.toLowerCase() === x.toLowerCase()) {
89
- b.push(k);
88
+ if (E.name.toLowerCase() === x.toLowerCase()) {
89
+ b.push(E);
90
90
  break;
91
91
  } else
92
92
  continue t;
93
93
  case 2:
94
- b.push({ ...k, value: x });
94
+ b.push({ ...E, value: x });
95
95
  break;
96
96
  case 3:
97
- b.push({ ...k, value: r.slice(h).join("/") });
97
+ b.push({ ...E, value: r.slice(h).join("/") });
98
98
  break e;
99
99
  case 4:
100
100
  if (isNaN(Number(x)))
101
101
  continue t;
102
- b.push({ ...k, value: Number(x) });
102
+ b.push({ ...E, value: Number(x) });
103
103
  break;
104
104
  default:
105
- throw new Error(`Unknown fragment type: ${k.type}`);
105
+ throw new Error(`Unknown fragment type: ${E.type}`);
106
106
  }
107
107
  }
108
108
  const v = {};
@@ -159,21 +159,43 @@ function ie(a) {
159
159
  }
160
160
  return e;
161
161
  }
162
+ const oe = /(noopener|noreferrer) (noopener|noreferrer)/, le = /^[\w-_]+:/;
163
+ function ce(a, t, e = window) {
164
+ function s(r) {
165
+ return !r || r === a ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
166
+ }
167
+ function n(r) {
168
+ if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
169
+ return;
170
+ const o = s(r.target);
171
+ o && (e.location.protocol !== o.protocol || e.location.hostname !== o.hostname || e.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && oe.test(o.getAttribute("rel")) || le.test(o.getAttribute("href")) || (r.preventDefault(), t(o)));
172
+ }
173
+ return a.addEventListener("click", n), function() {
174
+ a.removeEventListener("click", n);
175
+ };
176
+ }
177
+ function he(a, t) {
178
+ for (const e in t) {
179
+ const s = t[e].toString();
180
+ a = a.replace(`{${e}}`, s).replace(`{#${e}}`, s);
181
+ }
182
+ return a;
183
+ }
162
184
  function Le(a) {
163
- return new ce(a);
185
+ return new de(a);
164
186
  }
165
- const Ct = Symbol.for("DollaRouterMountMethod"), It = Symbol.for("DollaRouterUnmountMethod");
187
+ const Ct = Symbol.for("DollaRouterMountMethod"), Dt = Symbol.for("DollaRouterUnmountMethod");
166
188
  function gt(a) {
167
189
  return (a == null ? void 0 : a[Ft]) === !0;
168
190
  }
169
- async function oe(a, t) {
191
+ async function ue(a, t) {
170
192
  return a[Ct](t);
171
193
  }
172
- async function le(a) {
173
- return a[It]();
194
+ async function fe(a) {
195
+ return a[Dt]();
174
196
  }
175
- var Nt, J, S, ft, T, G, X, j, C, L, m, Vt, Dt, qt, B, Gt, yt, bt;
176
- class ce {
197
+ var Nt, J, S, ft, T, G, X, j, C, L, m, It, Vt, qt, B, Gt, yt, bt;
198
+ class de {
177
199
  constructor(t) {
178
200
  u(this, m);
179
201
  w(this, Nt, !0);
@@ -237,13 +259,13 @@ class ce {
237
259
  window.addEventListener("popstate", e), i(this, C).push(() => window.removeEventListener("popstate", e));
238
260
  const s = t.getRootElement();
239
261
  i(this, C).push(
240
- fe(s, (n) => {
262
+ ce(s, (n) => {
241
263
  let r = n.getAttribute("href");
242
264
  i(this, S).info("intercepted click on <a> tag", n), this.go(r);
243
265
  })
244
266
  ), i(this, S).info("will intercept clicks on <a> tags within root element", s), d(this, X, !0), await f(this, m, B).call(this);
245
267
  }
246
- async [It]() {
268
+ async [Dt]() {
247
269
  for (const t of i(this, C))
248
270
  t();
249
271
  d(this, C, []);
@@ -269,13 +291,13 @@ class ce {
269
291
  */
270
292
  go(t, e = {}) {
271
293
  let s;
272
- Array.isArray(t) ? s = z(t) : s = t.toString(), s = ut(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, m, Dt).call(this, s) : f(this, m, Vt).call(this, s);
294
+ Array.isArray(t) ? s = z(t) : s = t.toString(), s = ut(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, m, Vt).call(this, s) : f(this, m, It).call(this, s);
273
295
  }
274
296
  }
275
- J = new WeakMap(), S = new WeakMap(), ft = new WeakMap(), T = new WeakMap(), G = new WeakMap(), X = new WeakMap(), j = new WeakMap(), C = new WeakMap(), L = new WeakMap(), m = new WeakSet(), Vt = function(t, e) {
297
+ J = new WeakMap(), S = new WeakMap(), ft = new WeakMap(), T = new WeakMap(), G = new WeakMap(), X = new WeakMap(), j = new WeakMap(), C = new WeakMap(), L = new WeakMap(), m = new WeakSet(), It = function(t, e) {
276
298
  var s;
277
299
  (s = i(this, S)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, j) ? "/#" + t : t), f(this, m, B).call(this, t);
278
- }, Dt = function(t, e) {
300
+ }, Vt = function(t, e) {
279
301
  var s;
280
302
  (s = i(this, S)) == null || s.info("(replace)", t), window.history.replaceState(e, "", i(this, j) ? "/#" + t : t), f(this, m, B).call(this, t);
281
303
  }, qt = function() {
@@ -330,7 +352,7 @@ Gt = function(t, e) {
330
352
  }), n != null) {
331
353
  let r;
332
354
  if (M(n))
333
- r = de(n, s.params);
355
+ r = he(n, s.params);
334
356
  else if (H(n)) {
335
357
  const o = {
336
358
  path: s.path,
@@ -356,7 +378,7 @@ Gt = function(t, e) {
356
378
  * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
357
379
  */
358
380
  bt = function(t, e = [], s = []) {
359
- if (!D(t) || !M(t.path))
381
+ if (!V(t) || !M(t.path))
360
382
  throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${t}`);
361
383
  if (t.redirect && t.routes)
362
384
  throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
@@ -398,28 +420,6 @@ bt = function(t, e = [], s = []) {
398
420
  });
399
421
  return r;
400
422
  };
401
- const he = /(noopener|noreferrer) (noopener|noreferrer)/, ue = /^[\w-_]+:/;
402
- function fe(a, t, e = window) {
403
- function s(r) {
404
- return !r || r === a ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
405
- }
406
- function n(r) {
407
- if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
408
- return;
409
- const o = s(r.target);
410
- o && (e.location.protocol !== o.protocol || e.location.hostname !== o.hostname || e.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && he.test(o.getAttribute("rel")) || ue.test(o.getAttribute("href")) || (r.preventDefault(), t(o)));
411
- }
412
- return a.addEventListener("click", n), function() {
413
- a.removeEventListener("click", n);
414
- };
415
- }
416
- function de(a, t) {
417
- for (const e in t) {
418
- const s = t[e].toString();
419
- a = a.replace(`{${e}}`, s).replace(`{#${e}}`, s);
420
- }
421
- return a;
422
- }
423
423
  function me(a) {
424
424
  for (const t of a)
425
425
  if (t.meta.redirect) {
@@ -437,11 +437,11 @@ function me(a) {
437
437
  }
438
438
  class pe extends Error {
439
439
  }
440
- var I, dt, E, _;
440
+ var D, dt, k, _;
441
441
  class we {
442
442
  constructor() {
443
- u(this, E);
444
- u(this, I, []);
443
+ u(this, k);
444
+ u(this, D, []);
445
445
  u(this, dt, ge());
446
446
  }
447
447
  /**
@@ -451,41 +451,41 @@ class we {
451
451
  * @param middleware - A middleware function that will intercept requests.
452
452
  */
453
453
  use(t) {
454
- return i(this, I).push(t), () => {
455
- i(this, I).splice(i(this, I).indexOf(t), 1);
454
+ return i(this, D).push(t), () => {
455
+ i(this, D).splice(i(this, D).indexOf(t), 1);
456
456
  };
457
457
  }
458
458
  async get(t, e) {
459
- return f(this, E, _).call(this, "get", t, e);
459
+ return f(this, k, _).call(this, "get", t, e);
460
460
  }
461
461
  async put(t, e) {
462
- return f(this, E, _).call(this, "put", t, e);
462
+ return f(this, k, _).call(this, "put", t, e);
463
463
  }
464
464
  async patch(t, e) {
465
- return f(this, E, _).call(this, "patch", t, e);
465
+ return f(this, k, _).call(this, "patch", t, e);
466
466
  }
467
467
  async post(t, e) {
468
- return f(this, E, _).call(this, "post", t, e);
468
+ return f(this, k, _).call(this, "post", t, e);
469
469
  }
470
470
  async delete(t, e) {
471
- return f(this, E, _).call(this, "delete", t, e);
471
+ return f(this, k, _).call(this, "delete", t, e);
472
472
  }
473
473
  async head(t, e) {
474
- return f(this, E, _).call(this, "head", t, e);
474
+ return f(this, k, _).call(this, "head", t, e);
475
475
  }
476
476
  async options(t, e) {
477
- return f(this, E, _).call(this, "options", t, e);
477
+ return f(this, k, _).call(this, "options", t, e);
478
478
  }
479
479
  async trace(t, e) {
480
- return f(this, E, _).call(this, "trace", t, e);
480
+ return f(this, k, _).call(this, "trace", t, e);
481
481
  }
482
482
  }
483
- I = new WeakMap(), dt = new WeakMap(), E = new WeakSet(), _ = async function(t, e, s) {
483
+ D = new WeakMap(), dt = new WeakMap(), k = new WeakSet(), _ = async function(t, e, s) {
484
484
  return new ve({
485
485
  ...s,
486
486
  method: t,
487
487
  uri: e,
488
- middleware: i(this, I),
488
+ middleware: i(this, D),
489
489
  fetch: i(this, dt)
490
490
  }).fetch();
491
491
  };
@@ -521,7 +521,7 @@ class be {
521
521
  t.forEach((e, s) => {
522
522
  this.headers.set(s, e);
523
523
  });
524
- else if (D(t))
524
+ else if (V(t))
525
525
  for (const e in t) {
526
526
  const s = t[e];
527
527
  s instanceof Date ? this.headers.set(e, s.toISOString()) : s != null && this.headers.set(e, String(s));
@@ -535,7 +535,7 @@ class be {
535
535
  t.forEach((e, s) => {
536
536
  this.url.searchParams.set(s, e);
537
537
  });
538
- else if (D(t))
538
+ else if (V(t))
539
539
  for (const e in t) {
540
540
  const s = t[e];
541
541
  s instanceof Date ? this.url.searchParams.set(e, s.toISOString()) : s != null && this.url.searchParams.set(e, String(s));
@@ -569,7 +569,7 @@ class ve {
569
569
  async _handler() {
570
570
  let t;
571
571
  const e = this._request;
572
- !e.headers.has("content-type") && D(e.body) ? (e.headers.set("content-type", "application/json"), t = JSON.stringify(e.body)) : t = e.body;
572
+ !e.headers.has("content-type") && V(e.body) ? (e.headers.set("content-type", "application/json"), t = JSON.stringify(e.body)) : t = e.body;
573
573
  const s = await this._fetch(e.url.toString(), {
574
574
  method: e.method,
575
575
  headers: e.headers,
@@ -587,7 +587,7 @@ class ve {
587
587
  }
588
588
  }
589
589
  var mt, W, q, vt, Wt;
590
- class ke {
590
+ class Ee {
591
591
  constructor(t, e) {
592
592
  u(this, q);
593
593
  w(this, "dolla");
@@ -599,16 +599,16 @@ class ke {
599
599
  async load() {
600
600
  let t;
601
601
  if (!i(this, mt)) {
602
- if (D(this.config.strings))
602
+ if (V(this.config.strings))
603
603
  t = this.config.strings;
604
604
  else if (H(this.config.fetch)) {
605
- if (t = await this.config.fetch(), !D(t))
605
+ if (t = await this.config.fetch(), !V(t))
606
606
  throw new Error(`Fetch function did not return an object of language strings: ${t}`);
607
607
  } else if (M(this.config.path)) {
608
608
  const e = await fetch(this.config.path);
609
609
  if (e.ok) {
610
610
  const s = await e.json();
611
- if (D(s))
611
+ if (V(s))
612
612
  t = s;
613
613
  else
614
614
  throw new Error(
@@ -699,8 +699,8 @@ mt = new WeakMap(), W = new WeakMap(), q = new WeakSet(), vt = function(t, e = [
699
699
  }
700
700
  return o === 0 && n.length > 0 && s.segments.push({ type: 0, text: n }), s;
701
701
  };
702
- var Y, N, g, Z, tt, et, R, y, At, kt, Et, Rt, Ht;
703
- class Ee {
702
+ var Y, N, g, Z, tt, et, R, y, At, Et, kt, Rt, Ht;
703
+ class ke {
704
704
  constructor(t) {
705
705
  u(this, y);
706
706
  u(this, Y);
@@ -710,7 +710,7 @@ class Ee {
710
710
  u(this, tt, /* @__PURE__ */ new Map());
711
711
  u(this, et, "auto");
712
712
  u(this, R, Ot(""));
713
- d(this, Y, t), d(this, N, t.createLogger("Dolla.i18n")), this.addFormat("number", (e, s, n) => f(this, y, kt).call(this, Number(s), n)), this.addFormat("datetime", (e, s, n) => f(this, y, Et).call(this, s, n)), this.addFormat("list", (e, s, n) => f(this, y, Rt).call(this, s, n)), t.beforeMount(async () => {
713
+ d(this, Y, t), d(this, N, t.createLogger("Dolla.i18n")), this.addFormat("number", (e, s, n) => f(this, y, Et).call(this, Number(s), n)), this.addFormat("datetime", (e, s, n) => f(this, y, kt).call(this, s, n)), this.addFormat("list", (e, s, n) => f(this, y, Rt).call(this, s, n)), t.beforeMount(async () => {
714
714
  i(this, g).size > 0 && await this.setLocale(i(this, et));
715
715
  });
716
716
  }
@@ -722,7 +722,7 @@ class Ee {
722
722
  }
723
723
  setup(t) {
724
724
  if (t.translations.forEach((e) => {
725
- i(this, g).set(e.locale, new ke(e, i(this, Y)));
725
+ i(this, g).set(e.locale, new Ee(e, i(this, Y)));
726
726
  }), t.locale && t.locale !== "auto") {
727
727
  if (!t.translations.some((s) => s.locale === t.locale))
728
728
  throw new Error(`Initial locale '${t.locale}' is not registered in the locales array.`);
@@ -811,7 +811,7 @@ class Ee {
811
811
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
812
812
  */
813
813
  number(t, e) {
814
- return U(() => f(this, y, kt).call(this, ht(t), e));
814
+ return U(() => f(this, y, Et).call(this, ht(t), e));
815
815
  }
816
816
  /**
817
817
  * Formats a date for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -823,7 +823,7 @@ class Ee {
823
823
  * const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
824
824
  */
825
825
  dateTime(t, e) {
826
- return U(() => f(this, y, Et).call(this, ht(t), e));
826
+ return U(() => f(this, y, kt).call(this, ht(t), e));
827
827
  }
828
828
  /**
829
829
  * Formats a list for the current locale. Uses `Intl.ListFormat` under the hood.
@@ -863,19 +863,19 @@ Y = new WeakMap(), N = new WeakMap(), g = new WeakMap(), Z = new WeakMap(), tt =
863
863
  for (const h of v) {
864
864
  const x = i(this, tt).get(h.name);
865
865
  if (x == null) {
866
- const k = new Error(
866
+ const E = new Error(
867
867
  `Failed to load format '${h.name}' when processing '${e}', template: ${o}`
868
868
  );
869
- throw i(this, N).crash(k), k;
869
+ throw i(this, N).crash(E), E;
870
870
  }
871
871
  b = x(t, b, h.options);
872
872
  }
873
873
  c += b;
874
874
  }
875
875
  return c;
876
- }, kt = function(t, e) {
877
- return new Intl.NumberFormat(i(this, R).get(), e).format(t);
878
876
  }, Et = function(t, e) {
877
+ return new Intl.NumberFormat(i(this, R).get(), e).format(t);
878
+ }, kt = function(t, e) {
879
879
  return new Intl.DateTimeFormat(i(this, R).get(), e).format(M(t) ? new Date(t) : t);
880
880
  }, Rt = function(t, e) {
881
881
  return new Intl.ListFormat(i(this, R).get(), e).format(t);
@@ -947,7 +947,7 @@ function $e(a) {
947
947
  $("p", {}, "Please see the browser console for details.")
948
948
  );
949
949
  }
950
- var P, st, F, V, rt, A, nt, at, it, ot, O, lt, ct, pt;
950
+ var P, st, F, I, rt, A, nt, at, it, ot, O, lt, ct, pt;
951
951
  class _e {
952
952
  constructor() {
953
953
  // TODO: Take these off the global Dolla object.
@@ -956,7 +956,7 @@ class _e {
956
956
  u(this, P, !1);
957
957
  u(this, st, "production");
958
958
  u(this, F);
959
- u(this, V);
959
+ u(this, I);
960
960
  u(this, rt, $e);
961
961
  u(this, A);
962
962
  u(this, nt, []);
@@ -978,7 +978,7 @@ class _e {
978
978
  // Registration functions for modules.
979
979
  // All modules will be registered before mount.
980
980
  u(this, pt, []);
981
- this.http = new we(), this.i18n = new Ee(this);
981
+ this.http = new we(), this.i18n = new ke(this);
982
982
  }
983
983
  /**
984
984
  * True when the app is connected to a DOM node and displayed to the user.
@@ -1017,7 +1017,7 @@ class _e {
1017
1017
  * Returns the top level view Dolla is rendering inside the root element. This will return undefined until Dolla.mount() is called.
1018
1018
  */
1019
1019
  getRootView() {
1020
- return i(this, V);
1020
+ return i(this, I);
1021
1021
  }
1022
1022
  provide(t, e) {
1023
1023
  const s = new Yt(t, e);
@@ -1050,7 +1050,7 @@ class _e {
1050
1050
  Lt(HTMLElement, t, "Expected an HTML element or a selector string. Got type: %t, value: %v"), d(this, F, t);
1051
1051
  gt(e) && d(this, A, e);
1052
1052
  const s = gt(e) ? Ut : e, n = $(s);
1053
- d(this, V, this.constructView(n.type, n.props)), await Promise.all(i(this, pt).map((r) => r())), gt(e) && await oe(e, this), await Promise.all(i(this, nt).map((r) => r())), i(this, V).mount(i(this, F)), d(this, P, !0);
1053
+ d(this, I, this.constructView(n.type, n.props)), await Promise.all(i(this, pt).map((r) => r())), gt(e) && await ue(e, this), await Promise.all(i(this, nt).map((r) => r())), i(this, I).mount(i(this, F)), d(this, P, !0);
1054
1054
  for (const r of i(this, O).stores.values())
1055
1055
  r.handleMount();
1056
1056
  for (const r of i(this, at))
@@ -1059,7 +1059,7 @@ class _e {
1059
1059
  async unmount() {
1060
1060
  var t;
1061
1061
  if (i(this, P)) {
1062
- await Promise.all(i(this, it).map((e) => e())), (t = i(this, V)) == null || t.unmount(!1), i(this, A) && await le(i(this, A)), d(this, P, !1);
1062
+ await Promise.all(i(this, it).map((e) => e())), (t = i(this, I)) == null || t.unmount(!1), i(this, A) && await fe(i(this, A)), d(this, P, !1);
1063
1063
  for (const e of i(this, ot))
1064
1064
  e();
1065
1065
  }
@@ -1156,7 +1156,7 @@ class _e {
1156
1156
  return te(ee(i(this, O), t));
1157
1157
  }
1158
1158
  }
1159
- P = new WeakMap(), st = new WeakMap(), F = new WeakMap(), V = new WeakMap(), rt = new WeakMap(), A = new WeakMap(), nt = new WeakMap(), at = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), O = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), pt = new WeakMap();
1159
+ P = new WeakMap(), st = new WeakMap(), F = new WeakMap(), I = new WeakMap(), rt = new WeakMap(), A = new WeakMap(), nt = new WeakMap(), at = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), O = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), pt = new WeakMap();
1160
1160
  function Se() {
1161
1161
  if (typeof window < "u" && window.console)
1162
1162
  return window.console;
@@ -1176,15 +1176,17 @@ export {
1176
1176
  ht as get,
1177
1177
  Ce as getTracked,
1178
1178
  Pe as http,
1179
- Ie as list,
1179
+ De as list,
1180
1180
  $ as markup,
1181
- Ve as peek,
1182
- De as portal,
1181
+ Ie as peek,
1182
+ Ve as portal,
1183
1183
  Te as ref,
1184
1184
  qe as set,
1185
1185
  St as shallowEqual,
1186
1186
  Ge as strictEqual,
1187
1187
  Ne as t,
1188
- We as untrack
1188
+ We as unless,
1189
+ Ae as untrack,
1190
+ He as when
1189
1191
  };
1190
1192
  //# sourceMappingURL=index.js.map