@fictjs/runtime 0.3.0 → 0.5.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 (70) hide show
  1. package/dist/advanced.cjs +10 -8
  2. package/dist/advanced.cjs.map +1 -1
  3. package/dist/advanced.d.cts +4 -3
  4. package/dist/advanced.d.ts +4 -3
  5. package/dist/advanced.js +10 -8
  6. package/dist/advanced.js.map +1 -1
  7. package/dist/{chunk-TWELIZRY.js → chunk-5AA7HP4S.js} +5 -3
  8. package/dist/{chunk-TWELIZRY.js.map → chunk-5AA7HP4S.js.map} +1 -1
  9. package/dist/chunk-6SOPF5LZ.cjs +2363 -0
  10. package/dist/chunk-6SOPF5LZ.cjs.map +1 -0
  11. package/dist/{chunk-SO6X7G5S.js → chunk-BQG7VEBY.js} +501 -1880
  12. package/dist/chunk-BQG7VEBY.js.map +1 -0
  13. package/dist/chunk-FKDMDAUR.js +2363 -0
  14. package/dist/chunk-FKDMDAUR.js.map +1 -0
  15. package/dist/{chunk-L4DIV3RC.cjs → chunk-GHUV2FLD.cjs} +9 -7
  16. package/dist/chunk-GHUV2FLD.cjs.map +1 -0
  17. package/dist/{chunk-XLIZJMMJ.js → chunk-KKKYW54Z.js} +8 -6
  18. package/dist/{chunk-XLIZJMMJ.js.map → chunk-KKKYW54Z.js.map} +1 -1
  19. package/dist/{chunk-M2TSXZ4C.cjs → chunk-KYLNC4CD.cjs} +18 -16
  20. package/dist/chunk-KYLNC4CD.cjs.map +1 -0
  21. package/dist/chunk-TKWN42TA.cjs +2259 -0
  22. package/dist/chunk-TKWN42TA.cjs.map +1 -0
  23. package/dist/{context-B25xyQrJ.d.cts → context-CTBE00S_.d.cts} +1 -1
  24. package/dist/{context-CGdP7_Jb.d.ts → context-lkLhbkFJ.d.ts} +1 -1
  25. package/dist/{effect-D6kaLM2-.d.cts → effect-BpSNEJJz.d.cts} +7 -67
  26. package/dist/{effect-D6kaLM2-.d.ts → effect-BpSNEJJz.d.ts} +7 -67
  27. package/dist/index.cjs +40 -38
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +5 -4
  30. package/dist/index.d.ts +5 -4
  31. package/dist/index.dev.js +92 -4
  32. package/dist/index.dev.js.map +1 -1
  33. package/dist/index.js +19 -17
  34. package/dist/index.js.map +1 -1
  35. package/dist/internal.cjs +189 -202
  36. package/dist/internal.cjs.map +1 -1
  37. package/dist/internal.d.cts +13 -23
  38. package/dist/internal.d.ts +13 -23
  39. package/dist/internal.js +195 -208
  40. package/dist/internal.js.map +1 -1
  41. package/dist/loader.cjs +280 -0
  42. package/dist/loader.cjs.map +1 -0
  43. package/dist/loader.d.cts +57 -0
  44. package/dist/loader.d.ts +57 -0
  45. package/dist/loader.js +280 -0
  46. package/dist/loader.js.map +1 -0
  47. package/dist/{props-BIfromL0.d.cts → props-XTHYD19o.d.cts} +13 -2
  48. package/dist/{props-BEgIVMRx.d.ts → props-x-HbI-jX.d.ts} +13 -2
  49. package/dist/resume-BrAkmSTY.d.cts +79 -0
  50. package/dist/resume-Dx8_l72o.d.ts +79 -0
  51. package/dist/{scope-CzNkn587.d.ts → scope-CdbGmsFf.d.ts} +1 -1
  52. package/dist/{scope-Cx_3CjIZ.d.cts → scope-DfcP9I-A.d.cts} +1 -1
  53. package/dist/signal-C4ISF17w.d.cts +66 -0
  54. package/dist/signal-C4ISF17w.d.ts +66 -0
  55. package/package.json +8 -3
  56. package/src/binding.ts +254 -5
  57. package/src/dom.ts +103 -5
  58. package/src/hooks.ts +15 -2
  59. package/src/hydration.ts +75 -0
  60. package/src/internal.ts +34 -2
  61. package/src/list-helpers.ts +113 -12
  62. package/src/loader.ts +437 -0
  63. package/src/node-ops.ts +65 -0
  64. package/src/resume.ts +517 -0
  65. package/src/store.ts +8 -0
  66. package/dist/chunk-ID3WBWNO.cjs +0 -3638
  67. package/dist/chunk-ID3WBWNO.cjs.map +0 -1
  68. package/dist/chunk-L4DIV3RC.cjs.map +0 -1
  69. package/dist/chunk-M2TSXZ4C.cjs.map +0 -1
  70. package/dist/chunk-SO6X7G5S.js.map +0 -1
