sibujs 1.3.0 → 1.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 +105 -119
- package/dist/browser.cjs +53 -14
- package/dist/browser.d.cts +14 -9
- package/dist/browser.d.ts +14 -9
- package/dist/browser.js +4 -4
- package/dist/build.cjs +125 -135
- package/dist/build.d.cts +1 -1
- package/dist/build.d.ts +1 -1
- package/dist/build.js +11 -91
- package/dist/cdn.global.js +6 -6
- package/dist/chunk-5ZYQ6KDD.js +154 -0
- package/dist/chunk-6BMPXPUW.js +26 -0
- package/dist/chunk-7GRNSCFT.js +1097 -0
- package/dist/chunk-BGTHZHJ5.js +1016 -0
- package/dist/chunk-BMPL52BF.js +654 -0
- package/dist/chunk-CNZ35WI2.js +178 -0
- package/dist/chunk-GJPXRJ45.js +37 -0
- package/dist/chunk-JCDUJN2F.js +2779 -0
- package/dist/chunk-K4G4ZQNR.js +286 -0
- package/dist/chunk-M4NLBH4I.js +725 -0
- package/dist/chunk-MB6QFH3I.js +2776 -0
- package/dist/chunk-MYRV7VDM.js +742 -0
- package/dist/chunk-NZIIMDWI.js +84 -0
- package/dist/chunk-P3XWXJZU.js +282 -0
- package/dist/chunk-PDZQY43A.js +616 -0
- package/dist/chunk-RJ46C3CS.js +1293 -0
- package/dist/chunk-SFKNRVCU.js +292 -0
- package/dist/chunk-TDGZL5CU.js +365 -0
- package/dist/chunk-UHNL42EF.js +2730 -0
- package/dist/chunk-VAPYJN4X.js +368 -0
- package/dist/chunk-VQDZK23A.js +1023 -0
- package/dist/chunk-VQNQZCWJ.js +61 -0
- package/dist/chunk-XHK6BDAJ.js +76 -0
- package/dist/chunk-XUEEGU5O.js +409 -0
- package/dist/chunk-ZWKZCBO6.js +317 -0
- package/dist/contracts-ey_Qh8ef.d.cts +239 -0
- package/dist/contracts-ey_Qh8ef.d.ts +239 -0
- package/dist/contracts-xo5ckdRP.d.cts +240 -0
- package/dist/contracts-xo5ckdRP.d.ts +240 -0
- package/dist/customElement-BL3Uo8dL.d.cts +318 -0
- package/dist/customElement-BL3Uo8dL.d.ts +318 -0
- package/dist/data.cjs +52 -11
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +22 -24
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +26 -28
- package/dist/ecosystem.cjs +31 -6
- package/dist/ecosystem.d.cts +4 -4
- package/dist/ecosystem.d.ts +4 -4
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +305 -131
- package/dist/extras.d.cts +3 -3
- package/dist/extras.d.ts +3 -3
- package/dist/extras.js +21 -29
- package/dist/index.cjs +124 -56
- package/dist/index.d.cts +60 -72
- package/dist/index.d.ts +60 -72
- package/dist/index.js +10 -14
- package/dist/motion.cjs +13 -2
- package/dist/motion.d.cts +1 -1
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +91 -46
- package/dist/patterns.d.cts +46 -60
- package/dist/patterns.d.ts +46 -60
- package/dist/patterns.js +6 -14
- package/dist/performance.cjs +97 -12
- package/dist/performance.d.cts +6 -1
- package/dist/performance.d.ts +6 -1
- package/dist/performance.js +5 -3
- package/dist/plugins.cjs +20 -14
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +17 -19
- package/dist/ssr.cjs +9 -0
- package/dist/ssr.d.cts +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +7 -7
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +130 -53
- package/dist/ui.d.cts +13 -16
- package/dist/ui.d.ts +13 -16
- package/dist/ui.js +7 -9
- package/dist/widgets.cjs +31 -6
- package/dist/widgets.js +5 -5
- package/package.json +1 -1
package/dist/devtools.js
CHANGED
|
@@ -33,11 +33,11 @@ import {
|
|
|
33
33
|
trackCleanup,
|
|
34
34
|
walkDependencyGraph,
|
|
35
35
|
withErrorTracking
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
36
|
+
} from "./chunk-7GRNSCFT.js";
|
|
37
|
+
import "./chunk-VQNQZCWJ.js";
|
|
38
38
|
import "./chunk-EUZND3CB.js";
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-NZIIMDWI.js";
|
|
40
|
+
import "./chunk-K4G4ZQNR.js";
|
|
41
41
|
import {
|
|
42
42
|
isDev
|
|
43
43
|
} from "./chunk-5X6PP2UK.js";
|
|
@@ -100,55 +100,53 @@ function createTraceProfiler() {
|
|
|
100
100
|
}
|
|
101
101
|
const start = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
102
102
|
let recording = true;
|
|
103
|
-
|
|
103
|
+
function now() {
|
|
104
|
+
return (typeof performance !== "undefined" ? performance.now() : Date.now()) - start;
|
|
105
|
+
}
|
|
106
|
+
const onEffectCreate = (payload) => {
|
|
104
107
|
if (!recording) return;
|
|
105
|
-
const now = (typeof performance !== "undefined" ? performance.now() : Date.now()) - start;
|
|
106
|
-
const label = payload.name ?? "effect";
|
|
107
108
|
events.push({
|
|
108
|
-
name:
|
|
109
|
+
name: payload.name ?? "effect",
|
|
109
110
|
cat: "effect",
|
|
110
|
-
ph: "
|
|
111
|
-
ts: Math.floor(now * 1e3),
|
|
111
|
+
ph: "I",
|
|
112
|
+
ts: Math.floor(now() * 1e3),
|
|
112
113
|
tid: 0,
|
|
113
114
|
pid: 0
|
|
114
115
|
});
|
|
115
116
|
};
|
|
116
|
-
const
|
|
117
|
+
const onEffectDestroy = (payload) => {
|
|
117
118
|
if (!recording) return;
|
|
118
|
-
const now = (typeof performance !== "undefined" ? performance.now() : Date.now()) - start;
|
|
119
|
-
const label = payload.name ?? "effect";
|
|
120
119
|
events.push({
|
|
121
|
-
name:
|
|
120
|
+
name: payload.name ?? "effect:destroy",
|
|
122
121
|
cat: "effect",
|
|
123
|
-
ph: "
|
|
124
|
-
ts: Math.floor(now * 1e3),
|
|
122
|
+
ph: "I",
|
|
123
|
+
ts: Math.floor(now() * 1e3),
|
|
125
124
|
tid: 0,
|
|
126
125
|
pid: 0
|
|
127
126
|
});
|
|
128
127
|
};
|
|
129
|
-
const
|
|
128
|
+
const onSignalUpdate = (payload) => {
|
|
130
129
|
if (!recording) return;
|
|
131
|
-
const
|
|
132
|
-
const label = payload.name ?? "signal";
|
|
130
|
+
const p = payload;
|
|
133
131
|
events.push({
|
|
134
|
-
name:
|
|
132
|
+
name: p.name ?? "signal",
|
|
135
133
|
cat: "signal",
|
|
136
134
|
ph: "I",
|
|
137
|
-
ts: Math.floor(now * 1e3),
|
|
135
|
+
ts: Math.floor(now() * 1e3),
|
|
138
136
|
tid: 0,
|
|
139
137
|
pid: 0,
|
|
140
|
-
args:
|
|
138
|
+
args: p.oldValue !== void 0 ? { oldValue: String(p.oldValue), newValue: String(p.newValue) } : void 0
|
|
141
139
|
});
|
|
142
140
|
};
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
141
|
+
const offCreate = hook.on("effect:create", onEffectCreate);
|
|
142
|
+
const offDestroy = hook.on("effect:destroy", onEffectDestroy);
|
|
143
|
+
const offUpdate = hook.on("signal:update", onSignalUpdate);
|
|
146
144
|
function stop() {
|
|
147
145
|
if (!recording) return events;
|
|
148
146
|
recording = false;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
offCreate();
|
|
148
|
+
offDestroy();
|
|
149
|
+
offUpdate();
|
|
152
150
|
return events;
|
|
153
151
|
}
|
|
154
152
|
function stopTrace() {
|
package/dist/ecosystem.cjs
CHANGED
|
@@ -126,12 +126,21 @@ function queueSignalNotification(signal2) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
var MAX_DRAIN_ITERATIONS = 1e3;
|
|
129
130
|
function drainNotificationQueue() {
|
|
130
131
|
if (notifyDepth > 0) return;
|
|
131
132
|
notifyDepth++;
|
|
132
133
|
try {
|
|
133
134
|
let i = 0;
|
|
134
135
|
while (i < pendingQueue.length) {
|
|
136
|
+
if (i >= MAX_DRAIN_ITERATIONS) {
|
|
137
|
+
if (typeof console !== "undefined") {
|
|
138
|
+
console.error(
|
|
139
|
+
`[SibuJS] Notification queue exceeded ${MAX_DRAIN_ITERATIONS} iterations \u2014 likely an effect that writes to a signal it reads. Breaking to prevent infinite loop.`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
135
144
|
safeInvoke(pendingQueue[i]);
|
|
136
145
|
i++;
|
|
137
146
|
}
|
|
@@ -436,21 +445,37 @@ function derived(getter, options) {
|
|
|
436
445
|
cs._v = getter();
|
|
437
446
|
}, markDirty);
|
|
438
447
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
448
|
+
let evaluating = false;
|
|
439
449
|
function computedGetter() {
|
|
450
|
+
if (evaluating) {
|
|
451
|
+
throw new Error(
|
|
452
|
+
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
453
|
+
);
|
|
454
|
+
}
|
|
440
455
|
if (trackingSuspended) {
|
|
441
456
|
if (cs._d) {
|
|
442
|
-
|
|
443
|
-
|
|
457
|
+
evaluating = true;
|
|
458
|
+
try {
|
|
459
|
+
cs._d = false;
|
|
460
|
+
cs._v = getter();
|
|
461
|
+
} finally {
|
|
462
|
+
evaluating = false;
|
|
463
|
+
}
|
|
444
464
|
}
|
|
445
465
|
return cs._v;
|
|
446
466
|
}
|
|
447
467
|
recordDependency(cs);
|
|
448
468
|
if (cs._d) {
|
|
449
469
|
const oldValue = cs._v;
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
470
|
+
evaluating = true;
|
|
471
|
+
try {
|
|
472
|
+
track(() => {
|
|
473
|
+
cs._d = false;
|
|
474
|
+
cs._v = getter();
|
|
475
|
+
}, markDirty);
|
|
476
|
+
} finally {
|
|
477
|
+
evaluating = false;
|
|
478
|
+
}
|
|
454
479
|
if (hook && oldValue !== cs._v) {
|
|
455
480
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
456
481
|
}
|
package/dist/ecosystem.d.cts
CHANGED
|
@@ -48,7 +48,7 @@ interface MobXAdapterAPI {
|
|
|
48
48
|
*
|
|
49
49
|
* const mobx = inject<MobXAdapterAPI>("mobx");
|
|
50
50
|
* const todoCount = mobx.fromMobX(() => todoStore.todos.length);
|
|
51
|
-
* div(
|
|
51
|
+
* div(() => `Todos: ${todoCount()}`);
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
declare function mobXAdapter(options: MobXAdapterOptions): SibuPlugin;
|
|
@@ -90,7 +90,7 @@ interface ReduxAdapterAPI<S = unknown> {
|
|
|
90
90
|
*
|
|
91
91
|
* const redux = inject<ReduxAdapterAPI>("redux");
|
|
92
92
|
* const count = redux.useSelector(s => s.counter);
|
|
93
|
-
* div(
|
|
93
|
+
* div(() => `Count: ${count()}`);
|
|
94
94
|
* ```
|
|
95
95
|
*/
|
|
96
96
|
declare function reduxAdapter<S>(options: ReduxAdapterOptions<S>): SibuPlugin;
|
|
@@ -133,7 +133,7 @@ interface ZustandAdapterAPI<S> {
|
|
|
133
133
|
*
|
|
134
134
|
* const zs = inject<ZustandAdapterAPI>("zustand");
|
|
135
135
|
* const bears = zs.useSelector(s => s.bears);
|
|
136
|
-
* div(
|
|
136
|
+
* div(() => `Bears: ${bears()}`);
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
139
|
declare function zustandAdapter<S>(options: ZustandAdapterOptions<S>): SibuPlugin;
|
|
@@ -204,7 +204,7 @@ type AdaptedComponent = (props?: AdaptedComponentProps) => Element;
|
|
|
204
204
|
* });
|
|
205
205
|
*
|
|
206
206
|
* const { Button } = adapter.components;
|
|
207
|
-
* Button({ variant: "raised",
|
|
207
|
+
* Button({ variant: "raised" }, "Click me");
|
|
208
208
|
* ```
|
|
209
209
|
*/
|
|
210
210
|
declare function componentAdapter(config: AdapterConfig): {
|
package/dist/ecosystem.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface MobXAdapterAPI {
|
|
|
48
48
|
*
|
|
49
49
|
* const mobx = inject<MobXAdapterAPI>("mobx");
|
|
50
50
|
* const todoCount = mobx.fromMobX(() => todoStore.todos.length);
|
|
51
|
-
* div(
|
|
51
|
+
* div(() => `Todos: ${todoCount()}`);
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
declare function mobXAdapter(options: MobXAdapterOptions): SibuPlugin;
|
|
@@ -90,7 +90,7 @@ interface ReduxAdapterAPI<S = unknown> {
|
|
|
90
90
|
*
|
|
91
91
|
* const redux = inject<ReduxAdapterAPI>("redux");
|
|
92
92
|
* const count = redux.useSelector(s => s.counter);
|
|
93
|
-
* div(
|
|
93
|
+
* div(() => `Count: ${count()}`);
|
|
94
94
|
* ```
|
|
95
95
|
*/
|
|
96
96
|
declare function reduxAdapter<S>(options: ReduxAdapterOptions<S>): SibuPlugin;
|
|
@@ -133,7 +133,7 @@ interface ZustandAdapterAPI<S> {
|
|
|
133
133
|
*
|
|
134
134
|
* const zs = inject<ZustandAdapterAPI>("zustand");
|
|
135
135
|
* const bears = zs.useSelector(s => s.bears);
|
|
136
|
-
* div(
|
|
136
|
+
* div(() => `Bears: ${bears()}`);
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
139
|
declare function zustandAdapter<S>(options: ZustandAdapterOptions<S>): SibuPlugin;
|
|
@@ -204,7 +204,7 @@ type AdaptedComponent = (props?: AdaptedComponentProps) => Element;
|
|
|
204
204
|
* });
|
|
205
205
|
*
|
|
206
206
|
* const { Button } = adapter.components;
|
|
207
|
-
* Button({ variant: "raised",
|
|
207
|
+
* Button({ variant: "raised" }, "Click me");
|
|
208
208
|
* ```
|
|
209
209
|
*/
|
|
210
210
|
declare function componentAdapter(config: AdapterConfig): {
|
package/dist/ecosystem.js
CHANGED
|
@@ -7,16 +7,16 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TDGZL5CU.js";
|
|
11
11
|
import "./chunk-K5ZUMYVS.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-SFKNRVCU.js";
|
|
13
|
+
import "./chunk-5ZYQ6KDD.js";
|
|
14
|
+
import "./chunk-XHK6BDAJ.js";
|
|
15
15
|
import "./chunk-CMBFNA7L.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-VQNQZCWJ.js";
|
|
17
17
|
import "./chunk-EUZND3CB.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-NZIIMDWI.js";
|
|
19
|
+
import "./chunk-K4G4ZQNR.js";
|
|
20
20
|
import "./chunk-5X6PP2UK.js";
|
|
21
21
|
export {
|
|
22
22
|
antdAdapter,
|