sibujs 1.1.0 → 1.3.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 +29 -25
- package/dist/browser.cjs +804 -2
- package/dist/browser.d.cts +591 -1
- package/dist/browser.d.ts +591 -1
- package/dist/browser.js +50 -8
- package/dist/build.cjs +706 -161
- package/dist/build.js +21 -12
- package/dist/cdn.global.js +188 -7
- package/dist/chunk-2BYQDGN3.js +742 -0
- package/dist/chunk-32DY64NT.js +282 -0
- package/dist/chunk-3AIRKM3B.js +1263 -0
- package/dist/chunk-3X2YG6YM.js +505 -0
- package/dist/chunk-5X6PP2UK.js +28 -0
- package/dist/chunk-77L6NL3X.js +1097 -0
- package/dist/chunk-B7SWRFUT.js +332 -0
- package/dist/chunk-BGN5ZMP4.js +26 -0
- package/dist/chunk-BTU3TJDS.js +365 -0
- package/dist/chunk-CHF5OHIA.js +61 -0
- package/dist/chunk-CMBFNA7L.js +27 -0
- package/dist/chunk-DAHRH4ON.js +331 -0
- package/dist/chunk-EBGIRKQY.js +616 -0
- package/dist/chunk-EUZND3CB.js +27 -0
- package/dist/chunk-F3FA4F32.js +292 -0
- package/dist/chunk-GCOK2LC3.js +282 -0
- package/dist/chunk-JAKHTMQU.js +1000 -0
- package/dist/chunk-JCI5M6U6.js +956 -0
- package/dist/chunk-KQPDEVVS.js +398 -0
- package/dist/chunk-NEKUBFPT.js +60 -0
- package/dist/chunk-NYVAC6P5.js +37 -0
- package/dist/chunk-OUZZEE4S.js +365 -0
- package/dist/chunk-P6W3STU4.js +2249 -0
- package/dist/chunk-PTQJDMRT.js +146 -0
- package/dist/chunk-QWZG56ET.js +2744 -0
- package/dist/chunk-TSOKIX5Z.js +654 -0
- package/dist/chunk-VMVDTCXB.js +712 -0
- package/dist/chunk-VRW3FULF.js +725 -0
- package/dist/chunk-WZSPOOER.js +84 -0
- package/dist/chunk-YT6HQ6AM.js +14 -0
- package/dist/chunk-ZD6OAMTH.js +277 -0
- package/dist/contracts-DDrwxvJ-.d.cts +245 -0
- package/dist/contracts-DDrwxvJ-.d.ts +245 -0
- package/dist/data.cjs +35 -2
- package/dist/data.d.cts +7 -0
- package/dist/data.d.ts +7 -0
- package/dist/data.js +9 -8
- package/dist/devtools.cjs +122 -0
- package/dist/devtools.d.cts +69 -461
- package/dist/devtools.d.ts +69 -461
- package/dist/devtools.js +127 -6
- package/dist/ecosystem.cjs +68 -23
- package/dist/ecosystem.d.cts +1 -1
- package/dist/ecosystem.d.ts +1 -1
- package/dist/ecosystem.js +10 -9
- package/dist/extras.cjs +1252 -82
- package/dist/extras.d.cts +5 -5
- package/dist/extras.d.ts +5 -5
- package/dist/extras.js +69 -24
- package/dist/index.cjs +708 -161
- package/dist/index.d.cts +397 -17
- package/dist/index.d.ts +397 -17
- package/dist/index.js +39 -17
- package/dist/introspect-BumjnBKr.d.cts +477 -0
- package/dist/introspect-CZrlcaYy.d.ts +477 -0
- package/dist/introspect-Cb0zgpi2.d.cts +477 -0
- package/dist/introspect-Y2xNXGSf.d.ts +477 -0
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +51 -2
- package/dist/patterns.d.cts +18 -8
- package/dist/patterns.d.ts +18 -8
- package/dist/patterns.js +7 -7
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +473 -98
- package/dist/plugins.d.cts +27 -4
- package/dist/plugins.d.ts +27 -4
- package/dist/plugins.js +156 -37
- package/dist/ssr-4PBXAOO3.js +40 -0
- package/dist/ssr-Do_SiVoL.d.cts +201 -0
- package/dist/ssr-Do_SiVoL.d.ts +201 -0
- package/dist/ssr.cjs +357 -77
- package/dist/ssr.d.cts +10 -1
- package/dist/ssr.d.ts +10 -1
- package/dist/ssr.js +13 -10
- package/dist/tagFactory-DaJ0YWX6.d.cts +47 -0
- package/dist/tagFactory-DaJ0YWX6.d.ts +47 -0
- package/dist/testing.cjs +233 -2
- package/dist/testing.d.cts +42 -1
- package/dist/testing.d.ts +42 -1
- package/dist/testing.js +129 -2
- package/dist/ui.cjs +374 -3
- package/dist/ui.d.cts +252 -2
- package/dist/ui.d.ts +252 -2
- package/dist/ui.js +328 -8
- package/dist/widgets.js +7 -7
- package/package.json +1 -1
package/dist/devtools.js
CHANGED
|
@@ -33,14 +33,133 @@ import {
|
|
|
33
33
|
trackCleanup,
|
|
34
34
|
walkDependencyGraph,
|
|
35
35
|
withErrorTracking
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import
|
|
36
|
+
} from "./chunk-77L6NL3X.js";
|
|
37
|
+
import "./chunk-CHF5OHIA.js";
|
|
38
|
+
import "./chunk-EUZND3CB.js";
|
|
39
|
+
import "./chunk-WZSPOOER.js";
|
|
40
|
+
import "./chunk-ZD6OAMTH.js";
|
|
41
|
+
import {
|
|
42
|
+
isDev
|
|
43
|
+
} from "./chunk-5X6PP2UK.js";
|
|
44
|
+
|
|
45
|
+
// src/devtools/signalGraph.ts
|
|
46
|
+
function getHook() {
|
|
47
|
+
if (!isDev()) return null;
|
|
48
|
+
const g = globalThis;
|
|
49
|
+
return g.__SIBU_DEVTOOLS_GLOBAL_HOOK__ ?? null;
|
|
50
|
+
}
|
|
51
|
+
function captureSignalGraph() {
|
|
52
|
+
const hook = getHook();
|
|
53
|
+
if (!hook || typeof hook.getSignalNodes !== "function") {
|
|
54
|
+
return { capturedAt: Date.now(), nodes: [], edgeCount: 0 };
|
|
55
|
+
}
|
|
56
|
+
const nodes = [];
|
|
57
|
+
let edgeCount = 0;
|
|
58
|
+
for (const n of hook.getSignalNodes()) {
|
|
59
|
+
nodes.push({
|
|
60
|
+
id: n.id,
|
|
61
|
+
name: n.name,
|
|
62
|
+
kind: n.kind,
|
|
63
|
+
value: n.value,
|
|
64
|
+
subscribers: [...n.subscribers],
|
|
65
|
+
dependencies: [...n.dependencies],
|
|
66
|
+
evalCount: n.evalCount
|
|
67
|
+
});
|
|
68
|
+
edgeCount += n.dependencies.length;
|
|
69
|
+
}
|
|
70
|
+
return { capturedAt: Date.now(), nodes, edgeCount };
|
|
71
|
+
}
|
|
72
|
+
function diffSignalGraphs(before, after) {
|
|
73
|
+
const beforeById = new Map(before.nodes.map((n) => [n.id, n]));
|
|
74
|
+
const afterById = new Map(after.nodes.map((n) => [n.id, n]));
|
|
75
|
+
const added = [];
|
|
76
|
+
const removed = [];
|
|
77
|
+
const reevaluated = [];
|
|
78
|
+
for (const [id, node] of afterById) {
|
|
79
|
+
if (!beforeById.has(id)) {
|
|
80
|
+
added.push(node);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const prev = beforeById.get(id);
|
|
84
|
+
if (prev && prev.evalCount !== node.evalCount) reevaluated.push(node);
|
|
85
|
+
}
|
|
86
|
+
for (const [id, node] of beforeById) {
|
|
87
|
+
if (!afterById.has(id)) removed.push(node);
|
|
88
|
+
}
|
|
89
|
+
return { added, removed, reevaluated };
|
|
90
|
+
}
|
|
91
|
+
function createTraceProfiler() {
|
|
92
|
+
const events = [];
|
|
93
|
+
const hook = getHook();
|
|
94
|
+
if (!hook) {
|
|
95
|
+
return {
|
|
96
|
+
stop: () => events,
|
|
97
|
+
stopTrace: () => JSON.stringify({ traceEvents: events }),
|
|
98
|
+
isRecording: () => false
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const start = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
102
|
+
let recording = true;
|
|
103
|
+
const onEffectStart = (payload) => {
|
|
104
|
+
if (!recording) return;
|
|
105
|
+
const now = (typeof performance !== "undefined" ? performance.now() : Date.now()) - start;
|
|
106
|
+
const label = payload.name ?? "effect";
|
|
107
|
+
events.push({
|
|
108
|
+
name: label,
|
|
109
|
+
cat: "effect",
|
|
110
|
+
ph: "B",
|
|
111
|
+
ts: Math.floor(now * 1e3),
|
|
112
|
+
tid: 0,
|
|
113
|
+
pid: 0
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const onEffectEnd = (payload) => {
|
|
117
|
+
if (!recording) return;
|
|
118
|
+
const now = (typeof performance !== "undefined" ? performance.now() : Date.now()) - start;
|
|
119
|
+
const label = payload.name ?? "effect";
|
|
120
|
+
events.push({
|
|
121
|
+
name: label,
|
|
122
|
+
cat: "effect",
|
|
123
|
+
ph: "E",
|
|
124
|
+
ts: Math.floor(now * 1e3),
|
|
125
|
+
tid: 0,
|
|
126
|
+
pid: 0
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
const onSignalSet = (payload) => {
|
|
130
|
+
if (!recording) return;
|
|
131
|
+
const now = (typeof performance !== "undefined" ? performance.now() : Date.now()) - start;
|
|
132
|
+
const label = payload.name ?? "signal";
|
|
133
|
+
events.push({
|
|
134
|
+
name: label,
|
|
135
|
+
cat: "signal",
|
|
136
|
+
ph: "I",
|
|
137
|
+
ts: Math.floor(now * 1e3),
|
|
138
|
+
tid: 0,
|
|
139
|
+
pid: 0,
|
|
140
|
+
args: payload.args
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const offStart = hook.on("effect:start", onEffectStart);
|
|
144
|
+
const offEnd = hook.on("effect:end", onEffectEnd);
|
|
145
|
+
const offSet = hook.on("signal:set", onSignalSet);
|
|
146
|
+
function stop() {
|
|
147
|
+
if (!recording) return events;
|
|
148
|
+
recording = false;
|
|
149
|
+
offStart();
|
|
150
|
+
offEnd();
|
|
151
|
+
offSet();
|
|
152
|
+
return events;
|
|
153
|
+
}
|
|
154
|
+
function stopTrace() {
|
|
155
|
+
stop();
|
|
156
|
+
return JSON.stringify({ traceEvents: events, displayTimeUnit: "ms" });
|
|
157
|
+
}
|
|
158
|
+
return { stop, stopTrace, isRecording: () => recording };
|
|
159
|
+
}
|
|
42
160
|
export {
|
|
43
161
|
SibuError,
|
|
162
|
+
captureSignalGraph,
|
|
44
163
|
checkLeaks,
|
|
45
164
|
clearDebugValues,
|
|
46
165
|
clearHMRState,
|
|
@@ -49,9 +168,11 @@ export {
|
|
|
49
168
|
createErrorReporter,
|
|
50
169
|
createHMRBoundary,
|
|
51
170
|
createProfiler,
|
|
171
|
+
createTraceProfiler,
|
|
52
172
|
debugLog,
|
|
53
173
|
debugValue,
|
|
54
174
|
devState,
|
|
175
|
+
diffSignalGraphs,
|
|
55
176
|
disableDebug,
|
|
56
177
|
enableDebug,
|
|
57
178
|
formatError,
|
package/dist/ecosystem.cjs
CHANGED
|
@@ -539,7 +539,20 @@ function isUrlAttribute(attr) {
|
|
|
539
539
|
|
|
540
540
|
// src/reactivity/bindAttribute.ts
|
|
541
541
|
var _isDev4 = isDev();
|
|
542
|
+
function isEventHandlerAttr(name) {
|
|
543
|
+
if (name.length < 3) return false;
|
|
544
|
+
const lower = name.toLowerCase();
|
|
545
|
+
return lower[0] === "o" && lower[1] === "n" && lower.charCodeAt(2) >= 97 && lower.charCodeAt(2) <= 122;
|
|
546
|
+
}
|
|
542
547
|
function bindAttribute(el, attr, getter) {
|
|
548
|
+
if (isEventHandlerAttr(attr)) {
|
|
549
|
+
if (_isDev4)
|
|
550
|
+
devWarn(
|
|
551
|
+
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
552
|
+
);
|
|
553
|
+
return () => {
|
|
554
|
+
};
|
|
555
|
+
}
|
|
543
556
|
function commit() {
|
|
544
557
|
let value;
|
|
545
558
|
try {
|
|
@@ -582,11 +595,11 @@ function bindChildNode(placeholder, getter) {
|
|
|
582
595
|
if (_isDev5) devWarn(`bindChildNode: getter threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
583
596
|
return;
|
|
584
597
|
}
|
|
585
|
-
for (let i = 0; i < lastNodes.length; i++) {
|
|
586
|
-
const node = lastNodes[i];
|
|
587
|
-
if (node.parentNode) node.parentNode.removeChild(node);
|
|
588
|
-
}
|
|
589
598
|
if (result == null || typeof result === "boolean") {
|
|
599
|
+
for (let i = 0; i < lastNodes.length; i++) {
|
|
600
|
+
const node = lastNodes[i];
|
|
601
|
+
if (node.parentNode) node.parentNode.removeChild(node);
|
|
602
|
+
}
|
|
590
603
|
lastNodes.length = 0;
|
|
591
604
|
return;
|
|
592
605
|
}
|
|
@@ -595,24 +608,46 @@ function bindChildNode(placeholder, getter) {
|
|
|
595
608
|
lastNodes.length = 0;
|
|
596
609
|
return;
|
|
597
610
|
}
|
|
598
|
-
|
|
599
|
-
let count = 0;
|
|
611
|
+
let newNodes;
|
|
600
612
|
if (Array.isArray(result)) {
|
|
601
|
-
|
|
613
|
+
newNodes = [];
|
|
602
614
|
for (let i = 0; i < result.length; i++) {
|
|
603
615
|
const item = result[i];
|
|
604
616
|
if (item == null || typeof item === "boolean") continue;
|
|
605
|
-
|
|
606
|
-
parent.insertBefore(node, anchor);
|
|
607
|
-
lastNodes[count++] = node;
|
|
617
|
+
newNodes.push(item instanceof Node ? item : document.createTextNode(String(item)));
|
|
608
618
|
}
|
|
609
619
|
} else {
|
|
610
|
-
if (lastNodes.length < 1) lastNodes = [null];
|
|
611
620
|
const node = result instanceof Node ? result : document.createTextNode(String(result));
|
|
612
|
-
|
|
613
|
-
|
|
621
|
+
newNodes = [node];
|
|
622
|
+
}
|
|
623
|
+
const reused = lastNodes.length > 0 && newNodes.length > 0 ? /* @__PURE__ */ new Set() : void 0;
|
|
624
|
+
if (reused) {
|
|
625
|
+
for (let i = 0; i < newNodes.length; i++) {
|
|
626
|
+
for (let j = 0; j < lastNodes.length; j++) {
|
|
627
|
+
if (newNodes[i] === lastNodes[j]) {
|
|
628
|
+
reused.add(newNodes[i]);
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
614
633
|
}
|
|
615
|
-
lastNodes.length
|
|
634
|
+
for (let i = 0; i < lastNodes.length; i++) {
|
|
635
|
+
const node = lastNodes[i];
|
|
636
|
+
if (reused?.has(node)) continue;
|
|
637
|
+
if (node.parentNode) node.parentNode.removeChild(node);
|
|
638
|
+
}
|
|
639
|
+
const anchor = placeholder.nextSibling;
|
|
640
|
+
for (let i = 0; i < newNodes.length; i++) {
|
|
641
|
+
const node = newNodes[i];
|
|
642
|
+
if (reused?.has(node) && node.parentNode === parent) {
|
|
643
|
+
if (node.nextSibling !== anchor) {
|
|
644
|
+
parent.insertBefore(node, anchor);
|
|
645
|
+
}
|
|
646
|
+
} else {
|
|
647
|
+
parent.insertBefore(node, anchor);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
lastNodes = newNodes;
|
|
616
651
|
}
|
|
617
652
|
return track(commit);
|
|
618
653
|
}
|
|
@@ -759,16 +794,20 @@ function appendChildren(el, nodes) {
|
|
|
759
794
|
var tagFactory = (tag, ns) => (first, second) => {
|
|
760
795
|
const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
761
796
|
if (first === void 0) return el;
|
|
762
|
-
if (
|
|
797
|
+
if (typeof first === "string") {
|
|
798
|
+
if (second !== void 0) {
|
|
799
|
+
el.setAttribute("class", first);
|
|
800
|
+
appendChildren(el, second);
|
|
801
|
+
return el;
|
|
802
|
+
}
|
|
763
803
|
el.textContent = first;
|
|
764
804
|
return el;
|
|
765
805
|
}
|
|
766
|
-
if (
|
|
767
|
-
el.
|
|
768
|
-
appendChildren(el, second);
|
|
806
|
+
if (typeof first === "number") {
|
|
807
|
+
el.textContent = String(first);
|
|
769
808
|
return el;
|
|
770
809
|
}
|
|
771
|
-
if (Array.isArray(first) || first instanceof Node) {
|
|
810
|
+
if (Array.isArray(first) || first instanceof Node || typeof first === "function") {
|
|
772
811
|
appendChildren(el, first);
|
|
773
812
|
return el;
|
|
774
813
|
}
|
|
@@ -777,7 +816,7 @@ var tagFactory = (tag, ns) => (first, second) => {
|
|
|
777
816
|
if (pClass != null) applyClass(el, pClass);
|
|
778
817
|
const pId = props.id;
|
|
779
818
|
if (pId != null) el.id = pId;
|
|
780
|
-
const pNodes = props.nodes;
|
|
819
|
+
const pNodes = second !== void 0 ? second : props.nodes;
|
|
781
820
|
if (pNodes != null) appendChildren(el, pNodes);
|
|
782
821
|
const pOn = props.on;
|
|
783
822
|
if (pOn) {
|
|
@@ -802,12 +841,18 @@ var tagFactory = (tag, ns) => (first, second) => {
|
|
|
802
841
|
// already handled above / below
|
|
803
842
|
default: {
|
|
804
843
|
const value = props[key];
|
|
805
|
-
if (value == null
|
|
844
|
+
if (value == null) continue;
|
|
806
845
|
if (key[0] === "o" && key[1] === "n") continue;
|
|
807
846
|
if (typeof value === "function") {
|
|
808
847
|
registerDisposer(el, bindAttribute(el, key, value));
|
|
809
|
-
} else if (value ===
|
|
810
|
-
el
|
|
848
|
+
} else if (typeof value === "boolean") {
|
|
849
|
+
if (key in el && (key === "checked" || key === "disabled" || key === "selected")) {
|
|
850
|
+
el[key] = value;
|
|
851
|
+
} else if (value) {
|
|
852
|
+
el.setAttribute(key, "");
|
|
853
|
+
} else {
|
|
854
|
+
el.removeAttribute(key);
|
|
855
|
+
}
|
|
811
856
|
} else {
|
|
812
857
|
const str = String(value);
|
|
813
858
|
el.setAttribute(key, isUrlAttribute(key) ? sanitizeUrl(str) : str);
|
package/dist/ecosystem.d.cts
CHANGED
package/dist/ecosystem.d.ts
CHANGED
package/dist/ecosystem.js
CHANGED
|
@@ -7,16 +7,17 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BTU3TJDS.js";
|
|
11
11
|
import "./chunk-K5ZUMYVS.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-F3FA4F32.js";
|
|
13
|
+
import "./chunk-PTQJDMRT.js";
|
|
14
|
+
import "./chunk-NEKUBFPT.js";
|
|
15
|
+
import "./chunk-CMBFNA7L.js";
|
|
16
|
+
import "./chunk-CHF5OHIA.js";
|
|
17
|
+
import "./chunk-EUZND3CB.js";
|
|
18
|
+
import "./chunk-WZSPOOER.js";
|
|
19
|
+
import "./chunk-ZD6OAMTH.js";
|
|
20
|
+
import "./chunk-5X6PP2UK.js";
|
|
20
21
|
export {
|
|
21
22
|
antdAdapter,
|
|
22
23
|
chakraAdapter,
|