@fictjs/runtime 0.5.0 → 0.5.1

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 (36) hide show
  1. package/dist/advanced.cjs +9 -9
  2. package/dist/advanced.js +4 -4
  3. package/dist/{chunk-GHUV2FLD.cjs → chunk-4ZPZM5IG.cjs} +8 -8
  4. package/dist/{chunk-GHUV2FLD.cjs.map → chunk-4ZPZM5IG.cjs.map} +1 -1
  5. package/dist/{chunk-KKKYW54Z.js → chunk-5OYBRKE4.js} +3 -3
  6. package/dist/{chunk-6SOPF5LZ.cjs → chunk-6RCEIWZL.cjs} +36 -19
  7. package/dist/chunk-6RCEIWZL.cjs.map +1 -0
  8. package/dist/{chunk-FKDMDAUR.js → chunk-7BO6P2KP.js} +36 -19
  9. package/dist/chunk-7BO6P2KP.js.map +1 -0
  10. package/dist/{chunk-5AA7HP4S.js → chunk-AR6NSCZM.js} +3 -3
  11. package/dist/{chunk-KYLNC4CD.cjs → chunk-LFMXNQZC.cjs} +17 -17
  12. package/dist/{chunk-KYLNC4CD.cjs.map → chunk-LFMXNQZC.cjs.map} +1 -1
  13. package/dist/{chunk-BQG7VEBY.js → chunk-RY5CY4CI.js} +2 -2
  14. package/dist/{chunk-TKWN42TA.cjs → chunk-WJHXPF7M.cjs} +156 -156
  15. package/dist/{chunk-TKWN42TA.cjs.map → chunk-WJHXPF7M.cjs.map} +1 -1
  16. package/dist/index.cjs +39 -39
  17. package/dist/index.dev.js +33 -18
  18. package/dist/index.dev.js.map +1 -1
  19. package/dist/index.js +3 -3
  20. package/dist/internal.cjs +54 -42
  21. package/dist/internal.cjs.map +1 -1
  22. package/dist/internal.d.cts +1 -1
  23. package/dist/internal.d.ts +1 -1
  24. package/dist/internal.js +15 -3
  25. package/dist/internal.js.map +1 -1
  26. package/dist/loader.cjs +8 -8
  27. package/dist/loader.js +1 -1
  28. package/package.json +1 -1
  29. package/src/cycle-guard.ts +1 -1
  30. package/src/list-helpers.ts +19 -4
  31. package/src/signal.ts +47 -22
  32. package/dist/chunk-6SOPF5LZ.cjs.map +0 -1
  33. package/dist/chunk-FKDMDAUR.js.map +0 -1
  34. /package/dist/{chunk-KKKYW54Z.js.map → chunk-5OYBRKE4.js.map} +0 -0
  35. /package/dist/{chunk-5AA7HP4S.js.map → chunk-AR6NSCZM.js.map} +0 -0
  36. /package/dist/{chunk-BQG7VEBY.js.map → chunk-RY5CY4CI.js.map} +0 -0
package/dist/advanced.cjs CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkKYLNC4CDcjs = require('./chunk-KYLNC4CD.cjs');
5
+ var _chunkLFMXNQZCcjs = require('./chunk-LFMXNQZC.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunkGHUV2FLDcjs = require('./chunk-GHUV2FLD.cjs');
9
+ var _chunk4ZPZM5IGcjs = require('./chunk-4ZPZM5IG.cjs');
10
10
 
11
11
 
12
12
 
@@ -16,7 +16,7 @@ var _chunkGHUV2FLDcjs = require('./chunk-GHUV2FLD.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunkTKWN42TAcjs = require('./chunk-TKWN42TA.cjs');
19
+ var _chunkWJHXPF7Mcjs = require('./chunk-WJHXPF7M.cjs');
20
20
 
21
21
 
22
22
 
@@ -26,13 +26,13 @@ var _chunkTKWN42TAcjs = require('./chunk-TKWN42TA.cjs');
26
26
 
27
27
 
28
28
 
29
- var _chunk6SOPF5LZcjs = require('./chunk-6SOPF5LZ.cjs');
29
+ var _chunk6RCEIWZLcjs = require('./chunk-6RCEIWZL.cjs');
30
30
 
31
31
  // src/versioned-signal.ts
32
32
  function createVersionedSignal(initialValue, options) {
33
33
  const equals = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.equals]), () => ( Object.is));
