sibujs 1.2.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.
Files changed (89) hide show
  1. package/README.md +29 -25
  2. package/dist/browser.cjs +804 -2
  3. package/dist/browser.d.cts +591 -1
  4. package/dist/browser.d.ts +591 -1
  5. package/dist/browser.js +50 -8
  6. package/dist/build.cjs +654 -144
  7. package/dist/build.js +14 -12
  8. package/dist/cdn.global.js +188 -7
  9. package/dist/chunk-2BYQDGN3.js +742 -0
  10. package/dist/chunk-32DY64NT.js +282 -0
  11. package/dist/chunk-3AIRKM3B.js +1263 -0
  12. package/dist/chunk-3X2YG6YM.js +505 -0
  13. package/dist/chunk-5X6PP2UK.js +28 -0
  14. package/dist/chunk-77L6NL3X.js +1097 -0
  15. package/dist/chunk-BGN5ZMP4.js +26 -0
  16. package/dist/chunk-BTU3TJDS.js +365 -0
  17. package/dist/chunk-CHF5OHIA.js +61 -0
  18. package/dist/chunk-CMBFNA7L.js +27 -0
  19. package/dist/chunk-DAHRH4ON.js +331 -0
  20. package/dist/chunk-EBGIRKQY.js +616 -0
  21. package/dist/chunk-EUZND3CB.js +27 -0
  22. package/dist/chunk-F3FA4F32.js +292 -0
  23. package/dist/chunk-JAKHTMQU.js +1000 -0
  24. package/dist/chunk-JCI5M6U6.js +956 -0
  25. package/dist/chunk-KQPDEVVS.js +398 -0
  26. package/dist/chunk-NEKUBFPT.js +60 -0
  27. package/dist/chunk-NYVAC6P5.js +37 -0
  28. package/dist/chunk-PTQJDMRT.js +146 -0
  29. package/dist/chunk-QWZG56ET.js +2744 -0
  30. package/dist/chunk-TSOKIX5Z.js +654 -0
  31. package/dist/chunk-VRW3FULF.js +725 -0
  32. package/dist/chunk-WZSPOOER.js +84 -0
  33. package/dist/chunk-YT6HQ6AM.js +14 -0
  34. package/dist/chunk-ZD6OAMTH.js +277 -0
  35. package/dist/contracts-DDrwxvJ-.d.cts +245 -0
  36. package/dist/contracts-DDrwxvJ-.d.ts +245 -0
  37. package/dist/data.cjs +35 -2
  38. package/dist/data.d.cts +7 -0
  39. package/dist/data.d.ts +7 -0
  40. package/dist/data.js +9 -8
  41. package/dist/devtools.cjs +122 -0
  42. package/dist/devtools.d.cts +69 -461
  43. package/dist/devtools.d.ts +69 -461
  44. package/dist/devtools.js +127 -6
  45. package/dist/ecosystem.cjs +23 -6
  46. package/dist/ecosystem.d.cts +1 -1
  47. package/dist/ecosystem.d.ts +1 -1
  48. package/dist/ecosystem.js +10 -9
  49. package/dist/extras.cjs +1207 -65
  50. package/dist/extras.d.cts +5 -5
  51. package/dist/extras.d.ts +5 -5
  52. package/dist/extras.js +69 -24
  53. package/dist/index.cjs +663 -144
  54. package/dist/index.d.cts +397 -17
  55. package/dist/index.d.ts +397 -17
  56. package/dist/index.js +39 -17
  57. package/dist/introspect-BumjnBKr.d.cts +477 -0
  58. package/dist/introspect-CZrlcaYy.d.ts +477 -0
  59. package/dist/introspect-Cb0zgpi2.d.cts +477 -0
  60. package/dist/introspect-Y2xNXGSf.d.ts +477 -0
  61. package/dist/motion.js +4 -4
  62. package/dist/patterns.cjs +51 -2
  63. package/dist/patterns.d.cts +18 -8
  64. package/dist/patterns.d.ts +18 -8
  65. package/dist/patterns.js +7 -7
  66. package/dist/performance.js +4 -4
  67. package/dist/plugins.cjs +428 -81
  68. package/dist/plugins.d.cts +27 -4
  69. package/dist/plugins.d.ts +27 -4
  70. package/dist/plugins.js +156 -37
  71. package/dist/ssr-4PBXAOO3.js +40 -0
  72. package/dist/ssr-Do_SiVoL.d.cts +201 -0
  73. package/dist/ssr-Do_SiVoL.d.ts +201 -0
  74. package/dist/ssr.cjs +312 -60
  75. package/dist/ssr.d.cts +10 -1
  76. package/dist/ssr.d.ts +10 -1
  77. package/dist/ssr.js +13 -10
  78. package/dist/tagFactory-DaJ0YWX6.d.cts +47 -0
  79. package/dist/tagFactory-DaJ0YWX6.d.ts +47 -0
  80. package/dist/testing.cjs +233 -2
  81. package/dist/testing.d.cts +42 -1
  82. package/dist/testing.d.ts +42 -1
  83. package/dist/testing.js +129 -2
  84. package/dist/ui.cjs +374 -3
  85. package/dist/ui.d.cts +252 -2
  86. package/dist/ui.d.ts +252 -2
  87. package/dist/ui.js +328 -8
  88. package/dist/widgets.js +7 -7
  89. 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-7BF6TK55.js";
