@manyducks.co/dolla 3.0.0 → 3.1.0

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.
@@ -1,50 +1,11 @@
1
1
  import { a as e, c as t, d as n, f as r, i, l as a, m as o, o as s, p as c, u as l } from "./signals-CMJPGr_M.js";
2
- //#region src/core/context.ts
3
- var u = Symbol("Context.mountListeners"), d = Symbol("Context.cleanupListeners");
4
- function f(e) {
5
- return Object.assign(Object.create(e ?? null), { isMounted: !1 });
6
- }
7
- function p(e) {
8
- e.isMounted || (e.isMounted = !0, h(e, u));
9
- }
10
- function m(e) {
11
- e.isMounted && (e.isMounted = !1, h(e, d));
12
- }
13
- function h(e, t) {
14
- if (Object.hasOwn(e, t)) {
15
- for (let n of e[t]) n();
16
- e[t].length = 0;
17
- }
18
- }
19
- function g(e, t) {
20
- Object.hasOwn(e, u) ? e[u].push(t) : e[u] = [t];
21
- }
22
- function _(e, t) {
23
- Object.hasOwn(e, d) ? e[d].push(t) : e[d] = [t];
24
- }
25
- function v(e, t) {
26
- e.isMounted ? _(e, i(t)) : g(e, () => {
27
- _(e, i(t));
28
- });
29
- }
30
- var y = Symbol("Dolla.StoreId");
31
- function b(e, n, ...r) {
32
- n[y] ??= Symbol(n.name), t(!Object.hasOwn(e, n[y]), "Store was already provided on this context.");
33
- let i = f(e);
34
- return g(e, () => p(i)), _(e, () => m(i)), i.name = n.name, e[n[y]] = n.call(i, r[0], i);
35
- }
36
- function x(e, n) {
37
- let r = n[y], i = r ? e[r] : void 0;
38
- return t(i != null, `Store '${n.name}' is not provided by this context.`), i;
39
- }
40
- //#endregion
41
2
  //#region src/core/markup/types.ts
