@manyducks.co/dolla 2.0.0-alpha.59 → 2.0.0-alpha.60

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.
Files changed (39) hide show
  1. package/dist/core/context.d.ts +2 -18
  2. package/dist/core/index.d.ts +3 -4
  3. package/dist/core/logger.d.ts +5 -2
  4. package/dist/core/markup.d.ts +47 -21
  5. package/dist/core/mount.d.ts +2 -2
  6. package/dist/core/nodes/dom.d.ts +4 -4
  7. package/dist/core/nodes/dynamic.d.ts +4 -4
  8. package/dist/core/nodes/html.d.ts +4 -5
  9. package/dist/core/nodes/portal.d.ts +3 -3
  10. package/dist/core/nodes/repeat.d.ts +3 -3
  11. package/dist/core/nodes/view.d.ts +8 -3
  12. package/dist/core/symbols.d.ts +2 -2
  13. package/dist/core/views/default-crash-view.d.ts +1 -12
  14. package/dist/http.js +1 -1
  15. package/dist/i18n.js +2 -2
  16. package/dist/index.js +38 -37
  17. package/dist/index.js.map +1 -1
  18. package/dist/jsx-dev-runtime.js +1 -1
  19. package/dist/jsx-dev-runtime.js.map +1 -1
  20. package/dist/jsx-runtime.js +1 -1
  21. package/dist/jsx-runtime.js.map +1 -1
  22. package/dist/{logger-Ck_9LCem.js → logger-MPwl-Xqu.js} +70 -62
  23. package/dist/logger-MPwl-Xqu.js.map +1 -0
  24. package/dist/{markup-BBa4WBj1.js → markup-BGlfQYQk.js} +302 -325
  25. package/dist/markup-BGlfQYQk.js.map +1 -0
  26. package/dist/router/router.d.ts +12 -5
  27. package/dist/router-BpuJQ6OA.js +516 -0
  28. package/dist/router-BpuJQ6OA.js.map +1 -0
  29. package/dist/router.js +1 -1
  30. package/dist/{typeChecking-BJ-ymQ2F.js → typeChecking-CbltMOUt.js} +2 -1
  31. package/dist/{typeChecking-BJ-ymQ2F.js.map → typeChecking-CbltMOUt.js.map} +1 -1
  32. package/dist/types.d.ts +11 -2
  33. package/dist/utils.d.ts +2 -0
  34. package/package.json +1 -1
  35. package/dist/core/app.d.ts +0 -17
  36. package/dist/logger-Ck_9LCem.js.map +0 -1
  37. package/dist/markup-BBa4WBj1.js.map +0 -1
  38. package/dist/router-CaR7Xd4T.js +0 -490
  39. package/dist/router-CaR7Xd4T.js.map +0 -1
