kerfjs 5.0.0-beta.4 → 5.0.0-beta.41

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 (71) hide show
  1. package/CHANGELOG.md +345 -116
  2. package/README.md +43 -23
  3. package/ai/cursorrules +87 -48
  4. package/ai/manifest.json +10 -7
  5. package/ai/skill.md +101 -67
  6. package/dist/actions.js +2 -2
  7. package/dist/actions.js.map +1 -1
  8. package/dist/array-signal.js +1 -1
  9. package/dist/async.js +22 -19
  10. package/dist/async.js.map +1 -1
  11. package/dist/attach.js +3 -1
  12. package/dist/attach.js.map +1 -1
  13. package/dist/{chunk-QIP723L4.js → chunk-5WRGJZV6.js} +3 -2
  14. package/dist/chunk-5WRGJZV6.js.map +1 -0
  15. package/dist/{chunk-GY4XV2UV.js → chunk-BDX3R4OM.js} +3 -2
  16. package/dist/chunk-BDX3R4OM.js.map +1 -0
  17. package/dist/{chunk-HW7KSM2Y.js → chunk-CEQMZYLR.js} +1 -1
  18. package/dist/{chunk-HW7KSM2Y.js.map → chunk-CEQMZYLR.js.map} +1 -1
  19. package/dist/{chunk-SVATPF5R.js → chunk-DLY444MN.js} +121 -49
  20. package/dist/chunk-DLY444MN.js.map +1 -0
  21. package/dist/{chunk-KPXIOG2C.js → chunk-E5R5GNKE.js} +14 -4
  22. package/dist/chunk-E5R5GNKE.js.map +1 -0
  23. package/dist/{chunk-LVH3GC6B.js → chunk-ELXVRKY2.js} +3 -3
  24. package/dist/chunk-ELXVRKY2.js.map +1 -0
  25. package/dist/{chunk-ZDCJZCNO.js → chunk-JRKE6XEK.js} +37 -16
  26. package/dist/chunk-JRKE6XEK.js.map +1 -0
  27. package/dist/{chunk-UZJ6I4T6.js → chunk-MK42GLPV.js} +1 -1
  28. package/dist/chunk-MK42GLPV.js.map +1 -0
  29. package/dist/{chunk-V46JKE44.js → chunk-WKIPLNVO.js} +1 -1
  30. package/dist/chunk-WKIPLNVO.js.map +1 -0
  31. package/dist/{chunk-U6FK33SG.js → chunk-Y2FOYPBV.js} +2 -2
  32. package/dist/{chunk-U6FK33SG.js.map → chunk-Y2FOYPBV.js.map} +1 -1
  33. package/dist/{chunk-KZJXHFIB.js → chunk-ZOIERTUW.js} +3 -3
  34. package/dist/chunk-ZOIERTUW.js.map +1 -0
  35. package/dist/dev.js +64 -17
  36. package/dist/dev.js.map +1 -1
  37. package/dist/html.js +5 -4
  38. package/dist/html.js.map +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +23 -14
  41. package/dist/index.js.map +1 -1
  42. package/dist/jsx-runtime.d.ts +12 -5
  43. package/dist/jsx-runtime.js +1 -1
  44. package/dist/list.js +43 -14
  45. package/dist/list.js.map +1 -1
  46. package/dist/overlay.js +99 -32
  47. package/dist/overlay.js.map +1 -1
  48. package/dist/remount.js +2 -2
  49. package/dist/router.js +33 -10
  50. package/dist/router.js.map +1 -1
  51. package/dist/scope.js +5 -4
  52. package/dist/scope.js.map +1 -1
  53. package/dist/testing.js +1 -1
  54. package/dist/timing.js +1 -1
  55. package/dist/timing.js.map +1 -1
  56. package/llms.txt +6 -2
  57. package/package.json +32 -7
  58. package/setup/cli.mjs +90 -0
  59. package/setup/index.d.mts +37 -0
  60. package/setup/index.mjs +1347 -0
  61. package/setup/jsonc.mjs +201 -0
  62. package/setup/state.schema.json +56 -0
  63. package/dist/chunk-GY4XV2UV.js.map +0 -1
  64. package/dist/chunk-KPXIOG2C.js.map +0 -1
  65. package/dist/chunk-KZJXHFIB.js.map +0 -1
  66. package/dist/chunk-LVH3GC6B.js.map +0 -1
  67. package/dist/chunk-QIP723L4.js.map +0 -1
  68. package/dist/chunk-SVATPF5R.js.map +0 -1
  69. package/dist/chunk-UZJ6I4T6.js.map +0 -1
  70. package/dist/chunk-V46JKE44.js.map +0 -1
  71. package/dist/chunk-ZDCJZCNO.js.map +0 -1