@@ -1,1775 +1,46 @@
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(prop2, tagName) {
208
- if (!isDev) return void 0;
209
- const a = PropAliases[prop2];
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
- // src/devtools.ts
381
- function getGlobalHook() {
382
- if (typeof globalThis === "undefined") return void 0;
383
- return globalThis.__FICT_DEVTOOLS_HOOK__;
384
- }
385
- function getDevtoolsHook() {
386
- return getGlobalHook();
387
- }
388
-
389
- // src/cycle-guard.ts
390
- var isDev2 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
391
- var setCycleProtectionOptions = () => {
392
- };
393
- var resetCycleProtectionStateForTests = () => {
394
- };
395
- var beginFlushGuard = () => {
396
- };
397
- var beforeEffectRunGuard = () => true;
398
- var endFlushGuard = () => {
399
- };
400
- var enterRootGuard = () => true;
401
- var exitRootGuard = () => {
402
- };
403
- var defaultOptions = {
404
- enabled: true,
405
- maxFlushCyclesPerMicrotask: 1e4,
406
- maxEffectRunsPerFlush: 2e4,
407
- windowSize: 5,
408
- highUsageRatio: 0.8,
409
- maxRootReentrantDepth: 10,
410
- enableWindowWarning: true,
411
- devMode: isDev2,
412
- // Backoff warning options
413
- enableBackoffWarning: isDev2,
414
- backoffWarningRatio: 0.5
415
- };
416
- var enabled = defaultOptions.enabled;
417
- var options = {
418
- ...defaultOptions
419
- };
420
- var effectRunsThisFlush = 0;
421
- var windowUsage = [];
422
- var rootDepth = /* @__PURE__ */ new WeakMap();
423
- var flushWarned = false;
424
- var rootWarned = false;
425
- var windowWarned = false;
426
- var backoffWarned50 = false;
427
- var backoffWarned75 = false;
428
- setCycleProtectionOptions = (opts) => {
429
- if (typeof opts.enabled === "boolean") {
430
- enabled = opts.enabled;
431
- }
432
- options = { ...options, ...opts };
433
- };
434
- resetCycleProtectionStateForTests = () => {
435
- options = { ...defaultOptions };
436
- enabled = defaultOptions.enabled;
437
- effectRunsThisFlush = 0;
438
- windowUsage = [];
439
- rootDepth = /* @__PURE__ */ new WeakMap();
440
- flushWarned = false;
441
- rootWarned = false;
442
- windowWarned = false;
443
- backoffWarned50 = false;
444
- backoffWarned75 = false;
445
- };
446
- beginFlushGuard = () => {
447
- if (!enabled) return;
448
- effectRunsThisFlush = 0;
449
- flushWarned = false;
450
- windowWarned = false;
451
- backoffWarned50 = false;
452
- backoffWarned75 = false;
453
- };
454
- beforeEffectRunGuard = () => {
455
- if (!enabled) return true;
456
- const next = ++effectRunsThisFlush;
457
- const limit = Math.min(options.maxFlushCyclesPerMicrotask, options.maxEffectRunsPerFlush);
458
- if (options.enableBackoffWarning && isDev2) {
459
- const ratio = next / limit;
460
- const backoffRatio = options.backoffWarningRatio ?? 0.5;
461
- if (!backoffWarned50 && ratio >= backoffRatio && ratio < backoffRatio + 0.25) {
462
- backoffWarned50 = true;
463
- console.warn(
464
- `[fict] cycle guard: approaching effect limit (${Math.round(ratio * 100)}% of budget used)
465
- - Current: ${next} effects, Limit: ${limit}
466
- - Tip: Check for effects that trigger other effects in a loop.
467
- - Common causes: signal updates inside effects that read and write the same signal.`
468
- );
469
- } else if (!backoffWarned75 && ratio >= backoffRatio + 0.25 && ratio < 1) {
470
- backoffWarned75 = true;
471
- console.warn(
472
- `[fict] cycle guard: nearing effect limit (${Math.round(ratio * 100)}% of budget used)
473
- - Current: ${next} effects, Limit: ${limit}
474
- - Warning: Consider breaking the reactive dependency cycle.
475
- - Debug: Use browser devtools to identify the recursive effect chain.`
476
- );
477
- }
478
- }
479
- if (next > limit) {
480
- const message = `[fict] cycle protection triggered: flush-budget-exceeded`;
481
- if (options.devMode) {
482
- throw new Error(
483
- message + `
484
- - Effect runs: ${next}, Limit: ${limit}
485
- - This indicates a reactive cycle where effects keep triggering each other.
486
- - Check for patterns like: createEffect(() => { signal(); signal(newValue); })`
487
- );
488
- }
489
- if (!flushWarned) {
490
- flushWarned = true;
491
- console.warn(message, { effectRuns: next, limit });
492
- }
493
- return false;
494
- }
495
- return true;
496
- };
497
- endFlushGuard = () => {
498
- if (!enabled) return;
499
- recordWindowUsage(effectRunsThisFlush, options.maxFlushCyclesPerMicrotask);
500
- effectRunsThisFlush = 0;
501
- };
502
- enterRootGuard = (root) => {
503
- if (!enabled) return true;
504
- const depth = (rootDepth.get(root) ?? 0) + 1;
505
- if (depth > options.maxRootReentrantDepth) {
506
- const message = `[fict] cycle protection triggered: root-reentry`;
507
- if (options.devMode) {
508
- throw new Error(
509
- message + `
510
- - Re-entry depth: ${depth}, Max allowed: ${options.maxRootReentrantDepth}
511
- - This indicates recursive render() or component initialization.
512
- - Check for components that trigger re-renders during their own render phase.`
513
- );
514
- }
515
- if (!rootWarned) {
516
- rootWarned = true;
517
- console.warn(message, { depth, maxAllowed: options.maxRootReentrantDepth });
518
- }
519
- return false;
520
- }
521
- rootDepth.set(root, depth);
522
- return true;
523
- };
524
- exitRootGuard = (root) => {
525
- if (!enabled) return;
526
- const depth = rootDepth.get(root);
527
- if (depth === void 0) return;
528
- if (depth <= 1) {
529
- rootDepth.delete(root);
530
- } else {
531
- rootDepth.set(root, depth - 1);
532
- }
533
- };
534
- var recordWindowUsage = (used, budget) => {
535
- if (!options.enableWindowWarning) return;
536
- const entry = { used, budget };
537
- windowUsage.push(entry);
538
- if (windowUsage.length > options.windowSize) {
539
- windowUsage.shift();
540
- }
541
- if (windowWarned) return;
542
- if (windowUsage.length >= options.windowSize && windowUsage.every((item) => item.budget > 0 && item.used / item.budget >= options.highUsageRatio)) {
543
- windowWarned = true;
544
- reportCycle("high-usage-window", {
545
- windowSize: options.windowSize,
546
- ratio: options.highUsageRatio
547
- });
548
- }
549
- };
550
- var reportCycle = (reason, detail = void 0) => {
551
- const hook = getDevtoolsHook();
552
- hook?.cycleDetected?.(detail ? { reason, detail } : { reason });
553
- console.warn(`[fict] cycle protection triggered: ${reason}`, detail ?? "");
554
- };
555
-
556
- // src/lifecycle.ts
557
- var isDev3 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
558
- var currentRoot;
559
- var currentEffectCleanups;
560
- var globalErrorHandlers = /* @__PURE__ */ new WeakMap();
561
- var globalSuspenseHandlers = /* @__PURE__ */ new WeakMap();
562
- function createRootContext(parent) {
563
- return { parent, cleanups: [], destroyCallbacks: [], suspended: false };
564
- }
565
- function pushRoot(root) {
566
- if (!enterRootGuard(root)) {
567
- return currentRoot;
568
- }
569
- const prev = currentRoot;
570
- currentRoot = root;
571
- return prev;
572
- }
573
- function getCurrentRoot() {
574
- return currentRoot;
575
- }
576
- function popRoot(prev) {
577
- if (currentRoot) {
578
- exitRootGuard(currentRoot);
579
- }
580
- currentRoot = prev;
581
- }
582
- function onMount(fn) {
583
- if (currentRoot) {
584
- ;
585
- (currentRoot.onMountCallbacks || (currentRoot.onMountCallbacks = [])).push(fn);
586
- return;
587
- }
588
- runLifecycle(fn);
589
- }
590
- function onDestroy(fn) {
591
- if (currentRoot) {
592
- currentRoot.destroyCallbacks.push(() => runLifecycle(fn));
593
- return;
594
- }
595
- runLifecycle(fn);
596
- }
597
- function onCleanup(fn) {
598
- registerEffectCleanup(fn);
599
- }
600
- function flushOnMount(root) {
601
- const cbs = root.onMountCallbacks;
602
- if (!cbs || cbs.length === 0) return;
603
- const prevRoot = currentRoot;
604
- currentRoot = root;
605
- try {
606
- for (let i = 0; i < cbs.length; i++) {
607
- const cleanup = cbs[i]();
608
- if (typeof cleanup === "function") {
609
- root.cleanups.push(cleanup);
610
- }
611
- }
612
- } finally {
613
- currentRoot = prevRoot;
614
- cbs.length = 0;
615
- }
616
- }
617
- function registerRootCleanup(fn) {
618
- if (currentRoot) {
619
- currentRoot.cleanups.push(fn);
620
- }
621
- }
622
- function clearRoot(root) {
623
- runCleanupList(root.cleanups);
624
- if (root.onMountCallbacks) {
625
- root.onMountCallbacks.length = 0;
626
- }
627
- }
628
- function destroyRoot(root) {
629
- clearRoot(root);
630
- runCleanupList(root.destroyCallbacks);
631
- if (root.errorHandlers) {
632
- root.errorHandlers.length = 0;
633
- }
634
- if (globalErrorHandlers.has(root)) {
635
- globalErrorHandlers.delete(root);
636
- }
637
- if (root.suspenseHandlers) {
638
- root.suspenseHandlers.length = 0;
639
- }
640
- if (globalSuspenseHandlers.has(root)) {
641
- globalSuspenseHandlers.delete(root);
642
- }
643
- }
644
- function createRoot(fn, options2) {
645
- const parent = options2?.inherit ? currentRoot : void 0;
646
- const root = createRootContext(parent);
647
- const prev = pushRoot(root);
648
- let value;
649
- try {
650
- value = fn();
651
- } finally {
652
- popRoot(prev);
653
- }
654
- flushOnMount(root);
655
- return {
656
- dispose: () => destroyRoot(root),
657
- value
658
- };
659
- }
660
- function withEffectCleanups(bucket, fn) {
661
- const prev = currentEffectCleanups;
662
- currentEffectCleanups = bucket;
663
- try {
664
- return fn();
665
- } finally {
666
- currentEffectCleanups = prev;
667
- }
668
- }
669
- function registerEffectCleanup(fn) {
670
- if (currentEffectCleanups) {
671
- currentEffectCleanups.push(fn);
672
- } else {
673
- registerRootCleanup(fn);
674
- }
675
- }
676
- function runCleanupList(list) {
677
- let error;
678
- for (let i = list.length - 1; i >= 0; i--) {
679
- try {
680
- const cleanup = list[i];
681
- if (cleanup) cleanup();
682
- } catch (err) {
683
- if (error === void 0) {
684
- error = err;
685
- }
686
- }
687
- }
688
- list.length = 0;
689
- if (error !== void 0) {
690
- if (!handleError(error, { source: "cleanup" })) {
691
- throw error;
692
- }
693
- }
694
- }
695
- function runLifecycle(fn) {
696
- const cleanup = fn();
697
- if (typeof cleanup === "function") {
698
- cleanup();
699
- }
700
- }
701
- function registerErrorHandler(fn) {
702
- if (!currentRoot) {
703
- const message = isDev3 ? "registerErrorHandler must be called within a root" : "FICT:E_ROOT_HANDLER";
704
- throw new Error(message);
705
- }
706
- if (!currentRoot.errorHandlers) {
707
- currentRoot.errorHandlers = [];
708
- }
709
- currentRoot.errorHandlers.push(fn);
710
- const existing = globalErrorHandlers.get(currentRoot);
711
- if (existing) {
712
- existing.push(fn);
713
- } else {
714
- globalErrorHandlers.set(currentRoot, [fn]);
715
- }
716
- }
717
- function registerSuspenseHandler(fn) {
718
- if (!currentRoot) {
719
- const message = isDev3 ? "registerSuspenseHandler must be called within a root" : "FICT:E_ROOT_SUSPENSE";
720
- throw new Error(message);
721
- }
722
- if (!currentRoot.suspenseHandlers) {
723
- currentRoot.suspenseHandlers = [];
724
- }
725
- currentRoot.suspenseHandlers.push(fn);
726
- const existing = globalSuspenseHandlers.get(currentRoot);
727
- if (existing) {
728
- existing.push(fn);
729
- } else {
730
- globalSuspenseHandlers.set(currentRoot, [fn]);
731
- }
732
- }
733
- function handleError(err, info, startRoot) {
734
- let root = startRoot ?? currentRoot;
735
- let error = err;
736
- while (root) {
737
- const handlers = root.errorHandlers;
738
- if (handlers && handlers.length) {
739
- for (let i = handlers.length - 1; i >= 0; i--) {
740
- const handler = handlers[i];
741
- try {
742
- const handled = handler(error, info);
743
- if (handled !== false) {
744
- return true;
745
- }
746
- } catch (nextErr) {
747
- error = nextErr;
748
- }
749
- }
750
- }
751
- root = root.parent;
752
- }
753
- const globalForRoot = startRoot ? globalErrorHandlers.get(startRoot) : currentRoot ? globalErrorHandlers.get(currentRoot) : void 0;
754
- if (globalForRoot && globalForRoot.length) {
755
- for (let i = globalForRoot.length - 1; i >= 0; i--) {
756
- const handler = globalForRoot[i];
757
- try {
758
- const handled = handler(error, info);
759
- if (handled !== false) {
760
- return true;
761
- }
762
- } catch (nextErr) {
763
- error = nextErr;
764
- }
765
- }
766
- }
767
- return false;
768
- }
769
- function handleSuspend(token, startRoot) {
770
- let root = startRoot ?? currentRoot;
771
- const originRoot = root;
772
- while (root) {
773
- const handlers = root.suspenseHandlers;
774
- if (handlers && handlers.length) {
775
- for (let i = handlers.length - 1; i >= 0; i--) {
776
- const handler = handlers[i];
777
- const handled = handler(token);
778
- if (handled !== false) {
779
- if (originRoot) originRoot.suspended = true;
780
- return true;
781
- }
782
- }
783
- }
784
- root = root.parent;
785
- }
786
- const globalForRoot = startRoot && globalSuspenseHandlers.get(startRoot) ? globalSuspenseHandlers.get(startRoot) : currentRoot ? globalSuspenseHandlers.get(currentRoot) : void 0;
787
- if (globalForRoot && globalForRoot.length) {
788
- for (let i = globalForRoot.length - 1; i >= 0; i--) {
789
- const handler = globalForRoot[i];
790
- const handled = handler(token);
791
- if (handled !== false) {
792
- if (originRoot) originRoot.suspended = true;
793
- return true;
794
- }
795
- }
796
- }
797
- return false;
798
- }
799
-
800
- // src/effect.ts
801
- function createEffect(fn) {
802
- let cleanups = [];
803
- const rootForError = getCurrentRoot();
804
- const doCleanup = () => {
805
- runCleanupList(cleanups);
806
- cleanups = [];
807
- };
808
- const run = () => {
809
- const bucket = [];
810
- withEffectCleanups(bucket, () => {
811
- try {
812
- const maybeCleanup = fn();
813
- if (typeof maybeCleanup === "function") {
814
- bucket.push(maybeCleanup);
815
- }
816
- } catch (err) {
817
- if (handleSuspend(err, rootForError)) {
818
- return;
819
- }
820
- if (handleError(err, { source: "effect" }, rootForError)) {
821
- return;
822
- }
823
- throw err;
824
- }
825
- });
826
- cleanups = bucket;
827
- };
828
- const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
829
- const teardown = () => {
830
- runCleanupList(cleanups);
831
- disposeEffect();
832
- };
833
- registerRootCleanup(teardown);
834
- return teardown;
835
- }
836
- function createRenderEffect(fn) {
837
- let cleanup;
838
- const rootForError = getCurrentRoot();
839
- const doCleanup = () => {
840
- if (cleanup) {
841
- cleanup();
842
- cleanup = void 0;
843
- }
844
- };
845
- const run = () => {
846
- try {
847
- const maybeCleanup = fn();
848
- if (typeof maybeCleanup === "function") {
849
- cleanup = maybeCleanup;
850
- }
851
- } catch (err) {
852
- if (handleSuspend(err, rootForError)) {
853
- return;
854
- }
855
- const handled = handleError(err, { source: "effect" }, rootForError);
856
- if (handled) {
857
- return;
858
- }
859
- throw err;
860
- }
861
- };
862
- const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
863
- const teardown = () => {
864
- if (cleanup) {
865
- cleanup();
866
- cleanup = void 0;
867
- }
868
- disposeEffect();
869
- };
870
- registerRootCleanup(teardown);
871
- return teardown;
872
- }
873
-
874
- // src/hooks.ts
875
- var isDev4 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
876
- var ctxStack = [];
877
- function assertRenderContext(ctx, hookName) {
878
- if (!ctx.rendering) {
879
- const message = isDev4 ? `${hookName} can only be used during render execution` : "FICT:E_HOOK_RENDER";
880
- throw new Error(message);
881
- }
882
- }
883
- function __fictUseContext() {
884
- if (ctxStack.length === 0) {
885
- 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";
886
- throw new Error(message);
887
- }
888
- const ctx = ctxStack[ctxStack.length - 1];
889
- if (!ctx.rendering) {
890
- ctx.cursor = 0;
891
- ctx.rendering = true;
892
- }
893
- return ctx;
894
- }
895
- function __fictPushContext() {
896
- const ctx = { slots: [], cursor: 0 };
897
- ctxStack.push(ctx);
898
- return ctx;
899
- }
900
- function __fictGetCurrentComponentId() {
901
- return ctxStack[ctxStack.length - 1]?.componentId;
902
- }
903
- function __fictPopContext() {
904
- const ctx = ctxStack.pop();
905
- if (ctx) ctx.rendering = false;
906
- }
907
- function __fictResetContext() {
908
- ctxStack.length = 0;
909
- }
910
- function __fictUseSignal(ctx, initial, optionsOrSlot, slot) {
911
- assertRenderContext(ctx, "__fictUseSignal");
912
- const options2 = typeof optionsOrSlot === "number" ? void 0 : optionsOrSlot;
913
- const resolvedSlot = typeof optionsOrSlot === "number" ? optionsOrSlot : slot;
914
- const index = resolvedSlot ?? ctx.cursor++;
915
- if (!ctx.slots[index]) {
916
- ctx.slots[index] = signal(initial, options2);
917
- }
918
- return ctx.slots[index];
919
- }
920
- function __fictUseMemo(ctx, fn, optionsOrSlot, slot) {
921
- assertRenderContext(ctx, "__fictUseMemo");
922
- const options2 = typeof optionsOrSlot === "number" ? void 0 : optionsOrSlot;
923
- const resolvedSlot = typeof optionsOrSlot === "number" ? optionsOrSlot : slot;
924
- const index = resolvedSlot ?? ctx.cursor++;
925
- if (!ctx.slots[index]) {
926
- ctx.slots[index] = createMemo(fn, options2);
927
- }
928
- return ctx.slots[index];
929
- }
930
- function __fictUseEffect(ctx, fn, slot) {
931
- if (slot !== void 0) {
932
- if (ctx.slots[slot]) {
933
- return;
934
- }
935
- ctx.slots[slot] = createEffect(fn);
936
- return;
937
- }
938
- assertRenderContext(ctx, "__fictUseEffect");
939
- const index = ctx.cursor++;
940
- if (!ctx.slots[index]) {
941
- ctx.slots[index] = createEffect(fn);
942
- }
943
- }
944
- function __fictRender(ctx, fn) {
945
- ctxStack.push(ctx);
946
- ctx.cursor = 0;
947
- ctx.rendering = true;
948
- try {
949
- return fn();
950
- } finally {
951
- ctx.rendering = false;
952
- ctxStack.pop();
953
- }
954
- }
955
-
956
- // src/signal.ts
957
- var isDev5 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
958
- var Mutable = 1;
959
- var Watching = 2;
960
- var Running = 4;
961
- var Recursed = 8;
962
- var Dirty = 16;
963
- var Pending = 32;
964
- var MutableDirty = 17;
965
- var MutablePending = 33;
966
- var MutableRunning = 5;
967
- var WatchingRunning = 6;
968
- var cycle = 0;
969
- var batchDepth = 0;
970
- var activeSub;
971
- var flushScheduled = false;
972
- var highPriorityQueue = [];
973
- var lowPriorityQueue = [];
974
- var isInTransition = false;
975
- var enqueueMicrotask = typeof queueMicrotask === "function" ? queueMicrotask : (fn) => {
976
- Promise.resolve().then(fn);
977
- };
978
- var inCleanup = false;
979
- var SIGNAL_MARKER = Symbol.for("fict:signal");
980
- var COMPUTED_MARKER = Symbol.for("fict:computed");
981
- var EFFECT_MARKER = Symbol.for("fict:effect");
982
- var EFFECT_SCOPE_MARKER = Symbol.for("fict:effectScope");
983
- function link(dep, sub, version) {
984
- const prevDep = sub.depsTail;
985
- if (prevDep !== void 0 && prevDep.dep === dep) return;
986
- const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
987
- if (nextDep !== void 0 && nextDep.dep === dep) {
988
- nextDep.version = version;
989
- sub.depsTail = nextDep;
990
- return;
991
- }
992
- const prevSub = dep.subsTail;
993
- if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
994
- const newLink = { version, dep, sub, prevDep, nextDep, prevSub, nextSub: void 0 };
995
- sub.depsTail = newLink;
996
- dep.subsTail = newLink;
997
- if (nextDep !== void 0) nextDep.prevDep = newLink;
998
- if (prevDep !== void 0) prevDep.nextDep = newLink;
999
- else sub.deps = newLink;
1000
- if (prevSub !== void 0) prevSub.nextSub = newLink;
1001
- else dep.subs = newLink;
1002
- if (isDev5) trackDependencyDevtools(dep, sub);
1003
- }
1004
- function unlink(lnk, sub = lnk.sub) {
1005
- const dep = lnk.dep;
1006
- const prevDep = lnk.prevDep;
1007
- const nextDep = lnk.nextDep;
1008
- const nextSub = lnk.nextSub;
1009
- const prevSub = lnk.prevSub;
1010
- if (nextDep !== void 0) nextDep.prevDep = prevDep;
1011
- else sub.depsTail = prevDep;
1012
- if (prevDep !== void 0) prevDep.nextDep = nextDep;
1013
- else sub.deps = nextDep;
1014
- if (nextSub !== void 0) nextSub.prevSub = prevSub;
1015
- else dep.subsTail = prevSub;
1016
- if (prevSub !== void 0) prevSub.nextSub = nextSub;
1017
- else if ((dep.subs = nextSub) === void 0) unwatched(dep);
1018
- if (isDev5) untrackDependencyDevtools(dep, sub);
1019
- return nextDep;
1020
- }
1021
- function unwatched(dep) {
1022
- if (!(dep.flags & Mutable)) {
1023
- disposeNode(dep);
1024
- } else if ("getter" in dep && dep.getter !== void 0) {
1025
- dep.depsTail = void 0;
1026
- dep.flags = MutableDirty;
1027
- purgeDeps(dep);
1028
- }
1029
- }
1030
- function propagate(firstLink) {
1031
- let link2 = firstLink;
1032
- let next = link2.nextSub;
1033
- let stack;
1034
- top: for (; ; ) {
1035
- const sub = link2.sub;
1036
- let flags = sub.flags;
1037
- if (!(flags & 60)) {
1038
- sub.flags = flags | Pending;
1039
- } else if (!(flags & 12)) {
1040
- flags = 0;
1041
- } else if (!(flags & Running)) {
1042
- sub.flags = flags & ~Recursed | Pending;
1043
- } else if (!(flags & 48)) {
1044
- let vlink = sub.depsTail;
1045
- let valid = false;
1046
- while (vlink !== void 0) {
1047
- if (vlink === link2) {
1048
- valid = true;
1049
- break;
1050
- }
1051
- vlink = vlink.prevDep;
1052
- }
1053
- if (valid) {
1054
- sub.flags = flags | 40;
1055
- flags &= Mutable;
1056
- } else {
1057
- flags = 0;
1058
- }
1059
- } else {
1060
- flags = 0;
1061
- }
1062
- if (flags & Watching) notify(sub);
1063
- if (flags & Mutable) {
1064
- const subSubs = sub.subs;
1065
- if (subSubs !== void 0) {
1066
- const nextSub = subSubs.nextSub;
1067
- if (nextSub !== void 0) {
1068
- stack = { value: next, prev: stack };
1069
- next = nextSub;
1070
- }
1071
- link2 = subSubs;
1072
- continue;
1073
- }
1074
- }
1075
- if (next !== void 0) {
1076
- link2 = next;
1077
- next = link2.nextSub;
1078
- continue;
1079
- }
1080
- while (stack !== void 0) {
1081
- link2 = stack.value;
1082
- stack = stack.prev;
1083
- if (link2 !== void 0) {
1084
- next = link2.nextSub;
1085
- continue top;
1086
- }
1087
- }
1088
- break;
1089
- }
1090
- }
1091
- function checkDirty(firstLink, sub) {
1092
- let link2 = firstLink;
1093
- let stack;
1094
- let checkDepth = 0;
1095
- let dirty = false;
1096
- top: for (; ; ) {
1097
- const dep = link2.dep;
1098
- const depFlags = dep.flags;
1099
- if (sub.flags & Dirty) {
1100
- dirty = true;
1101
- } else if ((depFlags & MutableDirty) === MutableDirty) {
1102
- if (update(dep)) {
1103
- const subs = dep.subs;
1104
- if (subs !== void 0 && subs.nextSub !== void 0) shallowPropagate(subs);
1105
- dirty = true;
1106
- }
1107
- } else if ((depFlags & MutablePending) === MutablePending) {
1108
- if (!dep.deps) {
1109
- const nextDep = link2.nextDep;
1110
- if (nextDep !== void 0) {
1111
- link2 = nextDep;
1112
- continue;
1113
- }
1114
- } else {
1115
- if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
1116
- stack = { value: link2, prev: stack };
1117
- }
1118
- link2 = dep.deps;
1119
- sub = dep;
1120
- ++checkDepth;
1121
- continue;
1122
- }
1123
- }
1124
- if (!dirty) {
1125
- const nextDep = link2.nextDep;
1126
- if (nextDep !== void 0) {
1127
- link2 = nextDep;
1128
- continue;
1129
- }
1130
- }
1131
- while (checkDepth-- > 0) {
1132
- const firstSub = sub.subs;
1133
- const hasMultipleSubs = firstSub.nextSub !== void 0;
1134
- if (hasMultipleSubs) {
1135
- link2 = stack.value;
1136
- stack = stack.prev;
1137
- } else {
1138
- link2 = firstSub;
1139
- }
1140
- if (dirty) {
1141
- if (update(sub)) {
1142
- if (hasMultipleSubs) shallowPropagate(firstSub);
1143
- sub = link2.sub;
1144
- continue;
1145
- }
1146
- dirty = false;
1147
- } else {
1148
- sub.flags &= ~Pending;
1149
- }
1150
- sub = link2.sub;
1151
- const nextDep = link2.nextDep;
1152
- if (nextDep !== void 0) {
1153
- link2 = nextDep;
1154
- continue top;
1155
- }
1156
- }
1157
- return dirty;
1158
- }
1159
- }
1160
- function shallowPropagate(firstLink) {
1161
- let link2 = firstLink;
1162
- do {
1163
- const sub = link2.sub;
1164
- const flags = sub.flags;
1165
- if ((flags & 48) === Pending) {
1166
- sub.flags = flags | Dirty;
1167
- if ((flags & 6) === Watching) notify(sub);
1168
- }
1169
- link2 = link2.nextSub;
1170
- } while (link2 !== void 0);
1171
- }
1172
- function update(node) {
1173
- return "getter" in node && node.getter !== void 0 ? updateComputed(node) : updateSignal(node);
1174
- }
1175
- function valuesDiffer(node, prev, next) {
1176
- if (node.equals === false) return true;
1177
- if (typeof node.equals === "function") return !node.equals(prev, next);
1178
- return prev !== next;
1179
- }
1180
- function notify(effect2) {
1181
- effect2.flags &= ~Watching;
1182
- const effects = [];
1183
- for (; ; ) {
1184
- effects.push(effect2);
1185
- const nextLink = effect2.subs;
1186
- if (nextLink === void 0) break;
1187
- effect2 = nextLink.sub;
1188
- if (effect2 === void 0 || !(effect2.flags & Watching)) break;
1189
- effect2.flags &= ~Watching;
1190
- }
1191
- const targetQueue = isInTransition ? lowPriorityQueue : highPriorityQueue;
1192
- for (let i = effects.length - 1; i >= 0; i--) {
1193
- targetQueue.push(effects[i]);
1194
- }
1195
- }
1196
- function purgeDeps(sub) {
1197
- const depsTail = sub.depsTail;
1198
- let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
1199
- while (dep !== void 0) dep = unlink(dep, sub);
1200
- }
1201
- function disposeNode(node) {
1202
- node.depsTail = void 0;
1203
- node.flags = 0;
1204
- purgeDeps(node);
1205
- let sub = node.subs;
1206
- while (sub !== void 0) {
1207
- const next = sub.nextSub;
1208
- unlink(sub);
1209
- sub = next;
1210
- }
1211
- }
1212
- function updateSignal(s) {
1213
- s.flags = Mutable;
1214
- const current = s.currentValue;
1215
- const pending = s.pendingValue;
1216
- if (valuesDiffer(s, current, pending)) {
1217
- s.currentValue = pending;
1218
- return true;
1219
- }
1220
- return false;
1221
- }
1222
- function updateComputed(c) {
1223
- ++cycle;
1224
- const oldValue = c.value;
1225
- c.depsTail = void 0;
1226
- c.flags = MutableRunning;
1227
- const prevSub = activeSub;
1228
- activeSub = c;
1229
- try {
1230
- const newValue = c.getter(oldValue);
1231
- activeSub = prevSub;
1232
- c.flags &= ~Running;
1233
- purgeDeps(c);
1234
- if (valuesDiffer(c, oldValue, newValue)) {
1235
- c.value = newValue;
1236
- if (isDev5) updateComputedDevtools(c, newValue);
1237
- return true;
1238
- }
1239
- return false;
1240
- } catch (e) {
1241
- activeSub = prevSub;
1242
- c.flags &= ~Running;
1243
- throw e;
1244
- }
1245
- }
1246
- function runEffect(e) {
1247
- const flags = e.flags;
1248
- if (flags & Dirty) {
1249
- if (e.runCleanup) {
1250
- inCleanup = true;
1251
- try {
1252
- e.runCleanup();
1253
- } finally {
1254
- inCleanup = false;
1255
- }
1256
- }
1257
- ++cycle;
1258
- if (isDev5) effectRunDevtools(e);
1259
- e.depsTail = void 0;
1260
- e.flags = WatchingRunning;
1261
- const prevSub = activeSub;
1262
- activeSub = e;
1263
- try {
1264
- e.fn();
1265
- activeSub = prevSub;
1266
- e.flags = Watching;
1267
- purgeDeps(e);
1268
- } catch (err) {
1269
- activeSub = prevSub;
1270
- e.flags = Watching;
1271
- throw err;
1272
- }
1273
- } else if (flags & Pending && e.deps) {
1274
- if (e.runCleanup) {
1275
- inCleanup = true;
1276
- try {
1277
- e.runCleanup();
1278
- } finally {
1279
- inCleanup = false;
1280
- }
1281
- }
1282
- let isDirty = false;
1283
- try {
1284
- isDirty = checkDirty(e.deps, e);
1285
- } catch (err) {
1286
- if (handleSuspend(err, e.root)) {
1287
- if (e.flags !== 0) {
1288
- e.flags = Watching;
1289
- }
1290
- return;
1291
- }
1292
- if (handleError(err, { source: "effect" }, e.root)) {
1293
- if (e.flags !== 0) {
1294
- e.flags = Watching;
1295
- }
1296
- return;
1297
- }
1298
- throw err;
1299
- }
1300
- if (isDirty) {
1301
- ++cycle;
1302
- if (isDev5) effectRunDevtools(e);
1303
- e.depsTail = void 0;
1304
- e.flags = WatchingRunning;
1305
- const prevSub = activeSub;
1306
- activeSub = e;
1307
- try {
1308
- e.fn();
1309
- activeSub = prevSub;
1310
- e.flags = Watching;
1311
- purgeDeps(e);
1312
- } catch (err) {
1313
- activeSub = prevSub;
1314
- e.flags = Watching;
1315
- throw err;
1316
- }
1317
- } else {
1318
- e.flags = Watching;
1319
- }
1320
- } else {
1321
- e.flags = Watching;
1322
- }
1323
- }
1324
- function scheduleFlush() {
1325
- const hasWork = highPriorityQueue.length > 0 || lowPriorityQueue.length > 0;
1326
- if (flushScheduled || !hasWork) return;
1327
- if (batchDepth > 0) return;
1328
- flushScheduled = true;
1329
- enqueueMicrotask(() => {
1330
- flush();
1331
- });
1332
- }
1333
- function flush() {
1334
- beginFlushGuard();
1335
- if (batchDepth > 0) {
1336
- scheduleFlush();
1337
- endFlushGuard();
1338
- return;
1339
- }
1340
- const hasWork = highPriorityQueue.length > 0 || lowPriorityQueue.length > 0;
1341
- if (!hasWork) {
1342
- flushScheduled = false;
1343
- endFlushGuard();
1344
- return;
1345
- }
1346
- flushScheduled = false;
1347
- let highIndex = 0;
1348
- while (highIndex < highPriorityQueue.length) {
1349
- const e = highPriorityQueue[highIndex];
1350
- if (!beforeEffectRunGuard()) {
1351
- for (let i = 0; i < highPriorityQueue.length; i++) {
1352
- const queued = highPriorityQueue[i];
1353
- if (queued && queued.flags !== 0) {
1354
- queued.flags = Watching;
1355
- }
1356
- }
1357
- for (let i = 0; i < lowPriorityQueue.length; i++) {
1358
- const queued = lowPriorityQueue[i];
1359
- if (queued && queued.flags !== 0) {
1360
- queued.flags = Watching;
1361
- }
1362
- }
1363
- highPriorityQueue.length = 0;
1364
- lowPriorityQueue.length = 0;
1365
- flushScheduled = false;
1366
- endFlushGuard();
1367
- return;
1368
- }
1369
- highIndex++;
1370
- runEffect(e);
1371
- }
1372
- highPriorityQueue.length = 0;
1373
- let lowIndex = 0;
1374
- while (lowIndex < lowPriorityQueue.length) {
1375
- if (highPriorityQueue.length > 0) {
1376
- if (lowIndex > 0) {
1377
- lowPriorityQueue.copyWithin(0, lowIndex);
1378
- lowPriorityQueue.length -= lowIndex;
1379
- }
1380
- scheduleFlush();
1381
- endFlushGuard();
1382
- return;
1383
- }
1384
- const e = lowPriorityQueue[lowIndex];
1385
- if (!beforeEffectRunGuard()) {
1386
- for (let i = 0; i < highPriorityQueue.length; i++) {
1387
- const queued = highPriorityQueue[i];
1388
- if (queued && queued.flags !== 0) {
1389
- queued.flags = Watching;
1390
- }
1391
- }
1392
- for (let i = 0; i < lowPriorityQueue.length; i++) {
1393
- const queued = lowPriorityQueue[i];
1394
- if (queued && queued.flags !== 0) {
1395
- queued.flags = Watching;
1396
- }
1397
- }
1398
- highPriorityQueue.length = 0;
1399
- lowPriorityQueue.length = 0;
1400
- flushScheduled = false;
1401
- endFlushGuard();
1402
- return;
1403
- }
1404
- lowIndex++;
1405
- runEffect(e);
1406
- }
1407
- lowPriorityQueue.length = 0;
1408
- endFlushGuard();
1409
- }
1410
- function signal(initialValue, options2) {
1411
- const s = {
1412
- currentValue: initialValue,
1413
- pendingValue: initialValue,
1414
- subs: void 0,
1415
- subsTail: void 0,
1416
- flags: Mutable,
1417
- __id: void 0,
1418
- ...options2?.equals !== void 0 ? { equals: options2.equals } : {},
1419
- ...options2?.name !== void 0 ? { name: options2.name } : {},
1420
- ...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {}
1421
- };
1422
- if (isDev5) registerSignalDevtools(s);
1423
- const accessor = signalOper.bind(s);
1424
- accessor[SIGNAL_MARKER] = true;
1425
- return accessor;
1426
- }
1427
- function signalOper(value) {
1428
- if (arguments.length > 0) {
1429
- const next = value;
1430
- const prev = this.pendingValue;
1431
- if (valuesDiffer(this, prev, next)) {
1432
- this.pendingValue = next;
1433
- this.flags = MutableDirty;
1434
- if (isDev5) updateSignalDevtools(this, next);
1435
- const subs = this.subs;
1436
- if (subs !== void 0) {
1437
- propagate(subs);
1438
- if (!batchDepth) scheduleFlush();
1439
- }
1440
- }
1441
- return;
1442
- }
1443
- const flags = this.flags;
1444
- if (flags & Dirty && !inCleanup) {
1445
- if (updateSignal(this)) {
1446
- const subs = this.subs;
1447
- if (subs !== void 0) shallowPropagate(subs);
1448
- }
1449
- }
1450
- let sub = activeSub;
1451
- while (sub !== void 0) {
1452
- if (sub.flags & 3) {
1453
- link(this, sub, cycle);
1454
- break;
1455
- }
1456
- const subSubs = sub.subs;
1457
- sub = subSubs !== void 0 ? subSubs.sub : void 0;
1458
- }
1459
- return this.currentValue;
1460
- }
1461
- function computed(getter, options2) {
1462
- const c = {
1463
- value: void 0,
1464
- subs: void 0,
1465
- subsTail: void 0,
1466
- deps: void 0,
1467
- depsTail: void 0,
1468
- flags: 0,
1469
- getter,
1470
- __id: void 0,
1471
- ...options2?.equals !== void 0 ? { equals: options2.equals } : {},
1472
- ...options2?.name !== void 0 ? { name: options2.name } : {},
1473
- ...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {}
1474
- };
1475
- if (isDev5) registerComputedDevtools(c);
1476
- const bound = computedOper.bind(
1477
- c
1478
- );
1479
- bound[COMPUTED_MARKER] = true;
1480
- return bound;
1481
- }
1482
- function computedOper() {
1483
- if (inCleanup) return this.value;
1484
- const flags = this.flags;
1485
- if (flags & Dirty) {
1486
- if (updateComputed(this)) {
1487
- const subs = this.subs;
1488
- if (subs !== void 0) shallowPropagate(subs);
1489
- }
1490
- } else if (flags & Pending) {
1491
- if (this.deps && checkDirty(this.deps, this)) {
1492
- if (updateComputed(this)) {
1493
- const subs = this.subs;
1494
- if (subs !== void 0) shallowPropagate(subs);
1495
- }
1496
- } else {
1497
- this.flags = flags & ~Pending;
1498
- }
1499
- } else if (!flags) {
1500
- this.flags = MutableRunning;
1501
- const prevSub = setActiveSub(this);
1502
- try {
1503
- this.value = this.getter(void 0);
1504
- if (isDev5) updateComputedDevtools(this, this.value);
1505
- } finally {
1506
- setActiveSub(prevSub);
1507
- this.flags &= ~Running;
1508
- }
1509
- }
1510
- if (activeSub !== void 0) link(this, activeSub, cycle);
1511
- return this.value;
1512
- }
1513
- function effect(fn) {
1514
- const e = {
1515
- fn,
1516
- subs: void 0,
1517
- subsTail: void 0,
1518
- deps: void 0,
1519
- depsTail: void 0,
1520
- flags: WatchingRunning,
1521
- __id: void 0
1522
- };
1523
- const root = getCurrentRoot();
1524
- if (root) {
1525
- e.root = root;
1526
- }
1527
- if (isDev5) registerEffectDevtools(e);
1528
- const prevSub = activeSub;
1529
- if (prevSub !== void 0) link(e, prevSub, 0);
1530
- activeSub = e;
1531
- try {
1532
- if (isDev5) effectRunDevtools(e);
1533
- fn();
1534
- } finally {
1535
- activeSub = prevSub;
1536
- e.flags &= ~Running;
1537
- }
1538
- const disposer = effectOper.bind(e);
1539
- disposer[EFFECT_MARKER] = true;
1540
- return disposer;
1541
- }
1542
- function effectWithCleanup(fn, cleanupRunner, root) {
1543
- const e = {
1544
- fn,
1545
- subs: void 0,
1546
- subsTail: void 0,
1547
- deps: void 0,
1548
- depsTail: void 0,
1549
- flags: WatchingRunning,
1550
- runCleanup: cleanupRunner,
1551
- __id: void 0
1552
- };
1553
- const resolvedRoot = root ?? getCurrentRoot();
1554
- if (resolvedRoot) {
1555
- e.root = resolvedRoot;
1556
- }
1557
- if (isDev5) registerEffectDevtools(e);
1558
- const prevSub = activeSub;
1559
- if (prevSub !== void 0) link(e, prevSub, 0);
1560
- activeSub = e;
1561
- try {
1562
- if (isDev5) effectRunDevtools(e);
1563
- fn();
1564
- } finally {
1565
- activeSub = prevSub;
1566
- e.flags &= ~Running;
1567
- }
1568
- const disposer = effectOper.bind(e);
1569
- disposer[EFFECT_MARKER] = true;
1570
- return disposer;
1571
- }
1572
- function effectOper() {
1573
- disposeNode(this);
1574
- }
1575
- function effectScope(fn) {
1576
- const e = { deps: void 0, depsTail: void 0, subs: void 0, subsTail: void 0, flags: 0 };
1577
- const prevSub = activeSub;
1578
- if (prevSub !== void 0) link(e, prevSub, 0);
1579
- activeSub = e;
1580
- try {
1581
- fn();
1582
- } finally {
1583
- activeSub = prevSub;
1584
- }
1585
- const disposer = effectScopeOper.bind(e);
1586
- disposer[EFFECT_SCOPE_MARKER] = true;
1587
- return disposer;
1588
- }
1589
- function effectScopeOper() {
1590
- disposeNode(this);
1591
- }
1592
- function batch(fn) {
1593
- ++batchDepth;
1594
- let result;
1595
- let error;
1596
- try {
1597
- result = fn();
1598
- } catch (e) {
1599
- error = e;
1600
- } finally {
1601
- --batchDepth;
1602
- if (batchDepth === 0) {
1603
- try {
1604
- flush();
1605
- } catch (flushErr) {
1606
- if (error === void 0) {
1607
- error = flushErr;
1608
- }
1609
- }
1610
- }
1611
- }
1612
- if (error !== void 0) {
1613
- throw error;
1614
- }
1615
- return result;
1616
- }
1617
- function setActiveSub(sub) {
1618
- const prev = activeSub;
1619
- activeSub = sub;
1620
- return prev;
1621
- }
1622
- function __resetReactiveState() {
1623
- highPriorityQueue.length = 0;
1624
- lowPriorityQueue.length = 0;
1625
- batchDepth = 0;
1626
- activeSub = void 0;
1627
- flushScheduled = false;
1628
- isInTransition = false;
1629
- inCleanup = false;
1630
- cycle = 0;
1631
- }
1632
- function untrack(fn) {
1633
- const prev = activeSub;
1634
- activeSub = void 0;
1635
- try {
1636
- return fn();
1637
- } finally {
1638
- activeSub = prev;
1639
- }
1640
- }
1641
- function isSignal(fn) {
1642
- return typeof fn === "function" && fn[SIGNAL_MARKER] === true;
1643
- }
1644
- function isComputed(fn) {
1645
- return typeof fn === "function" && fn[COMPUTED_MARKER] === true;
1646
- }
1647
- function isEffect(fn) {
1648
- return typeof fn === "function" && fn[EFFECT_MARKER] === true;
1649
- }
1650
- function isEffectScope(fn) {
1651
- return typeof fn === "function" && fn[EFFECT_SCOPE_MARKER] === true;
1652
- }
1653
- function setTransitionContext(value) {
1654
- const prev = isInTransition;
1655
- isInTransition = value;
1656
- return prev;
1657
- }
1658
- var registerSignalDevtools = () => void 0;
1659
- var updateSignalDevtools = () => {
1660
- };
1661
- var registerComputedDevtools = () => void 0;
1662
- var updateComputedDevtools = () => {
1663
- };
1664
- var registerEffectDevtools = () => void 0;
1665
- var effectRunDevtools = () => {
1666
- };
1667
- var trackDependencyDevtools = () => {
1668
- };
1669
- var untrackDependencyDevtools = () => {
1670
- };
1671
- if (isDev5) {
1672
- let nextDevtoolsId = 0;
1673
- registerSignalDevtools = (node) => {
1674
- const hook = getDevtoolsHook();
1675
- if (!hook) return void 0;
1676
- const id = ++nextDevtoolsId;
1677
- const options2 = {};
1678
- if (node.name !== void 0) options2.name = node.name;
1679
- if (node.devToolsSource !== void 0) options2.source = node.devToolsSource;
1680
- const ownerId = __fictGetCurrentComponentId();
1681
- if (ownerId !== void 0) options2.ownerId = ownerId;
1682
- hook.registerSignal(id, node.currentValue, options2);
1683
- node.__id = id;
1684
- return id;
1685
- };
1686
- updateSignalDevtools = (node, value) => {
1687
- const hook = getDevtoolsHook();
1688
- if (!hook) return;
1689
- const id = node.__id;
1690
- if (id) hook.updateSignal(id, value);
1691
- };
1692
- registerComputedDevtools = (node) => {
1693
- const hook = getDevtoolsHook();
1694
- if (!hook) return void 0;
1695
- const id = ++nextDevtoolsId;
1696
- const options2 = {};
1697
- if (node.name !== void 0) options2.name = node.name;
1698
- if (node.devToolsSource !== void 0) options2.source = node.devToolsSource;
1699
- const ownerId = __fictGetCurrentComponentId();
1700
- if (ownerId !== void 0) options2.ownerId = ownerId;
1701
- options2.hasValue = false;
1702
- hook.registerComputed(id, node.value, options2);
1703
- node.__id = id;
1704
- return id;
1705
- };
1706
- updateComputedDevtools = (node, value) => {
1707
- const hook = getDevtoolsHook();
1708
- if (!hook) return;
1709
- const id = node.__id;
1710
- if (id) hook.updateComputed(id, value);
1711
- };
1712
- registerEffectDevtools = (node) => {
1713
- const hook = getDevtoolsHook();
1714
- if (!hook) return void 0;
1715
- const id = ++nextDevtoolsId;
1716
- const ownerId = __fictGetCurrentComponentId();
1717
- hook.registerEffect(id, ownerId !== void 0 ? { ownerId } : void 0);
1718
- node.__id = id;
1719
- return id;
1720
- };
1721
- effectRunDevtools = (node) => {
1722
- const hook = getDevtoolsHook();
1723
- if (!hook) return;
1724
- const id = node.__id;
1725
- if (id) hook.effectRun(id);
1726
- };
1727
- trackDependencyDevtools = (dep, sub) => {
1728
- const hook = getDevtoolsHook();
1729
- if (!hook?.trackDependency) return;
1730
- const depId = dep.__id;
1731
- const subId = sub.__id;
1732
- if (depId && subId) hook.trackDependency(subId, depId);
1733
- };
1734
- untrackDependencyDevtools = (dep, sub) => {
1735
- const hook = getDevtoolsHook();
1736
- if (!hook?.untrackDependency) return;
1737
- const depId = dep.__id;
1738
- const subId = sub.__id;
1739
- if (depId && subId) hook.untrackDependency(subId, depId);
1740
- };
1741
- }
1742
- function createSelector(source, equalityFn = (a, b) => a === b) {
1743
- let current = source();
1744
- const observers = /* @__PURE__ */ new Map();
1745
- const dispose = effect(() => {
1746
- const next = source();
1747
- if (equalityFn(current, next)) return;
1748
- const prevSig = observers.get(current);
1749
- if (prevSig) prevSig(false);
1750
- const nextSig = observers.get(next);
1751
- if (nextSig) nextSig(true);
1752
- current = next;
1753
- });
1754
- registerRootCleanup(() => {
1755
- dispose();
1756
- observers.clear();
1757
- });
1758
- return (key) => {
1759
- let sig = observers.get(key);
1760
- if (!sig) {
1761
- sig = signal(equalityFn(key, current));
1762
- observers.set(key, sig);
1763
- registerRootCleanup(() => observers.delete(key));
1764
- }
1765
- return sig();
1766
- };
1767
- }
1768
-
1769
- // src/memo.ts
1770
- function createMemo(fn, options2) {
1771
- return computed(fn, options2);
1772
- }
1
+ import {
2
+ $$EVENTS,
3
+ ChildProperties,
4
+ DelegatedEvents,
5
+ Properties,
6
+ SVGElements,
7
+ SVGNamespace,
8
+ UnitlessStyles,
9
+ __fictEnterHydration,
10
+ __fictExitHydration,
11
+ __fictGetCurrentComponentId,
12
+ __fictIsHydrating,
13
+ __fictIsResumable,
14
+ __fictPopContext,
15
+ __fictPushContext,
16
+ __fictRegisterScope,
17
+ batch,
18
+ computed,
19
+ createEffect,
20
+ createMemo,
21
+ createRenderEffect,
22
+ createRootContext,
23
+ destroyRoot,
24
+ flushOnMount,
25
+ getCurrentRoot,
26
+ getDevtoolsHook,
27
+ getPropAlias,
28
+ handleError,
29
+ handleSuspend,
30
+ isComputed,
31
+ isEffect,
32
+ isEffectScope,
33
+ isSignal,
34
+ onCleanup,
35
+ onMount,
36
+ popRoot,
37
+ pushRoot,
38
+ registerRootCleanup,
39
+ scheduleFlush,
40
+ setTransitionContext,
41
+ signal,
42
+ untrack
43
+ } from "./chunk-FKDMDAUR.js";
1773
44
 