34
- const value = _chunk6SOPF5LZcjs.signal.call(void 0, initialValue);
35
- const version = _chunk6SOPF5LZcjs.signal.call(void 0, 0);
34
+ const value = _chunk6RCEIWZLcjs.signal.call(void 0, initialValue);
35
+ const version = _chunk6RCEIWZLcjs.signal.call(void 0, 0);
36
36
  const bumpVersion = () => {
37
37
  const next = version() + 1;
38
38
  version(next);
@@ -53,8 +53,8 @@ function createVersionedSignal(initialValue, options) {
53
53
  force: () => {
54
54
  bumpVersion();
55
55
  },
56
- peekVersion: () => _chunk6SOPF5LZcjs.untrack.call(void 0, () => version()),
57
- peekValue: () => _chunk6SOPF5LZcjs.untrack.call(void 0, () => value())
56
+ peekVersion: () => _chunk6RCEIWZLcjs.untrack.call(void 0, () => version()),
57
+ peekValue: () => _chunk6RCEIWZLcjs.untrack.call(void 0, () => value())
58
58
  };
59
59
  }
60
60
 
@@ -79,5 +79,5 @@ function createVersionedSignal(initialValue, options) {
79
79
 
80
80
 
81
81
 
82
- exports.createAttributeBinding = _chunkTKWN42TAcjs.createAttributeBinding; exports.createChildBinding = _chunkTKWN42TAcjs.createChildBinding; exports.createClassBinding = _chunkTKWN42TAcjs.createClassBinding; exports.createContext = _chunkKYLNC4CDcjs.createContext; exports.createRenderEffect = _chunk6SOPF5LZcjs.createRenderEffect; exports.createScope = _chunkGHUV2FLDcjs.createScope; exports.createSelector = _chunk6SOPF5LZcjs.createSelector; exports.createShow = _chunkTKWN42TAcjs.createShow; exports.createSignal = _chunk6SOPF5LZcjs.signal; exports.createStyleBinding = _chunkTKWN42TAcjs.createStyleBinding; exports.createTextBinding = _chunkTKWN42TAcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunk6SOPF5LZcjs.effectScope; exports.getDevtoolsHook = _chunk6SOPF5LZcjs.getDevtoolsHook; exports.hasContext = _chunkKYLNC4CDcjs.hasContext; exports.isReactive = _chunkTKWN42TAcjs.isReactive; exports.registerErrorHandler = _chunk6SOPF5LZcjs.registerErrorHandler; exports.runInScope = _chunkGHUV2FLDcjs.runInScope; exports.setCycleProtectionOptions = _chunk6SOPF5LZcjs.setCycleProtectionOptions; exports.unwrap = _chunkTKWN42TAcjs.unwrap; exports.useContext = _chunkKYLNC4CDcjs.useContext;
82
+ exports.createAttributeBinding = _chunkWJHXPF7Mcjs.createAttributeBinding; exports.createChildBinding = _chunkWJHXPF7Mcjs.createChildBinding; exports.createClassBinding = _chunkWJHXPF7Mcjs.createClassBinding; exports.createContext = _chunkLFMXNQZCcjs.createContext; exports.createRenderEffect = _chunk6RCEIWZLcjs.createRenderEffect; exports.createScope = _chunk4ZPZM5IGcjs.createScope; exports.createSelector = _chunk6RCEIWZLcjs.createSelector; exports.createShow = _chunkWJHXPF7Mcjs.createShow; exports.createSignal = _chunk6RCEIWZLcjs.signal; exports.createStyleBinding = _chunkWJHXPF7Mcjs.createStyleBinding; exports.createTextBinding = _chunkWJHXPF7Mcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunk6RCEIWZLcjs.effectScope; exports.getDevtoolsHook = _chunk6RCEIWZLcjs.getDevtoolsHook; exports.hasContext = _chunkLFMXNQZCcjs.hasContext; exports.isReactive = _chunkWJHXPF7Mcjs.isReactive; exports.registerErrorHandler = _chunk6RCEIWZLcjs.registerErrorHandler; exports.runInScope = _chunk4ZPZM5IGcjs.runInScope; exports.setCycleProtectionOptions = _chunk6RCEIWZLcjs.setCycleProtectionOptions; exports.unwrap = _chunkWJHXPF7Mcjs.unwrap; exports.useContext = _chunkLFMXNQZCcjs.useContext;
83
83
  //# sourceMappingURL=advanced.cjs.map
package/dist/advanced.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  createContext,
3
3
  hasContext,
4
4
  useContext
5
- } from "./chunk-KKKYW54Z.js";
5
+ } from "./chunk-5OYBRKE4.js";
6
6
  import {
7
7
  createScope,
8
8
  runInScope
9
- } from "./chunk-5AA7HP4S.js";
9
+ } from "./chunk-AR6NSCZM.js";
10
10
  import {
11
11
  createAttributeBinding,
12
12
  createChildBinding,
@@ -16,7 +16,7 @@ import {
16
16
  createTextBinding,
17
17
  isReactive,
18
18
  unwrap
19
- } from "./chunk-BQG7VEBY.js";
19
+ } from "./chunk-RY5CY4CI.js";
20
20
  import {
21
21
  createRenderEffect,
22
22
  createSelector,
@@ -26,7 +26,7 @@ import {
26
26
  setCycleProtectionOptions,
27
27
  signal,
28
28
  untrack
29
- } from "./chunk-FKDMDAUR.js";
29
+ } from "./chunk-7BO6P2KP.js";
30
30
 
