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

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
@@ -1,21 +1,21 @@
1
- var pt = Object.defineProperty;
1
+ var gt = Object.defineProperty;
2
2
  var Ze = (a) => {
3
3
  throw TypeError(a);
4
4
  };
5
- var mt = (a, e, t) => e in a ? pt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
5
+ var mt = (a, e, t) => e in a ? gt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
6
6
  var L = (a, e, t) => mt(a, typeof e != "symbol" ? e + "" : e, t), Fe = (a, e, t) => e.has(a) || Ze("Cannot " + t);
7
- var n = (a, e, t) => (Fe(a, e, "read from private field"), t ? t.call(a) : e.get(a)), h = (a, e, t) => e.has(a) ? Ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), p = (a, e, t, r) => (Fe(a, e, "write to private field"), r ? r.call(a, t) : e.set(a, t), t), P = (a, e, t) => (Fe(a, e, "access private method"), t);
7
+ var n = (a, e, t) => (Fe(a, e, "read from private field"), t ? t.call(a) : e.get(a)), h = (a, e, t) => e.has(a) ? Ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), g = (a, e, t, r) => (Fe(a, e, "write to private field"), r ? r.call(a, t) : e.set(a, t), t), P = (a, e, t) => (Fe(a, e, "access private method"), t);
8
8
  var et = (a, e, t, r) => ({
9
9
  set _(i) {
10
- p(a, e, i, t);
10
+ g(a, e, i, t);
11
11
  },
12
12
  get _() {
13
13
  return n(a, e, r);
14
14
  }
15
15
  });