1774
45
  // src/jsx.ts
1775
46
  var Fragment = Symbol("Fragment");
@@ -1916,6 +187,65 @@ function removeNodes(nodes) {
1916
187
  node.parentNode?.removeChild(node);
1917
188
  }
1918
189
  }
190
+ var SLOT_START = "fict:slot:start";
191
+ var SLOT_END = "fict:slot:end";
192
+ function isSlotStart(node) {
193
+ return !!(node && node.nodeType === 8 && node.data === SLOT_START);
194
+ }
195
+ function isSlotEnd(node) {
196
+ return !!(node && node.nodeType === 8 && node.data === SLOT_END);
197
+ }
198
+ function getSlotEnd(start) {
199
+ let depth = 1;
200
+ let cursor = start.nextSibling;
201
+ while (cursor) {
202
+ if (isSlotStart(cursor)) {
203
+ depth++;
204
+ } else if (isSlotEnd(cursor)) {
205
+ depth--;
206
+ if (depth === 0) {
207
+ return cursor;
208
+ }
209
+ }
210
+ cursor = cursor.nextSibling;
211
+ }
212
+ const owner = start.ownerDocument ?? document;
213
+ const end = owner.createComment(SLOT_END);
214
+ if (start.parentNode) {
215
+ start.parentNode.insertBefore(end, start.nextSibling);
216
+ }
217
+ return end;
218
+ }
219
+ function resolvePath(root, path) {
220
+ let current = root;
221
+ for (const index of path) {
222
+ if (!current) return null;
223
+ let child = current.firstChild;
224
+ let currentIndex = 0;
225
+ while (child) {
226
+ if (isSlotStart(child)) {
227
+ if (currentIndex === index) {
228
+ current = child;
229
+ break;
230
+ }
231
+ const end = getSlotEnd(child);
232
+ child = end.nextSibling;
233
+ currentIndex++;
234
+ continue;
235
+ }
236
+ if (currentIndex === index) {
237
+ current = child;
238
+ break;
239
+ }
240
+ currentIndex++;
241
+ child = child.nextSibling;
242
+ }
243
+ if (!child) {
244
+ return null;
245
+ }
246
+ }
247
+ return current;
248
+ }
1919
249
 
