kerfjs 5.0.0-beta.13 → 5.0.0-beta.131

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 (94) hide show
  1. package/CHANGELOG.md +3384 -108
  2. package/README.md +101 -37
  3. package/ai/cursorrules +127 -68
  4. package/ai/manifest.json +36 -7
  5. package/ai/skill.md +167 -86
  6. package/ai/ui-skill.md +18 -0
  7. package/dist/actions.d.ts +1 -1
  8. package/dist/actions.js +10 -6
  9. package/dist/actions.js.map +1 -1
  10. package/dist/array-signal.js +1 -1
  11. package/dist/async.d.ts +7 -3
  12. package/dist/async.js +39 -22
  13. package/dist/async.js.map +1 -1
  14. package/dist/attach.js +1 -66
  15. package/dist/attach.js.map +1 -1
  16. package/dist/{chunk-GY4XV2UV.js → chunk-4TX6YJDM.js} +10 -3
  17. package/dist/chunk-4TX6YJDM.js.map +1 -0
  18. package/dist/{chunk-SVATPF5R.js → chunk-5QDM6HPD.js} +637 -277
  19. package/dist/chunk-5QDM6HPD.js.map +1 -0
  20. package/dist/{chunk-QIP723L4.js → chunk-5WRGJZV6.js} +3 -2
  21. package/dist/chunk-5WRGJZV6.js.map +1 -0
  22. package/dist/chunk-AP2FT33F.js +87 -0
  23. package/dist/chunk-AP2FT33F.js.map +1 -0
  24. package/dist/chunk-BTOKH5FA.js +70 -0
  25. package/dist/chunk-BTOKH5FA.js.map +1 -0
  26. package/dist/{chunk-ZDCJZCNO.js → chunk-GGADRIQO.js} +168 -97
  27. package/dist/chunk-GGADRIQO.js.map +1 -0
  28. package/dist/chunk-KOEGJCIS.js +65 -0
  29. package/dist/chunk-KOEGJCIS.js.map +1 -0
  30. package/dist/{chunk-HW7KSM2Y.js → chunk-KUHXPPJ4.js} +1 -1
  31. package/dist/chunk-KUHXPPJ4.js.map +1 -0
  32. package/dist/{chunk-UZJ6I4T6.js → chunk-MK42GLPV.js} +1 -1
  33. package/dist/chunk-MK42GLPV.js.map +1 -0
  34. package/dist/chunk-N4VHHOCM.js +27 -0
  35. package/dist/chunk-N4VHHOCM.js.map +1 -0
  36. package/dist/{chunk-V46JKE44.js → chunk-NRPLVJVR.js} +43 -14
  37. package/dist/chunk-NRPLVJVR.js.map +1 -0
  38. package/dist/{chunk-LVH3GC6B.js → chunk-QOAB2ESQ.js} +3 -3
  39. package/dist/chunk-QOAB2ESQ.js.map +1 -0
  40. package/dist/{chunk-KZJXHFIB.js → chunk-V322Z7FX.js} +5 -5
  41. package/dist/chunk-V322Z7FX.js.map +1 -0
  42. package/dist/{delegate-CL9VTZFb.d.ts → delegate--CrfgYtC.d.ts} +0 -34
  43. package/dist/dev.d.ts +46 -15
  44. package/dist/dev.js +185 -40
  45. package/dist/dev.js.map +1 -1
  46. package/dist/html.js +20 -8
  47. package/dist/html.js.map +1 -1
  48. package/dist/index.d.ts +98 -13
  49. package/dist/index.js +49 -21
  50. package/dist/index.js.map +1 -1
  51. package/dist/jsx-runtime.d.ts +25 -10
  52. package/dist/jsx-runtime.js +1 -1
  53. package/dist/list.d.ts +7 -3
  54. package/dist/list.js +236 -78
  55. package/dist/list.js.map +1 -1
  56. package/dist/overlay.d.ts +287 -142
  57. package/dist/overlay.js +1040 -369
  58. package/dist/overlay.js.map +1 -1
  59. package/dist/remount.js +2 -2
  60. package/dist/remount.js.map +1 -1
  61. package/dist/router.d.ts +22 -6
  62. package/dist/router.js +58 -19
  63. package/dist/router.js.map +1 -1
  64. package/dist/scope.d.ts +45 -8
  65. package/dist/scope.js +69 -30
  66. package/dist/scope.js.map +1 -1
  67. package/dist/testing.js +1 -1
  68. package/dist/timing.d.ts +17 -7
  69. package/dist/timing.js +8 -3
  70. package/dist/timing.js.map +1 -1
  71. package/llms.txt +17 -6
  72. package/package.json +48 -12
  73. package/setup/apply.mjs +202 -0
  74. package/setup/cli.mjs +95 -0
  75. package/setup/common.mjs +91 -0
  76. package/setup/detect.mjs +274 -0
  77. package/setup/index.d.mts +39 -0
  78. package/setup/index.mjs +1290 -0
  79. package/setup/jsonc.mjs +201 -0
  80. package/setup/state.schema.json +57 -0
  81. package/setup/ui-baseline.mjs +210 -0
  82. package/dist/chunk-GY4XV2UV.js.map +0 -1
  83. package/dist/chunk-HW7KSM2Y.js.map +0 -1
  84. package/dist/chunk-KPXIOG2C.js +0 -54
  85. package/dist/chunk-KPXIOG2C.js.map +0 -1
  86. package/dist/chunk-KZJXHFIB.js.map +0 -1
  87. package/dist/chunk-LVH3GC6B.js.map +0 -1
  88. package/dist/chunk-QIP723L4.js.map +0 -1
  89. package/dist/chunk-SVATPF5R.js.map +0 -1
  90. package/dist/chunk-U6FK33SG.js +0 -20
  91. package/dist/chunk-U6FK33SG.js.map +0 -1
  92. package/dist/chunk-UZJ6I4T6.js.map +0 -1
  93. package/dist/chunk-V46JKE44.js.map +0 -1
  94. package/dist/chunk-ZDCJZCNO.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/store.ts"],"names":[],"mappings":";;;;AAyCA,IAAM,WAAyC,EAAC;AAEzC,SAAS,YACd,IAAA,EACyB;AACzB,EAAA,MAAM,QAAA,GAA2B,MAAA,CAAO,IAAA,CAAK,OAAA,EAAS,CAAA;AAOtD,EAAA,IAAI,OAAA,GAAkC,IAAA;AAEtC,EAAA,MAAM,GAAA,GAAM,CAAC,IAAA,KAAuB;AAMlC,IAAA,MAAM,QAAQ,QAAA,CAAS,UAAA;AACvB,IAAA,MAAM,GAAA,GAAM,KAAA,GAAQ,KAAA,CAAM,IAAI,CAAA,GAAI,IAAA;AAClC,IAAA,MAAM,YAAY,QAAA,CAAS,SAAA;AAC3B,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,OAAA,KAAY,EAAE,QAAQ,KAAA,EAAM;AAC5B,MAAA,SAAA,CAAU,QAAA,CAAS,IAAA,EAAK,EAAG,GAAA,EAAK,OAAO,CAAA;AAAA,IACzC;AACA,IAAA,QAAA,CAAS,KAAA,GAAQ,GAAA;AAAA,EACnB,CAAA;AAaA,EAAA,MAAM,MAAM,MAAwB;AAClC,IAAA,MAAM,CAAA,GAAI,SAAS,IAAA,EAAK;AACxB,IAAA,MAAM,WAAW,QAAA,CAAS,aAAA;AAC1B,IAAA,IAAI,QAAA,IAAY,CAAA,KAAM,IAAA,IAAQ,OAAO,MAAM,QAAA,EAAU;AACnD,MAAA,OAAO,SAAS,CAAoB,CAAA;AAAA,IACtC;AACA,IAAA,OAAO,CAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,GAAG,CAAA;AAErC,EAAA,MAAM,KAAA,GAAiC;AAAA,IACrC,KAAA,EAAO,QAAA;AAAA,IACP,OAAA;AAAA,IACA,KAAA,GAAQ;AACN,MAAA,QAAA,CAAS,KAAA,GAAQ,KAAK,OAAA,EAAQ;AAAA,IAChC;AAAA,GACF;AAEA,EAAA,QAAA,CAAS,KAAK,KAAK,CAAA;AACnB,EAAA,OAAO,KAAA;AACT;AAOO,SAAS,cAAA,GAAuB;AACrC,EAAA,KAAA,MAAW,CAAA,IAAK,QAAA,EAAU,CAAA,CAAE,KAAA,EAAM;AACpC;AAMO,SAAS,kBAAA,GAA2B;AACzC,EAAA,QAAA,CAAS,MAAA,GAAS,CAAA;AACpB","file":"chunk-V322Z7FX.js","sourcesContent":["/**\n * `defineStore({ initial, actions })` — composable testable stores layered on\n * top of `reactive.ts`'s signals.\n *\n * Three rules:\n * 1. `state` is read-only. Consumers read via `state.value` or subscribe via\n * `effect()`. They cannot write directly.\n * 2. `actions` is the only mutation surface. All writes go through named\n * action functions. This is what makes stores testable — assert against\n * actions, not against arbitrary writes.\n * 3. `reset()` resets to `initial()`. Always defined; tests use it for\n * setup, lifecycle hooks (route change, sign-out, etc.) use it for\n * tear-down.\n *\n * A module-level registry tracks every store created via `defineStore()`;\n * `resetAllStores()` walks the registry and calls each `reset()`. Useful for\n * tests + project-switch / logout / route-reset scenarios where every piece\n * of client state should return to its initial shape.\n */\n\nimport { devHooks, type WarnOnceContext } from './dev-hooks.js';\nimport type { ReadonlySignal, Signal } from './reactive.js';\nimport { signal } from './reactive.js';\n\nexport interface Store<TState, TActions> {\n /** Read-only reactive view. Consumers read `state.value` or subscribe via `effect()`. */\n readonly state: ReadonlySignal<TState>;\n /** Named mutators — the only way to change state. */\n readonly actions: TActions;\n /** Reset state to `initial()`. Used by tests and lifecycle hooks. */\n reset(): void;\n}\n\ninterface DefineStoreSpec<TState, TActions> {\n initial: () => TState;\n actions: (\n set: (next: TState) => void,\n get: () => Readonly<TState>,\n ) => TActions;\n}\n\nconst REGISTRY: Array<{ reset: () => void }> = [];\n\nexport function defineStore<TState, TActions>(\n spec: DefineStoreSpec<TState, TActions>,\n): Store<TState, TActions> {\n const internal: Signal<TState> = signal(spec.initial());\n // KF-212: per-store one-shot dedup for the opt-in narrow-set warning.\n // Default off; consumers opt in via `KERF_DEV_WARN_NARROW_SET=1` in dev.\n // Resolve the hook on each set(), so a store created before `kerfjs/dev` is\n // installed starts warning as soon as the diagnostics become available.\n // Allocate the context lazily — production never pays for an object it will\n // never read.\n let warnCtx: WarnOnceContext | null = null;\n\n const set = (next: TState): void => {\n // With `kerfjs/dev` installed, `next` may carry proxies handed back by the\n // `get()` trap (e.g. `set({ ...get(), count: 1 })`). Unwrap them so the\n // internal signal only ever holds a plain object — the narrow-set warning\n // and every consumer read see raw state, never a Proxy. Production stores\n // the bare reference.\n const toRaw = devHooks.storeToRaw;\n const raw = toRaw ? toRaw(next) : next;\n const narrowSet = devHooks.narrowSet;\n if (narrowSet) {\n warnCtx ??= { warned: false };\n narrowSet(internal.peek(), raw, warnCtx);\n }\n internal.value = raw;\n };\n // With the diagnostics installed, wrap the reference returned to actions in a\n // deep read-only Proxy so that `get().count = 42` / `get().nested.x = 1`\n // (documented Rule 8 violations) throw a `TypeError` instead of silently\n // landing on the underlying state without notifying subscribers. The live\n // state object is never frozen or mutated, so external references to it stay\n // writable. Production returns the bare reference — no proxy, no wrapping.\n //\n // The read is UNTRACKED (`peek()`, KF-1268ZK): `get()` exists for actions,\n // and an action called from inside an `effect()` or a `mount()` render must\n // not subscribe that caller to the store the action writes — otherwise the\n // write re-runs the caller (a re-run loop, or a signals-core \"Cycle\n // detected\" error). Consumers that want to subscribe read `state.value`.\n const get = (): Readonly<TState> => {\n const v = internal.peek();\n const readonly = devHooks.storeReadonly;\n if (readonly && v !== null && typeof v === 'object') {\n return readonly(v as TState & object);\n }\n return v;\n };\n\n const actions = spec.actions(set, get);\n\n const store: Store<TState, TActions> = {\n state: internal,\n actions,\n reset() {\n internal.value = spec.initial();\n },\n };\n\n REGISTRY.push(store);\n return store;\n}\n\n/**\n * Reset every store registered via `defineStore()` to its `initial()` value.\n * Used by tests and by application lifecycle hooks (project switch, logout,\n * route reset).\n */\nexport function resetAllStores(): void {\n for (const s of REGISTRY) s.reset();\n}\n\n/**\n * Test helper — clears the registry. Exposed via the `kerfjs/testing` subpath,\n * not the main `kerfjs` entry. Unit tests use it to isolate stores between cases.\n */\nexport function clearStoreRegistry(): void {\n REGISTRY.length = 0;\n}\n"]}
@@ -1,37 +1,3 @@
1
- /**
2
- * Tiny event-delegation helpers. Replace per-element `addEventListener` calls
3
- * (which don't survive morph re-renders for nodes the diff creates) with one
4
- * listener at the morph-root that dispatches via `closest()`.
5
- *
6
- * Three-tier listener model:
7
- *
8
- * - Tier 1 (bubbling events) — use `delegate()`.
9
- * click, input, change, submit, mousedown/up, keydown/up, pointerdown/up/move,
10
- * drag*, drop, contextmenu, wheel, copy/paste/cut, focusin/focusout.
11
- *
12
- * `delegate()` also auto-promotes the well-known non-bubbling event
13
- * types (`focus`, `blur`, `scroll`, `load`, `error`, `mouseenter`,
14
- * `mouseleave`) to the capture phase under the hood, so the call site
15
- * looks identical for "interactive thing happens on a descendant"
16
- * regardless of whether that event bubbles. Selector matching stays
17
- * `closest()`-style — the same as for bubbling events — so a wrapper
18
- * selector like `'.field-row'` still matches when the event fires on
19
- * a descendant `<input>`.
20
- *
21
- * - Tier 2 (explicit capture) — use `delegateCapture()`.
22
- * The escape hatch for cases the auto-promotion list doesn't cover
23
- * (custom non-bubbling events) or when you want capture-phase
24
- * interception. Selector matching is `closest()`-style by default —
25
- * the same walk-up as `delegate()`, and it passes the matched ancestor
26
- * (not the raw target) to the handler — so a click on any descendant of
27
- * the selected element climbs to it. Pass `{ match: 'direct' }` to opt
28
- * into strict `matches()`-style matching (fire only when the event lands
29
- * on the exact element the selector identifies).
30
- *
31
- * - Tier 3 (per-element instances / library-owned subtrees) — mark the
32
- * host element with `data-morph-skip` and manage the library's
33
- * lifecycle directly. No delegation helper applies.
34
- */
35
1
  /**
36
2
  * How the selector is matched against the event's target:
37
3
  *
package/dist/dev.d.ts CHANGED
@@ -137,15 +137,30 @@ interface DevHooks {
137
137
  signalFactory?: <T>(value: T) => Signal<T>;
138
138
  /**
139
139
  * Wraps an `effect()` body so `delegate()` can detect that it is running
140
- * inside one. Returns the body to actually run.
140
+ * inside one. Returns the body to actually run. Resolved at effect-CREATION
141
+ * time (the delegate-in-effect switch too), so an effect created before the
142
+ * install or the opt-in is never wrapped.
141
143
  */
142
144
  wrapEffect?: (fn: () => void | (() => void)) => () => void | (() => void);
145
+ /**
146
+ * Wraps a `computed()` body so the selector fan-out warning can count
147
+ * re-evaluations and value changes. Returns the body to actually run.
148
+ * Resolved at computed-CREATION time (the `selectorFanout` switch too), so
149
+ * a computed created before the install or the opt-in is never counted.
150
+ */
151
+ wrapComputed?: <T>(fn: () => T) => () => T;
143
152
  delegateInEffect?: (fn: 'delegate' | 'delegateCapture') => void;
144
153
  narrowSet?: (prev: unknown, next: unknown, ctx: WarnOnceContext) => void;
145
154
  /** Deep read-only proxy for the `get()` snapshot, so stray writes throw. */
146
155
  storeReadonly?: <T extends object>(state: T) => T;
147
156
  /** Unwraps a proxy handed back through `set({ ...get() })`. */
148
157
  storeToRaw?: <T>(next: T) => T;
158
+ /**
159
+ * Attaches the rebuilt-listeners observer to a mount root. Called once per
160
+ * `mount()`, at creation — and it returns `null` when the warning is switched
161
+ * off then — so a mount created before the install or the opt-in is never
162
+ * observed.
163
+ */
149
164
  listenerRebuild?: (rootEl: Element) => MutationObserver | null;
150
165
  listIdShift?: (id: string) => void;
151
166
  parserRepair?: (html: string) => void;
@@ -164,6 +179,8 @@ interface DevHooks {
164
179
  duplicateCacheKeys?: (id: string, segItems: readonly {
165
180
  cacheKey: unknown;
166
181
  }[]) => void;
182
+ /** A surface opened over a modal `<dialog>` could not be made fully usable. */
183
+ overlayBlockedByModal?: (reason: 'hidden' | 'inert') => void;
167
184
  /**
168
185
  * When installed, a screened URL throws instead of warning-and-dropping.
169
186
  * A slot rather than a boolean so the check stays uniform with the rest.
@@ -255,6 +272,8 @@ interface DevWarningOptions {
255
272
  staleIndex?: boolean;
256
273
  /** Markup the HTML parser repaired (a block element inside a `<p>`). */
257
274
  parserRepair?: boolean;
275
+ /** One signal write re-evaluating many computeds that almost all stay equal. */
276
+ selectorFanout?: boolean;
258
277
  /** Structural audit of kerf's list bookkeeping: warn, or `'throw'`. */
259
278
  invariants?: boolean | 'throw';
260
279
  }
@@ -282,17 +301,26 @@ interface DevWarningOptions {
282
301
  *
283
302
  * ## Install ordering
284
303
  *
285
- * Every hook except one is read at CALL time (render, reconcile, `set()`,
286
- * `delegate()`), so installing any time before your first `mount()` is enough.
287
- *
288
- * The exception is `signalFactory`: `signal()` picks its constructor when the
289
- * signal is CREATED. Static imports are hoisted above a top-level
290
- * `await import()`, so module-scope signals in imported modules are created
291
- * before this module runs and the untracked-signal warning will not see them.
292
- * To cover those, make `import 'kerfjs/dev'` the FIRST STATIC import of a
293
- * dev-only entry file, then load the rest of your app.
294
- *
295
- * Opting into that warning prints this boundary once, so the gap is loud
304
+ * Most hooks are read at CALL time (render, reconcile, `set()`, `delegate()`).
305
+ * Four are decided once, when their host is CREATED, so both installation and
306
+ * the warning's switch must precede it:
307
+ *
308
+ * - `signalFactory` — `signal()` picks its constructor (untracked signals,
309
+ * and the write side of the selector fan-out warning).
310
+ * - `wrapComputed` — `computed()` decides whether to count its
311
+ * re-evaluations (selector fan-out).
312
+ * - `wrapEffect` — `effect()` decides whether to wrap its body with the
313
+ * effect-depth counter (delegate-in-effect).
314
+ * - `listenerRebuild` — `mount()` decides whether to attach its
315
+ * rebuilt-listeners `MutationObserver`.
316
+ *
317
+ * Static imports are hoisted above a top-level `await import()`, so
318
+ * module-scope signals and effects in imported modules are created before this
319
+ * module runs. To cover those, make `import 'kerfjs/dev'` the FIRST STATIC
320
+ * import of a dev-only entry file (calling `enableWarnings()` there), then load
321
+ * the rest of your app.
322
+ *
323
+ * Opting into the untracked-signal warning prints its boundary once, so the gap is loud
296
324
  * rather than silent. It cannot be closed by retro-fitting existing signals:
297
325
  * `Signal.prototype`'s `value` accessor is non-configurable, and reaching live
298
326
  * instances would require a per-signal registry that production would pay for.
@@ -326,9 +354,12 @@ interface DevWarningOptions {
326
354
  * goes through `globalThis.process` into a local binding), so the environment
327
355
  * variables are unreachable there.
328
356
  *
329
- * Call it as early as you can. Every diagnostic reads its switch at call time
330
- * except the untracked-signal warning, which is chosen when a signal is
331
- * CREATED — enabling that one prints its coverage boundary once.
357
+ * Call it as early as you can. Most diagnostics read their switch at call
358
+ * time, but four are decided when their host is CREATED: `untrackedSignals`
359
+ * per `signal()`, `delegateInEffect` per `effect()`, `rebuiltListeners` per
360
+ * `mount()`, and `selectorFanout` per `signal()` and per `computed()`. A
361
+ * signal, computed, effect, or mount created before this call stays
362
+ * uncovered. Enabling `untrackedSignals` prints its coverage boundary once.
332
363
  */
333
364
  declare function enableWarnings(options: DevWarningOptions): void;
334
365
  /**
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-NRPLVJVR.js';
2
+ import { LIST_MARKER_PREFIX, OVERLAY_HOST_SELECTOR, isOverlayHost } from './chunk-4TX6YJDM.js';
3
+ import { installDevHooks } from './chunk-KUHXPPJ4.js';
4
+ export { clearDevHooks, devHooks, installDevHooks } from './chunk-KUHXPPJ4.js';
5
5
  import { signal, Signal } from '@preact/signals-core';
6
6
 
7
7
  // src/dev-warn-config.ts
@@ -17,6 +17,7 @@ var ENV_NAME = {
17
17
  listRebind: "KERF_DEV_WARN_LIST_REBIND",
18
18
  staleIndex: "KERF_DEV_WARN_STALE_INDEX",
19
19
  parserRepair: "KERF_DEV_WARN_PARSER_REPAIR",
20
+ selectorFanout: "KERF_DEV_WARN_SELECTOR_FANOUT",
20
21
  invariants: "KERF_DEV_INVARIANTS"
21
22
  };
22
23
  var overrides = /* @__PURE__ */ new Map();
@@ -24,7 +25,10 @@ function applyWarningOptions(options) {
24
25
  for (const [key, value] of Object.entries(options)) {
25
26
  const envName = ENV_NAME[key];
26
27
  if (envName === void 0 || value === void 0) continue;
27
- overrides.set(envName, value === false ? false : value === true ? "1" : value);
28
+ overrides.set(
29
+ envName,
30
+ value === false ? false : value === true ? "1" : value
31
+ );
28
32
  }
29
33
  }
30
34
  function devFlag(envName) {
@@ -33,6 +37,9 @@ function devFlag(envName) {
33
37
  const proc = globalThis.process;
34
38
  return proc?.env?.[envName];
35
39
  }
40
+ function silenceHint(key) {
41
+ return `Silence it with enableWarnings({ ${key}: false }) from kerfjs/dev, or set ${ENV_NAME[key]}=0 (or unset it) under Node.`;
42
+ }
36
43
 
37
44
  // src/dev-binding-warn.ts
38
45
  var warnedHoles = /* @__PURE__ */ new Set();
@@ -51,7 +58,7 @@ function maybeWarnStaleBinding(prevWired, current) {
51
58
  if (warnedHoles.has(cur.id)) continue;
52
59
  warnedHoles.add(cur.id);
53
60
  console.warn(
54
- `kerf: fine-grained binding ${describeHole(cur)} switched to a different signal instance on a render whose static-surrounds HTML was byte-for-byte unchanged. On that fast path kerf keeps the original binding effect and does NOT re-bind, so this hole is now stale \u2014 it still tracks the FIRST signal instance and will not reflect the new one. Bind one computed that switches internally (e.g. class={computed(() => cond.value ? sigA.value : sigB.value)}) instead of switching which signal instance you bind (see docs/2-reactivity \xA72.9). Set KERF_DEV_WARN_STALE_BINDING=0 (or unset it) to silence this warning.`
61
+ `kerf: fine-grained binding ${describeHole(cur)} switched to a different signal instance on a render whose static-surrounds HTML was byte-for-byte unchanged. On that fast path kerf keeps the original binding effect and does NOT re-bind, so this hole is now stale \u2014 it still tracks the FIRST signal instance and will not reflect the new one. Bind one computed that switches internally (e.g. class={computed(() => cond.value ? sigA.value : sigB.value)}) instead of switching which signal instance you bind (see docs/2-reactivity \xA72.9). ` + silenceHint("staleBinding")
55
62
  );
56
63
  }
57
64
  }
@@ -77,7 +84,7 @@ function warnIfInsideEffect(fn) {
77
84
  if (warned) return;
78
85
  warned = true;
79
86
  console.warn(
80
- `kerf: ${fn}() was called inside an effect() body. Every effect re-run installs a fresh root listener; the effect disposer cleans up the reactive subscription but not the listeners, so listener count grows linearly with signal churn and each listener pins its handler closure. Register the delegate once at module or setup scope and gate behavior on the signal *inside the handler* where the read is free. See docs/5-event-delegation.md \xA75.3 "When capturing the disposer still isn't enough". Set KERF_DEV_WARN_DELEGATE_IN_EFFECT=0 (or unset it) to silence this warning.`
87
+ `kerf: ${fn}() was called inside an effect() body. Every effect re-run installs a fresh root listener; the effect disposer cleans up the reactive subscription but not the listeners, so listener count grows linearly with signal churn and each listener pins its handler closure. Register the delegate once at module or setup scope and gate behavior on the signal *inside the handler* where the read is free. See docs/5-event-delegation.md \xA75.3 "When capturing the disposer still isn't enough". ` + silenceHint("delegateInEffect")
81
88
  );
82
89
  }
83
90
 
@@ -100,7 +107,7 @@ function maybeWarnEachInMorphSkip(id, liveParent, rootEl) {
100
107
  if (!hasMorphSkipAncestor(liveParent, rootEl)) return;
101
108
  warnedIds.add(id);
102
109
  console.warn(
103
- `kerf: each() list '${id}' is inside a data-morph-skip subtree. The keyed reconciler still updates the list rows, but any static signal-reactive JSX inside the same skipped ancestor (e.g. <p>{count.value}</p>) is frozen \u2014 the morph never visits it. Remove data-morph-skip from any element that contains reactive JSX content and reserve it for truly library-owned hosts. Set KERF_DEV_WARN_EACH_IN_MORPH_SKIP=0 (or unset it) to silence this warning.`
110
+ `kerf: each() list '${id}' is inside a data-morph-skip subtree. The keyed reconciler still updates the list rows, but any static signal-reactive JSX inside the same skipped ancestor (e.g. <p>{count.value}</p>) is frozen \u2014 the morph never visits it. Remove data-morph-skip from any element that contains reactive JSX content and reserve it for truly library-owned hosts. ` + silenceHint("eachInMorphSkip")
104
111
  );
105
112
  }
106
113
  var warnedDupIds = /* @__PURE__ */ new Set();
@@ -115,7 +122,7 @@ function maybeWarnDuplicateCacheKeys(id, segItems) {
115
122
  if (seen.has(si.cacheKey)) {
116
123
  warnedDupIds.add(id);
117
124
  console.warn(
118
- `kerf: each() list '${id}' has duplicate cacheKey values (duplicate: ${String(si.cacheKey)}). The cacheKey function should return a unique value per row so kerf can tell apart items for memoization \u2014 duplicate values cause some rows to return stale cached HTML when external state that affects their render changes. Set KERF_DEV_WARN_DUPLICATE_EACH_KEYS=0 (or unset it) to silence this warning.`
125
+ `kerf: each() list '${id}' has duplicate cacheKey values (duplicate: ${String(si.cacheKey)}). The cacheKey function should return a unique value per row so kerf can tell apart items for memoization \u2014 duplicate values cause some rows to return stale cached HTML when external state that affects their render changes. ` + silenceHint("duplicateEachKeys")
119
126
  );
120
127
  return;
121
128
  }
@@ -157,18 +164,38 @@ function findListInvariantViolations(rootEl, bindings, expectedCounts) {
157
164
  const { marker, liveParent, items } = binding;
158
165
  const expected = expectedCounts?.get(id);
159
166
  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`));
167
+ problems.push(
168
+ describe(
169
+ id,
170
+ `holds ${items.length} row(s) but its source has ${expected} \u2014 the reconcile dropped or duplicated rows`
171
+ )
172
+ );
161
173
  }
162
174
  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"));
175
+ problems.push(
176
+ describe(
177
+ id,
178
+ "its marker comment is no longer inside the mount root, so every future reconcile would mutate a detached tree"
179
+ )
180
+ );
164
181
  continue;
165
182
  }
166
183
  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`));
184
+ problems.push(
185
+ describe(
186
+ id,
187
+ `its marker reads '${marker.data}' \u2014 the id is carried by a different marker node, so this binding describes another list`
188
+ )
189
+ );
168
190
  }
169
191
  const markerIndex = indexIn(liveParent, marker);
170
192
  if (markerIndex === -1) {
171
- problems.push(describe(id, "its marker is not a child of the parent the binding records"));
193
+ problems.push(
194
+ describe(
195
+ id,
196
+ "its marker is not a child of the parent the binding records"
197
+ )
198
+ );
172
199
  continue;
173
200
  }
174
201
  let previousIndex = markerIndex;
@@ -177,28 +204,46 @@ function findListInvariantViolations(rootEl, bindings, expectedCounts) {
177
204
  const node = items[i].node;
178
205
  const index = indexIn(liveParent, node);
179
206
  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"}`));
207
+ problems.push(
208
+ describe(
209
+ id,
210
+ `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"}`
211
+ )
212
+ );
181
213
  continue;
182
214
  }
183
215
  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`));
216
+ problems.push(
217
+ describe(
218
+ id,
219
+ `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`
220
+ )
221
+ );
185
222
  }
186
223
  previousIndex = index;
187
224
  if (first === -1) first = index;
188
225
  const owner = owners.get(node);
189
226
  if (owner !== void 0) {
190
- problems.push(describe(id, `bound row ${i} is also claimed by list '${owner}'`));
227
+ problems.push(
228
+ describe(id, `bound row ${i} is also claimed by list '${owner}'`)
229
+ );
191
230
  } else {
192
231
  owners.set(node, id);
193
232
  }
194
233
  }
195
- if (first !== -1) spans.push({ id, parent: liveParent, from: first, to: previousIndex });
234
+ if (first !== -1)
235
+ spans.push({ id, parent: liveParent, from: first, to: previousIndex });
196
236
  }
197
237
  for (let a = 0; a < spans.length; a++) {
198
238
  for (let b = a + 1; b < spans.length; b++) {
199
239
  if (spans[a].parent !== spans[b].parent) continue;
200
240
  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`));