16
- import { h as tt, c as yt, i as Ie, s as Ge, a as wt, 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, t as Et, n as kt, o as Lt, p as Pt, q as nt, r as at, u as St, v as Oe, x as Te, y as Rt, z as xt, A as Mt } from "./passthrough-BSLd3foL.js";
17
- import { B as rr, C as nr, D as ar } from "./passthrough-BSLd3foL.js";
18
- function Nt(a) {
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";
18
+ function Mt(a) {
19
19
  return tt`
20
20
  <div
21
21
  style=${{
@@ -30,7 +30,7 @@ function Nt(a) {
30
30
  <h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
31
31
  <p style=${{ marginBottom: "0.25rem" }}>
32
32
  <span style=${{ fontFamily: "monospace" }}>${a.loggerName}</span>
33
- ${yt(a.uid, tt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
33
+ ${wt(a.uid, tt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
34
34
  ${" "}says:
35
35
  </p>
36
36
  <blockquote
@@ -62,10 +62,10 @@ function Nt(a) {
62
62
  </div>
63
63
  `;
64
64
  }
65
- var J, _e, O, D;
66
- class Ot {
65
+ var J, _e, N, D;
66
+ class Nt {
67
67
  constructor() {
68
- h(this, O);
68
+ h(this, N);
69
69
  h(this, J, []);
70
70
  h(this, _e, Tt());
71
71
  }
@@ -81,31 +81,31 @@ class Ot {
81
81
  };
82
82
  }
83
83
  async get(e, t) {
84
- return P(this, O, D).call(this, "get", e, t);
84
+ return P(this, N, D).call(this, "get", e, t);
85
85
  }
86
86
  async put(e, t) {
87
- return P(this, O, D).call(this, "put", e, t);
87
+ return P(this, N, D).call(this, "put", e, t);
88
88
  }
89
89
  async patch(e, t) {
90
- return P(this, O, D).call(this, "patch", e, t);
90
+ return P(this, N, D).call(this, "patch", e, t);
91
91
  }
92
92
  async post(e, t) {
93
- return P(this, O, D).call(this, "post", e, t);
93
+ return P(this, N, D).call(this, "post", e, t);
94
94
  }
95
95
  async delete(e, t) {
96
- return P(this, O, D).call(this, "delete", e, t);
96
+ return P(this, N, D).call(this, "delete", e, t);
97
97
  }
98
98
  async head(e, t) {
99
- return P(this, O, D).call(this, "head", e, t);
99
+ return P(this, N, D).call(this, "head", e, t);
100
100
  }
101
101
  async options(e, t) {
102
- return P(this, O, D).call(this, "options", e, t);
102
+ return P(this, N, D).call(this, "options", e, t);
103
103
  }
104
104
  async trace(e, t) {
105
- return P(this, O, D).call(this, "trace", e, t);
105
+ return P(this, N, D).call(this, "trace", e, t);
106
106
  }
107
107
  }
108
- J = new WeakMap(), _e = new WeakMap(), O = new WeakSet(), D = async function(e, t, r) {
108
+ J = new WeakMap(), _e = new WeakMap(), N = new WeakSet(), D = async function(e, t, r) {
109
109
  return jt({
110
110
  ...r,
111
111
  method: e,
@@ -142,37 +142,37 @@ async function jt(a) {
142
142
  };
143
143
  if (e)
144
144
  if (e instanceof Map || e instanceof Headers)
145
- e.forEach((c, y) => {
146
- s.headers.set(y, c);
145
+ e.forEach((c, w) => {
146
+ s.headers.set(w, c);
147
147
  });
148
148
  else if (e != null && typeof e == "object" && !Array.isArray(e))
149
149
  for (const c in e) {
150
- const y = e[c];
151
- y instanceof Date ? s.headers.set(c, y.toISOString()) : y != null && s.headers.set(c, String(y));
150
+ const w = e[c];
151
+ w instanceof Date ? s.headers.set(c, w.toISOString()) : w != null && s.headers.set(c, String(w));
152
152
  }
153
153
  else
154
154
  throw new TypeError(`Unknown headers type. Got: ${e}`);
155
155
  if (t)
156
156
  if (t instanceof Map || t instanceof URLSearchParams)
157
- t.forEach((c, y) => {
158
- s.query.set(y, c);
157
+ t.forEach((c, w) => {
158
+ s.query.set(w, c);
159
159
  });
160
160
  else if (t != null && typeof t == "object" && !Array.isArray(t))
161
161
  for (const c in t) {
162
- const y = t[c];
163
- y instanceof Date ? s.query.set(c, y.toISOString()) : y != null && s.query.set(c, String(y));
162
+ const w = t[c];
163
+ w instanceof Date ? s.query.set(c, w.toISOString()) : w != null && s.query.set(c, String(w));
164
164
  }
165
165
  else
166
166
  throw new TypeError(`Unknown query params type. Got: ${t}`);
167
167
  let o;
168
168
  const f = async () => {
169
- const c = s.query.toString(), y = c.length > 0 ? s.uri + "?" + c : s.uri;
170
- let w;
171
- !s.headers.has("content-type") && Ie(s.body) ? (s.headers.set("content-type", "application/json"), w = JSON.stringify(s.body)) : w = s.body;
172
- const m = await r(y, {
169
+ const c = s.query.toString(), w = c.length > 0 ? s.uri + "?" + c : s.uri;
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;
172
+ const m = await r(w, {
173
173
  method: s.method,
174
174
  headers: s.headers,
175
- body: w
175
+ body: y
176
176
  }), d = Object.fromEntries(m.headers.entries()), b = d["content-type"];
177
177
  let $;
178
178
  b != null && b.includes("application/json") ? $ = await m.json() : b != null && b.includes("application/x-www-form-urlencoded") ? $ = await m.formData() : $ = await m.text(), o = {
@@ -185,9 +185,9 @@ async function jt(a) {
185
185
  };
186
186
  };
187
187
  if (i.length > 0) {
188
- const c = (y = 0) => {
189
- const w = i[y], m = i[y + 1] ? c(y + 1) : f;
190
- return async () => w(s, async () => (await m(), o));
188
+ const c = (w = 0) => {
189
+ const y = i[w], m = i[w + 1] ? c(w + 1) : f;
190
+ return async () => y(s, async () => (await m(), o));
191
191
  };
192
192
  await c()();
193
193
  } else
@@ -229,11 +229,11 @@ class Ct {
229
229
  return this.strings;
230
230
  }
231
231
  }
232
- var we, Y, x, se, be, ve, ie, $e, We, ft;
232
+ var ye, Y, x, se, be, ve, ie, $e, We, ft;
233
233
  class Dt {
234
234
  constructor(e) {
235
235
  h(this, We);
236
- h(this, we);
236
+ h(this, ye);
237
237
  h(this, Y);
238
238
  h(this, x, /* @__PURE__ */ new Map());
239
239
  h(this, se, []);
@@ -242,9 +242,9 @@ class Dt {
242
242
  h(this, ve);
243
243
  h(this, ie);
244
244
  h(this, $e);
245
- p(this, we, e), p(this, Y, e.createLogger("dolla/language"));
245
+ g(this, ye, e), g(this, Y, e.createLogger("dolla/language"));
246
246
  const [t, r] = K(), [i, s] = K();
247
- this.$current = t, p(this, ve, r), p(this, ie, i), p(this, $e, s), e.beforeMount(async () => {
247
+ this.$current = t, g(this, ve, r), g(this, ie, i), g(this, $e, s), e.beforeMount(async () => {
248
248
  n(this, x).size > 0 && await this.setLanguage(n(this, be));
249
249
  });
250
250
  }
@@ -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, we)));
256
+ n(this, x).set(t.name, new Ct(t, n(this, ye)));
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
- p(this, be, e.initialLanguage);
260
+ g(this, be, 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("', '")}'`
@@ -291,7 +291,7 @@ class Dt {
291
291
  }
292
292
  }
293
293
  /**
294
- * Returns a Signal containing the value at `key`.
294
+ * Returns a State containing the value at `key`.
295
295
 
296
296
  * @param key - Key to the translated value.
297
297
  * @param values - A map of {{placeholder}} names and the values to replace them with.
@@ -309,18 +309,18 @@ class Dt {
309
309
  if (t) {
310
310
  const s = {};
311
311
  for (const [f, c] of Object.entries(t))
312
- wt(c) && (s[f] = c);
312
+ yt(c) && (s[f] = c);
313
313
  const o = Object.entries(s);
314
314
  if (o.length > 0) {
315
- const f = o.map((y) => y[1]), c = Be([n(this, ie), ...f], (y, ...w) => {
316
- const m = w.map(($, j) => o[j]), d = {
315
+ const f = o.map((w) => w[1]), c = Be([n(this, ie), ...f], (w, ...y) => {
316
+ const m = y.map(($, j) => o[j]), d = {
317
317
  ...t
318
318
  };
319
319
  for (let $ = 0; $ < m.length; $++) {
320
320
  const j = m[$][0];
321
- d[j] = w[$];
321
+ d[j] = y[$];
322
322
  }
323
- const b = it(y, e) || `[NO TRANSLATION: ${e}]`;
323
+ const b = it(w, e) || `[NO TRANSLATION: ${e}]`;
324
324
  return st(b, d);
325
325
  });
326
326
  return n(this, se).push([e, t, c]), c;
@@ -333,7 +333,7 @@ class Dt {
333
333
  return n(this, se).push([e, t, i]), i;
334
334
  }
335
335
  }
336
- we = 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
+ 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) {
337
337
  for (const r of n(this, se))
338
338
  if (r[0] === e && bt(r[1], t))
339
339
  return r[2];
@@ -366,7 +366,7 @@ class Ut {
366
366
  h(this, _, []);
367
367
  h(this, oe, []);
368
368
  h(this, q, !1);
369
- p(this, X, e), p(this, Ee, e.createLogger("dolla/render"));
369
+ g(this, X, e), g(this, Ee, e.createLogger("dolla/render"));
370
370
  }
371
371
  /**
372
372
  * Queues a callback to run in the next render batch.
@@ -379,7 +379,7 @@ class Ut {
379
379
  e(), r();
380
380
  }) : n(this, _).push(() => {
381
381
  e(), r();
382
- }), !n(this, q) && n(this, X).isMounted && (p(this, q, !0), P(this, ce, Ae).call(this));
382
+ }), !n(this, q) && n(this, X).isMounted && (g(this, q, !0), P(this, ce, Ae).call(this));
383
383
  });
384
384
  }
385
385
  /**
@@ -391,16 +391,16 @@ class Ut {
391
391
  return new Promise((t) => {
392
392
  n(this, oe).push(() => {
393
393
  e(), t();
394
- }), !n(this, q) && n(this, X).isMounted && (p(this, q, !0), P(this, ce, Ae).call(this));
394
+ }), !n(this, q) && n(this, X).isMounted && (g(this, q, !0), P(this, ce, Ae).call(this));
395
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
399
  const e = n(this, H).size + n(this, _).length;
400
- if ((!n(this, X).isMounted || e === 0) && p(this, q, !1), !n(this, q)) {
400
+ if ((!n(this, X).isMounted || e === 0) && g(this, q, !1), !n(this, q)) {
401
401
  for (const t of n(this, oe))
402
402
  t();
403
- p(this, oe, []);
403
+ g(this, oe, []);
404
404
  return;
405
405
  }
406
406
  requestAnimationFrame(() => {
@@ -410,7 +410,7 @@ X = new WeakMap(), Ee = new WeakMap(), H = new WeakMap(), _ = new WeakMap(), oe
410
410
  n(this, H).clear();
411
411
  for (const t of n(this, _))
412
412
  t();
413
- p(this, _, []), P(this, ce, Ae).call(this);
413
+ g(this, _, []), P(this, ce, Ae).call(this);
414
414
  });
415
415
  };
416
416
  function de() {
@@ -445,7 +445,7 @@ function Ht(a) {
445
445
  a === void 0 && (a = {});
446
446
  var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
447
447
  function s() {
448
- var g = r.location, l = g.pathname, u = g.search, v = g.hash, E = i.state || {};
448
+ var p = r.location, l = p.pathname, u = p.search, v = p.hash, E = i.state || {};
449
449
  return [E.idx, qe({
450
450
  pathname: l,
451
451
  search: u,
@@ -459,12 +459,12 @@ function Ht(a) {
459
459
  if (o)
460
460
  b.call(o), o = null;
461
461
  else {
462
- var g = A.Pop, l = s(), u = l[0], v = l[1];
462
+ var p = A.Pop, l = s(), u = l[0], v = l[1];
463
463
  if (b.length)
464
464
  if (u != null) {
465
- var E = w - u;
465
+ var E = y - u;
466
466
  E && (o = {
467
- action: g,
467
+ action: p,
468
468
  location: v,
469
469
  retry: function() {
470
470
  U(E * -1);
@@ -479,76 +479,76 @@ function Ht(a) {
479
479
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
480
480
  );
481
481
  else
482
- re(g);
482
+ re(p);
483
483
  }
484
484
  }
485
485
  r.addEventListener(dt, f);
486
- var c = A.Pop, y = s(), w = y[0], m = y[1], d = He(), b = He();
487
- w == null && (w = 0, i.replaceState(de({}, i.state, {
488
- idx: w
486
+ 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
+ idx: y
489
489
  }), ""));
490
- function $(g) {
491
- return typeof g == "string" ? g : Ce(g);
490
+ function $(p) {
491
+ return typeof p == "string" ? p : Ce(p);
492
492
  }
493
- function j(g, l) {
493
+ function j(p, l) {
494
494
  return l === void 0 && (l = null), qe(de({
495
495
  pathname: m.pathname,
496
496
  hash: "",
497
497
  search: ""
498
- }, typeof g == "string" ? Qe(g) : g, {
498
+ }, typeof p == "string" ? Qe(p) : p, {
499
499
  state: l,
500
- key: gt()
500
+ key: pt()
501
501
  }));
502
502
  }
503
- function ge(g, l) {
503
+ function pe(p, l) {
504
504
  return [{
505
- usr: g.state,
506
- key: g.key,
505
+ usr: p.state,
506
+ key: p.key,
507
507
  idx: l
508
- }, $(g)];
508
+ }, $(p)];
509
509
  }
510
- function pe(g, l, u) {
510
+ function ge(p, l, u) {
511
511
  return !b.length || (b.call({
512
- action: g,
512
+ action: p,
513
513
  location: l,
514
514
  retry: u
515
515
  }), !1);
516
516
  }
517
- function re(g) {
518
- c = g;
517
+ function re(p) {
518
+ c = p;
519
519
  var l = s();
520
- w = l[0], m = l[1], d.call({
520
+ y = l[0], m = l[1], d.call({
521
521
  action: c,
522
522
  location: m
523
523
  });
524
524
  }
525
- function ne(g, l) {
526
- var u = A.Push, v = j(g, l);
525
+ function ne(p, l) {
526
+ var u = A.Push, v = j(p, l);
527
527
  function E() {
528
- ne(g, l);
528
+ ne(p, l);
529
529
  }
530
- if (pe(u, v, E)) {
531
- var S = ge(v, w + 1), N = S[0], T = S[1];
530
+ if (ge(u, v, E)) {
531
+ var S = pe(v, y + 1), M = S[0], T = S[1];
532
532
  try {
533
- i.pushState(N, "", T);
533
+ i.pushState(M, "", T);
534
534
  } catch {
535
535
  r.location.assign(T);
536
536
  }
537
537
  re(u);
538
538
  }
539
539
  }
540
- function me(g, l) {
541
- var u = A.Replace, v = j(g, l);
540
+ function me(p, l) {
541
+ var u = A.Replace, v = j(p, l);
542
542
  function E() {
543
- me(g, l);
543
+ me(p, l);
544
544
  }
545
- if (pe(u, v, E)) {
546
- var S = ge(v, w), N = S[0], T = S[1];
547
- i.replaceState(N, "", T), re(u);
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);
548
548
  }
549
549
  }
550
- function U(g) {
551
- i.go(g);
550
+ function U(p) {
551
+ i.go(p);
552
552
  }
553
553
  var Q = {
554
554
  get action() {
@@ -583,7 +583,7 @@ function _t(a) {
583
583
  a === void 0 && (a = {});
584
584
  var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
585
585
  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, N = l.hash, T = N === void 0 ? "" : N, C = i.state || {};
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
587
  return [C.idx, qe({
588
588
  pathname: v,
589
589
  search: S,
@@ -600,7 +600,7 @@ function _t(a) {
600
600
  var l = A.Pop, u = s(), v = u[0], E = u[1];
601
601
  if (b.length)
602
602
  if (v != null) {
603
- var S = w - v;
603
+ var S = y - v;
604
604
  S && (o = {
605
605
  action: l,
606
606
  location: E,
@@ -624,9 +624,9 @@ function _t(a) {
624
624
  var l = s(), u = l[1];
625
625
  Ce(u) !== Ce(m) && f();
626
626
  });
627
- var c = A.Pop, y = s(), w = y[0], m = y[1], d = He(), b = He();
628
- w == null && (w = 0, i.replaceState(de({}, i.state, {
629
- idx: w
627
+ 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
+ idx: y
630
630
  }), ""));
631
631
  function $() {
632
632
  var l = document.querySelector("base"), u = "";
@@ -639,17 +639,17 @@ function _t(a) {
639
639
  function j(l) {
640
640
  return $() + "#" + (typeof l == "string" ? l : Ce(l));
641
641
  }
642
- function ge(l, u) {
642
+ function pe(l, u) {
643
643
  return u === void 0 && (u = null), qe(de({
644
644
  pathname: m.pathname,
645
645
  hash: "",
646
646
  search: ""
647
647
  }, typeof l == "string" ? Qe(l) : l, {
648
648
  state: u,
649
- key: gt()
649
+ key: pt()
650
650
  }));
651
651
  }
652
- function pe(l, u) {
652
+ function ge(l, u) {
653
653
  return [{
654
654
  usr: l.state,
655
655
  key: l.key,
@@ -666,18 +666,18 @@ function _t(a) {
666
666
  function ne(l) {
667
667
  c = l;
668
668
  var u = s();
669
- w = u[0], m = u[1], d.call({
669
+ y = u[0], m = u[1], d.call({
670
670
  action: c,
671
671
  location: m
672
672
  });
673
673
  }
674
674
  function me(l, u) {
675
- var v = A.Push, E = ge(l, u);
675
+ var v = A.Push, E = pe(l, u);
676
676
  function S() {
677
677
  me(l, u);
678
678
  }
679
679
  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 N = pe(E, w + 1), T = N[0], C = N[1];
680
+ var M = ge(E, y + 1), T = M[0], C = M[1];
681
681
  try {
682
682
  i.pushState(T, "", C);
683
683
  } catch {
@@ -687,19 +687,19 @@ function _t(a) {
687
687
  }
688
688
  }
689
689
  function U(l, u) {
690
- var v = A.Replace, E = ge(l, u);
690
+ var v = A.Replace, E = pe(l, u);
691
691
  function S() {
692
692
  U(l, u);
693
693
  }
694
694
  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 N = pe(E, w), T = N[0], C = N[1];
695
+ var M = ge(E, y), T = M[0], C = M[1];
696
696
  i.replaceState(T, "", C), ne(v);
697
697
  }
698
698
  }
699
699
  function Q(l) {
700
700
  i.go(l);
701
701
  }
702
- var g = {
702
+ var p = {
703
703
  get action() {
704
704
  return c;
705
705
  },
@@ -726,7 +726,7 @@ function _t(a) {
726
726
  };
727
727
  }
728
728
  };
729
- return g;
729
+ return p;
730
730
  }
731
731
  function Ve(a) {
732
732
  a.preventDefault(), a.returnValue = "";
@@ -751,7 +751,7 @@ function He() {
751
751
  }
752
752
  };
753
753
  }
754
- function gt() {
754
+ function pt() {
755
755
  return Math.random().toString(36).substr(2, 8);
756
756
  }
757
757
  function Ce(a) {
@@ -768,7 +768,7 @@ function Qe(a) {
768
768
  }
769
769
  return e;
770
770
  }
771
- function ye(a) {
771
+ function we(a) {
772
772
  return lt(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((e) => e.trim()).filter((e) => e !== "");
773
773
  }
774
774
  function ae(a) {
@@ -814,12 +814,12 @@ function Ke(a) {
814
814
  }
815
815
  function ot(a, e, t = {}) {
816
816
  var o;
817
- const [r, i] = e.split("?"), s = ye(r);
817
+ const [r, i] = e.split("?"), s = we(r);
818
818
  e: for (const f of a) {
819
819
  const { fragments: c } = f;
820
820
  if (!(((o = c[c.length - 1]) == null ? void 0 : o.type) === 3) && c.length !== s.length || t.willMatch && !t.willMatch(f))
821
821
  continue e;
822
- const w = [];
822
+ const y = [];
823
823
  t: for (let d = 0; d < c.length; d++) {
824
824
  const b = s[d], $ = c[d];
825
825
  if (b == null && $.type !== 3)
@@ -827,30 +827,30 @@ function ot(a, e, t = {}) {
827
827
  switch ($.type) {
828
828
  case 1:
829
829
  if ($.name.toLowerCase() === b.toLowerCase()) {
830
- w.push($);
830
+ y.push($);
831
831
  break;
832
832
  } else
833
833
  continue e;
834
834
  case 2:
835
- w.push({ ...$, value: b });
835
+ y.push({ ...$, value: b });
836
836
  break;
837
837
  case 3:
838
- w.push({ ...$, value: s.slice(d).join("/") });
838
+ y.push({ ...$, value: s.slice(d).join("/") });
839
839
  break t;
840
840
  case 4:
841
841
  if (isNaN(Number(b)))
842
842
  continue e;
843
- w.push({ ...$, value: Number(b) });
843
+ y.push({ ...$, value: Number(b) });
844
844
  break;
845
845
  default:
846
846
  throw new Error(`Unknown fragment type: ${$.type}`);
847
847
  }
848
848
  }
849
849
  const m = /* @__PURE__ */ Object.create(null);
850
- for (const d of w)
850
+ for (const d of y)
851
851
  d.type === 2 && (m[d.name] = decodeURIComponent(d.value)), d.type === 4 && (m[d.name] = d.value), d.type === 3 && (m.wildcard = "/" + decodeURIComponent(d.value));
852
852
  return {
853
- path: "/" + w.map((d) => d.value).join("/"),
853
+ path: "/" + y.map((d) => d.value).join("/"),
854
854
  pattern: "/" + c.map((d) => d.type === 2 ? `{${d.name}}` : d.type === 4 ? `{#${d.name}}` : d.name).join("/"),
855
855
  params: m,
856
856
  query: Ke(i),
@@ -877,7 +877,7 @@ function Wt(a) {
877
877
  return e.sort(s), t.sort(s), r.sort(s), i.sort(s), [...e, ...t, ...r, ...i];
878
878
  }
879
879
  function zt(a) {
880
- const e = ye(a), t = [];
880
+ const e = we(a), t = [];
881
881
  for (let r = 0; r < e.length; r++) {
882
882
  const i = e[r];
883
883
  if (i === "*") {
@@ -900,12 +900,12 @@ function zt(a) {
900
900
  }
901
901
  return t;
902
902
  }
903
- var le, M, Z, k, ze, W, ke, ee, z, ue, he, fe, Le, B, Je, Ye;
903
+ var le, O, Z, k, ze, W, ke, ee, z, ue, he, fe, Le, B, Je, Ye;
904
904
  class Ft {
905
905
  constructor(e, t) {
906
906
  h(this, B);
907
907
  h(this, le);
908
- h(this, M);
908
+ h(this, O);
909
909
  h(this, Z);
910
910
  h(this, k);
911
911
  h(this, ze, 0);
@@ -934,13 +934,13 @@ class Ft {
934
934
  */
935
935
  L(this, "$query");
936
936
  h(this, Le);
937
- p(this, le, e), p(this, M, e.createLogger("dolla/router")), p(this, Z, t);
938
- const [r, i] = K(null), [s, o] = K(""), [f, c] = K({}), [y, w] = K(
937
+ g(this, le, e), g(this, O, e.createLogger("dolla/router")), g(this, Z, t);
938
+ const [r, i] = K(null), [s, o] = K(""), [f, c] = K({}), [w, y] = K(
939
939
  Ke(typeof window > "u" ? "" : window.location.search ?? "")
940
940
  );
941
- this.$pattern = r, p(this, ue, i), this.$path = s, p(this, he, o), this.$params = f, p(this, fe, c), this.$query = y, p(this, Le, w), e.beforeMount(() => {
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
942
  n(this, k) != null && (n(this, z).push(
943
- ut([y], (m) => {
943
+ ut([w], (m) => {
944
944
  const d = new URLSearchParams();
945
945
  for (const $ in m)
946
946
  d.set($, String(m[$]));
@@ -953,9 +953,9 @@ class Ft {
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
954
  Bt(n(this, Z).rootElement, (m) => {
955
955
  let d = m.getAttribute("href");
956
- 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);
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
957
  })
958
- ), n(this, M).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
958
+ ), n(this, O).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
959
959
  }), e.onUnmount(() => {
960
960
  for (; n(this, z).length > 0; )
961
961
  n(this, z).pop()();
@@ -963,12 +963,12 @@ class Ft {
963
963
  }
964
964
  setup(e) {
965
965
  if (n(this, le).isMounted) {
966
- n(this, M).crash(
966
+ n(this, O).crash(
967
967
  new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
968
968
  );
969
969
  return;
970
970
  }
971
- e.style === "hash" ? p(this, k, _t()) : p(this, k, Ht()), p(this, ee, Wt(
971
+ e.style === "hash" ? g(this, k, _t()) : g(this, k, Ht()), g(this, ee, Wt(
972
972
  e.routes.flatMap((t) => P(this, B, Je).call(this, t)).map((t) => ({
973
973
  pattern: t.pattern,
974
974
  meta: t.meta,
@@ -1000,7 +1000,7 @@ class Ft {
1000
1000
  */
1001
1001
  go(e, t = {}) {
1002
1002
  if (n(this, k) == null) {
1003
- n(this, M).crash(
1003
+ n(this, O).crash(
1004
1004
  new Error(
1005
1005
  "Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1006
1006
  )
@@ -1015,7 +1015,7 @@ class Ft {
1015
1015
  */
1016
1016
  back(e = 1) {
1017
1017
  if (n(this, k) == null) {
1018
- n(this, M).crash(
1018
+ n(this, O).crash(
1019
1019
  new Error(
1020
1020
  "Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1021
1021
  )
@@ -1029,7 +1029,7 @@ class Ft {
1029
1029
  */
1030
1030
  forward(e = 1) {
1031
1031
  if (n(this, k) == null) {
1032
- n(this, M).crash(
1032
+ n(this, O).crash(
1033
1033
  new Error(
1034
1034
  "Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1035
1035
  )
@@ -1039,7 +1039,7 @@ class Ft {
1039
1039
  n(this, k).go(e);
1040
1040
  }
1041
1041
  }
1042
- le = 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(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), Le = new WeakMap(), B = new WeakSet(), /**
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
1043
  * Parses a route definition object into a set of matchable routes.
1044
1044
  *
1045
1045
  * @param route - Route config object.
@@ -1056,13 +1056,13 @@ Je = function(e, t = [], r = []) {
1056
1056
  throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
1057
1057
  let i = [];
1058
1058
  for (const c of t)
1059
- i.push(...ye(c.path));
1060
- i.push(...ye(e.path)), i[i.length - 1] === "*" && i.pop();
1059
+ i.push(...we(c.path));
1060
+ i.push(...we(e.path)), i[i.length - 1] === "*" && i.pop();
1061
1061
  const s = [];
1062
1062
  if (e.redirect) {
1063
1063
  let c = e.redirect;
1064
1064
  return V(c) && (c = De(ae(i), c), c.startsWith("/") || (c = "/" + c)), s.push({
1065
- pattern: "/" + ae([...i, ...ye(e.path)]),
1065
+ pattern: "/" + ae([...i, ...we(e.path)]),
1066
1066
  meta: {
1067
1067
  redirect: c
1068
1068
  }
@@ -1088,7 +1088,7 @@ Je = function(e, t = [], r = []) {
1088
1088
  });
1089
1089
  return s;
1090
1090
  }, Ye = async function({ location: e }) {
1091
- e.search !== n(this, ke) && (p(this, ke, e.search), n(this, Le).call(this, Ke(e.search)));
1091
+ e.search !== n(this, ke) && (g(this, ke, e.search), n(this, Le).call(this, Ke(e.search)));
1092
1092
  const t = ot(n(this, ee), e.pathname);
1093
1093
  if (!t) {
1094
1094
  n(this, ue).call(this, null), n(this, he).call(this, e.pathname), n(this, fe).call(this, {
@@ -1100,10 +1100,10 @@ Je = function(e, t = [], r = []) {
1100
1100
  redirect: (r) => {
1101
1101
  throw new Error("Redirect not yet implemented.");
1102
1102
  }
1103
- }), n(this, M).info(`Matched route: '${t.pattern}' ('${t.path}')`), t.meta.redirect != null)
1103
+ }), n(this, O).info(`Matched route: '${t.pattern}' ('${t.path}')`), t.meta.redirect != null)
1104
1104
  if (typeof t.meta.redirect == "string") {
1105
1105
  const r = Qt(t.meta.redirect, t.params);
1106
- n(this, M).info(`Redirecting to: '${r}'`), n(this, k).replace(r);
1106
+ n(this, O).info(`Redirecting to: '${r}'`), n(this, k).replace(r);
1107
1107
  } else if (typeof t.meta.redirect == "function") {
1108
1108
  const r = {
1109
1109
  path: t.path,
@@ -1114,7 +1114,7 @@ Je = function(e, t = [], r = []) {
1114
1114
  let i = await t.meta.redirect(r);
1115
1115
  if (typeof i != "string")
1116
1116
  throw new Error("Redirect function must return a path to redirect to.");
1117
- i.startsWith("/") || (i = De(t.path, i)), n(this, M).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
1117
+ i.startsWith("/") || (i = De(t.path, i)), n(this, O).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
1118
1118
  } else
1119
1119
  throw new TypeError("Redirect must either be a path string or a function.");
1120
1120
  else if (n(this, he).call(this, t.path), n(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
@@ -1123,7 +1123,7 @@ Je = function(e, t = [], r = []) {
1123
1123
  for (let i = 0; i < r.length; i++) {
1124
1124
  const s = r[i], o = n(this, W)[i];
1125
1125
  if ((o == null ? void 0 : o.id) !== s.id) {
1126
- n(this, M).info(`Replacing layer @${i} (active ID: ${o == null ? void 0 : o.id}, matched ID: ${s.id})`), p(this, W, n(this, W).slice(0, i));
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
1127
  const f = n(this, W).at(-1), c = n(this, le).constructView(s.view, {});
1128
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
1129
  }
@@ -1152,7 +1152,7 @@ function Qt(a, e) {
1152
1152
  }
1153
1153
  return a;
1154
1154
  }
1155
- var F, Pe, I, te, Se, Re, xe, Me, Ne, R, G;
1155
+ var F, Pe, I, te, Se, Re, xe, Oe, Me, R, G;
1156
1156
  class Kt {
1157
1157
  constructor() {
1158
1158
  L(this, "http");
@@ -1163,11 +1163,11 @@ class Kt {
1163
1163
  h(this, Pe, "production");
1164
1164
  h(this, I);
1165
1165
  h(this, te);
1166
- h(this, Se, Nt);
1166
+ h(this, Se, Mt);
1167
1167
  h(this, Re, []);
1168
1168
  h(this, xe, []);
1169
+ h(this, Oe, []);
1169
1170
  h(this, Me, []);
1170
- h(this, Ne, []);
1171
1171
  h(this, R, {
1172
1172
  info: "development",
1173
1173
  log: "development",
@@ -1175,17 +1175,17 @@ class Kt {
1175
1175
  error: !0
1176
1176
  });
1177
1177
  h(this, G, rt("*,-dolla/*"));
1178
- L(this, "createSignal", K);
1179
- L(this, "createSettableSignal", $t);
1180
- L(this, "toSettableSignal", Et);
1181
- L(this, "signalify", Ge);
1182
- L(this, "designalify", kt);
1178
+ L(this, "createState", K);
1179
+ L(this, "createSettableState", $t);
1180
+ L(this, "toSettableState", Et);
1181
+ L(this, "toState", Ge);
1182
+ L(this, "valueOf", kt);
1183
1183
  L(this, "derive", Be);
1184
1184
  L(this, "watch", ut);
1185
1185
  L(this, "createRef", Lt);
1186
1186
  L(this, "isRef", Pt);
1187
1187
  const e = this;
1188
- this.http = new Ot(), this.language = new Dt(this), this.render = new Ut(this), this.router = new Ft(this, {
1188
+ this.http = new Nt(), this.language = new Dt(this), this.render = new Ut(this), this.router = new Ft(this, {
1189
1189
  get rootElement() {
1190
1190
  return n(e, I);
1191
1191
  },
@@ -1212,33 +1212,33 @@ class Kt {
1212
1212
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1213
1213
  */
1214
1214
  setEnv(e) {
1215
- p(this, Pe, e);
1215
+ g(this, Pe, e);
1216
1216
  }
1217
1217
  /**
1218
1218
  * Sets the view that will be shown when the `crash` method is called on any logger.
1219
1219
  * When a crash is reported the app will be unmounted and replaced with this crash page.
1220
1220
  */
1221
1221
  setCrashView(e) {
1222
- p(this, Se, e);
1222
+ g(this, Se, e);
1223
1223
  }
1224
1224
  async mount(e, t) {
1225
1225
  if (n(this, F))
1226
1226
  throw new Error("Dolla is already mounted.");
1227
1227
  if (V(e)) {
1228
1228
  const i = document.querySelector(e);
1229
- nt(HTMLElement, i, `Selector '${e}' did not match any element.`), p(this, I, i);
1229
+ nt(HTMLElement, i, `Selector '${e}' did not match any element.`), g(this, I, i);
1230
1230
  } else
1231
- nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), p(this, I, e);
1231
+ nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), g(this, I, e);
1232
1232
  let r;
1233
- t ? r = at(t) : r = at(ht), p(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, Re).map((i) => i())), n(this, te).mount(n(this, I)), p(this, F, !0);
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);
1234
1234
  for (const i of n(this, xe))
1235
1235
  i();
1236
1236
  }
1237
1237
  async unmount() {
1238
1238
  var e;
1239
1239
  if (n(this, F)) {
1240
- await Promise.all(n(this, Me).map((t) => t())), (e = n(this, te)) == null || e.unmount(), p(this, F, !1);
1241
- for (const t of n(this, Ne))
1240
+ await Promise.all(n(this, Oe).map((t) => t())), (e = n(this, te)) == null || e.unmount(), g(this, F, !1);
1241
+ for (const t of n(this, Me))
1242
1242
  t();
1243
1243
  }
1244
1244
  }
@@ -1260,13 +1260,13 @@ class Kt {
1260
1260
  * it will be awaited before unmounting finishes. Use this to perform cleanup.
1261
1261
  */
1262
1262
  beforeUnmount(e) {
1263
- n(this, Me).push(e);
1263
+ n(this, Oe).push(e);
1264
1264
  }
1265
1265
  /**
1266
1266
  * Registers a `callback` to run after the app is unmounted.
1267
1267
  */
1268
1268
  onUnmount(e) {
1269
- n(this, Ne).push(e);
1269
+ n(this, Me).push(e);
1270
1270
  }
1271
1271
  /**
1272
1272
  * Update log type toggles. Values that are not passed will remain unchanged.
@@ -1278,7 +1278,7 @@ class Kt {
1278
1278
  }
1279
1279
  }
1280
1280
  setLogFilter(e) {
1281
- p(this, G, rt(e));
1281
+ g(this, G, rt(e));
1282
1282
  }
1283
1283
  createLogger(e, t) {
1284
1284
  const r = Ge(e), i = (t == null ? void 0 : t.console) ?? St(), s = this;
@@ -1287,7 +1287,7 @@ class Kt {
1287
1287
  var f;
1288
1288
  const o = r.get();
1289
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))
1290
- return Oe;
1290
+ return Ne;
1291
1291
  {
1292
1292
  let c = `%c${o}`;
1293
1293
  return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.info.bind(
@@ -1304,7 +1304,7 @@ class Kt {
1304
1304
  var f;
1305
1305
  const o = r.get();
1306
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))
1307
- return Oe;
1307
+ return Ne;
1308
1308
  {
1309
1309
  let c = `%c${o}`;
1310
1310
  return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.log.bind(
@@ -1321,7 +1321,7 @@ class Kt {
1321
1321
  var f;
1322
1322
  const o = r.get();
1323
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))
1324
- return Oe;
1324
+ return Ne;
1325
1325
  {
1326
1326
  let c = `%c${o}`;
1327
1327
  return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.warn.bind(
@@ -1338,7 +1338,7 @@ class Kt {
1338
1338
  var f;
1339
1339
  const o = r.get();
1340
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))
1341
- return Oe;
1341
+ return Ne;
1342
1342
  {
1343
1343
  let c = `%c${o}`;
1344
1344
  return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.error.bind(
@@ -1370,28 +1370,27 @@ class Kt {
1370
1370
  *
1371
1371
  */
1372
1372
  constructMarkup(e) {
1373
- return xt(Mt({ root: this }, e));
1373
+ return xt(Ot({ root: this }, e));
1374
1374
  }
1375
1375
  }
1376
- F = new WeakMap(), Pe = new WeakMap(), I = new WeakMap(), te = new WeakMap(), Se = new WeakMap(), Re = new WeakMap(), xe = new WeakMap(), Me = new WeakMap(), Ne = new WeakMap(), R = new WeakMap(), G = new WeakMap();
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();
1377
1377
  const ct = new Kt(), Zt = ct.language.t.bind(ct.language);
1378
1378
  export {
1379
- yt as cond,
1379
+ wt as cond,
1380
1380
  at as createMarkup,
1381
1381
  Lt as createRef,
1382
- $t as createSettableSignal,
1383
- K as createSignal,
1384
- rr as createSignalSetter,
1382
+ $t as createSettableState,
1383
+ rr as createSetter,
1384
+ K as createState,
1385
1385
  ct as default,
1386
1386
  Be as derive,
1387
- kt as designalify,
1388
1387
  tt as html,
1389
1388
  Pt as isRef,
1390
1389
  nr as portal,
1391
1390
  ar as repeat,
1392
- Ge as signalify,
1393
1391
  Zt as t,
1394
- Et as toSettableSignal,
1395
- ut as watch
1392
+ Et as toSettableState,
1393
+ Ge as toState,
1394
+ kt as valueOf
1396
1395
  };
1397
1396
  //# sourceMappingURL=index.js.map