keits 0.0.2 → 0.0.3

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/dev/index.js +409 -122
  2. package/dist/dev/router.js +443 -0
  3. package/dist/dev/shared/{element-By0uLZli.js → element-C4DfKtZW.js} +2 -291
  4. package/dist/dev/shared/graph-D6-x_CWC.js +324 -0
  5. package/dist/dev/shared/owner-DlUsXKXE.js +122 -0
  6. package/dist/dev/svg.js +1 -1
  7. package/dist/prod/index.js +350 -166
  8. package/dist/prod/router.js +343 -0
  9. package/dist/prod/shared/element-DUtXb3px.js +187 -0
  10. package/dist/prod/shared/graph-C_aA46c6.js +240 -0
  11. package/dist/prod/shared/owner-DgJNPM0P.js +104 -0
  12. package/dist/prod/svg.js +1 -1
  13. package/dist/types/async/index.d.ts +2 -0
  14. package/dist/types/async/lazy.d.ts +7 -0
  15. package/dist/types/async/resource.d.ts +23 -0
  16. package/dist/types/async/suspense-context.d.ts +4 -0
  17. package/dist/types/core/graph.d.ts +8 -0
  18. package/dist/types/dom/types.d.ts +1 -1
  19. package/dist/types/flow/catch.d.ts +2 -0
  20. package/dist/types/flow/dynamic.d.ts +6 -0
  21. package/dist/types/flow/for.d.ts +7 -0
  22. package/dist/types/flow/if.d.ts +4 -0
  23. package/dist/types/flow/index.d.ts +8 -0
  24. package/dist/types/flow/portal.d.ts +2 -0
  25. package/dist/types/flow/range.d.ts +11 -0
  26. package/dist/types/flow/show.d.ts +1 -0
  27. package/dist/types/flow/suspense.d.ts +2 -0
  28. package/dist/types/flow/switch.d.ts +9 -0
  29. package/dist/types/index.d.ts +2 -0
  30. package/dist/types/router/history.d.ts +21 -0
  31. package/dist/types/router/index.d.ts +3 -0
  32. package/dist/types/router/links.d.ts +1 -0
  33. package/dist/types/router/match.d.ts +15 -0
  34. package/dist/types/router/router.d.ts +10 -0
  35. package/dist/types/router/scroll.d.ts +5 -0
  36. package/dist/types/router/types.d.ts +87 -0
  37. package/dist/types/svg/types.d.ts +1 -1
  38. package/package.json +23 -6
  39. package/dist/prod/shared/element-C8c5hIhH.js +0 -394
@@ -1,114 +1,14 @@
1
- import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, s as m, u as h, v as g, x as _, y as v } from "./shared/element-C8c5hIhH.js";
2
- // src/core/signal.ts
3
- function y(e, t) {
4
- let n = {
5
- kind: 0,
6
- value: e,
7
- equals: t?.equals ?? Object.is,
8
- observers: [],
9
- seenBy: 0
10
- };
11
- return Object.assign(() => (g(n), n.value), { set: (e) => {
12
- let t = typeof e == "function" ? e(n.value) : e;
13
- n.equals !== !1 && n.equals(n.value, t) || (n.value = t, o(n));
14
- } });
15
- }
16
- // src/core/computed.ts
17
- function b(e, t) {
18
- let r = {
19
- kind: 2,
20
- fn: e,
21
- value: void 0,
22
- equals: t?.equals ?? Object.is,
23
- hasValue: !1,
24
- hasError: !1,
25
- error: void 0,
26
- computing: !1,
27
- state: 2,
28
- sources: [],
29
- observers: [],
30
- seenBy: 0,
31
- flushId: 0,
32
- flushRuns: 0,
33
- owner: null,
34
- children: null,
35
- cleanups: null,
36
- disposed: !1
37
- };
38
- return l(r), () => {
39
- if (r.computing) throw x(r);
40
- if (r.state !== 0 && n(r), g(r), r.hasError) throw r.error;
41
- return r.value;
42
- };
43
- }
44
- function x(e) {
45
- return /* @__PURE__ */ Error("[keits] cycle detected");
46
- }
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./shared/owner-DgJNPM0P.js";
2
+ import { a as l, i as u, n as d, o as f, s as p } from "./shared/element-DUtXb3px.js";
3
+ import { a as m, c as h, d as g, h as _, i as v, l as y, m as b, p as x, r as S, s as C, t as w, u as T } from "./shared/graph-C_aA46c6.js";
47
4
  // src/core/env.ts
48
- var S = typeof window > "u";
49
- // src/core/owner.ts
50
- function C() {
51
- return a();
52
- }
53
- function w(t, n) {
54
- return e(t, n);
55
- }
56
- function T(t) {
57
- let n = {
58
- kind: 3,
59
- owner: a(),
60
- children: null,
61
- cleanups: null,
62
- disposed: !1,
63
- handler: null
64
- }, r = () => h(() => i(n));
65
- return h(() => {
66
- try {
67
- return e(n, () => t(r));
68
- } catch (e) {
69
- throw i(n), e;
70
- }
71
- });
72
- }
73
- function E(e) {
74
- m(e);
75
- }
76
- function D(e) {
77
- r(e);
78
- }
79
- function ee(t, n) {
80
- let r = {
81
- kind: 3,
82
- owner: null,
83
- children: null,
84
- cleanups: null,
85
- disposed: !1,
86
- handler: n
87
- };
88
- return l(r), h(() => {
89
- try {
90
- return e(r, t);
91
- } catch (e) {
92
- p(e, r);
93
- return;
94
- }
95
- });
96
- }
97
- function te(e) {
98
- return _(() => T((t) => {
99
- try {
100
- return e();
101
- } finally {
102
- t();
103
- }
104
- }));
105
- }
5
+ var E = typeof window > "u";
106
6
  // src/core/context.ts
