@fictjs/runtime 0.8.0 → 0.10.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 (86) hide show
  1. package/README.md +46 -0
  2. package/dist/advanced.cjs +9 -9
  3. package/dist/advanced.d.cts +5 -5
  4. package/dist/advanced.d.ts +5 -5
  5. package/dist/advanced.js +4 -4
  6. package/dist/{effect-DAzpH7Mm.d.ts → binding-DUEukRxl.d.cts} +35 -24
  7. package/dist/{effect-DAzpH7Mm.d.cts → binding-DqxS9ZQf.d.ts} +35 -24
  8. package/dist/{chunk-WRU3IZOA.js → chunk-2JRPPCG7.js} +3 -3
  9. package/dist/{chunk-TLDT76RV.js → chunk-DKA2I6ET.js} +3 -3
  10. package/dist/{chunk-FSCBL7RI.cjs → chunk-EQ5E4WOV.cjs} +702 -534
  11. package/dist/chunk-EQ5E4WOV.cjs.map +1 -0
  12. package/dist/{chunk-7YQK3XKY.js → chunk-F4RVNXOL.js} +687 -519
  13. package/dist/chunk-F4RVNXOL.js.map +1 -0
  14. package/dist/{chunk-PRF4QG73.cjs → chunk-I4GKKAAY.cjs} +469 -248
  15. package/dist/chunk-I4GKKAAY.cjs.map +1 -0
  16. package/dist/{chunk-HHDHQGJY.cjs → chunk-K3DH5SD5.cjs} +17 -17
  17. package/dist/{chunk-HHDHQGJY.cjs.map → chunk-K3DH5SD5.cjs.map} +1 -1
  18. package/dist/chunk-P4TZLFV6.js +768 -0
  19. package/dist/chunk-P4TZLFV6.js.map +1 -0
  20. package/dist/{chunk-4LCHQ7U4.js → chunk-R6FINS25.js} +318 -97
  21. package/dist/chunk-R6FINS25.js.map +1 -0
  22. package/dist/chunk-SZLJCQFZ.cjs +768 -0
  23. package/dist/chunk-SZLJCQFZ.cjs.map +1 -0
  24. package/dist/{chunk-CEV6TO5U.cjs → chunk-V7BC64W2.cjs} +8 -8
  25. package/dist/{chunk-CEV6TO5U.cjs.map → chunk-V7BC64W2.cjs.map} +1 -1
  26. package/dist/{context-BFbHf9nC.d.cts → devtools-C4Hgfa-S.d.ts} +47 -35
  27. package/dist/{context-C4vBQbb4.d.ts → devtools-CMxlJUTx.d.cts} +47 -35
  28. package/dist/index.cjs +42 -42
  29. package/dist/index.d.cts +5 -5
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.dev.js +233 -28
  32. package/dist/index.dev.js.map +1 -1
  33. package/dist/index.js +3 -3
  34. package/dist/internal-list.cjs +12 -0
  35. package/dist/internal-list.cjs.map +1 -0
  36. package/dist/internal-list.d.cts +2 -0
  37. package/dist/internal-list.d.ts +2 -0
  38. package/dist/internal-list.js +12 -0
  39. package/dist/internal-list.js.map +1 -0
  40. package/dist/internal.cjs +6 -746
  41. package/dist/internal.cjs.map +1 -1
  42. package/dist/internal.d.cts +7 -75
  43. package/dist/internal.d.ts +7 -75
  44. package/dist/internal.js +12 -752
  45. package/dist/internal.js.map +1 -1
  46. package/dist/jsx-dev-runtime.d.cts +671 -0
  47. package/dist/jsx-dev-runtime.d.ts +671 -0
  48. package/dist/jsx-runtime.d.cts +671 -0
  49. package/dist/jsx-runtime.d.ts +671 -0
  50. package/dist/list-BBzsJhrm.d.ts +71 -0
  51. package/dist/list-_NJCcjl1.d.cts +71 -0
  52. package/dist/loader.cjs +99 -16
  53. package/dist/loader.cjs.map +1 -1
  54. package/dist/loader.d.cts +17 -3
  55. package/dist/loader.d.ts +17 -3
  56. package/dist/loader.js +92 -9
  57. package/dist/loader.js.map +1 -1
  58. package/dist/{props-84UJeWO8.d.cts → props--zJ4ebbT.d.cts} +3 -3
  59. package/dist/{props-BRhFK50f.d.ts → props-BAGR7j-j.d.ts} +3 -3
  60. package/dist/{resume-i-A3EFox.d.cts → resume-C5IKAIdh.d.ts} +5 -3
  61. package/dist/{resume-CqeQ3v_q.d.ts → resume-DPZxmA95.d.cts} +5 -3
  62. package/dist/{scope-D3DpsfoG.d.ts → scope-CuImnvh1.d.ts} +1 -1
  63. package/dist/{scope-DlCBL1Ft.d.cts → scope-Dq5hOu7c.d.cts} +1 -1
  64. package/dist/{signal-C4ISF17w.d.cts → signal-Z4KkDk9h.d.cts} +12 -1
  65. package/dist/{signal-C4ISF17w.d.ts → signal-Z4KkDk9h.d.ts} +12 -1
  66. package/package.json +9 -2
  67. package/src/binding.ts +113 -36
  68. package/src/cycle-guard.ts +3 -3
  69. package/src/devtools.ts +19 -2
  70. package/src/dom.ts +58 -4
  71. package/src/effect.ts +5 -5
  72. package/src/hooks.ts +13 -5
  73. package/src/internal/list.ts +7 -0
  74. package/src/internal.ts +1 -0
  75. package/src/lifecycle.ts +41 -3
  76. package/src/list-helpers.ts +1 -1
  77. package/src/loader.ts +128 -12
  78. package/src/resume.ts +6 -3
  79. package/src/signal.ts +200 -20
  80. package/src/transition.ts +9 -3
  81. package/dist/chunk-4LCHQ7U4.js.map +0 -1
  82. package/dist/chunk-7YQK3XKY.js.map +0 -1
  83. package/dist/chunk-FSCBL7RI.cjs.map +0 -1
  84. package/dist/chunk-PRF4QG73.cjs.map +0 -1
  85. /package/dist/{chunk-WRU3IZOA.js.map → chunk-2JRPPCG7.js.map} +0 -0
  86. /package/dist/{chunk-TLDT76RV.js.map → chunk-DKA2I6ET.js.map} +0 -0