241
+ problems.push(
242
+ describe(
243
+ spans[a].id,
244
+ `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`
245
+ )
246
+ );
202
247
  }
203
248
  }
204
249
  }
@@ -207,7 +252,11 @@ function findListInvariantViolations(rootEl, bindings, expectedCounts) {
207
252
  function maybeCheckListInvariants(rootEl, bindings, expectedCounts) {
208
253
  const level = mode();
209
254
  if (level === "off") return;
210
- const problems = findListInvariantViolations(rootEl, bindings, expectedCounts);
255
+ const problems = findListInvariantViolations(
256
+ rootEl,
257
+ bindings,
258
+ expectedCounts
259
+ );
211
260
  if (problems.length === 0) return;
212
261
  const report = `${problems.join("\n")}
213
262
  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.`;
@@ -224,7 +273,7 @@ function maybeWarnStaleIndex(id) {
224
273
  if (warnedIds2.has(id)) return;
225
274
  warnedIds2.add(id);
226
275
  console.warn(
227
- `kerf: each() list '${id}' reused a memoized row at a new index this render, but its render function takes an \`index\` argument. Rows are memoized by object identity, not by position, so a reorder or an insert/remove ahead of a surviving row serves that row's cached HTML \u2014 computed at its OLD index. A numbered list, zebra striping, or an "N of M" label will silently show the wrong value. If the row output depends on the index, fold it into the memo key: each(items, render, { cacheKey: (_, i) => i }) (combine with your own key if you have one). If the index is not used in the output, ignore this. Set KERF_DEV_WARN_STALE_INDEX=0 (or unset it) to silence this warning.`
276
+ `kerf: each() list '${id}' reused a memoized row at a new index this render, but its render function takes an \`index\` argument. Rows are memoized by object identity, not by position, so a reorder or an insert/remove ahead of a surviving row serves that row's cached HTML \u2014 computed at its OLD index. A numbered list, zebra striping, or an "N of M" label will silently show the wrong value. If the row output depends on the index, fold it into the memo key: each(items, render, { cacheKey: (_, i) => i }) (combine with your own key if you have one). If the index is not used in the output, ignore this. ` + silenceHint("staleIndex")
228
277
  );
229
278
  }
230
279
 
@@ -245,14 +294,13 @@ function maybeWarnListRebind(id, liveParent) {
245
294
  if (warnedIds3.has(id)) return;
246
295
  warnedIds3.add(id);
247
296
  console.warn(
248
- `kerf: each() list '${id}' had its container (<${liveParent.tagName.toLowerCase()}>) rebuilt by the morph this render \u2014 an ancestor's tag changed so the subtree was replaced, or a same-tag sibling positionally took the container's place. The list re-binds and repopulates automatically, but its rows were re-created from scratch: focus, scroll positions, in-progress IME composition, and any imperative listeners on the old row nodes are lost. If the rows should survive, give the LIST'S OWN container a stable id/data-key (keying the conditional sibling instead only helps when it is removed, not when it reappears) and keep the tags of the list's ancestors stable across renders. Set KERF_DEV_WARN_LIST_REBIND=0 (or unset it) to silence this warning.`
297
+ `kerf: each() list '${id}' had its container (<${liveParent.tagName.toLowerCase()}>) rebuilt by the morph this render \u2014 an ancestor's tag changed so the subtree was replaced, or a same-tag sibling positionally took the container's place. The list re-binds and repopulates automatically, but its rows were re-created from scratch: focus, scroll positions, in-progress IME composition, and any imperative listeners on the old row nodes are lost. If the rows should survive, give the LIST'S OWN container a stable id/data-key (keying the conditional sibling instead only helps when it is removed, not when it reappears) and keep the tags of the list's ancestors stable across renders. ` + silenceHint("listRebind")
249
298
  );
250
299
  }
251
300
 
252
301
  // src/dev-listener-warn.ts
253
302
  var LISTENER_MARKER = /* @__PURE__ */ Symbol.for("kerfjs.devListener");
254
303
  var patched = false;
255
- var warned2 = false;
256
304
  function isOptedIn5() {
257
305
  return devFlag("KERF_DEV_WARN_REBUILT_LISTENERS") === "1";
258
306
  }
@@ -277,33 +325,38 @@ function patchAddEventListenerOnce() {
277
325
  };
278
326
  }
279
327
  function hasMarkedListener(el) {
280
- if (el[LISTENER_MARKER] === true) return true;
281
- const stack = [];
282
- for (let i = 0; i < el.children.length; i++) stack.push(el.children[i]);
328
+ const stack = [el];
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;
333
+ if (isOverlayHost(cur)) continue;
286
334
  for (let i = 0; i < cur.children.length; i++) stack.push(cur.children[i]);
287
335
  }
288
336
  return false;
289
337
  }
