sibujs 4.1.0 → 4.2.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 +24 -0
- package/dist/browser.cjs +13 -21
- package/dist/browser.js +6 -6
- package/dist/build.cjs +278 -104
- package/dist/build.js +15 -15
- package/dist/cdn.dev.global.js +398 -0
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-DCDS2PQ6.js → chunk-2LOYNGBY.js} +2 -2
- package/dist/{chunk-VPP2FONR.js → chunk-2WLZ6757.js} +17 -10
- package/dist/{chunk-IM7N5WR4.js → chunk-3VTSPNC5.js} +2 -2
- package/dist/{chunk-TIRZCERI.js → chunk-5DXA2J44.js} +1 -1
- package/dist/{chunk-I3VI34DP.js → chunk-6ZGI3RBE.js} +149 -33
- package/dist/{chunk-D3SZ4LVS.js → chunk-7ALC7KGE.js} +5 -6
- package/dist/{chunk-PFTDGEPZ.js → chunk-7VEC3UD2.js} +3 -3
- package/dist/{chunk-KSOEJGFO.js → chunk-BMYYZWHX.js} +3 -3
- package/dist/{chunk-LOFZHP6V.js → chunk-BNKV4REK.js} +7 -8
- package/dist/{chunk-5GJ5RTHA.js → chunk-FOWBJZDL.js} +7 -8
- package/dist/{chunk-FB7KQXZI.js → chunk-GDUNQCCW.js} +4 -4
- package/dist/{chunk-UFSQEO7P.js → chunk-HECVW343.js} +7 -8
- package/dist/{chunk-SHDVWATN.js → chunk-HJEPKZ2O.js} +7 -8
- package/dist/{chunk-ANGSYNPX.js → chunk-HZEBO22J.js} +57 -37
- package/dist/{chunk-5INI7D2L.js → chunk-IXKSNWV5.js} +74 -11
- package/dist/{chunk-DAKLOMKS.js → chunk-KE4KWRDY.js} +3 -3
- package/dist/{chunk-AW6HPJ3L.js → chunk-KKLW7YWL.js} +1 -1
- package/dist/{chunk-BMSN6NWQ.js → chunk-NEYWS4EX.js} +6 -6
- package/dist/{chunk-HYCCIYNS.js → chunk-NIOYEGBQ.js} +13 -14
- package/dist/{chunk-4U7KD3RY.js → chunk-OUWAIXIK.js} +3 -3
- package/dist/{chunk-MRAMKDHQ.js → chunk-P3DHXBR6.js} +1 -1
- package/dist/{chunk-FMHIQNMP.js → chunk-QCFLDD7C.js} +5 -5
- package/dist/{chunk-DHDZ7IVN.js → chunk-QKRPLZ2V.js} +7 -8
- package/dist/{chunk-4RH6D7GR.js → chunk-QL4UREZO.js} +6 -6
- package/dist/{chunk-XIHMS2Y6.js → chunk-SF3TB4K6.js} +8 -8
- package/dist/{chunk-XSZRJW76.js → chunk-XZ2N525U.js} +6 -6
- package/dist/{customElement-CKLoO63w.d.ts → customElement-CNZxEB9G.d.cts} +77 -0
- package/dist/{customElement-CKLoO63w.d.cts → customElement-CNZxEB9G.d.ts} +77 -0
- package/dist/data.cjs +15 -24
- package/dist/data.js +9 -9
- package/dist/devtools.cjs +18 -22
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +8 -8
- package/dist/{dispose-4FZ6OFXR.js → dispose-46BOMMQJ.js} +2 -2
- package/dist/ecosystem.cjs +222 -67
- package/dist/ecosystem.js +11 -11
- package/dist/extras.cjs +243 -86
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +25 -25
- package/dist/index.cjs +272 -98
- package/dist/index.d.cts +154 -33
- package/dist/index.d.ts +154 -33
- package/dist/index.js +15 -15
- package/dist/{introspect-RjLfIFpL.d.cts → introspect-D5xF-0Es.d.cts} +7 -0
- package/dist/{introspect-DOZfmC-4.d.ts → introspect-rSBIxEQi.d.ts} +7 -0
- package/dist/motion.cjs +13 -22
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +16 -24
- package/dist/patterns.d.cts +8 -0
- package/dist/patterns.d.ts +8 -0
- package/dist/patterns.js +7 -7
- package/dist/performance.cjs +16 -27
- package/dist/performance.js +9 -9
- package/dist/plugins.cjs +260 -86
- package/dist/plugins.d.cts +92 -0
- package/dist/plugins.d.ts +92 -0
- package/dist/plugins.js +18 -17
- package/dist/{ssr-JFP5535P.js → ssr-Y7XOEPEN.js} +5 -5
- package/dist/ssr.cjs +233 -79
- package/dist/ssr.js +12 -12
- package/dist/testing.cjs +11 -19
- package/dist/testing.js +5 -5
- package/dist/ui.cjs +98 -43
- package/dist/ui.d.cts +7 -1
- package/dist/ui.d.ts +7 -1
- package/dist/ui.js +10 -10
- package/dist/widgets.cjs +13 -21
- package/dist/widgets.d.cts +8 -0
- package/dist/widgets.d.ts +8 -0
- package/dist/widgets.js +9 -9
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
unregisterIsland,
|
|
53
53
|
when,
|
|
54
54
|
writable
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-HZEBO22J.js";
|
|
56
56
|
import {
|
|
57
57
|
a,
|
|
58
58
|
abbr,
|
|
@@ -190,36 +190,36 @@ import {
|
|
|
190
190
|
use,
|
|
191
191
|
var_,
|
|
192
192
|
video
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-P3DHXBR6.js";
|
|
194
194
|
import {
|
|
195
195
|
trustHTML
|
|
196
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-NIOYEGBQ.js";
|
|
197
197
|
import {
|
|
198
198
|
watch
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-BMYYZWHX.js";
|
|
200
200
|
import {
|
|
201
201
|
__resetIdCounter,
|
|
202
202
|
createId
|
|
203
203
|
} from "./chunk-CCSJMTRN.js";
|
|
204
204
|
import {
|
|
205
205
|
context
|
|
206
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-FOWBJZDL.js";
|
|
207
207
|
import {
|
|
208
208
|
SVG_NS,
|
|
209
209
|
tagFactory
|
|
210
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-6ZGI3RBE.js";
|
|
211
211
|
import {
|
|
212
212
|
bindDynamic
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-HJEPKZ2O.js";
|
|
214
214
|
import {
|
|
215
215
|
derived
|
|
216
|
-
} from "./chunk-
|
|
217
|
-
import "./chunk-
|
|
216
|
+
} from "./chunk-2LOYNGBY.js";
|
|
217
|
+
import "./chunk-IXKSNWV5.js";
|
|
218
218
|
import "./chunk-7ZHH77QA.js";
|
|
219
219
|
import {
|
|
220
220
|
effect,
|
|
221
221
|
on
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-7VEC3UD2.js";
|
|
223
223
|
import {
|
|
224
224
|
disableSSR,
|
|
225
225
|
enableSSR,
|
|
@@ -228,7 +228,7 @@ import {
|
|
|
228
228
|
isSSR,
|
|
229
229
|
runInSSRContext,
|
|
230
230
|
withSSR
|
|
231
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-5DXA2J44.js";
|
|
232
232
|
import {
|
|
233
233
|
MAX_DRAIN_TEARDOWNS,
|
|
234
234
|
checkLeaks,
|
|
@@ -237,24 +237,24 @@ import {
|
|
|
237
237
|
replaceChildrenSafely,
|
|
238
238
|
reportDrainRunaway,
|
|
239
239
|
unregisterDisposer
|
|
240
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-QKRPLZ2V.js";
|
|
241
241
|
import {
|
|
242
242
|
batch,
|
|
243
243
|
enqueueBatchedSignal,
|
|
244
244
|
external,
|
|
245
245
|
isBatching,
|
|
246
246
|
signal
|
|
247
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-HECVW343.js";
|
|
248
248
|
import {
|
|
249
249
|
retrack,
|
|
250
250
|
setMaxDrainIterations,
|
|
251
251
|
untracked
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-7ALC7KGE.js";
|
|
253
253
|
import {
|
|
254
254
|
getRuntimeErrorHandler,
|
|
255
255
|
reportError,
|
|
256
256
|
setRuntimeErrorHandler
|
|
257
|
-
} from "./chunk-
|
|
257
|
+
} from "./chunk-2WLZ6757.js";
|
|
258
258
|
export {
|
|
259
259
|
DynamicComponent,
|
|
260
260
|
ErrorBoundary,
|
|
@@ -45,6 +45,13 @@ declare function getPerformanceReport(): Record<string, {
|
|
|
45
45
|
declare function clearPerformanceData(): void;
|
|
46
46
|
declare function trackCleanup(component: string, cleanup: () => void): void;
|
|
47
47
|
declare function runCleanups(component: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Report components that still hold registered cleanups, i.e. that were never
|
|
50
|
+
* disposed. A development aid — it observes only what `debug.ts` tracked.
|
|
51
|
+
*
|
|
52
|
+
* @returns A map of component name to the number of outstanding cleanups.
|
|
53
|
+
* Empty when nothing is leaking.
|
|
54
|
+
*/
|
|
48
55
|
declare function checkLeaks(): Record<string, number>;
|
|
49
56
|
|
|
50
57
|
/**
|
|
@@ -45,6 +45,13 @@ declare function getPerformanceReport(): Record<string, {
|
|
|
45
45
|
declare function clearPerformanceData(): void;
|
|
46
46
|
declare function trackCleanup(component: string, cleanup: () => void): void;
|
|
47
47
|
declare function runCleanups(component: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Report components that still hold registered cleanups, i.e. that were never
|
|
50
|
+
* disposed. A development aid — it observes only what `debug.ts` tracked.
|
|
51
|
+
*
|
|
52
|
+
* @returns A map of component name to the number of outstanding cleanups.
|
|
53
|
+
* Empty when nothing is leaking.
|
|
54
|
+
*/
|
|
48
55
|
declare function checkLeaks(): Record<string, number>;
|
|
49
56
|
|
|
50
57
|
/**
|
package/dist/motion.cjs
CHANGED
|
@@ -45,18 +45,12 @@ __export(motion_exports, {
|
|
|
45
45
|
module.exports = __toCommonJS(motion_exports);
|
|
46
46
|
|
|
47
47
|
// src/core/dev.ts
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// this branch is unreachable here.
|
|
53
|
-
/* v8 ignore next 2 */
|
|
54
|
-
typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
var _isDev = isDev();
|
|
48
|
+
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
49
|
+
// safe default: off in browser, on in test/dev Node
|
|
50
|
+
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
51
|
+
);
|
|
58
52
|
function devWarn(message) {
|
|
59
|
-
if (
|
|
53
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
60
54
|
console.warn(`[SibuJS] ${message}`);
|
|
61
55
|
}
|
|
62
56
|
}
|
|
@@ -151,7 +145,6 @@ function reportError(error, context) {
|
|
|
151
145
|
|
|
152
146
|
// src/core/rendering/dispose.ts
|
|
153
147
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
154
|
-
var _isDev2 = isDev();
|
|
155
148
|
var activeBindingCount = 0;
|
|
156
149
|
function registerDisposer(node, teardown) {
|
|
157
150
|
let disposers = elementDisposers.get(node);
|
|
@@ -160,7 +153,7 @@ function registerDisposer(node, teardown) {
|
|
|
160
153
|
elementDisposers.set(node, disposers);
|
|
161
154
|
}
|
|
162
155
|
disposers.push(teardown);
|
|
163
|
-
if (
|
|
156
|
+
if (DEV) activeBindingCount++;
|
|
164
157
|
}
|
|
165
158
|
|
|
166
159
|
// src/ui/transition.ts
|
|
@@ -707,17 +700,16 @@ function forEachSubscriber(signal2, visit) {
|
|
|
707
700
|
}
|
|
708
701
|
|
|
709
702
|
// src/reactivity/track.ts
|
|
710
|
-
var
|
|
711
|
-
var _runtimeVersion = true ? "4.1.0" : "dev";
|
|
703
|
+
var _runtimeVersion = true ? "4.2.0" : "dev";
|
|
712
704
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
713
705
|
function resolveReactiveApi() {
|
|
714
706
|
const g = globalThis;
|
|
715
707
|
const existing = g[REGISTRY_KEY];
|
|
716
708
|
if (existing) {
|
|
717
|
-
if (
|
|
709
|
+
if (DEV && !existing.__dupWarned) {
|
|
718
710
|
existing.__dupWarned = true;
|
|
719
711
|
devWarn(
|
|
720
|
-
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity
|
|
712
|
+
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`
|
|
721
713
|
);
|
|
722
714
|
}
|
|
723
715
|
return existing;
|
|
@@ -816,7 +808,6 @@ var isBatching = API2.isBatching;
|
|
|
816
808
|
|
|
817
809
|
// src/core/signals/signal.ts
|
|
818
810
|
var _g = globalThis;
|
|
819
|
-
var _isDev4 = isDev();
|
|
820
811
|
function signal(initial, options) {
|
|
821
812
|
const state2 = {
|
|
822
813
|
value: initial,
|
|
@@ -829,7 +820,7 @@ function signal(initial, options) {
|
|
|
829
820
|
_d: false,
|
|
830
821
|
_validate: void 0
|
|
831
822
|
};
|
|
832
|
-
const debugName =
|
|
823
|
+
const debugName = DEV ? options?.name : void 0;
|
|
833
824
|
const equalsFn = options?.equals;
|
|
834
825
|
if (debugName) state2.__name = debugName;
|
|
835
826
|
function get() {
|
|
@@ -846,7 +837,7 @@ function signal(initial, options) {
|
|
|
846
837
|
if (equalsFn(prev, newValue)) return;
|
|
847
838
|
state2.value = newValue;
|
|
848
839
|
state2.__v++;
|
|
849
|
-
if (
|
|
840
|
+
if (DEV) {
|
|
850
841
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
851
842
|
if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
|
|
852
843
|
}
|
|
@@ -854,7 +845,7 @@ function signal(initial, options) {
|
|
|
854
845
|
notifySubscribers2(state2);
|
|
855
846
|
}
|
|
856
847
|
};
|
|
857
|
-
} else if (
|
|
848
|
+
} else if (DEV) {
|
|
858
849
|
set = (next) => {
|
|
859
850
|
const prev = state2.value;
|
|
860
851
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -879,7 +870,7 @@ function signal(initial, options) {
|
|
|
879
870
|
}
|
|
880
871
|
};
|
|
881
872
|
}
|
|
882
|
-
if (
|
|
873
|
+
if (DEV) {
|
|
883
874
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
884
875
|
if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
|
|
885
876
|
}
|
package/dist/motion.js
CHANGED
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
stagger,
|
|
21
21
|
transition,
|
|
22
22
|
viewTransition
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-3VTSPNC5.js";
|
|
24
|
+
import "./chunk-QKRPLZ2V.js";
|
|
25
|
+
import "./chunk-HECVW343.js";
|
|
26
|
+
import "./chunk-7ALC7KGE.js";
|
|
27
|
+
import "./chunk-2WLZ6757.js";
|
|
28
28
|
export {
|
|
29
29
|
TransitionGroup,
|
|
30
30
|
animate,
|
package/dist/patterns.cjs
CHANGED
|
@@ -44,23 +44,17 @@ __export(patterns_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(patterns_exports);
|
|
45
45
|
|
|
46
46
|
// src/core/dev.ts
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// this branch is unreachable here.
|
|
52
|
-
/* v8 ignore next 2 */
|
|
53
|
-
typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
var _isDev = isDev();
|
|
47
|
+
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
48
|
+
// safe default: off in browser, on in test/dev Node
|
|
49
|
+
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
50
|
+
);
|
|
57
51
|
function devAssert(condition, message) {
|
|
58
|
-
if (
|
|
52
|
+
if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
|
|
59
53
|
throw new Error(`[SibuJS] ${message}`);
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
56
|
function devWarn(message) {
|
|
63
|
-
if (
|
|
57
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
64
58
|
console.warn(`[SibuJS] ${message}`);
|
|
65
59
|
}
|
|
66
60
|
}
|
|
@@ -609,17 +603,16 @@ function forEachSubscriber(signal2, visit) {
|
|
|
609
603
|
}
|
|
610
604
|
|
|
611
605
|
// src/reactivity/track.ts
|
|
612
|
-
var
|
|
613
|
-
var _runtimeVersion = true ? "4.1.0" : "dev";
|
|
606
|
+
var _runtimeVersion = true ? "4.2.0" : "dev";
|
|
614
607
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
615
608
|
function resolveReactiveApi() {
|
|
616
609
|
const g = globalThis;
|
|
617
610
|
const existing = g[REGISTRY_KEY];
|
|
618
611
|
if (existing) {
|
|
619
|
-
if (
|
|
612
|
+
if (DEV && !existing.__dupWarned) {
|
|
620
613
|
existing.__dupWarned = true;
|
|
621
614
|
devWarn(
|
|
622
|
-
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity
|
|
615
|
+
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`
|
|
623
616
|
);
|
|
624
617
|
}
|
|
625
618
|
return existing;
|
|
@@ -718,7 +711,6 @@ var isBatching = API2.isBatching;
|
|
|
718
711
|
|
|
719
712
|
// src/core/signals/signal.ts
|
|
720
713
|
var _g = globalThis;
|
|
721
|
-
var _isDev3 = isDev();
|
|
722
714
|
function signal(initial, options) {
|
|
723
715
|
const state2 = {
|
|
724
716
|
value: initial,
|
|
@@ -731,7 +723,7 @@ function signal(initial, options) {
|
|
|
731
723
|
_d: false,
|
|
732
724
|
_validate: void 0
|
|
733
725
|
};
|
|
734
|
-
const debugName =
|
|
726
|
+
const debugName = DEV ? options?.name : void 0;
|
|
735
727
|
const equalsFn = options?.equals;
|
|
736
728
|
if (debugName) state2.__name = debugName;
|
|
737
729
|
function get() {
|
|
@@ -748,7 +740,7 @@ function signal(initial, options) {
|
|
|
748
740
|
if (equalsFn(prev, newValue)) return;
|
|
749
741
|
state2.value = newValue;
|
|
750
742
|
state2.__v++;
|
|
751
|
-
if (
|
|
743
|
+
if (DEV) {
|
|
752
744
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
753
745
|
if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
|
|
754
746
|
}
|
|
@@ -756,7 +748,7 @@ function signal(initial, options) {
|
|
|
756
748
|
notifySubscribers2(state2);
|
|
757
749
|
}
|
|
758
750
|
};
|
|
759
|
-
} else if (
|
|
751
|
+
} else if (DEV) {
|
|
760
752
|
set = (next) => {
|
|
761
753
|
const prev = state2.value;
|
|
762
754
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -781,7 +773,7 @@ function signal(initial, options) {
|
|
|
781
773
|
}
|
|
782
774
|
};
|
|
783
775
|
}
|
|
784
|
-
if (
|
|
776
|
+
if (DEV) {
|
|
785
777
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
786
778
|
if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
|
|
787
779
|
}
|
|
@@ -1710,13 +1702,13 @@ var validators = {
|
|
|
1710
1702
|
function validateProps(props, schema) {
|
|
1711
1703
|
const result = { ...props };
|
|
1712
1704
|
const errors = [];
|
|
1713
|
-
const
|
|
1705
|
+
const isDev = typeof process === "undefined" || process?.env?.NODE_ENV !== "production";
|
|
1714
1706
|
for (const [key, def] of Object.entries(schema)) {
|
|
1715
1707
|
const propDef = typeof def === "function" ? { type: def } : def;
|
|
1716
1708
|
if (result[key] == null && propDef.default !== void 0) {
|
|
1717
1709
|
result[key] = typeof propDef.default === "function" ? propDef.default() : propDef.default;
|
|
1718
1710
|
}
|
|
1719
|
-
if (!
|
|
1711
|
+
if (!isDev) continue;
|
|
1720
1712
|
if (propDef.required && result[key] == null) {
|
|
1721
1713
|
errors.push(`Prop '${key}' is required`);
|
|
1722
1714
|
continue;
|
|
@@ -1731,7 +1723,7 @@ function validateProps(props, schema) {
|
|
|
1731
1723
|
if (validResult !== true) errors.push(validResult);
|
|
1732
1724
|
}
|
|
1733
1725
|
}
|
|
1734
|
-
if (errors.length > 0 &&
|
|
1726
|
+
if (errors.length > 0 && isDev) {
|
|
1735
1727
|
console.warn(`[SibuJS] Prop validation errors:
|
|
1736
1728
|
${errors.map((e) => ` - ${e}`).join("\n")}`);
|
|
1737
1729
|
}
|
package/dist/patterns.d.cts
CHANGED
|
@@ -94,6 +94,14 @@ interface PersistOptions<T = unknown> {
|
|
|
94
94
|
* Must be synchronous — see `encrypt` docs. */
|
|
95
95
|
decrypt?: (value: string) => string;
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* A signal mirrored into persistent storage, rehydrated on creation.
|
|
99
|
+
*
|
|
100
|
+
* @param key Storage key.
|
|
101
|
+
* @param initial Value used when storage holds nothing (or holds junk).
|
|
102
|
+
* @param options Storage backend, serializer and version/migration settings.
|
|
103
|
+
* @returns A `[accessor, setter]` pair with the same shape as `signal`.
|
|
104
|
+
*/
|
|
97
105
|
declare function persisted<T>(key: string, initial: T, options?: PersistOptions<T>): [() => T, (next: T | ((prev: T) => T)) => void];
|
|
98
106
|
|
|
99
107
|
/**
|
package/dist/patterns.d.ts
CHANGED
|
@@ -94,6 +94,14 @@ interface PersistOptions<T = unknown> {
|
|
|
94
94
|
* Must be synchronous — see `encrypt` docs. */
|
|
95
95
|
decrypt?: (value: string) => string;
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* A signal mirrored into persistent storage, rehydrated on creation.
|
|
99
|
+
*
|
|
100
|
+
* @param key Storage key.
|
|
101
|
+
* @param initial Value used when storage holds nothing (or holds junk).
|
|
102
|
+
* @param options Storage backend, serializer and version/migration settings.
|
|
103
|
+
* @returns A `[accessor, setter]` pair with the same shape as `signal`.
|
|
104
|
+
*/
|
|
97
105
|
declare function persisted<T>(key: string, initial: T, options?: PersistOptions<T>): [() => T, (next: T | ((prev: T) => T)) => void];
|
|
98
106
|
|
|
99
107
|
/**
|
package/dist/patterns.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
optimisticList,
|
|
6
6
|
persisted,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OUWAIXIK.js";
|
|
9
9
|
import {
|
|
10
10
|
RenderProp,
|
|
11
11
|
assertType,
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
withWrapper
|
|
24
24
|
} from "./chunk-VJE6DDYM.js";
|
|
25
25
|
import "./chunk-H3SRKIYX.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-2LOYNGBY.js";
|
|
27
|
+
import "./chunk-7VEC3UD2.js";
|
|
28
|
+
import "./chunk-5DXA2J44.js";
|
|
29
|
+
import "./chunk-HECVW343.js";
|
|
30
|
+
import "./chunk-7ALC7KGE.js";
|
|
31
|
+
import "./chunk-2WLZ6757.js";
|
|
32
32
|
export {
|
|
33
33
|
RenderProp,
|
|
34
34
|
assertType,
|
package/dist/performance.cjs
CHANGED
|
@@ -231,23 +231,17 @@ async function processInChunks(items, processor, chunkSize = 50) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// src/core/dev.ts
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
// this branch is unreachable here.
|
|
239
|
-
/* v8 ignore next 2 */
|
|
240
|
-
typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
var _isDev = isDev();
|
|
234
|
+
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
235
|
+
// safe default: off in browser, on in test/dev Node
|
|
236
|
+
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
237
|
+
);
|
|
244
238
|
function devAssert(condition, message) {
|
|
245
|
-
if (
|
|
239
|
+
if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
|
|
246
240
|
throw new Error(`[SibuJS] ${message}`);
|
|
247
241
|
}
|
|
248
242
|
}
|
|
249
243
|
function devWarn(message) {
|
|
250
|
-
if (
|
|
244
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
251
245
|
console.warn(`[SibuJS] ${message}`);
|
|
252
246
|
}
|
|
253
247
|
}
|
|
@@ -796,17 +790,16 @@ function forEachSubscriber(signal2, visit) {
|
|
|
796
790
|
}
|
|
797
791
|
|
|
798
792
|
// src/reactivity/track.ts
|
|
799
|
-
var
|
|
800
|
-
var _runtimeVersion = true ? "4.1.0" : "dev";
|
|
793
|
+
var _runtimeVersion = true ? "4.2.0" : "dev";
|
|
801
794
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
802
795
|
function resolveReactiveApi() {
|
|
803
796
|
const g = globalThis;
|
|
804
797
|
const existing = g[REGISTRY_KEY];
|
|
805
798
|
if (existing) {
|
|
806
|
-
if (
|
|
799
|
+
if (DEV && !existing.__dupWarned) {
|
|
807
800
|
existing.__dupWarned = true;
|
|
808
801
|
devWarn(
|
|
809
|
-
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity
|
|
802
|
+
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`
|
|
810
803
|
);
|
|
811
804
|
}
|
|
812
805
|
return existing;
|
|
@@ -1068,7 +1061,6 @@ var isBatching = API2.isBatching;
|
|
|
1068
1061
|
|
|
1069
1062
|
// src/core/signals/signal.ts
|
|
1070
1063
|
var _g2 = globalThis;
|
|
1071
|
-
var _isDev3 = isDev();
|
|
1072
1064
|
function signal(initial, options) {
|
|
1073
1065
|
const state2 = {
|
|
1074
1066
|
value: initial,
|
|
@@ -1081,7 +1073,7 @@ function signal(initial, options) {
|
|
|
1081
1073
|
_d: false,
|
|
1082
1074
|
_validate: void 0
|
|
1083
1075
|
};
|
|
1084
|
-
const debugName =
|
|
1076
|
+
const debugName = DEV ? options?.name : void 0;
|
|
1085
1077
|
const equalsFn = options?.equals;
|
|
1086
1078
|
if (debugName) state2.__name = debugName;
|
|
1087
1079
|
function get() {
|
|
@@ -1098,7 +1090,7 @@ function signal(initial, options) {
|
|
|
1098
1090
|
if (equalsFn(prev, newValue)) return;
|
|
1099
1091
|
state2.value = newValue;
|
|
1100
1092
|
state2.__v++;
|
|
1101
|
-
if (
|
|
1093
|
+
if (DEV) {
|
|
1102
1094
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1103
1095
|
if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
|
|
1104
1096
|
}
|
|
@@ -1106,7 +1098,7 @@ function signal(initial, options) {
|
|
|
1106
1098
|
notifySubscribers2(state2);
|
|
1107
1099
|
}
|
|
1108
1100
|
};
|
|
1109
|
-
} else if (
|
|
1101
|
+
} else if (DEV) {
|
|
1110
1102
|
set = (next) => {
|
|
1111
1103
|
const prev = state2.value;
|
|
1112
1104
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -1131,7 +1123,7 @@ function signal(initial, options) {
|
|
|
1131
1123
|
}
|
|
1132
1124
|
};
|
|
1133
1125
|
}
|
|
1134
|
-
if (
|
|
1126
|
+
if (DEV) {
|
|
1135
1127
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1136
1128
|
if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
|
|
1137
1129
|
}
|
|
@@ -1189,7 +1181,6 @@ function reportDrainRunaway(label, executed, remaining) {
|
|
|
1189
1181
|
{ executed, remaining }
|
|
1190
1182
|
);
|
|
1191
1183
|
}
|
|
1192
|
-
var _isDev4 = isDev();
|
|
1193
1184
|
var activeBindingCount = 0;
|
|
1194
1185
|
function dispose(node) {
|
|
1195
1186
|
const stack = [node];
|
|
@@ -1212,13 +1203,13 @@ function dispose(node) {
|
|
|
1212
1203
|
if (!pending || pending.length === 0) break;
|
|
1213
1204
|
const snapshot = pending.slice();
|
|
1214
1205
|
elementDisposers.delete(current);
|
|
1215
|
-
if (
|
|
1206
|
+
if (DEV) activeBindingCount -= snapshot.length;
|
|
1216
1207
|
for (let i2 = 0; i2 < snapshot.length; i2++) {
|
|
1217
1208
|
if (executed >= MAX_DRAIN_TEARDOWNS) {
|
|
1218
1209
|
const rest = snapshot.slice(i2);
|
|
1219
1210
|
const added = elementDisposers.get(current);
|
|
1220
1211
|
elementDisposers.set(current, added ? rest.concat(added) : rest);
|
|
1221
|
-
if (
|
|
1212
|
+
if (DEV) activeBindingCount += rest.length;
|
|
1222
1213
|
reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
|
|
1223
1214
|
runaway = true;
|
|
1224
1215
|
break;
|
|
@@ -1274,7 +1265,6 @@ function sanitizeUrl(url) {
|
|
|
1274
1265
|
}
|
|
1275
1266
|
|
|
1276
1267
|
// src/performance/domRecycler.ts
|
|
1277
|
-
var _isDev5 = isDev();
|
|
1278
1268
|
var DOMPool = class {
|
|
1279
1269
|
constructor(maxSize = 50) {
|
|
1280
1270
|
this.pools = /* @__PURE__ */ new Map();
|
|
@@ -1301,7 +1291,7 @@ var DOMPool = class {
|
|
|
1301
1291
|
* is almost certainly a bug.
|
|
1302
1292
|
*/
|
|
1303
1293
|
release(element) {
|
|
1304
|
-
if (
|
|
1294
|
+
if (DEV && element.isConnected) {
|
|
1305
1295
|
devWarn(
|
|
1306
1296
|
"DOMPool.release() called on a still-connected element. Detach it from the DOM first (remove() / dispose())."
|
|
1307
1297
|
);
|
|
@@ -1413,7 +1403,6 @@ function noSideEffect(fn) {
|
|
|
1413
1403
|
}
|
|
1414
1404
|
|
|
1415
1405
|
// src/platform/ssr.ts
|
|
1416
|
-
var _isDev6 = isDev();
|
|
1417
1406
|
function trustHTML(html) {
|
|
1418
1407
|
return html;
|
|
1419
1408
|
}
|
package/dist/performance.js
CHANGED
|
@@ -33,18 +33,18 @@ import {
|
|
|
33
33
|
transitionState,
|
|
34
34
|
uniqueId,
|
|
35
35
|
yieldToMain
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-BNKV4REK.js";
|
|
37
37
|
import {
|
|
38
38
|
trustHTML
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-NIOYEGBQ.js";
|
|
40
|
+
import "./chunk-IXKSNWV5.js";
|
|
41
41
|
import "./chunk-7ZHH77QA.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-7VEC3UD2.js";
|
|
43
|
+
import "./chunk-5DXA2J44.js";
|
|
44
|
+
import "./chunk-QKRPLZ2V.js";
|
|
45
|
+
import "./chunk-HECVW343.js";
|
|
46
|
+
import "./chunk-7ALC7KGE.js";
|
|
47
|
+
import "./chunk-2WLZ6757.js";
|
|
48
48
|
export {
|
|
49
49
|
DOMPool,
|
|
50
50
|
Features,
|