@@ -1,382 +1,3 @@
1
- // src/delegated-events.ts
2
- var DelegatedEventNames = [
3
- "beforeinput",
4
- "click",
5
- "dblclick",
6
- "contextmenu",
7
- "focusin",
8
- "focusout",
9
- "input",
10
- "keydown",
11
- "keyup",
12
- "mousedown",
13
- "mousemove",
14
- "mouseout",
15
- "mouseover",
16
- "mouseup",
17
- "pointerdown",
18
- "pointermove",
19
- "pointerout",
20
- "pointerover",
21
- "pointerup",
22
- "touchend",
23
- "touchmove",
24
- "touchstart"
25
- ];
26
-
27
- // src/constants.ts
28
- var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
29
- var booleans = isDev ? [
30
- "allowfullscreen",
31
- "async",
32
- "alpha",
33
- // HTMLInputElement
34
- "autofocus",
35
- // HTMLElement prop
36
- "autoplay",
37
- "checked",
38
- "controls",
39
- "default",
40
- "disabled",
41
- "formnovalidate",
42
- "hidden",
43
- // HTMLElement prop
44
- "indeterminate",
45
- "inert",
46
- // HTMLElement prop
47
- "ismap",
48
- "loop",
49
- "multiple",
50
- "muted",
51
- "nomodule",
52
- "novalidate",
53
- "open",
54
- "playsinline",
55
- "readonly",
56
- "required",
57
- "reversed",
58
- "seamless",
59
- // HTMLIframeElement - non-standard
60
- "selected",
61
- // Experimental attributes
62
- "adauctionheaders",
63
- "browsingtopics",
64
- "credentialless",
65
- "defaultchecked",
66
- "defaultmuted",
67
- "defaultselected",
68
- "defer",
69
- "disablepictureinpicture",
70
- "disableremoteplayback",
71
- "preservespitch",
72
- "shadowrootclonable",
73
- "shadowrootcustomelementregistry",
74
- "shadowrootdelegatesfocus",
75
- "shadowrootserializable",
76
- "sharedstoragewritable"
77
- ] : [];
78
- var BooleanAttributes = new Set(booleans);
79
- var properties = isDev ? [
80
- // Core properties
81
- "className",
82
- "value",
83
- // CamelCase booleans
84
- "readOnly",
85
- "noValidate",
86
- "formNoValidate",
87
- "isMap",
88
- "noModule",
89
- "playsInline",
90
- // Experimental (camelCase)
91
- "adAuctionHeaders",
92
- "allowFullscreen",
93
- "browsingTopics",
94
- "defaultChecked",
95
- "defaultMuted",
96
- "defaultSelected",
97
- "disablePictureInPicture",
98
- "disableRemotePlayback",
99
- "preservesPitch",
100
- "shadowRootClonable",
101
- "shadowRootCustomElementRegistry",
102
- "shadowRootDelegatesFocus",
103
- "shadowRootSerializable",
104
- "sharedStorageWritable",
105
- // All lowercase booleans
106
- ...booleans
107
- ] : [];
108
- var Properties = new Set(properties);
109
- var ChildProperties = /* @__PURE__ */ new Set([
110
- "innerHTML",
111
- "textContent",
112
- "innerText",
113
- "children"
114
- ]);
115
- var Aliases = {
116
- className: "class",
117
- htmlFor: "for"
118
- };
119
- var PropAliases = isDev ? {
120
- // Direct mapping
121
- class: "className",
122
- // Element-specific mappings
123
- novalidate: {
124
- $: "noValidate",
125
- FORM: 1
126
- },
127
- formnovalidate: {
128
- $: "formNoValidate",
129
- BUTTON: 1,
130
- INPUT: 1
131
- },
132
- ismap: {
133
- $: "isMap",
134
- IMG: 1
135
- },
136
- nomodule: {
137
- $: "noModule",
138
- SCRIPT: 1
139
- },
140
- playsinline: {
141
- $: "playsInline",
142
- VIDEO: 1
143
- },
144
- readonly: {
145
- $: "readOnly",
146
- INPUT: 1,
147
- TEXTAREA: 1
148
- },
149
- // Experimental element-specific
150
- adauctionheaders: {
151
- $: "adAuctionHeaders",
152
- IFRAME: 1
153
- },
154
- allowfullscreen: {
155
- $: "allowFullscreen",
156
- IFRAME: 1
157
- },
158
- browsingtopics: {
159
- $: "browsingTopics",
160
- IMG: 1
161
- },
162
- defaultchecked: {
163
- $: "defaultChecked",
164
- INPUT: 1
165
- },
166
- defaultmuted: {
167
- $: "defaultMuted",
168
- AUDIO: 1,
169
- VIDEO: 1
170
- },
171
- defaultselected: {
172
- $: "defaultSelected",
173
- OPTION: 1
174
- },
175
- disablepictureinpicture: {
176
- $: "disablePictureInPicture",
177
- VIDEO: 1
178
- },
179
- disableremoteplayback: {
180
- $: "disableRemotePlayback",
181
- AUDIO: 1,
182
- VIDEO: 1
183
- },
184
- preservespitch: {
185
- $: "preservesPitch",
186
- AUDIO: 1,
187
- VIDEO: 1
188
- },
189
- shadowrootclonable: {
190
- $: "shadowRootClonable",
191
- TEMPLATE: 1
192
- },
193
- shadowrootdelegatesfocus: {
194
- $: "shadowRootDelegatesFocus",
195
- TEMPLATE: 1
196
- },
197
- shadowrootserializable: {
198
- $: "shadowRootSerializable",
199
- TEMPLATE: 1
200
- },
201
- sharedstoragewritable: {
202
- $: "sharedStorageWritable",
203
- IFRAME: 1,
204
- IMG: 1
205
- }
206
- } : {};
207
- function getPropAlias(prop, tagName) {
208
- if (!isDev) return void 0;
209
- const a = PropAliases[prop];
210
- if (typeof a === "object") {
211
- return a[tagName] ? a["$"] : void 0;
212
- }
213
- return a;
214
- }
215
- var $$EVENTS = "_$FICT_DELEGATE";
216
- var DelegatedEvents = new Set(DelegatedEventNames);
217
- var svgElements = isDev ? [
218
- "altGlyph",
219
- "altGlyphDef",
220
- "altGlyphItem",
221
- "animate",
222
- "animateColor",
223
- "animateMotion",
224
- "animateTransform",
225
- "circle",
226
- "clipPath",
227
- "color-profile",
228
- "cursor",
229
- "defs",
230
- "desc",
231
- "ellipse",
232
- "feBlend",
233
- "feColorMatrix",
234
- "feComponentTransfer",
235
- "feComposite",
236
- "feConvolveMatrix",
237
- "feDiffuseLighting",
238
- "feDisplacementMap",
239
- "feDistantLight",
240
- "feDropShadow",
241
- "feFlood",
242
- "feFuncA",
243
- "feFuncB",
244
- "feFuncG",
245
- "feFuncR",
246
- "feGaussianBlur",
247
- "feImage",
248
- "feMerge",
249
- "feMergeNode",
250
- "feMorphology",
251
- "feOffset",
252
- "fePointLight",
253
- "feSpecularLighting",
254
- "feSpotLight",
255
- "feTile",
256
- "feTurbulence",
257
- "filter",
258
- "font",
259
- "font-face",
260
- "font-face-format",
261
- "font-face-name",
262
- "font-face-src",
263
- "font-face-uri",
264
- "foreignObject",
265
- "g",
266
- "glyph",
267
- "glyphRef",
268
- "hkern",
269
- "image",
270
- "line",
271
- "linearGradient",
272
- "marker",
273
- "mask",
274
- "metadata",
275
- "missing-glyph",
276
- "mpath",
277
- "path",
278
- "pattern",
279
- "polygon",
280
- "polyline",
281
- "radialGradient",
282
- "rect",
283
- "set",
284
- "stop",
285
- "svg",
286
- "switch",
287
- "symbol",
288
- "text",
289
- "textPath",
290
- "tref",
291
- "tspan",
292
- "use",
293
- "view",
294
- "vkern"
295
- ] : [];
296
- var SVGElements = new Set(svgElements);
297
- var SVGNamespace = {
298
- xlink: "http://www.w3.org/1999/xlink",
299
- xml: "http://www.w3.org/XML/1998/namespace"
300
- };
301
- var unitlessList = isDev ? [
302
- "animationIterationCount",
303
- "animation-iteration-count",
304
- "borderImageOutset",
305
- "border-image-outset",
306
- "borderImageSlice",
307
- "border-image-slice",
308
- "borderImageWidth",
309
- "border-image-width",
310
- "boxFlex",
311
- "box-flex",
312
- "boxFlexGroup",
313
- "box-flex-group",
314
- "boxOrdinalGroup",
315
- "box-ordinal-group",
316
- "columnCount",
317
- "column-count",
318
- "columns",
319
- "flex",
320
- "flexGrow",
321
- "flex-grow",
322
- "flexPositive",
323
- "flex-positive",
324
- "flexShrink",
325
- "flex-shrink",
326
- "flexNegative",
327
- "flex-negative",
328
- "flexOrder",
329
- "flex-order",
330
- "gridRow",
331
- "grid-row",
332
- "gridRowEnd",
333
- "grid-row-end",
334
- "gridRowSpan",
335
- "grid-row-span",
336
- "gridRowStart",
337
- "grid-row-start",
338
- "gridColumn",
339
- "grid-column",
340
- "gridColumnEnd",
341
- "grid-column-end",
342
- "gridColumnSpan",
343
- "grid-column-span",
344
- "gridColumnStart",
345
- "grid-column-start",
346
- "fontWeight",
347
- "font-weight",
348
- "lineClamp",
349
- "line-clamp",
350
- "lineHeight",
351
- "line-height",
352
- "opacity",
353
- "order",
354
- "orphans",
355
- "tabSize",
356
- "tab-size",
357
- "widows",
358
- "zIndex",
359
- "z-index",
360
- "zoom",
361
- "fillOpacity",
362
- "fill-opacity",
363
- "floodOpacity",
364
- "flood-opacity",
365
- "stopOpacity",
366
- "stop-opacity",
367
- "strokeDasharray",
368
- "stroke-dasharray",
369
- "strokeDashoffset",
370
- "stroke-dashoffset",
371
- "strokeMiterlimit",
372
- "stroke-miterlimit",
373
- "strokeOpacity",
374
- "stroke-opacity",
375
- "strokeWidth",
376
- "stroke-width"
377
- ] : ["opacity", "zIndex"];
378
- var UnitlessStyles = new Set(unitlessList);
379
-
380
1
  // src/devtools.ts
