sibujs 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +210 -26
- package/dist/browser.js +4 -4
- package/dist/build.cjs +193 -89
- package/dist/build.js +10 -10
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-24DBWDTK.js → chunk-37BUKSLH.js} +1 -1
- package/dist/{chunk-IHBVTURX.js → chunk-4UUMSLSL.js} +4 -4
- package/dist/{chunk-USDR2GFV.js → chunk-6LTFHJQG.js} +3 -3
- package/dist/{chunk-MWZFOIBG.js → chunk-AMIKDMLP.js} +4 -4
- package/dist/{chunk-JBXNCZSC.js → chunk-F7FXQ3QS.js} +1 -1
- package/dist/{chunk-BEIKESVL.js → chunk-IKLYI3RF.js} +9 -9
- package/dist/{chunk-NUWKIEHE.js → chunk-LU2MQXQQ.js} +2 -2
- package/dist/{chunk-WVJJUFPC.js → chunk-M5KBNOSJ.js} +2 -2
- package/dist/{chunk-7JHWAGRQ.js → chunk-MHBCEJQO.js} +1 -1
- package/dist/{chunk-Q2ERM6NT.js → chunk-NHKQKKZU.js} +1 -1
- package/dist/{chunk-6G6UNHZI.js → chunk-RYMOSG5B.js} +5 -5
- package/dist/{chunk-F4UM7QBJ.js → chunk-SLMFA3ZZ.js} +1 -1
- package/dist/{chunk-X3NHE2DK.js → chunk-TEFZT5PJ.js} +83 -17
- package/dist/{chunk-SLCUP2EK.js → chunk-ULLTNDRA.js} +3 -3
- package/dist/{chunk-M6WSIGYW.js → chunk-VOVVTOEA.js} +2 -2
- package/dist/{chunk-XQ7XSGYP.js → chunk-WL7BIR6O.js} +1 -1
- package/dist/{chunk-CVMMULHO.js → chunk-WW6DAGGR.js} +4 -4
- package/dist/{chunk-5K72I3UQ.js → chunk-WZG2SZOT.js} +21 -4
- package/dist/{chunk-S4FHR5ZZ.js → chunk-XH2RTYEQ.js} +3 -3
- package/dist/{chunk-4WXWJ4SW.js → chunk-Z37APKBV.js} +4 -4
- package/dist/data.cjs +161 -23
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +245 -31
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +183 -45
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +185 -86
- package/dist/extras.js +19 -19
- package/dist/index.cjs +193 -89
- package/dist/index.d.cts +59 -8
- package/dist/index.d.ts +59 -8
- package/dist/index.js +10 -10
- package/dist/motion.cjs +329 -13
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +161 -23
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +258 -23
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +244 -51
- package/dist/plugins.js +6 -6
- package/dist/ssr.cjs +183 -44
- package/dist/ssr.js +7 -7
- package/dist/testing.cjs +396 -5
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +221 -32
- package/dist/ui.js +6 -6
- package/dist/widgets.cjs +146 -26
- package/dist/widgets.js +6 -6
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isDev
|
|
4
4
|
} from "./chunk-COY6PUD2.js";
|
|
5
5
|
|
|
6
|
-
// src/reactivity/track.ts
|
|
6
|
+
// src/reactivity/track-core.ts
|
|
7
7
|
var _isDev = isDev();
|
|
8
8
|
var POOL_MAX = 4096;
|
|
9
9
|
var nodePool = [];
|
|
@@ -117,6 +117,9 @@ function resumeTracking() {
|
|
|
117
117
|
trackingSuspended = false;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
function isTrackingSuspended() {
|
|
121
|
+
return trackingSuspended;
|
|
122
|
+
}
|
|
120
123
|
function untracked(fn) {
|
|
121
124
|
suspendTracking();
|
|
122
125
|
try {
|
|
@@ -234,6 +237,11 @@ function cleanup(subscriber) {
|
|
|
234
237
|
var maxSubscriberRepeats = 50;
|
|
235
238
|
var maxDrainIterations = 1e6;
|
|
236
239
|
var drainEpoch = 0;
|
|
240
|
+
function setMaxSubscriberRepeats(n) {
|
|
241
|
+
const prev = maxSubscriberRepeats;
|
|
242
|
+
if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
|
|
243
|
+
return prev;
|
|
244
|
+
}
|
|
237
245
|
function setMaxDrainIterations(n) {
|
|
238
246
|
const prev = maxDrainIterations;
|
|
239
247
|
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
@@ -409,21 +417,79 @@ function forEachSubscriber(signal, visit) {
|
|
|
409
417
|
}
|
|
410
418
|
}
|
|
411
419
|
|
|
420
|
+
// src/reactivity/track.ts
|
|
421
|
+
var _isDev2 = isDev();
|
|
422
|
+
var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
|
|
423
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
424
|
+
function resolveReactiveApi() {
|
|
425
|
+
const g = globalThis;
|
|
426
|
+
const existing = g[REGISTRY_KEY];
|
|
427
|
+
if (existing) {
|
|
428
|
+
if (_isDev2 && !existing.__dupWarned) {
|
|
429
|
+
existing.__dupWarned = true;
|
|
430
|
+
devWarn(
|
|
431
|
+
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity still works \u2014 all copies share the first one \u2014 but de-duplicate sibujs in your bundler (e.g. Vite optimizeDeps.exclude: ['sibujs'] or resolve.dedupe: ['sibujs']).`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
return existing;
|
|
435
|
+
}
|
|
436
|
+
const local = {
|
|
437
|
+
suspendTracking,
|
|
438
|
+
resumeTracking,
|
|
439
|
+
isTrackingSuspended,
|
|
440
|
+
untracked,
|
|
441
|
+
retrack,
|
|
442
|
+
track,
|
|
443
|
+
reactiveBinding,
|
|
444
|
+
recordDependency,
|
|
445
|
+
cleanup,
|
|
446
|
+
setMaxSubscriberRepeats,
|
|
447
|
+
setMaxDrainIterations,
|
|
448
|
+
drainNotificationQueue,
|
|
449
|
+
queueSignalNotification,
|
|
450
|
+
notifySubscribers,
|
|
451
|
+
getSubscriberCount,
|
|
452
|
+
getSubscriberDeps,
|
|
453
|
+
forEachSubscriber,
|
|
454
|
+
version: _runtimeVersion
|
|
455
|
+
};
|
|
456
|
+
g[REGISTRY_KEY] = local;
|
|
457
|
+
return local;
|
|
458
|
+
}
|
|
459
|
+
var API = resolveReactiveApi();
|
|
460
|
+
var suspendTracking2 = API.suspendTracking;
|
|
461
|
+
var resumeTracking2 = API.resumeTracking;
|
|
462
|
+
var isTrackingSuspended2 = API.isTrackingSuspended;
|
|
463
|
+
var untracked2 = API.untracked;
|
|
464
|
+
var retrack2 = API.retrack;
|
|
465
|
+
var track2 = API.track;
|
|
466
|
+
var reactiveBinding2 = API.reactiveBinding;
|
|
467
|
+
var recordDependency2 = API.recordDependency;
|
|
468
|
+
var cleanup2 = API.cleanup;
|
|
469
|
+
var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
|
|
470
|
+
var setMaxDrainIterations2 = API.setMaxDrainIterations;
|
|
471
|
+
var drainNotificationQueue2 = API.drainNotificationQueue;
|
|
472
|
+
var queueSignalNotification2 = API.queueSignalNotification;
|
|
473
|
+
var notifySubscribers2 = API.notifySubscribers;
|
|
474
|
+
var getSubscriberCount2 = API.getSubscriberCount;
|
|
475
|
+
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
476
|
+
var forEachSubscriber2 = API.forEachSubscriber;
|
|
477
|
+
|
|
412
478
|
export {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
untracked,
|
|
417
|
-
retrack,
|
|
418
|
-
track,
|
|
419
|
-
reactiveBinding,
|
|
420
|
-
recordDependency,
|
|
421
|
-
cleanup,
|
|
422
|
-
setMaxDrainIterations,
|
|
423
|
-
drainNotificationQueue,
|
|
424
|
-
queueSignalNotification,
|
|
425
|
-
notifySubscribers,
|
|
426
|
-
getSubscriberCount,
|
|
427
|
-
getSubscriberDeps,
|
|
428
|
-
forEachSubscriber
|
|
479
|
+
suspendTracking2 as suspendTracking,
|
|
480
|
+
resumeTracking2 as resumeTracking,
|
|
481
|
+
isTrackingSuspended2 as isTrackingSuspended,
|
|
482
|
+
untracked2 as untracked,
|
|
483
|
+
retrack2 as retrack,
|
|
484
|
+
track2 as track,
|
|
485
|
+
reactiveBinding2 as reactiveBinding,
|
|
486
|
+
recordDependency2 as recordDependency,
|
|
487
|
+
cleanup2 as cleanup,
|
|
488
|
+
setMaxDrainIterations2 as setMaxDrainIterations,
|
|
489
|
+
drainNotificationQueue2 as drainNotificationQueue,
|
|
490
|
+
queueSignalNotification2 as queueSignalNotification,
|
|
491
|
+
notifySubscribers2 as notifySubscribers,
|
|
492
|
+
getSubscriberCount2 as getSubscriberCount,
|
|
493
|
+
getSubscriberDeps2 as getSubscriberDeps,
|
|
494
|
+
forEachSubscriber2 as forEachSubscriber
|
|
429
495
|
};
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-L3GAGWCC.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MHBCEJQO.js";
|
|
10
10
|
import {
|
|
11
11
|
signal
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WZG2SZOT.js";
|
|
13
13
|
import {
|
|
14
14
|
forEachSubscriber,
|
|
15
15
|
getSubscriberCount,
|
|
16
16
|
getSubscriberDeps
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TEFZT5PJ.js";
|
|
18
18
|
import {
|
|
19
19
|
isDev
|
|
20
20
|
} from "./chunk-COY6PUD2.js";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-H3SRKIYX.js";
|
|
4
4
|
import {
|
|
5
5
|
effect
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MHBCEJQO.js";
|
|
7
7
|
import {
|
|
8
8
|
batch,
|
|
9
9
|
signal
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WZG2SZOT.js";
|
|
11
11
|
|
|
12
12
|
// src/browser/media.ts
|
|
13
13
|
function media(query) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isTrackingSuspended,
|
|
2
3
|
recordDependency,
|
|
3
4
|
retrack,
|
|
4
|
-
track
|
|
5
|
-
|
|
6
|
-
} from "./chunk-X3NHE2DK.js";
|
|
5
|
+
track
|
|
6
|
+
} from "./chunk-TEFZT5PJ.js";
|
|
7
7
|
import {
|
|
8
8
|
devAssert
|
|
9
9
|
} from "./chunk-COY6PUD2.js";
|
|
@@ -49,7 +49,7 @@ function derived(getter, options) {
|
|
|
49
49
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
|
-
if (
|
|
52
|
+
if (isTrackingSuspended()) {
|
|
53
53
|
if (cs._d) {
|
|
54
54
|
const prev = cs._v;
|
|
55
55
|
evaluating = true;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
notifySubscribers,
|
|
4
4
|
queueSignalNotification,
|
|
5
5
|
recordDependency
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TEFZT5PJ.js";
|
|
7
7
|
import {
|
|
8
8
|
isDev
|
|
9
9
|
} from "./chunk-COY6PUD2.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
// src/reactivity/batch.ts
|
|
12
12
|
var batchDepth = 0;
|
|
13
13
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
14
|
-
function
|
|
14
|
+
function batchImpl(fn) {
|
|
15
15
|
batchDepth++;
|
|
16
16
|
try {
|
|
17
17
|
return fn();
|
|
@@ -22,12 +22,12 @@ function batch(fn) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
26
26
|
if (batchDepth === 0) return false;
|
|
27
27
|
pendingSignals.add(signal2);
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function isBatchingImpl() {
|
|
31
31
|
return batchDepth > 0;
|
|
32
32
|
}
|
|
33
33
|
function flushBatch() {
|
|
@@ -40,6 +40,23 @@ function flushBatch() {
|
|
|
40
40
|
}
|
|
41
41
|
drainNotificationQueue();
|
|
42
42
|
}
|
|
43
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
44
|
+
function resolveBatchApi() {
|
|
45
|
+
const g = globalThis;
|
|
46
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
47
|
+
if (existing) return existing;
|
|
48
|
+
const local = {
|
|
49
|
+
batch: batchImpl,
|
|
50
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
51
|
+
isBatching: isBatchingImpl
|
|
52
|
+
};
|
|
53
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
54
|
+
return local;
|
|
55
|
+
}
|
|
56
|
+
var API = resolveBatchApi();
|
|
57
|
+
var batch = API.batch;
|
|
58
|
+
var enqueueBatchedSignal = API.enqueueBatchedSignal;
|
|
59
|
+
var isBatching = API.isBatching;
|
|
43
60
|
|
|
44
61
|
// src/core/signals/signal.ts
|
|
45
62
|
var _g = globalThis;
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-H3SRKIYX.js";
|
|
5
5
|
import {
|
|
6
6
|
derived
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WW6DAGGR.js";
|
|
8
8
|
import {
|
|
9
9
|
effect
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MHBCEJQO.js";
|
|
11
11
|
import {
|
|
12
12
|
batch,
|
|
13
13
|
signal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WZG2SZOT.js";
|
|
15
15
|
|
|
16
16
|
// src/patterns/machine.ts
|
|
17
17
|
function machine(config) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SLMFA3ZZ.js";
|
|
4
4
|
import {
|
|
5
5
|
derived
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WW6DAGGR.js";
|
|
7
7
|
import {
|
|
8
8
|
stripHtml
|
|
9
9
|
} from "./chunk-L3GAGWCC.js";
|
|
10
10
|
import {
|
|
11
11
|
effect
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MHBCEJQO.js";
|
|
13
13
|
import {
|
|
14
14
|
batch,
|
|
15
15
|
signal
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WZG2SZOT.js";
|
|
17
17
|
|
|
18
18
|
// src/widgets/Combobox.ts
|
|
19
19
|
var comboboxIdCounter = 0;
|
package/dist/data.cjs
CHANGED
|
@@ -66,7 +66,7 @@ function devWarn(message) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
// src/reactivity/track.ts
|
|
69
|
+
// src/reactivity/track-core.ts
|
|
70
70
|
var _isDev2 = isDev();
|
|
71
71
|
var POOL_MAX = 4096;
|
|
72
72
|
var nodePool = [];
|
|
@@ -150,6 +150,7 @@ function unlinkSub(node) {
|
|
|
150
150
|
else sub.depsTail = prev;
|
|
151
151
|
}
|
|
152
152
|
var currentSubscriber = null;
|
|
153
|
+
var suspendSavedSub = null;
|
|
153
154
|
var notifyDepth = 0;
|
|
154
155
|
var pendingQueue = [];
|
|
155
156
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
@@ -161,7 +162,35 @@ function safeInvoke(sub) {
|
|
|
161
162
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
162
163
|
}
|
|
163
164
|
}
|
|
165
|
+
var suspendDepth = 0;
|
|
164
166
|
var trackingSuspended = false;
|
|
167
|
+
function suspendTracking() {
|
|
168
|
+
if (suspendDepth === 0) {
|
|
169
|
+
suspendSavedSub = currentSubscriber;
|
|
170
|
+
currentSubscriber = null;
|
|
171
|
+
trackingSuspended = true;
|
|
172
|
+
}
|
|
173
|
+
suspendDepth++;
|
|
174
|
+
}
|
|
175
|
+
function resumeTracking() {
|
|
176
|
+
suspendDepth--;
|
|
177
|
+
if (suspendDepth === 0) {
|
|
178
|
+
currentSubscriber = suspendSavedSub;
|
|
179
|
+
suspendSavedSub = null;
|
|
180
|
+
trackingSuspended = false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function isTrackingSuspended() {
|
|
184
|
+
return trackingSuspended;
|
|
185
|
+
}
|
|
186
|
+
function untracked(fn) {
|
|
187
|
+
suspendTracking();
|
|
188
|
+
try {
|
|
189
|
+
return fn();
|
|
190
|
+
} finally {
|
|
191
|
+
resumeTracking();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
165
194
|
var subscriberEpochCounter = 0;
|
|
166
195
|
function retrack(effectFn, subscriber) {
|
|
167
196
|
const prev = currentSubscriber;
|
|
@@ -271,6 +300,16 @@ function cleanup(subscriber) {
|
|
|
271
300
|
var maxSubscriberRepeats = 50;
|
|
272
301
|
var maxDrainIterations = 1e6;
|
|
273
302
|
var drainEpoch = 0;
|
|
303
|
+
function setMaxSubscriberRepeats(n) {
|
|
304
|
+
const prev = maxSubscriberRepeats;
|
|
305
|
+
if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
|
|
306
|
+
return prev;
|
|
307
|
+
}
|
|
308
|
+
function setMaxDrainIterations(n) {
|
|
309
|
+
const prev = maxDrainIterations;
|
|
310
|
+
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
311
|
+
return prev;
|
|
312
|
+
}
|
|
274
313
|
function tickRepeat(sub) {
|
|
275
314
|
const s = sub;
|
|
276
315
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -419,6 +458,85 @@ function notifySubscribers(signal2) {
|
|
|
419
458
|
}
|
|
420
459
|
}
|
|
421
460
|
}
|
|
461
|
+
function getSubscriberCount(signal2) {
|
|
462
|
+
return signal2.__sc ?? 0;
|
|
463
|
+
}
|
|
464
|
+
function getSubscriberDeps(subscriber) {
|
|
465
|
+
const sub = subscriber;
|
|
466
|
+
const out = [];
|
|
467
|
+
let node = sub.depsHead ?? null;
|
|
468
|
+
while (node) {
|
|
469
|
+
if (node.sig) out.push(node.sig);
|
|
470
|
+
node = node.subNext;
|
|
471
|
+
}
|
|
472
|
+
return out;
|
|
473
|
+
}
|
|
474
|
+
function forEachSubscriber(signal2, visit) {
|
|
475
|
+
let node = signal2.subsHead ?? null;
|
|
476
|
+
while (node) {
|
|
477
|
+
const s = node.sub;
|
|
478
|
+
if (s) visit(s);
|
|
479
|
+
node = node.sigNext;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/reactivity/track.ts
|
|
484
|
+
var _isDev3 = isDev();
|
|
485
|
+
var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
|
|
486
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
487
|
+
function resolveReactiveApi() {
|
|
488
|
+
const g = globalThis;
|
|
489
|
+
const existing = g[REGISTRY_KEY];
|
|
490
|
+
if (existing) {
|
|
491
|
+
if (_isDev3 && !existing.__dupWarned) {
|
|
492
|
+
existing.__dupWarned = true;
|
|
493
|
+
devWarn(
|
|
494
|
+
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity still works \u2014 all copies share the first one \u2014 but de-duplicate sibujs in your bundler (e.g. Vite optimizeDeps.exclude: ['sibujs'] or resolve.dedupe: ['sibujs']).`
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
return existing;
|
|
498
|
+
}
|
|
499
|
+
const local = {
|
|
500
|
+
suspendTracking,
|
|
501
|
+
resumeTracking,
|
|
502
|
+
isTrackingSuspended,
|
|
503
|
+
untracked,
|
|
504
|
+
retrack,
|
|
505
|
+
track,
|
|
506
|
+
reactiveBinding,
|
|
507
|
+
recordDependency,
|
|
508
|
+
cleanup,
|
|
509
|
+
setMaxSubscriberRepeats,
|
|
510
|
+
setMaxDrainIterations,
|
|
511
|
+
drainNotificationQueue,
|
|
512
|
+
queueSignalNotification,
|
|
513
|
+
notifySubscribers,
|
|
514
|
+
getSubscriberCount,
|
|
515
|
+
getSubscriberDeps,
|
|
516
|
+
forEachSubscriber,
|
|
517
|
+
version: _runtimeVersion
|
|
518
|
+
};
|
|
519
|
+
g[REGISTRY_KEY] = local;
|
|
520
|
+
return local;
|
|
521
|
+
}
|
|
522
|
+
var API = resolveReactiveApi();
|
|
523
|
+
var suspendTracking2 = API.suspendTracking;
|
|
524
|
+
var resumeTracking2 = API.resumeTracking;
|
|
525
|
+
var isTrackingSuspended2 = API.isTrackingSuspended;
|
|
526
|
+
var untracked2 = API.untracked;
|
|
527
|
+
var retrack2 = API.retrack;
|
|
528
|
+
var track2 = API.track;
|
|
529
|
+
var reactiveBinding2 = API.reactiveBinding;
|
|
530
|
+
var recordDependency2 = API.recordDependency;
|
|
531
|
+
var cleanup2 = API.cleanup;
|
|
532
|
+
var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
|
|
533
|
+
var setMaxDrainIterations2 = API.setMaxDrainIterations;
|
|
534
|
+
var drainNotificationQueue2 = API.drainNotificationQueue;
|
|
535
|
+
var queueSignalNotification2 = API.queueSignalNotification;
|
|
536
|
+
var notifySubscribers2 = API.notifySubscribers;
|
|
537
|
+
var getSubscriberCount2 = API.getSubscriberCount;
|
|
538
|
+
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
539
|
+
var forEachSubscriber2 = API.forEachSubscriber;
|
|
422
540
|
|
|
423
541
|
// src/core/signals/derived.ts
|
|
424
542
|
function derived(getter, options) {
|
|
@@ -442,7 +560,7 @@ function derived(getter, options) {
|
|
|
442
560
|
cs._d = false;
|
|
443
561
|
cs._init = true;
|
|
444
562
|
};
|
|
445
|
-
|
|
563
|
+
track2(() => {
|
|
446
564
|
let threw = true;
|
|
447
565
|
try {
|
|
448
566
|
cs._v = getter();
|
|
@@ -461,12 +579,12 @@ function derived(getter, options) {
|
|
|
461
579
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
462
580
|
);
|
|
463
581
|
}
|
|
464
|
-
if (
|
|
582
|
+
if (isTrackingSuspended2()) {
|
|
465
583
|
if (cs._d) {
|
|
466
584
|
const prev = cs._v;
|
|
467
585
|
evaluating = true;
|
|
468
586
|
try {
|
|
469
|
-
|
|
587
|
+
retrack2(recompute, markDirty);
|
|
470
588
|
if (!Object.is(prev, cs._v)) cs.__v++;
|
|
471
589
|
} finally {
|
|
472
590
|
evaluating = false;
|
|
@@ -474,12 +592,12 @@ function derived(getter, options) {
|
|
|
474
592
|
}
|
|
475
593
|
return cs._v;
|
|
476
594
|
}
|
|
477
|
-
|
|
595
|
+
recordDependency2(cs);
|
|
478
596
|
if (cs._d) {
|
|
479
597
|
const oldValue = cs._v;
|
|
480
598
|
evaluating = true;
|
|
481
599
|
try {
|
|
482
|
-
|
|
600
|
+
retrack2(recompute, markDirty);
|
|
483
601
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
484
602
|
} finally {
|
|
485
603
|
evaluating = false;
|
|
@@ -559,7 +677,7 @@ function drainReruns(ctx) {
|
|
|
559
677
|
do {
|
|
560
678
|
ctx.rerunPending = false;
|
|
561
679
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
562
|
-
|
|
680
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
563
681
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
564
682
|
if (ctx.rerunPending) {
|
|
565
683
|
ctx.rerunPending = false;
|
|
@@ -588,7 +706,7 @@ function disposeEffect(ctx) {
|
|
|
588
706
|
}
|
|
589
707
|
}
|
|
590
708
|
try {
|
|
591
|
-
|
|
709
|
+
cleanup2(ctx.subscriber);
|
|
592
710
|
} catch (err) {
|
|
593
711
|
if (typeof console !== "undefined") {
|
|
594
712
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -633,7 +751,7 @@ function effect(effectFn, options) {
|
|
|
633
751
|
try {
|
|
634
752
|
ctx.rerunPending = false;
|
|
635
753
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
636
|
-
|
|
754
|
+
retrack2(ctx.bodyFn, sub);
|
|
637
755
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
638
756
|
} finally {
|
|
639
757
|
ctx.running = false;
|
|
@@ -649,7 +767,7 @@ function effect(effectFn, options) {
|
|
|
649
767
|
ctx.subscriber = sub;
|
|
650
768
|
ctx.running = true;
|
|
651
769
|
try {
|
|
652
|
-
|
|
770
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
653
771
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
654
772
|
} finally {
|
|
655
773
|
ctx.running = false;
|
|
@@ -663,7 +781,7 @@ function effect(effectFn, options) {
|
|
|
663
781
|
// src/reactivity/batch.ts
|
|
664
782
|
var batchDepth = 0;
|
|
665
783
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
666
|
-
function
|
|
784
|
+
function batchImpl(fn) {
|
|
667
785
|
batchDepth++;
|
|
668
786
|
try {
|
|
669
787
|
return fn();
|
|
@@ -674,25 +792,45 @@ function batch(fn) {
|
|
|
674
792
|
}
|
|
675
793
|
}
|
|
676
794
|
}
|
|
677
|
-
function
|
|
795
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
678
796
|
if (batchDepth === 0) return false;
|
|
679
797
|
pendingSignals.add(signal2);
|
|
680
798
|
return true;
|
|
681
799
|
}
|
|
800
|
+
function isBatchingImpl() {
|
|
801
|
+
return batchDepth > 0;
|
|
802
|
+
}
|
|
682
803
|
function flushBatch() {
|
|
683
804
|
try {
|
|
684
805
|
for (const signal2 of pendingSignals) {
|
|
685
|
-
|
|
806
|
+
queueSignalNotification2(signal2);
|
|
686
807
|
}
|
|
687
808
|
} finally {
|
|
688
809
|
pendingSignals.clear();
|
|
689
810
|
}
|
|
690
|
-
|
|
811
|
+
drainNotificationQueue2();
|
|
812
|
+
}
|
|
813
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
814
|
+
function resolveBatchApi() {
|
|
815
|
+
const g = globalThis;
|
|
816
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
817
|
+
if (existing) return existing;
|
|
818
|
+
const local = {
|
|
819
|
+
batch: batchImpl,
|
|
820
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
821
|
+
isBatching: isBatchingImpl
|
|
822
|
+
};
|
|
823
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
824
|
+
return local;
|
|
691
825
|
}
|
|
826
|
+
var API2 = resolveBatchApi();
|
|
827
|
+
var batch = API2.batch;
|
|
828
|
+
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
829
|
+
var isBatching = API2.isBatching;
|
|
692
830
|
|
|
693
831
|
// src/core/signals/signal.ts
|
|
694
832
|
var _g2 = globalThis;
|
|
695
|
-
var
|
|
833
|
+
var _isDev4 = isDev();
|
|
696
834
|
function signal(initial, options) {
|
|
697
835
|
const state = {
|
|
698
836
|
value: initial,
|
|
@@ -703,11 +841,11 @@ function signal(initial, options) {
|
|
|
703
841
|
__activeNode: null,
|
|
704
842
|
__name: void 0
|
|
705
843
|
};
|
|
706
|
-
const debugName =
|
|
844
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
707
845
|
const equalsFn = options?.equals;
|
|
708
846
|
if (debugName) state.__name = debugName;
|
|
709
847
|
function get() {
|
|
710
|
-
|
|
848
|
+
recordDependency2(state);
|
|
711
849
|
return state.value;
|
|
712
850
|
}
|
|
713
851
|
get.__signal = state;
|
|
@@ -720,15 +858,15 @@ function signal(initial, options) {
|
|
|
720
858
|
if (equalsFn(prev, newValue)) return;
|
|
721
859
|
state.value = newValue;
|
|
722
860
|
state.__v++;
|
|
723
|
-
if (
|
|
861
|
+
if (_isDev4) {
|
|
724
862
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
725
863
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
726
864
|
}
|
|
727
865
|
if (!enqueueBatchedSignal(state)) {
|
|
728
|
-
|
|
866
|
+
notifySubscribers2(state);
|
|
729
867
|
}
|
|
730
868
|
};
|
|
731
|
-
} else if (
|
|
869
|
+
} else if (_isDev4) {
|
|
732
870
|
set = (next) => {
|
|
733
871
|
const prev = state.value;
|
|
734
872
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -738,7 +876,7 @@ function signal(initial, options) {
|
|
|
738
876
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
739
877
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
740
878
|
if (!enqueueBatchedSignal(state)) {
|
|
741
|
-
|
|
879
|
+
notifySubscribers2(state);
|
|
742
880
|
}
|
|
743
881
|
};
|
|
744
882
|
} else {
|
|
@@ -749,11 +887,11 @@ function signal(initial, options) {
|
|
|
749
887
|
state.value = newValue;
|
|
750
888
|
state.__v++;
|
|
751
889
|
if (!enqueueBatchedSignal(state)) {
|
|
752
|
-
|
|
890
|
+
notifySubscribers2(state);
|
|
753
891
|
}
|
|
754
892
|
};
|
|
755
893
|
}
|
|
756
|
-
if (
|
|
894
|
+
if (_isDev4) {
|
|
757
895
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
758
896
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
759
897
|
}
|
package/dist/data.js
CHANGED
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
syncAdapter,
|
|
21
21
|
throttle,
|
|
22
22
|
withRetry
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-AMIKDMLP.js";
|
|
24
|
+
import "./chunk-F7FXQ3QS.js";
|
|
25
|
+
import "./chunk-WW6DAGGR.js";
|
|
26
26
|
import "./chunk-L3GAGWCC.js";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-MHBCEJQO.js";
|
|
28
28
|
import "./chunk-GOJMFRBL.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-WZG2SZOT.js";
|
|
30
|
+
import "./chunk-TEFZT5PJ.js";
|
|
31
31
|
import "./chunk-COY6PUD2.js";
|
|
32
32
|
export {
|
|
33
33
|
__resetQueryCache,
|