sibujs 1.0.0-beta.7 → 1.0.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 +47 -25
- package/dist/browser.js +4 -3
- package/dist/build.cjs +281 -62
- package/dist/build.js +10 -9
- package/dist/cdn.global.js +4 -4
- package/dist/chunk-24WSRM54.js +2002 -0
- package/dist/chunk-2GLUWW3D.js +567 -0
- package/dist/chunk-3CRQALYP.js +877 -0
- package/dist/chunk-526ENZ77.js +58 -0
- package/dist/chunk-5KBEED6D.js +361 -0
- package/dist/chunk-5M7LJFWV.js +271 -0
- package/dist/chunk-5ZFVYPDG.js +97 -0
- package/dist/chunk-6EYXAMBN.js +1857 -0
- package/dist/chunk-6HLLIF3K.js +398 -0
- package/dist/chunk-6J6S4NI7.js +398 -0
- package/dist/chunk-6NBHAKHS.js +1997 -0
- package/dist/chunk-7LS3ITZB.js +567 -0
- package/dist/chunk-7TQKR4PP.js +294 -0
- package/dist/chunk-ANRSGGFC.js +725 -0
- package/dist/chunk-BWBWJYBK.js +271 -0
- package/dist/chunk-CZUGLNJS.js +37 -0
- package/dist/chunk-DB243LB7.js +877 -0
- package/dist/chunk-DGUYCZJH.js +654 -0
- package/dist/chunk-DTCOOBMX.js +725 -0
- package/dist/chunk-FGOEVHY3.js +60 -0
- package/dist/chunk-FYIGTFXO.js +712 -0
- package/dist/chunk-GXIM4TC3.js +346 -0
- package/dist/chunk-HGMJFBC7.js +654 -0
- package/dist/chunk-HKUNBYN6.js +949 -0
- package/dist/chunk-HS6OOE3Q.js +365 -0
- package/dist/chunk-HZWNWUPJ.js +466 -0
- package/dist/chunk-I6EZTMPB.js +949 -0
- package/dist/chunk-IK3NFZOA.js +466 -0
- package/dist/chunk-JRWAHOMS.js +41 -0
- package/dist/chunk-KALKXPC3.js +297 -0
- package/dist/chunk-KKUV25KB.js +361 -0
- package/dist/chunk-L36YN45V.js +949 -0
- package/dist/chunk-LHNJSLC6.js +297 -0
- package/dist/chunk-MBINISSE.js +35 -0
- package/dist/chunk-MGYRVG2A.js +282 -0
- package/dist/chunk-MJ4LVHGX.js +712 -0
- package/dist/chunk-MLN3JZ2E.js +398 -0
- package/dist/chunk-N6IZB6KJ.js +567 -0
- package/dist/chunk-NMRUZALC.js +1097 -0
- package/dist/chunk-NMTRH4Q3.js +97 -0
- package/dist/chunk-OEGAHDEU.js +1094 -0
- package/dist/chunk-ONCYDOK6.js +466 -0
- package/dist/chunk-OWLQ4HZI.js +282 -0
- package/dist/chunk-OZS4YOOP.js +59 -0
- package/dist/chunk-PZEGYCF5.js +61 -0
- package/dist/chunk-QUGIYF3F.js +712 -0
- package/dist/chunk-QVKGGB2S.js +300 -0
- package/dist/chunk-QYSW3K7A.js +282 -0
- package/dist/chunk-RUAJTILD.js +26 -0
- package/dist/chunk-S6YEHFC7.js +654 -0
- package/dist/chunk-SDLZDHKP.js +107 -0
- package/dist/chunk-SU63HSUU.js +58 -0
- package/dist/chunk-T2SPHHYU.js +365 -0
- package/dist/chunk-UATXXETW.js +278 -0
- package/dist/chunk-UXDIPRCG.js +26 -0
- package/dist/chunk-V4G5Y6YM.js +1094 -0
- package/dist/chunk-VAA4FG3Z.js +365 -0
- package/dist/chunk-VUXB655T.js +1999 -0
- package/dist/chunk-XZGY5ZJ4.js +35 -0
- package/dist/chunk-Y6GP4QGG.js +276 -0
- package/dist/chunk-YECR7UIA.js +347 -0
- package/dist/chunk-Z65KYU7I.js +26 -0
- package/dist/chunk-Z6GZHJW5.js +877 -0
- package/dist/data.cjs +47 -25
- package/dist/data.js +6 -5
- package/dist/devtools.cjs +46 -24
- package/dist/devtools.js +4 -3
- package/dist/ecosystem.cjs +65 -31
- package/dist/ecosystem.js +7 -6
- package/dist/extras.cjs +172 -45
- package/dist/extras.d.cts +1 -1
- package/dist/extras.d.ts +1 -1
- package/dist/extras.js +23 -20
- package/dist/index.cjs +291 -63
- package/dist/index.d.cts +196 -7
- package/dist/index.d.ts +196 -7
- package/dist/index.js +32 -13
- package/dist/motion.cjs +82 -15
- package/dist/motion.d.cts +43 -1
- package/dist/motion.d.ts +43 -1
- package/dist/motion.js +5 -2
- package/dist/patterns.cjs +52 -25
- package/dist/patterns.d.cts +15 -0
- package/dist/patterns.d.ts +15 -0
- package/dist/patterns.js +5 -4
- package/dist/performance.cjs +29 -15
- package/dist/performance.js +3 -2
- package/dist/plugins.cjs +127 -41
- package/dist/plugins.js +9 -8
- package/dist/ssr-GEOEYQV7.js +35 -0
- package/dist/ssr-WKUPVSSK.js +36 -0
- package/dist/ssr.cjs +111 -42
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +8 -7
- package/dist/ui.cjs +49 -24
- package/dist/ui.js +6 -5
- package/dist/widgets.cjs +36 -22
- package/dist/widgets.js +5 -4
- package/package.json +1 -1
package/dist/browser.cjs
CHANGED
|
@@ -36,7 +36,24 @@ __export(browser_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(browser_exports);
|
|
38
38
|
|
|
39
|
+
// src/core/dev.ts
|
|
40
|
+
function isDev() {
|
|
41
|
+
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : true;
|
|
42
|
+
}
|
|
43
|
+
var _isDev = isDev();
|
|
44
|
+
function devAssert(condition, message) {
|
|
45
|
+
if (_isDev && !condition) {
|
|
46
|
+
throw new Error(`[Sibu] ${message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function devWarn(message) {
|
|
50
|
+
if (_isDev) {
|
|
51
|
+
console.warn(`[Sibu] ${message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
// src/reactivity/track.ts
|
|
56
|
+
var _isDev2 = isDev();
|
|
40
57
|
var subscriberStack = new Array(32);
|
|
41
58
|
var stackCapacity = 32;
|
|
42
59
|
var stackTop = -1;
|
|
@@ -46,6 +63,13 @@ var SUBS = "__s";
|
|
|
46
63
|
var notifyDepth = 0;
|
|
47
64
|
var pendingQueue = [];
|
|
48
65
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
66
|
+
function safeInvoke(sub) {
|
|
67
|
+
try {
|
|
68
|
+
sub();
|
|
69
|
+
} catch (err) {
|
|
70
|
+
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
49
73
|
function track(effectFn, subscriber) {
|
|
50
74
|
if (!subscriber) subscriber = effectFn;
|
|
51
75
|
cleanup(subscriber);
|
|
@@ -112,7 +136,7 @@ function drainNotificationQueue() {
|
|
|
112
136
|
try {
|
|
113
137
|
let i = 0;
|
|
114
138
|
while (i < pendingQueue.length) {
|
|
115
|
-
pendingQueue[i]
|
|
139
|
+
safeInvoke(pendingQueue[i]);
|
|
116
140
|
i++;
|
|
117
141
|
}
|
|
118
142
|
} finally {
|
|
@@ -176,11 +200,11 @@ function notifySubscribers(signal2) {
|
|
|
176
200
|
if (first._c) {
|
|
177
201
|
propagateDirty(first);
|
|
178
202
|
} else {
|
|
179
|
-
first
|
|
203
|
+
safeInvoke(first);
|
|
180
204
|
}
|
|
181
205
|
let i = 0;
|
|
182
206
|
while (i < pendingQueue.length) {
|
|
183
|
-
pendingQueue[i]
|
|
207
|
+
safeInvoke(pendingQueue[i]);
|
|
184
208
|
i++;
|
|
185
209
|
}
|
|
186
210
|
} finally {
|
|
@@ -217,13 +241,13 @@ function notifySubscribers(signal2) {
|
|
|
217
241
|
for (let i2 = 0; i2 < directCount; i2++) {
|
|
218
242
|
if (!pendingQueue[i2]._c) {
|
|
219
243
|
if (!pendingSet.has(pendingQueue[i2])) {
|
|
220
|
-
pendingQueue[i2]
|
|
244
|
+
safeInvoke(pendingQueue[i2]);
|
|
221
245
|
}
|
|
222
246
|
}
|
|
223
247
|
}
|
|
224
248
|
let i = directCount;
|
|
225
249
|
while (i < pendingQueue.length) {
|
|
226
|
-
pendingQueue[i]
|
|
250
|
+
safeInvoke(pendingQueue[i]);
|
|
227
251
|
i++;
|
|
228
252
|
}
|
|
229
253
|
} finally {
|
|
@@ -266,7 +290,7 @@ var pendingSignals = /* @__PURE__ */ new Set();
|
|
|
266
290
|
function batch(fn) {
|
|
267
291
|
batchDepth++;
|
|
268
292
|
try {
|
|
269
|
-
fn();
|
|
293
|
+
return fn();
|
|
270
294
|
} finally {
|
|
271
295
|
batchDepth--;
|
|
272
296
|
if (batchDepth === 0) {
|
|
@@ -287,23 +311,13 @@ function flushBatch() {
|
|
|
287
311
|
drainNotificationQueue();
|
|
288
312
|
}
|
|
289
313
|
|
|
290
|
-
// src/core/dev.ts
|
|
291
|
-
function isDev() {
|
|
292
|
-
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : true;
|
|
293
|
-
}
|
|
294
|
-
var _isDev = isDev();
|
|
295
|
-
function devAssert(condition, message) {
|
|
296
|
-
if (_isDev && !condition) {
|
|
297
|
-
throw new Error(`[Sibu] ${message}`);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
314
|
// src/core/signals/signal.ts
|
|
302
315
|
var _g = globalThis;
|
|
303
|
-
var
|
|
316
|
+
var _isDev3 = isDev();
|
|
304
317
|
function signal(initial, options) {
|
|
305
318
|
const state = { value: initial };
|
|
306
|
-
const debugName =
|
|
319
|
+
const debugName = _isDev3 ? options?.name : void 0;
|
|
320
|
+
const equalsFn = options?.equals;
|
|
307
321
|
if (debugName) {
|
|
308
322
|
state.__name = debugName;
|
|
309
323
|
}
|
|
@@ -315,8 +329,8 @@ function signal(initial, options) {
|
|
|
315
329
|
if (debugName) get.__name = debugName;
|
|
316
330
|
function set(next) {
|
|
317
331
|
const newValue = typeof next === "function" ? next(state.value) : next;
|
|
318
|
-
if (Object.is(newValue, state.value)) return;
|
|
319
|
-
if (
|
|
332
|
+
if (equalsFn ? equalsFn(state.value, newValue) : Object.is(newValue, state.value)) return;
|
|
333
|
+
if (_isDev3) {
|
|
320
334
|
const oldValue = state.value;
|
|
321
335
|
state.value = newValue;
|
|
322
336
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
@@ -328,7 +342,7 @@ function signal(initial, options) {
|
|
|
328
342
|
notifySubscribers(state);
|
|
329
343
|
}
|
|
330
344
|
}
|
|
331
|
-
if (
|
|
345
|
+
if (_isDev3) {
|
|
332
346
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
333
347
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
334
348
|
}
|
|
@@ -362,17 +376,25 @@ function isSSR() {
|
|
|
362
376
|
|
|
363
377
|
// src/core/signals/effect.ts
|
|
364
378
|
var _g2 = globalThis;
|
|
365
|
-
function effect(effectFn) {
|
|
379
|
+
function effect(effectFn, options) {
|
|
366
380
|
devAssert(typeof effectFn === "function", "effect: argument must be a function.");
|
|
367
381
|
if (isSSR()) return () => {
|
|
368
382
|
};
|
|
383
|
+
const onError = options?.onError;
|
|
384
|
+
const wrappedFn = onError ? () => {
|
|
385
|
+
try {
|
|
386
|
+
effectFn();
|
|
387
|
+
} catch (err) {
|
|
388
|
+
onError(err);
|
|
389
|
+
}
|
|
390
|
+
} : effectFn;
|
|
369
391
|
let cleanupHandle = () => {
|
|
370
392
|
};
|
|
371
393
|
const subscriber = () => {
|
|
372
394
|
cleanupHandle();
|
|
373
|
-
cleanupHandle = track(
|
|
395
|
+
cleanupHandle = track(wrappedFn, subscriber);
|
|
374
396
|
};
|
|
375
|
-
cleanupHandle = track(
|
|
397
|
+
cleanupHandle = track(wrappedFn, subscriber);
|
|
376
398
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
377
399
|
if (hook) hook.emit("effect:create", { effectFn });
|
|
378
400
|
return () => {
|
package/dist/browser.js
CHANGED
|
@@ -12,10 +12,11 @@ import {
|
|
|
12
12
|
resize,
|
|
13
13
|
scroll,
|
|
14
14
|
title
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-ONCYDOK6.js";
|
|
16
|
+
import "./chunk-PZEGYCF5.js";
|
|
17
17
|
import "./chunk-CHJ27IGK.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-YECR7UIA.js";
|
|
19
|
+
import "./chunk-4MYMUBRS.js";
|
|
19
20
|
import "./chunk-MLKGABMK.js";
|
|
20
21
|
export {
|
|
21
22
|
battery,
|