@@ -1,14 +1,15 @@
1
- var at = Object.defineProperty;
2
- var B = (o) => {
1
+ var ut = Object.defineProperty;
2
+ var j = (o) => {
3
3
  throw TypeError(o);
4
4
  };
5
- var ht = (o, t, e) => t in o ? at(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
- var c = (o, t, e) => ht(o, typeof t != "symbol" ? t + "" : t, e), W = (o, t, e) => t.has(o) || B("Cannot " + e);
7
- var L = (o, t, e) => (W(o, t, "read from private field"), e ? e.call(o) : t.get(o)), D = (o, t, e) => t.has(o) ? B("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), $ = (o, t, e, s) => (W(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e);
8
- import { c as f, t as ut, g as X, b as U, i as tt } from "./typeChecking-BJ-ymQ2F.js";
9
- import { u as S, h as lt, g as w, k as et, e as g, c as dt, l as ft, b as mt, $ as T, d as pt } from "./logger-Ck_9LCem.js";
10
- const A = Symbol("name"), u = Symbol("lifecycle"), p = Symbol("parent"), y = Symbol("stores"), b = Symbol("state");
11
- class bt {
5
+ var lt = (o, t, e) => t in o ? ut(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
+ var c = (o, t, e) => lt(o, typeof t != "symbol" ? t + "" : t, e), R = (o, t, e) => t.has(o) || j("Cannot " + e);
7
+ var L = (o, t, e) => (R(o, t, "read from private field"), e ? e.call(o) : t.get(o)), V = (o, t, e) => t.has(o) ? j("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), O = (o, t, e, s) => (R(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e);
8
+ import { c as f, t as dt, i as D, b as C } from "./typeChecking-CbltMOUt.js";
9
+ import { u as E, h as ft, g as y, k as st, e as w, t as it, c as mt, l as pt, m as bt, b as gt, $ as _, d as wt } from "./logger-MPwl-Xqu.js";
10
+ var b = /* @__PURE__ */ ((o) => (o[o.WILL_MOUNT = 0] = "WILL_MOUNT", o[o.DID_MOUNT = 1] = "DID_MOUNT", o[o.WILL_UNMOUNT = 2] = "WILL_UNMOUNT", o[o.DID_UNMOUNT = 3] = "DID_UNMOUNT", o[o.DISPOSE = 4] = "DISPOSE", o))(b || {});
11
+ const T = Symbol("name"), l = Symbol("lifecycle"), p = Symbol("parent"), v = Symbol("stores"), g = Symbol("state");
12
+ class yt {
12
13
  constructor(t) {
13
14
  c(this, "context");
14
15
  c(this, "state", 0);
@@ -52,7 +53,7 @@ class bt {
52
53
  break;
53
54
  }
54
55
  case 4: {
55
- this.state === 0 ? (this.notify(t), this.listeners.clear(), this.bound = void 0, this.state = 5) : this.context.crash(new Error(`Tried to DISPOSE context at state ${this.state}`));
56
+ this.state === 0 ? (this.notify(t), this.listeners.clear(), this.bound = void 0, this.context[g] = void 0, this.context[v] = void 0, this.state = 5) : this.context.crash(new Error(`Tried to DISPOSE context at state ${this.state}`));
56
57
  break;
57
58
  }
58
59
  }
@@ -73,79 +74,40 @@ class bt {
73
74
  s();
74
75
  if (this.bound)
75
76
  for (const s of this.bound)
76
- s[u].emit(t);
77
+ s[l].emit(t);
77
78
  }
78
79
  }
79
- var j, q, G, H, z, v;
80
- z = A, H = u, G = p, q = y, j = b;
81
- const N = class N {
80
+ var H, z, F, Z, K, x;
81
+ K = T, Z = l, F = p, z = v, H = g;
82
+ const I = class I {
82
83
  constructor(t, e) {
83
- D(this, v);
84
+ V(this, x);
85
+ c(this, K);
86
+ c(this, Z, new yt(this));
87
+ c(this, F);
84
88
  c(this, z);
85
- c(this, H, new bt(this));
86
- c(this, G);
87
- c(this, q);
88
- c(this, j);
89
- $(this, v, t), this[A] = S(t);
90
- const s = lt(() => w(L(this, v)), e == null ? void 0 : e.logger), i = Object.getOwnPropertyDescriptors(s);
89
+ c(this, H);
90
+ O(this, x, t), this[T] = E(t);
91
+ const s = ft(() => y(L(this, x)), e == null ? void 0 : e.logger), i = Object.getOwnPropertyDescriptors(s);
91
92
  for (const n in i)
92
93
  Object.defineProperty(this, n, i[n]);
93
94
  }
94
95
  get isMounted() {
95
- const { state: t } = this[u];
96
+ const { state: t } = this[l];
96
97
  return t >= 2 && t < 4;
97
98
  }
98
99
  /**
99
100
  * Returns a new Context with this one as its parent.
100
101
  */
101
102
  static linked(t, e, s) {
102
- const i = new N(e, s);
103
- return i[p] = t, s != null && s.bindLifecycleToParent && t[u].bind(i), i;
103
+ const i = new I(e, s);
104
+ return i[p] = t, s != null && s.bindLifecycleToParent && t[l].bind(i), i;
104
105
  }
105
106
  /**
106
- * Emit "will mount" lifecycle event to `context`.
107
+ * Emit a lifecycle event to `context`.
107
108
  */
108
- static willMount(t) {
109
- t[u].emit(
110
- 0
111
- /* WILL_MOUNT */
112
- );
113
- }
114
- /**
115
- * Emit "did mount" lifecycle event to `context`.
116
- */
117
- static didMount(t) {
118
- t[u].emit(
119
- 1
120
- /* DID_MOUNT */
121
- );
122
- }
123
- /**
124
- * Emit "will unmount" lifecycle event to `context`.
125
- */
126
- static willUnmount(t) {
127
- t[u].emit(
128
- 2
129
- /* WILL_UNMOUNT */
130
- );
131
- }
132
- /**
133
- * Emit "did unmount" lifecycle event to `context`.
134
- */
135
- static didUnmount(t) {
136
- t[u].emit(
137
- 3
138
- /* DID_UNMOUNT */
139
- );
140
- }
141
- /**
142
- * Emit "dispose" lifecycle event to `context`.
143
- */
144
- static dispose(t) {
145
- t[u].emit(
146
- 4
147
- /* DISPOSE */
148
- ), t[b] = void 0, t[y] = void 0;
109
+ static emit(t, e) {
110
+ t[l].emit(e);
149
111
  }
150
112
  /**
151
113
  * Traverses _parent contexts until arriving at one that doesn't have a parent itself.
@@ -161,31 +123,31 @@ const N = class N {
161
123
  * Returns the current name of this context.
162
124
  */
163
125
  getName() {
164
- return S(L(this, v));
126
+ return E(L(this, x));
165
127
  }
166
128
  /**
167
129
  * Sets a new name for this context.
168
130
  */
169
131
  setName(t) {
170
- $(this, v, t), this[A] = S(t);
132
+ O(this, x, t), this[T] = E(t);
171
133
  }
172
134
  /**
173
135
  * Creates an instance of a store and attaches it to this context.
174
136
  */
175
137
  addStore(t, e) {
176
138
  var i;
177
- if ((i = this[y]) != null && i.get(t)) {
139
+ if ((i = this[v]) != null && i.get(t)) {
178
140
  let n = t.name ? `'${t.name}'` : "this store";
179
- throw this.crash(new I(`An instance of ${n} was already added on this context.`));
141
+ throw this.crash(new U(`An instance of ${n} was already added on this context.`));
180
142
  }
181
- const s = N.linked(this, t.name, {
143
+ const s = I.linked(this, t.name, {
182
144
  bindLifecycleToParent: !0,
183
- logger: { tag: et(), tagName: "uid" }
145
+ logger: { tag: st(), tagName: "uid" }
184
146
  });
185
147
  try {
186
- this[y] || (this[y] = /* @__PURE__ */ new Map());
148
+ this[v] || (this[v] = /* @__PURE__ */ new Map());
187
149
  const n = t.call(s, e, s);
188
- this[y].set(t, n);
150
+ this[v].set(t, n);
189
151
  } catch (n) {
190
152
  throw this.crash(n);
191
153
  }
@@ -199,37 +161,37 @@ const N = class N {
199
161
  getStore(t) {
200
162
  var i;
201
163
  if (!f(t))
202
- throw new I("Invalid store.");
164
+ throw new U("Invalid store.");
203
165
  let e = this, s;
204
- for (; s = (i = e[y]) == null ? void 0 : i.get(t), s == null && e[p] != null; )
166
+ for (; s = (i = e[v]) == null ? void 0 : i.get(t), s == null && e[p] != null; )
205
167
  e = e[p];
206
168
  if (s == null)
207
- throw this.crash(new I(`Store '${t.name}' is not provided by this context.`));
169
+ throw this.crash(new U(`Store '${t.name}' is not provided by this context.`));
208
170
  return s;
209
171
  }
210
172
  /**
211
173
  * Schedule a callback function to run just before this context is mounted.
212
174
  */
213
175
  beforeMount(t) {
214
- return this[u].on(0, t), () => this[u].off(0, t);
176
+ return this[l].on(0, t), () => this[l].off(0, t);
215
177
  }
216
178
  /**
217
179
  * Schedule a callback function to run after this context is mounted.
218
180
  */
219
181
  onMount(t) {
220
- return this[u].on(1, t), () => this[u].off(1, t);
182
+ return this[l].on(1, t), () => this[l].off(1, t);
221
183
  }
222
184
  /**
223
185
  * Schedule a callback function to run just before this context is unmounted.
224
186
  */
225
187
  beforeUnmount(t) {
226
- return this[u].on(2, t), () => this[u].off(2, t);
188
+ return this[l].on(2, t), () => this[l].off(2, t);
227
189
  }
228
190
  /**
229
191
  * Schedule a callback function to run after this context is unmounted.
230
192
  */
231
193
  onUnmount(t) {
232
- return this[u].on(3, t), () => this[u].off(3, t);
194
+ return this[l].on(3, t), () => this[l].off(3, t);
233
195
  }
234
196
  effect(t) {
235
197
  const e = () => {
@@ -239,13 +201,13 @@ const N = class N {
239
201
  this.error(s), s instanceof Error ? this.crash(s) : typeof s == "string" ? this.crash(new Error(s)) : this.crash(new Error("Unknown error thrown in effect callback"));
240
202
  }
241
203
  };
242
- if (this[u].state >= 1) {
243
- const s = g(e);
244
- return this[u].on(3, s), s;
204
+ if (this[l].state >= 1) {
205
+ const s = w(e);
206
+ return this[l].on(3, s), s;
245
207
  } else {
246
208
  let s, i = !1;
247
- return this[u].on(0, () => {
248
- i || (s = g(e), this[u].on(3, s));
209
+ return this[l].on(0, () => {
210
+ i || (s = w(e), this[l].on(3, s));
249
211
  }), () => {
250
212
  s != null && (i = !0, s());
251
213
  };
@@ -255,7 +217,7 @@ const N = class N {
255
217
  var s;
256
218
  if (arguments.length > 0) {
257
219
  let i = this, n;
258
- for (; n = (s = i[b]) == null ? void 0 : s.get(t), n === void 0 && i[p] != null; )
220
+ for (; n = (s = i[g]) == null ? void 0 : s.get(t), n === void 0 && i[p] != null; )
259
221
  i = i[p];
260
222
  if (n === void 0) {
261
223
  if (arguments.length > 1)
@@ -266,35 +228,35 @@ const N = class N {
266
228
  } else {
267
229
  let i = this;
268
230
  const n = [];
269
- for (; i[b] && n.push(...i[b].entries()), i[p] != null; )
231
+ for (; i[g] && n.push(...i[g].entries()), i[p] != null; )
270
232
  i = i[p];
271
233
  return new Map(n.reverse());
272
234
  }
273
235
  }
274
236
  setState() {
275
- if (this[b] || (this[b] = /* @__PURE__ */ new Map()), arguments.length === 2)
276
- this[b].set(arguments[0], arguments[1]);
277
- else if (ut(arguments[0]) === "array")
237
+ if (this[g] || (this[g] = /* @__PURE__ */ new Map()), arguments.length === 2)
238
+ this[g].set(arguments[0], arguments[1]);
239
+ else if (dt(arguments[0]) === "array")
278
240
  for (const [t, e] of arguments[0])
279
- e === void 0 ? this[b].delete(t) : this[b].set(t, e);
241
+ e === void 0 ? this[g].delete(t) : this[g].set(t, e);
280
242
  else
281
243
  throw new Error("Invalid arguments.");
282
244
  return this;
283
245
  }
284
246
  };
285
- v = new WeakMap();
286
- let l = N;
287
- function At(o, t) {
288
- return new l(o, t);
247
+ x = new WeakMap();
248
+ let d = I;
249
+ function _t(o, t) {
250
+ return new d(o, t);
289
251
  }
290
- class I extends Error {
252
+ class U extends Error {
291
253
  }
292
- const x = Symbol.for("dollaMarkupNode");
293
- var F;
294
- F = x;
295
- class E {
254
+ const N = Symbol("type"), k = Symbol("MarkupNode");
255
+ var Y;
256
+ Y = N;
257
+ class $ {
296
258
  constructor(t) {
297
- c(this, F, !0);
259
+ c(this, Y, k);
298
260
  c(this, "root");
299
261
  this.root = t;
300
262
  }
@@ -305,7 +267,7 @@ class E {
305
267
  t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null);
306
268
  }
307
269
  unmount(t = !1) {
308
- this.root.parentNode && !t && this.root.parentNode.removeChild(this.root);
270
+ !t && this.root.parentNode && this.root.parentNode.removeChild(this.root);
309
271
  }
310
272
  move(t, e) {
311
273
  if ("moveBefore" in t && this.root instanceof Element)
@@ -318,11 +280,11 @@ class E {
318
280
  this.mount(t, e);
319
281
  }
320
282
  }
321
- var Z;
322
- Z = x;
323
- class C {
283
+ var J;
284
+ J = N;
285
+ class A {
324
286
  constructor(t, e) {
325
- c(this, Z, !0);
287
+ c(this, J, k);
326
288
  c(this, "root", document.createTextNode(""));
327
289
  c(this, "children", []);
328
290
  c(this, "context");
@@ -334,11 +296,11 @@ class C {
334
296
  return this.root.parentElement != null;
335
297
  }
336
298
  mount(t, e) {
337
- this.isMounted() || (t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.unsubscribe = g(() => {
299
+ this.isMounted() || (t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.unsubscribe = w(() => {
338
300
  try {
339
301
  const s = this.$slot();
340
- S(() => {
341
- this.update(X(s) ? s : [s]);
302
+ E(() => {
303
+ this.update(it(s));
342
304
  });
343
305
  } catch (s) {
344
306
  this.context.crash(s);
@@ -371,7 +333,7 @@ class C {
371
333
  update(t) {
372
334
  var s;
373
335
  if (this.cleanup(!1), t.length === 0 || !this.isMounted()) return;
374
- const e = _(this.context, t);
336
+ const e = B(this.context, t);
375
337
  for (const i of e) {
376
338
  const n = ((s = this.children.at(-1)) == null ? void 0 : s.root) || this.root;
377
339
  i.mount(this.root.parentElement, n), this.children.push(i);
@@ -387,23 +349,28 @@ class C {
387
349
  "moveBefore" in t ? t.moveBefore(this.root, e) : t.insertBefore(this.root, e);
388
350
  }
389
351
  }
390
- const st = Symbol("View");
391
- var K;
392
- K = x;
393
- class it {
352
+ const ot = Symbol("View");
353
+ var Q;
354
+ Q = N;
355
+ class nt {
356
+ /**
357
+ * @param context - Parent contenxt to link to.
358
+ * @param view - View function to mount.
359
+ * @param props - Props to pass to view function.
360
+ */
394
361
  constructor(t, e, s) {
395
- c(this, K, !0);
396
- c(this, "uniqueId", et());
362
+ c(this, Q, k);
363
+ c(this, "uniqueId", st());
397
364
  c(this, "context");
398
365
  c(this, "props");
399
366
  c(this, "view");
400
367
  c(this, "node");
401
- this.context = l.linked(t, e.name ?? "anonymous view", {
368
+ this.context = d.linked(t, e.name ?? "anonymous view", {
402
369
  logger: {
403
370
  tag: this.uniqueId,
404
371
  tagName: "uid"
405
372
  }
406
- }), this.context.setState(st, this), this.props = s, this.view = e;
373
+ }), this.context.setState(ot, this), this.props = s, this.view = e;
407
374
  }
408
375
  get root() {
409
376
  var t;
@@ -419,28 +386,28 @@ class it {
419
386
  const { context: i, props: n, view: r } = this;
420
387
  try {
421
388
  const a = r.call(i, n, i);
422
- a != null && a !== !1 && (this.node = ct(a, i));
389
+ a != null && a !== !1 && (this.node = ht(a, i));
423
390
  } catch (a) {
424
391
  throw a instanceof Error && i.crash(a), a;
425
392
  }
426
- l.willMount(this.context);
393
+ d.emit(this.context, b.WILL_MOUNT);
427
394
  }
428
- this.node && this.node.mount(t, e), s || l.didMount(this.context);
395
+ this.node && this.node.mount(t, e), s || d.emit(this.context, b.DID_MOUNT);
429
396
  }
430
397
  unmount(t = !1) {
431
- l.willUnmount(this.context), this.node && this.node.unmount(t), l.didUnmount(this.context), l.dispose(this.context);
398
+ d.emit(this.context, b.WILL_UNMOUNT), this.node && this.node.unmount(t), d.emit(this.context, b.DID_UNMOUNT), d.emit(this.context, b.DISPOSE);
432
399
  }
433
400
  move(t, e) {
434
401
  var s;
435
402
  (s = this.node) == null || s.move(t, e);
436
403
  }
437
404
  }
438
- const gt = (o) => /^on[A-Z]/.test(o), P = Symbol("HTML.isSVG");
439
- var Y;
440
- Y = x;
441
- class wt {
405
+ const vt = (o) => /^on[A-Z]/.test(o), P = Symbol("HTML.isSVG"), xt = ["class", "className", "ref", "mixin", "children"];
406
+ var X;
407
+ X = N;
408
+ class Nt {
442
409
  constructor(t, e, s) {
443
- c(this, Y, !0);
410
+ c(this, X, k);
444
411
  c(this, "root");
445
412
  c(this, "parentContext");
446
413
  c(this, "context");
@@ -452,28 +419,26 @@ class wt {
452
419
  c(this, "ref");
453
420
  // Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
454
421
  c(this, "canClickAway", !1);
455
- if (this.parentContext = t, this.tag = e, this.props = s, this.context = l.linked(this.parentContext, V.bind(this)), e.toLowerCase() === "svg" && this.context.setState(P, !0), this.context.getState(P, !1) ? this.root = document.createElementNS("http://www.w3.org/2000/svg", e) : this.root = document.createElement(e), dt() === "development") {
456
- const n = this.context.getState(st, null);
422
+ if (this.parentContext = t, this.tag = e, this.props = s, this.context = d.linked(this.parentContext, q.bind(this)), e.toLowerCase() === "svg" && this.context.setState(P, !0), this.context.getState(P, !1) ? this.root = document.createElementNS("http://www.w3.org/2000/svg", e) : this.root = document.createElement(e), mt() === "development") {
423
+ const n = this.context.getState(ot, null);
457
424
  n && (this.root.dataset.view = n.context.getName());
458
425
  }
459
- if (s.mixin) {
460
- const n = X(s.mixin) ? s.mixin : [s.mixin];
461
- for (const r of n)
462
- r(
426
+ if (s.mixin)
427
+ for (const n of it(s.mixin))
428
+ n(
463
429
  this.root,
464
- l.linked(this.context, V.bind(this), {
430
+ d.linked(this.context, q.bind(this), {
465
431
  bindLifecycleToParent: !0,
466
- logger: { tagName: r.name === "mixin" ? void 0 : "mixin", tag: r.name }
432
+ logger: { tagName: n.name === "mixin" ? void 0 : "mixin", tag: n.name }
467
433
  })
468
434
  );
469
- }
470
435
  const i = s.className ?? s.class;
471
- if (this.applyProps(this.root, ft(["class", "className", "ref", "mixin", "children"], s)), s.style && this.applyStyles(this.root, s.style, this.unsubscribers), i && this.applyClasses(this.root, i, this.unsubscribers), s.ref)
436
+ if (this.applyProps(this.root, pt(xt, s)), s.style && this.applyStyles(this.root, s.style, this.unsubscribers), i && this.applyClasses(this.root, i, this.unsubscribers), s.ref)
472
437
  if (f(s.ref))
473
438
  this.ref = s.ref, this.ref(this.root);
474
439
  else
475
440
  throw new Error("Expected ref to be a function. Got: " + s.ref);
476
- s.children && (this.childNodes = _(this.context, s.children));
441
+ s.children && (this.childNodes = B(this.context, s.children));
477
442
  }
478
443
  isMounted() {
479
444
  return this.context.isMounted;
@@ -481,23 +446,23 @@ class wt {
481
446
  mount(t, e) {
482
447
  const s = this.isMounted();
483
448
  if (!s) {
484
- l.willMount(this.context);
449
+ d.emit(this.context, b.WILL_MOUNT);
485
450
  for (let i = 0; i < this.childNodes.length; i++) {
486
451
  const n = this.childNodes[i], r = i > 0 ? this.childNodes[i - 1].root : void 0;
487
452
  n.mount(this.root, r);
488
453
  }
489
454
  }
490
- t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.canClickAway = !0, s || l.didMount(this.context);
455
+ t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.canClickAway = !0, s || d.emit(this.context, b.DID_MOUNT);
491
456
  }
492
457
  unmount(t = !1) {
493
458
  var e;
494
- l.willUnmount(this.context), t || (e = this.root.parentNode) == null || e.removeChild(this.root);
459
+ d.emit(this.context, b.WILL_UNMOUNT), t || (e = this.root.parentNode) == null || e.removeChild(this.root);
495
460
  for (const s of this.childNodes)
496
461
  s.unmount(!0);
497
462
  this.canClickAway = !1;
498
463
  for (const s of this.unsubscribers)
499
464
  s();
500
- this.unsubscribers.length = 0, this.ref && this.ref(void 0), l.didUnmount(this.context), l.dispose(this.context);
465
+ this.unsubscribers.length = 0, this.ref && this.ref(void 0), d.emit(this.context, b.DID_UNMOUNT), d.emit(this.context, b.DISPOSE);
501
466
  }
502
467
  move(t, e) {
503
468
  if ("moveBefore" in t)
@@ -511,7 +476,7 @@ class wt {
511
476
  }
512
477
  attachProp(t, e) {
513
478
  f(t) ? this.unsubscribers.push(
514
- g(() => {
479
+ w(() => {
515
480
  try {
516
481
  e(t());
517
482
  } catch (s) {
@@ -521,110 +486,123 @@ class wt {
521
486
  ) : e(t);
522
487
  }
523
488
  applyProps(t, e) {
524
- const s = this.context;
525
- for (const i in e) {
526
- const n = e[i];
527
- if (i === "on:clickoutside" || i === "onClickOutside" || i === "onclickoutside") {
528
- const r = (d) => {
529
- this.canClickAway && !t.contains(d.target) && n(d);
530
- }, a = { capture: !0 };
531
- window.addEventListener("click", r, a), this.unsubscribers.push(() => {
532
- window.removeEventListener("click", r, a);
489
+ for (const s in e) {
490
+ const i = e[s];
491
+ if (s === "on:clickoutside" || s === "onClickOutside" || s === "onclickoutside") {
492
+ const n = (a) => {
493
+ this.canClickAway && !t.contains(a.target) && i(a);
494
+ }, r = { capture: !0 };
495
+ window.addEventListener("click", n, r), this.unsubscribers.push(() => {
496
+ window.removeEventListener("click", n, r);
533
497
  });
534
- } else if (f(n) && gt(i)) {
535
- const r = i.slice(2).toLowerCase(), a = n;
536
- t.addEventListener(r, a), this.unsubscribers.push(() => {
537
- t.removeEventListener(r, a);
498
+ } else if (s.startsWith("prop:")) {
499
+ const n = s.substring(5);
500
+ this.attachProp(i, (r) => {
501
+ t[n] = r;
538
502
  });
539
- } else if (i.startsWith("on") && f(n) && vt.includes(i.substring(2)))
540
- t[i] = n, this.unsubscribers.push(() => {
541
- t[i] = void 0;
503
+ } else if (s.startsWith("on:")) {
504
+ const n = s.substring(3);
505
+ let r;
506
+ f(i) ? (t.addEventListener(n, i), this.unsubscribers.push(() => {
507
+ t.removeEventListener(n, i);
508
+ })) : this.attachProp(i, (a) => {
509
+ !a && r ? t.removeEventListener(n, r) : a != null && (r && r !== a && t.removeEventListener(n, r), t.addEventListener(n, a)), r = a;
542
510
  });
543
- else if (i.includes("-"))
544
- this.attachProp(n, (r) => {
545
- r == null ? t.removeAttribute(i) : t.setAttribute(i, String(r));
511
+ } else if (s.startsWith("attr:")) {
512
+ const n = s.substring(5).toLowerCase();
513
+ this.attachProp(i, (r) => {
514
+ r != null ? t.setAttribute(n, String(r)) : t.removeAttribute(n);
546
515
  });
547
- else if (!yt.includes(i))
548
- if (s.getState(P, !1))
549
- this.attachProp(n, (r) => {
550
- r != null ? t.setAttribute(i, String(e[i])) : t.removeAttribute(i);
551
- });
552
- else
553
- switch (i) {
554
- case "contentEditable":
555
- case "value":
556
- this.attachProp(n, (r) => {
557
- t[i] = String(r);
558
- });
559
- break;
560
- case "for":
561
- this.attachProp(n, (r) => {
562
- t.htmlFor = r;
563
- });
564
- break;
565
- case "innerHTML":
566
- this.attachProp(n, (r) => {
567
- t.innerHTML = r;
568
- });
569
- break;
570
- case "title":
571
- this.attachProp(n, (r) => {
572
- r == null ? t.removeAttribute(i) : t.setAttribute(i, String(r));
573
- });
574
- case "checked":
575
- this.attachProp(n, (r) => {
576
- t.checked = r, r ? t.setAttribute("checked", "") : t.removeAttribute("checked");
577
- });
578
- break;
579
- case "autocomplete":
580
- case "autocapitalize":
581
- this.attachProp(n, (r) => {
582
- typeof r == "string" ? t[i] = r : r ? t[i] = "on" : t[i] = "off";
583
- });
584
- break;
585
- default: {
586
- if (i.startsWith("prop:")) {
587
- const r = i.substring(5);
588
- this.attachProp(n, (a) => {
589
- t[r] = a;
590
- });
591
- } else if (i.startsWith("on:")) {
592
- const r = i.substring(3);
593
- let a;
594
- f(n) ? (t.addEventListener(r, n), this.unsubscribers.push(() => {
595
- t.removeEventListener(r, n);
596
- })) : this.attachProp(n, (d) => {
597
- !d && a ? t.removeEventListener(r, a) : d != null && (a && a !== d && t.removeEventListener(r, a), t.addEventListener(r, d)), a = d;
598
- });
599
- } else if (i.startsWith("attr:")) {
600
- const r = i.substring(5).toLowerCase();
601
- this.attachProp(n, (a) => {
602
- a != null ? t.setAttribute(r, String(a)) : t.removeAttribute(r);
603
- });
516
+ } else if (f(i) && vt(s)) {
517
+ const n = s.slice(2).toLowerCase(), r = i;
518
+ t.addEventListener(n, r), this.unsubscribers.push(() => {
519
+ t.removeEventListener(n, r);
520
+ });
521
+ } else if (s.startsWith("on") && f(i) && kt.includes(s.substring(2)))
522
+ t[s] = i, this.unsubscribers.push(() => {
523
+ t[s] = void 0;
524
+ });
525
+ else if (s.includes("-"))
526
+ this.attachProp(i, (n) => {
527
+ n == null ? t.removeAttribute(s) : t.setAttribute(s, String(n));
528
+ });
529
+ else if (this.context.getState(P, !1))
530
+ this.attachProp(i, (n) => {
531
+ n != null ? t.setAttribute(s, String(e[s])) : t.removeAttribute(s);
532
+ });
533
+ else
534
+ switch (s) {
535
+ case "contentEditable":
536
+ case "value":
537
+ this.attachProp(i, (r) => {
538
+ t[s] = String(r);
539
+ });
540
+ break;
541
+ case "for":
542
+ this.attachProp(i, (r) => {
543
+ t.htmlFor = r;
544
+ });
545
+ break;
546
+ case "innerHTML":
547
+ this.attachProp(i, (r) => {
548
+ t.innerHTML = r;
549
+ });
550
+ break;
551
+ case "title":
552
+ this.attachProp(i, (r) => {
553
+ r == null ? t.removeAttribute(s) : t.setAttribute(s, String(r));
554
+ });
555
+ case "checked":
556
+ this.attachProp(i, (r) => {
557
+ t.checked = r, r ? t.setAttribute("checked", "") : t.removeAttribute("checked");
558
+ });
559
+ break;
560
+ case "dataset":
561
+ let n = {};
562
+ this.attachProp(i, (r) => {
563
+ if (D(r)) {
564
+ const a = {};
565
+ for (const u in r)
566
+ a[bt(u)] = String(r[u]);
567
+ for (const u in n)
568
+ Object.hasOwn(n, u) && !Object.hasOwn(a, u) && (delete t.dataset[u], delete n[u]);
569
+ for (const u in a)
570
+ n[u] !== a[u] && (t.dataset[u] = a[u], n[u] = a[u]);
604
571
  } else
605
- this.attachProp(n, (r) => {
606
- t[i] = r;
607
- });
608
- break;
609
- }
572
+ for (const a in n)
573
+ delete t.dataset[a];
574
+ });
575
+ break;
576
+ case "autocomplete":
577
+ case "autocapitalize":
578
+ this.attachProp(i, (r) => {
579
+ typeof r == "string" ? t[s] = r : r ? t[s] = "on" : t[s] = "off";
580
+ });
581
+ break;
582
+ default: {
583
+ this.attachProp(i, (r) => {
584
+ t[s] = r;
585
+ });
586
+ break;
610
587
  }
588
+ }
611
589
  }
612
590
  }
613
591
  applyStyles(t, e, s) {
614
592
  const i = [];
615
593
  if (f(e)) {
616
594
  let n;
617
- const r = g(() => {
618
- f(n) && n(), t.style.cssText = "", n = this.applyStyles(t, w(e), s);
595
+ const r = w(() => {
596
+ f(n) && n(), t.style.cssText = "", n = this.applyStyles(t, y(e), s);
619
597
  });
620
598
  s.push(r), i.push(r);
621
599
  } else {
622
- const n = ot(e);
600
+ const n = ct(e);
623
601
  for (const r in n) {
624
- const { value: a, priority: d } = n[r];
602
+ const { value: a, priority: u } = n[r];
625
603
  if (f(a)) {
626
- const h = g(() => {
627
- w(a) ? t.style.setProperty(r, String(w(a)), d) : t.style.removeProperty(r);
604
+ const h = w(() => {
605
+ y(a) ? t.style.setProperty(r, String(y(a)), u) : t.style.removeProperty(r);
628
606
  });
629
607
  s.push(h), i.push(h);
630
608
  } else a != null && t.style.setProperty(r, String(a));
@@ -639,19 +617,19 @@ class wt {
639
617
  const i = [];
640
618
  if (f(e)) {
641
619
  let n;
642
- const r = g(() => {
643
- f(n) && n(), t.removeAttribute("class"), n = this.applyClasses(t, w(e), s);
620
+ const r = w(() => {
621
+ f(n) && n(), t.removeAttribute("class"), n = this.applyClasses(t, y(e), s);
644
622
  });
645
623
  s.push(r), i.push(r);
646
624
  } else {
647
- const n = nt(e);
625
+ const n = rt(e);
648
626
  for (const r in n) {
649
627
  const a = n[r];
650
628
  if (f(a)) {
651
- const d = g(() => {
652
- w(a) ? t.classList.add(r) : t.classList.remove(r);
629
+ const u = w(() => {
630
+ y(a) ? t.classList.add(r) : t.classList.remove(r);
653
631
  });
654
- s.push(d), i.push(d);
632
+ s.push(u), i.push(u);
655
633
  } else a && t.classList.add(r);
656
634
  }
657
635
  }
@@ -661,37 +639,37 @@ class wt {
661
639
  };
662
640
  }
663
641
  }
664
- function nt(o) {
642
+ function rt(o) {
665
643
  let t = {};
666
- if (U(o)) {
644
+ if (C(o)) {
667
645
  const e = o.split(" ");
668
646
  for (const s of e)
669
647
  t[s] = !0;
670
- } else tt(o) ? Object.assign(t, o) : Array.isArray(o) && Array.from(o).filter(Boolean).forEach((e) => {
671
- Object.assign(t, nt(e));
648
+ } else D(o) ? Object.assign(t, o) : Array.isArray(o) && Array.from(o).filter(Boolean).forEach((e) => {
649
+ Object.assign(t, rt(e));
672
650
  });
673
651
  return delete t.undefined, t;
674
652
  }
675
- function ot(o) {
653
+ function ct(o) {
676
654
  let t = {};
677
- if (U(o)) {
655
+ if (C(o)) {
678
656
  const e = o.split(";").filter((s) => s.trim() !== "");
679
657
  for (const s of e) {
680
658
  const [i, n] = s.split(":"), r = {
681
659
  value: n
682
660
  };
683
- n.includes("!important") ? (r.priority = "important", r.value = n.replace("!important", "").trim()) : r.value = n.trim(), t[R(i.trim())] = r;
661
+ n.includes("!important") ? (r.priority = "important", r.value = n.replace("!important", "").trim()) : r.value = n.trim(), t[G(i.trim())] = r;
684
662
  }
685
663
  }
686
- if (tt(o))
664
+ if (D(o))
687
665
  for (const e in o)
688
- e.startsWith("--") ? t[e] = { value: o[e] } : t[R(e)] = { value: o[e] };
666
+ e.startsWith("--") ? t[e] = { value: o[e] } : t[G(e)] = { value: o[e] };
689
667
  else Array.isArray(o) && Array.from(o).filter((e) => e != null).forEach((e) => {
690
- Object.assign(t, ot(e));
668
+ Object.assign(t, ct(e));
691
669
  });
692
670
  return t;
693
671
  }
694
- function V() {
672
+ function q() {
695
673
  if (this.root == null) return this.tag;
696
674
  let o = this.root.tagName.toLowerCase();
697
675
  if (this.root.id && (o += `#${this.root.id}`), this.root.classList.length > 0)
@@ -699,10 +677,10 @@ function V() {
699
677
  o += `.${t}`;
700
678
  return o;
701
679
  }
702
- function R(o) {
680
+ function G(o) {
703
681
  return o.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
704
682
  }
705
- const yt = ["ref", "children", "class", "style", "data", "mixin"], vt = [
683
+ const kt = [
706
684
  // Element
707
685
  "animationcancel",
708
686
  "animationend",
@@ -792,11 +770,11 @@ const yt = ["ref", "children", "class", "style", "data", "mixin"], vt = [
792
770
  "reset",
793
771
  "submit"
794
772
  ];
795
- var J;
796
- J = x;
797
- class xt {
773
+ var tt;
774
+ tt = N;
775
+ class Mt {
798
776
  constructor(t, e, s) {
799
- c(this, J, !0);
777
+ c(this, tt, k);
800
778
  c(this, "context");
801
779
  c(this, "content");
802
780
  c(this, "parent");
@@ -807,7 +785,7 @@ class xt {
807
785
  return this.element ? this.element.isMounted() : !1;
808
786
  }
809
787
  mount(t, e) {
810
- this.element = ct(this.content, this.context), this.element.mount(this.parent);
788
+ this.element = ht(this.content, this.context), this.element.mount(this.parent);
811
789
  }
812
790
  unmount(t = !1) {
813
791
  var e;
@@ -816,11 +794,11 @@ class xt {
816
794
  move(t, e) {
817
795
  }
818
796
  }
819
- var Q;
820
- Q = x;
821
- class kt {
797
+ var et;
798
+ et = N;
799
+ class St {
822
800
  constructor(t, e, s, i) {
823
- c(this, Q, !0);
801
+ c(this, et, k);
824
802
  c(this, "root", document.createTextNode(""));
825
803
  c(this, "context");
826
804
  c(this, "items");
@@ -834,9 +812,9 @@ class kt {
834
812
  return this.root.parentElement != null;
835
813
  }
836
814
  mount(t, e) {
837
- this.isMounted() || (t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.unsubscribe = g(() => {
815
+ this.isMounted() || (t.insertBefore(this.root, (e == null ? void 0 : e.nextSibling) ?? null), this.unsubscribe = w(() => {
838
816
  let s = this.items();
839
- s == null && (s = [], this.context.warn("repeat() received empty value for items", s)), S(() => {
817
+ s == null && (s = [], this.context.warn("repeat() received empty value for items", s)), E(() => {
840
818
  this._update(Array.from(s));
841
819
  });
842
820
  }));
@@ -854,7 +832,7 @@ class kt {
854
832
  this.connectedItems.clear();
855
833
  }
856
834
  _update(t) {
857
- var r, a, d;
835
+ var r, a, u;
858
836
  if (t.length === 0 || !this.isMounted())
859
837
  return this._cleanup(!1);
860
838
  const e = /* @__PURE__ */ new Map();
@@ -870,20 +848,20 @@ class kt {
870
848
  const i = [];
871
849
  for (const h of this.connectedItems.values())
872
850
  !e.has(h.key) && h.node.isMounted() && h.node.unmount(!1);
873
- mt(() => {
851
+ gt(() => {
874
852
  for (const h of e.values()) {
875
853
  const m = this.connectedItems.get(h.key);
876
854
  if (m && m.node.isMounted())
877
855
  m.$item(h.value), m.$index(h.index), i[h.index] = m;
878
856
  else {
879
- const k = T(h.value, { equals: pt }), M = T(h.index);
857
+ const M = _(h.value, { equals: wt }), S = _(h.index);
880
858
  i[h.index] = {
881
859
  key: h.key,
882
- $item: k,
883
- $index: M,
884
- node: new it(this.context, Mt, {
885
- $item: () => k(),
886
- $index: () => M(),
860
+ $item: M,
861
+ $index: S,
862
+ node: new nt(this.context, It, {
863
+ $item: () => M(),
864
+ $index: () => S(),
887
865
  render: this.render
888
866
  })
889
867
  };
@@ -891,20 +869,21 @@ class kt {
891
869
  }
892
870
  });
893
871
  for (let h = 0; h < i.length; h++) {
894
- const m = i[h], k = ((r = i[h - 1]) == null ? void 0 : r.node.root) ?? this.root, M = this.connectedItems.get(m.key);
895
- M && M.node.isMounted() ? m.node.move(this.root.parentElement, k) : m.node.mount(this.root.parentElement, k);
872
+ const m = i[h], M = ((r = i[h - 1]) == null ? void 0 : r.node.root) ?? this.root, S = this.connectedItems.get(m.key);
873
+ S && S.node.isMounted() ? m.node.move(this.root.parentElement, M) : m.node.mount(this.root.parentElement, M);
896
874
  }
897
875
  this.connectedItems.clear();
898
876
  for (const h of i)
899
877
  this.connectedItems.set(h.key, h);
900
878
  const n = ((a = i.at(-1)) == null ? void 0 : a.node.root) ?? this.root;
901
- (d = this.root.parentNode) == null || d.insertBefore(this.root, n.nextSibling);
879
+ (u = this.root.parentNode) == null || u.insertBefore(this.root, n.nextSibling);
902
880
  }
903
881
  }
904
- function Mt(o, t) {
905
- return t.setName("@RepeatItemView"), o.render.call(t, o.$item, o.$index, t);
882
+ const Et = "dolla.RepeatItemView";
883
+ function It(o, t) {
884
+ return t.setName(Et), o.render.call(t, o.$item, o.$index, t);
906
885
  }
907
- class rt {
886
+ class at {
908
887
  constructor(t, e) {
909
888
  /**
910
889
  * In the case of a view, type will be the View function itself. It can also hold an identifier for special nodes like "$cond", "$repeat", etc.
@@ -919,101 +898,99 @@ class rt {
919
898
  this.type = t, this.props = e;
920
899
  }
921
900
  }
922
- function St(o) {
923
- return (o == null ? void 0 : o[x]) === !0;
901
+ function Lt(o) {
902
+ return (o == null ? void 0 : o[N]) === k;
924
903
  }
925
- function O(o, t) {
926
- return new rt(o, t ?? {});
904
+ var Ot = /* @__PURE__ */ ((o) => (o.DOM = "$dom", o.Dynamic = "$dynamic", o.Portal = "$portal", o.Repeat = "$repeat", o))(Ot || {});
905
+ function W(o, t) {
906
+ return new at(o, t ?? {});
927
907
  }
928
- function Et(o, t, e) {
929
- return O("$dynamic", {
930
- source: T(() => {
931
- const s = w(o);
908
+ function Tt(o, t, e) {
909
+ return W("$dynamic", {
910
+ source: _(() => {
911
+ const s = y(o);
932
912
  return s && t ? t : !s && e ? e : null;
933
913
  })
934
914
  });
935
915
  }
936
- function It(o, t, e) {
937
- return Et(o, e, t);
916
+ function At(o, t, e) {
917
+ return Tt(o, e, t);
938
918
  }
939
- function Pt(o, t, e) {
940
- return O("$repeat", { items: () => w(o), key: t, render: e });
919
+ function Dt(o, t, e) {
920
+ return W("$repeat", { items: () => y(o), key: t, render: e });
941
921
  }
942
- function Tt(o, t) {
943
- return O("$portal", { parent: o, content: t });
922
+ function Ct(o, t) {
923
+ return W("$portal", { parent: o, content: t });
944
924
  }
945
- function ct(o, t = new l("$")) {
946
- const e = _(t, [o]);
947
- return e.length === 1 ? e[0] : new C(t, () => e);
925
+ function ht(o, t = new d("$")) {
926
+ const e = B(t, [o]);
927
+ return e.length === 1 ? e[0] : new A(t, () => e);
948
928
  }
949
- function _(o, ...t) {
929
+ function B(o, ...t) {
950
930
  const e = t.flat(1 / 0), s = [];
951
931
  for (const i of e)
952
932
  if (!(i == null || i === !1)) {
953
933
  if (i instanceof Node) {
954
- s.push(new E(i));
934
+ s.push(new $(i));
955
935
  continue;
956
936
  }
957
- if (i instanceof rt)
937
+ if (i instanceof at)
958
938
  if (f(i.type)) {
959
- s.push(new it(o, i.type, i.props));
939
+ s.push(new nt(o, i.type, i.props));
960
940
  continue;
961
- } else if (U(i.type))
941
+ } else if (C(i.type))
962
942
  switch (i.type) {
963
943
  case "$dom": {
964
944
  const n = i.props;
965
- s.push(new E(n.value));
945
+ s.push(new $(n.value));
966
946
  continue;
967
947
  }
968
- case "$text": {
969
- const n = i.props;
970
- s.push(new E(document.createTextNode(String(n.value))));
971
- continue;
972
- }
973
- case "$repeat": {
948
+ case "$dynamic": {
974
949
  const n = i.props;
975
- s.push(new kt(o, n.items, n.key, n.render));
950
+ s.push(new A(o, n.source));
976
951
  continue;
977
952
  }
978
- case "$dynamic": {
953
+ case "$portal": {
979
954
  const n = i.props;
980
- s.push(new C(o, n.source));
955
+ s.push(new Mt(o, n.content, n.parent));
981
956
  continue;
982
957
  }
983
- case "$portal": {
958
+ case "$repeat": {
984
959
  const n = i.props;
985
- s.push(new xt(o, n.content, n.parent));
960
+ s.push(new St(o, n.items, n.key, n.render));
986
961
  continue;
987
962
  }
988
963
  default:
989
- s.push(new wt(o, i.type, i.props));
964
+ s.push(new Nt(o, i.type, i.props));
990
965
  continue;
991
966
  }
992
967
  else
993
968
  throw new TypeError(`Expected a string or view function. Got: ${i.type}`);
994
- if (St(i)) {
969
+ if (Lt(i)) {
995
970
  s.push(i);
996
971
  continue;
997
972
  }
998
973
  if (f(i)) {
999
- s.push(new C(o, i));
974
+ s.push(new A(o, i));
1000
975
  continue;
1001
976
  }
1002
- s.push(new E(document.createTextNode(String(i))));
977
+ s.push(new $(document.createTextNode(String(i))));
1003
978
  }
1004
979
  return s;
1005
980
  }
1006
981
  export {
1007
- l as C,
1008
- C as D,
1009
- rt as M,
1010
- it as V,
1011
- Pt as a,
1012
- At as c,
1013
- O as m,
1014
- Tt as p,
1015
- ct as r,
1016
- It as u,
1017
- Et as w
982
+ d as C,
983
+ A as D,
984
+ b as L,
985
+ Ot as M,
986
+ nt as V,
987
+ Dt as a,
988
+ at as b,
989
+ _t as c,
990
+ W as m,
991
+ Ct as p,
992
+ ht as r,
993
+ At as u,
994
+ Tt as w
1018
995
  };
1019
- //# sourceMappingURL=markup-BBa4WBj1.js.map
996
+ //# sourceMappingURL=markup-BGlfQYQk.js.map