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
@@ -1,40 +1,40 @@
1
- var e = null, t = null, n = 0, r = 0, i = null, a = 0, o = 0, s = 0, c = [], l = [], u = [], d = 0;
2
- function f(t) {
1
+ var e = null, t = null, n = 0, r = 0, i = null, a = 0, o = 0, s = 0, c = [], l = [], u = [], d = 0, f = 0;
2
+ function p(t) {
3
3
  let r = e;
4
4
  r !== null && t.seenBy !== n && (t.seenBy = n, i === null && r.sources[a] === t ? a++ : ((i ??= []).push(t), t.observers.push(r)));
5
5
  }
6
- function p() {
6
+ function m() {
7
7
  return e !== null;
8
8
  }
9
- function m(e) {
9
+ function h(e) {
10
10
  if (e.observers.length !== 0) {
11
11
  o++;
12
12
  try {
13
- for (let t of e.observers) h(t, 2);
13
+ for (let t of e.observers) g(t, 2);
14
14
  } finally {
15
- C();
15
+ w();
16
16
  }
17
17
  }
18
18
  }
19
- function h(e, t) {
19
+ function g(e, t) {
20
20
  if (e.state >= t) return;
21
21
  let n = e.state === 0;
22
22
  if (e.state = t, n) {
23
23
  if (e.kind === 1) c.push(e);
24
- else for (let t of e.observers) h(t, 1);
24
+ else for (let t of e.observers) g(t, 1);
25
25
  }
26
26
  }
27
- function g(e) {
27
+ function _(e) {
28
28
  if (e.state === 1) {
29
- for (let t of e.sources) if (t.kind === 2 && (g(t), e.state === 2)) break;
29
+ for (let t of e.sources) if (t.kind === 2 && (_(t), e.state === 2)) break;
30
30
  }
31
- e.state === 2 ? e.kind === 1 ? v(e) : _(e) : e.state = 0;
31
+ e.state === 2 ? e.kind === 1 ? y(e) : v(e) : e.state = 0;
32
32
  }
33
- function _(e) {
33
+ function v(e) {
34
34
  let t;
35
35
  e.computing = !0;
36
36
  try {
37
- let n = y(e, () => e.fn(e.value));
37
+ let n = b(e, () => e.fn(e.value));
38
38
  t = !e.hasValue || e.hasError || e.equals === !1 || !e.equals(e.value, n), t && (e.value = n), e.hasValue = !0, e.hasError = !1, e.error = void 0;
39
39
  } catch (n) {
40
40
  t = !0, e.hasError = !0, e.error = n;
@@ -43,76 +43,76 @@ function _(e) {
43
43
  }
44
44
  if (t) for (let t of e.observers) t.state === 1 && (t.state = 2);
45
45
  }
46
- function v(e) {
46
+ function y(e) {
47
47
  try {
48
- y(e, e.fn);
48
+ b(e, e.fn);
49
49
  } catch (t) {
50
- z(t, e);
50
+ K(t, e);
51
51
  }
52
52
  }
53
- function y(o, s) {
54
- L(o);
53
+ function b(o, s) {
54
+ W(o);
55
55
  let c = e, l = t, u = n, d = i, f = a;
56
56
  e = o, t = o, n = ++r, i = null, a = 0, o.state = 0;
57
57
  try {
58
58
  return s();
59
59
  } finally {
60
- b(o, i, a), e = c, t = l, n = u, i = d, a = f;
60
+ x(o, i, a), e = c, t = l, n = u, i = d, a = f;
61
61
  }
62
62
  }
63
- function b(e, t, n) {
63
+ function x(e, t, n) {
64
64
  if (e.disposed) {
65
- if (t !== null) for (let n of t) x(n, e);
65
+ if (t !== null) for (let n of t) S(n, e);
66
66
  return;
67
67
  }
68
68
  let r = e.sources;
69
- for (let t = n; t < r.length; t++) x(r[t], e);
69
+ for (let t = n; t < r.length; t++) S(r[t], e);
70
70
  if (r.length = n, t !== null) for (let e of t) r.push(e);
71
71
  }
72
- function x(e, t) {
72
+ function S(e, t) {
73
73
  let n = e.observers, r = n.lastIndexOf(t);
74
74
  r !== -1 && (n[r] = n[n.length - 1], n.pop());
75
75
  }
76
- function S(e) {
76
+ function C(e) {
77
77
  o++;
78
78
  try {
79
79
  return e();
80
80
  } finally {
81
- C();
81
+ w();
82
82
  }
83
83
  }
84
- function C() {
85
- --o === 0 && w();
86
- }
87
84
  function w() {
85
+ --o === 0 && T();
86
+ }
87
+ function T() {
88
88
  do
89
- E(), l.length > 0 && T();
89
+ D(), l.length > 0 && E();
90
90
  while (c.length > 0 || l.length > 0);
91
91
  if (u.length > 0) {
92
92
  let e = u.splice(0);
93
93
  throw e.length === 1 ? e[0] : AggregateError(e, "[keits] multiple unhandled errors");
94
94
  }
95
95
  }
96
- function T() {
96
+ function E() {
97
97
  o++;
98
98
  let e = l.splice(0);
99
99
  try {
100
100
  for (let { owner: t, fn: n } of e) if (!t?.disposed) try {
101
- M(t, n);
101
+ z(t, n);
102
102
  } catch (e) {
103
- z(e, t);
103
+ K(e, t);
104
104
  }
105
105
  } finally {
106
106
  o--;
107
107
  }
108
108
  }
109
- function E() {
109
+ function D() {
110
110
  o++;
111
111
  let e = ++s, t = !1;
112
112
  try {
113
113
  for (let t = 0; t < c.length; t++) {
114
114
  let n = c[t];
115
- n.state !== 0 && (n.flushId !== e && (n.flushId = e, n.flushRuns = 0), ++n.flushRuns > 100 ? (n.state = 0, z(O(n), n)) : D(n));
115
+ n.state !== 0 && (n.flushId !== e && (n.flushId = e, n.flushRuns = 0), ++n.flushRuns > 100 ? (n.state = 0, K(k(n), n)) : O(n));
116
116
  }
117
117
  t = !0;
118
118
  } finally {
@@ -120,16 +120,16 @@ function E() {
120
120
  c.length = 0, o--;
121
121
  }
122
122
  }
123
- function D(e) {
123
+ function O(e) {
124
124
  let t = [];
125
125
  for (let n = e.owner; n !== null; n = n.owner) n.kind !== 3 && n.state !== 0 && t.push(n);
126
- for (let e = t.length - 1; e >= 0; e--) g(t[e]);
127
- g(e);
126
+ for (let e = t.length - 1; e >= 0; e--) _(t[e]);
127
+ _(e);
128
128
  }
129
- function O(e) {
129
+ function k(e) {
130
130
  return /* @__PURE__ */ Error("[keits] infinite update loop");
131
131
  }
132
- function k(t) {
132
+ function A(t) {
133
133
  let n = e;
134
134
  e = null;
135
135
  try {
@@ -138,14 +138,35 @@ function k(t) {
138
138
  e = n;
139
139
  }
140
140
  }
141
- function A(e) {
141
+ function j(e) {
142
142
  let n = t;
143
- e.owner = n, n !== null && (n.children ??= []).push(e);
143
+ e.owner = n, n !== null && (n.children ??= []).push(e), I(e);
144
+ }
145
+ var M = 0;
146
+ function N() {
147
+ M++;
148
+ }
149
+ function P() {
150
+ M--;
151
+ }
152
+ function F() {
153
+ let e = t;
154
+ if (M === 0 || e === null || e.key === void 0) return null;
155
+ let n = e.keyCount ?? 0;
156
+ return e.keyCount = n + 1, `${e.key}.${n}`;
157
+ }
158
+ function I(e) {
159
+ let t = F();
160
+ t !== null && (e.key = t, e.keyCount = 0);
144
161
  }
145
- function j() {
162
+ function L(e = t) {
163
+ for (let t = e; t !== null; t = t.owner) if (t.kind === 3 && t.hydratable) return !0;
164
+ return !1;
165
+ }
166
+ function R() {
146
167
  return t;
147
168
  }
148
- function M(n, r) {
169
+ function z(n, r) {
149
170
  let i = t, a = e;
150
171
  t = n, e = null;
151
172
  try {
@@ -154,13 +175,13 @@ function M(n, r) {
154
175
  t = i, e = a;
155
176
  }
156
177
  }
157
- function N(e) {
178
+ function B(e) {
158
179
  return t !== null && ((t.cleanups ??= []).push(e), !0);
159
180
  }
160
- function P(e) {
161
- d > 0 || F(t, e);
181
+ function V(e) {
182
+ q() || H(t, e);
162
183
  }
163
- function F(e, t) {
184
+ function H(e, t) {
164
185
  for (let n = e; n !== null; n = n.owner) if (n.kind === 3 && n.held) {
165
186
  n.held.push({
166
187
  owner: e,
@@ -173,7 +194,7 @@ function F(e, t) {
173
194
  fn: t
174
195
  });
175
196
  }
176
- function I(e) {
197
+ function U(e) {
177
198
  let t = {
178
199
  kind: 3,
179
200
  owner: null,
@@ -183,41 +204,41 @@ function I(e) {
183
204
  handler: null,
184
205
  held: []
185
206
  };
186
- return A(t), {
187
- result: M(t, e),
207
+ return j(t), {
208
+ result: z(t, e),
188
209
  release: () => {
189
210
  let e = t.held;
190
211
  if (e) {
191
212
  t.held = null;
192
- for (let { owner: t, fn: n } of e) F(t, n);
213
+ for (let { owner: t, fn: n } of e) H(t, n);
193
214
  }
194
215
  }
195
216
  };
196
217
  }
197
- function L(e) {
218
+ function W(e) {
198
219
  let t = e.children, n = e.cleanups;
199
- if (e.children = null, e.cleanups = null, t !== null) for (let e = t.length - 1; e >= 0; e--) R(t[e]);
220
+ if (e.children = null, e.cleanups = null, e.key !== void 0 && (e.keyCount = 0), t !== null) for (let e = t.length - 1; e >= 0; e--) G(t[e]);
200
221
  if (n !== null) for (let t = n.length - 1; t >= 0; t--) try {
201
222
  n[t]();
202
223
  } catch (t) {
203
- z(t, e);
224
+ K(t, e);
204
225
  }
205
226
  }
206
- function R(e) {
227
+ function G(e) {
207
228
  if (!e.disposed) {
208
229
  if (e.disposed = !0, e.kind !== 3) {
209
- for (let t of e.sources) x(t, e);
230
+ for (let t of e.sources) S(t, e);
210
231
  e.sources.length = 0, e.state = 0;
211
232
  }
212
- L(e);
233
+ W(e);
213
234
  }
214
235
  }
215
- function z(e, t) {
236
+ function K(e, t) {
216
237
  for (let n = t; n !== null; n = n.owner) {
217
238
  if (n.kind !== 3 || n.handler === null || n.disposed) continue;
218
239
  let t = n.handler;
219
240
  try {
220
- M(n.owner, () => t(e));
241
+ z(n.owner, () => t(e));
221
242
  return;
222
243
  } catch (t) {
223
244
  e = t;
@@ -226,10 +247,33 @@ function z(e, t) {
226
247
  if (o === 0) throw e;
227
248
  u.push(e);
228
249
  }
229
- function B() {
230
- return d > 0;
250
+ function q() {
251
+ if (d > 0) return !0;
252
+ if (f === 0) return !1;
253
+ for (let e = t; e !== null; e = e.owner) if (e.kind === 3 && e.static) return !0;
254
+ return !1;
231
255
  }
232
- function V(e) {
256
+ function J(e) {
257
+ let t = {
258
+ kind: 3,
259
+ owner: null,
260
+ children: null,
261
+ cleanups: null,
262
+ disposed: !1,
263
+ handler: null,
264
+ static: !0
265
+ };
266
+ f++;
267
+ let n = !1, r = () => {
268
+ n || (n = !0, f--, C(() => G(t)));
269
+ };
270
+ try {
271
+ return C(() => z(t, () => e(r)));
272
+ } catch (e) {
273
+ throw r(), e;
274
+ }
275
+ }
276
+ function Y(e) {
233
277
  d++;
234
278
  try {
235
279
  return e();
@@ -237,4 +281,4 @@ function V(e) {
237
281
  d--;
238
282
  }
239
283
  }
240
- export { V as _, I as a, z as c, m as d, v as f, g, k as h, S as i, B as l, f as m, P as n, R as o, M as p, A as r, j as s, N as t, p as u };
284
+ export { Y as C, _ as S, N as _, U as a, p as b, I as c, q as d, m as f, z as g, y as h, C as i, K as l, h as m, V as n, G as o, F as p, j as r, R as s, B as t, L as u, J as v, A as x, P as y };