@manyducks.co/dolla 2.0.0-alpha.6 → 2.0.0-alpha.8

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
@@ -13,8 +13,8 @@ var et = (a, e, t, r) => ({
13
13
  return n(a, e, r);
14
14
  }
15
15
  });
16
- import { h as tt, c as wt, i as Ie, t as Ge, a as yt, d as Be, b as bt, e as Xe, f as V, g as K, j as lt, k as vt, w as ut, P as ht, l as rt, m as $t, n as Et, v as kt, o as Lt, p as Pt, q as nt, r as at, s as St, u as Ne, x as Te, y as Rt, z as xt, A as Ot } from "./passthrough-CW8Ezjg-.js";
17
- import { B as rr, C as nr, D as ar } from "./passthrough-CW8Ezjg-.js";
16
+ import { h as tt, c as wt, i as Ge, t as Be, a as yt, d as Ie, b as bt, e as Xe, f as U, g as K, j as lt, k as vt, w as ut, P as ht, l as rt, m as $t, n as Et, v as kt, o as Lt, p as Pt, q as nt, r as at, s as St, u as Ne, x as Te, y as Rt, z as xt, A as Ot } from "./passthrough-9kwwjgWk.js";
17
+ import { B as rr, C as nr, D as ar } from "./passthrough-9kwwjgWk.js";
18
18
  function Mt(a) {
19
19
  return tt`
20
20
  <div
@@ -168,7 +168,7 @@ async function jt(a) {
168
168
  const f = async () => {
169
169
  const c = s.query.toString(), w = c.length > 0 ? s.uri + "?" + c : s.uri;
170
170
  let y;
171
- !s.headers.has("content-type") && Ie(s.body) ? (s.headers.set("content-type", "application/json"), y = JSON.stringify(s.body)) : y = s.body;
171
+ !s.headers.has("content-type") && Ge(s.body) ? (s.headers.set("content-type", "application/json"), y = JSON.stringify(s.body)) : y = s.body;
172
172
  const m = await r(w, {
173
173
  method: s.method,
174
174
  headers: s.headers,
@@ -207,14 +207,14 @@ class Ct {
207
207
  if (this.strings == null) {
208
208
  if (Xe(this.config.fetch)) {
209
209
  const e = await this.config.fetch();
210
- if (Ie(e))
210
+ if (Ge(e))
211
211
  this.strings = e;
212
212
  else
213
213
  throw new Error(`Fetch function did not return an object of language strings: ${e}`);
214
- } else if (V(this.config.path)) {
214
+ } else if (U(this.config.path)) {
215
215
  const e = await this.dolla.http.get(this.config.path);
216
216
  if (e.status >= 200 && e.status < 300)
217
- if (Ie(e.body))
217
+ if (Ge(e.body))
218
218
  this.strings = e.body;
219
219
  else
220
220
  throw new Error(
@@ -229,23 +229,23 @@ class Ct {
229
229
  return this.strings;
230
230
  }
231
231
  }
232
- var ye, Y, x, se, be, ve, ie, $e, We, ft;
232
+ var we, Y, x, se, ye, be, ie, ve, We, ft;
233
233
  class Dt {
234
234
  constructor(e) {
235
235
  h(this, We);
236
- h(this, ye);
236
+ h(this, we);
237
237
  h(this, Y);
238
238
  h(this, x, /* @__PURE__ */ new Map());
239
239
  h(this, se, []);
240
- h(this, be, "auto");
240
+ h(this, ye, "auto");
241
241
  L(this, "$current");
242
- h(this, ve);
242
+ h(this, be);
243
243
  h(this, ie);
244
- h(this, $e);
245
- g(this, ye, e), g(this, Y, e.createLogger("dolla/language"));
244
+ h(this, ve);
245
+ g(this, we, e), g(this, Y, e.createLogger("dolla/language"));
246
246
  const [t, r] = K(), [i, s] = K();
247
- this.$current = t, g(this, ve, r), g(this, ie, i), g(this, $e, s), e.beforeMount(async () => {
248
- n(this, x).size > 0 && await this.setLanguage(n(this, be));
247
+ this.$current = t, g(this, be, r), g(this, ie, i), g(this, ve, s), e.beforeMount(async () => {
248
+ n(this, x).size > 0 && await this.setLanguage(n(this, ye));
249
249
  });
250
250
  }
251
251
  get supportedLanguages() {
@@ -253,11 +253,11 @@ class Dt {
253
253
  }
254
254
  setup(e) {
255
255
  if (e.languages.forEach((t) => {
256
- n(this, x).set(t.name, new Ct(t, n(this, ye)));
256
+ n(this, x).set(t.name, new Ct(t, n(this, we)));
257
257
  }), e.initialLanguage && e.initialLanguage !== "auto") {
258
258
  if (!e.languages.some((r) => r.name === e.initialLanguage))
259
259
  throw new Error(`Initial language '${e.initialLanguage}' has no registered translation.`);
260
- g(this, be, e.initialLanguage);
260
+ g(this, ye, e.initialLanguage);
261
261
  }
262
262
  n(this, Y).info(
263
263
  `${n(this, x).size} language${n(this, x).size === 1 ? "" : "s"} supported: '${[...n(this, x).keys()].join("', '")}'`
@@ -285,7 +285,7 @@ class Dt {
285
285
  const r = n(this, x).get(t);
286
286
  try {
287
287
  const s = await r.load();
288
- n(this, $e).call(this, s), n(this, ve).call(this, t), n(this, Y).info("set language to " + t);
288
+ n(this, ve).call(this, s), n(this, be).call(this, t), n(this, Y).info("set language to " + t);
289
289
  } catch (s) {
290
290
  s instanceof Error && n(this, Y).crash(s);
291
291
  }
@@ -312,7 +312,7 @@ class Dt {
312
312
  yt(c) && (s[f] = c);
313
313
  const o = Object.entries(s);
314
314
  if (o.length > 0) {
315
- const f = o.map((w) => w[1]), c = Be([n(this, ie), ...f], (w, ...y) => {
315
+ const f = o.map((w) => w[1]), c = Ie([n(this, ie), ...f], (w, ...y) => {
316
316
  const m = y.map(($, j) => o[j]), d = {
317
317
  ...t
318
318
  };
@@ -326,19 +326,19 @@ class Dt {
326
326
  return n(this, se).push([e, t, c]), c;
327
327
  }
328
328
  }
329
- const i = Be([n(this, ie)], (s) => {
329
+ const i = Ie([n(this, ie)], (s) => {
330
330
  let o = it(s, e) || `[NO TRANSLATION: ${e}]`;
331
331
  return t && (o = st(o, t)), o;
332
332
  });
333
333
  return n(this, se).push([e, t, i]), i;
334
334
  }
335
335
  }
336
- ye = new WeakMap(), Y = new WeakMap(), x = new WeakMap(), se = new WeakMap(), be = new WeakMap(), ve = new WeakMap(), ie = new WeakMap(), $e = new WeakMap(), We = new WeakSet(), ft = function(e, t) {
336
+ we = new WeakMap(), Y = new WeakMap(), x = new WeakMap(), se = new WeakMap(), ye = new WeakMap(), be = new WeakMap(), ie = new WeakMap(), ve = new WeakMap(), We = new WeakSet(), ft = function(e, t) {
337
337
  for (const r of n(this, se))
338
338
  if (r[0] === e && bt(r[1], t))
339
339
  return r[2];
340
340
  };
341
- const qt = Ge("[NO LANGUAGE SET]");
341
+ const qt = Be("[NO LANGUAGE SET]");
342
342
  function st(a, e) {
343
343
  for (const t in e)
344
344
  a = a.replace(`{{${t}}}`, String(e[t]));
@@ -353,20 +353,21 @@ function it(a, e) {
353
353
  }
354
354
  return r;
355
355
  }
356
- var X, Ee, H, _, oe, q, ce, Ae;
357
- class Ut {
356
+ var X, $e, H, _, oe, q, ce, Ae;
357
+ class Vt {
358
358
  constructor(e) {
359
359
  h(this, ce);
360
360
  h(this, X);
361
- h(this, Ee);
361
+ h(this, $e);
362
362
  // Keyed updates ensure only the most recent callback queued with a certain key
363
363
  // will be called, keeping DOM operations to a minimum.
364
364
  h(this, H, /* @__PURE__ */ new Map());
365
365
  // All unkeyed updates are run on every batch.
366
366
  h(this, _, []);
367
+ // All read callbacks are run before updates on every batch.
367
368
  h(this, oe, []);
368
369
  h(this, q, !1);
369
- g(this, X, e), g(this, Ee, e.createLogger("dolla/render"));
370
+ g(this, X, e), g(this, $e, e.createLogger("dolla/render"));
370
371
  }
371
372
  /**
372
373
  * Queues a callback to run in the next render batch.
@@ -395,7 +396,7 @@ class Ut {
395
396
  });
396
397
  }
397
398
  }
398
- X = new WeakMap(), Ee = new WeakMap(), H = new WeakMap(), _ = new WeakMap(), oe = new WeakMap(), q = new WeakMap(), ce = new WeakSet(), Ae = function() {
399
+ X = new WeakMap(), $e = new WeakMap(), H = new WeakMap(), _ = new WeakMap(), oe = new WeakMap(), q = new WeakMap(), ce = new WeakSet(), Ae = function() {
399
400
  const e = n(this, H).size + n(this, _).length;
400
401
  if ((!n(this, X).isMounted || e === 0) && g(this, q, !1), !n(this, q)) {
401
402
  for (const t of n(this, oe))
@@ -404,7 +405,7 @@ X = new WeakMap(), Ee = new WeakMap(), H = new WeakMap(), _ = new WeakMap(), oe
404
405
  return;
405
406
  }
406
407
  requestAnimationFrame(() => {
407
- n(this, Ee).info(`Batching ${n(this, H).size + n(this, _).length} queued DOM update(s).`);
408
+ n(this, $e).info(`Batching ${n(this, H).size + n(this, _).length} queued DOM update(s).`);
408
409
  for (const t of n(this, H).values())
409
410
  t();
410
411
  n(this, H).clear();
@@ -413,14 +414,14 @@ X = new WeakMap(), Ee = new WeakMap(), H = new WeakMap(), _ = new WeakMap(), oe
413
414
  g(this, _, []), P(this, ce, Ae).call(this);
414
415
  });
415
416
  };
416
- function de() {
417
- return de = Object.assign ? Object.assign.bind() : function(a) {
417
+ function fe() {
418
+ return fe = Object.assign ? Object.assign.bind() : function(a) {
418
419
  for (var e = 1; e < arguments.length; e++) {
419
420
  var t = arguments[e];
420
421
  for (var r in t) ({}).hasOwnProperty.call(t, r) && (a[r] = t[r]);
421
422
  }
422
423
  return a;
423
- }, de.apply(null, arguments);
424
+ }, fe.apply(null, arguments);
424
425
  }
425
426
  var A;
426
427
  (function(a) {
@@ -440,7 +441,7 @@ function je(a, e) {
440
441
  }
441
442
  }
442
443
  }
443
- var Ue = "beforeunload", Vt = "hashchange", dt = "popstate";
444
+ var Ve = "beforeunload", Ut = "hashchange", dt = "popstate";
444
445
  function Ht(a) {
445
446
  a === void 0 && (a = {});
446
447
  var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
@@ -467,9 +468,9 @@ function Ht(a) {
467
468
  action: p,
468
469
  location: v,
469
470
  retry: function() {
470
- U(E * -1);
471
+ V(E * -1);
471
472
  }
472
- }, U(E));
473
+ }, V(E));
473
474
  } else
474
475
  process.env.NODE_ENV !== "production" && je(
475
476
  !1,
@@ -484,14 +485,14 @@ function Ht(a) {
484
485
  }
485
486
  r.addEventListener(dt, f);
486
487
  var c = A.Pop, w = s(), y = w[0], m = w[1], d = He(), b = He();
487
- y == null && (y = 0, i.replaceState(de({}, i.state, {
488
+ y == null && (y = 0, i.replaceState(fe({}, i.state, {
488
489
  idx: y
489
490
  }), ""));
490
491
  function $(p) {
491
492
  return typeof p == "string" ? p : Ce(p);
492
493
  }
493
494
  function j(p, l) {
494
- return l === void 0 && (l = null), qe(de({
495
+ return l === void 0 && (l = null), qe(fe({
495
496
  pathname: m.pathname,
496
497
  hash: "",
497
498
  search: ""
@@ -500,14 +501,14 @@ function Ht(a) {
500
501
  key: pt()
501
502
  }));
502
503
  }
503
- function pe(p, l) {
504
+ function de(p, l) {
504
505
  return [{
505
506
  usr: p.state,
506
507
  key: p.key,
507
508
  idx: l
508
509
  }, $(p)];
509
510
  }
510
- function ge(p, l, u) {
511
+ function pe(p, l, u) {
511
512
  return !b.length || (b.call({
512
513
  action: p,
513
514
  location: l,
@@ -527,27 +528,27 @@ function Ht(a) {
527
528
  function E() {
528
529
  ne(p, l);
529
530
  }
530
- if (ge(u, v, E)) {
531
- var S = pe(v, y + 1), M = S[0], T = S[1];
531
+ if (pe(u, v, E)) {
532
+ var S = de(v, y + 1), O = S[0], T = S[1];
532
533
  try {
533
- i.pushState(M, "", T);
534
+ i.pushState(O, "", T);
534
535
  } catch {
535
536
  r.location.assign(T);
536
537
  }
537
538
  re(u);
538
539
  }
539
540
  }
540
- function me(p, l) {
541
+ function ge(p, l) {
541
542
  var u = A.Replace, v = j(p, l);
542
543
  function E() {
543
- me(p, l);
544
+ ge(p, l);
544
545
  }
545
- if (ge(u, v, E)) {
546
- var S = pe(v, y), M = S[0], T = S[1];
547
- i.replaceState(M, "", T), re(u);
546
+ if (pe(u, v, E)) {
547
+ var S = de(v, y), O = S[0], T = S[1];
548
+ i.replaceState(O, "", T), re(u);
548
549
  }
549
550
  }
550
- function U(p) {
551
+ function V(p) {
551
552
  i.go(p);
552
553
  }
553
554
  var Q = {
@@ -559,21 +560,21 @@ function Ht(a) {
559
560
  },
560
561
  createHref: $,
561
562
  push: ne,
562
- replace: me,
563
- go: U,
563
+ replace: ge,
564
+ go: V,
564
565
  back: function() {
565
- U(-1);
566
+ V(-1);
566
567
  },
567
568
  forward: function() {
568
- U(1);
569
+ V(1);
569
570
  },
570
571
  listen: function(l) {
571
572
  return d.push(l);
572
573
  },
573
574
  block: function(l) {
574
575
  var u = b.push(l);
575
- return b.length === 1 && r.addEventListener(Ue, Ve), function() {
576
- u(), b.length || r.removeEventListener(Ue, Ve);
576
+ return b.length === 1 && r.addEventListener(Ve, Ue), function() {
577
+ u(), b.length || r.removeEventListener(Ve, Ue);
577
578
  };
578
579
  }
579
580
  };
@@ -583,7 +584,7 @@ function _t(a) {
583
584
  a === void 0 && (a = {});
584
585
  var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
585
586
  function s() {
586
- var l = Qe(r.location.hash.substr(1)), u = l.pathname, v = u === void 0 ? "/" : u, E = l.search, S = E === void 0 ? "" : E, M = l.hash, T = M === void 0 ? "" : M, C = i.state || {};
587
+ var l = Qe(r.location.hash.substr(1)), u = l.pathname, v = u === void 0 ? "/" : u, E = l.search, S = E === void 0 ? "" : E, O = l.hash, T = O === void 0 ? "" : O, C = i.state || {};
587
588
  return [C.idx, qe({
588
589
  pathname: v,
589
590
  search: S,
@@ -620,12 +621,12 @@ function _t(a) {
620
621
  ne(l);
621
622
  }
622
623
  }
623
- r.addEventListener(dt, f), r.addEventListener(Vt, function() {
624
+ r.addEventListener(dt, f), r.addEventListener(Ut, function() {
624
625
  var l = s(), u = l[1];
625
626
  Ce(u) !== Ce(m) && f();
626
627
  });
627
628
  var c = A.Pop, w = s(), y = w[0], m = w[1], d = He(), b = He();
628
- y == null && (y = 0, i.replaceState(de({}, i.state, {
629
+ y == null && (y = 0, i.replaceState(fe({}, i.state, {
629
630
  idx: y
630
631
  }), ""));
631
632
  function $() {
@@ -639,8 +640,8 @@ function _t(a) {
639
640
  function j(l) {
640
641
  return $() + "#" + (typeof l == "string" ? l : Ce(l));
641
642
  }
642
- function pe(l, u) {
643
- return u === void 0 && (u = null), qe(de({
643
+ function de(l, u) {
644
+ return u === void 0 && (u = null), qe(fe({
644
645
  pathname: m.pathname,
645
646
  hash: "",
646
647
  search: ""
@@ -649,7 +650,7 @@ function _t(a) {
649
650
  key: pt()
650
651
  }));
651
652
  }
652
- function ge(l, u) {
653
+ function pe(l, u) {
653
654
  return [{
654
655
  usr: l.state,
655
656
  key: l.key,
@@ -671,13 +672,13 @@ function _t(a) {
671
672
  location: m
672
673
  });
673
674
  }
674
- function me(l, u) {
675
- var v = A.Push, E = pe(l, u);
675
+ function ge(l, u) {
676
+ var v = A.Push, E = de(l, u);
676
677
  function S() {
677
- me(l, u);
678
+ ge(l, u);
678
679
  }
679
680
  if (process.env.NODE_ENV !== "production" && je(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), re(v, E, S)) {
680
- var M = ge(E, y + 1), T = M[0], C = M[1];
681
+ var O = pe(E, y + 1), T = O[0], C = O[1];
681
682
  try {
682
683
  i.pushState(T, "", C);
683
684
  } catch {
@@ -686,13 +687,13 @@ function _t(a) {
686
687
  ne(v);
687
688
  }
688
689
  }
689
- function U(l, u) {
690
- var v = A.Replace, E = pe(l, u);
690
+ function V(l, u) {
691
+ var v = A.Replace, E = de(l, u);
691
692
  function S() {
692
- U(l, u);
693
+ V(l, u);
693
694
  }
694
695
  if (process.env.NODE_ENV !== "production" && je(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), re(v, E, S)) {
695
- var M = ge(E, y), T = M[0], C = M[1];
696
+ var O = pe(E, y), T = O[0], C = O[1];
696
697
  i.replaceState(T, "", C), ne(v);
697
698
  }
698
699
  }
@@ -707,8 +708,8 @@ function _t(a) {
707
708
  return m;
708
709
  },
709
710
  createHref: j,
710
- push: me,
711
- replace: U,
711
+ push: ge,
712
+ replace: V,
712
713
  go: Q,
713
714
  back: function() {
714
715
  Q(-1);
@@ -721,14 +722,14 @@ function _t(a) {
721
722
  },
722
723
  block: function(u) {
723
724
  var v = b.push(u);
724
- return b.length === 1 && r.addEventListener(Ue, Ve), function() {
725
- v(), b.length || r.removeEventListener(Ue, Ve);
725
+ return b.length === 1 && r.addEventListener(Ve, Ue), function() {
726
+ v(), b.length || r.removeEventListener(Ve, Ue);
726
727
  };
727
728
  }
728
729
  };
729
730
  return p;
730
731
  }
731
- function Ve(a) {
732
+ function Ue(a) {
732
733
  a.preventDefault(), a.returnValue = "";
733
734
  }
734
735
  function He() {
@@ -768,7 +769,7 @@ function Qe(a) {
768
769
  }
769
770
  return e;
770
771
  }
771
- function we(a) {
772
+ function me(a) {
772
773
  return lt(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((e) => e.trim()).filter((e) => e !== "");
773
774
  }
774
775
  function ae(a) {
@@ -814,7 +815,7 @@ function Ke(a) {
814
815
  }
815
816
  function ot(a, e, t = {}) {
816
817
  var o;
817
- const [r, i] = e.split("?"), s = we(r);
818
+ const [r, i] = e.split("?"), s = me(r);
818
819
  e: for (const f of a) {
819
820
  const { fragments: c } = f;
820
821
  if (!(((o = c[c.length - 1]) == null ? void 0 : o.type) === 3) && c.length !== s.length || t.willMatch && !t.willMatch(f))
@@ -877,7 +878,7 @@ function Wt(a) {
877
878
  return e.sort(s), t.sort(s), r.sort(s), i.sort(s), [...e, ...t, ...r, ...i];
878
879
  }
879
880
  function zt(a) {
880
- const e = we(a), t = [];
881
+ const e = me(a), t = [];
881
882
  for (let r = 0; r < e.length; r++) {
882
883
  const i = e[r];
883
884
  if (i === "*") {
@@ -900,12 +901,12 @@ function zt(a) {
900
901
  }
901
902
  return t;
902
903
  }
903
- var le, O, Z, k, ze, W, ke, ee, z, ue, he, fe, Le, B, Je, Ye;
904
+ var Ee, M, Z, k, ze, W, ke, ee, z, le, ue, he, Le, I, Je, Ye;
904
905
  class Ft {
905
906
  constructor(e, t) {
906
- h(this, B);
907
- h(this, le);
908
- h(this, O);
907
+ h(this, I);
908
+ h(this, Ee);
909
+ h(this, M);
909
910
  h(this, Z);
910
911
  h(this, k);
911
912
  h(this, ze, 0);
@@ -918,27 +919,27 @@ class Ft {
918
919
  * The currently matched route pattern, if any.
919
920
  */
920
921
  L(this, "$pattern");
921
- h(this, ue);
922
+ h(this, le);
922
923
  /**
923
924
  * The current URL path.
924
925
  */
925
926
  L(this, "$path");
926
- h(this, he);
927
+ h(this, ue);
927
928
  /**
928
929
  * The current named path params.
929
930
  */
930
931
  L(this, "$params");
931
- h(this, fe);
932
+ h(this, he);
932
933
  /**
933
934
  * The current query params. Changes to this object will be reflected in the URL.
934
935
  */
935
936
  L(this, "$query");
936
937
  h(this, Le);
937
- g(this, le, e), g(this, O, e.createLogger("dolla/router")), g(this, Z, t);
938
+ g(this, Ee, e), g(this, M, e.createLogger("dolla/router")), g(this, Z, t);
938
939
  const [r, i] = K(null), [s, o] = K(""), [f, c] = K({}), [w, y] = K(
939
940
  Ke(typeof window > "u" ? "" : window.location.search ?? "")
940
941
  );
941
- this.$pattern = r, g(this, ue, i), this.$path = s, g(this, he, o), this.$params = f, g(this, fe, c), this.$query = w, g(this, Le, y), e.beforeMount(() => {
942
+ this.$pattern = r, g(this, le, i), this.$path = s, g(this, ue, o), this.$params = f, g(this, he, c), this.$query = w, g(this, Le, y), e.beforeMount(() => {
942
943
  n(this, k) != null && (n(this, z).push(
943
944
  ut([w], (m) => {
944
945
  const d = new URLSearchParams();
@@ -950,26 +951,26 @@ class Ft {
950
951
  search: b
951
952
  });
952
953
  })
953
- ), n(this, z).push(n(this, k).listen(P(this, B, Ye).bind(this))), P(this, B, Ye).call(this, n(this, k)), n(this, z).push(
954
- Bt(n(this, Z).rootElement, (m) => {
954
+ ), n(this, z).push(n(this, k).listen(P(this, I, Ye).bind(this))), P(this, I, Ye).call(this, n(this, k)), n(this, z).push(
955
+ It(n(this, Z).rootElement, (m) => {
955
956
  let d = m.getAttribute("href");
956
- n(this, O).info("Intercepted link click", m, d), /^https?:\/\/|^\//.test(d) || (d = ae([n(this, k).location.pathname, d])), n(this, k).push(d);
957
+ n(this, M).info("Intercepted link click", m, d), /^https?:\/\/|^\//.test(d) || (d = ae([n(this, k).location.pathname, d])), n(this, k).push(d);
957
958
  })
958
- ), n(this, O).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
959
+ ), n(this, M).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
959
960
  }), e.onUnmount(() => {
960
961
  for (; n(this, z).length > 0; )
961
962
  n(this, z).pop()();
962
963
  });
963
964
  }
964
965
  setup(e) {
965
- if (n(this, le).isMounted) {
966
- n(this, O).crash(
966
+ if (n(this, Ee).isMounted) {
967
+ n(this, M).crash(
967
968
  new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
968
969
  );
969
970
  return;
970
971
  }
971
972
  e.style === "hash" ? g(this, k, _t()) : g(this, k, Ht()), g(this, ee, Wt(
972
- e.routes.flatMap((t) => P(this, B, Je).call(this, t)).map((t) => ({
973
+ e.routes.flatMap((t) => P(this, I, Je).call(this, t)).map((t) => ({
973
974
  pattern: t.pattern,
974
975
  meta: t.meta,
975
976
  fragments: zt(t.pattern)
@@ -978,7 +979,7 @@ class Ft {
978
979
  for (const t of n(this, ee))
979
980
  if (t.meta.redirect) {
980
981
  let r;
981
- if (!Xe(t.meta.redirect)) if (V(t.meta.redirect)) {
982
+ if (!Xe(t.meta.redirect)) if (U(t.meta.redirect)) {
982
983
  if (r = t.meta.redirect, !ot(n(this, ee), r, {
983
984
  willMatch(s) {
984
985
  return s !== t;
@@ -1000,7 +1001,7 @@ class Ft {
1000
1001
  */
1001
1002
  go(e, t = {}) {
1002
1003
  if (n(this, k) == null) {
1003
- n(this, O).crash(
1004
+ n(this, M).crash(
1004
1005
  new Error(
1005
1006
  "Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1006
1007
  )
@@ -1015,7 +1016,7 @@ class Ft {
1015
1016
  */
1016
1017
  back(e = 1) {
1017
1018
  if (n(this, k) == null) {
1018
- n(this, O).crash(
1019
+ n(this, M).crash(
1019
1020
  new Error(
1020
1021
  "Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1021
1022
  )
@@ -1029,7 +1030,7 @@ class Ft {
1029
1030
  */
1030
1031
  forward(e = 1) {
1031
1032
  if (n(this, k) == null) {
1032
- n(this, O).crash(
1033
+ n(this, M).crash(
1033
1034
  new Error(
1034
1035
  "Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1035
1036
  )
@@ -1039,7 +1040,7 @@ class Ft {
1039
1040
  n(this, k).go(e);
1040
1041
  }
1041
1042
  }
1042
- le = new WeakMap(), O = new WeakMap(), Z = new WeakMap(), k = new WeakMap(), ze = new WeakMap(), W = new WeakMap(), ke = new WeakMap(), ee = new WeakMap(), z = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), Le = new WeakMap(), B = new WeakSet(), /**
1043
+ Ee = new WeakMap(), M = new WeakMap(), Z = new WeakMap(), k = new WeakMap(), ze = new WeakMap(), W = new WeakMap(), ke = new WeakMap(), ee = new WeakMap(), z = new WeakMap(), le = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), Le = new WeakMap(), I = new WeakSet(), /**
1043
1044
  * Parses a route definition object into a set of matchable routes.
1044
1045
  *
1045
1046
  * @param route - Route config object.
@@ -1056,13 +1057,13 @@ Je = function(e, t = [], r = []) {
1056
1057
  throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
1057
1058
  let i = [];
1058
1059
  for (const c of t)
1059
- i.push(...we(c.path));
1060
- i.push(...we(e.path)), i[i.length - 1] === "*" && i.pop();
1060
+ i.push(...me(c.path));
1061
+ i.push(...me(e.path)), i[i.length - 1] === "*" && i.pop();
1061
1062
  const s = [];
1062
1063
  if (e.redirect) {
1063
1064
  let c = e.redirect;
1064
- return V(c) && (c = De(ae(i), c), c.startsWith("/") || (c = "/" + c)), s.push({
1065
- pattern: "/" + ae([...i, ...we(e.path)]),
1065
+ return U(c) && (c = De(ae(i), c), c.startsWith("/") || (c = "/" + c)), s.push({
1066
+ pattern: "/" + ae([...i, ...me(e.path)]),
1066
1067
  meta: {
1067
1068
  redirect: c
1068
1069
  }
@@ -1076,7 +1077,7 @@ Je = function(e, t = [], r = []) {
1076
1077
  const f = { id: et(this, ze)._++, view: o };
1077
1078
  if (e.routes)
1078
1079
  for (const c of e.routes)
1079
- s.push(...P(this, B, Je).call(this, c, [...t, e], [...r, f]));
1080
+ s.push(...P(this, I, Je).call(this, c, [...t, e], [...r, f]));
1080
1081
  else
1081
1082
  s.push({
1082
1083
  pattern: parent ? ae([...t.map((c) => c.path), e.path]) : e.path,
@@ -1091,19 +1092,20 @@ Je = function(e, t = [], r = []) {
1091
1092
  e.search !== n(this, ke) && (g(this, ke, e.search), n(this, Le).call(this, Ke(e.search)));
1092
1093
  const t = ot(n(this, ee), e.pathname);
1093
1094
  if (!t) {
1094
- n(this, ue).call(this, null), n(this, he).call(this, e.pathname), n(this, fe).call(this, {
1095
+ n(this, le).call(this, null), n(this, ue).call(this, e.pathname), n(this, he).call(this, {
1095
1096
  wildcard: e.pathname
1096
1097
  });
1097
1098
  return;
1098
1099
  }
1099
1100
  if (t.meta.beforeMatch && await t.meta.beforeMatch({
1101
+ // TODO: Allow setting context variables from here.
1100
1102
  redirect: (r) => {
1101
1103
  throw new Error("Redirect not yet implemented.");
1102
1104
  }
1103
- }), n(this, O).info(`Matched route: '${t.pattern}' ('${t.path}')`), t.meta.redirect != null)
1105
+ }), t.meta.redirect != null)
1104
1106
  if (typeof t.meta.redirect == "string") {
1105
1107
  const r = Qt(t.meta.redirect, t.params);
1106
- n(this, O).info(`Redirecting to: '${r}'`), n(this, k).replace(r);
1108
+ n(this, M).info(`↩️ redirecting from '${t.path}' to '${r}'`), n(this, k).replace(r);
1107
1109
  } else if (typeof t.meta.redirect == "function") {
1108
1110
  const r = {
1109
1111
  path: t.path,
@@ -1114,24 +1116,26 @@ Je = function(e, t = [], r = []) {
1114
1116
  let i = await t.meta.redirect(r);
1115
1117
  if (typeof i != "string")
1116
1118
  throw new Error("Redirect function must return a path to redirect to.");
1117
- i.startsWith("/") || (i = De(t.path, i)), n(this, O).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
1119
+ i.startsWith("/") || (i = De(t.path, i)), n(this, M).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
1118
1120
  } else
1119
1121
  throw new TypeError("Redirect must either be a path string or a function.");
1120
- else if (n(this, he).call(this, t.path), n(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
1121
- n(this, ue).call(this, t.pattern);
1122
+ else if (n(this, M).info(`📍 navigating to '${t.path}'`), n(this, ue).call(this, t.path), n(this, he).call(this, t.params), t.pattern !== this.$pattern.get()) {
1123
+ n(this, le).call(this, t.pattern);
1122
1124
  const r = t.meta.layers;
1123
1125
  for (let i = 0; i < r.length; i++) {
1124
1126
  const s = r[i], o = n(this, W)[i];
1125
1127
  if ((o == null ? void 0 : o.id) !== s.id) {
1126
- n(this, O).info(`Replacing layer @${i} (active ID: ${o == null ? void 0 : o.id}, matched ID: ${s.id})`), g(this, W, n(this, W).slice(0, i));
1127
- const f = n(this, W).at(-1), c = n(this, le).constructView(s.view, {});
1128
- o && o.node.isMounted && o.node.unmount(), f ? f.node.setChildren([c]) : n(this, Z).rootView.setChildren([c]), n(this, W).push({ id: s.id, node: c });
1128
+ g(this, W, n(this, W).slice(0, i));
1129
+ const f = n(this, W).at(-1);
1130
+ o && o.node.isMounted && o.node.unmount();
1131
+ let c;
1132
+ f ? c = f.node.setChildView(s.view) : c = n(this, Z).rootView.setChildView(s.view), n(this, W).push({ id: s.id, node: c });
1129
1133
  }
1130
1134
  }
1131
1135
  }
1132
1136
  };
1133
- const It = /(noopener|noreferrer) (noopener|noreferrer)/, Gt = /^[\w-_]+:/;
1134
- function Bt(a, e, t = window) {
1137
+ const Gt = /(noopener|noreferrer) (noopener|noreferrer)/, Bt = /^[\w-_]+:/;
1138
+ function It(a, e, t = window) {
1135
1139
  function r(s) {
1136
1140
  return !s || s === a ? null : s.localName !== "a" || s.href === void 0 ? r(s.parentNode) : s;
1137
1141
  }
@@ -1139,7 +1143,7 @@ function Bt(a, e, t = window) {
1139
1143
  if (s.button && s.button !== 0 || s.ctrlKey || s.metaKey || s.altKey || s.shiftKey || s.defaultPrevented)
1140
1144
  return;
1141
1145
  const o = r(s.target);
1142
- o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && It.test(o.getAttribute("rel")) || Gt.test(o.getAttribute("href")) || (s.preventDefault(), e(o)));
1146
+ o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && Gt.test(o.getAttribute("rel")) || Bt.test(o.getAttribute("href")) || (s.preventDefault(), e(o)));
1143
1147
  }
1144
1148
  return a.addEventListener("click", i), function() {
1145
1149
  a.removeEventListener("click", i);
@@ -1152,7 +1156,7 @@ function Qt(a, e) {
1152
1156
  }
1153
1157
  return a;
1154
1158
  }
1155
- var F, Pe, I, te, Se, Re, xe, Oe, Me, R, G;
1159
+ var F, Pe, G, te, Se, Re, xe, Oe, Me, R, B;
1156
1160
  class Kt {
1157
1161
  constructor() {
1158
1162
  L(this, "http");
@@ -1161,7 +1165,7 @@ class Kt {
1161
1165
  L(this, "router");
1162
1166
  h(this, F, !1);
1163
1167
  h(this, Pe, "production");
1164
- h(this, I);
1168
+ h(this, G);
1165
1169
  h(this, te);
1166
1170
  h(this, Se, Mt);
1167
1171
  h(this, Re, []);
@@ -1174,20 +1178,20 @@ class Kt {
1174
1178
  warn: "development",
1175
1179
  error: !0
1176
1180
  });
1177
- h(this, G, rt("*,-dolla/*"));
1181
+ h(this, B, rt("*,-dolla/*"));
1178
1182
  L(this, "createState", K);
1179
1183
  L(this, "createSettableState", $t);
1180
1184
  L(this, "toSettableState", Et);
1181
- L(this, "toState", Ge);
1185
+ L(this, "toState", Be);
1182
1186
  L(this, "valueOf", kt);
1183
- L(this, "derive", Be);
1187
+ L(this, "derive", Ie);
1184
1188
  L(this, "watch", ut);
1185
1189
  L(this, "createRef", Lt);
1186
1190
  L(this, "isRef", Pt);
1187
1191
  const e = this;
1188
- this.http = new Nt(), this.language = new Dt(this), this.render = new Ut(this), this.router = new Ft(this, {
1192
+ this.http = new Nt(), this.language = new Dt(this), this.render = new Vt(this), this.router = new Ft(this, {
1189
1193
  get rootElement() {
1190
- return n(e, I);
1194
+ return n(e, G);
1191
1195
  },
1192
1196
  get rootView() {
1193
1197
  return n(e, te);
@@ -1224,13 +1228,13 @@ class Kt {
1224
1228
  async mount(e, t) {
1225
1229
  if (n(this, F))
1226
1230
  throw new Error("Dolla is already mounted.");
1227
- if (V(e)) {
1231
+ if (U(e)) {
1228
1232
  const i = document.querySelector(e);
1229
- nt(HTMLElement, i, `Selector '${e}' did not match any element.`), g(this, I, i);
1233
+ nt(HTMLElement, i, `Selector '${e}' did not match any element.`), g(this, G, i);
1230
1234
  } else
1231
- nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), g(this, I, e);
1235
+ nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), g(this, G, e);
1232
1236
  let r;
1233
- t ? r = at(t) : r = at(ht), g(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, Re).map((i) => i())), n(this, te).mount(n(this, I)), g(this, F, !0);
1237
+ t ? r = at(t) : r = at(ht), g(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, Re).map((i) => i())), n(this, te).mount(n(this, G)), g(this, F, !0);
1234
1238
  for (const i of n(this, xe))
1235
1239
  i();
1236
1240
  }
@@ -1278,15 +1282,15 @@ class Kt {
1278
1282
  }
1279
1283
  }
1280
1284
  setLogFilter(e) {
1281
- g(this, G, rt(e));
1285
+ g(this, B, rt(e));
1282
1286
  }
1283
1287
  createLogger(e, t) {
1284
- const r = Ge(e), i = (t == null ? void 0 : t.console) ?? St(), s = this;
1288
+ const r = Be(e), i = (t == null ? void 0 : t.console) ?? St(), s = this;
1285
1289
  return {
1286
1290
  get info() {
1287
1291
  var f;
1288
1292
  const o = r.get();
1289
- if (n(s, R).info === !1 || V(n(s, R).info) && n(s, R).info !== s.getEnv() || !n(f = s, G).call(f, o))
1293
+ if (n(s, R).info === !1 || U(n(s, R).info) && n(s, R).info !== s.getEnv() || !n(f = s, B).call(f, o))
1290
1294
  return Ne;
1291
1295
  {
1292
1296
  let c = `%c${o}`;
@@ -1303,7 +1307,7 @@ class Kt {
1303
1307
  get log() {
1304
1308
  var f;
1305
1309
  const o = r.get();
1306
- if (n(s, R).log === !1 || V(n(s, R).log) && n(s, R).log !== s.getEnv() || !n(f = s, G).call(f, o))
1310
+ if (n(s, R).log === !1 || U(n(s, R).log) && n(s, R).log !== s.getEnv() || !n(f = s, B).call(f, o))
1307
1311
  return Ne;
1308
1312
  {
1309
1313
  let c = `%c${o}`;
@@ -1320,7 +1324,7 @@ class Kt {
1320
1324
  get warn() {
1321
1325
  var f;
1322
1326
  const o = r.get();
1323
- if (n(s, R).warn === !1 || V(n(s, R).warn) && n(s, R).warn !== s.getEnv() || !n(f = s, G).call(f, o))
1327
+ if (n(s, R).warn === !1 || U(n(s, R).warn) && n(s, R).warn !== s.getEnv() || !n(f = s, B).call(f, o))
1324
1328
  return Ne;
1325
1329
  {
1326
1330
  let c = `%c${o}`;
@@ -1337,7 +1341,7 @@ class Kt {
1337
1341
  get error() {
1338
1342
  var f;
1339
1343
  const o = r.get();
1340
- if (n(s, R).error === !1 || V(n(s, R).error) && n(s, R).error !== s.getEnv() || !n(f = s, G).call(f, o))
1344
+ if (n(s, R).error === !1 || U(n(s, R).error) && n(s, R).error !== s.getEnv() || !n(f = s, B).call(f, o))
1341
1345
  return Ne;
1342
1346
  {
1343
1347
  let c = `%c${o}`;
@@ -1356,7 +1360,7 @@ class Kt {
1356
1360
  error: o,
1357
1361
  loggerName: r.get(),
1358
1362
  uid: t == null ? void 0 : t.uid
1359
- }).mount(n(s, I))), o;
1363
+ }).mount(n(s, G))), o;
1360
1364
  }
1361
1365
  };
1362
1366
  }
@@ -1364,16 +1368,16 @@ class Kt {
1364
1368
  *
1365
1369
  */
1366
1370
  constructView(e, t, r = []) {
1367
- return Rt({ root: this }, e, t, r);
1371
+ return Rt({ root: this, data: {} }, e, t, r);
1368
1372
  }
1369
1373
  /**
1370
1374
  *
1371
1375
  */
1372
1376
  constructMarkup(e) {
1373
- return xt(Ot({ root: this }, e));
1377
+ return xt(Ot({ root: this, data: {} }, e));
1374
1378
  }
1375
1379
  }
1376
- F = new WeakMap(), Pe = new WeakMap(), I = new WeakMap(), te = new WeakMap(), Se = new WeakMap(), Re = new WeakMap(), xe = new WeakMap(), Oe = new WeakMap(), Me = new WeakMap(), R = new WeakMap(), G = new WeakMap();
1380
+ F = new WeakMap(), Pe = new WeakMap(), G = new WeakMap(), te = new WeakMap(), Se = new WeakMap(), Re = new WeakMap(), xe = new WeakMap(), Oe = new WeakMap(), Me = new WeakMap(), R = new WeakMap(), B = new WeakMap();
1377
1381
  const ct = new Kt(), Zt = ct.language.t.bind(ct.language);
1378
1382
  export {
1379
1383
  wt as cond,
@@ -1383,14 +1387,14 @@ export {
1383
1387
  rr as createSetter,
1384
1388
  K as createState,
1385
1389
  ct as default,
1386
- Be as derive,
1390
+ Ie as derive,
1387
1391
  tt as html,
1388
1392
  Pt as isRef,
1389
1393
  nr as portal,
1390
1394
  ar as repeat,
1391
1395
  Zt as t,
1392
1396
  Et as toSettableState,
1393
- Ge as toState,
1397
+ Be as toState,
1394
1398
  kt as valueOf
1395
1399
  };
1396
1400
  //# sourceMappingURL=index.js.map