@zeus-js/signal 0.1.1-beta.1 → 0.1.1-beta.11
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/diagnostics.cjs +7 -0
- package/dist/diagnostics.cjs +11 -0
- package/dist/diagnostics.d.ts +1 -0
- package/dist/diagnostics.js +7 -0
- package/dist/diagnostics.prod.cjs +11 -0
- package/dist/diagnostics.prod.js +7 -0
- package/dist/internal.cjs +96 -3
- package/dist/internal.d.ts +23 -0
- package/dist/internal.js +96 -4
- package/dist/internal.prod.cjs +96 -3
- package/dist/internal.prod.js +96 -4
- package/dist/signal.cjs +1 -1
- package/dist/signal.esm-browser.js +4 -2
- package/dist/signal.esm-browser.prod.js +1 -1
- package/dist/signal.esm-bundler.js +1 -1
- package/dist/signal.global.js +4 -2
- package/dist/signal.global.prod.js +1 -1
- package/dist/signal.prod.cjs +1 -1
- package/package.json +16 -2
package/diagnostics.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
let _zeus_js_signal_internal = require("@zeus-js/signal/internal");
|
|
11
|
+
exports.createRuntimeDiagnosticsSession = _zeus_js_signal_internal.createRuntimeDiagnosticsSession;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RuntimeDiagnosticsSession, RuntimeDiagnosticsSnapshot, createRuntimeDiagnosticsSession } from '@zeus-js/signal/internal';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
let _zeus_js_signal_internal = require("@zeus-js/signal/internal");
|
|
11
|
+
exports.createRuntimeDiagnosticsSession = _zeus_js_signal_internal.createRuntimeDiagnosticsSession;
|
package/dist/internal.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* signal v0.1.1-beta.
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -32,6 +32,57 @@ let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
|
|
|
32
32
|
return ReactiveFlags;
|
|
33
33
|
}({});
|
|
34
34
|
//#endregion
|
|
35
|
+
//#region packages/core/signal/src/runtime-diagnostics.ts
|
|
36
|
+
let activeRuntimeDiagnostics;
|
|
37
|
+
function runWithRuntimeDiagnostics(diagnostics, fn) {
|
|
38
|
+
if (!(diagnostics === null || diagnostics === void 0 ? void 0 : diagnostics[0])) return fn();
|
|
39
|
+
const previous = activeRuntimeDiagnostics;
|
|
40
|
+
activeRuntimeDiagnostics = diagnostics;
|
|
41
|
+
try {
|
|
42
|
+
return fn();
|
|
43
|
+
} finally {
|
|
44
|
+
activeRuntimeDiagnostics = (previous === null || previous === void 0 ? void 0 : previous[0]) ? previous : void 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function createRuntimeDiagnosticsSession() {
|
|
48
|
+
const diagnostics = [
|
|
49
|
+
true,
|
|
50
|
+
0,
|
|
51
|
+
0,
|
|
52
|
+
0,
|
|
53
|
+
0,
|
|
54
|
+
0,
|
|
55
|
+
0,
|
|
56
|
+
0,
|
|
57
|
+
(run) => () => runWithRuntimeDiagnostics(diagnostics, run),
|
|
58
|
+
(run) => (fn) => runWithRuntimeDiagnostics(diagnostics, () => run(fn))
|
|
59
|
+
];
|
|
60
|
+
return {
|
|
61
|
+
run(fn) {
|
|
62
|
+
return runWithRuntimeDiagnostics(diagnostics, fn);
|
|
63
|
+
},
|
|
64
|
+
snapshot() {
|
|
65
|
+
const allocationsCreated = diagnostics[1] + diagnostics[3] + diagnostics[4] + diagnostics[6] + diagnostics[7];
|
|
66
|
+
const allocationsDisposed = diagnostics[2] + diagnostics[5];
|
|
67
|
+
return {
|
|
68
|
+
effectsCreated: diagnostics[1],
|
|
69
|
+
effectsDisposed: diagnostics[2],
|
|
70
|
+
proxiesCreated: diagnostics[3],
|
|
71
|
+
scopesCreated: diagnostics[4],
|
|
72
|
+
scopesDisposed: diagnostics[5],
|
|
73
|
+
refsCreated: diagnostics[6],
|
|
74
|
+
memosCreated: diagnostics[7],
|
|
75
|
+
allocationsCreated,
|
|
76
|
+
allocationsDisposed
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
dispose() {
|
|
80
|
+
diagnostics[0] = false;
|
|
81
|
+
if (activeRuntimeDiagnostics === diagnostics) activeRuntimeDiagnostics = void 0;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
35
86
|
//#region packages/core/signal/src/warning.ts
|
|
36
87
|
function warn(msg, ...args) {
|
|
37
88
|
console.warn(`[Zeus warn] ${msg}`, ...args);
|
|
@@ -49,12 +100,27 @@ var EffectScope = class {
|
|
|
49
100
|
this._isPaused = false;
|
|
50
101
|
this._warnOnRun = true;
|
|
51
102
|
this.__v_skip = true;
|
|
103
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
104
|
+
if (diagnostics) {
|
|
105
|
+
diagnostics[4]++;
|
|
106
|
+
this.run = diagnostics[9](this.run.bind(this));
|
|
107
|
+
const stop = this.stop.bind(this);
|
|
108
|
+
this.stop = (fromParent) => {
|
|
109
|
+
const active = this._active;
|
|
110
|
+
try {
|
|
111
|
+
stop(fromParent);
|
|
112
|
+
} finally {
|
|
113
|
+
if (active && !this._active && diagnostics[0]) diagnostics[5]++;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
52
117
|
if (!detached && activeEffectScope) if (activeEffectScope.active) {
|
|
53
118
|
this.parent = activeEffectScope;
|
|
54
119
|
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
55
120
|
} else {
|
|
56
121
|
this._active = false;
|
|
57
122
|
this._warnOnRun = false;
|
|
123
|
+
if (diagnostics) diagnostics[5]++;
|
|
58
124
|
}
|
|
59
125
|
}
|
|
60
126
|
get active() {
|
|
@@ -190,6 +256,10 @@ let EffectFlags = /* @__PURE__ */ function(EffectFlags) {
|
|
|
190
256
|
EffectFlags[EffectFlags["DIRTY"] = 16] = "DIRTY";
|
|
191
257
|
EffectFlags[EffectFlags["ALLOW_RECURSE"] = 32] = "ALLOW_RECURSE";
|
|
192
258
|
EffectFlags[EffectFlags["PAUSED"] = 64] = "PAUSED";
|
|
259
|
+
/**
|
|
260
|
+
* ComputedRef has evaluated, or a ReactiveEffect has tracked a computed
|
|
261
|
+
* dependency. This is sticky so dirty checks remain available when needed.
|
|
262
|
+
*/
|
|
193
263
|
EffectFlags[EffectFlags["EVALUATED"] = 128] = "EVALUATED";
|
|
194
264
|
return EffectFlags;
|
|
195
265
|
}({});
|
|
@@ -203,9 +273,23 @@ var ReactiveEffect = class {
|
|
|
203
273
|
this.next = void 0;
|
|
204
274
|
this.cleanups = void 0;
|
|
205
275
|
this.scheduler = void 0;
|
|
276
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
277
|
+
if (diagnostics) {
|
|
278
|
+
diagnostics[1]++;
|
|
279
|
+
this.run = diagnostics[8](this.run.bind(this));
|
|
280
|
+
const stop = this.stop.bind(this);
|
|
281
|
+
this.stop = () => {
|
|
282
|
+
const active = !!(this.flags & 1);
|
|
283
|
+
stop();
|
|
284
|
+
if (active && !(this.flags & 1) && diagnostics[0]) diagnostics[2]++;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
206
287
|
this.scope = activeEffectScope;
|
|
207
288
|
if (activeEffectScope) if (activeEffectScope.active) activeEffectScope.effects.push(this);
|
|
208
|
-
else
|
|
289
|
+
else {
|
|
290
|
+
this.flags &= -2;
|
|
291
|
+
if (diagnostics) diagnostics[2]++;
|
|
292
|
+
}
|
|
209
293
|
}
|
|
210
294
|
pause() {
|
|
211
295
|
this.flags |= 64;
|
|
@@ -257,7 +341,8 @@ var ReactiveEffect = class {
|
|
|
257
341
|
trigger() {
|
|
258
342
|
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
259
343
|
else if (this.scheduler) this.scheduler();
|
|
260
|
-
else this.runIfDirty();
|
|
344
|
+
else if (this.flags & 128) this.runIfDirty();
|
|
345
|
+
else this.run();
|
|
261
346
|
}
|
|
262
347
|
/**
|
|
263
348
|
* @internal
|
|
@@ -583,6 +668,7 @@ var Dep = class {
|
|
|
583
668
|
}
|
|
584
669
|
track(debugInfo) {
|
|
585
670
|
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
671
|
+
if (this.computed) activeSub.flags |= 128;
|
|
586
672
|
let link = this.activeLink;
|
|
587
673
|
if (link === void 0 || link.sub !== activeSub) {
|
|
588
674
|
link = this.activeLink = new Link(activeSub, this);
|
|
@@ -748,6 +834,8 @@ var ComputedRefImpl = class {
|
|
|
748
834
|
this.flags = 16;
|
|
749
835
|
this.globalVersion = globalVersion - 1;
|
|
750
836
|
this.next = void 0;
|
|
837
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
838
|
+
if (diagnostics) diagnostics[7]++;
|
|
751
839
|
this["__v_isReadonly"] = !setter;
|
|
752
840
|
this.isSSR = isSSR;
|
|
753
841
|
}
|
|
@@ -1329,6 +1417,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1329
1417
|
if (existingProxy) return existingProxy;
|
|
1330
1418
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1331
1419
|
proxyMap.set(target, proxy);
|
|
1420
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1421
|
+
if (diagnostics) diagnostics[3]++;
|
|
1332
1422
|
return proxy;
|
|
1333
1423
|
}
|
|
1334
1424
|
/**
|
|
@@ -1457,6 +1547,8 @@ var RefImpl = class {
|
|
|
1457
1547
|
this.dep = new Dep();
|
|
1458
1548
|
this[_ReactiveFlags$IS_REF] = true;
|
|
1459
1549
|
this[_ReactiveFlags$IS_SHA] = false;
|
|
1550
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1551
|
+
if (diagnostics) diagnostics[6]++;
|
|
1460
1552
|
this._rawValue = isShallow ? value : /* @__PURE__ */ toRaw(value);
|
|
1461
1553
|
this._value = isShallow ? value : toReactive(value);
|
|
1462
1554
|
this["__v_isShallow"] = isShallow;
|
|
@@ -1755,6 +1847,7 @@ exports.computed = computed;
|
|
|
1755
1847
|
exports.createEffect = createEffect;
|
|
1756
1848
|
exports.createMemo = createMemo;
|
|
1757
1849
|
exports.createRoot = createRoot;
|
|
1850
|
+
exports.createRuntimeDiagnosticsSession = createRuntimeDiagnosticsSession;
|
|
1758
1851
|
exports.createSignal = createSignal;
|
|
1759
1852
|
exports.effect = effect;
|
|
1760
1853
|
exports.effectScope = effectScope;
|
package/dist/internal.d.ts
CHANGED
|
@@ -95,6 +95,10 @@ export declare enum EffectFlags {
|
|
|
95
95
|
DIRTY = 16,
|
|
96
96
|
ALLOW_RECURSE = 32,
|
|
97
97
|
PAUSED = 64,
|
|
98
|
+
/**
|
|
99
|
+
* ComputedRef has evaluated, or a ReactiveEffect has tracked a computed
|
|
100
|
+
* dependency. This is sticky so dirty checks remain available when needed.
|
|
101
|
+
*/
|
|
98
102
|
EVALUATED = 128
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
@@ -349,4 +353,23 @@ export declare function onWatcherCleanup(cleanupFn: () => void, failSilently?: b
|
|
|
349
353
|
export declare function watch(source: WatchSource | WatchSource[] | WatchEffect | object, cb?: WatchCallback | null, options?: WatchOptions): WatchHandle;
|
|
350
354
|
export declare function traverse(value: unknown, depth?: number, seen?: Map<unknown, number>): unknown;
|
|
351
355
|
|
|
356
|
+
export interface RuntimeDiagnosticsSnapshot {
|
|
357
|
+
effectsCreated: number;
|
|
358
|
+
effectsDisposed: number;
|
|
359
|
+
proxiesCreated: number;
|
|
360
|
+
scopesCreated: number;
|
|
361
|
+
scopesDisposed: number;
|
|
362
|
+
refsCreated: number;
|
|
363
|
+
memosCreated: number;
|
|
364
|
+
allocationsCreated: number;
|
|
365
|
+
allocationsDisposed: number;
|
|
366
|
+
}
|
|
367
|
+
export interface RuntimeDiagnosticsSession {
|
|
368
|
+
run<T extends () => unknown>(fn: SynchronousCallback<T>): ReturnType<T>;
|
|
369
|
+
snapshot(): Readonly<RuntimeDiagnosticsSnapshot>;
|
|
370
|
+
dispose(): void;
|
|
371
|
+
}
|
|
372
|
+
type SynchronousCallback<T extends () => unknown> = T & (Extract<ReturnType<T>, PromiseLike<unknown>> extends never ? unknown : never);
|
|
373
|
+
export declare function createRuntimeDiagnosticsSession(): RuntimeDiagnosticsSession;
|
|
374
|
+
|
|
352
375
|
export { EffectScope as Scope, effectScope as scope, };
|
package/dist/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* signal v0.1.1-beta.
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -28,6 +28,57 @@ let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
|
|
|
28
28
|
return ReactiveFlags;
|
|
29
29
|
}({});
|
|
30
30
|
//#endregion
|
|
31
|
+
//#region packages/core/signal/src/runtime-diagnostics.ts
|
|
32
|
+
let activeRuntimeDiagnostics;
|
|
33
|
+
function runWithRuntimeDiagnostics(diagnostics, fn) {
|
|
34
|
+
if (!(diagnostics === null || diagnostics === void 0 ? void 0 : diagnostics[0])) return fn();
|
|
35
|
+
const previous = activeRuntimeDiagnostics;
|
|
36
|
+
activeRuntimeDiagnostics = diagnostics;
|
|
37
|
+
try {
|
|
38
|
+
return fn();
|
|
39
|
+
} finally {
|
|
40
|
+
activeRuntimeDiagnostics = (previous === null || previous === void 0 ? void 0 : previous[0]) ? previous : void 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function createRuntimeDiagnosticsSession() {
|
|
44
|
+
const diagnostics = [
|
|
45
|
+
true,
|
|
46
|
+
0,
|
|
47
|
+
0,
|
|
48
|
+
0,
|
|
49
|
+
0,
|
|
50
|
+
0,
|
|
51
|
+
0,
|
|
52
|
+
0,
|
|
53
|
+
(run) => () => runWithRuntimeDiagnostics(diagnostics, run),
|
|
54
|
+
(run) => (fn) => runWithRuntimeDiagnostics(diagnostics, () => run(fn))
|
|
55
|
+
];
|
|
56
|
+
return {
|
|
57
|
+
run(fn) {
|
|
58
|
+
return runWithRuntimeDiagnostics(diagnostics, fn);
|
|
59
|
+
},
|
|
60
|
+
snapshot() {
|
|
61
|
+
const allocationsCreated = diagnostics[1] + diagnostics[3] + diagnostics[4] + diagnostics[6] + diagnostics[7];
|
|
62
|
+
const allocationsDisposed = diagnostics[2] + diagnostics[5];
|
|
63
|
+
return {
|
|
64
|
+
effectsCreated: diagnostics[1],
|
|
65
|
+
effectsDisposed: diagnostics[2],
|
|
66
|
+
proxiesCreated: diagnostics[3],
|
|
67
|
+
scopesCreated: diagnostics[4],
|
|
68
|
+
scopesDisposed: diagnostics[5],
|
|
69
|
+
refsCreated: diagnostics[6],
|
|
70
|
+
memosCreated: diagnostics[7],
|
|
71
|
+
allocationsCreated,
|
|
72
|
+
allocationsDisposed
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
dispose() {
|
|
76
|
+
diagnostics[0] = false;
|
|
77
|
+
if (activeRuntimeDiagnostics === diagnostics) activeRuntimeDiagnostics = void 0;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
31
82
|
//#region packages/core/signal/src/warning.ts
|
|
32
83
|
function warn(msg, ...args) {
|
|
33
84
|
console.warn(`[Zeus warn] ${msg}`, ...args);
|
|
@@ -45,12 +96,27 @@ var EffectScope = class {
|
|
|
45
96
|
this._isPaused = false;
|
|
46
97
|
this._warnOnRun = true;
|
|
47
98
|
this.__v_skip = true;
|
|
99
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
100
|
+
if (diagnostics) {
|
|
101
|
+
diagnostics[4]++;
|
|
102
|
+
this.run = diagnostics[9](this.run.bind(this));
|
|
103
|
+
const stop = this.stop.bind(this);
|
|
104
|
+
this.stop = (fromParent) => {
|
|
105
|
+
const active = this._active;
|
|
106
|
+
try {
|
|
107
|
+
stop(fromParent);
|
|
108
|
+
} finally {
|
|
109
|
+
if (active && !this._active && diagnostics[0]) diagnostics[5]++;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
48
113
|
if (!detached && activeEffectScope) if (activeEffectScope.active) {
|
|
49
114
|
this.parent = activeEffectScope;
|
|
50
115
|
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
51
116
|
} else {
|
|
52
117
|
this._active = false;
|
|
53
118
|
this._warnOnRun = false;
|
|
119
|
+
if (diagnostics) diagnostics[5]++;
|
|
54
120
|
}
|
|
55
121
|
}
|
|
56
122
|
get active() {
|
|
@@ -186,6 +252,10 @@ let EffectFlags = /* @__PURE__ */ function(EffectFlags) {
|
|
|
186
252
|
EffectFlags[EffectFlags["DIRTY"] = 16] = "DIRTY";
|
|
187
253
|
EffectFlags[EffectFlags["ALLOW_RECURSE"] = 32] = "ALLOW_RECURSE";
|
|
188
254
|
EffectFlags[EffectFlags["PAUSED"] = 64] = "PAUSED";
|
|
255
|
+
/**
|
|
256
|
+
* ComputedRef has evaluated, or a ReactiveEffect has tracked a computed
|
|
257
|
+
* dependency. This is sticky so dirty checks remain available when needed.
|
|
258
|
+
*/
|
|
189
259
|
EffectFlags[EffectFlags["EVALUATED"] = 128] = "EVALUATED";
|
|
190
260
|
return EffectFlags;
|
|
191
261
|
}({});
|
|
@@ -199,9 +269,23 @@ var ReactiveEffect = class {
|
|
|
199
269
|
this.next = void 0;
|
|
200
270
|
this.cleanups = void 0;
|
|
201
271
|
this.scheduler = void 0;
|
|
272
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
273
|
+
if (diagnostics) {
|
|
274
|
+
diagnostics[1]++;
|
|
275
|
+
this.run = diagnostics[8](this.run.bind(this));
|
|
276
|
+
const stop = this.stop.bind(this);
|
|
277
|
+
this.stop = () => {
|
|
278
|
+
const active = !!(this.flags & 1);
|
|
279
|
+
stop();
|
|
280
|
+
if (active && !(this.flags & 1) && diagnostics[0]) diagnostics[2]++;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
202
283
|
this.scope = activeEffectScope;
|
|
203
284
|
if (activeEffectScope) if (activeEffectScope.active) activeEffectScope.effects.push(this);
|
|
204
|
-
else
|
|
285
|
+
else {
|
|
286
|
+
this.flags &= -2;
|
|
287
|
+
if (diagnostics) diagnostics[2]++;
|
|
288
|
+
}
|
|
205
289
|
}
|
|
206
290
|
pause() {
|
|
207
291
|
this.flags |= 64;
|
|
@@ -253,7 +337,8 @@ var ReactiveEffect = class {
|
|
|
253
337
|
trigger() {
|
|
254
338
|
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
255
339
|
else if (this.scheduler) this.scheduler();
|
|
256
|
-
else this.runIfDirty();
|
|
340
|
+
else if (this.flags & 128) this.runIfDirty();
|
|
341
|
+
else this.run();
|
|
257
342
|
}
|
|
258
343
|
/**
|
|
259
344
|
* @internal
|
|
@@ -579,6 +664,7 @@ var Dep = class {
|
|
|
579
664
|
}
|
|
580
665
|
track(debugInfo) {
|
|
581
666
|
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
667
|
+
if (this.computed) activeSub.flags |= 128;
|
|
582
668
|
let link = this.activeLink;
|
|
583
669
|
if (link === void 0 || link.sub !== activeSub) {
|
|
584
670
|
link = this.activeLink = new Link(activeSub, this);
|
|
@@ -744,6 +830,8 @@ var ComputedRefImpl = class {
|
|
|
744
830
|
this.flags = 16;
|
|
745
831
|
this.globalVersion = globalVersion - 1;
|
|
746
832
|
this.next = void 0;
|
|
833
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
834
|
+
if (diagnostics) diagnostics[7]++;
|
|
747
835
|
this["__v_isReadonly"] = !setter;
|
|
748
836
|
this.isSSR = isSSR;
|
|
749
837
|
}
|
|
@@ -1325,6 +1413,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1325
1413
|
if (existingProxy) return existingProxy;
|
|
1326
1414
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1327
1415
|
proxyMap.set(target, proxy);
|
|
1416
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1417
|
+
if (diagnostics) diagnostics[3]++;
|
|
1328
1418
|
return proxy;
|
|
1329
1419
|
}
|
|
1330
1420
|
/**
|
|
@@ -1453,6 +1543,8 @@ var RefImpl = class {
|
|
|
1453
1543
|
this.dep = new Dep();
|
|
1454
1544
|
this[_ReactiveFlags$IS_REF] = true;
|
|
1455
1545
|
this[_ReactiveFlags$IS_SHA] = false;
|
|
1546
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1547
|
+
if (diagnostics) diagnostics[6]++;
|
|
1456
1548
|
this._rawValue = isShallow ? value : /* @__PURE__ */ toRaw(value);
|
|
1457
1549
|
this._value = isShallow ? value : toReactive(value);
|
|
1458
1550
|
this["__v_isShallow"] = isShallow;
|
|
@@ -1736,4 +1828,4 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
1736
1828
|
return value;
|
|
1737
1829
|
}
|
|
1738
1830
|
//#endregion
|
|
1739
|
-
export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, batch, computed, createEffect, createMemo, createRoot, createSignal, effect, effectScope, effectScope as scope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, isValueState, nextTick, onCleanup, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, reactiveReadArray, resetTracking, shallowReadArray, shallowState, state, stop, track, traverse, trigger, untrack, watch };
|
|
1831
|
+
export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, batch, computed, createEffect, createMemo, createRoot, createRuntimeDiagnosticsSession, createSignal, effect, effectScope, effectScope as scope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, isValueState, nextTick, onCleanup, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, reactiveReadArray, resetTracking, shallowReadArray, shallowState, state, stop, track, traverse, trigger, untrack, watch };
|
package/dist/internal.prod.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* signal v0.1.1-beta.
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -32,6 +32,57 @@ let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
|
|
|
32
32
|
return ReactiveFlags;
|
|
33
33
|
}({});
|
|
34
34
|
//#endregion
|
|
35
|
+
//#region packages/core/signal/src/runtime-diagnostics.ts
|
|
36
|
+
let activeRuntimeDiagnostics;
|
|
37
|
+
function runWithRuntimeDiagnostics(diagnostics, fn) {
|
|
38
|
+
if (!(diagnostics === null || diagnostics === void 0 ? void 0 : diagnostics[0])) return fn();
|
|
39
|
+
const previous = activeRuntimeDiagnostics;
|
|
40
|
+
activeRuntimeDiagnostics = diagnostics;
|
|
41
|
+
try {
|
|
42
|
+
return fn();
|
|
43
|
+
} finally {
|
|
44
|
+
activeRuntimeDiagnostics = (previous === null || previous === void 0 ? void 0 : previous[0]) ? previous : void 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function createRuntimeDiagnosticsSession() {
|
|
48
|
+
const diagnostics = [
|
|
49
|
+
true,
|
|
50
|
+
0,
|
|
51
|
+
0,
|
|
52
|
+
0,
|
|
53
|
+
0,
|
|
54
|
+
0,
|
|
55
|
+
0,
|
|
56
|
+
0,
|
|
57
|
+
(run) => () => runWithRuntimeDiagnostics(diagnostics, run),
|
|
58
|
+
(run) => (fn) => runWithRuntimeDiagnostics(diagnostics, () => run(fn))
|
|
59
|
+
];
|
|
60
|
+
return {
|
|
61
|
+
run(fn) {
|
|
62
|
+
return runWithRuntimeDiagnostics(diagnostics, fn);
|
|
63
|
+
},
|
|
64
|
+
snapshot() {
|
|
65
|
+
const allocationsCreated = diagnostics[1] + diagnostics[3] + diagnostics[4] + diagnostics[6] + diagnostics[7];
|
|
66
|
+
const allocationsDisposed = diagnostics[2] + diagnostics[5];
|
|
67
|
+
return {
|
|
68
|
+
effectsCreated: diagnostics[1],
|
|
69
|
+
effectsDisposed: diagnostics[2],
|
|
70
|
+
proxiesCreated: diagnostics[3],
|
|
71
|
+
scopesCreated: diagnostics[4],
|
|
72
|
+
scopesDisposed: diagnostics[5],
|
|
73
|
+
refsCreated: diagnostics[6],
|
|
74
|
+
memosCreated: diagnostics[7],
|
|
75
|
+
allocationsCreated,
|
|
76
|
+
allocationsDisposed
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
dispose() {
|
|
80
|
+
diagnostics[0] = false;
|
|
81
|
+
if (activeRuntimeDiagnostics === diagnostics) activeRuntimeDiagnostics = void 0;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
35
86
|
//#region packages/core/signal/src/effectScope.ts
|
|
36
87
|
let activeEffectScope;
|
|
37
88
|
var EffectScope = class {
|
|
@@ -44,12 +95,27 @@ var EffectScope = class {
|
|
|
44
95
|
this._isPaused = false;
|
|
45
96
|
this._warnOnRun = true;
|
|
46
97
|
this.__v_skip = true;
|
|
98
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
99
|
+
if (diagnostics) {
|
|
100
|
+
diagnostics[4]++;
|
|
101
|
+
this.run = diagnostics[9](this.run.bind(this));
|
|
102
|
+
const stop = this.stop.bind(this);
|
|
103
|
+
this.stop = (fromParent) => {
|
|
104
|
+
const active = this._active;
|
|
105
|
+
try {
|
|
106
|
+
stop(fromParent);
|
|
107
|
+
} finally {
|
|
108
|
+
if (active && !this._active && diagnostics[0]) diagnostics[5]++;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
47
112
|
if (!detached && activeEffectScope) if (activeEffectScope.active) {
|
|
48
113
|
this.parent = activeEffectScope;
|
|
49
114
|
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
50
115
|
} else {
|
|
51
116
|
this._active = false;
|
|
52
117
|
this._warnOnRun = false;
|
|
118
|
+
if (diagnostics) diagnostics[5]++;
|
|
53
119
|
}
|
|
54
120
|
}
|
|
55
121
|
get active() {
|
|
@@ -184,6 +250,10 @@ let EffectFlags = /* @__PURE__ */ function(EffectFlags) {
|
|
|
184
250
|
EffectFlags[EffectFlags["DIRTY"] = 16] = "DIRTY";
|
|
185
251
|
EffectFlags[EffectFlags["ALLOW_RECURSE"] = 32] = "ALLOW_RECURSE";
|
|
186
252
|
EffectFlags[EffectFlags["PAUSED"] = 64] = "PAUSED";
|
|
253
|
+
/**
|
|
254
|
+
* ComputedRef has evaluated, or a ReactiveEffect has tracked a computed
|
|
255
|
+
* dependency. This is sticky so dirty checks remain available when needed.
|
|
256
|
+
*/
|
|
187
257
|
EffectFlags[EffectFlags["EVALUATED"] = 128] = "EVALUATED";
|
|
188
258
|
return EffectFlags;
|
|
189
259
|
}({});
|
|
@@ -197,9 +267,23 @@ var ReactiveEffect = class {
|
|
|
197
267
|
this.next = void 0;
|
|
198
268
|
this.cleanups = void 0;
|
|
199
269
|
this.scheduler = void 0;
|
|
270
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
271
|
+
if (diagnostics) {
|
|
272
|
+
diagnostics[1]++;
|
|
273
|
+
this.run = diagnostics[8](this.run.bind(this));
|
|
274
|
+
const stop = this.stop.bind(this);
|
|
275
|
+
this.stop = () => {
|
|
276
|
+
const active = !!(this.flags & 1);
|
|
277
|
+
stop();
|
|
278
|
+
if (active && !(this.flags & 1) && diagnostics[0]) diagnostics[2]++;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
200
281
|
this.scope = activeEffectScope;
|
|
201
282
|
if (activeEffectScope) if (activeEffectScope.active) activeEffectScope.effects.push(this);
|
|
202
|
-
else
|
|
283
|
+
else {
|
|
284
|
+
this.flags &= -2;
|
|
285
|
+
if (diagnostics) diagnostics[2]++;
|
|
286
|
+
}
|
|
203
287
|
}
|
|
204
288
|
pause() {
|
|
205
289
|
this.flags |= 64;
|
|
@@ -250,7 +334,8 @@ var ReactiveEffect = class {
|
|
|
250
334
|
trigger() {
|
|
251
335
|
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
252
336
|
else if (this.scheduler) this.scheduler();
|
|
253
|
-
else this.runIfDirty();
|
|
337
|
+
else if (this.flags & 128) this.runIfDirty();
|
|
338
|
+
else this.run();
|
|
254
339
|
}
|
|
255
340
|
/**
|
|
256
341
|
* @internal
|
|
@@ -574,6 +659,7 @@ var Dep = class {
|
|
|
574
659
|
}
|
|
575
660
|
track(debugInfo) {
|
|
576
661
|
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
662
|
+
if (this.computed) activeSub.flags |= 128;
|
|
577
663
|
let link = this.activeLink;
|
|
578
664
|
if (link === void 0 || link.sub !== activeSub) {
|
|
579
665
|
link = this.activeLink = new Link(activeSub, this);
|
|
@@ -725,6 +811,8 @@ var ComputedRefImpl = class {
|
|
|
725
811
|
this.flags = 16;
|
|
726
812
|
this.globalVersion = globalVersion - 1;
|
|
727
813
|
this.next = void 0;
|
|
814
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
815
|
+
if (diagnostics) diagnostics[7]++;
|
|
728
816
|
this["__v_isReadonly"] = !setter;
|
|
729
817
|
this.isSSR = isSSR;
|
|
730
818
|
}
|
|
@@ -1277,6 +1365,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1277
1365
|
if (existingProxy) return existingProxy;
|
|
1278
1366
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1279
1367
|
proxyMap.set(target, proxy);
|
|
1368
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1369
|
+
if (diagnostics) diagnostics[3]++;
|
|
1280
1370
|
return proxy;
|
|
1281
1371
|
}
|
|
1282
1372
|
/**
|
|
@@ -1405,6 +1495,8 @@ var RefImpl = class {
|
|
|
1405
1495
|
this.dep = new Dep();
|
|
1406
1496
|
this[_ReactiveFlags$IS_REF] = true;
|
|
1407
1497
|
this[_ReactiveFlags$IS_SHA] = false;
|
|
1498
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1499
|
+
if (diagnostics) diagnostics[6]++;
|
|
1408
1500
|
this._rawValue = isShallow ? value : /* @__PURE__ */ toRaw(value);
|
|
1409
1501
|
this._value = isShallow ? value : toReactive(value);
|
|
1410
1502
|
this["__v_isShallow"] = isShallow;
|
|
@@ -1684,6 +1776,7 @@ exports.computed = computed;
|
|
|
1684
1776
|
exports.createEffect = createEffect;
|
|
1685
1777
|
exports.createMemo = createMemo;
|
|
1686
1778
|
exports.createRoot = createRoot;
|
|
1779
|
+
exports.createRuntimeDiagnosticsSession = createRuntimeDiagnosticsSession;
|
|
1687
1780
|
exports.createSignal = createSignal;
|
|
1688
1781
|
exports.effect = effect;
|
|
1689
1782
|
exports.effectScope = effectScope;
|
package/dist/internal.prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* signal v0.1.1-beta.
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -28,6 +28,57 @@ let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
|
|
|
28
28
|
return ReactiveFlags;
|
|
29
29
|
}({});
|
|
30
30
|
//#endregion
|
|
31
|
+
//#region packages/core/signal/src/runtime-diagnostics.ts
|
|
32
|
+
let activeRuntimeDiagnostics;
|
|
33
|
+
function runWithRuntimeDiagnostics(diagnostics, fn) {
|
|
34
|
+
if (!(diagnostics === null || diagnostics === void 0 ? void 0 : diagnostics[0])) return fn();
|
|
35
|
+
const previous = activeRuntimeDiagnostics;
|
|
36
|
+
activeRuntimeDiagnostics = diagnostics;
|
|
37
|
+
try {
|
|
38
|
+
return fn();
|
|
39
|
+
} finally {
|
|
40
|
+
activeRuntimeDiagnostics = (previous === null || previous === void 0 ? void 0 : previous[0]) ? previous : void 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function createRuntimeDiagnosticsSession() {
|
|
44
|
+
const diagnostics = [
|
|
45
|
+
true,
|
|
46
|
+
0,
|
|
47
|
+
0,
|
|
48
|
+
0,
|
|
49
|
+
0,
|
|
50
|
+
0,
|
|
51
|
+
0,
|
|
52
|
+
0,
|
|
53
|
+
(run) => () => runWithRuntimeDiagnostics(diagnostics, run),
|
|
54
|
+
(run) => (fn) => runWithRuntimeDiagnostics(diagnostics, () => run(fn))
|
|
55
|
+
];
|
|
56
|
+
return {
|
|
57
|
+
run(fn) {
|
|
58
|
+
return runWithRuntimeDiagnostics(diagnostics, fn);
|
|
59
|
+
},
|
|
60
|
+
snapshot() {
|
|
61
|
+
const allocationsCreated = diagnostics[1] + diagnostics[3] + diagnostics[4] + diagnostics[6] + diagnostics[7];
|
|
62
|
+
const allocationsDisposed = diagnostics[2] + diagnostics[5];
|
|
63
|
+
return {
|
|
64
|
+
effectsCreated: diagnostics[1],
|
|
65
|
+
effectsDisposed: diagnostics[2],
|
|
66
|
+
proxiesCreated: diagnostics[3],
|
|
67
|
+
scopesCreated: diagnostics[4],
|
|
68
|
+
scopesDisposed: diagnostics[5],
|
|
69
|
+
refsCreated: diagnostics[6],
|
|
70
|
+
memosCreated: diagnostics[7],
|
|
71
|
+
allocationsCreated,
|
|
72
|
+
allocationsDisposed
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
dispose() {
|
|
76
|
+
diagnostics[0] = false;
|
|
77
|
+
if (activeRuntimeDiagnostics === diagnostics) activeRuntimeDiagnostics = void 0;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
31
82
|
//#region packages/core/signal/src/warning.ts
|
|
32
83
|
function warn(msg, ...args) {
|
|
33
84
|
console.warn(`[Zeus warn] ${msg}`, ...args);
|
|
@@ -45,12 +96,27 @@ var EffectScope = class {
|
|
|
45
96
|
this._isPaused = false;
|
|
46
97
|
this._warnOnRun = true;
|
|
47
98
|
this.__v_skip = true;
|
|
99
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
100
|
+
if (diagnostics) {
|
|
101
|
+
diagnostics[4]++;
|
|
102
|
+
this.run = diagnostics[9](this.run.bind(this));
|
|
103
|
+
const stop = this.stop.bind(this);
|
|
104
|
+
this.stop = (fromParent) => {
|
|
105
|
+
const active = this._active;
|
|
106
|
+
try {
|
|
107
|
+
stop(fromParent);
|
|
108
|
+
} finally {
|
|
109
|
+
if (active && !this._active && diagnostics[0]) diagnostics[5]++;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
48
113
|
if (!detached && activeEffectScope) if (activeEffectScope.active) {
|
|
49
114
|
this.parent = activeEffectScope;
|
|
50
115
|
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
51
116
|
} else {
|
|
52
117
|
this._active = false;
|
|
53
118
|
this._warnOnRun = false;
|
|
119
|
+
if (diagnostics) diagnostics[5]++;
|
|
54
120
|
}
|
|
55
121
|
}
|
|
56
122
|
get active() {
|
|
@@ -186,6 +252,10 @@ let EffectFlags = /* @__PURE__ */ function(EffectFlags) {
|
|
|
186
252
|
EffectFlags[EffectFlags["DIRTY"] = 16] = "DIRTY";
|
|
187
253
|
EffectFlags[EffectFlags["ALLOW_RECURSE"] = 32] = "ALLOW_RECURSE";
|
|
188
254
|
EffectFlags[EffectFlags["PAUSED"] = 64] = "PAUSED";
|
|
255
|
+
/**
|
|
256
|
+
* ComputedRef has evaluated, or a ReactiveEffect has tracked a computed
|
|
257
|
+
* dependency. This is sticky so dirty checks remain available when needed.
|
|
258
|
+
*/
|
|
189
259
|
EffectFlags[EffectFlags["EVALUATED"] = 128] = "EVALUATED";
|
|
190
260
|
return EffectFlags;
|
|
191
261
|
}({});
|
|
@@ -199,9 +269,23 @@ var ReactiveEffect = class {
|
|
|
199
269
|
this.next = void 0;
|
|
200
270
|
this.cleanups = void 0;
|
|
201
271
|
this.scheduler = void 0;
|
|
272
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
273
|
+
if (diagnostics) {
|
|
274
|
+
diagnostics[1]++;
|
|
275
|
+
this.run = diagnostics[8](this.run.bind(this));
|
|
276
|
+
const stop = this.stop.bind(this);
|
|
277
|
+
this.stop = () => {
|
|
278
|
+
const active = !!(this.flags & 1);
|
|
279
|
+
stop();
|
|
280
|
+
if (active && !(this.flags & 1) && diagnostics[0]) diagnostics[2]++;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
202
283
|
this.scope = activeEffectScope;
|
|
203
284
|
if (activeEffectScope) if (activeEffectScope.active) activeEffectScope.effects.push(this);
|
|
204
|
-
else
|
|
285
|
+
else {
|
|
286
|
+
this.flags &= -2;
|
|
287
|
+
if (diagnostics) diagnostics[2]++;
|
|
288
|
+
}
|
|
205
289
|
}
|
|
206
290
|
pause() {
|
|
207
291
|
this.flags |= 64;
|
|
@@ -253,7 +337,8 @@ var ReactiveEffect = class {
|
|
|
253
337
|
trigger() {
|
|
254
338
|
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
255
339
|
else if (this.scheduler) this.scheduler();
|
|
256
|
-
else this.runIfDirty();
|
|
340
|
+
else if (this.flags & 128) this.runIfDirty();
|
|
341
|
+
else this.run();
|
|
257
342
|
}
|
|
258
343
|
/**
|
|
259
344
|
* @internal
|
|
@@ -579,6 +664,7 @@ var Dep = class {
|
|
|
579
664
|
}
|
|
580
665
|
track(debugInfo) {
|
|
581
666
|
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
667
|
+
if (this.computed) activeSub.flags |= 128;
|
|
582
668
|
let link = this.activeLink;
|
|
583
669
|
if (link === void 0 || link.sub !== activeSub) {
|
|
584
670
|
link = this.activeLink = new Link(activeSub, this);
|
|
@@ -744,6 +830,8 @@ var ComputedRefImpl = class {
|
|
|
744
830
|
this.flags = 16;
|
|
745
831
|
this.globalVersion = globalVersion - 1;
|
|
746
832
|
this.next = void 0;
|
|
833
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
834
|
+
if (diagnostics) diagnostics[7]++;
|
|
747
835
|
this["__v_isReadonly"] = !setter;
|
|
748
836
|
this.isSSR = isSSR;
|
|
749
837
|
}
|
|
@@ -1325,6 +1413,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1325
1413
|
if (existingProxy) return existingProxy;
|
|
1326
1414
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1327
1415
|
proxyMap.set(target, proxy);
|
|
1416
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1417
|
+
if (diagnostics) diagnostics[3]++;
|
|
1328
1418
|
return proxy;
|
|
1329
1419
|
}
|
|
1330
1420
|
/**
|
|
@@ -1453,6 +1543,8 @@ var RefImpl = class {
|
|
|
1453
1543
|
this.dep = new Dep();
|
|
1454
1544
|
this[_ReactiveFlags$IS_REF] = true;
|
|
1455
1545
|
this[_ReactiveFlags$IS_SHA] = false;
|
|
1546
|
+
const diagnostics = activeRuntimeDiagnostics;
|
|
1547
|
+
if (diagnostics) diagnostics[6]++;
|
|
1456
1548
|
this._rawValue = isShallow ? value : /* @__PURE__ */ toRaw(value);
|
|
1457
1549
|
this._value = isShallow ? value : toReactive(value);
|
|
1458
1550
|
this["__v_isShallow"] = isShallow;
|
|
@@ -1736,4 +1828,4 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
1736
1828
|
return value;
|
|
1737
1829
|
}
|
|
1738
1830
|
//#endregion
|
|
1739
|
-
export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, batch, computed, createEffect, createMemo, createRoot, createSignal, effect, effectScope, effectScope as scope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, isValueState, nextTick, onCleanup, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, reactiveReadArray, resetTracking, shallowReadArray, shallowState, state, stop, track, traverse, trigger, untrack, watch };
|
|
1831
|
+
export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, batch, computed, createEffect, createMemo, createRoot, createRuntimeDiagnosticsSession, createSignal, effect, effectScope, effectScope as scope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, isValueState, nextTick, onCleanup, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, reactiveReadArray, resetTracking, shallowReadArray, shallowState, state, stop, track, traverse, trigger, untrack, watch };
|
package/dist/signal.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* signal v0.1.1-beta.
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -259,7 +259,8 @@ var ReactiveEffect = class {
|
|
|
259
259
|
trigger() {
|
|
260
260
|
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
261
261
|
else if (this.scheduler) this.scheduler();
|
|
262
|
-
else this.runIfDirty();
|
|
262
|
+
else if (this.flags & 128) this.runIfDirty();
|
|
263
|
+
else this.run();
|
|
263
264
|
}
|
|
264
265
|
/**
|
|
265
266
|
* @internal
|
|
@@ -558,6 +559,7 @@ var Dep = class {
|
|
|
558
559
|
}
|
|
559
560
|
track(debugInfo) {
|
|
560
561
|
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
562
|
+
if (this.computed) activeSub.flags |= 128;
|
|
561
563
|
let link = this.activeLink;
|
|
562
564
|
if (link === void 0 || link.sub !== activeSub) {
|
|
563
565
|
link = this.activeLink = new Link(activeSub, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}const t=Object.assign,n=Object.prototype.hasOwnProperty,r=(e,t)=>n.call(e,t),i=Array.isArray,a=e=>d(e)===`[object Map]`,o=e=>typeof e==`function`,s=e=>typeof e==`string`,c=e=>typeof e==`symbol`,l=e=>typeof e==`object`&&!!e,u=Object.prototype.toString,d=e=>u.call(e),f=e=>d(e).slice(8,-1),p=e=>s(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,m=(e,t)=>!Object.is(e,t);let h;var ee=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&h&&(h.active?(this.parent=h,this.index=(h.scopes||(h.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=h;try{return h=this,e()}finally{h=t}}}on(){++this._on===1&&(this.prevScope=h,h=this)}off(){if(this._on>0&&--this._on===0){if(h===this)h=this.prevScope;else{let e=h;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function te(e){return new ee(e)}function ne(){return h}function g(e,t=!1){h&&h.cleanups.push(e)}let _;const v=new WeakSet;var y=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanups=void 0,this.scheduler=void 0,this.scope=h,h&&(h.active?h.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,v.has(this)&&(v.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||ie(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,D(this),ae(this);let e=_,t=E;_=this,E=!0;try{return this.fn()}finally{oe(this),_=e,E=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)T(e);this.deps=this.depsTail=void 0,D(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?v.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){w(this)&&this.run()}get dirty(){return w(this)}};let re=0,b,x;function ie(e,t=!1){if(e.flags|=8,t){e.next=x,x=e;return}e.next=b,b=e}function S(){re++}function C(){if(--re>0)return;if(x){let e=x;for(x=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;b;){let t=b;for(b=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function ae(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function oe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),T(r),ce(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function w(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(se(t.dep.computed)||t.dep.version!==t.version))return!0;return!1}function se(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===O)||(e.globalVersion=O,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!w(e))))return;e.flags|=2;let t=e.dep,n=_,r=E;_=e,E=!0;try{ae(e);let n=e.fn(e._value);(t.version===0||m(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{_=n,E=r,oe(e),e.flags&=-3}}function T(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)T(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ce(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function le(e,n){e.effect instanceof y&&(e=e.effect.fn);let r=new y(e);n&&t(r,n);try{r.run()}catch(e){throw r.stop(),e}let i=r.run.bind(r);return i.effect=r,i}let E=!0;const ue=[];function de(){ue.push(E),E=!1}function fe(){let e=ue.pop();E=e===void 0?!0:e}function pe(e,t=!1){if(_ instanceof y){var n,r;((r=(n=_).cleanups)==null?n.cleanups=[]:r).push(e)}}function D(e){let t=e.cleanups;if(e.cleanups=void 0,t){let e=_;_=void 0;try{let e;for(let n of t)try{n()}catch(t){e!=null||(e=t)}if(e)throw e}finally{_=e}}}function me(e){S();try{return e()}finally{C()}}function he(){return _ instanceof y?_:void 0}let O=0;var ge=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},k=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!_||!E||_===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==_)t=this.activeLink=new ge(_,this),_.deps?(t.prevDep=_.depsTail,_.depsTail.nextDep=t,_.depsTail=t):_.deps=_.depsTail=t,A(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=_.depsTail,t.nextDep=void 0,_.depsTail.nextDep=t,_.depsTail=t,_.deps===t&&(_.deps=e)}return t}trigger(e){this.version++,O++,this.notify(e)}notify(e){S();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{C()}}};function A(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)A(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const j=new WeakMap,M=Symbol(``),N=Symbol(``),P=Symbol(``);function F(e,t,n){if(E&&_){let t=j.get(e);t||j.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new k),r.map=t,r.key=n),r.track()}}function I(e,t,n,r,o,s){let l=j.get(e);if(!l){O++;return}let u=e=>{e&&e.trigger()};if(S(),t===`clear`)l.forEach(u);else{let o=i(e),s=o&&p(n);if(o&&n===`length`){let e=Number(r);l.forEach((t,n)=>{(n===`length`||n===P||!c(n)&&n>=e)&&u(t)})}else switch((n!==void 0||l.has(void 0))&&u(l.get(n)),s&&u(l.get(P)),t){case`add`:o?s&&u(l.get(`length`)):(u(l.get(M)),a(e)&&u(l.get(N)));break;case`delete`:o||(u(l.get(M)),a(e)&&u(l.get(N)));break;case`set`:a(e)&&u(l.get(M));break}}C()}var _e=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new k(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=O-1,this.next=void 0,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&_!==this)return ie(this,!0),!0}get value(){let e=this.dep.track();return se(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function ve(e,t,n=!1){let r,i;return o(e)?r=e:(r=e.get,i=e.set),new _e(r,i,n)}function ye(e){let t=he(),n=ne();if(n&&(t==null?void 0:t.scope)!==n){g(e,!0);return}if(t){pe(e,!0);return}if(n){g(e,!0);return}}function L(e){let t=X(e);return t===e?t:(F(t,`iterate`,P),Y(e)?t:t.map(Z))}function R(e){return F(e=X(e),`iterate`,P),e}function z(e,t){return J(e)?Q(We(e)?Z(t):t):Z(t)}const be={__proto__:null,[Symbol.iterator](){return B(this,Symbol.iterator,e=>z(this,e))},concat(...e){return L(this).concat(...e.map(e=>i(e)?L(e):e))},entries(){return B(this,`entries`,e=>(e[1]=z(this,e[1]),e))},every(e,t){return V(this,`every`,e,t,void 0,arguments)},filter(e,t){return V(this,`filter`,e,t,e=>e.map(e=>z(this,e)),arguments)},find(e,t){return V(this,`find`,e,t,e=>z(this,e),arguments)},findIndex(e,t){return V(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return V(this,`findLast`,e,t,e=>z(this,e),arguments)},findLastIndex(e,t){return V(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return V(this,`forEach`,e,t,void 0,arguments)},includes(...e){return H(this,`includes`,e)},indexOf(...e){return H(this,`indexOf`,e)},join(e){return L(this).join(e)},lastIndexOf(...e){return H(this,`lastIndexOf`,e)},map(e,t){return V(this,`map`,e,t,void 0,arguments)},pop(){return U(this,`pop`)},push(...e){return U(this,`push`,e)},reduce(e,...t){return Se(this,`reduce`,e,t)},reduceRight(e,...t){return Se(this,`reduceRight`,e,t)},shift(){return U(this,`shift`)},some(e,t){return V(this,`some`,e,t,void 0,arguments)},splice(...e){return U(this,`splice`,e)},toReversed(){return L(this).toReversed()},toSorted(e){return L(this).toSorted(e)},toSpliced(...e){return L(this).toSpliced(...e)},unshift(...e){return U(this,`unshift`,e)},values(){return B(this,`values`,e=>z(this,e))}};function B(e,t,n){let r=R(e),i=r[t]();return r!==e&&!Y(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}const xe=Array.prototype;function V(e,t,n,r,i,a){let o=R(e),s=o!==e&&!Y(e),c=o[t];if(c!==xe[t]){let t=c.apply(e,a);return s?Z(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,z(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function Se(e,t,n,r){let i=R(e),a=i!==e&&!Y(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=z(e,t)),n.call(this,t,z(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?z(e,c):c}function H(e,t,n){let r=X(e);F(r,`iterate`,P);let i=r[t](...n);return(i===-1||i===!1)&&Ge(n[0])?(n[0]=X(n[0]),r[t](...n)):i}function U(e,t,n=[]){de(),S();let r=X(e)[t].apply(e,n);return C(),fe(),r}const Ce=e(`__proto__,__v_isRef,__isVue`),we=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(c));function Te(e){c(e)||(e=String(e));let t=X(this);return F(t,`has`,e),t.hasOwnProperty(e)}var Ee=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,a=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return a;if(t===`__v_raw`)return n===(r?a?ze:Re:a?Le:Ie).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let o=i(e);if(!r){let e;if(o&&(e=be[t]))return e;if(t===`hasOwnProperty`)return Te}let s=Reflect.get(e,t,$(e)?e:n);if((c(t)?we.has(t):Ce(t))||(r||F(e,`get`,t),a))return s;if($(s)){let e=o&&p(t)?s:s.value;return r&&l(e)?q(e):e}return l(s)?r?q(s):He(s):s}},De=class extends Ee{constructor(e=!1){super(!1,e)}set(e,t,n,a){let o=e[t],s=i(e)&&p(t);if(!this._isShallow){let e=J(o);if(!Y(n)&&!J(n)&&(o=X(o),n=X(n)),!s&&$(o)&&!$(n))return e||(o.value=n),!0}let c=s?Number(t)<e.length:r(e,t),l=Reflect.set(e,t,n,$(e)?e:a);return e===X(a)&&(c?m(n,o)&&I(e,`set`,t,n,o):I(e,`add`,t,n)),l}deleteProperty(e,t){let n=r(e,t),i=e[t],a=Reflect.deleteProperty(e,t);return a&&n&&I(e,`delete`,t,void 0,i),a}has(e,t){let n=Reflect.has(e,t);return(!c(t)||!we.has(t))&&F(e,`has`,t),n}ownKeys(e){return F(e,`iterate`,i(e)?`length`:M),Reflect.ownKeys(e)}},Oe=class extends Ee{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}};const ke=new De,Ae=new Oe,W=e=>e,G=e=>Reflect.getPrototypeOf(e);function je(e,n,r){return function(...i){let o=this.__v_raw,s=X(o),c=a(s),l=e===`entries`||e===Symbol.iterator&&c,u=e===`keys`&&c,d=o[e](...i),f=r?W:n?Q:Z;return!n&&F(s,`iterate`,u?N:M),t(Object.create(d),{next(){let{value:e,done:t}=d.next();return t?{value:e,done:t}:{value:l?[f(e[0]),f(e[1])]:f(e),done:t}}})}}function K(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Me(e,n){let r={get(t){let r=this.__v_raw,i=X(r),a=X(t);e||(m(t,a)&&F(i,`get`,t),F(i,`get`,a));let{has:o}=G(i),s=n?W:e?Q:Z;if(o.call(i,t))return s(r.get(t));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(t)},get size(){let t=this.__v_raw;return!e&&F(X(t),`iterate`,M),t.size},has(t){let n=this.__v_raw,r=X(n),i=X(t);return e||(m(t,i)&&F(r,`has`,t),F(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(t,r){let i=this,a=i.__v_raw,o=X(a),s=n?W:e?Q:Z;return!e&&F(o,`iterate`,M),a.forEach((e,n)=>t.call(r,s(e),s(n),i))}};return t(r,e?{add:K(`add`),set:K(`set`),delete:K(`delete`),clear:K(`clear`)}:{add(e){let t=X(this),r=G(t),i=X(e),a=!n&&!Y(e)&&!J(e)?i:e;return r.has.call(t,a)||m(e,a)&&r.has.call(t,e)||m(i,a)&&r.has.call(t,i)||(t.add(a),I(t,`add`,a,a)),this},set(e,t){!n&&!Y(t)&&!J(t)&&(t=X(t));let r=X(this),{has:i,get:a}=G(r),o=i.call(r,e);o||(e=X(e),o=i.call(r,e));let s=a.call(r,e);return r.set(e,t),o?m(t,s)&&I(r,`set`,e,t,s):I(r,`add`,e,t),this},delete(e){let t=X(this),{has:n,get:r}=G(t),i=n.call(t,e);i||(e=X(e),i=n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&I(t,`delete`,e,void 0,a),o},clear(){let e=X(this),t=e.size!==0,n=e.clear();return t&&I(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(t=>{r[t]=je(t,e,n)}),r}function Ne(e,t){let n=Me(e,t);return(t,i,a)=>i===`__v_isReactive`?!e:i===`__v_isReadonly`?e:i===`__v_raw`?t:Reflect.get(r(n,i)&&i in t?n:t,i,a)}const Pe={get:Ne(!1,!1)},Fe={get:Ne(!0,!1)},Ie=new WeakMap,Le=new WeakMap,Re=new WeakMap,ze=new WeakMap;function Be(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Ve(e){return e.__v_skip||!Object.isExtensible(e)?0:Be(f(e))}function He(e){return J(e)?e:Ue(e,!1,ke,Pe,Ie)}function q(e){return Ue(e,!0,Ae,Fe,Re)}function Ue(e,t,n,r,i){if(!l(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=Ve(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function We(e){return J(e)?We(e.__v_raw):!!(e&&e.__v_isReactive)}function J(e){return!!(e&&e.__v_isReadonly)}function Y(e){return!!(e&&e.__v_isShallow)}function Ge(e){return e?!!e.__v_raw:!1}function X(e){let t=e&&e.__v_raw;return t?X(t):e}const Z=e=>l(e)?He(e):e,Q=e=>l(e)?q(e):e;let Ke,qe;function $(e){return e?e.__v_isRef===!0:!1}function Je(e){return Ye(e,!0)}function Ye(e,t){return $(e)?e:new Xe(e,t)}Ke=`__v_isRef`,qe=`__v_isShallow`;var Xe=class{constructor(e,t){this.dep=new k,this[Ke]=!0,this[qe]=!1,this._rawValue=t?e:X(e),this._value=t?e:Z(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Y(e)||J(e);e=n?e:X(e),m(e,t)&&(this._rawValue=e,this._value=n?e:Z(e),this.dep.trigger())}};function Ze(e){let t=Je(e);return[()=>t.value,e=>{let n=typeof e==`function`?e(t.value):e;return t.value=n,n}]}function Qe(e){let t=ve(e);return()=>t.value}function $e(e){le(e)}function et(e){let t=te(!0),n=!1,r=()=>{n||(n=!0,t.stop())};try{return t.run(()=>e(r))}catch(e){throw r(),e}}export{me as batch,$e as createEffect,Qe as createMemo,et as createRoot,Ze as createSignal,ye as onCleanup};
|
|
1
|
+
function e(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}const t=Object.assign,n=Object.prototype.hasOwnProperty,r=(e,t)=>n.call(e,t),i=Array.isArray,a=e=>d(e)===`[object Map]`,o=e=>typeof e==`function`,s=e=>typeof e==`string`,c=e=>typeof e==`symbol`,l=e=>typeof e==`object`&&!!e,u=Object.prototype.toString,d=e=>u.call(e),f=e=>d(e).slice(8,-1),p=e=>s(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,m=(e,t)=>!Object.is(e,t);let h;var ee=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&h&&(h.active?(this.parent=h,this.index=(h.scopes||(h.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=h;try{return h=this,e()}finally{h=t}}}on(){++this._on===1&&(this.prevScope=h,h=this)}off(){if(this._on>0&&--this._on===0){if(h===this)h=this.prevScope;else{let e=h;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function te(e){return new ee(e)}function ne(){return h}function g(e,t=!1){h&&h.cleanups.push(e)}let _;const v=new WeakSet;var y=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanups=void 0,this.scheduler=void 0,this.scope=h,h&&(h.active?h.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,v.has(this)&&(v.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||ie(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,D(this),ae(this);let e=_,t=E;_=this,E=!0;try{return this.fn()}finally{oe(this),_=e,E=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)T(e);this.deps=this.depsTail=void 0,D(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?v.add(this):this.scheduler?this.scheduler():this.flags&128?this.runIfDirty():this.run()}runIfDirty(){w(this)&&this.run()}get dirty(){return w(this)}};let re=0,b,x;function ie(e,t=!1){if(e.flags|=8,t){e.next=x,x=e;return}e.next=b,b=e}function S(){re++}function C(){if(--re>0)return;if(x){let e=x;for(x=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;b;){let t=b;for(b=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function ae(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function oe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),T(r),ce(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function w(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(se(t.dep.computed)||t.dep.version!==t.version))return!0;return!1}function se(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===O)||(e.globalVersion=O,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!w(e))))return;e.flags|=2;let t=e.dep,n=_,r=E;_=e,E=!0;try{ae(e);let n=e.fn(e._value);(t.version===0||m(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{_=n,E=r,oe(e),e.flags&=-3}}function T(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)T(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ce(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function le(e,n){e.effect instanceof y&&(e=e.effect.fn);let r=new y(e);n&&t(r,n);try{r.run()}catch(e){throw r.stop(),e}let i=r.run.bind(r);return i.effect=r,i}let E=!0;const ue=[];function de(){ue.push(E),E=!1}function fe(){let e=ue.pop();E=e===void 0?!0:e}function pe(e,t=!1){if(_ instanceof y){var n,r;((r=(n=_).cleanups)==null?n.cleanups=[]:r).push(e)}}function D(e){let t=e.cleanups;if(e.cleanups=void 0,t){let e=_;_=void 0;try{let e;for(let n of t)try{n()}catch(t){e!=null||(e=t)}if(e)throw e}finally{_=e}}}function me(e){S();try{return e()}finally{C()}}function he(){return _ instanceof y?_:void 0}let O=0;var ge=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},k=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!_||!E||_===this.computed)return;this.computed&&(_.flags|=128);let t=this.activeLink;if(t===void 0||t.sub!==_)t=this.activeLink=new ge(_,this),_.deps?(t.prevDep=_.depsTail,_.depsTail.nextDep=t,_.depsTail=t):_.deps=_.depsTail=t,A(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=_.depsTail,t.nextDep=void 0,_.depsTail.nextDep=t,_.depsTail=t,_.deps===t&&(_.deps=e)}return t}trigger(e){this.version++,O++,this.notify(e)}notify(e){S();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{C()}}};function A(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)A(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const j=new WeakMap,M=Symbol(``),N=Symbol(``),P=Symbol(``);function F(e,t,n){if(E&&_){let t=j.get(e);t||j.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new k),r.map=t,r.key=n),r.track()}}function I(e,t,n,r,o,s){let l=j.get(e);if(!l){O++;return}let u=e=>{e&&e.trigger()};if(S(),t===`clear`)l.forEach(u);else{let o=i(e),s=o&&p(n);if(o&&n===`length`){let e=Number(r);l.forEach((t,n)=>{(n===`length`||n===P||!c(n)&&n>=e)&&u(t)})}else switch((n!==void 0||l.has(void 0))&&u(l.get(n)),s&&u(l.get(P)),t){case`add`:o?s&&u(l.get(`length`)):(u(l.get(M)),a(e)&&u(l.get(N)));break;case`delete`:o||(u(l.get(M)),a(e)&&u(l.get(N)));break;case`set`:a(e)&&u(l.get(M));break}}C()}var _e=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new k(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=O-1,this.next=void 0,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&_!==this)return ie(this,!0),!0}get value(){let e=this.dep.track();return se(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function ve(e,t,n=!1){let r,i;return o(e)?r=e:(r=e.get,i=e.set),new _e(r,i,n)}function ye(e){let t=he(),n=ne();if(n&&(t==null?void 0:t.scope)!==n){g(e,!0);return}if(t){pe(e,!0);return}if(n){g(e,!0);return}}function L(e){let t=X(e);return t===e?t:(F(t,`iterate`,P),Y(e)?t:t.map(Z))}function R(e){return F(e=X(e),`iterate`,P),e}function z(e,t){return J(e)?Q(We(e)?Z(t):t):Z(t)}const be={__proto__:null,[Symbol.iterator](){return B(this,Symbol.iterator,e=>z(this,e))},concat(...e){return L(this).concat(...e.map(e=>i(e)?L(e):e))},entries(){return B(this,`entries`,e=>(e[1]=z(this,e[1]),e))},every(e,t){return V(this,`every`,e,t,void 0,arguments)},filter(e,t){return V(this,`filter`,e,t,e=>e.map(e=>z(this,e)),arguments)},find(e,t){return V(this,`find`,e,t,e=>z(this,e),arguments)},findIndex(e,t){return V(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return V(this,`findLast`,e,t,e=>z(this,e),arguments)},findLastIndex(e,t){return V(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return V(this,`forEach`,e,t,void 0,arguments)},includes(...e){return H(this,`includes`,e)},indexOf(...e){return H(this,`indexOf`,e)},join(e){return L(this).join(e)},lastIndexOf(...e){return H(this,`lastIndexOf`,e)},map(e,t){return V(this,`map`,e,t,void 0,arguments)},pop(){return U(this,`pop`)},push(...e){return U(this,`push`,e)},reduce(e,...t){return Se(this,`reduce`,e,t)},reduceRight(e,...t){return Se(this,`reduceRight`,e,t)},shift(){return U(this,`shift`)},some(e,t){return V(this,`some`,e,t,void 0,arguments)},splice(...e){return U(this,`splice`,e)},toReversed(){return L(this).toReversed()},toSorted(e){return L(this).toSorted(e)},toSpliced(...e){return L(this).toSpliced(...e)},unshift(...e){return U(this,`unshift`,e)},values(){return B(this,`values`,e=>z(this,e))}};function B(e,t,n){let r=R(e),i=r[t]();return r!==e&&!Y(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}const xe=Array.prototype;function V(e,t,n,r,i,a){let o=R(e),s=o!==e&&!Y(e),c=o[t];if(c!==xe[t]){let t=c.apply(e,a);return s?Z(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,z(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function Se(e,t,n,r){let i=R(e),a=i!==e&&!Y(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=z(e,t)),n.call(this,t,z(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?z(e,c):c}function H(e,t,n){let r=X(e);F(r,`iterate`,P);let i=r[t](...n);return(i===-1||i===!1)&&Ge(n[0])?(n[0]=X(n[0]),r[t](...n)):i}function U(e,t,n=[]){de(),S();let r=X(e)[t].apply(e,n);return C(),fe(),r}const Ce=e(`__proto__,__v_isRef,__isVue`),we=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(c));function Te(e){c(e)||(e=String(e));let t=X(this);return F(t,`has`,e),t.hasOwnProperty(e)}var Ee=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,a=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return a;if(t===`__v_raw`)return n===(r?a?ze:Re:a?Le:Ie).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let o=i(e);if(!r){let e;if(o&&(e=be[t]))return e;if(t===`hasOwnProperty`)return Te}let s=Reflect.get(e,t,$(e)?e:n);if((c(t)?we.has(t):Ce(t))||(r||F(e,`get`,t),a))return s;if($(s)){let e=o&&p(t)?s:s.value;return r&&l(e)?q(e):e}return l(s)?r?q(s):He(s):s}},De=class extends Ee{constructor(e=!1){super(!1,e)}set(e,t,n,a){let o=e[t],s=i(e)&&p(t);if(!this._isShallow){let e=J(o);if(!Y(n)&&!J(n)&&(o=X(o),n=X(n)),!s&&$(o)&&!$(n))return e||(o.value=n),!0}let c=s?Number(t)<e.length:r(e,t),l=Reflect.set(e,t,n,$(e)?e:a);return e===X(a)&&(c?m(n,o)&&I(e,`set`,t,n,o):I(e,`add`,t,n)),l}deleteProperty(e,t){let n=r(e,t),i=e[t],a=Reflect.deleteProperty(e,t);return a&&n&&I(e,`delete`,t,void 0,i),a}has(e,t){let n=Reflect.has(e,t);return(!c(t)||!we.has(t))&&F(e,`has`,t),n}ownKeys(e){return F(e,`iterate`,i(e)?`length`:M),Reflect.ownKeys(e)}},Oe=class extends Ee{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}};const ke=new De,Ae=new Oe,W=e=>e,G=e=>Reflect.getPrototypeOf(e);function je(e,n,r){return function(...i){let o=this.__v_raw,s=X(o),c=a(s),l=e===`entries`||e===Symbol.iterator&&c,u=e===`keys`&&c,d=o[e](...i),f=r?W:n?Q:Z;return!n&&F(s,`iterate`,u?N:M),t(Object.create(d),{next(){let{value:e,done:t}=d.next();return t?{value:e,done:t}:{value:l?[f(e[0]),f(e[1])]:f(e),done:t}}})}}function K(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Me(e,n){let r={get(t){let r=this.__v_raw,i=X(r),a=X(t);e||(m(t,a)&&F(i,`get`,t),F(i,`get`,a));let{has:o}=G(i),s=n?W:e?Q:Z;if(o.call(i,t))return s(r.get(t));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(t)},get size(){let t=this.__v_raw;return!e&&F(X(t),`iterate`,M),t.size},has(t){let n=this.__v_raw,r=X(n),i=X(t);return e||(m(t,i)&&F(r,`has`,t),F(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(t,r){let i=this,a=i.__v_raw,o=X(a),s=n?W:e?Q:Z;return!e&&F(o,`iterate`,M),a.forEach((e,n)=>t.call(r,s(e),s(n),i))}};return t(r,e?{add:K(`add`),set:K(`set`),delete:K(`delete`),clear:K(`clear`)}:{add(e){let t=X(this),r=G(t),i=X(e),a=!n&&!Y(e)&&!J(e)?i:e;return r.has.call(t,a)||m(e,a)&&r.has.call(t,e)||m(i,a)&&r.has.call(t,i)||(t.add(a),I(t,`add`,a,a)),this},set(e,t){!n&&!Y(t)&&!J(t)&&(t=X(t));let r=X(this),{has:i,get:a}=G(r),o=i.call(r,e);o||(e=X(e),o=i.call(r,e));let s=a.call(r,e);return r.set(e,t),o?m(t,s)&&I(r,`set`,e,t,s):I(r,`add`,e,t),this},delete(e){let t=X(this),{has:n,get:r}=G(t),i=n.call(t,e);i||(e=X(e),i=n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&I(t,`delete`,e,void 0,a),o},clear(){let e=X(this),t=e.size!==0,n=e.clear();return t&&I(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(t=>{r[t]=je(t,e,n)}),r}function Ne(e,t){let n=Me(e,t);return(t,i,a)=>i===`__v_isReactive`?!e:i===`__v_isReadonly`?e:i===`__v_raw`?t:Reflect.get(r(n,i)&&i in t?n:t,i,a)}const Pe={get:Ne(!1,!1)},Fe={get:Ne(!0,!1)},Ie=new WeakMap,Le=new WeakMap,Re=new WeakMap,ze=new WeakMap;function Be(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Ve(e){return e.__v_skip||!Object.isExtensible(e)?0:Be(f(e))}function He(e){return J(e)?e:Ue(e,!1,ke,Pe,Ie)}function q(e){return Ue(e,!0,Ae,Fe,Re)}function Ue(e,t,n,r,i){if(!l(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=Ve(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function We(e){return J(e)?We(e.__v_raw):!!(e&&e.__v_isReactive)}function J(e){return!!(e&&e.__v_isReadonly)}function Y(e){return!!(e&&e.__v_isShallow)}function Ge(e){return e?!!e.__v_raw:!1}function X(e){let t=e&&e.__v_raw;return t?X(t):e}const Z=e=>l(e)?He(e):e,Q=e=>l(e)?q(e):e;let Ke,qe;function $(e){return e?e.__v_isRef===!0:!1}function Je(e){return Ye(e,!0)}function Ye(e,t){return $(e)?e:new Xe(e,t)}Ke=`__v_isRef`,qe=`__v_isShallow`;var Xe=class{constructor(e,t){this.dep=new k,this[Ke]=!0,this[qe]=!1,this._rawValue=t?e:X(e),this._value=t?e:Z(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Y(e)||J(e);e=n?e:X(e),m(e,t)&&(this._rawValue=e,this._value=n?e:Z(e),this.dep.trigger())}};function Ze(e){let t=Je(e);return[()=>t.value,e=>{let n=typeof e==`function`?e(t.value):e;return t.value=n,n}]}function Qe(e){let t=ve(e);return()=>t.value}function $e(e){le(e)}function et(e){let t=te(!0),n=!1,r=()=>{n||(n=!0,t.stop())};try{return t.run(()=>e(r))}catch(e){throw r(),e}}export{me as batch,$e as createEffect,Qe as createMemo,et as createRoot,Ze as createSignal,ye as onCleanup};
|
package/dist/signal.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* signal v0.1.1-beta.
|
|
2
|
+
* signal v0.1.1-beta.11
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -261,7 +261,8 @@ var ZeusSignal = (function(exports) {
|
|
|
261
261
|
trigger() {
|
|
262
262
|
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
263
263
|
else if (this.scheduler) this.scheduler();
|
|
264
|
-
else this.runIfDirty();
|
|
264
|
+
else if (this.flags & 128) this.runIfDirty();
|
|
265
|
+
else this.run();
|
|
265
266
|
}
|
|
266
267
|
/**
|
|
267
268
|
* @internal
|
|
@@ -560,6 +561,7 @@ var ZeusSignal = (function(exports) {
|
|
|
560
561
|
}
|
|
561
562
|
track(debugInfo) {
|
|
562
563
|
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
564
|
+
if (this.computed) activeSub.flags |= 128;
|
|
563
565
|
let link = this.activeLink;
|
|
564
566
|
if (link === void 0 || link.sub !== activeSub) {
|
|
565
567
|
link = this.activeLink = new Link(activeSub, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ZeusSignal=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}let n=Object.assign,r=Object.prototype.hasOwnProperty,i=(e,t)=>r.call(e,t),a=Array.isArray,o=e=>f(e)===`[object Map]`,s=e=>typeof e==`function`,c=e=>typeof e==`string`,l=e=>typeof e==`symbol`,u=e=>typeof e==`object`&&!!e,d=Object.prototype.toString,f=e=>d.call(e),ee=e=>f(e).slice(8,-1),p=e=>c(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,m=(e,t)=>!Object.is(e,t),h;var te=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&h&&(h.active?(this.parent=h,this.index=(h.scopes||(h.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=h;try{return h=this,e()}finally{h=t}}}on(){++this._on===1&&(this.prevScope=h,h=this)}off(){if(this._on>0&&--this._on===0){if(h===this)h=this.prevScope;else{let e=h;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function ne(e){return new te(e)}function re(){return h}function ie(e,t=!1){h&&h.cleanups.push(e)}let g,_=new WeakSet;var v=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanups=void 0,this.scheduler=void 0,this.scope=h,h&&(h.active?h.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,_.has(this)&&(_.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||S(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,pe(this),ae(this);let e=g,t=D;g=this,D=!0;try{return this.fn()}finally{oe(this),g=e,D=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)E(e);this.deps=this.depsTail=void 0,pe(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?_.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){T(this)&&this.run()}get dirty(){return T(this)}};let y=0,b,x;function S(e,t=!1){if(e.flags|=8,t){e.next=x,x=e;return}e.next=b,b=e}function C(){y++}function w(){if(--y>0)return;if(x){let e=x;for(x=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;b;){let t=b;for(b=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function ae(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function oe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),E(r),ce(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function T(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(se(t.dep.computed)||t.dep.version!==t.version))return!0;return!1}function se(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===k)||(e.globalVersion=k,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!T(e))))return;e.flags|=2;let t=e.dep,n=g,r=D;g=e,D=!0;try{ae(e);let n=e.fn(e._value);(t.version===0||m(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{g=n,D=r,oe(e),e.flags&=-3}}function E(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)E(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ce(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function le(e,t){e.effect instanceof v&&(e=e.effect.fn);let r=new v(e);t&&n(r,t);try{r.run()}catch(e){throw r.stop(),e}let i=r.run.bind(r);return i.effect=r,i}let D=!0,O=[];function ue(){O.push(D),D=!1}function de(){let e=O.pop();D=e===void 0?!0:e}function fe(e,t=!1){if(g instanceof v){var n,r;((r=(n=g).cleanups)==null?n.cleanups=[]:r).push(e)}}function pe(e){let t=e.cleanups;if(e.cleanups=void 0,t){let e=g;g=void 0;try{let e;for(let n of t)try{n()}catch(t){e!=null||(e=t)}if(e)throw e}finally{g=e}}}function me(e){C();try{return e()}finally{w()}}function he(){return g instanceof v?g:void 0}let k=0;var ge=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},A=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!g||!D||g===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==g)t=this.activeLink=new ge(g,this),g.deps?(t.prevDep=g.depsTail,g.depsTail.nextDep=t,g.depsTail=t):g.deps=g.depsTail=t,_e(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=g.depsTail,t.nextDep=void 0,g.depsTail.nextDep=t,g.depsTail=t,g.deps===t&&(g.deps=e)}return t}trigger(e){this.version++,k++,this.notify(e)}notify(e){C();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{w()}}};function _e(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)_e(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}let j=new WeakMap,M=Symbol(``),N=Symbol(``),P=Symbol(``);function F(e,t,n){if(D&&g){let t=j.get(e);t||j.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new A),r.map=t,r.key=n),r.track()}}function I(e,t,n,r,i,s){let c=j.get(e);if(!c){k++;return}let u=e=>{e&&e.trigger()};if(C(),t===`clear`)c.forEach(u);else{let i=a(e),s=i&&p(n);if(i&&n===`length`){let e=Number(r);c.forEach((t,n)=>{(n===`length`||n===P||!l(n)&&n>=e)&&u(t)})}else switch((n!==void 0||c.has(void 0))&&u(c.get(n)),s&&u(c.get(P)),t){case`add`:i?s&&u(c.get(`length`)):(u(c.get(M)),o(e)&&u(c.get(N)));break;case`delete`:i||(u(c.get(M)),o(e)&&u(c.get(N)));break;case`set`:o(e)&&u(c.get(M));break}}w()}var ve=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new A(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=k-1,this.next=void 0,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&g!==this)return S(this,!0),!0}get value(){let e=this.dep.track();return se(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function ye(e,t,n=!1){let r,i;return s(e)?r=e:(r=e.get,i=e.set),new ve(r,i,n)}function be(e){let t=he(),n=re();if(n&&(t==null?void 0:t.scope)!==n){ie(e,!0);return}if(t){fe(e,!0);return}if(n){ie(e,!0);return}}function L(e){let t=X(e);return t===e?t:(F(t,`iterate`,P),Y(e)?t:t.map(Z))}function R(e){return F(e=X(e),`iterate`,P),e}function z(e,t){return J(e)?Q(Ge(e)?Z(t):t):Z(t)}let xe={__proto__:null,[Symbol.iterator](){return B(this,Symbol.iterator,e=>z(this,e))},concat(...e){return L(this).concat(...e.map(e=>a(e)?L(e):e))},entries(){return B(this,`entries`,e=>(e[1]=z(this,e[1]),e))},every(e,t){return V(this,`every`,e,t,void 0,arguments)},filter(e,t){return V(this,`filter`,e,t,e=>e.map(e=>z(this,e)),arguments)},find(e,t){return V(this,`find`,e,t,e=>z(this,e),arguments)},findIndex(e,t){return V(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return V(this,`findLast`,e,t,e=>z(this,e),arguments)},findLastIndex(e,t){return V(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return V(this,`forEach`,e,t,void 0,arguments)},includes(...e){return H(this,`includes`,e)},indexOf(...e){return H(this,`indexOf`,e)},join(e){return L(this).join(e)},lastIndexOf(...e){return H(this,`lastIndexOf`,e)},map(e,t){return V(this,`map`,e,t,void 0,arguments)},pop(){return U(this,`pop`)},push(...e){return U(this,`push`,e)},reduce(e,...t){return Ce(this,`reduce`,e,t)},reduceRight(e,...t){return Ce(this,`reduceRight`,e,t)},shift(){return U(this,`shift`)},some(e,t){return V(this,`some`,e,t,void 0,arguments)},splice(...e){return U(this,`splice`,e)},toReversed(){return L(this).toReversed()},toSorted(e){return L(this).toSorted(e)},toSpliced(...e){return L(this).toSpliced(...e)},unshift(...e){return U(this,`unshift`,e)},values(){return B(this,`values`,e=>z(this,e))}};function B(e,t,n){let r=R(e),i=r[t]();return r!==e&&!Y(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}let Se=Array.prototype;function V(e,t,n,r,i,a){let o=R(e),s=o!==e&&!Y(e),c=o[t];if(c!==Se[t]){let t=c.apply(e,a);return s?Z(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,z(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function Ce(e,t,n,r){let i=R(e),a=i!==e&&!Y(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=z(e,t)),n.call(this,t,z(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?z(e,c):c}function H(e,t,n){let r=X(e);F(r,`iterate`,P);let i=r[t](...n);return(i===-1||i===!1)&&Ke(n[0])?(n[0]=X(n[0]),r[t](...n)):i}function U(e,t,n=[]){ue(),C();let r=X(e)[t].apply(e,n);return w(),de(),r}let we=t(`__proto__,__v_isRef,__isVue`),Te=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(l));function Ee(e){l(e)||(e=String(e));let t=X(this);return F(t,`has`,e),t.hasOwnProperty(e)}var De=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Be:ze:i?Re:Le).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let o=a(e);if(!r){let e;if(o&&(e=xe[t]))return e;if(t===`hasOwnProperty`)return Ee}let s=Reflect.get(e,t,$(e)?e:n);if((l(t)?Te.has(t):we(t))||(r||F(e,`get`,t),i))return s;if($(s)){let e=o&&p(t)?s:s.value;return r&&u(e)?q(e):e}return u(s)?r?q(s):Ue(s):s}},Oe=class extends De{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t],s=a(e)&&p(t);if(!this._isShallow){let e=J(o);if(!Y(n)&&!J(n)&&(o=X(o),n=X(n)),!s&&$(o)&&!$(n))return e||(o.value=n),!0}let c=s?Number(t)<e.length:i(e,t),l=Reflect.set(e,t,n,$(e)?e:r);return e===X(r)&&(c?m(n,o)&&I(e,`set`,t,n,o):I(e,`add`,t,n)),l}deleteProperty(e,t){let n=i(e,t),r=e[t],a=Reflect.deleteProperty(e,t);return a&&n&&I(e,`delete`,t,void 0,r),a}has(e,t){let n=Reflect.has(e,t);return(!l(t)||!Te.has(t))&&F(e,`has`,t),n}ownKeys(e){return F(e,`iterate`,a(e)?`length`:M),Reflect.ownKeys(e)}},ke=class extends De{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}};let Ae=new Oe,je=new ke,W=e=>e,G=e=>Reflect.getPrototypeOf(e);function Me(e,t,r){return function(...i){let a=this.__v_raw,s=X(a),c=o(s),l=e===`entries`||e===Symbol.iterator&&c,u=e===`keys`&&c,d=a[e](...i),f=r?W:t?Q:Z;return!t&&F(s,`iterate`,u?N:M),n(Object.create(d),{next(){let{value:e,done:t}=d.next();return t?{value:e,done:t}:{value:l?[f(e[0]),f(e[1])]:f(e),done:t}}})}}function K(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ne(e,t){let r={get(n){let r=this.__v_raw,i=X(r),a=X(n);e||(m(n,a)&&F(i,`get`,n),F(i,`get`,a));let{has:o}=G(i),s=t?W:e?Q:Z;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&F(X(t),`iterate`,M),t.size},has(t){let n=this.__v_raw,r=X(n),i=X(t);return e||(m(t,i)&&F(r,`has`,t),F(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=X(a),s=t?W:e?Q:Z;return!e&&F(o,`iterate`,M),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return n(r,e?{add:K(`add`),set:K(`set`),delete:K(`delete`),clear:K(`clear`)}:{add(e){let n=X(this),r=G(n),i=X(e),a=!t&&!Y(e)&&!J(e)?i:e;return r.has.call(n,a)||m(e,a)&&r.has.call(n,e)||m(i,a)&&r.has.call(n,i)||(n.add(a),I(n,`add`,a,a)),this},set(e,n){!t&&!Y(n)&&!J(n)&&(n=X(n));let r=X(this),{has:i,get:a}=G(r),o=i.call(r,e);o||(e=X(e),o=i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?m(n,s)&&I(r,`set`,e,n,s):I(r,`add`,e,n),this},delete(e){let t=X(this),{has:n,get:r}=G(t),i=n.call(t,e);i||(e=X(e),i=n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&I(t,`delete`,e,void 0,a),o},clear(){let e=X(this),t=e.size!==0,n=e.clear();return t&&I(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(n=>{r[n]=Me(n,e,t)}),r}function Pe(e,t){let n=Ne(e,t);return(t,r,a)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(i(n,r)&&r in t?n:t,r,a)}let Fe={get:Pe(!1,!1)},Ie={get:Pe(!0,!1)},Le=new WeakMap,Re=new WeakMap,ze=new WeakMap,Be=new WeakMap;function Ve(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function He(e){return e.__v_skip||!Object.isExtensible(e)?0:Ve(ee(e))}function Ue(e){return J(e)?e:We(e,!1,Ae,Fe,Le)}function q(e){return We(e,!0,je,Ie,ze)}function We(e,t,n,r,i){if(!u(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=He(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function Ge(e){return J(e)?Ge(e.__v_raw):!!(e&&e.__v_isReactive)}function J(e){return!!(e&&e.__v_isReadonly)}function Y(e){return!!(e&&e.__v_isShallow)}function Ke(e){return e?!!e.__v_raw:!1}function X(e){let t=e&&e.__v_raw;return t?X(t):e}let Z=e=>u(e)?Ue(e):e,Q=e=>u(e)?q(e):e,qe,Je;function $(e){return e?e.__v_isRef===!0:!1}function Ye(e){return Xe(e,!0)}function Xe(e,t){return $(e)?e:new Ze(e,t)}qe=`__v_isRef`,Je=`__v_isShallow`;var Ze=class{constructor(e,t){this.dep=new A,this[qe]=!0,this[Je]=!1,this._rawValue=t?e:X(e),this._value=t?e:Z(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Y(e)||J(e);e=n?e:X(e),m(e,t)&&(this._rawValue=e,this._value=n?e:Z(e),this.dep.trigger())}};function Qe(e){let t=Ye(e);return[()=>t.value,e=>{let n=typeof e==`function`?e(t.value):e;return t.value=n,n}]}function $e(e){let t=ye(e);return()=>t.value}function et(e){le(e)}function tt(e){let t=ne(!0),n=!1,r=()=>{n||(n=!0,t.stop())};try{return t.run(()=>e(r))}catch(e){throw r(),e}}return e.batch=me,e.createEffect=et,e.createMemo=$e,e.createRoot=tt,e.createSignal=Qe,e.onCleanup=be,e})({});
|
|
1
|
+
var ZeusSignal=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}let n=Object.assign,r=Object.prototype.hasOwnProperty,i=(e,t)=>r.call(e,t),a=Array.isArray,o=e=>f(e)===`[object Map]`,s=e=>typeof e==`function`,c=e=>typeof e==`string`,l=e=>typeof e==`symbol`,u=e=>typeof e==`object`&&!!e,d=Object.prototype.toString,f=e=>d.call(e),ee=e=>f(e).slice(8,-1),p=e=>c(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,m=(e,t)=>!Object.is(e,t),h;var te=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&h&&(h.active?(this.parent=h,this.index=(h.scopes||(h.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=h;try{return h=this,e()}finally{h=t}}}on(){++this._on===1&&(this.prevScope=h,h=this)}off(){if(this._on>0&&--this._on===0){if(h===this)h=this.prevScope;else{let e=h;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function ne(e){return new te(e)}function re(){return h}function ie(e,t=!1){h&&h.cleanups.push(e)}let g,_=new WeakSet;var v=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanups=void 0,this.scheduler=void 0,this.scope=h,h&&(h.active?h.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,_.has(this)&&(_.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||S(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,pe(this),ae(this);let e=g,t=D;g=this,D=!0;try{return this.fn()}finally{oe(this),g=e,D=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)E(e);this.deps=this.depsTail=void 0,pe(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?_.add(this):this.scheduler?this.scheduler():this.flags&128?this.runIfDirty():this.run()}runIfDirty(){T(this)&&this.run()}get dirty(){return T(this)}};let y=0,b,x;function S(e,t=!1){if(e.flags|=8,t){e.next=x,x=e;return}e.next=b,b=e}function C(){y++}function w(){if(--y>0)return;if(x){let e=x;for(x=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;b;){let t=b;for(b=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function ae(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function oe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),E(r),ce(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function T(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(se(t.dep.computed)||t.dep.version!==t.version))return!0;return!1}function se(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===k)||(e.globalVersion=k,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!T(e))))return;e.flags|=2;let t=e.dep,n=g,r=D;g=e,D=!0;try{ae(e);let n=e.fn(e._value);(t.version===0||m(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{g=n,D=r,oe(e),e.flags&=-3}}function E(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)E(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ce(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function le(e,t){e.effect instanceof v&&(e=e.effect.fn);let r=new v(e);t&&n(r,t);try{r.run()}catch(e){throw r.stop(),e}let i=r.run.bind(r);return i.effect=r,i}let D=!0,O=[];function ue(){O.push(D),D=!1}function de(){let e=O.pop();D=e===void 0?!0:e}function fe(e,t=!1){if(g instanceof v){var n,r;((r=(n=g).cleanups)==null?n.cleanups=[]:r).push(e)}}function pe(e){let t=e.cleanups;if(e.cleanups=void 0,t){let e=g;g=void 0;try{let e;for(let n of t)try{n()}catch(t){e!=null||(e=t)}if(e)throw e}finally{g=e}}}function me(e){C();try{return e()}finally{w()}}function he(){return g instanceof v?g:void 0}let k=0;var ge=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},A=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!g||!D||g===this.computed)return;this.computed&&(g.flags|=128);let t=this.activeLink;if(t===void 0||t.sub!==g)t=this.activeLink=new ge(g,this),g.deps?(t.prevDep=g.depsTail,g.depsTail.nextDep=t,g.depsTail=t):g.deps=g.depsTail=t,_e(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=g.depsTail,t.nextDep=void 0,g.depsTail.nextDep=t,g.depsTail=t,g.deps===t&&(g.deps=e)}return t}trigger(e){this.version++,k++,this.notify(e)}notify(e){C();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{w()}}};function _e(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)_e(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}let j=new WeakMap,M=Symbol(``),N=Symbol(``),P=Symbol(``);function F(e,t,n){if(D&&g){let t=j.get(e);t||j.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new A),r.map=t,r.key=n),r.track()}}function I(e,t,n,r,i,s){let c=j.get(e);if(!c){k++;return}let u=e=>{e&&e.trigger()};if(C(),t===`clear`)c.forEach(u);else{let i=a(e),s=i&&p(n);if(i&&n===`length`){let e=Number(r);c.forEach((t,n)=>{(n===`length`||n===P||!l(n)&&n>=e)&&u(t)})}else switch((n!==void 0||c.has(void 0))&&u(c.get(n)),s&&u(c.get(P)),t){case`add`:i?s&&u(c.get(`length`)):(u(c.get(M)),o(e)&&u(c.get(N)));break;case`delete`:i||(u(c.get(M)),o(e)&&u(c.get(N)));break;case`set`:o(e)&&u(c.get(M));break}}w()}var ve=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new A(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=k-1,this.next=void 0,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&g!==this)return S(this,!0),!0}get value(){let e=this.dep.track();return se(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function ye(e,t,n=!1){let r,i;return s(e)?r=e:(r=e.get,i=e.set),new ve(r,i,n)}function be(e){let t=he(),n=re();if(n&&(t==null?void 0:t.scope)!==n){ie(e,!0);return}if(t){fe(e,!0);return}if(n){ie(e,!0);return}}function L(e){let t=X(e);return t===e?t:(F(t,`iterate`,P),Y(e)?t:t.map(Z))}function R(e){return F(e=X(e),`iterate`,P),e}function z(e,t){return J(e)?Q(Ge(e)?Z(t):t):Z(t)}let xe={__proto__:null,[Symbol.iterator](){return B(this,Symbol.iterator,e=>z(this,e))},concat(...e){return L(this).concat(...e.map(e=>a(e)?L(e):e))},entries(){return B(this,`entries`,e=>(e[1]=z(this,e[1]),e))},every(e,t){return V(this,`every`,e,t,void 0,arguments)},filter(e,t){return V(this,`filter`,e,t,e=>e.map(e=>z(this,e)),arguments)},find(e,t){return V(this,`find`,e,t,e=>z(this,e),arguments)},findIndex(e,t){return V(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return V(this,`findLast`,e,t,e=>z(this,e),arguments)},findLastIndex(e,t){return V(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return V(this,`forEach`,e,t,void 0,arguments)},includes(...e){return H(this,`includes`,e)},indexOf(...e){return H(this,`indexOf`,e)},join(e){return L(this).join(e)},lastIndexOf(...e){return H(this,`lastIndexOf`,e)},map(e,t){return V(this,`map`,e,t,void 0,arguments)},pop(){return U(this,`pop`)},push(...e){return U(this,`push`,e)},reduce(e,...t){return Ce(this,`reduce`,e,t)},reduceRight(e,...t){return Ce(this,`reduceRight`,e,t)},shift(){return U(this,`shift`)},some(e,t){return V(this,`some`,e,t,void 0,arguments)},splice(...e){return U(this,`splice`,e)},toReversed(){return L(this).toReversed()},toSorted(e){return L(this).toSorted(e)},toSpliced(...e){return L(this).toSpliced(...e)},unshift(...e){return U(this,`unshift`,e)},values(){return B(this,`values`,e=>z(this,e))}};function B(e,t,n){let r=R(e),i=r[t]();return r!==e&&!Y(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}let Se=Array.prototype;function V(e,t,n,r,i,a){let o=R(e),s=o!==e&&!Y(e),c=o[t];if(c!==Se[t]){let t=c.apply(e,a);return s?Z(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,z(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function Ce(e,t,n,r){let i=R(e),a=i!==e&&!Y(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=z(e,t)),n.call(this,t,z(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?z(e,c):c}function H(e,t,n){let r=X(e);F(r,`iterate`,P);let i=r[t](...n);return(i===-1||i===!1)&&Ke(n[0])?(n[0]=X(n[0]),r[t](...n)):i}function U(e,t,n=[]){ue(),C();let r=X(e)[t].apply(e,n);return w(),de(),r}let we=t(`__proto__,__v_isRef,__isVue`),Te=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(l));function Ee(e){l(e)||(e=String(e));let t=X(this);return F(t,`has`,e),t.hasOwnProperty(e)}var De=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Be:ze:i?Re:Le).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let o=a(e);if(!r){let e;if(o&&(e=xe[t]))return e;if(t===`hasOwnProperty`)return Ee}let s=Reflect.get(e,t,$(e)?e:n);if((l(t)?Te.has(t):we(t))||(r||F(e,`get`,t),i))return s;if($(s)){let e=o&&p(t)?s:s.value;return r&&u(e)?q(e):e}return u(s)?r?q(s):Ue(s):s}},Oe=class extends De{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t],s=a(e)&&p(t);if(!this._isShallow){let e=J(o);if(!Y(n)&&!J(n)&&(o=X(o),n=X(n)),!s&&$(o)&&!$(n))return e||(o.value=n),!0}let c=s?Number(t)<e.length:i(e,t),l=Reflect.set(e,t,n,$(e)?e:r);return e===X(r)&&(c?m(n,o)&&I(e,`set`,t,n,o):I(e,`add`,t,n)),l}deleteProperty(e,t){let n=i(e,t),r=e[t],a=Reflect.deleteProperty(e,t);return a&&n&&I(e,`delete`,t,void 0,r),a}has(e,t){let n=Reflect.has(e,t);return(!l(t)||!Te.has(t))&&F(e,`has`,t),n}ownKeys(e){return F(e,`iterate`,a(e)?`length`:M),Reflect.ownKeys(e)}},ke=class extends De{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}};let Ae=new Oe,je=new ke,W=e=>e,G=e=>Reflect.getPrototypeOf(e);function Me(e,t,r){return function(...i){let a=this.__v_raw,s=X(a),c=o(s),l=e===`entries`||e===Symbol.iterator&&c,u=e===`keys`&&c,d=a[e](...i),f=r?W:t?Q:Z;return!t&&F(s,`iterate`,u?N:M),n(Object.create(d),{next(){let{value:e,done:t}=d.next();return t?{value:e,done:t}:{value:l?[f(e[0]),f(e[1])]:f(e),done:t}}})}}function K(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ne(e,t){let r={get(n){let r=this.__v_raw,i=X(r),a=X(n);e||(m(n,a)&&F(i,`get`,n),F(i,`get`,a));let{has:o}=G(i),s=t?W:e?Q:Z;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&F(X(t),`iterate`,M),t.size},has(t){let n=this.__v_raw,r=X(n),i=X(t);return e||(m(t,i)&&F(r,`has`,t),F(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=X(a),s=t?W:e?Q:Z;return!e&&F(o,`iterate`,M),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return n(r,e?{add:K(`add`),set:K(`set`),delete:K(`delete`),clear:K(`clear`)}:{add(e){let n=X(this),r=G(n),i=X(e),a=!t&&!Y(e)&&!J(e)?i:e;return r.has.call(n,a)||m(e,a)&&r.has.call(n,e)||m(i,a)&&r.has.call(n,i)||(n.add(a),I(n,`add`,a,a)),this},set(e,n){!t&&!Y(n)&&!J(n)&&(n=X(n));let r=X(this),{has:i,get:a}=G(r),o=i.call(r,e);o||(e=X(e),o=i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?m(n,s)&&I(r,`set`,e,n,s):I(r,`add`,e,n),this},delete(e){let t=X(this),{has:n,get:r}=G(t),i=n.call(t,e);i||(e=X(e),i=n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&I(t,`delete`,e,void 0,a),o},clear(){let e=X(this),t=e.size!==0,n=e.clear();return t&&I(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(n=>{r[n]=Me(n,e,t)}),r}function Pe(e,t){let n=Ne(e,t);return(t,r,a)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(i(n,r)&&r in t?n:t,r,a)}let Fe={get:Pe(!1,!1)},Ie={get:Pe(!0,!1)},Le=new WeakMap,Re=new WeakMap,ze=new WeakMap,Be=new WeakMap;function Ve(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function He(e){return e.__v_skip||!Object.isExtensible(e)?0:Ve(ee(e))}function Ue(e){return J(e)?e:We(e,!1,Ae,Fe,Le)}function q(e){return We(e,!0,je,Ie,ze)}function We(e,t,n,r,i){if(!u(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=He(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function Ge(e){return J(e)?Ge(e.__v_raw):!!(e&&e.__v_isReactive)}function J(e){return!!(e&&e.__v_isReadonly)}function Y(e){return!!(e&&e.__v_isShallow)}function Ke(e){return e?!!e.__v_raw:!1}function X(e){let t=e&&e.__v_raw;return t?X(t):e}let Z=e=>u(e)?Ue(e):e,Q=e=>u(e)?q(e):e,qe,Je;function $(e){return e?e.__v_isRef===!0:!1}function Ye(e){return Xe(e,!0)}function Xe(e,t){return $(e)?e:new Ze(e,t)}qe=`__v_isRef`,Je=`__v_isShallow`;var Ze=class{constructor(e,t){this.dep=new A,this[qe]=!0,this[Je]=!1,this._rawValue=t?e:X(e),this._value=t?e:Z(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Y(e)||J(e);e=n?e:X(e),m(e,t)&&(this._rawValue=e,this._value=n?e:Z(e),this.dep.trigger())}};function Qe(e){let t=Ye(e);return[()=>t.value,e=>{let n=typeof e==`function`?e(t.value):e;return t.value=n,n}]}function $e(e){let t=ye(e);return()=>t.value}function et(e){le(e)}function tt(e){let t=ne(!0),n=!1,r=()=>{n||(n=!0,t.stop())};try{return t.run(()=>e(r))}catch(e){throw r(),e}}return e.batch=me,e.createEffect=et,e.createMemo=$e,e.createRoot=tt,e.createSignal=Qe,e.onCleanup=be,e})({});
|
package/dist/signal.prod.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeus-js/signal",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.1-beta.
|
|
4
|
+
"version": "0.1.1-beta.11",
|
|
5
5
|
"description": "@zeus-js/signal",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -33,16 +33,26 @@
|
|
|
33
33
|
"development": "./dist/internal.cjs",
|
|
34
34
|
"default": "./internal.cjs"
|
|
35
35
|
}
|
|
36
|
+
},
|
|
37
|
+
"./diagnostics": {
|
|
38
|
+
"types": "./dist/diagnostics.d.ts",
|
|
39
|
+
"import": "./dist/diagnostics.js",
|
|
40
|
+
"require": {
|
|
41
|
+
"production": "./dist/diagnostics.prod.cjs",
|
|
42
|
+
"development": "./dist/diagnostics.cjs",
|
|
43
|
+
"default": "./diagnostics.cjs"
|
|
44
|
+
}
|
|
36
45
|
}
|
|
37
46
|
},
|
|
38
47
|
"files": [
|
|
39
48
|
"index.cjs",
|
|
40
49
|
"internal.cjs",
|
|
50
|
+
"diagnostics.cjs",
|
|
41
51
|
"dist"
|
|
42
52
|
],
|
|
43
53
|
"dependencies": {
|
|
44
54
|
"alien-signals": "^3.2.1",
|
|
45
|
-
"@zeus-js/shared": "0.1.1-beta.
|
|
55
|
+
"@zeus-js/shared": "0.1.1-beta.11"
|
|
46
56
|
},
|
|
47
57
|
"author": "Baicie",
|
|
48
58
|
"bugs": {
|
|
@@ -63,6 +73,10 @@
|
|
|
63
73
|
{
|
|
64
74
|
"entry": "internal.ts",
|
|
65
75
|
"output": "dist/internal.js"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"entry": "diagnostics.ts",
|
|
79
|
+
"output": "dist/diagnostics.js"
|
|
66
80
|
}
|
|
67
81
|
]
|
|
68
82
|
},
|