338
+ function insideHostSlot(target, rootEl) {
339
+ const host = target.closest(OVERLAY_HOST_SELECTOR);
340
+ return host !== null && host !== rootEl && rootEl.contains(host);
341
+ }
290
342
  function emitWarning() {
291
- if (warned2) return;
292
- warned2 = true;
293
343
  console.warn(
294
- "kerf: a node inside a mount()-managed tree was removed/rebuilt while carrying an imperative addEventListener listener. The listener is gone with the old node. Use `delegate(rootEl, 'click', '[data-action=\"...\"]', handler)` so the listener lives on a stable ancestor and survives re-renders, or wrap the host in `data-morph-skip` if the subtree is library-owned (Monaco, xterm, D3 charts). Set KERF_DEV_WARN_REBUILT_LISTENERS=0 (or unset it) to silence this warning."
344
+ "kerf: a node inside a mount()-managed tree was removed/rebuilt while carrying an imperative addEventListener listener. The listener is gone with the old node. Use `delegate(rootEl, 'click', '[data-action=\"...\"]', handler)` so the listener lives on a stable ancestor and survives re-renders, or wrap the host in `data-morph-skip` if the subtree is library-owned (Monaco, xterm, D3 charts). " + silenceHint("rebuiltListeners")
295
345
  );
296
346
  }