1920
250
  // src/transition.ts
1921
251
  function startTransition(fn) {
@@ -1963,8 +293,65 @@ function untrack2(fn) {
1963
293
  return untrack(fn);
1964
294
  }
1965
295
 
296
+ // src/hydration.ts
297
+ var hydrationStack = [];
298
+ function withHydration(root, fn) {
299
+ const owner = root.ownerDocument ?? document;
300
+ hydrationStack.push({
301
+ cursor: root.firstChild,
302
+ boundary: null,
303
+ owner
304
+ });
305
+ try {
306
+ fn();
307
+ } finally {
308
+ hydrationStack.pop();
309
+ }
310
+ }
311
+ function withHydrationRange(start, end, owner, fn) {
312
+ hydrationStack.push({
313
+ cursor: start,
314
+ boundary: end,
315
+ owner
316
+ });
317
+ try {
318
+ fn();
319
+ } finally {
320
+ hydrationStack.pop();
321
+ }
322
+ }
323
+ function claimNodes(templateRoot, fallback) {
324
+ const ctx = hydrationStack[hydrationStack.length - 1];
325
+ if (!ctx || !ctx.cursor) {
326
+ return fallback();
327
+ }
328
+ const count = templateRoot.nodeType === 11 ? templateRoot.childNodes.length : 1;
329
+ if (count === 0) return fallback();
330
+ const claimed = [];
331
+ let cursor = ctx.cursor;
332
+ for (let i = 0; i < count; i++) {
333
+ if (!cursor || cursor === ctx.boundary) {
334
+ return fallback();
335
+ }
336
+ claimed.push(cursor);
337
+ cursor = cursor.nextSibling;
338
+ }
339
+ ctx.cursor = cursor;
340
+ if (claimed.length === 1) {
341
+ return claimed[0];
342
+ }
343
+ const frag = ctx.owner.createDocumentFragment();
344
+ for (const node of claimed) {
345
+ frag.appendChild(node);
346
+ }
347
+ return frag;
348
+ }
349
+ function isHydratingActive() {
350
+ return hydrationStack.length > 0;
351
+ }
352
+
1966
353
  // src/binding.ts
1967
- var isDev6 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
354
+ var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
1968
355
  function isReactive(value) {
1969
356
  if (typeof value !== "function") return false;
1970
357
  if (isSignal(value) || isComputed(value)) return true;
@@ -2146,7 +533,7 @@ function applyStyle(el, value, prev) {
2146
533
  }
2147
534
  }
2148
535
  }
