keits 0.0.3 → 0.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.
Files changed (75) hide show
  1. package/README.md +93 -79
  2. package/dist/dev/api.js +275 -0
  3. package/dist/dev/forms.js +330 -0
  4. package/dist/dev/index.js +26 -326
  5. package/dist/dev/router.js +24 -5
  6. package/dist/dev/shared/computed-DrF8O8b4.js +40 -0
  7. package/dist/dev/shared/{element-C4DfKtZW.js → element-DXwmUAnz.js} +32 -111
  8. package/dist/dev/shared/{graph-D6-x_CWC.js → graph-SIvYLXSv.js} +62 -3
  9. package/dist/dev/shared/hydrate-C8cOsDDH.js +588 -0
  10. package/dist/dev/shared/mount-CDB2HgN5.js +23 -0
  11. package/dist/dev/shared/namespaces-Cz82B0Pr.js +84 -0
  12. package/dist/dev/shared/owner-BuwIoI4j.js +72 -0
  13. package/dist/dev/shared/render-context-k2uu_dM_.js +34 -0
  14. package/dist/dev/shared/render-effect-Uk9dDmuU.js +32 -0
  15. package/dist/dev/shared/resource-DlgzdtcG.js +145 -0
  16. package/dist/dev/shared/signal-B3xOKbVm.js +24 -0
  17. package/dist/dev/shared/store-0vEg2bQV.js +152 -0
  18. package/dist/dev/shared/unsafe-keys-CB1P22No.js +8 -0
  19. package/dist/dev/static.js +76 -0
  20. package/dist/dev/svg.js +2 -1
  21. package/dist/dev/testing.js +216 -0
  22. package/dist/dev/vite.js +141 -0
  23. package/dist/prod/api.js +215 -0
  24. package/dist/prod/forms.js +240 -0
  25. package/dist/prod/index.js +110 -327
  26. package/dist/prod/router.js +83 -68
  27. package/dist/prod/shared/computed-BjqJ6Pps.js +33 -0
  28. package/dist/prod/shared/element-DCit4-3e.js +129 -0
  29. package/dist/prod/shared/{graph-C_aA46c6.js → graph-CR2WKbwr.js} +107 -63
  30. package/dist/prod/shared/hydrate-kKnJbkV7.js +480 -0
  31. package/dist/prod/shared/mount-DbeKIoyD.js +18 -0
  32. package/dist/prod/shared/namespaces-BSRrBJIU.js +71 -0
  33. package/dist/prod/shared/owner-DBi3odT4.js +67 -0
  34. package/dist/prod/shared/render-context-DF8lr1uu.js +30 -0
  35. package/dist/prod/shared/render-effect-UFDi2Pfh.js +25 -0
  36. package/dist/prod/shared/resource-Ch5tVseZ.js +91 -0
  37. package/dist/prod/shared/signal-BDMlfa0Z.js +16 -0
  38. package/dist/prod/shared/store-CvW0DbmK.js +110 -0
  39. package/dist/prod/shared/unsafe-keys-C5PMlerl.js +7 -0
  40. package/dist/prod/static.js +48 -0
  41. package/dist/prod/svg.js +3 -2
  42. package/dist/prod/testing.js +144 -0
  43. package/dist/prod/vite.js +106 -0
  44. package/dist/types/api/cache.d.ts +16 -0
  45. package/dist/types/api/client.d.ts +42 -0
  46. package/dist/types/api/error.d.ts +16 -0
  47. package/dist/types/api/index.d.ts +3 -0
  48. package/dist/types/api/url.d.ts +5 -0
  49. package/dist/types/async/render-context.d.ts +10 -0
  50. package/dist/types/core/effect.d.ts +1 -0
  51. package/dist/types/core/graph.d.ts +11 -0
  52. package/dist/types/core/owner.d.ts +1 -0
  53. package/dist/types/core/unsafe-keys.d.ts +2 -0
  54. package/dist/types/dom/hooks.d.ts +4 -0
  55. package/dist/types/dom/types.d.ts +5 -0
  56. package/dist/types/forms/form.d.ts +55 -0
  57. package/dist/types/forms/index.d.ts +2 -0
  58. package/dist/types/forms/paths.d.ts +6 -0
  59. package/dist/types/forms/types.d.ts +38 -0
  60. package/dist/types/router/index.d.ts +1 -0
  61. package/dist/types/router/match.d.ts +1 -0
  62. package/dist/types/router/types.d.ts +1 -0
  63. package/dist/types/static/head.d.ts +36 -0
  64. package/dist/types/static/hydrate.d.ts +3 -0
  65. package/dist/types/static/index.d.ts +4 -0
  66. package/dist/types/static/island.d.ts +14 -0
  67. package/dist/types/static/json.d.ts +1 -0
  68. package/dist/types/static/render.d.ts +11 -0
  69. package/dist/types/static/server-dom.d.ts +100 -0
  70. package/dist/types/testing/index.d.ts +62 -0
  71. package/dist/types/vite/index.d.ts +24 -0
  72. package/package.json +46 -5
  73. package/dist/dev/shared/owner-DlUsXKXE.js +0 -122
  74. package/dist/prod/shared/element-DUtXb3px.js +0 -187
  75. package/dist/prod/shared/owner-DgJNPM0P.js +0 -104
