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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,15 +3,16 @@
3
3
  ![bundle size](https://img.shields.io/bundlephobia/min/@manyducks.co/dolla)
4
4
  ![bundle size](https://img.shields.io/bundlephobia/minzip/@manyducks.co/dolla)
5
5
 
6
- > WARNING: This package is in active development. It may contain serious bugs and releases may introduce breaking changes without notice.
6
+ > WARNING: This package is in active development. It may contain serious bugs and docs may be outdated or inaccurate. Use at your own risk.
7
7
 
8
8
  Dolla is a batteries-included JavaScript frontend framework covering the needs of moderate-to-complex single page apps:
9
9
 
10
- - ⚡ Reactive DOM updates with [State](). A similar concept to Signals without behind the scenes magic.
10
+ - ⚡ Reactive DOM updates with [State](). Inspired by Signals, but with more explicit tracking.
11
11
  - 📦 Reusable components with [Views](#section-views).
12
- - 🗺️ Built in [router]() supporting nested routes and preloading.
13
- - Built in [HTTP]() client with middleware support.
14
- - Built in [Localization] (translations as JSON files and a `t` function to get strings)
12
+ - 🔀 Built in [routing]() with nested routes and middleware support (check login status, preload data, etc).
13
+ - 🐕 Built in [HTTP]() client with middleware support (set auth headers, etc).
14
+ - 📍 Built in [localization]() system (store translated strings in JSON files and call the `t` function to get them).
15
+ - 🍳 Build system optional. Write views in JSX or use `html` tagged template literals.
15
16
 
16
17
  Let's first get into some examples.
17
18
 
@@ -104,10 +105,10 @@ $value.get(); // 50
104
105
  A basic view:
105
106
 
106
107
  ```js
107
- import Dolla, { html } from "@manyducks.co/dolla";
108
+ import Dolla, { createState, html } from "@manyducks.co/dolla";
108
109
 
109
110
  function Counter(props, ctx) {
110
- const [$count, setCount] = Dolla.createState(0);
111
+ const [$count, setCount] = createState(0);
111
112
 
112
113
  function increment() {
113
114
  setCount((count) => count + 1);
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 Ie, t as Ge, a as yt, d as Be, 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-BVaqqjam.js";
17
+ import { B as rr, C as nr, D as ar } from "./passthrough-BVaqqjam.js";
18
18
  function Mt(a) {
19
19
  return tt`
20
20
  <div
@@ -211,7 +211,7 @@ class Ct {
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
217
  if (Ie(e.body))
@@ -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
  }
@@ -333,7 +333,7 @@ class Dt {
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];
@@ -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,8 +528,8 @@ 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), M = S[0], T = S[1];
532
533
  try {
533
534
  i.pushState(M, "", T);
534
535
  } catch {
@@ -537,17 +538,17 @@ function Ht(a) {
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];
546
+ if (pe(u, v, E)) {
547
+ var S = de(v, y), M = S[0], T = S[1];
547
548
  i.replaceState(M, "", 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
  };
@@ -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 M = pe(E, y + 1), T = M[0], C = M[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 M = pe(E, y), T = M[0], C = M[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,11 +901,11 @@ 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, O, Z, k, ze, W, ke, ee, z, le, ue, he, Le, B, Je, Ye;
904
905
  class Ft {
905
906
  constructor(e, t) {
906
907
  h(this, B);
907
- h(this, le);
908
+ h(this, Ee);
908
909
  h(this, O);
909
910
  h(this, Z);
910
911
  h(this, k);
@@ -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, O, 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();
@@ -962,7 +963,7 @@ class Ft {
962
963
  });
963
964
  }
964
965
  setup(e) {
965
- if (n(this, le).isMounted) {
966
+ if (n(this, Ee).isMounted) {
966
967
  n(this, O).crash(
967
968
  new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
968
969
  );
@@ -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;
@@ -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(), O = 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(), B = 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
  }
@@ -1091,12 +1092,13 @@ 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
  }
@@ -1117,15 +1119,17 @@ Je = function(e, t = [], r = []) {
1117
1119
  i.startsWith("/") || (i = De(t.path, i)), n(this, O).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, 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
1128
  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 });
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
  }
@@ -1185,7 +1189,7 @@ class Kt {
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
1194
  return n(e, I);
1191
1195
  },
@@ -1224,7 +1228,7 @@ 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
1233
  nt(HTMLElement, i, `Selector '${e}' did not match any element.`), g(this, I, i);
1230
1234
  } else
@@ -1286,7 +1290,7 @@ class Kt {
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, G).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, G).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, G).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, G).call(f, o))
1341
1345
  return Ne;
1342
1346
  {
1343
1347
  let c = `%c${o}`;
@@ -1364,13 +1368,13 @@ 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
1380
  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();