381
2
  function getGlobalHook() {
382
3
  if (typeof globalThis === "undefined") return void 0;
@@ -387,7 +8,7 @@ function getDevtoolsHook() {
387
8
  }
388
9
 
389
10
  // src/cycle-guard.ts
390
- var isDev2 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
11
+ var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
391
12
  var setCycleProtectionOptions = () => {
392
13
  };
393
14
  var resetCycleProtectionStateForTests = () => {
@@ -401,17 +22,17 @@ var enterRootGuard = () => true;
401
22
  var exitRootGuard = () => {
402
23
  };
403
24
  var defaultOptions = {
404
- // Keep cycle guards on in production to avoid infinite flush loops.
405
- enabled: true,
25
+ // DX-first in development, performance-first in production.
26
+ enabled: isDev,
406
27
  maxFlushCyclesPerMicrotask: 1e4,
407
28
  maxEffectRunsPerFlush: 2e4,
408
29
  windowSize: 5,
409
30
  highUsageRatio: 0.8,
410
31
  maxRootReentrantDepth: 10,
411
32
  enableWindowWarning: true,
412
- devMode: isDev2,
33
+ devMode: isDev,
413
34
  // Backoff warning options
414
- enableBackoffWarning: isDev2,
35
+ enableBackoffWarning: isDev,
415
36
  backoffWarningRatio: 0.5
416
37
  };
417
38
  var enabled = defaultOptions.enabled;
@@ -456,7 +77,7 @@ beforeEffectRunGuard = () => {
456
77
  if (!enabled) return true;
457
78
  const next = ++effectRunsThisFlush;
458
79
  const limit = Math.min(options.maxFlushCyclesPerMicrotask, options.maxEffectRunsPerFlush);
459
- if (options.enableBackoffWarning && isDev2) {
80
+ if (options.enableBackoffWarning && isDev) {
460
81
  const ratio = next / limit;
461
82
  const backoffRatio = options.backoffWarningRatio ?? 0.5;
462
83
  if (!backoffWarned50 && ratio >= backoffRatio && ratio < backoffRatio + 0.25) {
@@ -555,13 +176,40 @@ var reportCycle = (reason, detail = void 0) => {
555
176
  };
556
177
 
557
178
  // src/lifecycle.ts
558
- var isDev3 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
179
+ var isDev2 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
559
180
  var currentRoot;
560
181
  var currentEffectCleanups;
561
182
  var globalErrorHandlers = /* @__PURE__ */ new WeakMap();
562
183
  var globalSuspenseHandlers = /* @__PURE__ */ new WeakMap();
184
+ var rootDevtoolsIds = /* @__PURE__ */ new WeakMap();
185
+ var nextRootDevtoolsId = 0;
186
+ function registerRootDevtools(root) {
187
+ if (!isDev2) return;
188
+ const hook = getDevtoolsHook();
189
+ if (!hook?.registerRoot) return;
190
+ const id = ++nextRootDevtoolsId;
191
+ rootDevtoolsIds.set(root, id);
192
+ hook.registerRoot(id);
193
+ }
194
+ function disposeRootDevtools(root) {
195
+ if (!isDev2) return;
196
+ const id = rootDevtoolsIds.get(root);
197
+ if (id === void 0) return;
198
+ const hook = getDevtoolsHook();
199
+ hook?.disposeRoot?.(id);
200
+ rootDevtoolsIds.delete(root);
201
+ }
202
+ function setRootSuspendDevtools(root, suspended) {
203
+ if (!isDev2) return;
204
+ const id = rootDevtoolsIds.get(root);
205
+ if (id === void 0) return;
206
+ const hook = getDevtoolsHook();
207
+ hook?.rootSuspend?.(id, suspended);
208
+ }
563
209
  function createRootContext(parent) {
564
- return { parent, cleanups: [], destroyCallbacks: [], suspended: false };
210
+ const root = { parent, cleanups: [], destroyCallbacks: [], suspended: false };
211
+ registerRootDevtools(root);
212
+ return root;
565
213
  }
566
214
  function pushRoot(root) {
567
215
  if (!enterRootGuard(root)) {
@@ -641,6 +289,7 @@ function destroyRoot(root) {
641
289
  if (globalSuspenseHandlers.has(root)) {
642
290
  globalSuspenseHandlers.delete(root);
643
291
  }
292
+ disposeRootDevtools(root);
644
293
  }
645
294
  function createRoot(fn, options2) {
646
295
  const parent = options2?.inherit ? currentRoot : void 0;
@@ -701,7 +350,7 @@ function runLifecycle(fn) {
701
350
  }
702
351
  function registerErrorHandler(fn) {
703
352
  if (!currentRoot) {
704
- const message = isDev3 ? "registerErrorHandler must be called within a root" : "FICT:E_ROOT_HANDLER";
353
+ const message = isDev2 ? "registerErrorHandler must be called within a root" : "FICT:E_ROOT_HANDLER";
705
354
  throw new Error(message);
706
355
  }
707
356
  if (!currentRoot.errorHandlers) {
@@ -717,7 +366,7 @@ function registerErrorHandler(fn) {
717
366
  }
718
367
  function registerSuspenseHandler(fn) {
719
368
  if (!currentRoot) {
720
- const message = isDev3 ? "registerSuspenseHandler must be called within a root" : "FICT:E_ROOT_SUSPENSE";
369
+ const message = isDev2 ? "registerSuspenseHandler must be called within a root" : "FICT:E_ROOT_SUSPENSE";
721
370
  throw new Error(message);
722
371
  }
723
372
  if (!currentRoot.suspenseHandlers) {
@@ -777,7 +426,10 @@ function handleSuspend(token, startRoot) {
777
426
  const handler = handlers[i];
778
427
  const handled = handler(token);
779
428
  if (handled !== false) {
780
- if (originRoot) originRoot.suspended = true;
429
+ if (originRoot) {
430
+ originRoot.suspended = true;
431
+ setRootSuspendDevtools(originRoot, true);
432
+ }
781
433
  return true;
782
434
  }
783
435
  }
@@ -790,7 +442,10 @@ function handleSuspend(token, startRoot) {
790
442
  const handler = globalForRoot[i];
791
443
  const handled = handler(token);
792
444
  if (handled !== false) {
793
- if (originRoot) originRoot.suspended = true;
445
+ if (originRoot) {
446
+ originRoot.suspended = true;
447
+ setRootSuspendDevtools(originRoot, true);
448
+ }
794
449
  return true;
795
450
  }
796
451
  }
@@ -798,93 +453,24 @@ function handleSuspend(token, startRoot) {
798
453
  return false;
799
454
  }
800
455
 
801
- // src/effect.ts
802
- function createEffect(fn) {
803
- let cleanups = [];
804
- const rootForError = getCurrentRoot();
805
- const doCleanup = () => {
806
- runCleanupList(cleanups);
807
- cleanups = [];
808
- };
809
- const run = () => {
810
- const bucket = [];
811
- withEffectCleanups(bucket, () => {
812
- try {
813
- const maybeCleanup = fn();
814
- if (typeof maybeCleanup === "function") {
815
- bucket.push(maybeCleanup);
816
- }
817
- } catch (err) {
818
- if (handleSuspend(err, rootForError)) {
819
- return;
820
- }
821
- if (handleError(err, { source: "effect" }, rootForError)) {
822
- return;
823
- }
824
- throw err;
825
- }
826
- });
827
- cleanups = bucket;
828
- };
829
- const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
830
- const teardown = () => {
831
- runCleanupList(cleanups);
832
- disposeEffect();
833
- };
834
- registerRootCleanup(teardown);
835
- return teardown;
836
- }
837
- function createRenderEffect(fn) {
838
- let cleanup;
839
- const rootForError = getCurrentRoot();
840
- const doCleanup = () => {
841
- if (cleanup) {
842
- cleanup();
843
- cleanup = void 0;
844
- }
845
- };
846
- const run = () => {
847
- try {
848
- const maybeCleanup = fn();
849
- if (typeof maybeCleanup === "function") {
850
- cleanup = maybeCleanup;
851
- }
852
- } catch (err) {
853
- if (handleSuspend(err, rootForError)) {
854
- return;
855
- }
856
- const handled = handleError(err, { source: "effect" }, rootForError);
857
- if (handled) {
858
- return;
859
- }
860
- throw err;
861
- }
862
- };
863
- const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
864
- const teardown = () => {
865
- if (cleanup) {
866
- cleanup();
867
- cleanup = void 0;
868
- }
869
- disposeEffect();
870
- };
871
- registerRootCleanup(teardown);
872
- return teardown;
456
+ // src/memo.ts
457
+ function createMemo(fn, options2) {
458
+ return computed(fn, options2);
873
459
  }
874
460
 
875
461
  // src/hooks.ts
876
- var isDev4 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
462
+ var isDev3 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
877
463
  var ctxStack = [];
878
464
  var preparedContext = null;
879
465
  function assertRenderContext(ctx, hookName) {
880
466
  if (!ctx.rendering) {
881
- const message = isDev4 ? `${hookName} can only be used during render execution` : "FICT:E_HOOK_RENDER";
467
+ const message = isDev3 ? `${hookName} can only be used during render execution` : "FICT:E_HOOK_RENDER";
882
468
  throw new Error(message);
883
469
  }
884
470
  }
885
471
  function __fictUseContext() {
886
472
  if (ctxStack.length === 0) {
887
- const message = isDev4 ? "Invalid hook call: hooks can only be used while rendering a component. Make sure you are not calling hooks in event handlers or outside of components." : "FICT:E_HOOK_OUTSIDE_RENDER";
473
+ const message = isDev3 ? "Invalid hook call: hooks can only be used while rendering a component. Make sure you are not calling hooks in event handlers or outside of components." : "FICT:E_HOOK_OUTSIDE_RENDER";
888
474
  throw new Error(message);
889
475
  }
890
476
  const ctx = ctxStack[ctxStack.length - 1];
@@ -937,18 +523,20 @@ function __fictUseMemo(ctx, fn, optionsOrSlot, slot) {
937
523
  }
938
524
  return ctx.slots[index];
939
525
  }
940
- function __fictUseEffect(ctx, fn, slot) {
941
- if (slot !== void 0) {
942
- if (ctx.slots[slot]) {
526
+ function __fictUseEffect(ctx, fn, optionsOrSlot, slot) {
527
+ const options2 = typeof optionsOrSlot === "number" ? void 0 : optionsOrSlot;
528
+ const resolvedSlot = typeof optionsOrSlot === "number" ? optionsOrSlot : slot;
529
+ if (resolvedSlot !== void 0) {
530
+ if (ctx.slots[resolvedSlot]) {
943
531
  return;
944
532
  }
945
- ctx.slots[slot] = createEffect(fn);
533
+ ctx.slots[resolvedSlot] = createEffect(fn, options2);
946
534
  return;
947
535
  }
948
536
  assertRenderContext(ctx, "__fictUseEffect");
949
537
  const index = ctx.cursor++;
950
538
  if (!ctx.slots[index]) {
951
- ctx.slots[index] = createEffect(fn);
539
+ ctx.slots[index] = createEffect(fn, options2);
952
540
  }
953
541
  }
954
542
  function __fictRender(ctx, fn) {
@@ -964,7 +552,7 @@ function __fictRender(ctx, fn) {
964
552
  }
965
553
 
966
554
  // src/signal.ts
967
- var isDev5 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
555
+ var isDev4 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
968
556
  var Mutable = 1;
969
557
  var Watching = 2;
970
558
  var Running = 4;
@@ -1011,7 +599,7 @@ function link(dep, sub, version) {
1011
599
  else sub.deps = newLink;
1012
600
  if (prevSub !== void 0) prevSub.nextSub = newLink;
1013
601
  else dep.subs = newLink;
1014
- if (isDev5) trackDependencyDevtools(dep, sub);
602
+ if (isDev4) trackDependencyDevtools(dep, sub);
1015
603
  }
1016
604
  function unlink(lnk, sub = lnk.sub) {
1017
605
  const dep = lnk.dep;
@@ -1027,7 +615,7 @@ function unlink(lnk, sub = lnk.sub) {
1027
615
  else dep.subsTail = prevSub;
1028
616
  if (prevSub !== void 0) prevSub.nextSub = nextSub;
1029
617
  else if ((dep.subs = nextSub) === void 0) unwatched(dep);
1030
- if (isDev5) untrackDependencyDevtools(dep, sub);
618
+ if (isDev4) untrackDependencyDevtools(dep, sub);
1031
619
  return nextDep;
1032
620
  }
1033
621
  function unwatched(dep) {
@@ -1211,6 +799,15 @@ function purgeDeps(sub) {
1211
799
  while (dep !== void 0) dep = unlink(dep, sub);
1212
800
  }
1213
801
  function disposeNode(node) {
802
+ if (isDev4) {
803
+ if ("fn" in node && typeof node.fn === "function") {
804
+ disposeEffectDevtools(node);
805
+ } else if ("getter" in node && typeof node.getter === "function") {
806
+ disposeComputedDevtools(node);
807
+ } else if ("currentValue" in node) {
808
+ disposeSignalDevtools(node);
809
+ }
810
+ }
1214
811
  node.depsTail = void 0;
1215
812
  node.flags = 0;
1216
813
  purgeDeps(node);
@@ -1249,7 +846,7 @@ function updateComputed(c) {
1249
846
  c.prevValue = oldValue;
1250
847
  c.prevFlushId = currentFlushId;
1251
848
  c.value = newValue;
1252
- if (isDev5) updateComputedDevtools(c, newValue);
849
+ if (isDev4) updateComputedDevtools(c, newValue);
1253
850
  return true;
1254
851
  }
1255
852
  return false;
@@ -1264,6 +861,7 @@ function runEffect(e) {
1264
861
  const flags = e.flags;
1265
862
  const runCleanup = () => {
1266
863
  if (!e.runCleanup) return;
864
+ if (isDev4) effectCleanupDevtools(e);
1267
865
  inCleanup = true;
1268
866
  activeCleanupFlushId = currentFlushId;
1269
867
  try {
@@ -1276,7 +874,6 @@ function runEffect(e) {
1276
874
  if (flags & Dirty) {
1277
875
  runCleanup();
1278
876
  ++cycle;
1279
- if (isDev5) effectRunDevtools(e);
1280
877
  e.depsTail = void 0;
1281
878
  e.flags = WatchingRunning;
1282
879
  const prevSub = activeSub;
@@ -1314,7 +911,6 @@ function runEffect(e) {
1314
911
  if (isDirty) {
1315
912
  runCleanup();
1316
913
  ++cycle;
1317
- if (isDev5) effectRunDevtools(e);
1318
914
  e.depsTail = void 0;
1319
915
  e.flags = WatchingRunning;
1320
916
  const prevSub = activeSub;
@@ -1348,19 +944,30 @@ function scheduleFlush() {
1348
944
  }
1349
945
  function flush() {
1350
946
  beginFlushGuard();
947
+ let flushReported = false;
948
+ const finishFlush = () => {
949
+ if (flushReported && isDev4) {
950
+ flushEndDevtools();
951
+ }
952
+ endFlushGuard();
953
+ };
1351
954
  if (batchDepth > 0) {
1352
955
  scheduleFlush();
1353
- endFlushGuard();
956
+ finishFlush();
1354
957
  return;
1355
958
  }
1356
959
  const hasWork = highPriorityQueue.length > 0 || lowPriorityQueue.length > 0;
1357
960
  if (!hasWork) {
1358
961
  flushScheduled = false;
1359
- endFlushGuard();
962
+ finishFlush();
1360
963
  return;
1361
964
  }
1362
965
  currentFlushId++;
1363
966
  flushScheduled = false;
967
+ if (isDev4) {
968
+ flushStartDevtools();
969
+ flushReported = true;
970
+ }
1364
971
  let highIndex = 0;
1365
972
  while (highIndex < highPriorityQueue.length) {
1366
973
  const e = highPriorityQueue[highIndex];
@@ -1380,7 +987,7 @@ function flush() {
1380
987
  highPriorityQueue.length = 0;
1381
988
  lowPriorityQueue.length = 0;
1382
989
  flushScheduled = false;
1383
- endFlushGuard();
990
+ finishFlush();
1384
991
  return;
1385
992
  }
1386
993
  highIndex++;
@@ -1395,7 +1002,7 @@ function flush() {
1395
1002
  lowPriorityQueue.length -= lowIndex;
1396
1003
  }
1397
1004
  scheduleFlush();
1398
- endFlushGuard();
1005
+ finishFlush();
1399
1006
  return;
1400
1007
  }
1401
1008
  const e = lowPriorityQueue[lowIndex];
@@ -1415,14 +1022,14 @@ function flush() {
1415
1022
  highPriorityQueue.length = 0;
1416
1023
  lowPriorityQueue.length = 0;
1417
1024
  flushScheduled = false;
1418
- endFlushGuard();
1025
+ finishFlush();
1419
1026
  return;
1420
1027
  }
1421
1028
  lowIndex++;
1422
1029
  runEffect(e);
1423
1030
  }
1424
1031
  lowPriorityQueue.length = 0;
1425
- endFlushGuard();
1032
+ finishFlush();
1426
1033
  }
1427
1034
  function signal(initialValue, options2) {
1428
1035
  const s = {
@@ -1436,7 +1043,7 @@ function signal(initialValue, options2) {
1436
1043
  if (options2?.equals !== void 0) s.equals = options2.equals;
1437
1044
  if (options2?.name !== void 0) s.name = options2.name;
1438
1045
  if (options2?.devToolsSource !== void 0) s.devToolsSource = options2.devToolsSource;
1439
- if (isDev5) registerSignalDevtools(s);
1046
+ if (isDev4) registerSignalDevtools(s);
1440
1047
  const accessor = signalOper.bind(s);
1441
1048
  accessor[SIGNAL_MARKER] = true;
1442
1049
  return accessor;
@@ -1448,7 +1055,7 @@ function signalOper(value) {
1448
1055
  if (valuesDiffer(this, prev, next)) {
1449
1056
  this.pendingValue = next;
1450
1057
  this.flags = MutableDirty;
1451
- if (isDev5) updateSignalDevtools(this, next);
1058
+ if (isDev4) updateSignalDevtools(this, next);
1452
1059
  const subs = this.subs;
1453
1060
  if (subs !== void 0) {
1454
1061
  propagate(subs);
@@ -1495,7 +1102,8 @@ function computed(getter, options2) {
1495
1102
  if (options2?.equals !== void 0) c.equals = options2.equals;
1496
1103
  if (options2?.name !== void 0) c.name = options2.name;
1497
1104
  if (options2?.devToolsSource !== void 0) c.devToolsSource = options2.devToolsSource;
1498
- if (isDev5) registerComputedDevtools(c);
1105
+ if (options2?.internal === true) c.devToolsInternal = true;
1106
+ if (isDev4) registerComputedDevtools(c);
1499
1107
  const bound = computedOper.bind(
1500
1108
  c
1501
1109
  );
@@ -1530,7 +1138,7 @@ function computedOper() {
1530
1138
  const prevSub = setActiveSub(this);
1531
1139
  try {
1532
1140
  this.value = this.getter(void 0);
1533
- if (isDev5) updateComputedDevtools(this, this.value);
1141
+ if (isDev4) updateComputedDevtools(this, this.value);
1534
1142
  } catch (err) {
1535
1143
  this.flags = 0;
1536
1144
  purgeDeps(this);
@@ -1545,7 +1153,7 @@ function computedOper() {
1545
1153
  if (activeSub !== void 0) link(this, activeSub, cycle);
1546
1154
  return this.value;
1547
1155
  }
1548
- function effect(fn) {
1156
+ function effect(fn, options2) {
1549
1157
  const e = {
1550
1158
  fn,
1551
1159
  subs: void 0,
@@ -1553,21 +1161,23 @@ function effect(fn) {
1553
1161
  deps: void 0,
1554
1162
  depsTail: void 0,
1555
1163
  flags: WatchingRunning,
1164
+ ...options2?.name !== void 0 ? { name: options2.name } : {},
1165
+ ...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
1556
1166
  __id: void 0
1557
1167
  };
1558
1168
  const root = getCurrentRoot();
1559
1169
  if (root) {
1560
1170
  e.root = root;
1561
1171
  }
1562
- if (isDev5) registerEffectDevtools(e);
1172
+ if (isDev4) registerEffectDevtools(e);
1173
+ e.fn = wrapEffectFnWithDevtoolsTiming(e, fn);
1563
1174
  const prevSub = activeSub;
1564
1175
  if (prevSub !== void 0) link(e, prevSub, 0);
1565
1176
  activeSub = e;
1566
1177
  let didThrow = false;
1567
1178
  let thrown;
1568
1179
  try {
1569
- if (isDev5) effectRunDevtools(e);
1570
- fn();
1180
+ e.fn();
1571
1181
  } catch (err) {
1572
1182
  didThrow = true;
1573
1183
  thrown = err;
@@ -1584,7 +1194,7 @@ function effect(fn) {
1584
1194
  disposer[EFFECT_MARKER] = true;
1585
1195
  return disposer;
1586
1196
  }
1587
- function effectWithCleanup(fn, cleanupRunner, root) {
1197
+ function effectWithCleanup(fn, cleanupRunner, root, options2) {
1588
1198
  const e = {
1589
1199
  fn,
1590
1200
  subs: void 0,
@@ -1593,21 +1203,23 @@ function effectWithCleanup(fn, cleanupRunner, root) {
1593
1203
  depsTail: void 0,
1594
1204
  flags: WatchingRunning,
1595
1205
  runCleanup: cleanupRunner,
1206
+ ...options2?.name !== void 0 ? { name: options2.name } : {},
1207
+ ...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
1596
1208
  __id: void 0
1597
1209
  };
1598
1210
  const resolvedRoot = root ?? getCurrentRoot();
1599
1211
  if (resolvedRoot) {
1600
1212
  e.root = resolvedRoot;
1601
1213
  }
1602
- if (isDev5) registerEffectDevtools(e);
1214
+ if (isDev4) registerEffectDevtools(e);
1215
+ e.fn = wrapEffectFnWithDevtoolsTiming(e, fn);
1603
1216
  const prevSub = activeSub;
1604
1217
  if (prevSub !== void 0) link(e, prevSub, 0);
1605
1218
  activeSub = e;
1606
1219
  let didThrow = false;
1607
1220
  let thrown;
1608
1221
  try {
1609
- if (isDev5) effectRunDevtools(e);
1610
- fn();
1222
+ e.fn();
1611
1223
  } catch (err) {
1612
1224
  didThrow = true;
1613
1225
  thrown = err;
@@ -1654,7 +1266,11 @@ function effectScopeOper() {
1654
1266
  disposeNode(this);
1655
1267
  }
1656
1268
  function batch(fn) {
1269
+ const enteringOuterBatch = batchDepth === 0;
1657
1270
  ++batchDepth;
1271
+ if (enteringOuterBatch && isDev4) {
1272
+ batchStartDevtools();
1273
+ }
1658
1274
  let result;
1659
1275
  let error;
1660
1276
  try {
@@ -1664,6 +1280,9 @@ function batch(fn) {
1664
1280
  } finally {
1665
1281
  --batchDepth;
1666
1282
  if (batchDepth === 0) {
1283
+ if (isDev4) {
1284
+ batchEndDevtools();
1285
+ }
1667
1286
  try {
1668
1287
  flush();
1669
1288
  } catch (flushErr) {
@@ -1694,6 +1313,7 @@ function __resetReactiveState() {
1694
1313
  cycle = 0;
1695
1314
  currentFlushId = 0;
1696
1315
  activeCleanupFlushId = 0;
1316
+ clearDevtoolsSignalSetters();
1697
1317
  }
1698
1318
  function untrack(fn) {
1699
1319
  const prev = activeSub;
@@ -1724,18 +1344,49 @@ function setTransitionContext(value) {
1724
1344
  var registerSignalDevtools = () => void 0;
1725
1345
  var updateSignalDevtools = () => {
1726
1346
  };
1347
+ var disposeSignalDevtools = () => {
1348
+ };
1727
1349
  var registerComputedDevtools = () => void 0;
1728
1350
  var updateComputedDevtools = () => {
1729
1351
  };
1352
+ var disposeComputedDevtools = () => {
1353
+ };
1730
1354
  var registerEffectDevtools = () => void 0;
1731
1355
  var effectRunDevtools = () => {
1732
1356
  };
1357
+ var wrapEffectFnWithDevtoolsTiming = (_node, fn) => fn;
1358
+ var effectCleanupDevtools = () => {
1359
+ };
1360
+ var disposeEffectDevtools = () => {
1361
+ };
1733
1362
  var trackDependencyDevtools = () => {
1734
1363
  };
1735
1364
  var untrackDependencyDevtools = () => {
1736
1365
  };
1737
- if (isDev5) {
1366
+ var batchStartDevtools = () => {
1367
+ };
1368
+ var batchEndDevtools = () => {
1369
+ };
1370
+ var flushStartDevtools = () => {
1371
+ };
1372
+ var flushEndDevtools = () => {
1373
+ };
1374
+ var clearDevtoolsSignalSetters = () => {
1375
+ };
1376
+ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
1738
1377
  let nextDevtoolsId = 0;
1378
+ const getSignalSetterMap = () => {
1379
+ if (typeof globalThis === "undefined") return void 0;
1380
+ const global = globalThis;
1381
+ if (!global.__FICT_DEVTOOLS_SIGNALS__) {
1382
+ global.__FICT_DEVTOOLS_SIGNALS__ = /* @__PURE__ */ new Map();
1383
+ }
1384
+ return global.__FICT_DEVTOOLS_SIGNALS__;
1385
+ };
1386
+ const getExistingSignalSetterMap = () => {
1387
+ if (typeof globalThis === "undefined") return void 0;
1388
+ return globalThis.__FICT_DEVTOOLS_SIGNALS__;
1389
+ };
1739
1390
  registerSignalDevtools = (node) => {
1740
1391
  const hook = getDevtoolsHook();
1741
1392
  if (!hook) return void 0;
@@ -1747,6 +1398,9 @@ if (isDev5) {
1747
1398
  if (ownerId !== void 0) options2.ownerId = ownerId;
1748
1399
  hook.registerSignal(id, node.currentValue, options2);
1749
1400
  node.__id = id;
1401
+ getSignalSetterMap()?.set(id, (value) => {
1402
+ signalOper.call(node, value);
1403
+ });
1750
1404
  return id;
1751
1405
  };
1752
1406
  updateSignalDevtools = (node, value) => {
@@ -1755,9 +1409,19 @@ if (isDev5) {
1755
1409
  const id = node.__id;
1756
1410
  if (id) hook.updateSignal(id, value);
1757
1411
  };
1412
+ disposeSignalDevtools = (node) => {
1413
+ const identifiable = node;
1414
+ const id = identifiable.__id;
1415
+ if (!id) return;
1416
+ const hook = getDevtoolsHook();
1417
+ hook?.disposeSignal?.(id);
1418
+ getExistingSignalSetterMap()?.delete(id);
1419
+ delete identifiable.__id;
1420
+ };
1758
1421
  registerComputedDevtools = (node) => {
1759
1422
  const hook = getDevtoolsHook();
1760
1423
  if (!hook) return void 0;
1424
+ if (node.devToolsInternal) return void 0;
1761
1425
  const id = ++nextDevtoolsId;
1762
1426
  const options2 = {};
1763
1427
  if (node.name !== void 0) options2.name = node.name;
@@ -1775,20 +1439,55 @@ if (isDev5) {
1775
1439
  const id = node.__id;
1776
1440
  if (id) hook.updateComputed(id, value);
1777
1441
  };
1442
+ disposeComputedDevtools = (node) => {
1443
+ const identifiable = node;
1444
+ const id = identifiable.__id;
1445
+ if (!id) return;
1446
+ const hook = getDevtoolsHook();
1447
+ hook?.disposeComputed?.(id);
1448
+ delete identifiable.__id;
1449
+ };
1778
1450
  registerEffectDevtools = (node) => {
1779
1451
  const hook = getDevtoolsHook();
1780
1452
  if (!hook) return void 0;
1781
1453
  const id = ++nextDevtoolsId;
1454
+ const options2 = {};
1782
1455
  const ownerId = __fictGetCurrentComponentId();
1783
- hook.registerEffect(id, ownerId !== void 0 ? { ownerId } : void 0);
1456
+ if (ownerId !== void 0) options2.ownerId = ownerId;
1457
+ if (node.devToolsSource !== void 0) options2.source = node.devToolsSource;
1458
+ hook.registerEffect(id, Object.keys(options2).length > 0 ? options2 : void 0);
1784
1459
  node.__id = id;
1785
1460
  return id;
1786
1461
  };
1787
- effectRunDevtools = (node) => {
1462
+ effectRunDevtools = (node, duration) => {
1463
+ const hook = getDevtoolsHook();
1464
+ if (!hook) return;
1465
+ const id = node.__id;
1466
+ if (id) hook.effectRun(id, duration);
1467
+ };
1468
+ wrapEffectFnWithDevtoolsTiming = (node, fn) => {
1469
+ return () => {
1470
+ const startedAt = performance.now();
1471
+ try {
1472
+ fn();
1473
+ } finally {
1474
+ effectRunDevtools(node, performance.now() - startedAt);
1475
+ }
1476
+ };
1477
+ };
1478
+ effectCleanupDevtools = (node) => {
1788
1479
  const hook = getDevtoolsHook();
1789
1480
  if (!hook) return;
1790
1481
  const id = node.__id;
1791
- if (id) hook.effectRun(id);
1482
+ if (id) hook.effectCleanup?.(id);
1483
+ };
1484
+ disposeEffectDevtools = (node) => {
1485
+ const identifiable = node;
1486
+ const id = identifiable.__id;
1487
+ if (!id) return;
1488
+ const hook = getDevtoolsHook();
1489
+ hook?.disposeEffect?.(id);
1490
+ delete identifiable.__id;
1792
1491
  };
1793
1492
  trackDependencyDevtools = (dep, sub) => {
1794
1493
  const hook = getDevtoolsHook();
@@ -1804,6 +1503,25 @@ if (isDev5) {
1804
1503
  const subId = sub.__id;
1805
1504
  if (depId && subId) hook.untrackDependency(subId, depId);
1806
1505
  };
1506
+ batchStartDevtools = () => {
1507
+ const hook = getDevtoolsHook();
1508
+ hook?.batchStart?.();
1509
+ };
1510
+ batchEndDevtools = () => {
1511
+ const hook = getDevtoolsHook();
1512
+ hook?.batchEnd?.();
1513
+ };
1514
+ flushStartDevtools = () => {
1515
+ const hook = getDevtoolsHook();
1516
+ hook?.flushStart?.();
1517
+ };
1518
+ flushEndDevtools = () => {
1519
+ const hook = getDevtoolsHook();
1520
+ hook?.flushEnd?.();
1521
+ };
1522
+ clearDevtoolsSignalSetters = () => {
1523
+ getExistingSignalSetterMap()?.clear();
1524
+ };
1807
1525
  }
1808
1526
  function createSelector(source, equalityFn = (a, b) => a === b) {
1809
1527
  let current = source();
@@ -1832,10 +1550,458 @@ function createSelector(source, equalityFn = (a, b) => a === b) {
1832
1550
  };
1833
1551
  }
1834
1552
 
1835
- // src/memo.ts
1836
- function createMemo(fn, options2) {
1837
- return computed(fn, options2);
1553
+ // src/effect.ts
1554
+ function createEffect(fn, options2) {
1555
+ let cleanups = [];
1556
+ const rootForError = getCurrentRoot();
1557
+ const doCleanup = () => {
1558
+ runCleanupList(cleanups);
1559
+ cleanups = [];
1560
+ };
1561
+ const run = () => {
1562
+ const bucket = [];
1563
+ withEffectCleanups(bucket, () => {
1564
+ try {
1565
+ const maybeCleanup = fn();
1566
+ if (typeof maybeCleanup === "function") {
1567
+ bucket.push(maybeCleanup);
1568
+ }
1569
+ } catch (err) {
1570
+ if (handleSuspend(err, rootForError)) {
1571
+ return;
1572
+ }
1573
+ if (handleError(err, { source: "effect" }, rootForError)) {
1574
+ return;
1575
+ }
1576
+ throw err;
1577
+ }
1578
+ });
1579
+ cleanups = bucket;
1580
+ };
1581
+ const disposeEffect = effectWithCleanup(run, doCleanup, rootForError, options2);
1582
+ const teardown = () => {
1583
+ runCleanupList(cleanups);
1584
+ disposeEffect();
1585
+ };
1586
+ registerRootCleanup(teardown);
1587
+ return teardown;
1588
+ }
1589
+ function createRenderEffect(fn, options2) {
1590
+ let cleanup;
1591
+ const rootForError = getCurrentRoot();
1592
+ const doCleanup = () => {
1593
+ if (cleanup) {
1594
+ cleanup();
1595
+ cleanup = void 0;
1596
+ }
1597
+ };
1598
+ const run = () => {
1599
+ try {
1600
+ const maybeCleanup = fn();
1601
+ if (typeof maybeCleanup === "function") {
1602
+ cleanup = maybeCleanup;
1603
+ }
1604
+ } catch (err) {
1605
+ if (handleSuspend(err, rootForError)) {
1606
+ return;
1607
+ }
1608
+ const handled = handleError(err, { source: "effect" }, rootForError);
1609
+ if (handled) {
1610
+ return;
1611
+ }
1612
+ throw err;
1613
+ }
1614
+ };
1615
+ const disposeEffect = effectWithCleanup(run, doCleanup, rootForError, options2);
1616
+ const teardown = () => {
1617
+ if (cleanup) {
1618
+ cleanup();
1619
+ cleanup = void 0;
1620
+ }
1621
+ disposeEffect();
1622
+ };
1623
+ registerRootCleanup(teardown);
1624
+ return teardown;
1625
+ }
1626
+
1627
+ // src/delegated-events.ts
1628
+ var DelegatedEventNames = [
1629
+ "beforeinput",
1630
+ "click",
1631
+ "dblclick",
1632
+ "contextmenu",
1633
+ "focusin",
1634
+ "focusout",
1635
+ "input",
1636
+ "keydown",
1637
+ "keyup",
1638
+ "mousedown",
1639
+ "mousemove",
1640
+ "mouseout",
1641
+ "mouseover",
1642
+ "mouseup",
1643
+ "pointerdown",
1644
+ "pointermove",
1645
+ "pointerout",
1646
+ "pointerover",
1647
+ "pointerup",
1648
+ "touchend",
1649
+ "touchmove",
1650
+ "touchstart"
1651
+ ];
1652
+
1653
+ // src/constants.ts
1654
+ var isDev5 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
1655
+ var booleans = isDev5 ? [
1656
+ "allowfullscreen",
1657
+ "async",
1658
+ "alpha",
1659
+ // HTMLInputElement
1660
+ "autofocus",
1661
+ // HTMLElement prop
1662
+ "autoplay",
1663
+ "checked",
1664
+ "controls",
1665
+ "default",
1666
+ "disabled",
1667
+ "formnovalidate",
1668
+ "hidden",
1669
+ // HTMLElement prop
1670
+ "indeterminate",
1671
+ "inert",
1672
+ // HTMLElement prop
1673
+ "ismap",
1674
+ "loop",
1675
+ "multiple",
1676
+ "muted",
1677
+ "nomodule",
1678
+ "novalidate",
1679
+ "open",
1680
+ "playsinline",
1681
+ "readonly",
1682
+ "required",
1683
+ "reversed",
1684
+ "seamless",
1685
+ // HTMLIframeElement - non-standard
1686
+ "selected",
1687
+ // Experimental attributes
1688
+ "adauctionheaders",
1689
+ "browsingtopics",
1690
+ "credentialless",
1691
+ "defaultchecked",
1692
+ "defaultmuted",
1693
+ "defaultselected",
1694
+ "defer",
1695
+ "disablepictureinpicture",
1696
+ "disableremoteplayback",
1697
+ "preservespitch",
1698
+ "shadowrootclonable",
1699
+ "shadowrootcustomelementregistry",
1700
+ "shadowrootdelegatesfocus",
1701
+ "shadowrootserializable",
1702
+ "sharedstoragewritable"
1703
+ ] : [];
1704
+ var BooleanAttributes = new Set(booleans);
1705
+ var properties = isDev5 ? [
1706
+ // Core properties
1707
+ "className",
1708
+ "value",
1709
+ // CamelCase booleans
1710
+ "readOnly",
1711
+ "noValidate",
1712
+ "formNoValidate",
1713
+ "isMap",
1714
+ "noModule",
1715
+ "playsInline",
1716
+ // Experimental (camelCase)
1717
+ "adAuctionHeaders",
1718
+ "allowFullscreen",
1719
+ "browsingTopics",
1720
+ "defaultChecked",
1721
+ "defaultMuted",
1722
+ "defaultSelected",
1723
+ "disablePictureInPicture",
1724
+ "disableRemotePlayback",
1725
+ "preservesPitch",
1726
+ "shadowRootClonable",
1727
+ "shadowRootCustomElementRegistry",
1728
+ "shadowRootDelegatesFocus",
1729
+ "shadowRootSerializable",
1730
+ "sharedStorageWritable",
1731
+ // All lowercase booleans
1732
+ ...booleans
1733
+ ] : [];
1734
+ var Properties = new Set(properties);
1735
+ var ChildProperties = /* @__PURE__ */ new Set([
1736
+ "innerHTML",
1737
+ "textContent",
1738
+ "innerText",
1739
+ "children"
1740
+ ]);
1741
+ var Aliases = {
1742
+ className: "class",
1743
+ htmlFor: "for"
1744
+ };
1745
+ var PropAliases = isDev5 ? {
1746
+ // Direct mapping
1747
+ class: "className",
1748
+ // Element-specific mappings
1749
+ novalidate: {
1750
+ $: "noValidate",
1751
+ FORM: 1
1752
+ },
1753
+ formnovalidate: {
1754
+ $: "formNoValidate",
1755
+ BUTTON: 1,
1756
+ INPUT: 1
1757
+ },
1758
+ ismap: {
1759
+ $: "isMap",
1760
+ IMG: 1
1761
+ },
1762
+ nomodule: {
1763
+ $: "noModule",
1764
+ SCRIPT: 1
1765
+ },
1766
+ playsinline: {
1767
+ $: "playsInline",
1768
+ VIDEO: 1
1769
+ },
1770
+ readonly: {
1771
+ $: "readOnly",
1772
+ INPUT: 1,
1773
+ TEXTAREA: 1
1774
+ },
1775
+ // Experimental element-specific
1776
+ adauctionheaders: {
1777
+ $: "adAuctionHeaders",
1778
+ IFRAME: 1
1779
+ },
1780
+ allowfullscreen: {
1781
+ $: "allowFullscreen",
1782
+ IFRAME: 1
1783
+ },
1784
+ browsingtopics: {
1785
+ $: "browsingTopics",
1786
+ IMG: 1
1787
+ },
1788
+ defaultchecked: {
1789
+ $: "defaultChecked",
1790
+ INPUT: 1
1791
+ },
1792
+ defaultmuted: {
1793
+ $: "defaultMuted",
1794
+ AUDIO: 1,
1795
+ VIDEO: 1
1796
+ },
1797
+ defaultselected: {
1798
+ $: "defaultSelected",
1799
+ OPTION: 1
1800
+ },
1801
+ disablepictureinpicture: {
1802
+ $: "disablePictureInPicture",
1803
+ VIDEO: 1
1804
+ },
1805
+ disableremoteplayback: {
1806
+ $: "disableRemotePlayback",
1807
+ AUDIO: 1,
1808
+ VIDEO: 1
1809
+ },
1810
+ preservespitch: {
1811
+ $: "preservesPitch",
1812
+ AUDIO: 1,
1813
+ VIDEO: 1
1814
+ },
1815
+ shadowrootclonable: {
1816
+ $: "shadowRootClonable",
1817
+ TEMPLATE: 1
1818
+ },
1819
+ shadowrootdelegatesfocus: {
1820
+ $: "shadowRootDelegatesFocus",
1821
+ TEMPLATE: 1
1822
+ },
1823
+ shadowrootserializable: {
1824
+ $: "shadowRootSerializable",
1825
+ TEMPLATE: 1
1826
+ },
1827
+ sharedstoragewritable: {
1828
+ $: "sharedStorageWritable",
1829
+ IFRAME: 1,
1830
+ IMG: 1
1831
+ }
1832
+ } : {};
1833
+ function getPropAlias(prop, tagName) {
1834
+ if (!isDev5) return void 0;
1835
+ const a = PropAliases[prop];
1836
+ if (typeof a === "object") {
1837
+ return a[tagName] ? a["$"] : void 0;
1838
+ }
1839
+ return a;
1838
1840
  }
1841
+ var $$EVENTS = "_$FICT_DELEGATE";
1842
+ var DelegatedEvents = new Set(DelegatedEventNames);
1843
+ var svgElements = isDev5 ? [
1844
+ "altGlyph",
1845
+ "altGlyphDef",
1846
+ "altGlyphItem",
1847
+ "animate",
1848
+ "animateColor",
1849
+ "animateMotion",
1850
+ "animateTransform",
1851
+ "circle",
1852
+ "clipPath",
1853
+ "color-profile",
1854
+ "cursor",
1855
+ "defs",
1856
+ "desc",
1857
+ "ellipse",
1858
+ "feBlend",
1859
+ "feColorMatrix",
1860
+ "feComponentTransfer",
1861
+ "feComposite",
1862
+ "feConvolveMatrix",
1863
+ "feDiffuseLighting",
1864
+ "feDisplacementMap",
1865
+ "feDistantLight",
1866
+ "feDropShadow",
1867
+ "feFlood",
1868
+ "feFuncA",
1869
+ "feFuncB",
1870
+ "feFuncG",
1871
+ "feFuncR",
1872
+ "feGaussianBlur",
1873
+ "feImage",
1874
+ "feMerge",
1875
+ "feMergeNode",
1876
+ "feMorphology",
1877
+ "feOffset",
1878
+ "fePointLight",
1879
+ "feSpecularLighting",
1880
+ "feSpotLight",
1881
+ "feTile",
1882
+ "feTurbulence",
1883
+ "filter",
1884
+ "font",
1885
+ "font-face",
1886
+ "font-face-format",
1887
+ "font-face-name",
1888
+ "font-face-src",
1889
+ "font-face-uri",
1890
+ "foreignObject",
1891
+ "g",
1892
+ "glyph",
1893
+ "glyphRef",
1894
+ "hkern",
1895
+ "image",
1896
+ "line",
1897
+ "linearGradient",
1898
+ "marker",
1899
+ "mask",
1900
+ "metadata",
1901
+ "missing-glyph",
1902
+ "mpath",
1903
+ "path",
1904
+ "pattern",
1905
+ "polygon",
1906
+ "polyline",
1907
+ "radialGradient",
1908
+ "rect",
1909
+ "set",
1910
+ "stop",
1911
+ "svg",
1912
+ "switch",
1913
+ "symbol",
1914
+ "text",
1915
+ "textPath",
1916
+ "tref",
1917
+ "tspan",
1918
+ "use",
1919
+ "view",
1920
+ "vkern"
1921
+ ] : [];
1922
+ var SVGElements = new Set(svgElements);
1923
+ var SVGNamespace = {
1924
+ xlink: "http://www.w3.org/1999/xlink",
1925
+ xml: "http://www.w3.org/XML/1998/namespace"
1926
+ };
1927
+ var unitlessList = isDev5 ? [
1928
+ "animationIterationCount",
1929
+ "animation-iteration-count",
1930
+ "borderImageOutset",
1931
+ "border-image-outset",
1932
+ "borderImageSlice",
1933
+ "border-image-slice",
1934
+ "borderImageWidth",
1935
+ "border-image-width",
1936
+ "boxFlex",
1937
+ "box-flex",
1938
+ "boxFlexGroup",
1939
+ "box-flex-group",
1940
+ "boxOrdinalGroup",
1941
+ "box-ordinal-group",
1942
+ "columnCount",
1943
+ "column-count",
1944
+ "columns",
1945
+ "flex",
1946
+ "flexGrow",
1947
+ "flex-grow",
1948
+ "flexPositive",
1949
+ "flex-positive",
1950
+ "flexShrink",
1951
+ "flex-shrink",
1952
+ "flexNegative",
1953
+ "flex-negative",
1954
+ "flexOrder",
1955
+ "flex-order",
1956
+ "gridRow",
1957
+ "grid-row",
1958
+ "gridRowEnd",
1959
+ "grid-row-end",
1960
+ "gridRowSpan",
1961
+ "grid-row-span",
1962
+ "gridRowStart",
1963
+ "grid-row-start",
1964
+ "gridColumn",
1965
+ "grid-column",
1966
+ "gridColumnEnd",
1967
+ "grid-column-end",
1968
+ "gridColumnSpan",
1969
+ "grid-column-span",
1970
+ "gridColumnStart",
1971
+ "grid-column-start",
1972
+ "fontWeight",
1973
+ "font-weight",
1974
+ "lineClamp",
1975
+ "line-clamp",
1976
+ "lineHeight",
1977
+ "line-height",
1978
+ "opacity",
1979
+ "order",
1980
+ "orphans",
1981
+ "tabSize",
1982
+ "tab-size",
1983
+ "widows",
1984
+ "zIndex",
1985
+ "z-index",
1986
+ "zoom",
1987
+ "fillOpacity",
1988
+ "fill-opacity",
1989
+ "floodOpacity",
1990
+ "flood-opacity",
1991
+ "stopOpacity",
1992
+ "stop-opacity",
1993
+ "strokeDasharray",
1994
+ "stroke-dasharray",
1995
+ "strokeDashoffset",
1996
+ "stroke-dashoffset",
1997
+ "strokeMiterlimit",
1998
+ "stroke-miterlimit",
1999
+ "strokeOpacity",
2000
+ "stroke-opacity",
2001
+ "strokeWidth",
2002
+ "stroke-width"
2003
+ ] : ["opacity", "zIndex"];
2004
+ var UnitlessStyles = new Set(unitlessList);
1839
2005
 
1840
2006
  // src/ssr-stream.ts
1841
2007
  var ssrStreamHooks = null;
@@ -2081,6 +2247,7 @@ function reconcile(target, value, seenPairs) {
2081
2247
  }
2082
2248
 
2083
2249
  // src/resume.ts
2250
+ var FICT_SSR_SNAPSHOT_SCHEMA_VERSION = 1;
2084
2251
  var ssrEnabled = false;
2085
2252
  var resumableEnabled = false;
2086
2253
  var hydrating = false;
@@ -2180,7 +2347,7 @@ function __fictSerializeSSRState() {
2180
2347
  }
2181
2348
  scopes[id] = snapshot;
2182
2349
  }
2183
- return { scopes };
2350
+ return { v: FICT_SSR_SNAPSHOT_SCHEMA_VERSION, scopes };
2184
2351
  }
2185
2352
  function __fictSerializeSSRStateForScopes(scopeIds) {
2186
2353
  const scopes = {};
@@ -2202,7 +2369,7 @@ function __fictSerializeSSRStateForScopes(scopeIds) {
2202
2369
  }
2203
2370
  scopes[id] = snapshot;
2204
2371
  }
2205
- return { scopes };
2372
+ return { v: FICT_SSR_SNAPSHOT_SCHEMA_VERSION, scopes };
2206
2373
  }
2207
2374
  function __fictSetSSRState(state) {
2208
2375
  snapshotState = state;
@@ -2213,7 +2380,7 @@ function __fictSetSSRState(state) {
2213
2380
  function __fictMergeSSRState(state) {
2214
2381
  if (!state) return;
2215
2382
  if (!snapshotState) {
2216
- snapshotState = { scopes: { ...state.scopes } };
2383
+ snapshotState = { v: state.v, scopes: { ...state.scopes } };
2217
2384
  return;
2218
2385
  }
2219
2386
  Object.assign(snapshotState.scopes, state.scopes);
@@ -2465,16 +2632,6 @@ function deserializeValue(value, refs = /* @__PURE__ */ new Map(), path = "$") {
2465
2632
  }
2466
2633
 
2467
2634
  export {
2468
- BooleanAttributes,
2469
- Properties,
2470
- ChildProperties,
2471
- Aliases,
2472
- getPropAlias,
2473
- $$EVENTS,
2474
- DelegatedEvents,
2475
- SVGElements,
2476
- SVGNamespace,
2477
- UnitlessStyles,
2478
2635
  getDevtoolsHook,
2479
2636
  setCycleProtectionOptions,
2480
2637
  createRootContext,
@@ -2492,7 +2649,8 @@ export {
2492
2649
  registerSuspenseHandler,
2493
2650
  handleError,
2494
2651
  handleSuspend,
2495
- createMemo,
2652
+ createEffect,
2653
+ createRenderEffect,
2496
2654
  __fictUseContext,
2497
2655
  __fictPushContext,
2498
2656
  __fictPrepareContext,
@@ -2518,8 +2676,17 @@ export {
2518
2676
  isEffectScope,
2519
2677
  setTransitionContext,
2520
2678
  createSelector,
2521
- createEffect,
2522
- createRenderEffect,
2679
+ createMemo,
2680
+ BooleanAttributes,
2681
+ Properties,
2682
+ ChildProperties,
2683
+ Aliases,
2684
+ getPropAlias,
2685
+ $$EVENTS,
2686
+ DelegatedEvents,
2687
+ SVGElements,
2688
+ SVGNamespace,
2689
+ UnitlessStyles,
2523
2690
  __fictSetSSRStreamHooks,
2524
2691
  __fictGetSSRStreamHooks,
2525
2692
  __fictPushSSRBoundary,
@@ -2527,6 +2694,7 @@ export {
2527
2694
  createStore,
2528
2695
  isStoreProxy,
2529
2696
  unwrapStore,
2697
+ FICT_SSR_SNAPSHOT_SCHEMA_VERSION,
2530
2698
  __fictEnableSSR,
2531
2699
  __fictDisableSSR,
2532
2700
  __fictEnableResumable,
@@ -2553,4 +2721,4 @@ export {
2553
2721
  serializeValue,
2554
2722
  deserializeValue
2555
2723
  };
2556
- //# sourceMappingURL=chunk-7YQK3XKY.js.map
2724
+ //# sourceMappingURL=chunk-F4RVNXOL.js.map