@@ -0,0 +1,480 @@
1
+ import { _ as e, p as t, s as n, u as r, v as i, y as a } from "./graph-CR2WKbwr.js";
2
+ import { t as o } from "./render-effect-UFDi2Pfh.js";
3
+ import { a as s, i as c } from "./owner-DBi3odT4.js";
4
+ import { a as l, i as u, o as d, r as f, t as p } from "./render-context-DF8lr1uu.js";
5
+ import { i as m, n as h, o as g, r as _, t as v } from "./namespaces-BSRrBJIU.js";
6
+ // src/static/json.ts
7
+ function y(e) {
8
+ return JSON.stringify(e).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
9
+ }
10
+ // src/static/head.ts
11
+ var b = u(null);
12
+ function x(e) {
13
+ let t = d(b) ?? (typeof document > "u" ? null : ee());
14
+ if (t === null) return;
15
+ let n = {};
16
+ o(() => t.set(n, w(e))), s(() => t.remove(n));
17
+ }
18
+ var S = (e) => typeof e == "function" ? e() : e, C = (e) => `"${e.replace(/["\\]/g, "\\$&")}"`;
19
+ function w(e) {
20
+ let t = [], n = (e, n, r) => {
21
+ r !== void 0 && t.push({
22
+ key: `${e}:${n}`,
23
+ tag: "meta",
24
+ attrs: {
25
+ [e]: n,
26
+ content: r
27
+ },
28
+ selector: `meta[${e}=${C(n)}]`
29
+ });
30
+ }, r = S(e.title);
31
+ r !== void 0 && t.push({
32
+ key: "title",
33
+ tag: "title",
34
+ attrs: {},
35
+ text: r,
36
+ selector: "title"
37
+ }), n("name", "description", S(e.description)), n("name", "robots", S(e.robots));
38
+ let i = S(e.canonical);
39
+ i !== void 0 && t.push({
40
+ key: "link:canonical",
41
+ tag: "link",
42
+ attrs: {
43
+ rel: "canonical",
44
+ href: i
45
+ },
46
+ selector: "link[rel=\"canonical\"]"
47
+ });
48
+ for (let [t, r] of Object.entries(e.og ?? {})) n("property", `og:${t}`, S(r));
49
+ for (let [t, r] of Object.entries(e.twitter ?? {})) n("name", `twitter:${t}`, S(r));
50
+ for (let t of e.meta ?? []) t.property === void 0 ? t.name !== void 0 && n("name", t.name, S(t.content)) : n("property", t.property, S(t.content));
51
+ for (let n of e.link ?? []) t.push({
52
+ key: `link:${n.rel}:${n.href}`,
53
+ tag: "link",
54
+ attrs: { ...n },
55
+ selector: `link[rel=${C(n.rel)}][href=${C(n.href)}]`
56
+ });
57
+ let a = typeof e.jsonLd == "function" ? e.jsonLd() : e.jsonLd;
58
+ return a !== void 0 && t.push({
59
+ key: "jsonld",
60
+ tag: "script",
61
+ attrs: { type: "application/ld+json" },
62
+ text: y(a),
63
+ selector: "script[type=\"application/ld+json\"]"
64
+ }), t;
65
+ }
66
+ function T(e = () => {}) {
67
+ let t = /* @__PURE__ */ new Map(), n = {
68
+ set(r, i) {
69
+ t.set(r, i), e(n.winners());
70
+ },
71
+ remove(r) {
72
+ t.delete(r), e(n.winners());
73
+ },
74
+ winners() {
75
+ let e = /* @__PURE__ */ new Map();
76
+ for (let n of t.values()) for (let t of n) e.set(t.key, t);
77
+ return e;
78
+ }
79
+ };
80
+ return n;
81
+ }
82
+ var E = null;
83
+ function ee() {
84
+ if (E !== null) return E;
85
+ let e = /* @__PURE__ */ new Map(), t = document.title;
86
+ return E = T((n) => {
87
+ for (let [r, i] of e) n.has(r) || (i === null ? document.title = t : i.remove(), e.delete(r));
88
+ for (let [t, r] of n) {
89
+ if (r.tag === "title") {
90
+ document.title !== r.text && (document.title = r.text ?? ""), e.set(t, null);
91
+ continue;
92
+ }
93
+ let n = e.get(t) ?? null;
94
+ n !== null && !n.isConnected && (n = null);
95
+ let i = n ?? document.head.querySelector(r.selector);
96
+ i === null && (i = document.createElement(r.tag), document.head.append(i));
97
+ for (let [e, t] of Object.entries(r.attrs)) i.getAttribute(e) !== t && i.setAttribute(e, t);
98
+ r.text !== void 0 && i.textContent !== r.text && (i.textContent = r.text), e.set(t, i);
99
+ }
100
+ }), E;
101
+ }
102
+ // src/static/server-dom.ts
103
+ var D = class {
104
+ parentNode = null;
105
+ previousSibling = null;
106
+ nextSibling = null;
107
+ remove() {
108
+ this.parentNode?.removeChild(this);
109
+ }
110
+ before(...e) {
111
+ let t = this.parentNode;
112
+ if (t !== null) for (let n of e) t.insertBefore(z(n), this);
113
+ }
114
+ after(...e) {
115
+ let t = this.parentNode, n = this.nextSibling;
116
+ if (t !== null) for (let r of e) t.insertBefore(z(r), n);
117
+ }
118
+ }, O = class extends D {
119
+ firstChild = null;
120
+ lastChild = null;
121
+ insertBefore(e, t) {
122
+ if (e instanceof k) {
123
+ for (; e.firstChild !== null;) this.insertBefore(e.firstChild, t);
124
+ return e;
125
+ }
126
+ return e.remove(), e.parentNode = this, e.nextSibling = t, e.previousSibling = t === null ? this.lastChild : t.previousSibling, e.previousSibling === null ? this.firstChild = e : e.previousSibling.nextSibling = e, t === null ? this.lastChild = e : t.previousSibling = e, e;
127
+ }
128
+ appendChild(e) {
129
+ return this.insertBefore(e, null);
130
+ }
131
+ append(...e) {
132
+ for (let t of e) this.insertBefore(z(t), null);
133
+ }
134
+ removeChild(e) {
135
+ return e.previousSibling === null ? this.firstChild = e.nextSibling : e.previousSibling.nextSibling = e.nextSibling, e.nextSibling === null ? this.lastChild = e.previousSibling : e.nextSibling.previousSibling = e.previousSibling, e.parentNode = e.previousSibling = e.nextSibling = null, e;
136
+ }
137
+ get textContent() {
138
+ let e = "";
139
+ for (let t = this.firstChild; t !== null; t = t.nextSibling) e += t.textContent;
140
+ return e;
141
+ }
142
+ set textContent(e) {
143
+ for (; this.firstChild !== null;) this.removeChild(this.firstChild);
144
+ e !== "" && this.appendChild(new A(e));
145
+ }
146
+ printChildren(e, t) {
147
+ for (let n = this.firstChild; n !== null; n = n.nextSibling) n.print(e, t);
148
+ }
149
+ }, k = class extends O {
150
+ nodeType = 11;
151
+ print(e, t) {
152
+ this.printChildren(e, t);
153
+ }
154
+ }, A = class extends D {
155
+ nodeType = 3;
156
+ data;
157
+ constructor(e) {
158
+ super(), this.data = e;
159
+ }
160
+ get textContent() {
161
+ return this.data;
162
+ }
163
+ print(e, t) {
164
+ e.push(t ? H(this.data) : B(this.data));
165
+ }
166
+ }, j = class extends D {
167
+ nodeType = 8;
168
+ data;
169
+ constructor(e) {
170
+ super(), this.data = e;
171
+ }
172
+ get textContent() {
173
+ return "";
174
+ }
175
+ print() {}
176
+ }, M = class extends D {
177
+ nodeType = 3;
178
+ html;
179
+ constructor(e) {
180
+ super(), this.html = e;
181
+ }
182
+ get textContent() {
183
+ return "";
184
+ }
185
+ print(e) {
186
+ e.push(this.html);
187
+ }
188
+ }, N = /* @__PURE__ */ new Set([
189
+ "area",
190
+ "base",
191
+ "br",
192
+ "col",
193
+ "embed",
194
+ "hr",
195
+ "img",
196
+ "input",
197
+ "link",
198
+ "meta",
199
+ "source",
200
+ "track",
201
+ "wbr"
202
+ ]), te = /* @__PURE__ */ new Set(["script", "style"]), P = /^[^\s"'<>/=\u0000-\u001f\u007f]+$/, F = {
203
+ className: "class",
204
+ htmlFor: "for",
205
+ httpEquiv: "http-equiv",
206
+ acceptCharset: "accept-charset"
207
+ }, I = class extends O {
208
+ nodeType = 1;
209
+ localName;
210
+ namespaceURI;
211
+ classList;
212
+ style;
213
+ #e = /* @__PURE__ */ new Map();
214
+ #t = {};
215
+ constructor(e, t) {
216
+ if (super(), !P.test(e)) throw Error("[keits/static] bad tag");
217
+ this.localName = t === null ? e.toLowerCase() : e, this.namespaceURI = t, this.classList = new L(this), this.style = new R(this);
218
+ }
219
+ getAttribute(e) {
220
+ return this.#e.get(this.#n(e)) ?? null;
221
+ }
222
+ hasAttribute(e) {
223
+ return this.#e.has(this.#n(e));
224
+ }
225
+ setAttribute(e, t) {
226
+ if (!P.test(e)) throw Error("[keits/static] bad attribute");
227
+ this.#e.set(this.#n(e), String(t));
228
+ }
229
+ removeAttribute(e) {
230
+ this.#e.delete(this.#n(e));
231
+ }
232
+ toggleAttribute(e, t) {
233
+ let n = t ?? !this.hasAttribute(e);
234
+ return n ? this.setAttribute(e, "") : this.removeAttribute(e), n;
235
+ }
236
+ #n(e) {
237
+ return this.namespaceURI === null ? e.toLowerCase() : e;
238
+ }
239
+ get value() {
240
+ return this.#t.value ?? "";
241
+ }
242
+ set value(e) {
243
+ this.#t.value = e;
244
+ }
245
+ get checked() {
246
+ return this.#t.checked === !0;
247
+ }
248
+ set checked(e) {
249
+ this.#t.checked = e;
250
+ }
251
+ get selected() {
252
+ return this.#t.selected === !0;
253
+ }
254
+ set selected(e) {
255
+ this.#t.selected = e;
256
+ }
257
+ get textContent() {
258
+ return super.textContent;
259
+ }
260
+ set textContent(e) {
261
+ super.textContent = e == null ? "" : String(e);
262
+ }
263
+ set className(e) {
264
+ this.setAttribute("class", e);
265
+ }
266
+ set htmlFor(e) {
267
+ this.setAttribute(F.htmlFor, e);
268
+ }
269
+ set draggable(e) {
270
+ this.setAttribute("draggable", String(e));
271
+ }
272
+ set spellcheck(e) {
273
+ this.setAttribute("spellcheck", String(e));
274
+ }
275
+ print(e) {
276
+ e.push(`<${this.localName}`);
277
+ for (let [t, n] of this.#e) e.push(n === "" ? ` ${t}` : ` ${t}="${V(n)}"`);
278
+ e.push(">"), this.namespaceURI === null && N.has(this.localName) || (this.printChildren(e, this.namespaceURI === null && te.has(this.localName)), e.push(`</${this.localName}>`));
279
+ }
280
+ }, L = class {
281
+ #e;
282
+ constructor(e) {
283
+ this.#e = e;
284
+ }
285
+ #t() {
286
+ return (this.#e.getAttribute("class") ?? "").split(/\s+/).filter(Boolean);
287
+ }
288
+ #n(e) {
289
+ e.length === 0 ? this.#e.removeAttribute("class") : this.#e.setAttribute("class", e.join(" "));
290
+ }
291
+ contains(e) {
292
+ return this.#t().includes(e);
293
+ }
294
+ add(...e) {
295
+ let t = this.#t();
296
+ for (let n of e) t.includes(n) || t.push(n);
297
+ this.#n(t);
298
+ }
299
+ remove(...e) {
300
+ this.#n(this.#t().filter((t) => !e.includes(t)));
301
+ }
302
+ toggle(e, t) {
303
+ let n = t ?? !this.contains(e);
304
+ return n ? this.add(e) : this.remove(e), n;
305
+ }
306
+ }, R = class {
307
+ #e;
308
+ #t = /* @__PURE__ */ new Map();
309
+ constructor(e) {
310
+ this.#e = e;
311
+ }
312
+ getPropertyValue(e) {
313
+ return this.#t.get(e) ?? "";
314
+ }
315
+ setProperty(e, t) {
316
+ t === "" ? this.#t.delete(e) : this.#t.set(e, t), this.#n();
317
+ }
318
+ removeProperty(e) {
319
+ let t = this.getPropertyValue(e);
320
+ return this.#t.delete(e), this.#n(), t;
321
+ }
322
+ get cssText() {
323
+ return [...this.#t].map(([e, t]) => `${e}: ${t};`).join(" ");
324
+ }
325
+ set cssText(e) {
326
+ this.#t.clear();
327
+ for (let t of e.split(";")) {
328
+ let e = t.indexOf(":");
329
+ e > 0 && this.#t.set(t.slice(0, e).trim(), t.slice(e + 1).trim());
330
+ }
331
+ this.#n();
332
+ }
333
+ get display() {
334
+ return this.getPropertyValue("display");
335
+ }
336
+ set display(e) {
337
+ this.setProperty("display", e);
338
+ }
339
+ #n() {
340
+ this.#t.size === 0 ? this.#e.removeAttribute("style") : this.#e.setAttribute("style", this.cssText);
341
+ }
342
+ };
343
+ function z(e) {
344
+ return typeof e == "string" ? new A(e) : e;
345
+ }
346
+ function B(e) {
347
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
348
+ }
349
+ function V(e) {
350
+ return B(e).replace(/"/g, "&quot;");
351
+ }
352
+ function H(e) {
353
+ return e.replace(/<\/(script|style)/gi, "<\\/$1");
354
+ }
355
+ var U = {
356
+ element(e, n) {
357
+ let i = new I(e, n === "http://www.w3.org/2000/svg" ? v : n), a = t();
358
+ return a !== null && r() && i.setAttribute("data-k", a), i;
359
+ },
360
+ text: (e) => new A(e),
361
+ marker: () => new j(""),
362
+ fragment: () => new k(),
363
+ html: (e) => {
364
+ let t = new k();
365
+ return t.appendChild(new M(e)), t;
366
+ }
367
+ };
368
+ function W(e) {
369
+ let t = [];
370
+ return e.print(t, !1), t.join("");
371
+ }
372
+ // src/static/render.ts
373
+ var G = 0, K = null;
374
+ async function q(t, o = {}) {
375
+ G++ === 0 && (K = g(U)), e();
376
+ let s = /* @__PURE__ */ new Set(), c = {}, u = {
377
+ wait(e) {
378
+ s.add(e);
379
+ let t = () => s.delete(e);
380
+ e.then(t, t);
381
+ },
382
+ store(e, t, n) {
383
+ r(n) && (c[e] = t);
384
+ }
385
+ }, d = T(), f = () => {};
386
+ try {
387
+ let e = i((e) => {
388
+ f = e;
389
+ let r = U.fragment();
390
+ return l(p, u, () => l(b, d, () => {
391
+ let e = n();
392
+ e.key = "0", e.keyCount = 0, o.hydrate && (e.hydratable = !0), h(r, t());
393
+ })), r;
394
+ }), r = o.timeout ?? 1e4, a = Date.now() + r;
395
+ for (; s.size > 0;) await J(Promise.all(s), a - Date.now(), r);
396
+ return {
397
+ html: W(e),
398
+ head: Y(d.winners()),
399
+ data: X(c)
400
+ };
401
+ } finally {
402
+ f(), a(), --G === 0 && g(K);
403
+ }
404
+ }
405
+ function J(e, t, n) {
406
+ return new Promise((r, i) => {
407
+ let a = setTimeout(() => i(/* @__PURE__ */ Error(`[keits/static] Data was still loading after ${n} ms: the page could not be rendered.`)), Math.max(0, t));
408
+ e.then((e) => (clearTimeout(a), r(e)), (e) => (clearTimeout(a), i(e)));
409
+ });
410
+ }
411
+ function Y(e) {
412
+ let t = "";
413
+ for (let n of e.values()) {
414
+ let e = Object.entries(n.attrs).map(([e, t]) => {
415
+ if (!P.test(e)) throw Error("[keits/static] bad attribute");
416
+ return ` ${e}="${V(t)}"`;
417
+ }).join("");
418
+ n.tag === "title" ? t += `<title>${B(n.text ?? "")}</title>` : n.tag === "script" ? t += `<script${e}>${n.text ?? ""}<\/script>` : t += `<${n.tag}${e}>`;
419
+ }
420
+ return t;
421
+ }
422
+ function X(e) {
423
+ return Object.keys(e).length === 0 ? "" : `<script type="application/json" id="keits-data">${y(e)}<\/script>`;
424
+ }
425
+ // src/static/hydrate.ts
426
+ var Z = null, Q = null;
427
+ function ne(e) {
428
+ if (Q === null) {
429
+ let e = [...document.querySelectorAll("script[type=\"application/json\"]#keits-data")].pop() ?? null;
430
+ Q = e === null ? {} : JSON.parse(e.textContent ?? "{}");
431
+ }
432
+ return Object.hasOwn(Q, e) ? { value: Q[e] } : void 0;
433
+ }
434
+ function re() {
435
+ Q = null;
436
+ }
437
+ var ie = {
438
+ ...m,
439
+ element(e, n) {
440
+ let r = t();
441
+ if (Z !== null && r !== null && !_()) {
442
+ let t = Z.byKey.get(r);
443
+ if (t !== void 0 && t.localName === (n === null ? e.toLowerCase() : e)) return Z.byKey.delete(r), t.removeAttribute("data-k"), $(t), t;
444
+ Z.mismatch ??= t === void 0 ? `no <${e}> with key ${r}` : `<${t.localName}> instead of <${e}> at key ${r}`;
445
+ }
446
+ return m.element(e, n);
447
+ }
448
+ };
449
+ function $(e) {
450
+ for (let t = e.firstChild; t !== null;) {
451
+ let n = t.nextSibling;
452
+ t.nodeType === 1 && t.hasAttribute("data-k") || e.removeChild(t), t = n;
453
+ }
454
+ }
455
+ function ae(t, n, r = "0") {
456
+ let i = /* @__PURE__ */ new Map();
457
+ for (let e of n.querySelectorAll("[data-k]")) i.set(e.getAttribute("data-k"), e);
458
+ let o = {
459
+ byKey: i,
460
+ mismatch: null
461
+ };
462
+ f(ne);
463
+ let s = Z, l = g(ie);
464
+ Z = o, e();
465
+ let u;
466
+ try {
467
+ $(n), u = c(r, !1, (e) => (h(n, t()), e));
468
+ } finally {
469
+ a(), Z = s, g(l);
470
+ }
471
+ let d = n.querySelector("[data-k]");
472
+ if (o.mismatch === null && d === null) return u;
473
+ u(), n.textContent = "", e();
474
+ try {
475
+ return c(r, !1, (e) => (h(n, t()), e));
476
+ } finally {
477
+ a();
478
+ }
479
+ }
480
+ export { x as i, re as n, q as r, ae as t };
@@ -0,0 +1,18 @@
1
+ import { n as e } from "./owner-DBi3odT4.js";
2
+ import { a as t, n } from "./namespaces-BSRrBJIU.js";
3
+ // src/dom/mount.ts
4
+ function r(r, i) {
5
+ if (i === null) throw Error("[keits] no target");
6
+ let a = t.marker(), o = t.marker();
7
+ i.append(a, o);
8
+ let s = e((e) => (n(i, r(), o), e));
9
+ return () => {
10
+ s();
11
+ let e = a;
12
+ for (; e !== null;) {
13
+ let t = e === o ? null : e.nextSibling;
14
+ e.remove(), e = t;
15
+ }
16
+ };
17
+ }
18
+ export { r as t };
@@ -0,0 +1,71 @@
1
+ import { t as e } from "./render-effect-UFDi2Pfh.js";
2
+ // src/dom/hooks.ts
3
+ var t = {
4
+ element: (e, t) => t === null ? document.createElement(e) : document.createElementNS(t, e),
5
+ text: (e) => document.createTextNode(e),
6
+ marker: () => document.createComment(""),
7
+ fragment: () => document.createDocumentFragment()
8
+ }, n = 0;
9
+ function r(e) {
10
+ n++;
11
+ try {
12
+ return e();
13
+ } finally {
14
+ n--;
15
+ }
16
+ }
17
+ function i() {
18
+ return n > 0;
19
+ }
20
+ var a = t;
21
+ function o(e) {
22
+ let t = a;
23
+ return a = e, t;
24
+ }
25
+ // src/dom/insert.ts
26
+ function s(e, t, n = null) {
27
+ if (t != null && typeof t != "boolean") {
28
+ if (typeof t == "function") return d(e, t, n);
29
+ if (c(t)) for (let r of t) s(e, r, n);
30
+ else if (typeof t == "object") {
31
+ if (!t.nodeType) throw Error("[keits] bad child");
32
+ e.insertBefore(t, n);
33
+ } else e.insertBefore(a.text(String(t)), n);
34
+ }
35
+ }
36
+ function c(e) {
37
+ return Array.isArray(e);
38
+ }
39
+ function l(e) {
40
+ return e === null || typeof e != "object" && typeof e != "function";
41
+ }
42
+ function u(e) {
43
+ return e == null || typeof e == "boolean" ? "" : String(e);
44
+ }
45
+ function d(t, n, r) {
46
+ let i = a.text("");
47
+ t.insertBefore(i, r);
48
+ let o = null, c = null;
49
+ e(() => {
50
+ let e = n();
51
+ if (o === null || c === null) {
52
+ if (l(e)) {
53
+ let t = u(e);
54
+ i.data !== t && (i.data = t);
55
+ return;
56
+ }
57
+ o = a.marker(), c = a.marker(), i.before(o), i.after(c), i.remove();
58
+ }
59
+ f(o, c), s(c.parentNode, e, c);
60
+ });
61
+ }
62
+ function f(e, t) {
63
+ let n = e.nextSibling;
64
+ for (; n !== null && n !== t;) {
65
+ let e = n.nextSibling;
66
+ n.remove(), n = e;
67
+ }
68
+ }
69
+ // src/dom/namespaces.ts
70
+ var p = "http://www.w3.org/2000/svg";
71
+ export { a, t as i, s as n, o, i as r, r as s, p as t };
@@ -0,0 +1,67 @@
1
+ import { C as e, c as t, g as n, i as r, l as i, n as a, o, r as s, s as c, t as l } from "./graph-CR2WKbwr.js";
2
+ // src/core/owner.ts
3
+ function u() {
4
+ return c();
5
+ }
6
+ function d(e, t) {
7
+ return n(e, t);
8
+ }
9
+ function f(e) {
10
+ let i = {
11
+ kind: 3,
12
+ owner: c(),
13
+ children: null,
14
+ cleanups: null,
15
+ disposed: !1,
16
+ handler: null
17
+ };
18
+ t(i);
19
+ let a = () => r(() => o(i));
20
+ return r(() => {
21
+ try {
22
+ return n(i, () => e(a));
23
+ } catch (e) {
24
+ throw o(i), e;
25
+ }
26
+ });
27
+ }
28
+ function p(e, t, n) {
29
+ return f((r) => {
30
+ let i = c();
31
+ return i.key = e, i.keyCount = 0, t && (i.hydratable = !0), n(r);
32
+ });
33
+ }
34
+ function m(e) {
35
+ l(e);
36
+ }
37
+ function h(e) {
38
+ a(e);
39
+ }
40
+ function g(e, t) {
41
+ let a = {
42
+ kind: 3,
43
+ owner: null,
44
+ children: null,
45
+ cleanups: null,
46
+ disposed: !1,
47
+ handler: t
48
+ };
49
+ return s(a), r(() => {
50
+ try {
51
+ return n(a, e);
52
+ } catch (e) {
53
+ i(e, a);
54
+ return;
55
+ }
56
+ });
57
+ }
58
+ function _(t) {
59
+ return e(() => f((e) => {
60
+ try {
61
+ return t();
62
+ } finally {
63
+ e();
64
+ }
65
+ }));
66
+ }
67
+ export { m as a, d as c, p as i, f as n, h as o, u as r, _ as s, g as t };
@@ -0,0 +1,30 @@
1
+ import { g as e, r as t, s as n } from "./graph-CR2WKbwr.js";
2
+ // src/core/context.ts
3
+ function r(e, t) {
4
+ return { defaultValue: e };
5
+ }
6
+ function i(n, r, i) {
7
+ let a = {
8
+ kind: 3,
9
+ owner: null,
10
+ children: null,
11
+ cleanups: null,
12
+ disposed: !1,
13
+ handler: null,
14
+ context: {
15
+ key: n,
16
+ value: r
17
+ }
18
+ };
19
+ return t(a), e(a, i);
20
+ }
21
+ function a(e) {
22
+ for (let t = n(); t !== null; t = t.owner) if (t.kind === 3 && t.context?.key === e) return t.context.value;
23
+ return e.defaultValue;
24
+ }
25
+ // src/async/render-context.ts
26
+ var o = r(null), s = null;
27
+ function c(e) {
28
+ s = e;
29
+ }
30
+ export { i as a, r as i, s as n, a as o, c as r, o as t };
@@ -0,0 +1,25 @@
1
+ import { d as e, h as t, i as n, p as r, r as i } from "./graph-CR2WKbwr.js";
2
+ // src/core/effect.ts
3
+ function a(t, n) {
4
+ e() ? r() : o(t, n?.name);
5
+ }
6
+ function o(e, r) {
7
+ let a = {
8
+ kind: 1,
9
+ fn: e,
10
+ state: 0,
11
+ sources: [],
12
+ flushId: 0,
13
+ flushRuns: 0,
14
+ owner: null,
15
+ children: null,
16
+ cleanups: null,
17
+ disposed: !1
18
+ };
19
+ i(a), n(() => t(a));
20
+ }
21
+ // src/dom/render-effect.ts
22
+ function s(e) {
23
+ o(e);
24
+ }
25
+ export { a as n, s as t };