sibujs 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/browser.cjs +31 -2
- package/dist/browser.d.cts +15 -2
- package/dist/browser.d.ts +15 -2
- package/dist/browser.js +4 -4
- package/dist/build.cjs +92 -13
- package/dist/build.js +10 -10
- package/dist/cdn.dev.global.js +9 -9
- package/dist/cdn.full.dev.global.js +10 -10
- package/dist/cdn.full.global.js +9 -9
- package/dist/cdn.global.js +9 -9
- package/dist/{chunk-XLO7SLIX.js → chunk-2DCGACUU.js} +16 -9
- package/dist/{chunk-6GSIXTWX.js → chunk-3JZ4L5TJ.js} +10 -4
- package/dist/{chunk-UCALUKB5.js → chunk-4PMLNECI.js} +4 -4
- package/dist/{chunk-RR7M3FHM.js → chunk-7LN645I6.js} +1 -1
- package/dist/{chunk-SKPTERHP.js → chunk-B3WHI2QA.js} +1 -1
- package/dist/{chunk-4Z3SPQ67.js → chunk-FTIR4QW2.js} +13 -3
- package/dist/{chunk-HFCOH2GN.js → chunk-GW3SCCZG.js} +4 -4
- package/dist/{chunk-PNIRUQ4C.js → chunk-KEISJXBU.js} +2 -2
- package/dist/{chunk-LYVUX7NT.js → chunk-OMJJM3KM.js} +2 -2
- package/dist/{chunk-VCTAEPSB.js → chunk-ONOHFDLG.js} +9 -1
- package/dist/{chunk-36S2YPP4.js → chunk-PCT43HW3.js} +1 -1
- package/dist/{chunk-W2EQ7X2L.js → chunk-RBTPLM32.js} +46 -8
- package/dist/{chunk-7GIHSAWB.js → chunk-RIXRAYIU.js} +1 -1
- package/dist/{chunk-HQSEH5F6.js → chunk-RJE2BNI4.js} +3 -3
- package/dist/{chunk-ADM46X22.js → chunk-S373NSMK.js} +18 -13
- package/dist/{chunk-M2F7TZHH.js → chunk-TBYTO6BS.js} +2 -2
- package/dist/{chunk-3BTTCZ5J.js → chunk-UGRX3S57.js} +31 -2
- package/dist/{chunk-7NBDXVHS.js → chunk-VUF4ALSW.js} +1 -1
- package/dist/{chunk-LQFGQNMV.js → chunk-VZKNK2V7.js} +9 -4
- package/dist/{chunk-NVNJH22U.js → chunk-XZZOBQAY.js} +1 -1
- package/dist/{customElement-CNZxEB9G.d.ts → customElement-OB9CIsc5.d.cts} +38 -10
- package/dist/{customElement-CNZxEB9G.d.cts → customElement-OB9CIsc5.d.ts} +38 -10
- package/dist/data.cjs +81 -9
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +41 -2
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +83 -9
- package/dist/ecosystem.d.cts +13 -5
- package/dist/ecosystem.d.ts +13 -5
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +115 -14
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +19 -19
- package/dist/index.cjs +92 -13
- package/dist/index.d.cts +24 -151
- package/dist/index.d.ts +24 -151
- package/dist/index.js +10 -10
- package/dist/motion.cjs +31 -2
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +81 -10
- package/dist/patterns.d.cts +5 -0
- package/dist/patterns.d.ts +5 -0
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +31 -2
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +39 -2
- package/dist/plugins.js +6 -6
- package/dist/ssr.cjs +39 -2
- package/dist/ssr.js +7 -7
- package/dist/tagFactory-DVoDpHye.d.cts +215 -0
- package/dist/tagFactory-DVoDpHye.d.ts +215 -0
- package/dist/testing.cjs +31 -2
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +93 -13
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +6 -6
- package/dist/widgets.cjs +75 -9
- package/dist/widgets.js +6 -6
- package/package.json +2 -2
- package/dist/tagFactory-Bzupt4Pj.d.cts +0 -55
- package/dist/tagFactory-Bzupt4Pj.d.ts +0 -55
package/README.md
CHANGED
|
@@ -164,6 +164,17 @@ Import advanced features from focused entry points for optimal tree-shaking. `si
|
|
|
164
164
|
### `sibujs/browser` — Reactive browser APIs
|
|
165
165
|
Reactive wrappers for `media` queries, `resize`, `scroll`, `online`/`network`, `geo`, `battery`, `idle`, `permissions`, `clipboard`, `dragDrop`, `title`/`favicon`, `colorScheme`, `visibility`, `mouse`/`swipe`, `windowSize`, `urlState`, `broadcast`, `fullscreen`, `wakeLock`, `animationFrame`, `mutationObserver`, `bounds`, `keyboard`, `speech`, `gamepad`, `pointerLock`, `vibrate`, `textSelection`, `imageLoader`, and `format`.
|
|
166
166
|
|
|
167
|
+
`media()` returns `{ matches, dispose }`, not a bare `() => boolean`. Its `matchMedia` listener stays attached until `dispose()` is called, so release it when the owner goes away:
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import { media } from "sibujs/browser";
|
|
171
|
+
|
|
172
|
+
const { matches: small, dispose } = media("(max-width: 640px)");
|
|
173
|
+
|
|
174
|
+
small(); // reactive boolean
|
|
175
|
+
dispose(); // remove the matchMedia listener
|
|
176
|
+
```
|
|
177
|
+
|
|
167
178
|
### `sibujs/ui` — UI utilities
|
|
168
179
|
`form` & `formAction` (validation/binding), `virtualList`, `intersection`, `inputMask`, `a11y` / `a11yPrimitives`, `scopedStyle`, `reactiveAttr`, `dialog`, `toast`, `infiniteScroll`, `pagination`, `eventBus`, `timers`, `hover`, `scrollLock`, `lazyEffect`, plus composable/HOC patterns.
|
|
169
180
|
|
package/dist/browser.cjs
CHANGED
|
@@ -310,6 +310,15 @@ function untracked(fn) {
|
|
|
310
310
|
var subscriberEpochCounter = 0;
|
|
311
311
|
function retrack(effectFn, subscriber) {
|
|
312
312
|
const prev = currentSubscriber;
|
|
313
|
+
let savedDepth = 0;
|
|
314
|
+
let savedSuspendSub = null;
|
|
315
|
+
if (trackingSuspended) {
|
|
316
|
+
savedDepth = suspendDepth;
|
|
317
|
+
savedSuspendSub = suspendSavedSub;
|
|
318
|
+
suspendDepth = 0;
|
|
319
|
+
suspendSavedSub = null;
|
|
320
|
+
trackingSuspended = false;
|
|
321
|
+
}
|
|
313
322
|
currentSubscriber = subscriber;
|
|
314
323
|
const sub = subscriber;
|
|
315
324
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -324,6 +333,11 @@ function retrack(effectFn, subscriber) {
|
|
|
324
333
|
effectFn();
|
|
325
334
|
} finally {
|
|
326
335
|
currentSubscriber = prev;
|
|
336
|
+
if (savedDepth !== 0) {
|
|
337
|
+
suspendDepth = savedDepth;
|
|
338
|
+
suspendSavedSub = savedSuspendSub;
|
|
339
|
+
trackingSuspended = true;
|
|
340
|
+
}
|
|
327
341
|
let node = sub.depsHead ?? null;
|
|
328
342
|
while (node !== null) {
|
|
329
343
|
const next = node.subNext;
|
|
@@ -343,11 +357,25 @@ function track(effectFn, subscriber) {
|
|
|
343
357
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
344
358
|
cleanup(subscriber);
|
|
345
359
|
const prev = currentSubscriber;
|
|
360
|
+
let savedDepth = 0;
|
|
361
|
+
let savedSuspendSub = null;
|
|
362
|
+
if (trackingSuspended) {
|
|
363
|
+
savedDepth = suspendDepth;
|
|
364
|
+
savedSuspendSub = suspendSavedSub;
|
|
365
|
+
suspendDepth = 0;
|
|
366
|
+
suspendSavedSub = null;
|
|
367
|
+
trackingSuspended = false;
|
|
368
|
+
}
|
|
346
369
|
currentSubscriber = subscriber;
|
|
347
370
|
try {
|
|
348
371
|
effectFn();
|
|
349
372
|
} finally {
|
|
350
373
|
currentSubscriber = prev;
|
|
374
|
+
if (savedDepth !== 0) {
|
|
375
|
+
suspendDepth = savedDepth;
|
|
376
|
+
suspendSavedSub = savedSuspendSub;
|
|
377
|
+
trackingSuspended = true;
|
|
378
|
+
}
|
|
351
379
|
const sub2 = subscriber;
|
|
352
380
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
353
381
|
const sig = n.sig;
|
|
@@ -518,8 +546,9 @@ function propagateDirty(sub) {
|
|
|
518
546
|
if (s._c) {
|
|
519
547
|
const nSig = s._sig;
|
|
520
548
|
if (nSig) {
|
|
521
|
-
if (!nSig._d) {
|
|
549
|
+
if (!nSig._d || nSig._f === true) {
|
|
522
550
|
nSig._d = true;
|
|
551
|
+
nSig._f = false;
|
|
523
552
|
stack.push(nSig);
|
|
524
553
|
}
|
|
525
554
|
} else {
|
|
@@ -619,7 +648,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
619
648
|
}
|
|
620
649
|
|
|
621
650
|
// src/reactivity/track.ts
|
|
622
|
-
var _runtimeVersion = true ? "4.
|
|
651
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
623
652
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
624
653
|
function resolveReactiveApi() {
|
|
625
654
|
const g = globalThis;
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* media
|
|
2
|
+
* media tracks whether a CSS media query matches.
|
|
3
3
|
* Uses `window.matchMedia` and listens to `change` events for live updates.
|
|
4
4
|
*
|
|
5
|
+
* It returns an object, not a bare `() => boolean`. The `change` listener stays
|
|
6
|
+
* attached until `dispose()` is called, so a query created by a component must
|
|
7
|
+
* be released with it (e.g. `onUnmount(dispose, el)`). After disposal `matches()`
|
|
8
|
+
* keeps returning its last value.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const { matches: small, dispose } = media("(max-width: 640px)");
|
|
13
|
+
*
|
|
14
|
+
* small();
|
|
15
|
+
* dispose();
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
5
18
|
* @param query CSS media query string (e.g. "(max-width: 768px)")
|
|
6
|
-
* @returns
|
|
19
|
+
* @returns `{ matches, dispose }` — a reactive getter and the listener release
|
|
7
20
|
*/
|
|
8
21
|
declare function media(query: string): {
|
|
9
22
|
matches: () => boolean;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* media
|
|
2
|
+
* media tracks whether a CSS media query matches.
|
|
3
3
|
* Uses `window.matchMedia` and listens to `change` events for live updates.
|
|
4
4
|
*
|
|
5
|
+
* It returns an object, not a bare `() => boolean`. The `change` listener stays
|
|
6
|
+
* attached until `dispose()` is called, so a query created by a component must
|
|
7
|
+
* be released with it (e.g. `onUnmount(dispose, el)`). After disposal `matches()`
|
|
8
|
+
* keeps returning its last value.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const { matches: small, dispose } = media("(max-width: 640px)");
|
|
13
|
+
*
|
|
14
|
+
* small();
|
|
15
|
+
* dispose();
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
5
18
|
* @param query CSS media query string (e.g. "(max-width: 768px)")
|
|
6
|
-
* @returns
|
|
19
|
+
* @returns `{ matches, dispose }` — a reactive getter and the listener release
|
|
7
20
|
*/
|
|
8
21
|
declare function media(query: string): {
|
|
9
22
|
matches: () => boolean;
|
package/dist/browser.js
CHANGED
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
visibility,
|
|
36
36
|
wakeLock,
|
|
37
37
|
windowSize
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-OMJJM3KM.js";
|
|
39
39
|
import "./chunk-H3SRKIYX.js";
|
|
40
40
|
import "./chunk-52XFPGSN.js";
|
|
41
41
|
import "./chunk-7ZHH77QA.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-RIXRAYIU.js";
|
|
43
43
|
import "./chunk-5DXA2J44.js";
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-XZZOBQAY.js";
|
|
45
|
+
import "./chunk-UGRX3S57.js";
|
|
46
46
|
import "./chunk-2WLZ6757.js";
|
|
47
47
|
export {
|
|
48
48
|
animationFrame,
|
package/dist/build.cjs
CHANGED
|
@@ -1765,6 +1765,14 @@ function setSafeAttribute(el, name, value, options = {}) {
|
|
|
1765
1765
|
const html3 = isHtmlElement(el);
|
|
1766
1766
|
const idlName = html3 ? name.toLowerCase() : name;
|
|
1767
1767
|
if (typeof value === "boolean") {
|
|
1768
|
+
if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
|
|
1769
|
+
const token = value ? "true" : "false";
|
|
1770
|
+
if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
|
|
1771
|
+
if (ns) el.setAttributeNS(ns, name, token);
|
|
1772
|
+
else el.setAttribute(name, token);
|
|
1773
|
+
}
|
|
1774
|
+
return true;
|
|
1775
|
+
}
|
|
1768
1776
|
if (html3 && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
|
|
1769
1777
|
setProp(el, idlName, value);
|
|
1770
1778
|
} else if (value) {
|
|
@@ -1937,6 +1945,15 @@ function untracked(fn) {
|
|
|
1937
1945
|
var subscriberEpochCounter = 0;
|
|
1938
1946
|
function retrack(effectFn, subscriber) {
|
|
1939
1947
|
const prev = currentSubscriber;
|
|
1948
|
+
let savedDepth = 0;
|
|
1949
|
+
let savedSuspendSub = null;
|
|
1950
|
+
if (trackingSuspended) {
|
|
1951
|
+
savedDepth = suspendDepth;
|
|
1952
|
+
savedSuspendSub = suspendSavedSub;
|
|
1953
|
+
suspendDepth = 0;
|
|
1954
|
+
suspendSavedSub = null;
|
|
1955
|
+
trackingSuspended = false;
|
|
1956
|
+
}
|
|
1940
1957
|
currentSubscriber = subscriber;
|
|
1941
1958
|
const sub2 = subscriber;
|
|
1942
1959
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -1951,6 +1968,11 @@ function retrack(effectFn, subscriber) {
|
|
|
1951
1968
|
effectFn();
|
|
1952
1969
|
} finally {
|
|
1953
1970
|
currentSubscriber = prev;
|
|
1971
|
+
if (savedDepth !== 0) {
|
|
1972
|
+
suspendDepth = savedDepth;
|
|
1973
|
+
suspendSavedSub = savedSuspendSub;
|
|
1974
|
+
trackingSuspended = true;
|
|
1975
|
+
}
|
|
1954
1976
|
let node = sub2.depsHead ?? null;
|
|
1955
1977
|
while (node !== null) {
|
|
1956
1978
|
const next = node.subNext;
|
|
@@ -1970,11 +1992,25 @@ function track(effectFn, subscriber) {
|
|
|
1970
1992
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
1971
1993
|
cleanup(subscriber);
|
|
1972
1994
|
const prev = currentSubscriber;
|
|
1995
|
+
let savedDepth = 0;
|
|
1996
|
+
let savedSuspendSub = null;
|
|
1997
|
+
if (trackingSuspended) {
|
|
1998
|
+
savedDepth = suspendDepth;
|
|
1999
|
+
savedSuspendSub = suspendSavedSub;
|
|
2000
|
+
suspendDepth = 0;
|
|
2001
|
+
suspendSavedSub = null;
|
|
2002
|
+
trackingSuspended = false;
|
|
2003
|
+
}
|
|
1973
2004
|
currentSubscriber = subscriber;
|
|
1974
2005
|
try {
|
|
1975
2006
|
effectFn();
|
|
1976
2007
|
} finally {
|
|
1977
2008
|
currentSubscriber = prev;
|
|
2009
|
+
if (savedDepth !== 0) {
|
|
2010
|
+
suspendDepth = savedDepth;
|
|
2011
|
+
suspendSavedSub = savedSuspendSub;
|
|
2012
|
+
trackingSuspended = true;
|
|
2013
|
+
}
|
|
1978
2014
|
const sub3 = subscriber;
|
|
1979
2015
|
for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
|
|
1980
2016
|
const sig = n.sig;
|
|
@@ -2145,8 +2181,9 @@ function propagateDirty(sub2) {
|
|
|
2145
2181
|
if (s2._c) {
|
|
2146
2182
|
const nSig = s2._sig;
|
|
2147
2183
|
if (nSig) {
|
|
2148
|
-
if (!nSig._d) {
|
|
2184
|
+
if (!nSig._d || nSig._f === true) {
|
|
2149
2185
|
nSig._d = true;
|
|
2186
|
+
nSig._f = false;
|
|
2150
2187
|
stack.push(nSig);
|
|
2151
2188
|
}
|
|
2152
2189
|
} else {
|
|
@@ -2246,7 +2283,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
2246
2283
|
}
|
|
2247
2284
|
|
|
2248
2285
|
// src/reactivity/track.ts
|
|
2249
|
-
var _runtimeVersion = true ? "4.
|
|
2286
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
2250
2287
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
2251
2288
|
function resolveReactiveApi() {
|
|
2252
2289
|
const g2 = globalThis;
|
|
@@ -4648,7 +4685,7 @@ function show(condition, element) {
|
|
|
4648
4685
|
const update = () => {
|
|
4649
4686
|
resolved.style.display = condition() ? "" : "none";
|
|
4650
4687
|
};
|
|
4651
|
-
registerDisposer(resolved,
|
|
4688
|
+
registerDisposer(resolved, reactiveBinding2(update, resolved));
|
|
4652
4689
|
return resolved;
|
|
4653
4690
|
}
|
|
4654
4691
|
function attachBranch(parent, anchor, branch, attachedOnce, where) {
|
|
@@ -4693,7 +4730,7 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
4693
4730
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
|
|
4694
4731
|
initialized = true;
|
|
4695
4732
|
};
|
|
4696
|
-
registerDisposer(anchor,
|
|
4733
|
+
registerDisposer(anchor, reactiveBinding2(update, anchor));
|
|
4697
4734
|
if (!initialized) {
|
|
4698
4735
|
queueMicrotask(() => {
|
|
4699
4736
|
if (!initialized && anchor.parentNode) update();
|
|
@@ -4727,7 +4764,7 @@ function match(value, cases, fallback) {
|
|
|
4727
4764
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
|
|
4728
4765
|
initialized = true;
|
|
4729
4766
|
};
|
|
4730
|
-
registerDisposer(anchor,
|
|
4767
|
+
registerDisposer(anchor, reactiveBinding2(update, anchor));
|
|
4731
4768
|
if (!initialized) {
|
|
4732
4769
|
queueMicrotask(() => {
|
|
4733
4770
|
if (!initialized && anchor.parentNode) update();
|
|
@@ -4882,7 +4919,12 @@ function each(getArray, render, options) {
|
|
|
4882
4919
|
const [indexGetter, setIndex] = signal(i2);
|
|
4883
4920
|
let node;
|
|
4884
4921
|
try {
|
|
4885
|
-
|
|
4922
|
+
suspendTracking2();
|
|
4923
|
+
try {
|
|
4924
|
+
node = resolveNodeChild(render(itemGetter, indexGetter));
|
|
4925
|
+
} finally {
|
|
4926
|
+
resumeTracking2();
|
|
4927
|
+
}
|
|
4886
4928
|
} catch (err) {
|
|
4887
4929
|
const key2 = newKeys[i2];
|
|
4888
4930
|
node = document.createComment(`each:error:${i2}`);
|
|
@@ -5925,10 +5967,14 @@ function derived(getter, options) {
|
|
|
5925
5967
|
const cs = {};
|
|
5926
5968
|
cs._d = false;
|
|
5927
5969
|
cs._init = false;
|
|
5970
|
+
cs._f = false;
|
|
5928
5971
|
cs._g = getter;
|
|
5929
5972
|
cs.__v = 0;
|
|
5973
|
+
let evaluating = false;
|
|
5974
|
+
let disposed = false;
|
|
5975
|
+
let pendingError;
|
|
5930
5976
|
const markDirty = () => {
|
|
5931
|
-
if (cs._d) return;
|
|
5977
|
+
if (cs._d || disposed) return;
|
|
5932
5978
|
cs._d = true;
|
|
5933
5979
|
};
|
|
5934
5980
|
markDirty._c = 1;
|
|
@@ -5951,33 +5997,53 @@ function derived(getter, options) {
|
|
|
5951
5997
|
}
|
|
5952
5998
|
}, markDirty);
|
|
5953
5999
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
5954
|
-
let evaluating = false;
|
|
5955
6000
|
const validate = () => {
|
|
5956
|
-
if (!cs._d) return;
|
|
6001
|
+
if (!cs._d || disposed || pendingError !== void 0) return;
|
|
5957
6002
|
const oldValue = cs._v;
|
|
5958
6003
|
evaluating = true;
|
|
5959
6004
|
try {
|
|
5960
6005
|
retrack2(recompute, markDirty);
|
|
5961
6006
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
6007
|
+
} catch (err) {
|
|
6008
|
+
pendingError = { error: err };
|
|
6009
|
+
cs.__v++;
|
|
6010
|
+
if (disposed) cs._d = true;
|
|
6011
|
+
else cs._f = true;
|
|
5962
6012
|
} finally {
|
|
5963
6013
|
evaluating = false;
|
|
6014
|
+
if (disposed) cleanup2(markDirty);
|
|
5964
6015
|
}
|
|
5965
|
-
if (hook && !Object.is(oldValue, cs._v)) {
|
|
6016
|
+
if (hook && !disposed && !Object.is(oldValue, cs._v)) {
|
|
5966
6017
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
5967
6018
|
}
|
|
5968
6019
|
};
|
|
5969
6020
|
cs._validate = validate;
|
|
6021
|
+
const throwPending = () => {
|
|
6022
|
+
const { error } = pendingError;
|
|
6023
|
+
pendingError = void 0;
|
|
6024
|
+
if (disposed) cs._d = false;
|
|
6025
|
+
throw error;
|
|
6026
|
+
};
|
|
5970
6027
|
function computedGetter() {
|
|
5971
6028
|
if (evaluating) {
|
|
5972
6029
|
throw new Error(
|
|
5973
6030
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
5974
6031
|
);
|
|
5975
6032
|
}
|
|
5976
|
-
if (isTrackingSuspended2()) {
|
|
5977
|
-
if (cs._d)
|
|
6033
|
+
if (isTrackingSuspended2() || disposed) {
|
|
6034
|
+
if (cs._d) {
|
|
6035
|
+
validate();
|
|
6036
|
+
if (pendingError !== void 0) throwPending();
|
|
6037
|
+
}
|
|
5978
6038
|
return cs._v;
|
|
5979
6039
|
}
|
|
5980
|
-
if (cs._d)
|
|
6040
|
+
if (cs._d) {
|
|
6041
|
+
validate();
|
|
6042
|
+
if (pendingError !== void 0) {
|
|
6043
|
+
recordDependency2(cs);
|
|
6044
|
+
throwPending();
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
5981
6047
|
recordDependency2(cs);
|
|
5982
6048
|
return cs._v;
|
|
5983
6049
|
}
|
|
@@ -5986,6 +6052,19 @@ function derived(getter, options) {
|
|
|
5986
6052
|
cs.__name = debugName;
|
|
5987
6053
|
}
|
|
5988
6054
|
computedGetter.__signal = cs;
|
|
6055
|
+
computedGetter.dispose = () => {
|
|
6056
|
+
if (disposed) return;
|
|
6057
|
+
disposed = true;
|
|
6058
|
+
cs._d = pendingError !== void 0;
|
|
6059
|
+
cleanup2(markDirty);
|
|
6060
|
+
const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
6061
|
+
if (h) {
|
|
6062
|
+
try {
|
|
6063
|
+
h.emit("computed:destroy", { signal: cs, getter: computedGetter });
|
|
6064
|
+
} catch {
|
|
6065
|
+
}
|
|
6066
|
+
}
|
|
6067
|
+
};
|
|
5989
6068
|
if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
|
|
5990
6069
|
return computedGetter;
|
|
5991
6070
|
}
|
package/dist/build.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
index_exports
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-S373NSMK.js";
|
|
4
|
+
import "./chunk-PCT43HW3.js";
|
|
5
5
|
import "./chunk-NIOYEGBQ.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-7LN645I6.js";
|
|
7
7
|
import "./chunk-CCSJMTRN.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-VUF4ALSW.js";
|
|
9
|
+
import "./chunk-KEISJXBU.js";
|
|
10
|
+
import "./chunk-ONOHFDLG.js";
|
|
11
|
+
import "./chunk-RBTPLM32.js";
|
|
12
12
|
import "./chunk-IXKSNWV5.js";
|
|
13
13
|
import "./chunk-7ZHH77QA.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-RIXRAYIU.js";
|
|
15
15
|
import "./chunk-5DXA2J44.js";
|
|
16
16
|
import "./chunk-QKRPLZ2V.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-XZZOBQAY.js";
|
|
18
|
+
import "./chunk-UGRX3S57.js";
|
|
19
19
|
import "./chunk-2WLZ6757.js";
|
|
20
20
|
|
|
21
21
|
// src/build/compileTemplates.ts
|