package/dist/dev.js CHANGED
@@ -1,7 +1,7 @@
1
- import { truncateRowHtml } from './chunk-V46JKE44.js';
2
- import { LIST_MARKER_PREFIX } from './chunk-GY4XV2UV.js';
3
- import { installDevHooks } from './chunk-HW7KSM2Y.js';
4
- export { clearDevHooks, devHooks, installDevHooks } from './chunk-HW7KSM2Y.js';
1
+ import { truncateRowHtml } from './chunk-WKIPLNVO.js';
2
+ import { LIST_MARKER_PREFIX } from './chunk-BDX3R4OM.js';
3
+ import { installDevHooks } from './chunk-CEQMZYLR.js';
4
+ export { clearDevHooks, devHooks, installDevHooks } from './chunk-CEQMZYLR.js';
5
5
  import { signal, Signal } from '@preact/signals-core';
6
6
 
7
7
  // src/dev-warn-config.ts
@@ -24,7 +24,10 @@ function applyWarningOptions(options) {
24
24
  for (const [key, value] of Object.entries(options)) {
25
25
  const envName = ENV_NAME[key];
26
26
  if (envName === void 0 || value === void 0) continue;
27
- overrides.set(envName, value === false ? false : value === true ? "1" : value);
27
+ overrides.set(
28
+ envName,
29
+ value === false ? false : value === true ? "1" : value
30
+ );
28
31
  }
29
32
  }