297
347
  function installListenerRebuildWarn(rootEl) {
298
348
  if (!isOptedIn5()) return null;
299
349
  patchAddEventListenerOnce();
350
+ let warned3 = false;
300
351
  const observer = new MutationObserver((mutations) => {
301
- if (warned2) return;
352
+ if (warned3) return;
302
353
  for (const m of mutations) {
354
+ if (insideHostSlot(m.target, rootEl)) continue;
303
355
  for (let i = 0; i < m.removedNodes.length; i++) {
304
356
  const removed = m.removedNodes[i];
305
357
  if (!(removed instanceof Element)) continue;
306
358
  if (hasMarkedListener(removed)) {
359
+ warned3 = true;
307
360
  emitWarning();
308
361
  return;
309
362
  }
@@ -314,6 +367,18 @@ function installListenerRebuildWarn(rootEl) {
314
367
  return observer;
315
368
  }
316
369
 
370
+ // src/dev-overlay-warn.ts
371
+ var warned2 = /* @__PURE__ */ new Set();
372
+ var MESSAGES = {
373
+ hidden: "kerf overlay(): a surface was opened while a modal <dialog> is open, and this engine lacks the <dialog>.showModal() / Popover API needed to lift it into the top layer. It renders beneath the dialog and is inert, so the user can neither see nor use it. Render the content inside the dialog's own markup, or open the dialog without `native: true`.",
374
+ inert: "kerf overlay(): a non-modal surface opened while a modal <dialog> is open was lifted into the top layer so it is visible, but browsers keep everything outside a modal dialog inert \u2014 its focusable controls cannot be focused or clicked. Anchor the popover inside the dialog and give the dialog a `data-kerf-overlay-host` element (dialogs kerf opens get one automatically), or pass a `container` inside the dialog."
375
+ };
376
+ function maybeWarnOverlayBlockedByModal(reason) {
377
+ if (warned2.has(reason)) return;
378
+ warned2.add(reason);
379
+ console.warn(MESSAGES[reason]);
380
+ }
381
+
317
382
  // src/dev-parser-repair-warn.ts
318
383
  var BLOCK_TAGS = [
319
384
  "address",
@@ -378,7 +443,7 @@ function maybeWarnParserRepair(html) {
378
443
  if (warnedPairs.has(pair)) return;
379
444
  warnedPairs.add(pair);
380
445
  console.warn(
381
- `kerf: a <${tag}> inside a <p> will not survive parsing. <p> may contain only phrasing content, so the HTML parser closes it before a block-level child \u2014 your <p> ends up EMPTY and the <${tag}> (plus everything after it) becomes its sibling instead of its child. kerf then reconciles that repaired tree correctly, so updates still work; what you lose is the structure you wrote, along with any CSS or querySelector that assumed it. Use a <div> (or a phrasing element like <span>) in place of the <p>, or move the block content outside it. Set KERF_DEV_WARN_PARSER_REPAIR=0 (or unset it) to silence this warning.`
446
+ `kerf: a <${tag}> inside a <p> will not survive parsing. <p> may contain only phrasing content, so the HTML parser closes it before a block-level child \u2014 your <p> ends up EMPTY and the <${tag}> (plus everything after it) becomes its sibling instead of its child. kerf then reconciles that repaired tree correctly, so updates still work; what you lose is the structure you wrote, along with any CSS or querySelector that assumed it. Use a <div> (or a phrasing element like <span>) in place of the <p>, or move the block content outside it. ` + silenceHint("parserRepair")
382
447
  );
383
448
  }
384
449
 
@@ -402,8 +467,8 @@ function _isValueOnlyDiff(a, b) {
402
467
  if (!_isValueOnlyDiff(x, y)) return false;
403
468
  } else if (x.nodeType === COMMENT_NODE) {
404
469
  if (x.data !== y.data) return false;
405
- } else if (x.nodeType !== TEXT_NODE) {
406
- return false;
470
+ } else {
471
+ if (x.nodeType !== TEXT_NODE) return false;
407
472
  }
408
473
  }
409
474
  return true;
@@ -417,7 +482,7 @@ function maybeWarnValueOnlyRerender(prevHtml, nextHtml, ctx) {
417
482
  if (!_isValueOnlyDiff(a.content, b.content)) return;
418
483
  ctx.warned = true;
419
484
  console.warn(
420
- "kerf: this re-render changed only text content and attribute values \u2014 no structural change \u2014 so every changed hole could be a fine-grained binding instead. Values bind, structure re-renders: pass the signal/computed itself ({count}, class={sig}) rather than reading .value in the hole, and each change updates just that node with no render re-run (a mount whose render reads no .value never re-renders at all). See docs/2-reactivity \xA72.9. Set KERF_DEV_WARN_VALUE_ONLY_RERENDER=0 (or unset it) to silence this warning."
485
+ "kerf: this re-render changed only text content and attribute values \u2014 no structural change \u2014 so every changed hole could be a fine-grained binding instead. Values bind, structure re-renders: pass the signal/computed itself ({count}, class={sig}) rather than reading .value in the hole, and each change updates just that node with no render re-run (a mount whose render reads no .value never re-renders at all). See docs/2-reactivity \xA72.9. " + silenceHint("valueOnlyRerender")
421
486
  );
422
487
  }
423
488
 
@@ -430,25 +495,98 @@ function maybeWarnMissingRowKey(rowEl, rowHtml, binding) {
430
495
  `kerf each(): the first row has no \`id\` or \`data-key\` attribute. Without one, rows match positionally \u2014 an insert/remove at the head shifts every row's identity, so focused inputs jump to the wrong row, mid-edit textareas swap content with their neighbor, and any per-row state silently follows the wrong item. Add \`data-key={item.id}\` (or set \`id\`) to the top-level element returned by the row render. Row HTML: ${JSON.stringify(truncateRowHtml(rowHtml))}`
431
496
  );
432
497
  }
433
- var WARNING_MESSAGE = "kerf: signal was written but has no subscribers. Did you read `.value` outside of a render fn / effect()? Hoisted reads do not subscribe, so subsequent writes will not re-render. Move the read inside mount()'s render fn or effect() callback. Set KERF_DEV_WARN_UNTRACKED_SIGNALS=0 (or unset it) to silence this warning.";
498
+
499
+ // src/dev-selector-fanout-warn.ts
500
+ var MIN_EVALUATIONS = 200;
501
+ var MAX_CHANGED_RATIO = 0.02;
502
+ var MIN_CHANGED_ALLOWANCE = 2;
503
+ var STREAK_TO_WARN = 3;
504
+ var evaluations = 0;
505
+ var changes = 0;
506
+ var open = null;
507
+ var states = /* @__PURE__ */ new WeakMap();
508
+ function isSelectorFanoutEnabled() {
509
+ return devFlag("KERF_DEV_WARN_SELECTOR_FANOUT") === "1";
510
+ }
511
+ function wrapComputedForFanout(fn) {
512
+ if (!isSelectorFanoutEnabled()) return fn;
513
+ let hasPrevious = false;
514
+ let previous;
515
+ return function() {
516
+ const value = fn.call(this);
517
+ if (hasPrevious) {
518
+ evaluations++;
519
+ if (!Object.is(previous, value)) changes++;
520
+ }
521
+ hasPrevious = true;
522
+ previous = value;
523
+ return value;
524
+ };
525
+ }
526
+ function noteTrackedSignalWrite(signal) {
527
+ if (open !== null) {
528
+ if (open.signal !== signal) open.multiple = true;
529
+ return;
530
+ }
531
+ const window = {
532
+ signal,
533
+ baseEvaluations: evaluations,
534
+ baseChanges: changes,
535
+ stack: String(new Error().stack),
536
+ multiple: false
537
+ };
538
+ open = window;
539
+ void Promise.resolve().then(() => closeWindow(window));
540
+ }
541
+ function closeWindow(window) {
542
+ if (open !== window) return;
543
+ open = null;
544
+ if (window.multiple) return;
545
+ const ran = evaluations - window.baseEvaluations;
546
+ const changed = changes - window.baseChanges;
547
+ let state = states.get(window.signal);
548
+ if (state === void 0) {
549
+ state = { streak: 0, warned: false };
550
+ states.set(window.signal, state);
551
+ }
552
+ const qualifies = ran >= MIN_EVALUATIONS && changed <= Math.max(MIN_CHANGED_ALLOWANCE, ran * MAX_CHANGED_RATIO);
553
+ if (!qualifies) {
554
+ state.streak = 0;
555
+ return;
556
+ }
557
+ state.streak++;
558
+ if (state.streak < STREAK_TO_WARN || state.warned) return;
559
+ state.warned = true;
560
+ console.warn(
561
+ `kerf: one write to this signal re-evaluated ${ran} computed()s but only ${changed} produced a different value, ${STREAK_TO_WARN} writes in a row. If each comparison is an equality or membership test against this signal (e.g. computed(() => row.id === selected.value ? ...)), use selector() for equality or setSelector() for set membership from kerfjs instead \u2014 they update only the keys whose answer changed, O(1) per write instead of O(rows). The write happened at:
562
+ ${window.stack}
563
+ ` + silenceHint("selectorFanout")
564
+ );
565
+ }
566
+ var WARNING_MESSAGE = "kerf: signal was written but has no subscribers. Did you read `.value` outside of a render fn / effect()? Hoisted reads do not subscribe, so subsequent writes will not re-render. Move the read inside mount()'s render fn or effect() callback. " + silenceHint("untrackedSignals");
434
567
  var DevSignal = class extends Signal {
435
568
  __hasSubscriber = false;
436
569
  __warned = false;
437
570
  __constructed = false;
438
- constructor(initial) {
571
+ __features;
572
+ constructor(initial, features) {
439
573
  super(initial, {
440
574
  watched() {
441
575
  this.__hasSubscriber = true;
442
576
  }
443
577
  });
578
+ this.__features = features;
444
579
  this.__constructed = true;
445
580
  }
446
581
  get value() {
447
582
  return super.value;
448
583
  }
449
584
  set value(v) {
585
+ if (this.__features.fanout && !Object.is(this.peek(), v)) {
586
+ noteTrackedSignalWrite(this);
587
+ }
450
588
  super.value = v;
451
- if (this.__constructed && !this.__hasSubscriber && !this.__warned) {
589
+ if (this.__constructed && this.__features.untracked && !this.__hasSubscriber && !this.__warned) {
452
590
  this.__warned = true;
453
591
  console.warn(WARNING_MESSAGE);
454
592
  }
@@ -462,13 +600,13 @@ function noteUntrackedCoverage() {
462
600
  if (coverageNoticeShown) return;
463
601
  coverageNoticeShown = true;
464
602
  console.warn(
465
- "kerf: KERF_DEV_WARN_UNTRACKED_SIGNALS only covers signals created AFTER kerfjs/dev is installed. Static imports are hoisted above `await import('kerfjs/dev')`, so module-scope signals in the modules you import are created first and this warning cannot see them \u2014 you may get no warnings even where the bug exists. To cover them, make `import 'kerfjs/dev'` the FIRST STATIC import of a dev-only entry file (static imports evaluate in order), then load the rest of your app. Set KERF_DEV_WARN_UNTRACKED_SIGNALS=0 (or unset it) to silence this warning."
603
+ "kerf: KERF_DEV_WARN_UNTRACKED_SIGNALS only covers signals created AFTER kerfjs/dev is installed. Static imports are hoisted above `await import('kerfjs/dev')`, so module-scope signals in the modules you import are created first and this warning cannot see them \u2014 you may get no warnings even where the bug exists. To cover them, make `import 'kerfjs/dev'` the FIRST STATIC import of a dev-only entry file (static imports evaluate in order), then load the rest of your app. " + silenceHint("untrackedSignals")
466
604
  );
467
605
  }
468
606
 
469
607
  // src/dev-store-warn.ts
470
608
  var WARNING_PREFIX = "kerf: defineStore.set() called with keys missing from the current state \u2014 ";
471
- var WARNING_SUFFIX = ". set() REPLACES state; the missing keys will be undefined after this call. Use `set({ ...get(), ...next })` to merge instead, or update each call site to pass the full state. Set KERF_DEV_WARN_NARROW_SET=0 (or unset it) to silence this warning.";
609
+ var WARNING_SUFFIX = ". set() REPLACES state; the missing keys will be undefined after this call. Use `set({ ...get(), ...next })` to merge instead, or update each call site to pass the full state. " + silenceHint("narrowSet");
472
610
  function isOptedIn8() {
473
611
  return devFlag("KERF_DEV_WARN_NARROW_SET") === "1";
474
612
  }
@@ -560,7 +698,11 @@ function enableWarnings(options) {
560
698
  }
561
699
  var DEV_HOOKS = {
562
700
  // --- reactive ---------------------------------------------------------
563
- signalFactory: (value) => isDevWarnUntrackedEnabled() ? new DevSignal(value) : signal(value),
701
+ signalFactory: (value) => {
702
+ const untracked = isDevWarnUntrackedEnabled();
703
+ const fanout = isSelectorFanoutEnabled();
704
+ return untracked || fanout ? new DevSignal(value, { untracked, fanout }) : signal(value);
705
+ },
564
706
  wrapEffect: (fn) => {
565
707
  if (!isDevWarnDelegateInEffectEnabled()) return fn;
566
708
  return () => {
@@ -572,6 +714,7 @@ var DEV_HOOKS = {
572
714
  }
573
715
  };
574
716
  },
717
+ wrapComputed: wrapComputedForFanout,
575
718
  // --- delegate ---------------------------------------------------------
576
719
  delegateInEffect: warnIfInsideEffect,
577
720
  // --- store ------------------------------------------------------------
@@ -594,6 +737,8 @@ var DEV_HOOKS = {
594
737
  staleIndexEnabled: isOptedInStaleIndex,
595
738
  staleIndex: maybeWarnStaleIndex,
596
739
  duplicateCacheKeys: maybeWarnDuplicateCacheKeys,
740
+ // --- overlay ----------------------------------------------------------
741
+ overlayBlockedByModal: maybeWarnOverlayBlockedByModal,
597
742
  // --- urlScreen --------------------------------------------------------
598
743
  urlScreenThrow: (message) => {
599
744
  throw new Error(message);