42
- var S = Symbol(), C = Symbol(), w = Symbol(), T = class {
43
- static [w] = !0;
44
- get [C]() {
3
+ var u = Symbol(), d = Symbol(), f = Symbol(), p = class {
4
+ static [f] = !0;
5
+ get [d]() {
45
6
  return !0;
46
7
  }
47
- }, E = class extends T {
8
+ }, m = class extends p {
48
9
  #e;
49
10
  constructor(e, t) {
50
11
  super(), this.#e = t;
@@ -56,24 +17,24 @@ var S = Symbol(), C = Symbol(), w = Symbol(), T = class {
56
17
  return this.#e.parentNode != null;
57
18
  }
58
19
  mount(e, t) {
59
- G(e, this.#e, t);
20
+ N(e, this.#e, t);
60
21
  }
61
22
  unmount(e = !1) {
62
23
  e || this.#e.parentNode?.removeChild(this.#e);
63
24
  }
64
25
  move(e, t) {
65
- q(e, this.#e, t);
26
+ F(e, this.#e, t);
66
27
  }
67
28
  };
68
29
  //#endregion
69
30
  //#region src/core/markup/scheduler.ts
70
- function D(e) {
31
+ function h(e) {
71
32
  e();
72
33
  }
73
34
  //#endregion
74
35
  //#region src/core/markup/nodes/dynamic.ts
75
- var O = class extends T {
76
- #e = K("");
36
+ var g = class extends p {
37
+ #e = P("");
77
38
  #t = [];
78
39
  #n;
79
40
  #r;
@@ -88,8 +49,8 @@ var O = class extends T {
88
49
  return this.#e.parentNode != null;
89
50
  }
90
51
  mount(e, t) {
91
- this.isMounted() || (G(e, this.#e, t), this.#i = s(this.#r, (e) => {
92
- D(() => {
52
+ this.isMounted() || (N(e, this.#e, t), this.#i = s(this.#r, (e) => {
53
+ h(() => {
93
54
  this.#o(e);
94
55
  });
95
56
  }));
@@ -118,7 +79,7 @@ var O = class extends T {
118
79
  if (!this.isMounted()) return;
119
80
  if ((typeof e == "string" || typeof e == "number") && this.#t.length === 1) {
120
81
  let t = this.#t[0];
121
- if (t instanceof E) {
82
+ if (t instanceof m) {
122
83
  let n = t.getRoot();
123
84
  if (n && n.nodeType === Node.TEXT_NODE) {
124
85
  n.nodeValue = String(e);
@@ -127,7 +88,7 @@ var O = class extends T {
127
88
  }
128
89
  }
129
90
  if (this.#a(!1), e == null || e === !1) return;
130
- let t = W(this.#n, e), n = this.#e.parentElement, r = this.#e;
91
+ let t = M(this.#n, e), n = this.#e.parentElement, r = this.#e;
131
92
  for (let e = 0; e < t.length; e++) {
132
93
  let i = t[e];
133
94
  i.mount(n, r), this.#t.push(i);
@@ -135,7 +96,7 @@ var O = class extends T {
135
96
  a && (r = a);
136
97
  }
137
98
  }
138
- }, k = Symbol("parentElement"), A = Symbol("debug"), j = Symbol("isSVG"), M = ["ref", "children"], N = class extends T {
99
+ }, _ = Symbol("parentElement"), v = Symbol("debug"), y = Symbol("isSVG"), b = ["ref", "children"], x = class extends p {
139
100
  #e;
140
101
  #t;
141
102
  #n;
@@ -144,8 +105,8 @@ var O = class extends T {
144
105
  #a = /* @__PURE__ */ new Set();
145
106
  #o;
146
107
  constructor(e, t, n) {
147
- if (super(), this.#t = n, this.#n = e, t === "svg" ? (this.#n = f(e), this.#n[j] = !0, this.#r = !0) : this.#n[j] && t === "foreignObject" && (this.#n = f(e), this.#n[j] = !1, this.#r = !1), this.#n[j] ? this.#e = document.createElementNS("http://www.w3.org/2000/svg", t) : this.#e = document.createElement(t), this.#n[A]) {
148
- let e = this.#n[Y];
108
+ if (super(), this.#t = n, this.#n = e, t === "svg" ? (this.#n = V(e), this.#n[y] = !0, this.#r = !0) : this.#n[y] && t === "foreignObject" && (this.#n = V(e), this.#n[y] = !1, this.#r = !1), this.#n[y] ? this.#e = document.createElementNS("http://www.w3.org/2000/svg", t) : this.#e = document.createElement(t), this.#n[v]) {
109
+ let e = Y(this.#n);
149
110
  e && (this.#e.dataset.view = e.context.name);
150
111
  }
151
112
  }
@@ -157,23 +118,23 @@ var O = class extends T {
157
118
  }
158
119
  mount(e, t) {
159
120
  let n = this.isMounted();
160
- if (!n && (this.#c(this.#e, o(M, this.#t)), this.#t.children)) {
161
- this.#i = W(this.#n, this.#t.children);
121
+ if (!n && (this.#c(this.#e, o(b, this.#t)), this.#t.children)) {
122
+ this.#i = M(this.#n, this.#t.children);
162
123
  for (let e of this.#i) e.mount(this.#e);
163
124
  }
164
125
  let r = t?.nextSibling ?? null;
165
- if ((this.#e.parentNode !== e || this.#e.nextSibling !== r) && G(e, this.#e, r), !n) {
126
+ if ((this.#e.parentNode !== e || this.#e.nextSibling !== r) && N(e, this.#e, r), !n) {
166
127
  if (l(this.#t.ref)) {
167
128
  let e = this.#t.ref(this.#e);
168
129
  l(e) && (this.#o = e);
169
130
  }
170
- this.#r && p(this.#n);
131
+ this.#r && H(this.#n);
171
132
  }
172
133
  }
173
134
  unmount(e = !1) {
174
135
  !e && this.#e.parentNode && this.#e.parentNode.removeChild(this.#e);
175
136
  for (let e of this.#i) e.unmount(!0);
176
- this.#a.forEach((e) => e()), this.#a.clear(), this.#r && m(this.#n), this.#o &&= (this.#o(), void 0), this.#i.length = 0;
137
+ this.#a.forEach((e) => e()), this.#a.clear(), this.#r && U(this.#n), this.#o &&= (this.#o(), void 0), this.#i.length = 0;
177
138
  }
178
139
  move(e, t) {
179
140
  if (e.moveBefore) try {
@@ -184,7 +145,7 @@ var O = class extends T {
184
145
  }
185
146
  #s(e, t) {
186
147
  l(e) ? this.#a.add(s(e, (e) => {
187
- D(() => t(e));
148
+ h(() => t(e));
188
149
  })) : t(e);
189
150
  }
190
151
  #c(e, t) {
@@ -203,21 +164,21 @@ var O = class extends T {
203
164
  } else if (n[0] === ":" || n.startsWith("attr:")) {
204
165
  let t = n.substring(5).toLowerCase();
205
166
  this.#s(r, (n) => {
206
- R(e, t, n);
167
+ E(e, t, n);
207
168
  });
208
169
  } else if (n[0] === "@" && l(r)) {
209
170
  let t = n.substring(1);
210
- this.#a.add(J(e, t, r));
171
+ this.#a.add(I(e, t, r));
211
172
  } else if (n.startsWith("on") && l(r)) {
212
173
  let t = n.toLowerCase().slice(2);
213
- this.#a.add(J(e, t, r));
214
- } else n in e && !this.#n[j] ? typeof e[n] == "boolean" ? this.#s(r, (t) => {
174
+ this.#a.add(I(e, t, r));
175
+ } else n in e && !this.#n[y] ? typeof e[n] == "boolean" ? this.#s(r, (t) => {
215
176
  let r = !!t;
216
- e[n] = r, R(e, n, r);
177
+ e[n] = r, E(e, n, r);
217
178
  }) : this.#s(r, (t) => {
218
179
  e[n] = t;
219
180
  }) : this.#s(r, (t) => {
220
- R(e, n, t);
181
+ E(e, n, t);
221
182
  });
222
183
  }
223
184
  }
@@ -226,13 +187,13 @@ var O = class extends T {
226
187
  n.forEach((e) => {
227
188
  e(), this.#a.delete(e);
228
189
  }), n.clear(), e.style.cssText = "";
229
- let r = F(t);
190
+ let r = C(t);
230
191
  for (let [t, { value: i, priority: a }] of Object.entries(r)) if (l(i)) {
231
192
  let r = s(i, (n) => {
232
- n ? e.style.setProperty(t, L(n), a) : e.style.removeProperty(t);
193
+ n ? e.style.setProperty(t, T(n), a) : e.style.removeProperty(t);
233
194
  });
234
195
  this.#a.add(r), n.add(r);
235
- } else i != null && e.style.setProperty(t, L(i), a);
196
+ } else i != null && e.style.setProperty(t, T(i), a);
236
197
  };
237
198
  l(t) ? this.#a.add(s(t, r)) : r(t);
238
199
  }
@@ -240,8 +201,8 @@ var O = class extends T {
240
201
  let n = /* @__PURE__ */ new Set(), r = (t) => {
241
202
  n.forEach((e) => {
242
203
  e(), this.#a.delete(e);
243
- }), n.clear(), R(e, "class", null);
244
- let r = P(t);
204
+ }), n.clear(), E(e, "class", null);
205
+ let r = S(t);
245
206
  for (let [t, i] of Object.entries(r)) if (t !== "undefined") if (l(i)) {
246
207
  let r = s(i, (n) => e.classList.toggle(t, !!n));
247
208
  this.#a.add(r), n.add(r);
@@ -250,69 +211,69 @@ var O = class extends T {
250
211
  l(t) ? this.#a.add(s(t, r)) : r(t);
251
212
  }
252
213
  };
253
- function P(e) {
254
- return c(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : a(e) ? Object.assign({}, ...e.filter(Boolean).map(P)) : r(e) ? e : {};
214
+ function S(e) {
215
+ return c(e) ? Object.fromEntries(e.split(" ").map((e) => [e, !0])) : a(e) ? Object.assign({}, ...e.filter(Boolean).map(S)) : r(e) ? e : {};
255
216
  }
256
- function F(e) {
217
+ function C(e) {
257
218
  return c(e) ? Object.fromEntries(e.split(";").filter((e) => e.trim()).map((e) => {
258
219
  let [t, n] = e.split(":");
259
- return [I(t.trim()), {
220
+ return [w(t.trim()), {
260
221
  value: n.replace("!important", "").trim(),
261
222
  priority: n.includes("!important") ? "important" : ""
262
223
  }];
263
- })) : a(e) ? Object.assign({}, ...e.filter(Boolean).map(F)) : r(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.startsWith("--") ? e : I(e), { value: t }])) : {};
224
+ })) : a(e) ? Object.assign({}, ...e.filter(Boolean).map(C)) : r(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.startsWith("--") ? e : w(e), { value: t }])) : {};
264
225
  }
265
- function I(e) {
226
+ function w(e) {
266
227
  return e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (e, t) => (t ? "-" : "") + e.toLowerCase());
267
228
  }
268
- function L(e) {
229
+ function T(e) {
269
230
  return n(e) ? `${e}px` : e;
270
231
  }
271
- function R(e, t, n) {
232
+ function E(e, t, n) {
272
233
  n ? e.setAttribute(t, String(n)) : e.removeAttribute(t);
273
234
  }
274
235
  //#endregion
275
236
  //#region src/core/markup/utils.ts
276
- function z(e, t) {
237
+ function D(e, t) {
277
238
  return {
278
- [S]: !0,
239
+ [u]: !0,
279
240
  type: e,
280
241
  props: t
281
242
  };
282
243
  }
283
- function B(e) {
284
- return e && e[S];
244
+ function O(e) {
245
+ return e && e[u];
285
246
  }
286
- function V(e) {
287
- return e && e[C];
247
+ function k(e) {
248
+ return e && e[d];
288
249
  }
289
- function H(e) {
290
- return e && e[w];
250
+ function A(e) {
251
+ return e && e[f];
291
252
  }
292
- function U(e, t = f()) {
293
- let n = W(t, e);
294
- return n.length === 1 ? n[0] : new O(t, () => n);
253
+ function j(e, t = V()) {
254
+ let n = M(t, e);
255
+ return n.length === 1 ? n[0] : new g(t, () => n);
295
256
  }
296
- function W(e, ...t) {
257
+ function M(e, ...t) {
297
258
  let r = [];
298
259
  function i(t) {
299
260
  if (!(t == null || t === !1)) if (a(t)) for (let e = 0; e < t.length; e++) i(t[e]);
300
- else if (c(t) || n(t)) r.push(new E(e, K(String(t))));
301
- else if (B(t)) {
261
+ else if (c(t) || n(t)) r.push(new m(e, P(String(t))));
262
+ else if (O(t)) {
302
263
  let { type: n, props: i } = t;
303
- H(n) ? r.push(new n(e, ...i.args)) : l(n) ? r.push(new X(e, n, i)) : c(n) && r.push(new N(e, n, i));
304
- } else V(t) ? r.push(t) : t instanceof Node ? r.push(new E(e, t)) : l(t) && r.push(new O(e, t));
264
+ A(n) ? r.push(new n(e, ...i.args)) : l(n) ? r.push(new R(e, n, i)) : c(n) && r.push(new x(e, n, i));
265
+ } else k(t) ? r.push(t) : t instanceof Node ? r.push(new m(e, t)) : l(t) && r.push(new g(e, t));
305
266
  }
306
267
  for (let e = 0; e < t.length; e++) i(t[e]);
307
268
  return r;
308
269
  }
309
- function G(e, t, n) {
270
+ function N(e, t, n) {
310
271
  n ? e.insertBefore(t, n?.nextSibling) : e.appendChild(t);
311
272
  }
312
- function K(e) {
273
+ function P(e) {
313
274
  return document.createTextNode(e);
314
275
  }
315
- function q(e, t, n) {
276
+ function F(e, t, n) {
316
277
  let r = n?.nextSibling ?? null;
317
278
  if (e.moveBefore) try {
318
279
  e.moveBefore(t, r);
@@ -320,18 +281,18 @@ function q(e, t, n) {
320
281
  } catch {}
321
282
  e.insertBefore(t, r);
322
283
  }
323
- function J(e, t, n) {
284
+ function I(e, t, n) {
324
285
  return e.addEventListener(t, n), () => e.removeEventListener(t, n);
325
286
  }
326
287
  //#endregion
327
288
  //#region src/core/markup/nodes/view.ts
328
- var Y = Symbol.for("ViewNode"), X = class extends T {
289
+ var L = Symbol.for("ViewNode"), R = class extends p {
329
290
  #e;
330
291
  #t;
331
292
  #n;
332
293
  context;
333
294
  constructor(e, t, n) {
334
- super(), this.context = f(e), this.context[Y] = this, this.context.name = t.name, this.#e = n, this.#t = t;
295
+ super(), this.context = V(e), this.context[L] = this, this.context.name = t.name, this.#e = n, this.#t = t;
335
296
  }
336
297
  getRoot() {
337
298
  return this.#n?.getRoot();
@@ -343,18 +304,60 @@ var Y = Symbol.for("ViewNode"), X = class extends T {
343
304
  let r = this.isMounted();
344
305
  if (!r) {
345
306
  let t = e(() => this.#t.call(this.context, this.#e, this.context));
346
- t != null && t !== !1 ? this.#n = U(t, this.context) : this.#n = new E(this.context, K(""));
307
+ t != null && t !== !1 ? this.#n = j(t, this.context) : this.#n = new m(this.context, P(""));
347
308
  }
348
- this.#n.mount(t, n), r || p(this.context);
309
+ this.#n.mount(t, n), r || H(this.context);
349
310
  }
350
311
  unmount(e = !1) {
351
- this.#n?.unmount(e), m(this.context);
312
+ this.#n?.unmount(e), U(this.context);
352
313
  }
353
314
  move(e, t) {
354
315
  this.#n?.move(e, t);
355
316
  }
356
- };
317
+ }, z = Symbol("Context.mountListeners"), B = Symbol("Context.cleanupListeners");
318
+ function V(e) {
319
+ return Object.assign(Object.create(e ?? null), { isMounted: !1 });
320
+ }
321
+ function H(e) {
322
+ e.isMounted || (e.isMounted = !0, W(e, z));
323
+ }
324
+ function U(e) {
325
+ e.isMounted && (e.isMounted = !1, W(e, B));
326
+ }
327
+ function W(e, t) {
328
+ if (Object.hasOwn(e, t)) {
329
+ for (let n of e[t]) n();
330
+ e[t].length = 0;
331
+ }
332
+ }
333
+ function G(e, t) {
334
+ Object.hasOwn(e, z) ? e[z].push(t) : e[z] = [t];
335
+ }
336
+ function K(e, t) {
337
+ Object.hasOwn(e, B) ? e[B].push(t) : e[B] = [t];
338
+ }
339
+ function q(e, t) {
340
+ e.isMounted ? K(e, i(t)) : G(e, () => {
341
+ K(e, i(t));
342
+ });
343
+ }
344
+ function J(e) {
345
+ return e[_];
346
+ }
347
+ function Y(e) {
348
+ return e[L];
349
+ }
350
+ var X = Symbol("Dolla.StoreId");
351
+ function Z(e, n, ...r) {
352
+ n[X] ??= Symbol(n.name), t(!Object.hasOwn(e, n[X]), "Store was already provided on this context.");
353
+ let i = V(e);
354
+ return G(e, () => H(i)), K(e, () => U(i)), i.name = n.name, e[n[X]] = n.call(i, r[0], i);
355
+ }
356
+ function Q(e, n) {
357
+ let r = n[X], i = r ? e[r] : void 0;
358
+ return t(i != null, `Store '${n.name}' is not provided by this context.`), i;
359
+ }
357
360
  //#endregion
358
- export { _, K as a, m as b, A as c, D as d, T as f, p as g, x as h, z as i, k as l, f as m, G as n, q as o, b as p, J as r, U as s, X as t, O as u, v, g as y };
361
+ export { p as S, j as _, Q as a, g as b, q as c, R as d, N as f, F as g, P as h, J as i, G as l, D as m, V as n, H as o, I as p, Y as r, K as s, Z as t, U as u, v, h as x, _ as y };
359
362
 
360
- //# sourceMappingURL=view-cBN-hn_T.js.map
363
+ //# sourceMappingURL=context-B5blupD2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-B5blupD2.js","names":["#root","#context","#slot","#root","#unsubscribe","#update","#cleanup","#children","#props","#context","#ownContext","#root","#applyProps","#childNodes","#refCleanup","#unsubscribers","#applyStyles","#applyClasses","#attach","#props","#view","#node"],"sources":["../src/core/markup/types.ts","../src/core/markup/nodes/dom.ts","../src/core/markup/scheduler.ts","../src/core/markup/nodes/dynamic.ts","../src/core/symbols.ts","../src/core/markup/nodes/element.ts","../src/core/markup/utils.ts","../src/core/markup/nodes/view.ts","../src/core/context.ts"],"sourcesContent":["import type { IntrinsicElements, View } from \"../../types.js\";\nimport { Context } from \"../index.js\";\n\n/**\n * Determines the type of the `props` object for any kind of Markup type.\n */\nexport type PropsOf<T extends string | View<any> | (new (...args: any[]) => MarkupNode)> =\n T extends View<infer P>\n ? P\n : T extends new (...args: infer Args) => MarkupNode\n ? { args: Args extends [Context, ...infer Rest] ? Rest : [] }\n : T extends keyof IntrinsicElements\n ? IntrinsicElements[T]\n : any;\n\nexport const IS_MARKUP = Symbol();\nexport const IS_MARKUP_NODE = Symbol();\nexport const IS_MARKUP_NODE_CLASS = Symbol();\n\n/**\n * A set of basic metadata that can be constructed into a `MarkupNode`.\n */\nexport interface Markup<\n Type extends string | View<any> | (new (...args: any[]) => MarkupNode) =\n | string\n | View<any>\n | (new (...args: any[]) => MarkupNode),\n> {\n [IS_MARKUP]: true;\n type: Type;\n props: PropsOf<Type>;\n}\n\nexport interface MountTarget {\n insertBefore(node: Node, child: Node | null): any;\n moveBefore?: (node: Node, child: Node | null) => any;\n appendChild(node: Node): any;\n}\n\n/**\n * A node that can be mounted by the Markup layout engine. Can be extended to create new custom node types.\n *\n * A `MarkupNode` instance can be passed anywhere a `Renderable` is required.\n */\nexport abstract class MarkupNode {\n static [IS_MARKUP_NODE_CLASS] = true;\n\n get [IS_MARKUP_NODE]() {\n return true;\n }\n\n /**\n * Returns a single DOM node to represent this MarkupNode's position in the DOM.\n * Usually the parent element, but it can be an empty Text node used as a marker.\n *\n * It only needs to be defined while the node is mounted, so it can be created in the `mount` function.\n */\n abstract getRoot(): Node | undefined;\n\n /**\n * Returns true while this node is mounted.\n */\n abstract isMounted(): boolean;\n\n /**\n * Mount this node to a `parent` element.\n * If passed, this node will be mounted as the next sibling of `after`.\n */\n abstract mount(parent: MountTarget, after?: Node): void;\n\n /**\n * Unmount this MarkupNode from its parent element.\n *\n * The `skipDOM` option can be passed as an optimization when unmounting a parent node.\n * A value of `true` indicates that no DOM operations need to happen because the parent is already being unmounted.\n *\n * @param skipDOM - No DOM updates will be performed when true. Lifecycle methods will be called regardless.\n */\n abstract unmount(skipDOM?: boolean): void;\n\n /**\n * Moves a node without unmounting and remounting (if the browser supports Element.moveBefore).\n */\n abstract move(parent: MountTarget, after?: Node): void;\n}\n","import { Context } from \"../../context.js\";\nimport { MarkupNode, type MountTarget } from \"../types.js\";\nimport { addChild, moveAfter } from \"../utils.js\";\n\n/**\n * A lightweight MarkupNode wrapper for a plain DOM node.\n */\nexport class DOMNode extends MarkupNode {\n #root: Node;\n\n constructor(_context: Context, node: Node) {\n super();\n this.#root = node;\n }\n\n override getRoot() {\n return this.#root;\n }\n\n override isMounted() {\n return this.#root.parentNode != null;\n }\n\n override mount(parent: MountTarget, after?: Node) {\n addChild(parent, this.#root, after);\n }\n\n override unmount(skipDOM = false) {\n if (skipDOM) return;\n this.#root.parentNode?.removeChild(this.#root);\n }\n\n override move(parent: Element, after?: Node) {\n moveAfter(parent, this.#root, after);\n }\n}\n","const pendingUpdates = new Set<() => void>();\nlet isScheduled = false;\n\nfunction flushUpdates() {\n for (const update of pendingUpdates) update();\n pendingUpdates.clear();\n isScheduled = false;\n}\n\nexport function scheduleUpdate(updateFn: () => void) {\n updateFn();\n\n // pendingUpdates.add(updateFn);\n // if (!isScheduled) {\n // isScheduled = true;\n // queueMicrotask(flushUpdates);\n // }\n}\n","import type { Context } from \"../../context.js\";\nimport { subscribe, type Getter } from \"../../signals.js\";\nimport { scheduleUpdate } from \"../scheduler.js\";\nimport { MarkupNode, MountTarget } from \"../types.js\";\nimport { addChild, createTextNode, toMarkupNodes } from \"../utils.js\";\nimport { DOMNode } from \"./dom.js\";\n\n/**\n * Renders any kind of content; markup, signals, DOM nodes, etc.\n * If it can be rendered by Dolla then Dynamic will do it.\n */\n\nexport class DynamicNode extends MarkupNode {\n #root = createTextNode(\"\");\n #children: MarkupNode[] = [];\n #context: Context;\n #slot: Getter<any>;\n #unsubscribe?: () => void;\n\n constructor(context: Context, slot: Getter<any>) {\n super();\n this.#context = context;\n this.#slot = slot;\n }\n\n override getRoot() {\n return this.#root;\n }\n\n override isMounted() {\n return this.#root.parentNode != null;\n }\n\n override mount(parent: MountTarget, after?: Node) {\n if (!this.isMounted()) {\n addChild(parent, this.#root, after);\n this.#unsubscribe = subscribe(this.#slot, (content) => {\n scheduleUpdate(() => {\n this.#update(content);\n });\n });\n }\n }\n\n override unmount(skipDOM = false) {\n this.#unsubscribe?.();\n\n if (this.isMounted()) {\n if (!skipDOM) {\n this.#root.parentNode?.removeChild(this.#root);\n }\n this.#cleanup(skipDOM);\n }\n }\n\n override move(parent: MountTarget, after?: Node) {\n let referenceNode: Node | null = after?.nextSibling ?? null;\n\n if (parent.moveBefore) {\n try {\n parent.moveBefore(this.#root, referenceNode);\n referenceNode = this.#root.nextSibling;\n\n for (let i = 0; i < this.#children.length; i++) {\n const childRoot = this.#children[i].getRoot();\n if (childRoot) {\n (parent as any).moveBefore(childRoot, referenceNode);\n }\n }\n return;\n } catch {\n // Fallthrough to standard insertBefore\n }\n }\n\n // Standard DOM fallback (moves root AND children)\n parent.insertBefore(this.#root, referenceNode);\n referenceNode = this.#root.nextSibling;\n\n for (let i = 0; i < this.#children.length; i++) {\n this.#children[i].move(parent, this.#children[i - 1]?.getRoot() ?? this.#root);\n }\n }\n\n #cleanup(skipDOM: boolean) {\n for (let i = 0; i < this.#children.length; i++) {\n this.#children[i].unmount(skipDOM);\n }\n this.#children.length = 0;\n }\n\n #update(content: any) {\n if (!this.isMounted()) return;\n\n // Fast-path for primitive text updates\n const isPrimitive = typeof content === \"string\" || typeof content === \"number\";\n if (isPrimitive && this.#children.length === 1) {\n const child = this.#children[0];\n if (child instanceof DOMNode) {\n const domNode = child.getRoot();\n if (domNode && domNode.nodeType === Node.TEXT_NODE) {\n domNode.nodeValue = String(content);\n return;\n }\n }\n }\n\n this.#cleanup(false);\n\n if (content == null || content === false) return;\n\n const nodes = toMarkupNodes(this.#context, content);\n\n const parent = this.#root.parentElement!;\n let referenceNode: Node = this.#root;\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n node.mount(parent, referenceNode);\n this.#children.push(node);\n\n const nextRoot = node.getRoot();\n if (nextRoot) referenceNode = nextRoot;\n }\n }\n}\n","export const PARENT_ELEMENT = Symbol(\"parentElement\");\nexport const DEBUG = Symbol(\"debug\");\n","import { isArray, isFunction, isNumber, isObject, isString, omit } from \"../../../utils.js\";\nimport { Context, createContext, getNearestViewNode, mountContext, unmountContext } from \"../../context.js\";\nimport { Ref } from \"../../ref.js\";\nimport { type Getter, subscribe } from \"../../signals.js\";\nimport { DEBUG } from \"../../symbols.js\";\nimport { scheduleUpdate } from \"../scheduler.js\";\nimport { MarkupNode, MountTarget } from \"../types.js\";\nimport { addChild, addListener, toMarkupNodes } from \"../utils.js\";\n\nconst IS_SVG = Symbol(\"isSVG\");\n\n// Properties in this list will not be processed by applyProps because they are already handled elsewhere.\nconst ignoredProps = [\"ref\", \"children\"];\n\n/**\n * Renders an HTML or SVG element.\n */\nexport class ElementNode extends MarkupNode {\n #root: HTMLElement | SVGElement;\n\n readonly #props: Record<string, any>;\n\n #context: Context;\n #ownContext = false;\n #childNodes: MarkupNode[] = [];\n #unsubscribers = new Set<() => void>();\n\n #refCleanup?: () => void;\n\n constructor(context: Context, tag: string, props: Record<string, any>) {\n super();\n\n this.#props = props;\n this.#context = context;\n\n if (tag === \"svg\") {\n // This and all nested views will be created as SVG elements.\n this.#context = createContext(context);\n this.#context[IS_SVG] = true;\n this.#ownContext = true;\n } else if (this.#context[IS_SVG] && tag === \"foreignObject\") {\n // No longer in SVG.\n this.#context = createContext(context);\n this.#context[IS_SVG] = false;\n this.#ownContext = false;\n }\n\n // Create node with the appropriate constructor.\n if (this.#context[IS_SVG]) {\n this.#root = document.createElementNS(\"http://www.w3.org/2000/svg\", tag);\n } else {\n this.#root = document.createElement(tag);\n }\n\n // Add view name as a data attribute debug mode.\n if (this.#context[DEBUG]) {\n const view = getNearestViewNode(this.#context);\n if (view) {\n this.#root.dataset.view = view.context.name;\n }\n }\n }\n\n override getRoot() {\n return this.#root;\n }\n\n override isMounted() {\n return this.#root.parentNode != null;\n }\n\n override mount(parent: MountTarget, after?: Node) {\n const wasMounted = this.isMounted();\n\n if (!wasMounted) {\n this.#applyProps(this.#root, omit(ignoredProps, this.#props));\n\n if (this.#props.children) {\n this.#childNodes = toMarkupNodes(this.#context, this.#props.children);\n for (const child of this.#childNodes) {\n child.mount(this.#root);\n }\n }\n }\n\n const targetSibling = after?.nextSibling ?? null;\n if (this.#root.parentNode !== parent || this.#root.nextSibling !== targetSibling) {\n addChild(parent, this.#root, targetSibling);\n }\n\n if (!wasMounted) {\n if (isFunction<Ref<any>>(this.#props.ref)) {\n const result = this.#props.ref(this.#root);\n if (isFunction(result)) {\n this.#refCleanup = result;\n }\n }\n\n if (this.#ownContext) mountContext(this.#context);\n }\n }\n\n override unmount(skipDOM = false) {\n if (!skipDOM && this.#root.parentNode) {\n this.#root.parentNode.removeChild(this.#root);\n }\n\n for (const child of this.#childNodes) {\n child.unmount(true); // Skip DOM removal for children\n }\n\n // Clear reactivity\n this.#unsubscribers.forEach((unsubscribe) => unsubscribe());\n this.#unsubscribers.clear();\n\n if (this.#ownContext) unmountContext(this.#context);\n\n // Clear ref\n if (this.#refCleanup) {\n this.#refCleanup();\n this.#refCleanup = undefined;\n }\n\n // Release memory\n this.#childNodes.length = 0;\n }\n\n override move(parent: MountTarget, after?: Node) {\n if (parent.moveBefore) {\n try {\n parent.moveBefore(this.#root, after?.nextSibling ?? null);\n return;\n } catch {}\n }\n this.mount(parent, after);\n }\n\n #attach<T>(value: Getter<T> | T, callback: (value: T) => void) {\n if (isFunction<Getter<T>>(value)) {\n this.#unsubscribers.add(\n subscribe(value, (current) => {\n scheduleUpdate(() => callback(current));\n }),\n );\n } else {\n // No need to schedule since DOM node is not connected yet.\n callback(value);\n }\n }\n\n #applyProps(element: any, props: Record<string, unknown>) {\n for (const key in props) {\n const value = props[key];\n\n if (key === \"style\") {\n this.#applyStyles(element, value);\n } else if (key === \"class\" || key === \"className\") {\n this.#applyClasses(element, value);\n } else if (key === \"for\") {\n this.#attach(value, (current) => {\n element.htmlFor = current;\n });\n } else if (key[0] === \".\" || key.startsWith(\"prop:\")) {\n // Keys starting with `.` or `prop:` are set as props.\n\n const _key = key.substring(5);\n this.#attach(value, (current) => {\n element[_key] = current;\n });\n } else if (key[0] === \":\" || key.startsWith(\"attr:\")) {\n // Keys starting with `:` or `attr:` are set as attributes.\n\n const _key = key.substring(5).toLowerCase();\n this.#attach(value, (current) => {\n setAttribute(element, _key, current);\n });\n } else if (key[0] === \"@\" && isFunction(value)) {\n // Anything that's a function starting with `@` is an event listener.\n\n const eventName = key.substring(1);\n this.#unsubscribers.add(addListener(element, eventName, value));\n } else if (key.startsWith(\"on\") && isFunction(value)) {\n // Anything that's a function starting with `on` is an event listener.\n\n const eventName = key.toLowerCase().slice(2);\n this.#unsubscribers.add(addListener(element, eventName, value));\n } else if (key in element && !this.#context[IS_SVG]) {\n // Set as property if the element has one.\n\n if (typeof element[key] === \"boolean\") {\n this.#attach(value, (current) => {\n const isTrue = Boolean(current);\n element[key] = isTrue;\n setAttribute(element, key, isTrue);\n });\n } else {\n this.#attach(value, (current) => {\n element[key] = current;\n });\n }\n } else {\n // Fall back to attributes.\n\n this.#attach(value, (current) => {\n setAttribute(element, key, current);\n });\n }\n }\n }\n\n #applyStyles(element: HTMLElement | SVGElement, styles: unknown) {\n const localUnsubs = new Set<() => void>();\n\n const apply = (current: unknown) => {\n localUnsubs.forEach((unsub) => {\n unsub();\n this.#unsubscribers.delete(unsub);\n });\n localUnsubs.clear();\n element.style.cssText = \"\";\n\n const mapped = getStyleMap(current);\n for (const [name, { value, priority }] of Object.entries(mapped)) {\n if (isFunction(value)) {\n const unsub = subscribe(value, (v) => {\n if (v) element.style.setProperty(name, asPixelsIfNumber(v), priority);\n else element.style.removeProperty(name);\n });\n this.#unsubscribers.add(unsub);\n localUnsubs.add(unsub);\n } else if (value != null) {\n element.style.setProperty(name, asPixelsIfNumber(value), priority);\n }\n }\n };\n\n if (isFunction(styles)) {\n this.#unsubscribers.add(subscribe(styles, apply));\n } else {\n apply(styles);\n }\n }\n\n #applyClasses(element: HTMLElement | SVGElement, classes: unknown) {\n const localUnsubs = new Set<() => void>();\n\n const apply = (current: unknown) => {\n // Clean up nested subscriptions if the top-level signal emits a new object\n localUnsubs.forEach((unsub) => {\n unsub();\n this.#unsubscribers.delete(unsub);\n });\n localUnsubs.clear();\n setAttribute(element, \"class\", null);\n\n const mapped = getClassMap(current);\n for (const [name, value] of Object.entries(mapped)) {\n if (name === \"undefined\") continue;\n\n if (isFunction(value)) {\n const unsub = subscribe(value, (isActive) => element.classList.toggle(name, !!isActive));\n this.#unsubscribers.add(unsub);\n localUnsubs.add(unsub);\n } else if (value) {\n element.classList.add(name);\n }\n }\n };\n\n if (isFunction(classes)) {\n this.#unsubscribers.add(subscribe(classes, apply));\n } else {\n apply(classes);\n }\n }\n}\n\n/**\n * Parse classes into a single object. Classes can be passed as a string, an object with class keys can boolean values, or an array with a mix of both.\n */\nfunction getClassMap(classes: unknown): Record<string, unknown> {\n if (isString(classes)) return Object.fromEntries(classes.split(\" \").map((c) => [c, true]));\n if (isArray(classes)) return Object.assign({}, ...classes.filter(Boolean).map(getClassMap));\n if (isObject(classes)) return classes as Record<string, unknown>;\n return {};\n}\n\n/**\n * Parse styles into a single object.\n */\nfunction getStyleMap(styles: unknown): Record<string, { value: unknown; priority?: string }> {\n if (isString(styles)) {\n return Object.fromEntries(\n styles\n .split(\";\")\n .filter((s) => s.trim())\n .map((line) => {\n const [key, val] = line.split(\":\");\n return [\n camelToKebab(key.trim()),\n {\n value: val.replace(\"!important\", \"\").trim(),\n priority: val.includes(\"!important\") ? \"important\" : \"\",\n },\n ];\n }),\n );\n }\n if (isArray(styles)) return Object.assign({}, ...styles.filter(Boolean).map(getStyleMap));\n if (isObject(styles)) {\n return Object.fromEntries(\n Object.entries(styles).map(([k, v]) => [k.startsWith(\"--\") ? k : camelToKebab(k), { value: v }]),\n );\n }\n return {};\n}\n\n/**\n * Converts a camelCase string to kebab-case.\n */\nfunction camelToKebab(value: string): string {\n return value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? \"-\" : \"\") + $.toLowerCase());\n}\n\nfunction asPixelsIfNumber(value: any): string {\n if (isNumber(value)) {\n return `${value}px`;\n } else {\n return value;\n }\n}\n\nfunction setAttribute(element: Element, name: string, value: any) {\n if (value) {\n element.setAttribute(name, String(value));\n } else {\n element.removeAttribute(name);\n }\n}\n","import type { Renderable, View } from \"../../types.js\";\nimport { isArray, isFunction, isNumber, isString } from \"../../utils.js\";\nimport { Context, createContext } from \"../context.js\";\nimport { DOMNode } from \"./nodes/dom.js\";\nimport { DynamicNode } from \"./nodes/dynamic.js\";\nimport { ElementNode } from \"./nodes/element.js\";\nimport { ViewNode } from \"./nodes/view.js\";\nimport { IS_MARKUP, IS_MARKUP_NODE, IS_MARKUP_NODE_CLASS, Markup, MarkupNode, MountTarget, PropsOf } from \"./types.js\";\n\nexport function createMarkup<Type extends string | View<any> | (new (...args: any[]) => MarkupNode)>(\n type: Type,\n props: PropsOf<Type>,\n): Markup<Type> {\n return {\n [IS_MARKUP]: true,\n type,\n props,\n };\n}\n\nexport function isMarkup<T extends string | View<any> | (new (...args: any[]) => MarkupNode)>(\n value: any,\n): value is Markup<T> {\n return value && value[IS_MARKUP];\n}\n\nexport function isMarkupNode(value: any): value is MarkupNode {\n return value && value[IS_MARKUP_NODE];\n}\n\nexport function isMarkupNodeClass(value: any): value is new (...args: any[]) => MarkupNode {\n return value && value[IS_MARKUP_NODE_CLASS];\n}\n\n/**\n * Takes any `Renderable` value and returns a `MarkupNode` that will display it.\n */\nexport function render(content: Renderable, context = createContext()): MarkupNode {\n const nodes = toMarkupNodes(context, content);\n if (nodes.length === 1) {\n return nodes[0]; // if it's just one item return it\n }\n // otherwise wrap it in something that can display multiple nodes\n return new DynamicNode(context, () => nodes);\n}\n\n/**\n * Convert basically anything into an array of `MarkupNode`\n */\nexport function toMarkupNodes(context: Context, ...content: any[]): MarkupNode[] {\n const nodes: MarkupNode[] = [];\n\n // Internal processor to avoid intermediate array allocations\n function process(item: any) {\n if (item == null || item === false) return;\n\n if (isArray(item)) {\n for (let i = 0; i < item.length; i++) {\n process(item[i]);\n }\n } else if (isString(item) || isNumber(item)) {\n nodes.push(new DOMNode(context, createTextNode(String(item))));\n } else if (isMarkup(item)) {\n const { type, props } = item;\n\n if (isMarkupNodeClass(type)) {\n nodes.push(new type(context, ...props.args));\n } else if (isFunction(type)) {\n nodes.push(new ViewNode(context, type as View<any>, props));\n } else if (isString(type)) {\n nodes.push(new ElementNode(context, type, props));\n }\n } else if (isMarkupNode(item)) {\n nodes.push(item);\n } else if (item instanceof Node) {\n nodes.push(new DOMNode(context, item));\n } else if (isFunction(item)) {\n nodes.push(new DynamicNode(context, item));\n }\n }\n\n for (let i = 0; i < content.length; i++) {\n process(content[i]);\n }\n\n return nodes;\n}\n\nexport function addChild(parent: MountTarget, node: Node, after?: Node | null) {\n if (after) {\n parent.insertBefore(node, after?.nextSibling);\n } else {\n parent.appendChild(node);\n }\n}\n\nexport function createTextNode(text: string) {\n return document.createTextNode(text);\n}\n\n/**\n * Moves an element using `moveBefore` if the browser supports it, otherwise falls back to `insertBefore`.\n */\nexport function moveAfter(parent: MountTarget, node: Node, after?: Node | null) {\n const before = after?.nextSibling ?? null;\n if (parent.moveBefore) {\n try {\n parent.moveBefore(node, before);\n return;\n } catch {}\n }\n parent.insertBefore(node, before);\n}\n\nexport function addListener<T extends Event>(target: EventTarget, event: string, listener: (event: T) => any) {\n target.addEventListener(event, listener as any);\n return () => target.removeEventListener(event, listener as any);\n}\n","import type { View } from \"../../../types.js\";\nimport { ComponentState, Context, createContext, mountContext, unmountContext } from \"../../context.js\";\nimport { peek } from \"../../signals.js\";\nimport { MarkupNode } from \"../types.js\";\nimport { createTextNode, render } from \"../utils.js\";\nimport { DOMNode } from \"./dom.js\";\n\nexport const VIEW = Symbol.for(\"ViewNode\");\n\n/**\n * Renders a View.\n */\nexport class ViewNode<P> extends MarkupNode {\n readonly #props: P;\n readonly #view: View<P>;\n #node?: MarkupNode;\n\n readonly context: Context<ComponentState & Record<string | symbol, any>>;\n\n constructor(context: Context, view: View<P>, props: P) {\n super();\n this.context = createContext(context) as Context<ComponentState>;\n this.context[VIEW] = this;\n this.context.name = view.name;\n this.#props = props;\n this.#view = view;\n }\n\n getRoot() {\n return this.#node?.getRoot();\n }\n\n isMounted() {\n return this.context.isMounted;\n }\n\n mount(parent: Element, after?: Node) {\n const wasMounted = this.isMounted();\n\n if (!wasMounted) {\n const viewContent = peek(() => this.#view.call(this.context, this.#props, this.context));\n\n if (viewContent != null && viewContent !== false) {\n this.#node = render(viewContent, this.context);\n } else {\n this.#node = new DOMNode(this.context, createTextNode(\"\"));\n }\n }\n\n this.#node!.mount(parent, after);\n\n if (!wasMounted) mountContext(this.context);\n }\n\n unmount(skipDOM = false) {\n this.#node?.unmount(skipDOM);\n unmountContext(this.context);\n }\n\n move(parent: Element, after?: Node) {\n this.#node?.move(parent, after);\n }\n}\n","import type { Store } from \"../types.js\";\nimport { assert } from \"../utils.js\";\nimport { VIEW, ViewNode } from \"./markup/nodes/view.js\";\nimport { createEffect } from \"./signals.js\";\nimport { PARENT_ELEMENT } from \"./symbols.js\";\n\nexport type LifecycleListener = () => any;\n\ntype ContextState = {\n isMounted: boolean;\n};\n\nexport type ComponentState = ContextState & {\n name: string;\n};\n\nexport type Context<T = Record<string | symbol, any>> = ContextState & T;\n\n/*===================================*\\\n|| Context ||\n\\*===================================*/\n\nconst MOUNT_LISTENERS = Symbol(\"Context.mountListeners\");\nconst CLEANUP_LISTENERS = Symbol(\"Context.cleanupListeners\");\n\nexport function createContext(parent?: Context): Context {\n return Object.assign(Object.create(parent ?? null), { isMounted: false });\n}\n\nexport function mountContext(context: Context) {\n if (context.isMounted) return;\n context.isMounted = true;\n _callListeners(context, MOUNT_LISTENERS);\n}\n\nexport function unmountContext(context: Context) {\n if (!context.isMounted) return;\n context.isMounted = false;\n _callListeners(context, CLEANUP_LISTENERS);\n}\n\nfunction _callListeners(context: Context, key: symbol) {\n if (!Object.hasOwn(context, key)) return;\n for (const callback of context[key]) callback();\n context[key].length = 0;\n}\n\n/*===================================*\\\n|| Lifecycle Hooks ||\n\\*===================================*/\n\nexport function onMount(context: Context, fn: LifecycleListener) {\n if (!Object.hasOwn(context, MOUNT_LISTENERS)) context[MOUNT_LISTENERS] = [fn];\n else context[MOUNT_LISTENERS].push(fn);\n}\n\nexport function onCleanup(context: Context, fn: LifecycleListener) {\n if (!Object.hasOwn(context, CLEANUP_LISTENERS)) context[CLEANUP_LISTENERS] = [fn];\n else context[CLEANUP_LISTENERS].push(fn);\n}\n\nexport function onEffect(context: Context, fn: () => void) {\n if (context.isMounted) {\n onCleanup(context, createEffect(fn));\n } else {\n onMount(context, () => {\n onCleanup(context, createEffect(fn));\n });\n }\n}\n\n/*===================================*\\\n|| Traversal Hooks ||\n\\*===================================*/\n\n/**\n * Returns the parent element of the root we're mounted in.\n */\nexport function getRootElement(context: Context): Element {\n return context[PARENT_ELEMENT];\n}\n\n/**\n * Returns the ViewNode of the nearest view up the context chain.\n */\nexport function getNearestViewNode<Props = unknown>(context: Context): ViewNode<Props> | undefined {\n return context[VIEW];\n}\n\n/*===================================*\\\n|| Stores ||\n\\*===================================*/\n\nexport const STORE_ID = Symbol(\"Dolla.StoreId\");\n\nexport function addStore<Props, Returns>(\n context: Context,\n store: Store<Props, Returns> & { [STORE_ID]?: symbol },\n ...args: undefined extends Props ? [props?: Props] : [props: Props]\n) {\n // Tag the store function with a unique symbol if it doesn't have one.\n store[STORE_ID] ??= Symbol(store.name);\n\n assert(!Object.hasOwn(context, store[STORE_ID]), \"Store was already provided on this context.\");\n\n // Give the store its own context bound to this lifecycle.\n const storeContext = createContext(context) as Context<ComponentState>;\n onMount(context, () => mountContext(storeContext));\n onCleanup(context, () => unmountContext(storeContext));\n storeContext.name = store.name;\n\n return (context[store[STORE_ID]!] = store.call(storeContext, args[0] as Props, storeContext));\n}\n\nexport function getStore<Returns>(context: Context, store: Store<any, Returns> & { [STORE_ID]?: symbol }): Returns {\n const id = store[STORE_ID];\n const result = id ? context[id] : undefined;\n assert(result != null, `Store '${store.name}' is not provided by this context.`);\n return result;\n}\n"],"mappings":";;AAeA,IAAa,IAAY,QAAQ,EACpB,IAAiB,QAAQ,EACzB,IAAuB,QAAQ,EA2BtB,IAAtB,MAAiC;CAC/B,QAAQ,KAAwB;CAEhC,KAAK,KAAkB;AACrB,SAAO;;GCzCE,IAAb,cAA6B,EAAW;CACtC;CAEA,YAAY,GAAmB,GAAY;AAEzC,EADA,OAAO,EACP,MAAA,IAAa;;CAGf,UAAmB;AACjB,S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,GAAM,IAAU;AAC/C,IAAQ,GAAK,SAAS;;;AAOxB,SAAgB,EAAQ,GAAkB,GAAuB;AAC/D,CAAK,OAAO,OAAO,GAAS,EAAgB,GACvC,EAAQ,GAAiB,KAAK,EAAG,GADQ,EAAQ,KAAmB,CAAC,EAAG;;AAI/E,SAAgB,EAAU,GAAkB,GAAuB;AACjE,CAAK,OAAO,OAAO,GAAS,EAAkB,GACzC,EAAQ,GAAmB,KAAK,EAAG,GADQ,EAAQ,KAAqB,CAAC,EAAG;;AAInF,SAAgB,EAAS,GAAkB,GAAgB;AACzD,CAAI,EAAQ,YACV,EAAU,GAAS,EAAa,EAAG,CAAC,GAEpC,EAAQ,SAAe;AACrB,IAAU,GAAS,EAAa,EAAG,CAAC;GACpC;;AAWN,SAAgB,EAAe,GAA2B;AACxD,QAAO,EAAQ;;AAMjB,SAAgB,EAAoC,GAA+C;AACjG,QAAO,EAAQ;;AAOjB,IAAa,IAAW,OAAO,gBAAgB;AAE/C,SAAgB,EACd,GACA,GACA,GAAG,GACH;AAIA,CAFA,EAAM,OAAc,OAAO,EAAM,KAAK,EAEtC,EAAO,CAAC,OAAO,OAAO,GAAS,EAAM,GAAU,EAAE,8CAA8C;CAG/F,IAAM,IAAe,EAAc,EAAQ;AAK3C,QAJA,EAAQ,SAAe,EAAa,EAAa,CAAC,EAClD,EAAU,SAAe,EAAe,EAAa,CAAC,EACtD,EAAa,OAAO,EAAM,MAElB,EAAQ,EAAM,MAAc,EAAM,KAAK,GAAc,EAAK,IAAa,EAAa;;AAG9F,SAAgB,EAAkB,GAAkB,GAA+D;CACjH,IAAM,IAAK,EAAM,IACX,IAAS,IAAK,EAAQ,KAAM,KAAA;AAElC,QADA,EAAO,KAAU,MAAM,UAAU,EAAM,KAAK,oCAAoC,EACzE"}
@@ -1,4 +1,5 @@
1
1
  import type { Store } from "../types.js";
2
+ import { ViewNode } from "./markup/nodes/view.js";
2
3
  export type LifecycleListener = () => any;
3
4
  type ContextState = {
4
5
  isMounted: boolean;
@@ -13,6 +14,14 @@ export declare function unmountContext(context: Context): void;
13
14
  export declare function onMount(context: Context, fn: LifecycleListener): void;
14
15
  export declare function onCleanup(context: Context, fn: LifecycleListener): void;
15
16
  export declare function onEffect(context: Context, fn: () => void): void;
17
+ /**
18
+ * Returns the parent element of the root we're mounted in.
19
+ */
20
+ export declare function getRootElement(context: Context): Element;
21
+ /**
22
+ * Returns the ViewNode of the nearest view up the context chain.
23
+ */
24
+ export declare function getNearestViewNode<Props = unknown>(context: Context): ViewNode<Props> | undefined;
16
25
  export declare const STORE_ID: unique symbol;
17
26
  export declare function addStore<Props, Returns>(context: Context, store: Store<Props, Returns> & {
18
27
  [STORE_ID]?: symbol;
@@ -2,10 +2,10 @@ export { createRoot } from "./root.js";
2
2
  export type { DollaPlugin } from "./root.js";
3
3
  export { batch, compose, createAtom, createEffect, peek, subscribe, unwrap } from "./signals.js";
4
4
  export type { Getter, Setter } from "./signals.js";
5
- export { addStore, getStore, onCleanup, onEffect, onMount } from "./context.js";
5
+ export { addStore, getNearestViewNode, getRootElement, getStore, onCleanup, onEffect, onMount } from "./context.js";
6
6
  export type { Context } from "./context.js";
7
7
  export { createDebug, getDebug, setLogFilter, setLogLevel } from "./debug.js";
8
- export { forEach, showIf, hideIf, createPortal } from "./markup/helpers.js";
8
+ export { createPortal, forEach, hideIf, showIf } from "./markup/helpers.js";
9
9
  export { html } from "./markup/html.js";
10
10
  export { ViewNode } from "./markup/nodes/view.js";
11
11
  export type { Markup, MarkupNode } from "./markup/types.js";