31
31
  // src/versioned-signal.ts
32
32
  function createVersionedSignal(initialValue, options) {
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkTKWN42TAcjs = require('./chunk-TKWN42TA.cjs');
3
+ var _chunkWJHXPF7Mcjs = require('./chunk-WJHXPF7M.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
- var _chunk6SOPF5LZcjs = require('./chunk-6SOPF5LZ.cjs');
9
+ var _chunk6RCEIWZLcjs = require('./chunk-6RCEIWZL.cjs');
10
10
 
11
11
  // src/scope.ts
12
12
  function createScope() {
@@ -19,17 +19,17 @@ function createScope() {
19
19
  };
20
20
  const run = (fn) => {
21
21
  stop();
22
- const { dispose: rootDispose, value } = _chunk6SOPF5LZcjs.createRoot.call(void 0, fn, { inherit: true });
22
+ const { dispose: rootDispose, value } = _chunk6RCEIWZLcjs.createRoot.call(void 0, fn, { inherit: true });
23
23
  dispose = rootDispose;
24
24
  return value;
25
25
  };
26
- _chunk6SOPF5LZcjs.registerRootCleanup.call(void 0, stop);
26
+ _chunk6RCEIWZLcjs.registerRootCleanup.call(void 0, stop);
27
27
  return { run, stop };
28
28
  }
29
29
  function runInScope(flag, fn) {
30
30
  const scope = createScope();
31
- const evaluate = () => _chunkTKWN42TAcjs.isReactive.call(void 0, flag) ? flag() : !!flag;
32
- _chunk6SOPF5LZcjs.createEffect.call(void 0, () => {
31
+ const evaluate = () => _chunkWJHXPF7Mcjs.isReactive.call(void 0, flag) ? flag() : !!flag;
32
+ _chunk6RCEIWZLcjs.createEffect.call(void 0, () => {
33
33
  const enabled = evaluate();
34
34
  if (enabled) {
35
35
  scope.run(fn);
@@ -37,11 +37,11 @@ function runInScope(flag, fn) {
37
37
  scope.stop();
38
38
  }
39
39
  });
40
- _chunk6SOPF5LZcjs.onCleanup.call(void 0, scope.stop);
40
+ _chunk6RCEIWZLcjs.onCleanup.call(void 0, scope.stop);
41
41
  }
42
42
 
43
43
 
44
44
 
45
45
 
46
46
  exports.createScope = createScope; exports.runInScope = runInScope;
47
- //# sourceMappingURL=chunk-GHUV2FLD.cjs.map
47
+ //# sourceMappingURL=chunk-4ZPZM5IG.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-GHUV2FLD.cjs","../src/scope.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACKO,SAAS,WAAA,CAAA,EAA6B;AAC3C,EAAA,IAAI,QAAA,EAA+B,IAAA;AAEnC,EAAA,MAAM,KAAA,EAAO,CAAA,EAAA,GAAM;AACjB,IAAA,GAAA,CAAI,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,CAAA;AACR,MAAA,QAAA,EAAU,IAAA;AAAA,IACZ;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,EAAM,CAAI,EAAA,EAAA,GAAmB;AACjC,IAAA,IAAA,CAAK,CAAA;AACL,IAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAa,MAAM,EAAA,EAAI,0CAAA,EAAW,EAAI,EAAE,OAAA,EAAS,KAAK,CAAC,CAAA;AACxE,IAAA,QAAA,EAAU,WAAA;AACV,IAAA,OAAO,KAAA;AAAA,EACT,CAAA;AAEA,EAAA,mDAAA,IAAwB,CAAA;AACxB,EAAA,OAAO,EAAE,GAAA,EAAK,KAAK,CAAA;AACrB;AAMO,SAAS,UAAA,CAAW,IAAA,EAA8B,EAAA,EAAsB;AAC7E,EAAA,MAAM,MAAA,EAAQ,WAAA,CAAY,CAAA;AAC1B,EAAA,MAAM,SAAA,EAAW,CAAA,EAAA,GAAO,0CAAA,IAAe,EAAA,EAAK,IAAA,CAAuB,EAAA,EAAI,CAAC,CAAC,IAAA;AAEzE,EAAA,4CAAA,CAAa,EAAA,GAAM;AACjB,IAAA,MAAM,QAAA,EAAU,QAAA,CAAS,CAAA;AACzB,IAAA,GAAA,CAAI,OAAA,EAAS;AACX,MAAA,KAAA,CAAM,GAAA,CAAI,EAAE,CAAA;AAAA,IACd,EAAA,KAAO;AACL,MAAA,KAAA,CAAM,IAAA,CAAK,CAAA;AAAA,IACb;AAAA,EACF,CAAC,CAAA;AAED,EAAA,yCAAA,KAAU,CAAM,IAAI,CAAA;AACtB;ADbA;AACA;AACE;AACA;AACF,mEAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-GHUV2FLD.cjs","sourcesContent":[null,"import { isReactive, type MaybeReactive } from './binding'\nimport { createEffect } from './effect'\nimport { createRoot, onCleanup, registerRootCleanup } from './lifecycle'\n\nexport { effectScope } from './signal'\n\nexport interface ReactiveScope {\n run<T>(fn: () => T): T\n stop(): void\n}\n\n/**\n * Create an explicit reactive scope that can contain effects/memos and be stopped manually.\n * The scope registers with the current root for cleanup.\n */\nexport function createScope(): ReactiveScope {\n let dispose: (() => void) | null = null\n\n const stop = () => {\n if (dispose) {\n dispose()\n dispose = null\n }\n }\n\n const run = <T>(fn: () => T): T => {\n stop()\n const { dispose: rootDispose, value } = createRoot(fn, { inherit: true })\n dispose = rootDispose\n return value\n }\n\n registerRootCleanup(stop)\n return { run, stop }\n}\n\n/**\n * Run a block of reactive code inside a managed scope that follows a boolean flag.\n * When the flag turns false, the scope is disposed and all contained effects/memos are cleaned up.\n */\nexport function runInScope(flag: MaybeReactive<boolean>, fn: () => void): void {\n const scope = createScope()\n const evaluate = () => (isReactive(flag) ? (flag as () => boolean)() : !!flag)\n\n createEffect(() => {\n const enabled = evaluate()\n if (enabled) {\n scope.run(fn)\n } else {\n scope.stop()\n }\n })\n\n onCleanup(scope.stop)\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-4ZPZM5IG.cjs","../src/scope.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACKO,SAAS,WAAA,CAAA,EAA6B;AAC3C,EAAA,IAAI,QAAA,EAA+B,IAAA;AAEnC,EAAA,MAAM,KAAA,EAAO,CAAA,EAAA,GAAM;AACjB,IAAA,GAAA,CAAI,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,CAAA;AACR,MAAA,QAAA,EAAU,IAAA;AAAA,IACZ;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,EAAM,CAAI,EAAA,EAAA,GAAmB;AACjC,IAAA,IAAA,CAAK,CAAA;AACL,IAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAa,MAAM,EAAA,EAAI,0CAAA,EAAW,EAAI,EAAE,OAAA,EAAS,KAAK,CAAC,CAAA;AACxE,IAAA,QAAA,EAAU,WAAA;AACV,IAAA,OAAO,KAAA;AAAA,EACT,CAAA;AAEA,EAAA,mDAAA,IAAwB,CAAA;AACxB,EAAA,OAAO,EAAE,GAAA,EAAK,KAAK,CAAA;AACrB;AAMO,SAAS,UAAA,CAAW,IAAA,EAA8B,EAAA,EAAsB;AAC7E,EAAA,MAAM,MAAA,EAAQ,WAAA,CAAY,CAAA;AAC1B,EAAA,MAAM,SAAA,EAAW,CAAA,EAAA,GAAO,0CAAA,IAAe,EAAA,EAAK,IAAA,CAAuB,EAAA,EAAI,CAAC,CAAC,IAAA;AAEzE,EAAA,4CAAA,CAAa,EAAA,GAAM;AACjB,IAAA,MAAM,QAAA,EAAU,QAAA,CAAS,CAAA;AACzB,IAAA,GAAA,CAAI,OAAA,EAAS;AACX,MAAA,KAAA,CAAM,GAAA,CAAI,EAAE,CAAA;AAAA,IACd,EAAA,KAAO;AACL,MAAA,KAAA,CAAM,IAAA,CAAK,CAAA;AAAA,IACb;AAAA,EACF,CAAC,CAAA;AAED,EAAA,yCAAA,KAAU,CAAM,IAAI,CAAA;AACtB;ADbA;AACA;AACE;AACA;AACF,mEAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-4ZPZM5IG.cjs","sourcesContent":[null,"import { isReactive, type MaybeReactive } from './binding'\nimport { createEffect } from './effect'\nimport { createRoot, onCleanup, registerRootCleanup } from './lifecycle'\n\nexport { effectScope } from './signal'\n\nexport interface ReactiveScope {\n run<T>(fn: () => T): T\n stop(): void\n}\n\n/**\n * Create an explicit reactive scope that can contain effects/memos and be stopped manually.\n * The scope registers with the current root for cleanup.\n */\nexport function createScope(): ReactiveScope {\n let dispose: (() => void) | null = null\n\n const stop = () => {\n if (dispose) {\n dispose()\n dispose = null\n }\n }\n\n const run = <T>(fn: () => T): T => {\n stop()\n const { dispose: rootDispose, value } = createRoot(fn, { inherit: true })\n dispose = rootDispose\n return value\n }\n\n registerRootCleanup(stop)\n return { run, stop }\n}\n\n/**\n * Run a block of reactive code inside a managed scope that follows a boolean flag.\n * When the flag turns false, the scope is disposed and all contained effects/memos are cleaned up.\n */\nexport function runInScope(flag: MaybeReactive<boolean>, fn: () => void): void {\n const scope = createScope()\n const evaluate = () => (isReactive(flag) ? (flag as () => boolean)() : !!flag)\n\n createEffect(() => {\n const enabled = evaluate()\n if (enabled) {\n scope.run(fn)\n } else {\n scope.stop()\n }\n })\n\n onCleanup(scope.stop)\n}\n"]}
@@ -3,7 +3,7 @@ import {
3
3
  insertNodesBefore,
4
4
  removeNodes,
5
5
  toNodeArray
6
- } from "./chunk-BQG7VEBY.js";
6
+ } from "./chunk-RY5CY4CI.js";
7
7
  import {
8
8
  createRenderEffect,
9
9
  createRootContext,
@@ -12,7 +12,7 @@ import {
12
12
  getCurrentRoot,
13
13
  popRoot,
14
14
  pushRoot
15
- } from "./chunk-FKDMDAUR.js";
15
+ } from "./chunk-7BO6P2KP.js";
16
16
 
17
17
  // src/context.ts
18
18
  var contextStorage = /* @__PURE__ */ new WeakMap();
@@ -108,4 +108,4 @@ export {
108
108
  useContext,
109
109
  hasContext
110
110
  };
111
- //# sourceMappingURL=chunk-KKKYW54Z.js.map
111
+ //# sourceMappingURL=chunk-5OYBRKE4.js.map
@@ -401,7 +401,7 @@ var enterRootGuard = () => true;
401
401
  var exitRootGuard = () => {
402
402
  };
403
403
  var defaultOptions = {
404
- enabled: true,
404
+ enabled: isDev2,
405
405
  maxFlushCyclesPerMicrotask: 1e4,
406
406
  maxEffectRunsPerFlush: 2e4,
407
407
  windowSize: 5,
@@ -978,6 +978,8 @@ var cycle = 0;
978
978
  var batchDepth = 0;
979
979
  var activeSub;
980
980
  var flushScheduled = false;
981
+ var currentFlushId = 0;
982
+ var activeCleanupFlushId = 0;
981
983
  var highPriorityQueue = [];
982
984
  var lowPriorityQueue = [];
983
985
  var isInTransition = false;
@@ -1223,6 +1225,8 @@ function updateSignal(s) {
1223
1225
  const current = s.currentValue;
1224
1226
  const pending = s.pendingValue;
1225
1227
  if (valuesDiffer(s, current, pending)) {
1228
+ s.prevValue = current;
1229
+ s.prevFlushId = currentFlushId;
1226
1230
  s.currentValue = pending;
1227
1231
  return true;
1228
1232
  }
@@ -1241,6 +1245,8 @@ function updateComputed(c) {
1241
1245
  c.flags &= ~Running;
1242
1246
  purgeDeps(c);
1243
1247
  if (valuesDiffer(c, oldValue, newValue)) {
1248
+ c.prevValue = oldValue;
1249
+ c.prevFlushId = currentFlushId;
1244
1250
  c.value = newValue;
1245
1251
  if (isDev5) updateComputedDevtools(c, newValue);
1246
1252
  return true;
@@ -1254,15 +1260,19 @@ function updateComputed(c) {
1254
1260
  }
1255
1261
  function runEffect(e) {
1256
1262
  const flags = e.flags;
1257
- if (flags & Dirty) {
1258
- if (e.runCleanup) {
1259
- inCleanup = true;
1260
- try {
1261
- e.runCleanup();
1262
- } finally {
1263
- inCleanup = false;
1264
- }
1263
+ const runCleanup = () => {
1264
+ if (!e.runCleanup) return;
1265
+ inCleanup = true;
1266
+ activeCleanupFlushId = currentFlushId;
1267
+ try {
1268
+ e.runCleanup();
1269
+ } finally {
1270
+ activeCleanupFlushId = 0;
1271
+ inCleanup = false;
1265
1272
  }
1273
+ };
1274
+ if (flags & Dirty) {
1275
+ runCleanup();
1266
1276
  ++cycle;
1267
1277
  if (isDev5) effectRunDevtools(e);
1268
1278
  e.depsTail = void 0;
@@ -1280,14 +1290,6 @@ function runEffect(e) {
1280
1290
  throw err;
1281
1291
  }
1282
1292
  } else if (flags & Pending && e.deps) {
1283
- if (e.runCleanup) {
1284
- inCleanup = true;
1285
- try {
1286
- e.runCleanup();
1287
- } finally {
1288
- inCleanup = false;
1289
- }
1290
- }
1291
1293
  let isDirty = false;
1292
1294
  try {
1293
1295
  isDirty = checkDirty(e.deps, e);
@@ -1307,6 +1309,7 @@ function runEffect(e) {
1307
1309
  throw err;
1308
1310
  }
1309
1311
  if (isDirty) {
1312
+ runCleanup();
1310
1313
  ++cycle;
1311
1314
  if (isDev5) effectRunDevtools(e);
1312
1315
  e.depsTail = void 0;
@@ -1352,6 +1355,7 @@ function flush() {
1352
1355
  endFlushGuard();
1353
1356
  return;
1354
1357
  }
1358
+ currentFlushId++;
1355
1359
  flushScheduled = false;
1356
1360
  let highIndex = 0;
1357
1361
  while (highIndex < highPriorityQueue.length) {
@@ -1456,6 +1460,12 @@ function signalOper(value) {
1456
1460
  if (subs !== void 0) shallowPropagate(subs);
1457
1461
  }
1458
1462
  }
1463
+ if (inCleanup) {
1464
+ if (this.prevFlushId === activeCleanupFlushId) {
1465
+ return this.prevValue;
1466
+ }
1467
+ return this.currentValue;
1468
+ }
1459
1469
  let sub = activeSub;
1460
1470
  while (sub !== void 0) {
1461
1471
  if (sub.flags & 3) {
@@ -1489,7 +1499,12 @@ function computed(getter, options2) {
1489
1499
  return bound;
1490
1500
  }
1491
1501
  function computedOper() {
1492
- if (inCleanup) return this.value;
1502
+ if (inCleanup) {
1503
+ if (this.prevFlushId === activeCleanupFlushId) {
1504
+ return this.prevValue;
1505
+ }
1506
+ return this.value;
1507
+ }
1493
1508
  const flags = this.flags;
1494
1509
  if (flags & Dirty) {
1495
1510
  if (updateComputed(this)) {
@@ -1637,6 +1652,8 @@ function __resetReactiveState() {
1637
1652
  isInTransition = false;
1638
1653
  inCleanup = false;
1639
1654
  cycle = 0;
1655
+ currentFlushId = 0;
1656
+ activeCleanupFlushId = 0;
1640
1657
  }
1641
1658
  function untrack(fn) {
1642
1659
  const prev = activeSub;
@@ -2360,4 +2377,4 @@ function deserializeValue(value, refs = /* @__PURE__ */ new Map(), path = "$") {
2360
2377
 
2361
2378
 
2362
2379
  exports.BooleanAttributes = BooleanAttributes; exports.Properties = Properties; exports.ChildProperties = ChildProperties; exports.Aliases = Aliases; exports.getPropAlias = getPropAlias; exports.$$EVENTS = $$EVENTS; exports.DelegatedEvents = DelegatedEvents; exports.SVGElements = SVGElements; exports.SVGNamespace = SVGNamespace; exports.UnitlessStyles = UnitlessStyles; exports.getDevtoolsHook = getDevtoolsHook; exports.setCycleProtectionOptions = setCycleProtectionOptions; exports.createRootContext = createRootContext; exports.pushRoot = pushRoot; exports.getCurrentRoot = getCurrentRoot; exports.popRoot = popRoot; exports.onMount = onMount; exports.onDestroy = onDestroy; exports.onCleanup = onCleanup; exports.flushOnMount = flushOnMount; exports.registerRootCleanup = registerRootCleanup; exports.destroyRoot = destroyRoot; exports.createRoot = createRoot; exports.registerErrorHandler = registerErrorHandler; exports.registerSuspenseHandler = registerSuspenseHandler; exports.handleError = handleError; exports.handleSuspend = handleSuspend; exports.createMemo = createMemo; exports.__fictUseContext = __fictUseContext; exports.__fictPushContext = __fictPushContext; exports.__fictPrepareContext = __fictPrepareContext; exports.__fictGetCurrentComponentId = __fictGetCurrentComponentId; exports.__fictPopContext = __fictPopContext; exports.__fictResetContext = __fictResetContext; exports.__fictUseSignal = __fictUseSignal; exports.__fictUseMemo = __fictUseMemo; exports.__fictUseEffect = __fictUseEffect; exports.__fictRender = __fictRender; exports.scheduleFlush = scheduleFlush; exports.flush = flush; exports.signal = signal; exports.computed = computed; exports.effectScope = effectScope; exports.batch = batch; exports.setActiveSub = setActiveSub; exports.__resetReactiveState = __resetReactiveState; exports.untrack = untrack; exports.isSignal = isSignal; exports.isComputed = isComputed; exports.isEffect = isEffect; exports.isEffectScope = isEffectScope; exports.setTransitionContext = setTransitionContext; exports.createSelector = createSelector; exports.createEffect = createEffect; exports.createRenderEffect = createRenderEffect; exports.createStore = createStore; exports.isStoreProxy = isStoreProxy; exports.unwrapStore = unwrapStore; exports.__fictEnableSSR = __fictEnableSSR; exports.__fictDisableSSR = __fictDisableSSR; exports.__fictEnableResumable = __fictEnableResumable; exports.__fictDisableResumable = __fictDisableResumable; exports.__fictIsResumable = __fictIsResumable; exports.__fictIsSSR = __fictIsSSR; exports.__fictEnterHydration = __fictEnterHydration; exports.__fictExitHydration = __fictExitHydration; exports.__fictIsHydrating = __fictIsHydrating; exports.__fictRegisterScope = __fictRegisterScope; exports.__fictGetScopeRegistry = __fictGetScopeRegistry; exports.__fictSerializeSSRState = __fictSerializeSSRState; exports.__fictSetSSRState = __fictSetSSRState; exports.__fictGetSSRScope = __fictGetSSRScope; exports.__fictEnsureScope = __fictEnsureScope; exports.__fictUseLexicalScope = __fictUseLexicalScope; exports.__fictGetScopeProps = __fictGetScopeProps; exports.__fictQrl = __fictQrl; exports.__fictRegisterResume = __fictRegisterResume; exports.__fictGetResume = __fictGetResume; exports.serializeValue = serializeValue; exports.deserializeValue = deserializeValue;
2363
- //# sourceMappingURL=chunk-6SOPF5LZ.cjs.map
2380
+ //# sourceMappingURL=chunk-6RCEIWZL.cjs.map