37
- import "./chunk-6SA3QQES.js";
38
- import "./chunk-CHJ27IGK.js";
39
- import "./chunk-V2XTI523.js";
40
- import "./chunk-UNXCEF6S.js";
41
- import "./chunk-MLKGABMK.js";
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,
@@ -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 {
@@ -781,16 +794,20 @@ function appendChildren(el, nodes) {
781
794
  var tagFactory = (tag, ns) => (first, second) => {
782
795
  const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
783
796
  if (first === void 0) return el;
784
- if (second === void 0 && typeof first === "string") {
797
+ if (typeof first === "string") {
798
+ if (second !== void 0) {
799
+ el.setAttribute("class", first);
800
+ appendChildren(el, second);
801
+ return el;
802
+ }
785
803
  el.textContent = first;
786
804
  return el;
787
805
  }
788
- if (second !== void 0) {
789
- el.setAttribute("class", first);
790
- appendChildren(el, second);
806
+ if (typeof first === "number") {
807
+ el.textContent = String(first);
791
808
  return el;
792
809
  }
793
- if (Array.isArray(first) || first instanceof Node) {
810
+ if (Array.isArray(first) || first instanceof Node || typeof first === "function") {
794
811
  appendChildren(el, first);
795
812
  return el;
796
813
  }
@@ -799,7 +816,7 @@ var tagFactory = (tag, ns) => (first, second) => {
799
816
  if (pClass != null) applyClass(el, pClass);
800
817
  const pId = props.id;
801
818
  if (pId != null) el.id = pId;
802
- const pNodes = props.nodes;
819
+ const pNodes = second !== void 0 ? second : props.nodes;
803
820
  if (pNodes != null) appendChildren(el, pNodes);
804
821
  const pOn = props.on;
805
822
  if (pOn) {
@@ -1,5 +1,5 @@
1
1
  import { S as SibuPlugin } from './plugin-Bek4RhJY.cjs';
2
- import { T as TagProps } from './tagFactory-Dl8QCLga.cjs';
2
+ import { T as TagProps } from './tagFactory-DaJ0YWX6.cjs';
3
3
 
4
4
  /** MobX autorun disposer function type. */
5
5
  type MobXReactionDisposer = () => void;
@@ -1,5 +1,5 @@
1
1
  import { S as SibuPlugin } from './plugin-Bek4RhJY.js';
2
- import { T as TagProps } from './tagFactory-Dl8QCLga.js';
2
+ import { T as TagProps } from './tagFactory-DaJ0YWX6.js';
3
3
 
4
4
  /** MobX autorun disposer function type. */
5
5
  type MobXReactionDisposer = () => void;
package/dist/ecosystem.js CHANGED
@@ -7,16 +7,17 @@ import {
7
7
  mobXAdapter,
8
8
  reduxAdapter,
9
9
  zustandAdapter
10
- } from "./chunk-OUZZEE4S.js";
10
+ } from "./chunk-BTU3TJDS.js";
11
11
  import "./chunk-K5ZUMYVS.js";
12
- import "./chunk-B7SWRFUT.js";
13
- import "./chunk-23VV7YD3.js";
14
- import "./chunk-L6JRBDNS.js";
15
- import "./chunk-6SA3QQES.js";
16
- import "./chunk-CHJ27IGK.js";
17
- import "./chunk-V2XTI523.js";
18
- import "./chunk-UNXCEF6S.js";
19
- import "./chunk-MLKGABMK.js";
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,