sibujs 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +4 -3
- package/dist/build.cjs +11 -3
- package/dist/build.js +10 -9
- package/dist/cdn.global.js +4 -4
- package/dist/chunk-24WSRM54.js +2002 -0
- package/dist/chunk-3CRQALYP.js +877 -0
- package/dist/chunk-6HLLIF3K.js +398 -0
- package/dist/chunk-7TQKR4PP.js +294 -0
- package/dist/chunk-CZUGLNJS.js +37 -0
- package/dist/chunk-DTCOOBMX.js +725 -0
- package/dist/chunk-FGOEVHY3.js +60 -0
- package/dist/chunk-HGMJFBC7.js +654 -0
- package/dist/chunk-HS6OOE3Q.js +365 -0
- package/dist/chunk-L36YN45V.js +949 -0
- package/dist/chunk-MJ4LVHGX.js +712 -0
- package/dist/chunk-N6IZB6KJ.js +567 -0
- package/dist/chunk-NMRUZALC.js +1097 -0
- package/dist/chunk-OHQQWZ7P.js +969 -0
- package/dist/chunk-ONCYDOK6.js +466 -0
- package/dist/chunk-OWLQ4HZI.js +282 -0
- package/dist/chunk-PZEGYCF5.js +61 -0
- package/dist/chunk-QVKGGB2S.js +300 -0
- package/dist/chunk-SDLZDHKP.js +107 -0
- package/dist/chunk-Y6GP4QGG.js +276 -0
- package/dist/chunk-YECR7UIA.js +347 -0
- package/dist/chunk-Z65KYU7I.js +26 -0
- package/dist/data.cjs +24 -4
- package/dist/data.js +6 -5
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.js +4 -3
- package/dist/ecosystem.cjs +9 -2
- package/dist/ecosystem.js +7 -6
- package/dist/extras.cjs +68 -24
- package/dist/extras.js +21 -20
- package/dist/index.cjs +11 -3
- package/dist/index.js +10 -9
- package/dist/motion.js +3 -2
- package/dist/patterns.cjs +7 -2
- package/dist/patterns.d.cts +15 -0
- package/dist/patterns.d.ts +15 -0
- package/dist/patterns.js +5 -4
- package/dist/performance.js +3 -2
- package/dist/plugins.cjs +65 -29
- package/dist/plugins.js +9 -8
- package/dist/ssr-WKUPVSSK.js +36 -0
- package/dist/ssr.cjs +60 -41
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +8 -7
- package/dist/ui.js +6 -5
- package/dist/widgets.js +5 -4
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isSSR
|
|
3
|
+
} from "./chunk-CHJ27IGK.js";
|
|
4
|
+
import {
|
|
5
|
+
track
|
|
6
|
+
} from "./chunk-YECR7UIA.js";
|
|
7
|
+
import {
|
|
8
|
+
devAssert
|
|
9
|
+
} from "./chunk-4MYMUBRS.js";
|
|
10
|
+
|
|
11
|
+
// src/core/signals/watch.ts
|
|
12
|
+
function watch(getter, callback) {
|
|
13
|
+
devAssert(typeof getter === "function", "watch: first argument must be a getter function.");
|
|
14
|
+
devAssert(typeof callback === "function", "watch: second argument must be a callback function.");
|
|
15
|
+
if (isSSR()) return () => {
|
|
16
|
+
};
|
|
17
|
+
let oldValue;
|
|
18
|
+
let first = true;
|
|
19
|
+
const subscriber = () => {
|
|
20
|
+
const newValue = getter();
|
|
21
|
+
if (first) {
|
|
22
|
+
oldValue = newValue;
|
|
23
|
+
first = false;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!Object.is(newValue, oldValue)) {
|
|
27
|
+
callback(newValue, oldValue);
|
|
28
|
+
oldValue = newValue;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const teardown = track(subscriber);
|
|
32
|
+
return teardown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
watch
|
|
37
|
+
};
|