107
- function O(e, t) {
7
+ function D(e, t) {
108
8
  return { defaultValue: e };
109
9
  }
110
- function k(t, n, r) {
111
- let i = {
10
+ function O(e, t, n) {
11
+ let r = {
112
12
  kind: 3,
113
13
  owner: null,
114
14
  children: null,
@@ -116,50 +16,50 @@ function k(t, n, r) {
116
16
  disposed: !1,
117
17
  handler: null,
118
18
  context: {
119
- key: t,
120
- value: n
19
+ key: e,
20
+ value: t
121
21
  }
122
22
  };
123
- return l(i), e(i, r);
23
+ return S(r), x(r, n);
124
24
  }
125
- function A(e) {
126
- for (let t = a(); t !== null; t = t.owner) if (t.kind === 3 && t.context?.key === e) return t.context.value;
25
+ function k(e) {
26
+ for (let t = C(); t !== null; t = t.owner) if (t.kind === 3 && t.context?.key === e) return t.context.value;
127
27
  return e.defaultValue;
128
28
  }
129
29
  // src/core/store.ts
130
- var j = Symbol("raw"), M = Symbol("shape"), N = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), F = 0;
131
- function I(e, t) {
132
- let n = z(e);
30
+ var A = Symbol("raw"), j = Symbol("shape"), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), P = 0;
31
+ function ee(e, t) {
32
+ let n = L(e);
133
33
  return [n, (e) => {
134
- F++;
34
+ P++;
135
35
  try {
136
- v(() => h(() => e(n)));
36
+ _(() => v(() => e(n)));
137
37
  } finally {
138
- F--;
38
+ P--;
139
39
  }
140
40
  }];
141
41
  }
142
- function L(e) {
42
+ function F(e) {
143
43
  if (typeof e == "object" && e) {
144
- let t = e[j];
44
+ let t = e[A];
145
45
  if (t !== void 0) return t;
146
46
  }
147
47
  return e;
148
48
  }
149
- function R(e) {
49
+ function I(e) {
150
50
  if (typeof e != "object" || !e) return !1;
151
51
  if (Array.isArray(e)) return !0;
152
52
  let t = Object.getPrototypeOf(e);
153
53
  return t === Object.prototype || t === null;
154
54
  }
155
- function z(e) {
156
- if (!R(e)) return e;
157
- let t = N.get(e);
158
- return t === void 0 && (t = new Proxy(e, U), N.set(e, t)), t;
55
+ function L(e) {
56
+ if (!I(e)) return e;
57
+ let t = M.get(e);
58
+ return t === void 0 && (t = new Proxy(e, te), M.set(e, t)), t;
159
59
  }
160
- function B(e, t) {
161
- let n = P.get(e);
162
- n === void 0 && P.set(e, n = /* @__PURE__ */ new Map());
60
+ function R(e, t) {
61
+ let n = N.get(e);
62
+ n === void 0 && N.set(e, n = /* @__PURE__ */ new Map());
163
63
  let r = n.get(t);
164
64
  return r === void 0 && n.set(t, r = {
165
65
  kind: 0,
@@ -167,92 +67,376 @@ function B(e, t) {
167
67
  seenBy: 0
168
68
  }), r;
169
69
  }
170
- function V(e, t) {
171
- let n = P.get(e)?.get(t);
172
- n !== void 0 && o(n);
70
+ function z(e, t) {
71
+ let n = N.get(e)?.get(t);
72
+ n !== void 0 && g(n);
173
73
  }
174
- function H(e) {
74
+ function B(e) {
175
75
  return !1;
176
76
  }
177
- var U = {
77
+ var te = {
178
78
  get(e, t) {
179
- if (t === j) return e;
79
+ if (t === A) return e;
180
80
  let n = e[t];
181
- return s() && (Object.hasOwn(e, t) || !(t in e)) && g(B(e, t)), z(n);
81
+ return T() && (Object.hasOwn(e, t) || !(t in e)) && b(R(e, t)), L(n);
182
82
  },
183
83
  has(e, t) {
184
- return s() && g(B(e, t)), t in e;
84
+ return T() && b(R(e, t)), t in e;
185
85
  },
186
86
  ownKeys(e) {
187
- return s() && g(B(e, M)), Reflect.ownKeys(e);
87
+ return T() && b(R(e, j)), Reflect.ownKeys(e);
188
88
  },
189
89
  set(e, t, n) {
190
- if (F === 0) {
191
- let t = H(e);
90
+ if (P === 0) {
91
+ let t = B(e);
192
92
  if (t) throw t;
193
93
  return !1;
194
94
  }
195
- let r = e, i = L(n), a = Object.hasOwn(e, t), o = r[t], s = Array.isArray(e), c = s ? e.length : 0;
95
+ let r = e, i = F(n), a = Object.hasOwn(e, t), o = r[t], s = Array.isArray(e), c = s ? e.length : 0;
196
96
  if (a && Object.is(o, i)) return !0;
197
- if (r[t] = i, V(e, t), a || V(e, M), s) {
97
+ if (r[t] = i, z(e, t), a || z(e, j), s) {
198
98
  let n = e.length;
199
99
  if (n !== c) {
200
- t !== "length" && V(e, "length"), V(e, M);
201
- for (let t = n; t < c; t++) V(e, String(t));
100
+ t !== "length" && z(e, "length"), z(e, j);
101
+ for (let t = n; t < c; t++) z(e, String(t));
202
102
  }
203
103
  }
204
104
  return !0;
205
105
  },
206
106
  deleteProperty(e, t) {
207
- if (F === 0) {
208
- let t = H(e);
107
+ if (P === 0) {
108
+ let t = B(e);
209
109
  if (t) throw t;
210
110
  return !1;
211
111
  }
212
- return Object.hasOwn(e, t) && (delete e[t], V(e, t), V(e, M)), !0;
112
+ return Object.hasOwn(e, t) && (delete e[t], z(e, t), z(e, j)), !0;
213
113
  }
214
114
  };
215
- function W(e, t, n = {}) {
216
- G(z(L(e)), L(t), n.key);
115
+ function ne(e, t, n = {}) {
116
+ V(L(F(e)), F(t), n.key);
217
117
  }
218
- function G(e, t, n) {
219
- let r = L(e), i = e;
118
+ function V(e, t, n) {
119
+ let r = F(e), i = e;
220
120
  if (Array.isArray(r) && Array.isArray(t)) {
221
121
  let e = /* @__PURE__ */ new Map();
222
- if (n !== void 0) for (let t of r) R(t) && e.set(t[n], t);
122
+ if (n !== void 0) for (let t of r) I(t) && e.set(t[n], t);
223
123
  for (let a = 0; a < t.length; a++) {
224
- let o = t[a], s = n !== void 0 && R(o) ? e.get(o[n]) : r[a];
225
- i[a] = K(s, o, n);
124
+ let o = t[a], s = n !== void 0 && I(o) ? e.get(o[n]) : r[a];
125
+ i[a] = H(s, o, n);
226
126
  }
227
127
  r.length !== t.length && (i.length = t.length);
228
128
  } else {
229
- for (let e of Object.keys(t)) i[e] = K(r[e], t[e], n);
129
+ for (let e of Object.keys(t)) i[e] = H(r[e], t[e], n);
230
130
  for (let e of Object.keys(r)) Object.hasOwn(t, e) || delete i[e];
231
131
  }
232
132
  }
233
- function K(e, t, n) {
234
- return R(e) && R(t) && Array.isArray(e) === Array.isArray(t) ? (G(z(e), t, n), e) : t;
133
+ function H(e, t, n) {
134
+ return I(e) && I(t) && Array.isArray(e) === Array.isArray(t) ? (V(L(e), t, n), e) : t;
235
135
  }
236
136
  // src/dom/tags.ts
237
- var q = /* @__PURE__ */ d("a"), J = /* @__PURE__ */ d("abbr"), Y = /* @__PURE__ */ d("address"), X = /* @__PURE__ */ d("area"), Z = /* @__PURE__ */ d("article"), Q = /* @__PURE__ */ d("aside"), ne = /* @__PURE__ */ d("audio"), re = /* @__PURE__ */ d("b"), ie = /* @__PURE__ */ d("base"), ae = /* @__PURE__ */ d("bdi"), oe = /* @__PURE__ */ d("bdo"), se = /* @__PURE__ */ d("blockquote"), ce = /* @__PURE__ */ d("body"), le = /* @__PURE__ */ d("br"), ue = /* @__PURE__ */ d("button"), de = /* @__PURE__ */ d("canvas"), fe = /* @__PURE__ */ d("caption"), pe = /* @__PURE__ */ d("cite"), me = /* @__PURE__ */ d("code"), he = /* @__PURE__ */ d("col"), ge = /* @__PURE__ */ d("colgroup"), _e = /* @__PURE__ */ d("data"), ve = /* @__PURE__ */ d("datalist"), ye = /* @__PURE__ */ d("dd"), be = /* @__PURE__ */ d("del"), xe = /* @__PURE__ */ d("details"), Se = /* @__PURE__ */ d("dfn"), Ce = /* @__PURE__ */ d("dialog"), we = /* @__PURE__ */ d("div"), Te = /* @__PURE__ */ d("dl"), Ee = /* @__PURE__ */ d("dt"), De = /* @__PURE__ */ d("em"), Oe = /* @__PURE__ */ d("embed"), ke = /* @__PURE__ */ d("fieldset"), Ae = /* @__PURE__ */ d("figcaption"), je = /* @__PURE__ */ d("figure"), Me = /* @__PURE__ */ d("footer"), Ne = /* @__PURE__ */ d("form"), Pe = /* @__PURE__ */ d("h1"), Fe = /* @__PURE__ */ d("h2"), Ie = /* @__PURE__ */ d("h3"), Le = /* @__PURE__ */ d("h4"), Re = /* @__PURE__ */ d("h5"), ze = /* @__PURE__ */ d("h6"), Be = /* @__PURE__ */ d("head"), Ve = /* @__PURE__ */ d("header"), He = /* @__PURE__ */ d("hgroup"), Ue = /* @__PURE__ */ d("hr"), We = /* @__PURE__ */ d("html"), Ge = /* @__PURE__ */ d("i"), Ke = /* @__PURE__ */ d("iframe"), qe = /* @__PURE__ */ d("img"), Je = /* @__PURE__ */ d("input"), Ye = /* @__PURE__ */ d("ins"), Xe = /* @__PURE__ */ d("kbd"), Ze = /* @__PURE__ */ d("label"), Qe = /* @__PURE__ */ d("legend"), $e = /* @__PURE__ */ d("li"), et = /* @__PURE__ */ d("link"), tt = /* @__PURE__ */ d("main"), nt = /* @__PURE__ */ d("map"), rt = /* @__PURE__ */ d("mark"), it = /* @__PURE__ */ d("menu"), at = /* @__PURE__ */ d("meta"), ot = /* @__PURE__ */ d("meter"), st = /* @__PURE__ */ d("nav"), ct = /* @__PURE__ */ d("noscript"), lt = /* @__PURE__ */ d("object"), ut = /* @__PURE__ */ d("ol"), dt = /* @__PURE__ */ d("optgroup"), ft = /* @__PURE__ */ d("option"), pt = /* @__PURE__ */ d("output"), mt = /* @__PURE__ */ d("p"), ht = /* @__PURE__ */ d("picture"), gt = /* @__PURE__ */ d("pre"), _t = /* @__PURE__ */ d("progress"), vt = /* @__PURE__ */ d("q"), yt = /* @__PURE__ */ d("rp"), bt = /* @__PURE__ */ d("rt"), xt = /* @__PURE__ */ d("ruby"), St = /* @__PURE__ */ d("s"), Ct = /* @__PURE__ */ d("samp"), wt = /* @__PURE__ */ d("script"), Tt = /* @__PURE__ */ d("search"), Et = /* @__PURE__ */ d("section"), Dt = /* @__PURE__ */ d("select"), Ot = /* @__PURE__ */ d("slot"), kt = /* @__PURE__ */ d("small"), At = /* @__PURE__ */ d("source"), jt = /* @__PURE__ */ d("span"), Mt = /* @__PURE__ */ d("strong"), Nt = /* @__PURE__ */ d("style"), Pt = /* @__PURE__ */ d("sub"), Ft = /* @__PURE__ */ d("summary"), It = /* @__PURE__ */ d("sup"), Lt = /* @__PURE__ */ d("table"), Rt = /* @__PURE__ */ d("tbody"), zt = /* @__PURE__ */ d("td"), Bt = /* @__PURE__ */ d("template"), $ = /* @__PURE__ */ d("textarea"), Vt = /* @__PURE__ */ d("tfoot"), Ht = /* @__PURE__ */ d("th"), Ut = /* @__PURE__ */ d("thead"), Wt = /* @__PURE__ */ d("time"), Gt = /* @__PURE__ */ d("title"), Kt = /* @__PURE__ */ d("tr"), qt = /* @__PURE__ */ d("track"), Jt = /* @__PURE__ */ d("u"), Yt = /* @__PURE__ */ d("ul"), Xt = /* @__PURE__ */ d("var"), Zt = /* @__PURE__ */ d("video"), Qt = /* @__PURE__ */ d("wbr");
137
+ var re = /* @__PURE__ */ d("a"), ie = /* @__PURE__ */ d("abbr"), ae = /* @__PURE__ */ d("address"), oe = /* @__PURE__ */ d("area"), U = /* @__PURE__ */ d("article"), W = /* @__PURE__ */ d("aside"), G = /* @__PURE__ */ d("audio"), K = /* @__PURE__ */ d("b"), q = /* @__PURE__ */ d("base"), se = /* @__PURE__ */ d("bdi"), ce = /* @__PURE__ */ d("bdo"), le = /* @__PURE__ */ d("blockquote"), ue = /* @__PURE__ */ d("body"), de = /* @__PURE__ */ d("br"), fe = /* @__PURE__ */ d("button"), pe = /* @__PURE__ */ d("canvas"), me = /* @__PURE__ */ d("caption"), he = /* @__PURE__ */ d("cite"), ge = /* @__PURE__ */ d("code"), _e = /* @__PURE__ */ d("col"), ve = /* @__PURE__ */ d("colgroup"), ye = /* @__PURE__ */ d("data"), be = /* @__PURE__ */ d("datalist"), xe = /* @__PURE__ */ d("dd"), Se = /* @__PURE__ */ d("del"), Ce = /* @__PURE__ */ d("details"), we = /* @__PURE__ */ d("dfn"), Te = /* @__PURE__ */ d("dialog"), Ee = /* @__PURE__ */ d("div"), De = /* @__PURE__ */ d("dl"), Oe = /* @__PURE__ */ d("dt"), ke = /* @__PURE__ */ d("em"), Ae = /* @__PURE__ */ d("embed"), je = /* @__PURE__ */ d("fieldset"), Me = /* @__PURE__ */ d("figcaption"), Ne = /* @__PURE__ */ d("figure"), Pe = /* @__PURE__ */ d("footer"), Fe = /* @__PURE__ */ d("form"), Ie = /* @__PURE__ */ d("h1"), Le = /* @__PURE__ */ d("h2"), Re = /* @__PURE__ */ d("h3"), ze = /* @__PURE__ */ d("h4"), Be = /* @__PURE__ */ d("h5"), Ve = /* @__PURE__ */ d("h6"), He = /* @__PURE__ */ d("head"), Ue = /* @__PURE__ */ d("header"), We = /* @__PURE__ */ d("hgroup"), Ge = /* @__PURE__ */ d("hr"), Ke = /* @__PURE__ */ d("html"), qe = /* @__PURE__ */ d("i"), Je = /* @__PURE__ */ d("iframe"), Ye = /* @__PURE__ */ d("img"), Xe = /* @__PURE__ */ d("input"), Ze = /* @__PURE__ */ d("ins"), Qe = /* @__PURE__ */ d("kbd"), $e = /* @__PURE__ */ d("label"), et = /* @__PURE__ */ d("legend"), tt = /* @__PURE__ */ d("li"), nt = /* @__PURE__ */ d("link"), rt = /* @__PURE__ */ d("main"), it = /* @__PURE__ */ d("map"), at = /* @__PURE__ */ d("mark"), ot = /* @__PURE__ */ d("menu"), st = /* @__PURE__ */ d("meta"), ct = /* @__PURE__ */ d("meter"), lt = /* @__PURE__ */ d("nav"), ut = /* @__PURE__ */ d("noscript"), dt = /* @__PURE__ */ d("object"), ft = /* @__PURE__ */ d("ol"), pt = /* @__PURE__ */ d("optgroup"), mt = /* @__PURE__ */ d("option"), ht = /* @__PURE__ */ d("output"), gt = /* @__PURE__ */ d("p"), _t = /* @__PURE__ */ d("picture"), vt = /* @__PURE__ */ d("pre"), yt = /* @__PURE__ */ d("progress"), bt = /* @__PURE__ */ d("q"), xt = /* @__PURE__ */ d("rp"), St = /* @__PURE__ */ d("rt"), Ct = /* @__PURE__ */ d("ruby"), wt = /* @__PURE__ */ d("s"), Tt = /* @__PURE__ */ d("samp"), Et = /* @__PURE__ */ d("script"), Dt = /* @__PURE__ */ d("search"), Ot = /* @__PURE__ */ d("section"), kt = /* @__PURE__ */ d("select"), At = /* @__PURE__ */ d("slot"), jt = /* @__PURE__ */ d("small"), Mt = /* @__PURE__ */ d("source"), Nt = /* @__PURE__ */ d("span"), Pt = /* @__PURE__ */ d("strong"), Ft = /* @__PURE__ */ d("style"), It = /* @__PURE__ */ d("sub"), Lt = /* @__PURE__ */ d("summary"), Rt = /* @__PURE__ */ d("sup"), zt = /* @__PURE__ */ d("table"), Bt = /* @__PURE__ */ d("tbody"), Vt = /* @__PURE__ */ d("td"), Ht = /* @__PURE__ */ d("template"), Ut = /* @__PURE__ */ d("textarea"), Wt = /* @__PURE__ */ d("tfoot"), Gt = /* @__PURE__ */ d("th"), Kt = /* @__PURE__ */ d("thead"), qt = /* @__PURE__ */ d("time"), Jt = /* @__PURE__ */ d("title"), Yt = /* @__PURE__ */ d("tr"), Xt = /* @__PURE__ */ d("track"), Zt = /* @__PURE__ */ d("u"), Qt = /* @__PURE__ */ d("ul"), $t = /* @__PURE__ */ d("var"), en = /* @__PURE__ */ d("video"), tn = /* @__PURE__ */ d("wbr");
238
138
  // src/dom/mount.ts
239
- function $t(e, n) {
240
- if (n === null) throw Error("[keits] no target");
241
- let r = t.marker(), i = t.marker();
242
- n.append(r, i);
243
- let a = T((t) => (c(n, e(), i), t));
139
+ function nn(e, t) {
140
+ if (t === null) throw Error("[keits] no target");
141
+ let n = f.marker(), r = f.marker();
142
+ t.append(n, r);
143
+ let a = i((n) => (u(t, e(), r), n));
244
144
  return () => {
245
145
  a();
246
- let e = r;
146
+ let e = n;
247
147
  for (; e !== null;) {
248
- let t = e === i ? null : e.nextSibling;
148
+ let t = e === r ? null : e.nextSibling;
249
149
  e.remove(), e = t;
250
150
  }
251
151
  };
252
152
  }
253
153
  // src/dom/unsafe.ts
254
- function en(e) {
154
+ function rn(e) {
255
155
  let t = document.createElement("template");
256
156
  return t.innerHTML = e, t.content;
257
157
  }
258
- export { q as $a, J as $abbr, Y as $address, X as $area, Z as $article, Q as $aside, ne as $audio, re as $b, ie as $base, ae as $bdi, oe as $bdo, se as $blockquote, ce as $body, le as $br, ue as $button, de as $canvas, fe as $caption, pe as $cite, me as $code, he as $col, ge as $colgroup, _e as $data, ve as $datalist, ye as $dd, be as $del, xe as $details, Se as $dfn, Ce as $dialog, we as $div, Te as $dl, Ee as $dt, De as $em, Oe as $embed, ke as $fieldset, Ae as $figcaption, je as $figure, Me as $footer, Ne as $form, Pe as $h1, Fe as $h2, Ie as $h3, Le as $h4, Re as $h5, ze as $h6, Be as $head, Ve as $header, He as $hgroup, Ue as $hr, We as $html, Ge as $i, Ke as $iframe, qe as $img, Je as $input, Ye as $ins, Xe as $kbd, Ze as $label, Qe as $legend, $e as $li, et as $link, tt as $main, nt as $map, rt as $mark, it as $menu, at as $meta, ot as $meter, st as $nav, ct as $noscript, lt as $object, ut as $ol, dt as $optgroup, ft as $option, pt as $output, mt as $p, ht as $picture, gt as $pre, _t as $progress, vt as $q, yt as $rp, bt as $rt, xt as $ruby, St as $s, Ct as $samp, wt as $script, Tt as $search, Et as $section, Dt as $select, Ot as $slot, kt as $small, At as $source, jt as $span, Mt as $strong, Nt as $style, Pt as $sub, Ft as $summary, It as $sup, Lt as $table, Rt as $tbody, zt as $td, Bt as $template, $ as $textarea, Vt as $tfoot, Ht as $th, Ut as $thead, Wt as $time, Gt as $title, Kt as $tr, qt as $track, Jt as $u, Yt as $ul, Xt as $var, Zt as $video, Qt as $wbr, h as batch, ee as catchError, b as computed, O as createContext, T as createRoot, f as effect, C as getOwner, d as html, c as insert, S as isServer, u as isStaticRender, $t as mount, E as onCleanup, D as onMount, k as provide, W as reconcile, te as renderStatic, w as runWithOwner, y as signal, I as store, en as unsafeHTML, v as untrack, L as unwrap, A as useContext };
158
+ // src/flow/range.ts
159
+ function J(e, t) {
160
+ return i((n) => {
161
+ let r = e();
162
+ if (an(r)) return {
163
+ item: t,
164
+ index: null,
165
+ dispose: n,
166
+ first: r,
167
+ last: r
168
+ };
169
+ let i = document.createDocumentFragment(), a = f.marker(), o = f.marker();
170
+ return i.append(a, o), u(i, r, o), {
171
+ item: t,
172
+ index: null,
173
+ dispose: n,
174
+ first: a,
175
+ last: o
176
+ };
177
+ });
178
+ }
179
+ function an(e) {
180
+ return typeof e == "object" && !!e && e.nodeType === 1;
181
+ }
182
+ function Y(e, t, n) {
183
+ if (t.first === t.last) {
184
+ e.insertBefore(t.first, n);
185
+ return;
186
+ }
187
+ let r = t.first;
188
+ for (; r !== null;) {
189
+ let i = r === t.last ? null : r.nextSibling;
190
+ e.insertBefore(r, n), r = i;
191
+ }
192
+ }
193
+ function X(e) {
194
+ e.dispose();
195
+ let t = e.first;
196
+ for (; t !== null;) {
197
+ let n = t === e.last ? null : t.nextSibling;
198
+ t.remove(), t = n;
199
+ }
200
+ }
201
+ // src/flow/for.ts
202
+ function on(e, t, n) {
203
+ let i = f.marker(), a = document.createDocumentFragment();
204
+ a.append(i);
205
+ let o = [], s = null;
206
+ w(() => {
207
+ for (let e of o) e.dispose();
208
+ s?.dispose();
209
+ }), l(() => {
210
+ let t = e();
211
+ c(t ? Array.from(t) : []);
212
+ });
213
+ function c(e) {
214
+ let t = i.parentNode;
215
+ if (e.length === 0) {
216
+ for (let e of o) X(e);
217
+ o = [], s === null && n?.fallback && (s = J(n.fallback, null), Y(t, s, i));
218
+ return;
219
+ }
220
+ s !== null && (X(s), s = null);
221
+ let r = /* @__PURE__ */ new Map();
222
+ o.forEach((e, t) => {
223
+ let n = r.get(e.item);
224
+ n ? n.push(t) : r.set(e.item, [t]);
225
+ });
226
+ let a = Array(o.length).fill(!1), c = Array(e.length), l = Array(e.length);
227
+ for (let t = 0; t < e.length; t++) {
228
+ let n = e[t], i = r.get(n), s = i !== void 0 && i.length > 0 ? i.shift() : -1;
229
+ if (s >= 0) {
230
+ let e = o[s];
231
+ e.index(t), a[s] = !0, c[t] = e;
232
+ } else c[t] = u(n, t);
233
+ l[t] = s;
234
+ }
235
+ for (let e = 0; e < o.length; e++) a[e] || X(o[e]);
236
+ let d = sn(l), f = i;
237
+ for (let e = c.length - 1; e >= 0; e--) {
238
+ let n = c[e];
239
+ d.has(e) || Y(t, n, f), f = n.first;
240
+ }
241
+ o = c;
242
+ }
243
+ function u(e, n) {
244
+ let i = () => {}, a = J(() => {
245
+ let a = r(n);
246
+ return i = a.set, t(e, a);
247
+ }, e);
248
+ return a.index = i, a;
249
+ }
250
+ return a;
251
+ }
252
+ function sn(e) {
253
+ let t = [], n = Array(e.length);
254
+ for (let r = 0; r < e.length; r++) {
255
+ let i = e[r];
256
+ if (i < 0) continue;
257
+ let a = 0, o = t.length;
258
+ for (; a < o;) {
259
+ let n = a + o >> 1;
260
+ e[t[n]] < i ? a = n + 1 : o = n;
261
+ }
262
+ n[r] = a > 0 ? t[a - 1] : -1, t[a] = r;
263
+ }
264
+ let r = /* @__PURE__ */ new Set(), i = t.length > 0 ? t[t.length - 1] : -1;
265
+ for (; i >= 0;) r.add(i), i = n[i];
266
+ return r;
267
+ }
268
+ // src/flow/if.ts
269
+ function cn(e, n, r) {
270
+ let i = t(e), a = t(() => !!i()), o = i;
271
+ return () => a() ? _(() => n(o)) : r ? _(r) : null;
272
+ }
273
+ // src/flow/show.ts
274
+ function ln(e, t) {
275
+ let n = t.style.display;
276
+ return l(() => {
277
+ e() ? t.style.display = n : t.style.display = "none";
278
+ }), t;
279
+ }
280
+ // src/flow/switch.ts
281
+ function Z(e, n, r) {
282
+ let i = t(e);
283
+ return () => {
284
+ let e = n[i()] ?? r;
285
+ return e ? _(e) : null;
286
+ };
287
+ }
288
+ // src/flow/dynamic.ts
289
+ function un(e, n) {
290
+ let r = t(e);
291
+ return () => {
292
+ let e = r();
293
+ return e ? _(() => e(n)) : null;
294
+ };
295
+ }
296
+ // src/flow/catch.ts
297
+ function dn(e, t) {
298
+ let n = r(null), i = () => n.set(null);
299
+ return () => {
300
+ let r = n();
301
+ return _(r === null ? () => c(() => {
302
+ let t = document.createDocumentFragment();
303
+ return u(t, e()), t;
304
+ }, (e) => n.set({ error: e })) : () => t(r.error, i));
305
+ };
306
+ }
307
+ // src/flow/portal.ts
308
+ function fn(e, t) {
309
+ if (y()) return null;
310
+ let n = t === void 0 ? document.body : t;
311
+ if (n === null) throw Error("[keits] no target");
312
+ let r = f.marker(), i = f.marker();
313
+ return n.append(r, i), u(n, _(e), i), w(() => {
314
+ let e = r;
315
+ for (; e !== null;) {
316
+ let t = e === i ? null : e.nextSibling;
317
+ e.remove(), e = t;
318
+ }
319
+ }), null;
320
+ }
321
+ // src/async/suspense-context.ts
322
+ var Q = D(null);
323
+ // src/flow/suspense.ts
324
+ function pn(e, t) {
325
+ let n = r(0), i = /* @__PURE__ */ new Set(), a = { wait(e, t) {
326
+ i.has(e) || (i.add(e), n.set((e) => e + 1), t(() => {
327
+ i.delete(e), n.set((e) => e - 1);
328
+ }));
329
+ } }, o = document.createDocumentFragment(), s = f.marker(), c = f.marker();
330
+ o.append(s, c);
331
+ let { release: d } = m(() => O(Q, a, () => u(o, _(e), c))), p = {
332
+ item: null,
333
+ index: null,
334
+ dispose: () => {},
335
+ first: s,
336
+ last: c
337
+ }, h = f.marker(), g = document.createDocumentFragment();
338
+ g.append(h);
339
+ let v = null;
340
+ return w(() => v?.dispose()), l(() => {
341
+ let e = n() > 0;
342
+ _(() => {
343
+ let n = h.parentNode;
344
+ e ? (Y(o, p, null), v === null && (v = J(t, null), Y(n, v, h))) : (v !== null && (X(v), v = null), Y(n, p, h), d());
345
+ });
346
+ }), g;
347
+ }
348
+ // src/async/resource.ts
349
+ function $(e, t, n) {
350
+ let i = typeof t == "function", a = i ? e : () => !0, o = i ? t : (t, n) => e(n), s = i ? n : t, c = C(), u = s !== void 0 && "initialValue" in s, d = r(s?.initialValue), f = r(u ? "ready" : "unresolved"), p = r(null), m = null, g = 0, y = [], b = null, x = () => {
351
+ let e = y;
352
+ y = [];
353
+ for (let t of e) t();
354
+ };
355
+ function S(e, t) {
356
+ m?.abort(), m = null;
357
+ let n = ++g;
358
+ if (e == null || e === !1) return b = null, f.set(_(d) === void 0 ? "unresolved" : "ready"), x(), Promise.resolve();
359
+ b = e;
360
+ let r = new AbortController();
361
+ m = r;
362
+ let i;
363
+ try {
364
+ i = o(e, {
365
+ signal: r.signal,
366
+ refetching: t,
367
+ value: _(d)
368
+ });
369
+ } catch (e) {
370
+ return E(e), Promise.resolve();
371
+ }
372
+ return mn(i) ? (f.set(_(d) === void 0 && _(f) !== "ready" ? "pending" : "refreshing"), Promise.resolve(i).then((e) => {
373
+ n === g && T(e);
374
+ }, (e) => {
375
+ n === g && E(e);
376
+ })) : (T(i), Promise.resolve());
377
+ }
378
+ function T(e) {
379
+ m = null, v(() => {
380
+ d.set(() => e), p.set(null), f.set("ready");
381
+ }), x();
382
+ }
383
+ function E(e) {
384
+ m = null, v(() => {
385
+ p.set({ error: e }), f.set("errored");
386
+ }), x();
387
+ }
388
+ l(() => {
389
+ let e = a();
390
+ _(() => S(e, !1));
391
+ }), w(() => {
392
+ g++, m?.abort(), m = null;
393
+ });
394
+ let D = Object.assign(() => {
395
+ let e = f();
396
+ if (e === "errored") throw p().error;
397
+ if (e === "pending") {
398
+ let e = k(Q);
399
+ e !== null && e.wait(D, (e) => y.push(e));
400
+ }
401
+ return d();
402
+ }, {
403
+ state: () => f(),
404
+ loading: () => {
405
+ let e = f();
406
+ return e === "pending" || e === "refreshing";
407
+ },
408
+ error: () => p()?.error,
409
+ refetch: () => _(() => S(b ?? a(), !0)),
410
+ mutate: (e) => v(() => {
411
+ d.set(() => e), p.set(null), f.set(e === void 0 ? "unresolved" : "ready");
412
+ }),
413
+ optimistic: async (e, t) => {
414
+ let n = _(d), r = e(n);
415
+ d.set(() => r);
416
+ try {
417
+ return await t(), !0;
418
+ } catch (e) {
419
+ return _(d) === r && d.set(() => n), v(() => h(e, c)), !1;
420
+ }
421
+ }
422
+ });
423
+ return D;
424
+ }
425
+ function mn(e) {
426
+ return typeof e?.then == "function";
427
+ }
428
+ // src/async/lazy.ts
429
+ function hn(e) {
430
+ let t, n, r = () => n ??= Promise.resolve(e()).then((e) => t = e.default, (e) => {
431
+ throw n = void 0, e;
432
+ });
433
+ return Object.assign((e) => {
434
+ if (t !== void 0) return _(() => t(e));
435
+ let n = $(() => t ?? r());
436
+ return () => {
437
+ let t = n();
438
+ return t ? _(() => t(e)) : null;
439
+ };
440
+ }, { preload: r });
441
+ }
442
+ export { re as $a, ie as $abbr, ae as $address, oe as $area, U as $article, W as $aside, G as $audio, K as $b, q as $base, se as $bdi, ce as $bdo, le as $blockquote, ue as $body, de as $br, fe as $button, pe as $canvas, me as $caption, dn as $catch, he as $cite, ge as $code, _e as $col, ve as $colgroup, ye as $data, be as $datalist, xe as $dd, Se as $del, Ce as $details, we as $dfn, Te as $dialog, Ee as $div, De as $dl, Oe as $dt, un as $dynamic, ke as $em, Ae as $embed, je as $fieldset, Me as $figcaption, Ne as $figure, Pe as $footer, on as $for, Fe as $form, Ie as $h1, Le as $h2, Re as $h3, ze as $h4, Be as $h5, Ve as $h6, He as $head, Ue as $header, We as $hgroup, Ge as $hr, Ke as $html, qe as $i, cn as $if, Je as $iframe, Ye as $img, Xe as $input, Ze as $ins, Qe as $kbd, $e as $label, et as $legend, tt as $li, nt as $link, rt as $main, it as $map, at as $mark, ot as $menu, st as $meta, ct as $meter, lt as $nav, ut as $noscript, dt as $object, ft as $ol, pt as $optgroup, mt as $option, ht as $output, gt as $p, _t as $picture, fn as $portal, vt as $pre, yt as $progress, bt as $q, xt as $rp, St as $rt, Ct as $ruby, wt as $s, Tt as $samp, Et as $script, Dt as $search, Ot as $section, kt as $select, ln as $show, At as $slot, jt as $small, Mt as $source, Nt as $span, Pt as $strong, Ft as $style, It as $sub, Lt as $summary, Rt as $sup, pn as $suspense, Z as $switch, zt as $table, Bt as $tbody, Vt as $td, Ht as $template, Ut as $textarea, Wt as $tfoot, Gt as $th, Kt as $thead, qt as $time, Jt as $title, Yt as $tr, Xt as $track, Zt as $u, Qt as $ul, $t as $var, en as $video, tn as $wbr, v as batch, c as catchError, t as computed, D as createContext, i as createRoot, p as effect, o as getOwner, d as html, u as insert, E as isServer, y as isStaticRender, hn as lazy, nn as mount, n as onCleanup, e as onMount, O as provide, ne as reconcile, a as renderStatic, $ as resource, s as runWithOwner, r as signal, ee as store, rn as unsafeHTML, _ as untrack, F as unwrap, k as useContext };