@manyducks.co/dolla 2.0.0-alpha.32 → 2.0.0-alpha.34

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/index.js CHANGED
@@ -3,8 +3,8 @@ var At = (o) => {
3
3
  throw TypeError(o);
4
4
  };
5
5
  var fe = (o, t, e) => t in o ? ue(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
- var d = (o, t, e) => fe(o, typeof t != "symbol" ? t + "" : t, e), Pt = (o, t, e) => t.has(o) || At("Cannot " + e);
7
- var i = (o, t, e) => (Pt(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ? At("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), m = (o, t, e, s) => (Pt(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e), f = (o, t, e) => (Pt(o, t, "access private method"), e);
6
+ var d = (o, t, e) => fe(o, typeof t != "symbol" ? t + "" : t, e), Nt = (o, t, e) => t.has(o) || At("Cannot " + e);
7
+ var i = (o, t, e) => (Nt(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ? At("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), m = (o, t, e, s) => (Nt(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e), f = (o, t, e) => (Nt(o, t, "access private method"), e);
8
8
  var st = (o, t, e, s) => ({
9
9
  set _(n) {
10
10
  m(o, t, n, e);
@@ -13,8 +13,8 @@ var st = (o, t, e, s) => ({
13
13
  return i(o, t, s);
14
14
  }
15
15
  });
16
- import { a as Zt, b as de, i as tt, I as te, c as me, d as Wt, e as x, s as Gt, f as v, g as et, P as ee, h as we, t as Bt, j as Ht, k as pe, l as zt, p as ge, m as Kt, S as ye, n as be, o as $e, q as Ee, r as ve, u as ke, C as Re, v as Qt, w as Jt, x as Se, y as vt, z as kt, V as _e, A as Le, B as Me, D as xe } from "./markup-C-1VlVZi.js";
17
- import { F as ls, G as hs, E as cs } from "./markup-C-1VlVZi.js";
16
+ import { a as Zt, b as de, i as tt, I as te, c as me, d as Wt, e as x, s as Gt, f as E, g as et, P as ee, h as we, t as Bt, j as Ht, k as pe, l as zt, p as ge, m as Kt, S as ye, n as be, o as $e, q as ve, r as Ee, u as ke, C as Re, v as Qt, w as Jt, x as _e, y as Et, z as kt, V as Se, A as Le, B as Me, D as xe } from "./markup-B3FV_fq9.js";
17
+ import { F as ls, G as hs, E as cs } from "./markup-B3FV_fq9.js";
18
18
  function nt(o) {
19
19
  return Zt(o, "Expected `path` to be a string. Got type: %t, value: %v"), o.split("/").map((t) => t.trim()).filter((t) => t !== "");
20
20
  }
@@ -66,7 +66,7 @@ function se(o, t, e = {}) {
66
66
  const { fragments: h } = c;
67
67
  if (!(((a = h[h.length - 1]) == null ? void 0 : a.type) === 3) && h.length !== r.length || e.willMatch && !e.willMatch(c))
68
68
  continue t;
69
- const E = [];
69
+ const v = [];
70
70
  e: for (let u = 0; u < h.length; u++) {
71
71
  const F = r[u], R = h[u];
72
72
  if (F == null && R.type !== 3)
@@ -74,30 +74,30 @@ function se(o, t, e = {}) {
74
74
  switch (R.type) {
75
75
  case 1:
76
76
  if (R.name.toLowerCase() === F.toLowerCase()) {
77
- E.push(R);
77
+ v.push(R);
78
78
  break;
79
79
  } else
80
80
  continue t;
81
81
  case 2:
82
- E.push({ ...R, value: F });
82
+ v.push({ ...R, value: F });
83
83
  break;
84
84
  case 3:
85
- E.push({ ...R, value: r.slice(u).join("/") });
85
+ v.push({ ...R, value: r.slice(u).join("/") });
86
86
  break e;
87
87
  case 4:
88
88
  if (isNaN(Number(F)))
89
89
  continue t;
90
- E.push({ ...R, value: Number(F) });
90
+ v.push({ ...R, value: Number(F) });
91
91
  break;
92
92
  default:
93
93
  throw new Error(`Unknown fragment type: ${R.type}`);
94
94
  }
95
95
  }
96
96
  const k = {};
97
- for (const u of E)
97
+ for (const u of v)
98
98
  u.type === 2 && (k[u.name] = decodeURIComponent(u.value)), u.type === 4 && (k[u.name] = u.value), u.type === 3 && (k.wildcard = "/" + decodeURIComponent(u.value));
99
99
  return {
100
- path: "/" + E.map((u) => u.value).join("/"),
100
+ path: "/" + v.map((u) => u.value).join("/"),
101
101
  pattern: "/" + h.map((u) => u.type === 2 ? `{${u.name}}` : u.type === 4 ? `{#${u.name}}` : u.name).join("/"),
102
102
  params: k,
103
103
  query: De(n),
@@ -123,7 +123,7 @@ function Fe(o) {
123
123
  const r = (a, c) => a.fragments.length > c.fragments.length ? -1 : 1;
124
124
  return t.sort(r), e.sort(r), s.sort(r), n.sort(r), [...t, ...e, ...s, ...n];
125
125
  }
126
- function Pe(o) {
126
+ function Ne(o) {
127
127
  const t = nt(o), e = [];
128
128
  for (let s = 0; s < t.length; s++) {
129
129
  const n = t[s];
@@ -148,27 +148,27 @@ function Pe(o) {
148
148
  return e;
149
149
  }
150
150
  function ss(o) {
151
- return new Ne(o);
151
+ return new Oe(o);
152
152
  }
153
153
  const re = Symbol.for("DollaRouterMountMethod"), ne = Symbol.for("DollaRouterUnmountMethod");
154
- function Tt(o) {
154
+ function Pt(o) {
155
155
  return (o == null ? void 0 : o[te]) === !0;
156
156
  }
157
- async function Te(o, t) {
157
+ async function Pe(o, t) {
158
158
  return o[re](t);
159
159
  }
160
- async function Oe(o) {
160
+ async function Te(o) {
161
161
  return o[ne]();
162
162
  }
163
- var Yt, K, L, _t, P, Q, it, I, q, T, at, p, Ot, ie, ae, rt, Nt, oe, Ut;
164
- class Ne {
163
+ var Yt, K, L, St, N, Q, it, I, q, P, at, p, Tt, ie, ae, rt, Ot, oe, Ut;
164
+ class Oe {
165
165
  constructor(t) {
166
166
  l(this, p);
167
167
  d(this, Yt, !0);
168
168
  l(this, K);
169
169
  l(this, L);
170
- l(this, _t, 0);
171
- l(this, P, []);
170
+ l(this, St, 0);
171
+ l(this, N, []);
172
172
  l(this, Q, []);
173
173
  l(this, it, !1);
174
174
  /**
@@ -180,7 +180,7 @@ class Ne {
180
180
  /**
181
181
  * The current match object.
182
182
  */
183
- l(this, T);
183
+ l(this, P);
184
184
  l(this, at);
185
185
  /**
186
186
  * The currently matched route pattern, if any.
@@ -198,11 +198,11 @@ class Ne {
198
198
  * The current query params. Changes to this object will be reflected in the URL.
199
199
  */
200
200
  d(this, "$query");
201
- me(t, "Options must be an object. Got: %t"), [st(this, T)._, st(this, at)._] = Wt(), this.$pattern = x([i(this, T)], (e) => e == null ? void 0 : e.pattern), this.$path = x([i(this, T)], (e) => (e == null ? void 0 : e.path) ?? window.location.pathname), this.$params = x([i(this, T)], (e) => (e == null ? void 0 : e.params) ?? {}, { equals: Gt }), this.$query = x([i(this, T)], (e) => (e == null ? void 0 : e.query) ?? {}, { equals: Gt }), t.hash && m(this, I, !0), m(this, Q, Fe(
201
+ me(t, "Options must be an object. Got: %t"), [st(this, P)._, st(this, at)._] = Wt(), this.$pattern = x([i(this, P)], (e) => e == null ? void 0 : e.pattern), this.$path = x([i(this, P)], (e) => (e == null ? void 0 : e.path) ?? window.location.pathname), this.$params = x([i(this, P)], (e) => (e == null ? void 0 : e.params) ?? {}, { equals: Gt }), this.$query = x([i(this, P)], (e) => (e == null ? void 0 : e.query) ?? {}, { equals: Gt }), t.hash && m(this, I, !0), m(this, Q, Fe(
202
202
  t.routes.flatMap((e) => f(this, p, Ut).call(this, e)).map((e) => ({
203
203
  pattern: e.pattern,
204
204
  meta: e.meta,
205
- fragments: Pe(e.pattern)
205
+ fragments: Ne(e.pattern)
206
206
  }))
207
207
  )), Ie(i(this, Q));
208
208
  }
@@ -216,7 +216,7 @@ class Ne {
216
216
  i(this, q).push(
217
217
  je(s, (n) => {
218
218
  let r = n.getAttribute("href");
219
- i(this, L).info("intercepted click on <a> tag", n), /^https?:\/\/|^\//.test(r) || (r = z([window.location.pathname, r])), f(this, p, Ot).call(this, r);
219
+ i(this, L).info("intercepted click on <a> tag", n), /^https?:\/\/|^\//.test(r) || (r = z([window.location.pathname, r])), f(this, p, Tt).call(this, r);
220
220
  })
221
221
  ), i(this, L).info("will intercept clicks on <a> tags within root element", s), m(this, it, !0), await f(this, p, rt).call(this);
222
222
  }
@@ -248,10 +248,10 @@ class Ne {
248
248
  if (i(this, K) == null)
249
249
  throw new Error("Routa methods won't work until you register it: Dolla.use(Routa, { /* ...options */ })");
250
250
  let s;
251
- Array.isArray(t) ? s = z(t) : s = t.toString(), s = Rt(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, p, ie).call(this, s) : f(this, p, Ot).call(this, s);
251
+ Array.isArray(t) ? s = z(t) : s = t.toString(), s = Rt(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, p, ie).call(this, s) : f(this, p, Tt).call(this, s);
252
252
  }
253
253
  }
254
- K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), I = new WeakMap(), q = new WeakMap(), T = new WeakMap(), at = new WeakMap(), p = new WeakSet(), Ot = function(t, e) {
254
+ K = new WeakMap(), L = new WeakMap(), St = new WeakMap(), N = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), I = new WeakMap(), q = new WeakMap(), P = new WeakMap(), at = new WeakMap(), p = new WeakSet(), Tt = function(t, e) {
255
255
  var s;
256
256
  (s = i(this, L)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, I) ? "/#" + t : t), f(this, p, rt).call(this, t);
257
257
  }, ie = function(t, e) {
@@ -261,7 +261,7 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
261
261
  return i(this, I) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
262
262
  }, rt = async function(t) {
263
263
  var c;
264
- const e = i(this, L), s = (c = i(this, K)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, p, ae).call(this), { match: r, journey: a } = await f(this, p, Nt).call(this, n);
264
+ const e = i(this, L), s = (c = i(this, K)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, p, ae).call(this), { match: r, journey: a } = await f(this, p, Ot).call(this, n);
265
265
  for (const h of a)
266
266
  switch (h.kind) {
267
267
  case "match":
@@ -280,7 +280,7 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
280
280
  } else
281
281
  i(this, it) && e.crash(new qe(`Failed to match route '${n.pathname}'`));
282
282
  return { match: r, journey: a };
283
- }, Nt = async function(t, e = []) {
283
+ }, Ot = async function(t, e = []) {
284
284
  const s = se(i(this, Q), t.pathname);
285
285
  if (!s)
286
286
  return {
@@ -295,7 +295,7 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
295
295
  }
296
296
  }), n != null) {
297
297
  let r;
298
- if (v(n))
298
+ if (E(n))
299
299
  r = Ve(n, s.params);
300
300
  else if (tt(n)) {
301
301
  const a = {
@@ -304,12 +304,12 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
304
304
  params: s.params,
305
305
  query: s.query
306
306
  };
307
- if (r = await n(a), !v(r))
307
+ if (r = await n(a), !E(r))
308
308
  throw new Error("Redirect function must return a path to redirect to.");
309
309
  r.startsWith("/") || (r = Rt(s.path, r));
310
310
  } else
311
311
  throw new TypeError("Redirect must either be a path string or a function.");
312
- return f(this, p, Nt).call(this, new URL(r, window.location.origin), [
312
+ return f(this, p, Ot).call(this, new URL(r, window.location.origin), [
313
313
  ...e,
314
314
  { kind: "redirect", message: `redirecting '${s.path}' -> '${r}'` }
315
315
  ]);
@@ -321,11 +321,11 @@ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q =
321
321
  oe = function(t, e) {
322
322
  const s = e.meta.layers;
323
323
  for (let n = 0; n < s.length; n++) {
324
- const r = s[n], a = i(this, P)[n];
324
+ const r = s[n], a = i(this, N)[n];
325
325
  if ((a == null ? void 0 : a.id) !== r.id) {
326
- m(this, P, i(this, P).slice(0, n)), a == null || a.view.unmount();
327
- const c = i(this, P).at(-1), w = ((c == null ? void 0 : c.view) ?? t).setChildView(r.view);
328
- i(this, P).push({ id: r.id, view: w });
326
+ m(this, N, i(this, N).slice(0, n)), a == null || a.view.unmount();
327
+ const c = i(this, N).at(-1), w = ((c == null ? void 0 : c.view) ?? t).setChildView(r.view);
328
+ i(this, N).push({ id: r.id, view: w });
329
329
  }
330
330
  }
331
331
  }, /**
@@ -335,7 +335,7 @@ oe = function(t, e) {
335
335
  * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
336
336
  */
337
337
  Ut = function(t, e = [], s = []) {
338
- if (!et(t) || !v(t.path))
338
+ if (!et(t) || !E(t.path))
339
339
  throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${t}`);
340
340
  if (t.redirect && t.routes)
341
341
  throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
@@ -350,7 +350,7 @@ Ut = function(t, e = [], s = []) {
350
350
  const r = [];
351
351
  if (t.redirect) {
352
352
  let h = t.redirect;
353
- return v(h) && (h = Rt(z(n), h), h.startsWith("/") || (h = "/" + h)), r.push({
353
+ return E(h) && (h = Rt(z(n), h), h.startsWith("/") || (h = "/" + h)), r.push({
354
354
  pattern: "/" + z([...n, ...nt(t.path)]),
355
355
  meta: {
356
356
  redirect: h
@@ -362,7 +362,7 @@ Ut = function(t, e = [], s = []) {
362
362
  a = t.view;
363
363
  else if (t.view)
364
364
  throw new TypeError(`Route '${t.path}' expected a view function or undefined. Got: ${t.view}`);
365
- const c = { id: st(this, _t)._++, view: a };
365
+ const c = { id: st(this, St)._++, view: a };
366
366
  if (t.routes)
367
367
  for (const h of t.routes)
368
368
  r.push(...f(this, p, Ut).call(this, h, [...e, t], [...s, c]));
@@ -403,7 +403,7 @@ function Ie(o) {
403
403
  for (const t of o)
404
404
  if (t.meta.redirect) {
405
405
  let e;
406
- if (!tt(t.meta.redirect)) if (v(t.meta.redirect)) {
406
+ if (!tt(t.meta.redirect)) if (E(t.meta.redirect)) {
407
407
  if (e = t.meta.redirect, !se(o, e, {
408
408
  willMatch(n) {
409
409
  return n !== t;
@@ -416,10 +416,10 @@ function Ie(o) {
416
416
  }
417
417
  class qe extends Error {
418
418
  }
419
- var W, Lt, Mt, ot, S, _;
419
+ var W, Lt, Mt, ot, _, S;
420
420
  class We {
421
421
  constructor(t) {
422
- l(this, S);
422
+ l(this, _);
423
423
  l(this, W, []);
424
424
  l(this, Lt, Ae());
425
425
  l(this, Mt);
@@ -438,31 +438,31 @@ class We {
438
438
  };
439
439
  }
440
440
  async get(t, e) {
441
- return f(this, S, _).call(this, "get", t, e);
441
+ return f(this, _, S).call(this, "get", t, e);
442
442
  }
443
443
  async put(t, e) {
444
- return f(this, S, _).call(this, "put", t, e);
444
+ return f(this, _, S).call(this, "put", t, e);
445
445
  }
446
446
  async patch(t, e) {
447
- return f(this, S, _).call(this, "patch", t, e);
447
+ return f(this, _, S).call(this, "patch", t, e);
448
448
  }
449
449
  async post(t, e) {
450
- return f(this, S, _).call(this, "post", t, e);
450
+ return f(this, _, S).call(this, "post", t, e);
451
451
  }
452
452
  async delete(t, e) {
453
- return f(this, S, _).call(this, "delete", t, e);
453
+ return f(this, _, S).call(this, "delete", t, e);
454
454
  }
455
455
  async head(t, e) {
456
- return f(this, S, _).call(this, "head", t, e);
456
+ return f(this, _, S).call(this, "head", t, e);
457
457
  }
458
458
  async options(t, e) {
459
- return f(this, S, _).call(this, "options", t, e);
459
+ return f(this, _, S).call(this, "options", t, e);
460
460
  }
461
461
  async trace(t, e) {
462
- return f(this, S, _).call(this, "trace", t, e);
462
+ return f(this, _, S).call(this, "trace", t, e);
463
463
  }
464
464
  }
465
- W = new WeakMap(), Lt = new WeakMap(), Mt = new WeakMap(), ot = new WeakMap(), S = new WeakSet(), _ = async function(t, e, s) {
465
+ W = new WeakMap(), Lt = new WeakMap(), Mt = new WeakMap(), ot = new WeakMap(), _ = new WeakSet(), S = async function(t, e, s) {
466
466
  return new He({
467
467
  ...s,
468
468
  method: t,
@@ -585,7 +585,7 @@ class ze {
585
585
  if (tt(this.config.fetch)) {
586
586
  if (t = await this.config.fetch(), !et(t))
587
587
  throw new Error(`Fetch function did not return an object of language strings: ${t}`);
588
- } else if (v(this.config.path)) {
588
+ } else if (E(this.config.path)) {
589
589
  const e = await fetch(this.config.path);
590
590
  if (e.ok) {
591
591
  const s = await e.json();
@@ -640,7 +640,7 @@ xt = new WeakMap(), J = new WeakMap(), H = new WeakSet(), Ct = function(t, e = [
640
640
  segments: []
641
641
  };
642
642
  let n = "", r = 0, a = 0, c, h, w;
643
- const E = () => {
643
+ const v = () => {
644
644
  c = {
645
645
  type: 1,
646
646
  name: "",
@@ -659,7 +659,7 @@ xt = new WeakMap(), J = new WeakMap(), H = new WeakSet(), Ct = function(t, e = [
659
659
  }
660
660
  switch (a) {
661
661
  case 0:
662
- t[r] === "{" && t[r + 1] === "{" ? (a = 1, r += 2, n.length > 0 && (s.segments.push({ type: 0, text: n }), n = ""), E()) : (n += t[r], r++);
662
+ t[r] === "{" && t[r + 1] === "{" ? (a = 1, r += 2, n.length > 0 && (s.segments.push({ type: 0, text: n }), n = ""), v()) : (n += t[r], r++);
663
663
  break;
664
664
  case 1:
665
665
  t[r] === "|" ? (a = 2, r += 1, c.name = n, n = "", k()) : t[r] === "}" && t[r + 1] === "}" ? (a = 0, r += 2, c.name = n, n = "", s.segments.push(c)) : (n += t[r], r++);
@@ -680,19 +680,19 @@ xt = new WeakMap(), J = new WeakMap(), H = new WeakSet(), Ct = function(t, e = [
680
680
  }
681
681
  return a === 0 && n.length > 0 && s.segments.push({ type: 0, text: n }), s;
682
682
  };
683
- var lt, O, b, ht, ct, ut, ft, $, he, jt, Vt, It, ce;
683
+ var lt, T, b, ht, ct, ut, ft, $, he, jt, Vt, It, ce;
684
684
  class Ke {
685
685
  constructor(t) {
686
686
  l(this, $);
687
687
  l(this, lt);
688
- l(this, O);
688
+ l(this, T);
689
689
  l(this, b, /* @__PURE__ */ new Map());
690
690
  l(this, ht, []);
691
691
  l(this, ct, /* @__PURE__ */ new Map());
692
692
  l(this, ut, "auto");
693
693
  d(this, "$locale");
694
694
  l(this, ft);
695
- m(this, lt, t), m(this, O, t.createLogger("Dolla.i18n"));
695
+ m(this, lt, t), m(this, T, t.createLogger("Dolla.i18n"));
696
696
  const [e, s] = Wt();
697
697
  this.$locale = e, m(this, ft, s), this.addFormat("number", (n, r, a) => f(this, $, jt).call(this, Number(r), a)), this.addFormat("datetime", (n, r, a) => f(this, $, Vt).call(this, r, a)), this.addFormat("list", (n, r, a) => f(this, $, It).call(this, r, a)), t.beforeMount(async () => {
698
698
  i(this, b).size > 0 && await this.setLocale(i(this, ut));
@@ -709,7 +709,7 @@ class Ke {
709
709
  throw new Error(`Initial locale '${t.locale}' is not registered in the locales array.`);
710
710
  m(this, ut, t.locale);
711
711
  }
712
- i(this, O).info(
712
+ i(this, T).info(
713
713
  `${i(this, b).size} language${i(this, b).size === 1 ? "" : "s"} supported: '${[...i(this, b).keys()].join("', '")}'`
714
714
  );
715
715
  }
@@ -734,9 +734,9 @@ class Ke {
734
734
  throw new Error(`Locale '${t}' has no translation.`);
735
735
  const s = i(this, b).get(e);
736
736
  try {
737
- await s.load(), m(this, ht, []), i(this, ft).call(this, e), i(this, O).info("set language to " + e);
737
+ await s.load(), m(this, ht, []), i(this, ft).call(this, e), i(this, T).info("set language to " + e);
738
738
  } catch (r) {
739
- r instanceof Error && i(this, O).crash(r);
739
+ r instanceof Error && i(this, T).crash(r);
740
740
  }
741
741
  }
742
742
  /**
@@ -824,7 +824,7 @@ class Ke {
824
824
  return x([this.$locale, t], (s, n) => f(this, $, It).call(this, n, e));
825
825
  }
826
826
  }
827
- lt = new WeakMap(), O = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), ft = new WeakMap(), $ = new WeakSet(), he = function(t, e, s) {
827
+ lt = new WeakMap(), T = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), ft = new WeakMap(), $ = new WeakSet(), he = function(t, e, s) {
828
828
  var h;
829
829
  const n = f(this, $, ce).call(this, e, s);
830
830
  if (n) return n;
@@ -843,7 +843,7 @@ lt = new WeakMap(), O = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct
843
843
  if (w.type === 0)
844
844
  c += w.text;
845
845
  else if (w.type === 1) {
846
- let E = Qe(s, w.name);
846
+ let v = Qe(s, w.name);
847
847
  const k = ((h = s.formatOverrides) == null ? void 0 : h[w.name]) ?? [...w.formats];
848
848
  w.name === "count" && k.length === 0 && k.push({ name: "number", options: {} });
849
849
  for (const u of k) {
@@ -852,17 +852,17 @@ lt = new WeakMap(), O = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct
852
852
  const R = new Error(
853
853
  `Failed to load format '${u.name}' when processing '${e}', template: ${a}`
854
854
  );
855
- throw i(this, O).crash(R), R;
855
+ throw i(this, T).crash(R), R;
856
856
  }
857
- E = F(t, E, u.options);
857
+ v = F(t, v, u.options);
858
858
  }
859
- c += E;
859
+ c += v;
860
860
  }
861
861
  return c;
862
862
  }, jt = function(t, e) {
863
863
  return new Intl.NumberFormat(this.$locale.get(), e).format(t);
864
864
  }, Vt = function(t, e) {
865
- return new Intl.DateTimeFormat(this.$locale.get(), e).format(v(t) ? new Date(t) : t);
865
+ return new Intl.DateTimeFormat(this.$locale.get(), e).format(E(t) ? new Date(t) : t);
866
866
  }, It = function(t, e) {
867
867
  return new Intl.ListFormat(this.$locale.get(), e).format(t);
868
868
  }, // relativeTime(): State<string> {
@@ -928,7 +928,7 @@ function Je(o) {
928
928
  </div>
929
929
  `;
930
930
  }
931
- var dt, X, N, A, G, Y, Dt, M, mt, D, qt, St;
931
+ var dt, X, O, A, G, Y, Dt, M, mt, D, qt, _t;
932
932
  class Xe {
933
933
  constructor(t) {
934
934
  l(this, D);
@@ -936,7 +936,7 @@ class Xe {
936
936
  l(this, X);
937
937
  // Keys ensure only the most recent callback queued with a certain key
938
938
  // will be called, keeping DOM operations to a minimum.
939
- l(this, N, /* @__PURE__ */ new Map());
939
+ l(this, O, /* @__PURE__ */ new Map());
940
940
  // All unkeyed writes are run on every batch.
941
941
  l(this, A, []);
942
942
  // All read callbacks are run before updates on every batch.
@@ -968,41 +968,41 @@ class Xe {
968
968
  * Always put DOM mutations in a write callback when possible to help Dolla batch them efficiently.
969
969
  */
970
970
  write(t, e) {
971
- e ? i(this, N).set(e, t) : i(this, A).push(t), f(this, D, qt).call(this);
971
+ e ? i(this, O).set(e, t) : i(this, A).push(t), f(this, D, qt).call(this);
972
972
  }
973
973
  }
974
- dt = new WeakMap(), X = new WeakMap(), N = new WeakMap(), A = new WeakMap(), G = new WeakMap(), Y = new WeakMap(), Dt = new WeakMap(), M = new WeakMap(), mt = new WeakMap(), D = new WeakSet(), qt = function() {
974
+ dt = new WeakMap(), X = new WeakMap(), O = new WeakMap(), A = new WeakMap(), G = new WeakMap(), Y = new WeakMap(), Dt = new WeakMap(), M = new WeakMap(), mt = new WeakMap(), D = new WeakSet(), qt = function() {
975
975
  if (!i(this, Y)) {
976
976
  m(this, Y, !0);
977
977
  const t = i(this, dt).getEnv() === "development";
978
978
  queueMicrotask(() => {
979
- f(this, D, St).call(this, t);
979
+ f(this, D, _t).call(this, t);
980
980
  });
981
981
  }
982
- }, St = function(t = !1) {
982
+ }, _t = function(t = !1) {
983
983
  const e = performance.now();
984
984
  let s = 0;
985
- const n = i(this, G).length + i(this, N).size + i(this, A).length;
985
+ const n = i(this, G).length + i(this, O).size + i(this, A).length;
986
986
  let r = 0;
987
987
  const a = () => (r++, s = performance.now() - e, i(this, Dt) && s > 12 && r < n ? (st(this, M)._++, t && i(this, X).warn(
988
988
  `⚠️ Deferring batch to next frame. Performed ${r} of ${n} batched operation${r === 1 ? "" : "s"} in ${i(this, mt).format(s)} (deferral ${i(this, M)}).`
989
989
  ), requestAnimationFrame(() => {
990
- f(this, D, St).call(this, t);
991
- }), !0) : !1), c = [...i(this, N).entries()];
990
+ f(this, D, _t).call(this, t);
991
+ }), !0) : !1), c = [...i(this, O).entries()];
992
992
  let h, w;
993
993
  for (; w = i(this, G).shift(); )
994
994
  if (w(), a()) return;
995
995
  for ([h, w] of c)
996
- if (w(), i(this, N).delete(h), a()) return;
996
+ if (w(), i(this, O).delete(h), a()) return;
997
997
  for (; w = i(this, A).shift(); )
998
998
  if (w(), a()) return;
999
999
  t && i(this, X)[s > 16 ? "warn" : "info"](
1000
1000
  `${s > 16 ? "⚠️ (>=16ms) " : ""}Executed ${r} operation${r === 1 ? "" : "s"} in ${i(this, mt).format(s)}${i(this, M) > 0 ? ` (after ${i(this, M)} deferral${i(this, M) === 1 ? "" : "s"})` : ""}.`
1001
- ), m(this, M, 0), i(this, G).length || i(this, N).size || i(this, A).length ? queueMicrotask(() => {
1002
- f(this, D, St).call(this, t);
1001
+ ), m(this, M, 0), i(this, G).length || i(this, O).size || i(this, A).length ? queueMicrotask(() => {
1002
+ f(this, D, _t).call(this, t);
1003
1003
  }) : m(this, Y, !1);
1004
1004
  };
1005
- var U, wt, C, B, pt, gt, Z, yt, bt, $t, Et, g, y, j, V, Ft;
1005
+ var U, wt, C, B, pt, gt, Z, yt, bt, $t, vt, g, y, j, V, Ft;
1006
1006
  class Ye {
1007
1007
  constructor() {
1008
1008
  d(this, "batch");
@@ -1020,7 +1020,7 @@ class Ye {
1020
1020
  l(this, yt, []);
1021
1021
  l(this, bt, []);
1022
1022
  l(this, $t, []);
1023
- l(this, Et, []);
1023
+ l(this, vt, []);
1024
1024
  l(this, g, {
1025
1025
  root: this,
1026
1026
  data: {},
@@ -1043,10 +1043,10 @@ class Ye {
1043
1043
  d(this, "createState", Wt);
1044
1044
  d(this, "toState", be);
1045
1045
  d(this, "toValue", $e);
1046
- d(this, "isState", Ee);
1046
+ d(this, "isState", ve);
1047
1047
  d(this, "derive", x);
1048
1048
  d(this, "createWatcher", zt);
1049
- d(this, "createRef", ve);
1049
+ d(this, "createRef", Ee);
1050
1050
  d(this, "isRef", ke);
1051
1051
  this.batch = new Xe(this), this.stats = new ye(this), this.http = new We(this), this.i18n = new Ke(this);
1052
1052
  }
@@ -1108,19 +1108,19 @@ class Ye {
1108
1108
  // return { ...this.#rootElementContext.data };
1109
1109
  // }
1110
1110
  /**
1111
- * Adds a listener to be called when `eventName` is emitted.
1111
+ * Adds a listener to be called when an event with a matching `type` is emitted.
1112
1112
  */
1113
1113
  on(t, e) {
1114
1114
  if (t === "*") {
1115
- const s = (n, r) => {
1116
- e(r);
1115
+ const s = (n, r, ...a) => {
1116
+ e(r, ...a);
1117
1117
  };
1118
1118
  i(this, g).emitter.on(t, s), i(this, V).set(e, s);
1119
1119
  } else
1120
1120
  i(this, g).emitter.on(t, e);
1121
1121
  }
1122
1122
  /**
1123
- * Removes a listener from the list to be called when `eventName` is emitted.
1123
+ * Removes a listener from the list to be called when an event with a matching `type` is emitted.
1124
1124
  */
1125
1125
  off(t, e) {
1126
1126
  if (t === "*") {
@@ -1130,12 +1130,12 @@ class Ye {
1130
1130
  i(this, g).emitter.off(t, e);
1131
1131
  }
1132
1132
  /**
1133
- * Adds a listener to be called when `eventName` is emitted. The listener is immediately removed after being called once.
1133
+ * Adds a listener to be called when an event with a matching `type` is emitted. The listener is immediately removed after being called once.
1134
1134
  */
1135
1135
  once(t, e) {
1136
1136
  if (t === "*") {
1137
- const s = (n, r) => {
1138
- i(this, V).delete(e), e(r);
1137
+ const s = (n, r, ...a) => {
1138
+ i(this, V).delete(e), e(r, ...a);
1139
1139
  };
1140
1140
  i(this, g).emitter.once(t, s), i(this, V).set(e, s);
1141
1141
  } else
@@ -1144,19 +1144,22 @@ class Ye {
1144
1144
  /**
1145
1145
  * Emits a new event to all listeners.
1146
1146
  */
1147
- emit(t, e) {
1148
- return i(this, g).emitter.emit(t, new Re(t, e));
1149
- }
1150
- attachStore(t, e) {
1151
- if (!new xe(t, e).attach(i(this, g))) {
1147
+ emit(t, ...e) {
1148
+ return i(this, g).emitter.emit(t, new Re(t), ...e);
1149
+ }
1150
+ provide(t, e) {
1151
+ const s = new xe(t, e);
1152
+ if (s.attach(i(this, g)))
1153
+ return s.value;
1154
+ {
1152
1155
  let r = t.name ? `'${t.name}'` : "this store";
1153
- console.warn(`An instance of ${r} was already attached to this context.`);
1156
+ return console.warn(`An instance of ${r} was already attached to this context.`), this.use(t);
1154
1157
  }
1155
1158
  }
1156
1159
  /**
1157
1160
  * Gets the nearest instance of a store. Throws an error if the store isn't provided higher in the tree.
1158
1161
  */
1159
- useStore(t) {
1162
+ use(t) {
1160
1163
  if (tt(t)) {
1161
1164
  const e = i(this, g).stores.get(t);
1162
1165
  if (e == null)
@@ -1168,14 +1171,14 @@ class Ye {
1168
1171
  async mount(t, e) {
1169
1172
  if (i(this, U))
1170
1173
  throw new Error("Dolla is already mounted.");
1171
- if (v(t)) {
1174
+ if (E(t)) {
1172
1175
  const r = document.querySelector(t);
1173
1176
  Jt(HTMLElement, r, `Selector '${t}' did not match any element.`), m(this, C, r);
1174
1177
  } else
1175
1178
  Jt(HTMLElement, t, "Expected an HTML element or a selector string. Got type: %t, value: %v"), m(this, C, t);
1176
- Tt(e) && m(this, Z, e);
1177
- const s = Tt(e) ? ee : e, n = Se(s);
1178
- m(this, B, this.constructView(n.type, n.props)), await Promise.all(i(this, Ft).map((r) => r())), Tt(e) && await Te(e, this), await Promise.all(i(this, yt).map((r) => r())), i(this, B).mount(i(this, C)), m(this, U, !0);
1179
+ Pt(e) && m(this, Z, e);
1180
+ const s = Pt(e) ? ee : e, n = _e(s);
1181
+ m(this, B, this.constructView(n.type, n.props)), await Promise.all(i(this, Ft).map((r) => r())), Pt(e) && await Pe(e, this), await Promise.all(i(this, yt).map((r) => r())), i(this, B).mount(i(this, C)), m(this, U, !0);
1179
1182
  for (const r of i(this, g).stores.values())
1180
1183
  r.handleMount();
1181
1184
  for (const r of i(this, bt))
@@ -1184,8 +1187,8 @@ class Ye {
1184
1187
  async unmount() {
1185
1188
  var t;
1186
1189
  if (i(this, U)) {
1187
- await Promise.all(i(this, $t).map((e) => e())), (t = i(this, B)) == null || t.unmount(!1), i(this, gt).stopAll(), i(this, Z) && await Oe(i(this, Z)), m(this, U, !1);
1188
- for (const e of i(this, Et))
1190
+ await Promise.all(i(this, $t).map((e) => e())), (t = i(this, B)) == null || t.unmount(!1), i(this, gt).stopAll(), i(this, Z) && await Te(i(this, Z)), m(this, U, !1);
1191
+ for (const e of i(this, vt))
1189
1192
  e();
1190
1193
  }
1191
1194
  }
@@ -1213,7 +1216,7 @@ class Ye {
1213
1216
  * Registers a `callback` to run after the app is unmounted.
1214
1217
  */
1215
1218
  onUnmount(t) {
1216
- i(this, Et).push(t);
1219
+ i(this, vt).push(t);
1217
1220
  }
1218
1221
  /**
1219
1222
  * Update log type toggles. Values that are not passed will remain unchanged.
@@ -1235,8 +1238,8 @@ class Ye {
1235
1238
  },
1236
1239
  get info() {
1237
1240
  var r;
1238
- if (i(n, y).info === !1 || v(i(n, y).info) && i(n, y).info !== n.getEnv() || !i(r = n, j).call(r, t))
1239
- return vt;
1241
+ if (i(n, y).info === !1 || E(i(n, y).info) && i(n, y).info !== n.getEnv() || !i(r = n, j).call(r, t))
1242
+ return Et;
1240
1243
  {
1241
1244
  let a = `%c${t}`;
1242
1245
  return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.info.bind(
@@ -1251,8 +1254,8 @@ class Ye {
1251
1254
  },
1252
1255
  get log() {
1253
1256
  var r;
1254
- if (i(n, y).log === !1 || v(i(n, y).log) && i(n, y).log !== n.getEnv() || !i(r = n, j).call(r, t))
1255
- return vt;
1257
+ if (i(n, y).log === !1 || E(i(n, y).log) && i(n, y).log !== n.getEnv() || !i(r = n, j).call(r, t))
1258
+ return Et;
1256
1259
  {
1257
1260
  let a = `%c${t}`;
1258
1261
  return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.log.bind(
@@ -1267,8 +1270,8 @@ class Ye {
1267
1270
  },
1268
1271
  get warn() {
1269
1272
  var r;
1270
- if (i(n, y).warn === !1 || v(i(n, y).warn) && i(n, y).warn !== n.getEnv() || !i(r = n, j).call(r, t))
1271
- return vt;
1273
+ if (i(n, y).warn === !1 || E(i(n, y).warn) && i(n, y).warn !== n.getEnv() || !i(r = n, j).call(r, t))
1274
+ return Et;
1272
1275
  {
1273
1276
  let a = `%c${t}`;
1274
1277
  return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.warn.bind(
@@ -1283,8 +1286,8 @@ class Ye {
1283
1286
  },
1284
1287
  get error() {
1285
1288
  var r;
1286
- if (i(n, y).error === !1 || v(i(n, y).error) && i(n, y).error !== n.getEnv() || !i(r = n, j).call(r, t))
1287
- return vt;
1289
+ if (i(n, y).error === !1 || E(i(n, y).error) && i(n, y).error !== n.getEnv() || !i(r = n, j).call(r, t))
1290
+ return Et;
1288
1291
  {
1289
1292
  let a = `%c${t}`;
1290
1293
  return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.error.bind(
@@ -1298,11 +1301,11 @@ class Ye {
1298
1301
  }
1299
1302
  },
1300
1303
  crash(r) {
1301
- throw n.isMounted && (n.unmount(), n.constructView(i(n, pt), {
1304
+ n.isMounted && (n.unmount(), n.constructView(i(n, pt), {
1302
1305
  error: r,
1303
1306
  loggerName: t,
1304
1307
  uid: e == null ? void 0 : e.uid
1305
- }).mount(i(n, C))), r;
1308
+ }).mount(i(n, C)));
1306
1309
  }
1307
1310
  };
1308
1311
  }
@@ -1310,7 +1313,7 @@ class Ye {
1310
1313
  *
1311
1314
  */
1312
1315
  constructView(t, e, s = []) {
1313
- return new _e(i(this, g), t, e, s);
1316
+ return new Se(i(this, g), t, e, s);
1314
1317
  }
1315
1318
  /**
1316
1319
  *
@@ -1319,7 +1322,7 @@ class Ye {
1319
1322
  return Le(Me(i(this, g), t));
1320
1323
  }
1321
1324
  }
1322
- U = new WeakMap(), wt = new WeakMap(), C = new WeakMap(), B = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), Z = new WeakMap(), yt = new WeakMap(), bt = new WeakMap(), $t = new WeakMap(), Et = new WeakMap(), g = new WeakMap(), y = new WeakMap(), j = new WeakMap(), V = new WeakMap(), Ft = new WeakMap();
1325
+ U = new WeakMap(), wt = new WeakMap(), C = new WeakMap(), B = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), Z = new WeakMap(), yt = new WeakMap(), bt = new WeakMap(), $t = new WeakMap(), vt = new WeakMap(), g = new WeakMap(), y = new WeakMap(), j = new WeakMap(), V = new WeakMap(), Ft = new WeakMap();
1323
1326
  function Ze() {
1324
1327
  if (typeof window < "u" && window.console)
1325
1328
  return window.console;
@@ -1335,8 +1338,8 @@ function is() {
1335
1338
  }
1336
1339
  export {
1337
1340
  pe as cond,
1338
- Se as createMarkup,
1339
- ve as createRef,
1341
+ _e as createMarkup,
1342
+ Ee as createRef,
1340
1343
  ss as createRouter,
1341
1344
  Wt as createState,
1342
1345
  we as deepEqual,
@@ -1345,7 +1348,7 @@ export {
1345
1348
  is as getDevDebug,
1346
1349
  Ht as html,
1347
1350
  ke as isRef,
1348
- Ee as isState,
1351
+ ve as isState,
1349
1352
  ls as portal,
1350
1353
  hs as repeat,
1351
1354
  ns as setDevDebug,