30
33
  function devFlag(envName) {
@@ -157,18 +160,38 @@ function findListInvariantViolations(rootEl, bindings, expectedCounts) {
157
160
  const { marker, liveParent, items } = binding;
158
161
  const expected = expectedCounts?.get(id);
159
162
  if (expected !== void 0 && items.length !== expected) {
160
- problems.push(describe(id, `holds ${items.length} row(s) but its source has ${expected} \u2014 the reconcile dropped or duplicated rows`));
163
+ problems.push(
164
+ describe(
165
+ id,
166
+ `holds ${items.length} row(s) but its source has ${expected} \u2014 the reconcile dropped or duplicated rows`
167
+ )
168
+ );
161
169
  }
162
170
  if (!rootEl.contains(marker)) {
163
- problems.push(describe(id, "its marker comment is no longer inside the mount root, so every future reconcile would mutate a detached tree"));
171
+ problems.push(
172
+ describe(
173
+ id,
174
+ "its marker comment is no longer inside the mount root, so every future reconcile would mutate a detached tree"
175
+ )
176
+ );
164
177
  continue;
165
178
  }
166
179
  if (marker.data !== `${LIST_MARKER_PREFIX}${id}`) {
167
- problems.push(describe(id, `its marker reads '${marker.data}' \u2014 the id is carried by a different marker node, so this binding describes another list`));
180
+ problems.push(
181
+ describe(
182
+ id,
183
+ `its marker reads '${marker.data}' \u2014 the id is carried by a different marker node, so this binding describes another list`
184
+ )
185
+ );
168
186
  }
169
187
  const markerIndex = indexIn(liveParent, marker);
170
188
  if (markerIndex === -1) {
171
- problems.push(describe(id, "its marker is not a child of the parent the binding records"));
189
+ problems.push(
190
+ describe(
191
+ id,
192
+ "its marker is not a child of the parent the binding records"
193
+ )
194
+ );
172
195
  continue;
173
196
  }
174
197
  let previousIndex = markerIndex;
@@ -177,28 +200,46 @@ function findListInvariantViolations(rootEl, bindings, expectedCounts) {
177
200
  const node = items[i].node;
178
201
  const index = indexIn(liveParent, node);
179
202
  if (index === -1) {
180
- problems.push(describe(id, `bound row ${i} is not a child of the list's parent (<${liveParent.tagName.toLowerCase()}>)${node.isConnected ? " \u2014 it is attached elsewhere in the document" : " \u2014 it is detached"}`));
203
+ problems.push(
204
+ describe(
205
+ id,
206
+ `bound row ${i} is not a child of the list's parent (<${liveParent.tagName.toLowerCase()}>)${node.isConnected ? " \u2014 it is attached elsewhere in the document" : " \u2014 it is detached"}`
207
+ )
208
+ );
181
209
  continue;
182
210
  }
183
211
  if (index <= previousIndex) {
184
- problems.push(describe(id, `bound row ${i} appears at child position ${index}, which is not after the previous one (${previousIndex}) \u2014 the rows are out of order or have crossed the marker`));
212
+ problems.push(
213
+ describe(
214
+ id,
215
+ `bound row ${i} appears at child position ${index}, which is not after the previous one (${previousIndex}) \u2014 the rows are out of order or have crossed the marker`
216
+ )
217
+ );
185
218
  }
186
219
  previousIndex = index;
187
220
  if (first === -1) first = index;
188
221
  const owner = owners.get(node);
189
222
  if (owner !== void 0) {
190
- problems.push(describe(id, `bound row ${i} is also claimed by list '${owner}'`));
223
+ problems.push(
224
+ describe(id, `bound row ${i} is also claimed by list '${owner}'`)
225
+ );
191
226
  } else {
192
227
  owners.set(node, id);
193
228
  }
194
229
  }
195
- if (first !== -1) spans.push({ id, parent: liveParent, from: first, to: previousIndex });
230
+ if (first !== -1)
231
+ spans.push({ id, parent: liveParent, from: first, to: previousIndex });
196
232
  }
197
233
  for (let a = 0; a < spans.length; a++) {
198
234
  for (let b = a + 1; b < spans.length; b++) {
199
235
  if (spans[a].parent !== spans[b].parent) continue;
200
236
  if (spans[a].from <= spans[b].to && spans[b].from <= spans[a].to) {
201
- problems.push(describe(spans[a].id, `its rows (child positions ${spans[a].from}-${spans[a].to}) overlap those of list '${spans[b].id}' (${spans[b].from}-${spans[b].to}) in the same parent`));
237
+ problems.push(
238
+ describe(
239
+ spans[a].id,
240
+ `its rows (child positions ${spans[a].from}-${spans[a].to}) overlap those of list '${spans[b].id}' (${spans[b].from}-${spans[b].to}) in the same parent`
241
+ )
242
+ );
202
243
  }
203
244
  }
204
245
  }
@@ -207,7 +248,11 @@ function findListInvariantViolations(rootEl, bindings, expectedCounts) {
207
248
  function maybeCheckListInvariants(rootEl, bindings, expectedCounts) {
208
249
  const level = mode();
209
250
  if (level === "off") return;
210
- const problems = findListInvariantViolations(rootEl, bindings, expectedCounts);
251
+ const problems = findListInvariantViolations(
252
+ rootEl,
253
+ bindings,
254
+ expectedCounts
255
+ );
211
256
  if (problems.length === 0) return;
212
257
  const report = `${problems.join("\n")}
213
258
  This is a kerf bug, not an application one \u2014 please report it with the markup that produced it. Set KERF_DEV_INVARIANTS=1 to warn instead of throw, or unset it to disable these checks.`;
@@ -277,12 +322,14 @@ function patchAddEventListenerOnce() {
277
322
  };
278
323
  }
279
324
  function hasMarkedListener(el) {
280
- if (el[LISTENER_MARKER] === true) return true;
325
+ if (el[LISTENER_MARKER] === true)
326
+ return true;
281
327
  const stack = [];
282
328
  for (let i = 0; i < el.children.length; i++) stack.push(el.children[i]);
283
329
  while (stack.length > 0) {
284
330
  const cur = stack.pop();
285
- if (cur[LISTENER_MARKER] === true) return true;
331
+ if (cur[LISTENER_MARKER] === true)
332
+ return true;
286
333
  for (let i = 0; i < cur.children.length; i++) stack.push(cur.children[i]);
287
334
  }
288
335
  return false;