@slimlib/store 2.0.0 → 2.0.2

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.
package/index.mjs ADDED
@@ -0,0 +1,825 @@
1
+ import { DEV } from 'esm-env';
2
+
3
+ let activeScope;
4
+
5
+ const setActiveScope = (scope) => {
6
+ activeScope = scope;
7
+ };
8
+
9
+ let scheduler = queueMicrotask;
10
+
11
+ const setScheduler = (newScheduler) => {
12
+ scheduler = newScheduler;
13
+ };
14
+
15
+ const [unwrap, propertyDepsSymbol, trackSymbol, childrenSymbol,
16
+
17
+ ] = Array.from([, , , ,], Symbol);
18
+
19
+ const noopGetter = () => undefined;
20
+
21
+ class DepsSet extends Set {
22
+ a = 0;
23
+ b;
24
+ constructor(getter) {
25
+ super();
26
+ this.b = getter;
27
+ }
28
+ }
29
+
30
+ const createSourceEntry = (dependents, node, version, getter, storedValue) => ({
31
+ c: dependents,
32
+ d: node,
33
+ a: version,
34
+ b: getter,
35
+ e: storedValue,
36
+ });
37
+ let flushScheduled = false;
38
+
39
+ let globalVersion = 1;
40
+ const batched = [];
41
+ let lastAddedId = 0;
42
+ let needsSort = false;
43
+
44
+ let currentComputing;
45
+ let tracked = true;
46
+
47
+ const setTracked = (value) => {
48
+ tracked = value;
49
+ };
50
+
51
+ const batchedAdd = (node) => {
52
+ const nodeId = node.f;
53
+
54
+ if (nodeId < lastAddedId) {
55
+ needsSort = true;
56
+ }
57
+ lastAddedId = nodeId;
58
+ batched.push(node);
59
+ };
60
+
61
+ const batchedAddNew = (node, effectId) => {
62
+ lastAddedId = effectId;
63
+ batched.push(node);
64
+ };
65
+
66
+ const unwrapValue = (value) => (value !== null &&
67
+ (typeof value === 'object' || typeof value === 'function') &&
68
+ value[unwrap]) ||
69
+ value;
70
+
71
+ const makeLive = (node) => {
72
+ node.g |= 64 ;
73
+ const nodeSources = node.h;
74
+ for (let i = 0, len = nodeSources.length; i < len; ++i) {
75
+ const { c: c, d: sourceNode } = nodeSources[i];
76
+ c.add(node);
77
+ if (sourceNode !== undefined && (sourceNode.g & (8 | 64 )) === 0) {
78
+ makeLive(sourceNode);
79
+ }
80
+ }
81
+ };
82
+
83
+ const makeNonLive = (node) => {
84
+ node.g &= -65 ;
85
+ const nodeSources = node.h;
86
+ for (let i = 0, len = nodeSources.length; i < len; ++i) {
87
+ const { c: c, d: sourceNode } = nodeSources[i];
88
+ c.delete(node);
89
+
90
+ if (sourceNode !== undefined &&
91
+ (sourceNode.g & (8 | 64 )) === 64 &&
92
+ sourceNode.i.size === 0) {
93
+ makeNonLive(sourceNode);
94
+ }
95
+ }
96
+ };
97
+
98
+ const clearSources = (node, fromIndex = 0) => {
99
+ const isLive = (node.g & (8 | 64 )) !== 0;
100
+ const nodeSources = node.h;
101
+ for (let i = fromIndex, len = nodeSources.length; i < len; ++i) {
102
+ const { c: c, d: sourceNode } = nodeSources[i];
103
+
104
+ let retained = false;
105
+ for (let j = 0; j < fromIndex && !retained; ++j) {
106
+ retained = nodeSources[j].c === c;
107
+ }
108
+ if (!retained) {
109
+
110
+ c.delete(node);
111
+
112
+ if (isLive &&
113
+ sourceNode !== undefined &&
114
+ (sourceNode.g & (8 | 64 )) === 64 &&
115
+ sourceNode.i.size === 0) {
116
+ makeNonLive(sourceNode);
117
+ }
118
+ }
119
+ }
120
+ nodeSources.length = fromIndex;
121
+ };
122
+
123
+ const flushEffects = () => {
124
+ flushScheduled = false;
125
+
126
+ const nodes = batched.slice();
127
+ batched.length = 0;
128
+ if (needsSort) {
129
+ nodes.sort((a, b) => a.f - b.f);
130
+ }
131
+ lastAddedId = 0;
132
+ needsSort = false;
133
+
134
+ for (let i = 0, len = nodes.length; i < len; ++i) {
135
+ const node = nodes[i];
136
+ try {
137
+ node.j?.();
138
+ }
139
+ catch (e) {
140
+ console.error(e);
141
+ }
142
+ }
143
+ };
144
+
145
+ const scheduleFlush = () => {
146
+ if (!flushScheduled) {
147
+ flushScheduled = true;
148
+ scheduler(flushEffects);
149
+ }
150
+ };
151
+
152
+ const trackStateDependency = (deps, valueGetter, cachedValue) => {
153
+
154
+ const sourcesArray = currentComputing.h;
155
+ const skipIndex = currentComputing.k;
156
+ const existing = sourcesArray[skipIndex];
157
+ const noSource = existing === undefined;
158
+ if (noSource || existing.c !== deps) {
159
+
160
+ if (!noSource) {
161
+ clearSources(currentComputing, skipIndex);
162
+ }
163
+
164
+ sourcesArray.push(createSourceEntry(deps, undefined, deps.a, valueGetter, cachedValue));
165
+
166
+ currentComputing.g |= 128 ;
167
+
168
+ if ((currentComputing.g & (8 | 64 )) !== 0) {
169
+ deps.add(currentComputing);
170
+ }
171
+ }
172
+ else {
173
+
174
+ const entry = sourcesArray[skipIndex];
175
+ entry.a = deps.a;
176
+ entry.b = valueGetter;
177
+ entry.e = cachedValue;
178
+
179
+ currentComputing.g |= 128 ;
180
+ }
181
+ ++currentComputing.k;
182
+ };
183
+
184
+ const markNeedsCheck = (node) => {
185
+ const flags = node.g;
186
+
187
+ if ((flags & (4 | 1 | 2 )) !== 0) {
188
+
189
+ if ((flags & (4 | 8 | 1 )) === (4 | 8 )) {
190
+ node.g = flags | 1 ;
191
+ batchedAdd(node);
192
+ scheduleFlush();
193
+ }
194
+ return;
195
+ }
196
+
197
+ node.g = flags | 2 ;
198
+ if ((flags & 8 ) !== 0) {
199
+ batchedAdd(node);
200
+ scheduleFlush();
201
+ }
202
+ for (const dep of node.i) {
203
+ markNeedsCheck(dep);
204
+ }
205
+ };
206
+
207
+ const markDependents = (deps) => {
208
+ ++globalVersion;
209
+
210
+ ++deps.a;
211
+ for (const dep of deps) {
212
+ markNeedsCheck(dep);
213
+ }
214
+ };
215
+
216
+ const runWithTracking = (node, getter) => {
217
+
218
+ node.g = (node.g & -388) | 4 ;
219
+ node.k = 0;
220
+ const prev = currentComputing;
221
+ const prevTracked = tracked;
222
+ currentComputing = node;
223
+ tracked = true;
224
+ try {
225
+ return getter();
226
+ }
227
+ finally {
228
+ currentComputing = prev;
229
+ tracked = prevTracked;
230
+
231
+ const flags = (node.g &= -5 );
232
+ const nodeSources = node.h;
233
+ const skipped = node.k;
234
+ const nodeSourcesLength = nodeSources.length;
235
+
236
+ if ((flags & 256 ) !== 0) {
237
+ const updateLen = Math.min(skipped, nodeSourcesLength);
238
+ for (let i = 0; i < updateLen; ++i) {
239
+ const entry = nodeSources[i];
240
+ const entryNode = entry.d;
241
+ if (entryNode !== undefined) {
242
+ entry.a = entryNode.a;
243
+ }
244
+ }
245
+ }
246
+
247
+ if (nodeSourcesLength > skipped) {
248
+ clearSources(node, skipped);
249
+ }
250
+ }
251
+ };
252
+
253
+ const untracked = (callback) => {
254
+ const prevTracked = tracked;
255
+ tracked = false;
256
+ try {
257
+ return callback();
258
+ }
259
+ finally {
260
+ tracked = prevTracked;
261
+ }
262
+ };
263
+
264
+ const checkComputedSources = (sourcesArray) => {
265
+ const prevTracked = tracked;
266
+ tracked = false;
267
+ const len = sourcesArray.length;
268
+ for (let i = 0; i < len; ++i) {
269
+ const sourceEntry = sourcesArray[i];
270
+ const sourceNode = sourceEntry.d;
271
+
272
+ try {
273
+ computedRead(sourceNode);
274
+ }
275
+ catch {
276
+
277
+ tracked = prevTracked;
278
+ return true;
279
+ }
280
+
281
+ if (sourceEntry.a !== sourceNode.a) {
282
+ tracked = prevTracked;
283
+ return true;
284
+ }
285
+ }
286
+ tracked = prevTracked;
287
+ return false;
288
+ };
289
+
290
+ const WARN_ON_WRITE_IN_COMPUTED = 1 << 0;
291
+
292
+ const SUPPRESS_EFFECT_GC_WARNING = 1 << 1;
293
+
294
+ const WARN_ON_UNTRACKED_EFFECT = 1 << 2;
295
+
296
+ let debugConfigFlags = 0;
297
+
298
+ const debugConfig = (flags) => {
299
+ debugConfigFlags = flags | 0;
300
+ };
301
+
302
+ const safeForEach = (fns) => {
303
+ for (let i = 0, len = fns.length; i < len; ++i) {
304
+ const fn = fns[i];
305
+ try {
306
+ fn?.();
307
+ }
308
+ catch (e) {
309
+ console.error(e);
310
+ }
311
+ }
312
+ };
313
+
314
+ const warnIfWriteInComputed = (context) => {
315
+ if (DEV && (debugConfigFlags & WARN_ON_WRITE_IN_COMPUTED) !== 0 && currentComputing && (currentComputing.g & 8 ) === 0) {
316
+ console.warn(`[@slimlib/store] Writing to ${context} inside a computed is not recommended. The computed will not automatically re-run when this value changes, which may lead to stale values.`);
317
+ }
318
+ };
319
+
320
+ const effectRegistry = DEV
321
+ ? new FinalizationRegistry((stackTrace) => {
322
+ if ((debugConfigFlags & SUPPRESS_EFFECT_GC_WARNING) === 0) {
323
+ console.warn(`[@slimlib/store] Effect was garbage collected without being disposed. This may indicate a memory leak. Effects should be disposed by calling the returned dispose function or by using a scope that is properly disposed.\n\nEffect was created at:\n${stackTrace}`);
324
+ }
325
+ })
326
+ : null;
327
+
328
+ const registerEffect = DEV
329
+ ? () => {
330
+ const token = {};
331
+
332
+ const relevantStack = String(new Error().stack).split('\n').slice(3).join('\n');
333
+ effectRegistry.register(token, relevantStack, token);
334
+ return token;
335
+ }
336
+ : () => undefined;
337
+
338
+ const unregisterEffect = DEV
339
+ ? (token) => {
340
+ effectRegistry?.unregister(token);
341
+ }
342
+ : () => { };
343
+
344
+ const warnIfNoActiveScope = DEV
345
+ ? (activeScope) => {
346
+ if ((debugConfigFlags & WARN_ON_UNTRACKED_EFFECT) !== 0 && !activeScope) {
347
+ console.warn(`[@slimlib/store] Effect created without an active scope. Consider using scope() or setActiveScope() to track effects for proper lifecycle management.`);
348
+ }
349
+ }
350
+ : () => { };
351
+ const cycleMessage = 'Detected cycle in computations.';
352
+
353
+ function computedRead(self) {
354
+
355
+ if (tracked && currentComputing !== undefined) {
356
+
357
+ const consumerSources = currentComputing.h;
358
+ const skipIndex = currentComputing.k;
359
+ const deps = self.i;
360
+ const existing = consumerSources[skipIndex];
361
+ const noSource = existing === undefined;
362
+ if (noSource || existing.c !== deps) {
363
+
364
+ if (!noSource) {
365
+ clearSources(currentComputing, skipIndex);
366
+ }
367
+
368
+ consumerSources.push(createSourceEntry(deps, self, 0, undefined, undefined));
369
+
370
+ if ((currentComputing.g & (8 | 64 )) !== 0) {
371
+ deps.add(currentComputing);
372
+
373
+ if ((self.g & 64 ) === 0) {
374
+ makeLive(self);
375
+ }
376
+ }
377
+ }
378
+
379
+ currentComputing.g |= 256 ;
380
+ ++currentComputing.k;
381
+ }
382
+ let flags = self.g;
383
+ const sourcesArray = self.h;
384
+
385
+ if ((flags & 4 ) !== 0) {
386
+ throw new Error(cycleMessage);
387
+ }
388
+
389
+ const hasCached = (flags & (16 | 32 )) !== 0;
390
+
391
+ checkCache: if ((flags & (1 | 2 )) === 0 && hasCached) {
392
+
393
+ if (self.f === globalVersion) {
394
+ if ((flags & 32 ) !== 0) {
395
+ throw self.l;
396
+ }
397
+ return self.l;
398
+ }
399
+
400
+ if ((flags & 64 ) === 0) {
401
+ let sourceChanged = false;
402
+
403
+ const prevTracked = tracked;
404
+
405
+ setTracked(false);
406
+ for (let i = 0, len = sourcesArray.length; i < len; ++i) {
407
+ const source = sourcesArray[i];
408
+ const sourceNode = source.d;
409
+ if (sourceNode === undefined) {
410
+
411
+ const currentDepsVersion = source.c.a;
412
+ if (source.a !== currentDepsVersion) {
413
+
414
+ const storedValue = source.e;
415
+ const storedType = typeof storedValue;
416
+ if (storedValue === null || (storedType !== 'object' && storedType !== 'function')) {
417
+ const currentValue = source.b();
418
+ if (Object.is(currentValue, storedValue)) {
419
+
420
+ source.a = currentDepsVersion;
421
+ continue;
422
+ }
423
+ }
424
+
425
+ sourceChanged = true;
426
+ break;
427
+ }
428
+ }
429
+ else {
430
+
431
+ try {
432
+ computedRead(sourceNode);
433
+ }
434
+ catch {
435
+
436
+ sourceChanged = true;
437
+ break;
438
+ }
439
+ if (source.a !== sourceNode.a) {
440
+ sourceChanged = true;
441
+ break;
442
+ }
443
+ }
444
+ }
445
+ setTracked(prevTracked);
446
+ if (sourceChanged) {
447
+
448
+ self.g = flags |= 1 ;
449
+ break checkCache;
450
+ }
451
+
452
+ self.f = globalVersion;
453
+ if ((flags & 32 ) !== 0) {
454
+ throw self.l;
455
+ }
456
+ return self.l;
457
+ }
458
+ }
459
+
460
+ if ((flags & (1 | 2 | 128 )) === 2 && hasCached) {
461
+ if (checkComputedSources(sourcesArray)) {
462
+
463
+ flags = (flags & -3 ) | 1 ;
464
+ }
465
+ else {
466
+
467
+ self.g = flags & -3 ;
468
+
469
+ self.f = globalVersion;
470
+ if ((flags & 32 ) !== 0) {
471
+ throw self.l;
472
+ }
473
+ return self.l;
474
+ }
475
+ }
476
+
477
+ if ((flags & (1 | 2 )) !== 0) {
478
+ const wasDirty = (flags & 1 ) !== 0;
479
+ runWithTracking(self, () => {
480
+ try {
481
+ const newValue = self.j();
482
+
483
+ const changed = (flags & 16 ) === 0 || !self.m(self.l, newValue);
484
+ if (changed) {
485
+ self.l = newValue;
486
+
487
+ ++self.a;
488
+ self.g = (self.g | 16 ) & ~32 ;
489
+
490
+ for (const dep of self.i) {
491
+ const depFlags = dep.g;
492
+ if ((depFlags & (4 | 1 | 2 )) === 2 ) {
493
+ dep.g = depFlags | 1 ;
494
+ }
495
+ }
496
+ }
497
+ else if (wasDirty) {
498
+ self.g |= 16 ;
499
+ }
500
+
501
+ self.f = globalVersion;
502
+ }
503
+ catch (e) {
504
+
505
+ ++self.a;
506
+ self.l = e;
507
+ self.g = (self.g & ~16 ) | 32 ;
508
+ self.f = globalVersion;
509
+ }
510
+ });
511
+ }
512
+
513
+ if ((self.g & 32 ) !== 0) {
514
+ throw self.l;
515
+ }
516
+ return self.l;
517
+ }
518
+
519
+ const computed = (getter, equals = Object.is) => {
520
+ const node = {
521
+ h: [],
522
+ i: new DepsSet(noopGetter),
523
+ g: 1 ,
524
+ k: 0,
525
+ a: 0,
526
+ l: undefined,
527
+ f: 0,
528
+ j: getter,
529
+ m: equals,
530
+ };
531
+ return () => computedRead(node);
532
+ };
533
+
534
+ let effectCreationCounter = 0;
535
+
536
+ const effect = (callback) => {
537
+ let disposed = false;
538
+
539
+ const gcToken = registerEffect();
540
+
541
+ warnIfNoActiveScope(activeScope);
542
+
543
+ let node;
544
+
545
+ const runner = () => {
546
+
547
+ if (disposed) {
548
+ return;
549
+ }
550
+
551
+ const flags = node.g;
552
+ if ((flags & 4 ) !== 0) {
553
+ throw new Error(cycleMessage);
554
+ }
555
+
556
+ if ((flags & (1 | 2 | 128 )) === 2 ) {
557
+
558
+ if (!checkComputedSources(node.h)) {
559
+ node.g = flags & -3 ;
560
+ return;
561
+ }
562
+ }
563
+
564
+ runWithTracking(node, () => {
565
+
566
+ if (typeof node.l === 'function') {
567
+ node.l();
568
+ }
569
+
570
+ node.l = callback();
571
+ });
572
+ };
573
+
574
+ node = {
575
+ h: [],
576
+ i: new DepsSet(noopGetter),
577
+ g: 1 | 8 ,
578
+ k: 0,
579
+ a: 0,
580
+ l: undefined,
581
+ f: ++effectCreationCounter,
582
+ j: runner,
583
+ m: Object.is,
584
+ };
585
+ const effectId = node.f;
586
+ const dispose = () => {
587
+
588
+ disposed = true;
589
+
590
+ unregisterEffect(gcToken);
591
+
592
+ if (typeof node.l === 'function') {
593
+ node.l();
594
+ }
595
+ clearSources(node);
596
+ };
597
+
598
+ if (activeScope) {
599
+ activeScope[trackSymbol](dispose);
600
+ }
601
+
602
+ batchedAddNew(node, effectId);
603
+ scheduleFlush();
604
+ return dispose;
605
+ };
606
+
607
+ const scope = (callback, parent = activeScope) => {
608
+ const effects = [];
609
+ const children = [];
610
+ const cleanups = [];
611
+ let disposed = false;
612
+ let myIndex = -1;
613
+
614
+ const onDispose = cleanup => {
615
+ if (disposed) {
616
+ return;
617
+ }
618
+ cleanups.push(cleanup);
619
+ };
620
+ const ctx = ((cb) => {
621
+ if (!cb) {
622
+
623
+ if (disposed) {
624
+ return;
625
+ }
626
+
627
+ disposed = true;
628
+
629
+ safeForEach(children);
630
+
631
+ safeForEach(effects);
632
+ effects.length = 0;
633
+
634
+ safeForEach(cleanups);
635
+
636
+ if (parent) {
637
+ parent[childrenSymbol][myIndex] = undefined;
638
+ }
639
+ return;
640
+ }
641
+
642
+ if (disposed) {
643
+ return ctx;
644
+ }
645
+
646
+ const prev = activeScope;
647
+ setActiveScope(ctx);
648
+ try {
649
+ cb(onDispose);
650
+ }
651
+ finally {
652
+ setActiveScope(prev);
653
+ }
654
+ return ctx;
655
+ });
656
+
657
+ ctx[trackSymbol] = (dispose) => effects.push(dispose);
658
+ ctx[childrenSymbol] = children;
659
+
660
+ if (parent) {
661
+ myIndex = parent[childrenSymbol].push(ctx) - 1;
662
+ }
663
+
664
+ if (callback) {
665
+ ctx(callback);
666
+ }
667
+ return ctx;
668
+ };
669
+
670
+ function signal(initialValue) {
671
+ let value = initialValue;
672
+ let deps;
673
+
674
+ const read = () => {
675
+
676
+ if (tracked && currentComputing !== undefined) {
677
+
678
+ trackStateDependency((deps ??= new DepsSet(read)), read, value);
679
+ }
680
+ return value;
681
+
682
+ };
683
+
684
+ read.set = (newValue) => {
685
+
686
+ warnIfWriteInComputed('signal');
687
+ if (!Object.is(value, newValue)) {
688
+ value = newValue;
689
+ if (deps !== undefined) {
690
+ markDependents(deps);
691
+ }
692
+ }
693
+
694
+ };
695
+ return read;
696
+ }
697
+
698
+ function state(object = {}) {
699
+
700
+ const proxiesCache = new WeakMap();
701
+
702
+ const notifyPropertyDependents = (target, property) => {
703
+ const propsMap = target[propertyDepsSymbol];
704
+ if (!propsMap)
705
+ return;
706
+ const deps = propsMap.get(property);
707
+ if (deps !== undefined) {
708
+ markDependents(deps);
709
+ }
710
+ };
711
+ const createProxy = (object) => {
712
+ if (proxiesCache.has(object)) {
713
+ return proxiesCache.get(object);
714
+ }
715
+ let methodCache;
716
+ const proxy = new Proxy(object, {
717
+
718
+ set(target, p, newValue) {
719
+ warnIfWriteInComputed('state');
720
+ const realValue = unwrapValue(newValue);
721
+
722
+ if (!Object.is(target[p], realValue)) {
723
+ target[p] = realValue;
724
+
725
+ notifyPropertyDependents(target, p);
726
+
727
+ methodCache?.delete(p);
728
+ }
729
+ return true;
730
+ },
731
+
732
+ get(target, p) {
733
+ if (p === unwrap)
734
+ return target;
735
+
736
+ const propValue = target[p];
737
+
738
+ if (tracked && currentComputing !== undefined) {
739
+
740
+ let propsMap = target[propertyDepsSymbol];
741
+ if (propsMap === undefined) {
742
+ propsMap = new Map();
743
+ Object.defineProperty(target, propertyDepsSymbol, { value: propsMap });
744
+ }
745
+
746
+ let deps = propsMap.get(p);
747
+ if (deps === undefined) {
748
+
749
+ const propertyGetter = () => target[p];
750
+
751
+ propsMap.set(p, (deps = new DepsSet(propertyGetter)));
752
+ }
753
+
754
+ trackStateDependency(deps, deps.b, propValue);
755
+ }
756
+
757
+ const propertyType = typeof propValue;
758
+ if (propValue === null || (propertyType !== 'object' && propertyType !== 'function')) {
759
+ return propValue;
760
+ }
761
+
762
+ if (propertyType === 'function') {
763
+
764
+ if (methodCache === undefined) {
765
+ methodCache = new Map();
766
+ }
767
+ let cached = methodCache.get(p);
768
+ if (cached === undefined) {
769
+
770
+ const method = propValue;
771
+ cached = (...args) => {
772
+
773
+ for (let i = 0, len = args.length; i < len; ++i) {
774
+ args[i] = unwrapValue(args[i]);
775
+ }
776
+ const result = method.apply(target, args);
777
+
778
+ if (currentComputing === undefined) {
779
+ const propsMap = target[propertyDepsSymbol];
780
+ if (propsMap === undefined)
781
+ return result;
782
+ for (const deps of propsMap.values()) {
783
+
784
+ markDependents(deps);
785
+ }
786
+ }
787
+ return result;
788
+ };
789
+ methodCache.set(p, cached);
790
+ }
791
+ return cached;
792
+ }
793
+
794
+ return createProxy(propValue);
795
+ },
796
+
797
+ defineProperty(target, property, attributes) {
798
+ warnIfWriteInComputed('state');
799
+ const result = Reflect.defineProperty(target, property, attributes);
800
+ if (result) {
801
+
802
+ notifyPropertyDependents(target, property);
803
+ }
804
+ return result;
805
+ },
806
+
807
+ deleteProperty(target, p) {
808
+ warnIfWriteInComputed('state');
809
+ const result = Reflect.deleteProperty(target, p);
810
+ if (result) {
811
+
812
+ notifyPropertyDependents(target, p);
813
+
814
+ methodCache?.delete(p);
815
+ }
816
+ return result;
817
+ },
818
+ });
819
+ proxiesCache.set(object, proxy);
820
+ return proxy;
821
+ };
822
+ return createProxy(object);
823
+ }
824
+
825
+ export { SUPPRESS_EFFECT_GC_WARNING, WARN_ON_UNTRACKED_EFFECT, WARN_ON_WRITE_IN_COMPUTED, activeScope, computed, debugConfig, effect, flushEffects, scope, setActiveScope, setScheduler, signal, state, untracked, unwrapValue };