2149
- var isUnitlessStyleProperty = isDev6 ? (prop2) => UnitlessStyles.has(prop2) : (prop2) => prop2 === "opacity" || prop2 === "zIndex";
536
+ var isUnitlessStyleProperty = isDev ? (prop2) => UnitlessStyles.has(prop2) : (prop2) => prop2 === "opacity" || prop2 === "zIndex";
2150
537
  function createClassBinding(el, value) {
2151
538
  if (isReactive(value)) {
2152
539
  let prev = {};
@@ -2234,7 +621,7 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
2234
621
  }
2235
622
  let currentNodes = [];
2236
623
  let currentText = null;
2237
- let currentRoot2 = null;
624
+ let currentRoot = null;
2238
625
  const clearCurrentNodes = () => {
2239
626
  if (currentNodes.length > 0) {
2240
627
  removeNodes(currentNodes);
@@ -2263,9 +650,9 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
2263
650
  const parentNode = marker.parentNode;
2264
651
  const isPrimitive = value == null || value === false || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
2265
652
  if (isPrimitive) {
2266
- if (currentRoot2) {
2267
- destroyRoot(currentRoot2);
2268
- currentRoot2 = null;
653
+ if (currentRoot) {
654
+ destroyRoot(currentRoot);
655
+ currentRoot = null;
2269
656
  }
2270
657
  if (!parentNode) {
2271
658
  clearCurrentNodes();
@@ -2276,9 +663,9 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
2276
663
  setTextNode(textValue, shouldInsert, parentNode);
2277
664
  return;
2278
665
  }
2279
- if (currentRoot2) {
2280
- destroyRoot(currentRoot2);
2281
- currentRoot2 = null;
666
+ if (currentRoot) {
667
+ destroyRoot(currentRoot);
668
+ currentRoot = null;
2282
669
  }
2283
670
  clearCurrentNodes();
2284
671
  const root = createRootContext(hostRoot);
@@ -2333,14 +720,14 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
2333
720
  flushOnMount(root);
2334
721
  }
2335
722
  }
2336
- currentRoot2 = root;
723
+ currentRoot = root;
2337
724
  currentNodes = nodes;
2338
725
  });
2339
726
  return () => {
2340
727
  dispose();
2341
- if (currentRoot2) {
2342
- destroyRoot(currentRoot2);
2343
- currentRoot2 = null;
728
+ if (currentRoot) {
729
+ destroyRoot(currentRoot);
730
+ currentRoot = null;
2344
731
  }
2345
732
  clearCurrentNodes();
2346
733
  if (ownsMarker) {
@@ -2348,6 +735,151 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
2348
735
  }
2349
736
  };
2350
737
  }
738
+ function insertBetween(start, end, getValue, createElementFn) {
739
+ const hostRoot = getCurrentRoot();
740
+ let currentNodes = [];
741
+ let currentText = null;
742
+ let currentRoot = null;
743
+ let initialHydrating = __fictIsHydrating();
744
+ const collectBetween = () => {
745
+ const nodes = [];
746
+ let cursor = start.nextSibling;
747
+ while (cursor && cursor !== end) {
748
+ nodes.push(cursor);
749
+ cursor = cursor.nextSibling;
750
+ }
751
+ return nodes;
752
+ };
753
+ const clearCurrentNodes = () => {
754
+ if (currentNodes.length > 0) {
755
+ removeNodes(currentNodes);
756
+ currentNodes = [];
757
+ }
758
+ };
759
+ const setTextNode = (textValue, shouldInsert) => {
760
+ if (!currentText) {
761
+ currentText = document.createTextNode(textValue);
762
+ } else if (currentText.data !== textValue) {
763
+ currentText.data = textValue;
764
+ }
765
+ if (!shouldInsert) {
766
+ clearCurrentNodes();
767
+ return;
768
+ }
769
+ if (currentNodes.length === 1 && currentNodes[0] === currentText) {
770
+ return;
771
+ }
772
+ clearCurrentNodes();
773
+ const parentNode = start.parentNode;
774
+ if (parentNode) {
775
+ insertNodesBefore(parentNode, [currentText], end);
776
+ currentNodes = [currentText];
777
+ }
778
+ };
779
+ const dispose = createRenderEffect(() => {
780
+ const value = getValue();
781
+ const parentNode = start.parentNode;
782
+ const isPrimitive = value == null || value === false || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
783
+ if (isPrimitive) {
784
+ if (initialHydrating && isHydratingActive() && parentNode) {
785
+ const existing = collectBetween();
786
+ if (existing.length > 0) {
787
+ currentNodes = existing;
788
+ const only = existing.length === 1 ? existing[0] : null;
789
+ currentText = only && only.nodeType === 3 ? only : null;
790
+ }
791
+ }
792
+ if (currentRoot) {
793
+ destroyRoot(currentRoot);
794
+ currentRoot = null;
795
+ }
796
+ if (!parentNode) {
797
+ clearCurrentNodes();
798
+ return;
799
+ }
800
+ const textValue = value == null || value === false ? "" : String(value);
801
+ const shouldInsert = value != null && value !== false;
802
+ setTextNode(textValue, shouldInsert);
803
+ initialHydrating = false;
804
+ return;
805
+ }
806
+ if (currentRoot) {
807
+ destroyRoot(currentRoot);
808
+ currentRoot = null;
809
+ }
810
+ clearCurrentNodes();
811
+ const root = createRootContext(hostRoot);
812
+ const prev = pushRoot(root);
813
+ let nodes = [];
814
+ let handledError = false;
815
+ try {
816
+ let newNode = void 0;
817
+ const createValue = () => {
818
+ if (value instanceof Node) {
819
+ return value;
820
+ }
821
+ if (Array.isArray(value)) {
822
+ if (value.every((v) => v instanceof Node)) {
823
+ return value;
824
+ }
825
+ if (createElementFn) {
826
+ const mapped = [];
827
+ for (const item of value) {
828
+ mapped.push(...toNodeArray(createElementFn(item)));
829
+ }
830
+ return mapped;
831
+ }
832
+ return document.createTextNode(String(value));
833
+ }
834
+ return createElementFn ? createElementFn(value) : document.createTextNode(String(value));
835
+ };
836
+ if (initialHydrating && isHydratingActive() && parentNode) {
837
+ withHydrationRange(start.nextSibling, end, parentNode.ownerDocument ?? document, () => {
838
+ newNode = createValue();
839
+ });
840
+ } else {
841
+ newNode = createValue();
842
+ }
843
+ nodes = toNodeArray(newNode);
844
+ if (root.suspended) {
845
+ handledError = true;
846
+ destroyRoot(root);
847
+ return;
848
+ }
849
+ if (parentNode && !initialHydrating) {
850
+ insertNodesBefore(parentNode, nodes, end);
851
+ }
852
+ } catch (err) {
853
+ if (handleSuspend(err, root)) {
854
+ handledError = true;
855
+ destroyRoot(root);
856
+ return;
857
+ }
858
+ if (handleError(err, { source: "renderChild" }, root)) {
859
+ handledError = true;
860
+ destroyRoot(root);
861
+ return;
862
+ }
863
+ throw err;
864
+ } finally {
865
+ popRoot(prev);
866
+ if (!handledError) {
867
+ flushOnMount(root);
868
+ }
869
+ }
870
+ currentRoot = root;
871
+ currentNodes = initialHydrating ? collectBetween() : nodes;
872
+ initialHydrating = false;
873
+ });
874
+ return () => {
875
+ dispose();
876
+ if (currentRoot) {
877
+ destroyRoot(currentRoot);
878
+ currentRoot = null;
879
+ }
880
+ clearCurrentNodes();
881
+ };
882
+ }
2351
883
  function createChildBinding(parent, getValue, createElementFn) {
2352
884
  const marker = document.createComment("fict:child");
2353
885
  parent.appendChild(marker);
@@ -2525,11 +1057,11 @@ function addEventListener(node, name, handler, delegate) {
2525
1057
  node.addEventListener(name, handler);
2526
1058
  }
2527
1059
  }
2528
- function bindEvent(el, eventName, handler, options2) {
1060
+ function bindEvent(el, eventName, handler, options) {
2529
1061
  if (handler == null) return () => {
2530
1062
  };
2531
1063
  const rootRef = getCurrentRoot();
2532
- const shouldDelegate = options2 == null && DelegatedEvents.has(eventName);
1064
+ const shouldDelegate = options == null && DelegatedEvents.has(eventName);
2533
1065
  if (shouldDelegate) {
2534
1066
  const key = `$$${eventName}`;
2535
1067
  delegateEvents([eventName]);
@@ -2560,8 +1092,8 @@ function bindEvent(el, eventName, handler, options2) {
2560
1092
  throw err;
2561
1093
  }
2562
1094
  };
2563
- el.addEventListener(eventName, wrapped, options2);
2564
- const cleanup = () => el.removeEventListener(eventName, wrapped, options2);
1095
+ el.addEventListener(eventName, wrapped, options);
1096
+ const cleanup = () => el.removeEventListener(eventName, wrapped, options);
2565
1097
  registerRootCleanup(cleanup);
2566
1098
  return cleanup;
2567
1099
  }
@@ -2665,7 +1197,11 @@ function assignProp(node, prop2, value, prev, isSVG, skipRef, props) {
2665
1197
  }
2666
1198
  if (prop2.slice(0, 3) === "on:") {
2667
1199
  const eventName = prop2.slice(3);
2668
- if (prev) node.removeEventListener(eventName, prev);
1200
+ if (typeof value === "string") {
1201
+ node.setAttribute(prop2, value);
1202
+ return value;
1203
+ }
1204
+ if (prev && typeof prev !== "string") node.removeEventListener(eventName, prev);
2669
1205
  if (value) node.addEventListener(eventName, value);
2670
1206
  return value;
2671
1207
  }
@@ -2710,9 +1246,9 @@ function assignProp(node, prop2, value, prev, isSVG, skipRef, props) {
2710
1246
  }
2711
1247
  const isCE = node.nodeName.includes("-") || "is" in props;
2712
1248
  if (!isSVG) {
2713
- const propAlias = isDev6 ? getPropAlias(prop2, node.tagName) : void 0;
2714
- const isProperty = isDev6 ? Properties.has(prop2) : prop2 in node;
2715
- const isChildProp = isDev6 ? ChildProperties.has(prop2) : prop2 === "innerHTML" || prop2 === "textContent" || prop2 === "innerText" || prop2 === "children";
1249
+ const propAlias = isDev ? getPropAlias(prop2, node.tagName) : void 0;
1250
+ const isProperty = isDev ? Properties.has(prop2) : prop2 in node;
1251
+ const isChildProp = isDev ? ChildProperties.has(prop2) : prop2 === "innerHTML" || prop2 === "textContent" || prop2 === "innerText" || prop2 === "children";
2716
1252
  if (propAlias || isProperty || isChildProp || isCE) {
2717
1253
  const propName = propAlias || prop2;
2718
1254
  if (isCE && !isProperty && !isChildProp && !propAlias) {
@@ -2742,16 +1278,30 @@ function assignProp(node, prop2, value, prev, isSVG, skipRef, props) {
2742
1278
  function toPropertyName(name) {
2743
1279
  return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
2744
1280
  }
2745
- function createConditional(condition, renderTrue, createElementFn, renderFalse) {
2746
- const startMarker = document.createComment("fict:cond:start");
2747
- const endMarker = document.createComment("fict:cond:end");
2748
- const fragment = document.createDocumentFragment();
2749
- fragment.append(startMarker, endMarker);
1281
+ function createConditional(condition, renderTrue, createElementFn, renderFalse, startOverride, endOverride) {
1282
+ const useProvided = !!(startOverride && endOverride);
1283
+ const startMarker = useProvided ? startOverride : document.createComment("fict:cond:start");
1284
+ const endMarker = useProvided ? endOverride : document.createComment("fict:cond:end");
1285
+ const fragment = useProvided ? startMarker : document.createDocumentFragment();
1286
+ if (!useProvided) {
1287
+ ;
1288
+ fragment.append(startMarker, endMarker);
1289
+ }
2750
1290
  const hostRoot = getCurrentRoot();
2751
1291
  let currentNodes = [];
2752
- let currentRoot2 = null;
1292
+ let currentRoot = null;
2753
1293
  let lastCondition = void 0;
2754
1294
  let pendingRender = false;
1295
+ let initialHydrating = __fictIsHydrating();
1296
+ const collectBetween = () => {
1297
+ const nodes = [];
1298
+ let cursor = startMarker.nextSibling;
1299
+ while (cursor && cursor !== endMarker) {
1300
+ nodes.push(cursor);
1301
+ cursor = cursor.nextSibling;
1302
+ }
1303
+ return nodes;
1304
+ };
2755
1305
  const conditionMemo = computed(condition);
2756
1306
  const runConditional = () => {
2757
1307
  const cond = conditionMemo();
@@ -2761,6 +1311,54 @@ function createConditional(condition, renderTrue, createElementFn, renderFalse)
2761
1311
  return;
2762
1312
  }
2763
1313
  pendingRender = false;
1314
+ if (initialHydrating && isHydratingActive()) {
1315
+ initialHydrating = false;
1316
+ lastCondition = cond;
1317
+ const render3 = cond ? renderTrue : renderFalse;
1318
+ if (!render3) {
1319
+ currentNodes = collectBetween();
1320
+ return;
1321
+ }
1322
+ const root2 = createRootContext(hostRoot);
1323
+ const prev2 = pushRoot(root2);
1324
+ let handledError2 = false;
1325
+ try {
1326
+ withHydrationRange(
1327
+ startMarker.nextSibling,
1328
+ endMarker,
1329
+ parent.ownerDocument ?? document,
1330
+ () => {
1331
+ const output = untrack(render3);
1332
+ if (output == null || output === false) {
1333
+ return;
1334
+ }
1335
+ createElementFn(output);
1336
+ }
1337
+ );
1338
+ currentNodes = collectBetween();
1339
+ } catch (err) {
1340
+ if (handleSuspend(err, root2)) {
1341
+ handledError2 = true;
1342
+ destroyRoot(root2);
1343
+ return;
1344
+ }
1345
+ if (handleError(err, { source: "renderChild" }, root2)) {
1346
+ handledError2 = true;
1347
+ destroyRoot(root2);
1348
+ return;
1349
+ }
1350
+ throw err;
1351
+ } finally {
1352
+ popRoot(prev2);
1353
+ if (!handledError2) {
1354
+ flushOnMount(root2);
1355
+ currentRoot = root2;
1356
+ } else {
1357
+ currentRoot = null;
1358
+ }
1359
+ }
1360
+ return;
1361
+ }
2764
1362
  if (lastCondition === cond && currentNodes.length > 0) {
2765
1363
  return;
2766
1364
  }
@@ -2768,9 +1366,9 @@ function createConditional(condition, renderTrue, createElementFn, renderFalse)
2768
1366
  return;
2769
1367
  }
2770
1368
  lastCondition = cond;
2771
- if (currentRoot2) {
2772
- destroyRoot(currentRoot2);
2773
- currentRoot2 = null;
1369
+ if (currentRoot) {
1370
+ destroyRoot(currentRoot);
1371
+ currentRoot = null;
2774
1372
  }
2775
1373
  removeNodes(currentNodes);
2776
1374
  currentNodes = [];
@@ -2806,9 +1404,9 @@ function createConditional(condition, renderTrue, createElementFn, renderFalse)
2806
1404
  popRoot(prev);
2807
1405
  if (!handledError) {
2808
1406
  flushOnMount(root);
2809
- currentRoot2 = root;
1407
+ currentRoot = root;
2810
1408
  } else {
2811
- currentRoot2 = null;
1409
+ currentRoot = null;
2812
1410
  }
2813
1411
  }
2814
1412
  };
@@ -2822,8 +1420,8 @@ function createConditional(condition, renderTrue, createElementFn, renderFalse)
2822
1420
  },
2823
1421
  dispose: () => {
2824
1422
  dispose();
2825
- if (currentRoot2) {
2826
- destroyRoot(currentRoot2);
1423
+ if (currentRoot) {
1424
+ destroyRoot(currentRoot);
2827
1425
  }
2828
1426
  removeNodes(currentNodes);
2829
1427
  currentNodes = [];
@@ -2843,11 +1441,11 @@ function createPortal(container, render2, createElementFn) {
2843
1441
  const marker = document.createComment("fict:portal");
2844
1442
  container.appendChild(marker);
2845
1443
  let currentNodes = [];
2846
- let currentRoot2 = null;
1444
+ let currentRoot = null;
2847
1445
  const dispose = createRenderEffect(() => {
2848
- if (currentRoot2) {
2849
- destroyRoot(currentRoot2);
2850
- currentRoot2 = null;
1446
+ if (currentRoot) {
1447
+ destroyRoot(currentRoot);
1448
+ currentRoot = null;
2851
1449
  }
2852
1450
  if (currentNodes.length > 0) {
2853
1451
  removeNodes(currentNodes);
@@ -2884,16 +1482,16 @@ function createPortal(container, render2, createElementFn) {
2884
1482
  popRoot(prev);
2885
1483
  if (!handledError) {
2886
1484
  flushOnMount(root);
2887
- currentRoot2 = root;
1485
+ currentRoot = root;
2888
1486
  } else {
2889
- currentRoot2 = null;
1487
+ currentRoot = null;
2890
1488
  }
2891
1489
  }
2892
1490
  });
2893
1491
  const portalDispose = () => {
2894
1492
  dispose();
2895
- if (currentRoot2) {
2896
- destroyRoot(currentRoot2);
1493
+ if (currentRoot) {
1494
+ destroyRoot(currentRoot);
2897
1495
  }
2898
1496
  if (currentNodes.length > 0) {
2899
1497
  removeNodes(currentNodes);
@@ -3054,19 +1652,19 @@ function mergeProps(...sources) {
3054
1652
  }
3055
1653
  });
3056
1654
  }
3057
- function keyed(target, key, options2) {
1655
+ function keyed(target, key, options) {
3058
1656
  return prop(() => {
3059
1657
  const resolvedTarget = isPropGetter(target) ? target() : target;
3060
1658
  const resolvedKey = typeof key === "function" ? key() : key;
3061
1659
  return resolvedTarget[resolvedKey];
3062
- }, options2);
1660
+ }, options);
3063
1661
  }
3064
- function prop(getter, options2) {
1662
+ function prop(getter, options) {
3065
1663
  if (isPropGetter(getter)) {
3066
1664
  return getter;
3067
1665
  }
3068
1666
  const fn = getter;
3069
- const unwrap2 = options2?.unwrap !== false;
1667
+ const unwrap2 = options?.unwrap !== false;
3070
1668
  return __fictProp(
3071
1669
  createMemo(() => {
3072
1670
  const value = fn();
@@ -3081,19 +1679,27 @@ function prop(getter, options2) {
3081
1679
  // src/dom.ts
3082
1680
  var SVG_NS = "http://www.w3.org/2000/svg";
3083
1681
  var MATHML_NS = "http://www.w3.org/1998/Math/MathML";
3084
- var isDev7 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
1682
+ var isDev2 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
3085
1683
  var nextComponentId = 1;
3086
1684
  function render(view, container) {
3087
1685
  const root = createRootContext();
3088
1686
  const prev = pushRoot(root);
3089
- let dom;
1687
+ let dom = void 0;
3090
1688
  try {
3091
1689
  const output = view();
3092
- dom = createElement(output);
1690
+ if (__fictIsHydrating()) {
1691
+ withHydration(container, () => {
1692
+ dom = createElement(output);
1693
+ });
1694
+ } else {
1695
+ dom = createElement(output);
1696
+ }
3093
1697
  } finally {
3094
1698
  popRoot(prev);
3095
1699
  }
3096
- container.replaceChildren(dom);
1700
+ if (!__fictIsHydrating()) {
1701
+ container.replaceChildren(dom);
1702
+ }
3097
1703
  container.setAttribute("data-fict-fine-grained", "1");
3098
1704
  flushOnMount(root);
3099
1705
  const teardown = () => {
@@ -3102,6 +1708,25 @@ function render(view, container) {
3102
1708
  };
3103
1709
  return teardown;
3104
1710
  }
1711
+ function hydrateComponent(view, container) {
1712
+ const root = createRootContext();
1713
+ const prev = pushRoot(root);
1714
+ __fictEnterHydration();
1715
+ try {
1716
+ withHydration(container, () => {
1717
+ view();
1718
+ });
1719
+ } finally {
1720
+ __fictExitHydration();
1721
+ popRoot(prev);
1722
+ }
1723
+ container.setAttribute("data-fict-fine-grained", "1");
1724
+ flushOnMount(root);
1725
+ const teardown = () => {
1726
+ destroyRoot(root);
1727
+ };
1728
+ return teardown;
1729
+ }
3105
1730
  function createElement(node) {
3106
1731
  return createElementWithContext(node, null);
3107
1732
  }
@@ -3110,7 +1735,7 @@ function resolveNamespace(tagName, namespace) {
3110
1735
  if (tagName === "math") return "mathml";
3111
1736
  if (namespace === "mathml") return "mathml";
3112
1737
  if (namespace === "svg") return "svg";
3113
- if (isDev7 && SVGElements.has(tagName)) return "svg";
1738
+ if (isDev2 && SVGElements.has(tagName)) return "svg";
3114
1739
  return null;
3115
1740
  }
3116
1741
  function createElementWithContext(node, namespace) {
@@ -3120,6 +1745,13 @@ function createElementWithContext(node, namespace) {
3120
1745
  if (node === null || node === void 0 || node === false) {
3121
1746
  return document.createTextNode("");
3122
1747
  }
1748
+ if (isReactive(node)) {
1749
+ const resolved = node();
1750
+ if (resolved === node) {
1751
+ return document.createTextNode("");
1752
+ }
1753
+ return createElementWithContext(resolved, namespace);
1754
+ }
3123
1755
  if (typeof node === "object" && node !== null && !(node instanceof Node)) {
3124
1756
  if ("marker" in node) {
3125
1757
  const handle = node;
@@ -3175,7 +1807,7 @@ function createElementWithContext(node, namespace) {
3175
1807
  }
3176
1808
  });
3177
1809
  const props = createPropsProxy(baseProps);
3178
- const hook = isDev7 ? getDevtoolsHook() : void 0;
1810
+ const hook = isDev2 ? getDevtoolsHook() : void 0;
3179
1811
  const parentId = hook ? __fictGetCurrentComponentId() : void 0;
3180
1812
  const componentId = hook ? nextComponentId++ : void 0;
3181
1813
  if (hook?.registerComponent && componentId !== void 0) {
@@ -3196,6 +1828,27 @@ function createElementWithContext(node, namespace) {
3196
1828
  });
3197
1829
  onCleanup(() => hook.componentUnmount?.(componentId));
3198
1830
  }
1831
+ if (__fictIsResumable() && !__fictIsHydrating()) {
1832
+ const content = createElementWithContext(rendered, namespace);
1833
+ const host = namespace === "svg" ? document.createElementNS(SVG_NS, "fict-host") : namespace === "mathml" ? document.createElementNS(MATHML_NS, "fict-host") : document.createElement("fict-host");
1834
+ host.setAttribute("data-fict-host", "");
1835
+ if (namespace === null && host.style) {
1836
+ ;
1837
+ host.style.display = "contents";
1838
+ }
1839
+ const meta = vnode.type.__fictMeta;
1840
+ const typeKey = (meta?.id ?? vnode.type.name) || "Anonymous";
1841
+ __fictRegisterScope(ctx, host, typeKey, rawProps);
1842
+ if (meta?.resume) {
1843
+ host.setAttribute("data-fict-h", meta.resume);
1844
+ }
1845
+ if (content instanceof DocumentFragment) {
1846
+ host.append(...Array.from(content.childNodes));
1847
+ } else {
1848
+ host.appendChild(content);
1849
+ }
1850
+ return host;
1851
+ }
3199
1852
  return createElementWithContext(rendered, namespace);
3200
1853
  } catch (err) {
3201
1854
  if (handleSuspend(err)) {
@@ -3231,7 +1884,7 @@ function template(html, isImportNode, isSVG, isMathML) {
3231
1884
  if (isSVG) {
3232
1885
  t.innerHTML = `<svg>${html}</svg>`;
3233
1886
  const wrapper = t.content.firstChild;
3234
- if (isDev7 && wrapper.childNodes.length !== 1) {
1887
+ if (isDev2 && wrapper.childNodes.length !== 1) {
3235
1888
  console.warn(
3236
1889
  `[fict] template() received multi-root SVG content (${wrapper.childNodes.length} nodes). Returning a DocumentFragment. This may indicate a compiler bug or invalid JSX structure.`
3237
1890
  );
@@ -3246,7 +1899,7 @@ function template(html, isImportNode, isSVG, isMathML) {
3246
1899
  if (isMathML) {
3247
1900
  t.innerHTML = `<math>${html}</math>`;
3248
1901
  const wrapper = t.content.firstChild;
3249
- if (isDev7 && wrapper.childNodes.length !== 1) {
1902
+ if (isDev2 && wrapper.childNodes.length !== 1) {
3250
1903
  console.warn(
3251
1904
  `[fict] template() received multi-root MathML content (${wrapper.childNodes.length} nodes). Returning a DocumentFragment. This may indicate a compiler bug or invalid JSX structure.`
3252
1905
  );
@@ -3260,7 +1913,7 @@ function template(html, isImportNode, isSVG, isMathML) {
3260
1913
  }
3261
1914
  t.innerHTML = html;
3262
1915
  const content = t.content;
3263
- if (isDev7 && content.childNodes.length !== 1) {
1916
+ if (isDev2 && content.childNodes.length !== 1) {
3264
1917
  console.warn(
3265
1918
  `[fict] template() received multi-root content (${content.childNodes.length} nodes). Returning a DocumentFragment. This may indicate a compiler bug or invalid JSX structure.`
3266
1919
  );
@@ -3270,7 +1923,13 @@ function template(html, isImportNode, isSVG, isMathML) {
3270
1923
  }
3271
1924
  return content;
3272
1925
  };
3273
- const fn = isImportNode ? () => untrack2(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
1926
+ const fn = isImportNode ? () => untrack2(() => {
1927
+ const base = node || (node = create());
1928
+ return isHydratingActive() ? claimNodes(base, () => document.importNode(base, true)) : document.importNode(base, true);
1929
+ }) : () => {
1930
+ const base = node || (node = create());
1931
+ return isHydratingActive() ? claimNodes(base, () => base.cloneNode(true)) : base.cloneNode(true);
1932
+ };
3274
1933
  fn.cloneNode = fn;
3275
1934
  return fn;
3276
1935
  }
@@ -3343,7 +2002,7 @@ function applyRef(el, value) {
3343
2002
  registerRootCleanup(() => {
3344
2003
  refFn(null);
3345
2004
  });
3346
- } else if (isDev7) {
2005
+ } else if (isDev2) {
3347
2006
  console.warn(
3348
2007
  "[fict] Ref applied outside of a root context. The ref cleanup (setting to null) will not run automatically. Consider using createRoot() or ensure the element is created within a component."
3349
2008
  );
@@ -3356,7 +2015,7 @@ function applyRef(el, value) {
3356
2015
  registerRootCleanup(() => {
3357
2016
  refObj.current = null;
3358
2017
  });
3359
- } else if (isDev7) {
2018
+ } else if (isDev2) {
3360
2019
  console.warn(
3361
2020
  "[fict] Ref applied outside of a root context. The ref cleanup (setting to null) will not run automatically. Consider using createRoot() or ensure the element is created within a component."
3362
2021
  );
@@ -3427,7 +2086,7 @@ function applyProps(el, props, isSVG = false) {
3427
2086
  }
3428
2087
  continue;
3429
2088
  }
3430
- if (isDev7 && ChildProperties.has(key) || key === "innerHTML" || key === "textContent" || key === "innerText" || key === "children") {
2089
+ if (isDev2 && ChildProperties.has(key) || key === "innerHTML" || key === "textContent" || key === "innerText" || key === "children") {
3431
2090
  createAttributeBinding(el, key, value, setProperty);
3432
2091
  continue;
3433
2092
  }
@@ -3443,8 +2102,8 @@ function applyProps(el, props, isSVG = false) {
3443
2102
  createAttributeBinding(el, key.slice(5), value, setProperty);
3444
2103
  continue;
3445
2104
  }
3446
- const propAlias = !isSVG && isDev7 ? getPropAlias(key, tagName) : void 0;
3447
- const isProperty = !isSVG ? isDev7 ? Properties.has(key) : key in el : false;
2105
+ const propAlias = !isSVG && isDev2 ? getPropAlias(key, tagName) : void 0;
2106
+ const isProperty = !isSVG ? isDev2 ? Properties.has(key) : key in el : false;
3448
2107
  if (propAlias || isProperty || isCE && !isSVG) {
3449
2108
  const propName = propAlias || key;
3450
2109
  if (isCE && !isProperty && !propAlias) {
@@ -3547,59 +2206,19 @@ function eventNameFromProp(key) {
3547
2206
  }
3548
2207
 
3549
2208
  export {
3550
- BooleanAttributes,
3551
- Properties,
3552
- ChildProperties,
3553
- Aliases,
3554
- getPropAlias,
3555
- DelegatedEvents,
3556
- SVGElements,
3557
- SVGNamespace,
3558
- UnitlessStyles,
3559
- getDevtoolsHook,
3560
- setCycleProtectionOptions,
3561
- createRootContext,
3562
- pushRoot,
3563
- getCurrentRoot,
3564
- popRoot,
3565
- onMount,
3566
- onDestroy,
3567
- onCleanup,
3568
- flushOnMount,
3569
- registerRootCleanup,
3570
- destroyRoot,
3571
- createRoot,
3572
- registerErrorHandler,
3573
- registerSuspenseHandler,
3574
- handleError,
3575
- createMemo,
3576
- __fictUseContext,
3577
- __fictPushContext,
3578
- __fictPopContext,
3579
- __fictResetContext,
3580
- __fictUseSignal,
3581
- __fictUseMemo,
3582
- __fictUseEffect,
3583
- __fictRender,
3584
- flush,
3585
- signal,
3586
- effectScope,
3587
- batch,
3588
- setActiveSub,
3589
- __resetReactiveState,
3590
- untrack,
3591
- createSelector,
3592
- createEffect,
3593
- createRenderEffect,
2209
+ withHydrationRange,
2210
+ isHydratingActive,
3594
2211
  Fragment,
3595
2212
  toNodeArray,
3596
2213
  insertNodesBefore,
3597
2214
  removeNodes,
2215
+ getSlotEnd,
2216
+ resolvePath,
3598
2217
  startTransition,
3599
2218
  useTransition,
3600
2219
  useDeferredValue,
3601
- batch2,
3602
- untrack2,
2220
+ batch2 as batch,
2221
+ untrack2 as untrack,
3603
2222
  isReactive,
3604
2223
  unwrap,
3605
2224
  callEventHandler,
@@ -3614,6 +2233,7 @@ export {
3614
2233
  bindClass,
3615
2234
  classList,
3616
2235
  insert,
2236
+ insertBetween,
3617
2237
  createChildBinding,
3618
2238
  delegateEvents,
3619
2239
  clearDelegatedEvents,
@@ -3632,7 +2252,8 @@ export {
3632
2252
  keyed,
3633
2253
  prop,
3634
2254
  render,
2255
+ hydrateComponent,
3635
2256
  createElement,
3636
2257
  template
3637
2258
  };
3638
- //# sourceMappingURL=chunk-SO6X7G5S.js.map
2259
+ //# sourceMappingURL=chunk-BQG7VEBY.js.map