sibujs 3.4.0 → 4.0.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 (98) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +118 -15
  3. package/dist/browser.cjs +410 -101
  4. package/dist/browser.d.cts +50 -5
  5. package/dist/browser.d.ts +50 -5
  6. package/dist/browser.js +8 -6
  7. package/dist/build.cjs +777 -385
  8. package/dist/build.js +15 -15
  9. package/dist/cdn.global.js +11 -7
  10. package/dist/{chunk-JCO7AHNU.js → chunk-3EKJK5FZ.js} +73 -34
  11. package/dist/chunk-4MFZMLUU.js +147 -0
  12. package/dist/chunk-52XFPGSN.js +123 -0
  13. package/dist/chunk-5INI7D2L.js +194 -0
  14. package/dist/{chunk-OAVXAFAY.js → chunk-6LG2T7LO.js} +5 -5
  15. package/dist/{chunk-OOUQUCNN.js → chunk-ACBT6UZS.js} +57 -22
  16. package/dist/{chunk-F7HW2NI5.js → chunk-AW6HPJ3L.js} +1 -1
  17. package/dist/chunk-DHDZ7IVN.js +109 -0
  18. package/dist/{chunk-JNGGM2XE.js → chunk-DQVUBVNX.js} +16 -25
  19. package/dist/{chunk-AXFWGY32.js → chunk-DR7H6UGM.js} +232 -67
  20. package/dist/{chunk-WSGLJYFI.js → chunk-E62UADKL.js} +9 -3
  21. package/dist/{chunk-3Z2NGWQI.js → chunk-ES2GERY2.js} +1 -1
  22. package/dist/{chunk-S3V6ZXPI.js → chunk-EWEE7NBF.js} +115 -41
  23. package/dist/{chunk-3DVGCW7O.js → chunk-F64ZPCFE.js} +8 -8
  24. package/dist/{chunk-APFRCIRI.js → chunk-GCSGGA3Q.js} +295 -198
  25. package/dist/{chunk-EX77FXTT.js → chunk-HYCCIYNS.js} +228 -51
  26. package/dist/{chunk-ELXMRSVN.js → chunk-NF3LYCQH.js} +259 -124
  27. package/dist/chunk-O3QQ3XOL.js +61 -0
  28. package/dist/{chunk-BUKYCWHX.js → chunk-PBQEW5VW.js} +14 -10
  29. package/dist/{chunk-H5FI5WDP.js → chunk-RRIDJQ5C.js} +3 -3
  30. package/dist/{chunk-S3NFJO6L.js → chunk-TIRZCERI.js} +36 -5
  31. package/dist/{chunk-ODXVQ3CS.js → chunk-VFHIVEPF.js} +309 -188
  32. package/dist/chunk-VPP2FONR.js +142 -0
  33. package/dist/{chunk-KZBEVFXZ.js → chunk-W55YHPEP.js} +5 -3
  34. package/dist/{chunk-FKQG7FTY.js → chunk-WN6WDFCB.js} +4 -4
  35. package/dist/{chunk-CEBWDD63.js → chunk-WOOMUJFT.js} +228 -86
  36. package/dist/{chunk-ITWCTZYH.js → chunk-Z2CE42DB.js} +19 -25
  37. package/dist/{contracts-ey_Qh8ef.d.cts → contracts-Hg6ITAEF.d.cts} +6 -6
  38. package/dist/{contracts-ey_Qh8ef.d.ts → contracts-Hg6ITAEF.d.ts} +6 -6
  39. package/dist/{customElement-CPfIrbvg.d.ts → customElement-CKLoO63w.d.cts} +73 -11
  40. package/dist/{customElement-CPfIrbvg.d.cts → customElement-CKLoO63w.d.ts} +73 -11
  41. package/dist/data.cjs +483 -205
  42. package/dist/data.d.cts +139 -7
  43. package/dist/data.d.ts +139 -7
  44. package/dist/data.js +9 -9
  45. package/dist/devtools.cjs +222 -87
  46. package/dist/devtools.js +8 -8
  47. package/dist/dispose-4FZ6OFXR.js +19 -0
  48. package/dist/ecosystem.cjs +419 -175
  49. package/dist/ecosystem.js +11 -11
  50. package/dist/extras.cjs +1981 -765
  51. package/dist/extras.d.cts +7 -7
  52. package/dist/extras.d.ts +7 -7
  53. package/dist/extras.js +29 -26
  54. package/dist/index.cjs +784 -385
  55. package/dist/index.d.cts +299 -28
  56. package/dist/index.d.ts +299 -28
  57. package/dist/index.js +33 -18
  58. package/dist/motion.cjs +180 -50
  59. package/dist/motion.d.cts +26 -0
  60. package/dist/motion.d.ts +26 -0
  61. package/dist/motion.js +5 -5
  62. package/dist/patterns.cjs +437 -170
  63. package/dist/patterns.d.cts +60 -13
  64. package/dist/patterns.d.ts +60 -13
  65. package/dist/patterns.js +7 -7
  66. package/dist/performance.cjs +333 -148
  67. package/dist/performance.d.cts +55 -7
  68. package/dist/performance.d.ts +55 -7
  69. package/dist/performance.js +9 -9
  70. package/dist/plugins.cjs +1374 -576
  71. package/dist/plugins.d.cts +227 -9
  72. package/dist/plugins.d.ts +227 -9
  73. package/dist/plugins.js +613 -321
  74. package/dist/{ssr-D62yFwuw.d.cts → ssr-BiPRdZ6n.d.cts} +44 -15
  75. package/dist/{ssr-D62yFwuw.d.ts → ssr-BiPRdZ6n.d.ts} +44 -15
  76. package/dist/{ssr-2PPULEK2.js → ssr-JFP5535P.js} +5 -4
  77. package/dist/ssr.cjs +1104 -443
  78. package/dist/ssr.d.cts +230 -20
  79. package/dist/ssr.d.ts +230 -20
  80. package/dist/ssr.js +15 -12
  81. package/dist/{startup-0Qv6aosO.d.cts → startup-BMpaiMhP.d.cts} +1 -1
  82. package/dist/{startup-0Qv6aosO.d.ts → startup-BMpaiMhP.d.ts} +1 -1
  83. package/dist/testing.cjs +205 -63
  84. package/dist/testing.d.cts +1 -1
  85. package/dist/testing.d.ts +1 -1
  86. package/dist/testing.js +8 -10
  87. package/dist/ui.cjs +640 -199
  88. package/dist/ui.d.cts +2 -2
  89. package/dist/ui.d.ts +2 -2
  90. package/dist/ui.js +10 -10
  91. package/dist/widgets.cjs +207 -82
  92. package/dist/widgets.js +9 -9
  93. package/package.json +12 -7
  94. package/dist/chunk-5VGSK6D2.js +0 -80
  95. package/dist/chunk-COY6PUD2.js +0 -34
  96. package/dist/chunk-K35BAR4P.js +0 -96
  97. package/dist/chunk-L3GAGWCC.js +0 -111
  98. package/dist/chunk-RT3IYFN2.js +0 -38
@@ -1,80 +0,0 @@
1
- import {
2
- devWarn,
3
- isDev
4
- } from "./chunk-COY6PUD2.js";
5
-
6
- // src/core/rendering/dispose.ts
7
- var elementDisposers = /* @__PURE__ */ new WeakMap();
8
- var _isDev = isDev();
9
- var activeBindingCount = 0;
10
- function registerDisposer(node, teardown) {
11
- let disposers = elementDisposers.get(node);
12
- if (!disposers) {
13
- disposers = [];
14
- elementDisposers.set(node, disposers);
15
- }
16
- disposers.push(teardown);
17
- if (_isDev) activeBindingCount++;
18
- }
19
- function dispose(node) {
20
- const stack = [node];
21
- const order = [];
22
- while (stack.length > 0) {
23
- const current = stack.pop();
24
- order.push(current);
25
- const children = Array.from(current.childNodes);
26
- for (let i = 0; i < children.length; i++) {
27
- stack.push(children[i]);
28
- }
29
- }
30
- for (let i = order.length - 1; i >= 0; i--) {
31
- const current = order[i];
32
- const disposers = elementDisposers.get(current);
33
- if (disposers) {
34
- const snapshot = disposers.slice();
35
- elementDisposers.delete(current);
36
- if (_isDev) activeBindingCount -= snapshot.length;
37
- for (const d of snapshot) {
38
- try {
39
- d();
40
- } catch (err) {
41
- if (_isDev && typeof console !== "undefined") {
42
- console.warn("[SibuJS] Disposer threw during cleanup:", err);
43
- }
44
- }
45
- }
46
- let extraPasses = 0;
47
- while (extraPasses++ < 8) {
48
- const added = elementDisposers.get(current);
49
- if (!added || added.length === 0) break;
50
- const moreSnapshot = added.slice();
51
- elementDisposers.delete(current);
52
- if (_isDev) activeBindingCount -= moreSnapshot.length;
53
- for (const d of moreSnapshot) {
54
- try {
55
- d();
56
- } catch (err) {
57
- if (_isDev && typeof console !== "undefined") {
58
- console.warn("[SibuJS] Disposer threw during cleanup:", err);
59
- }
60
- }
61
- }
62
- }
63
- }
64
- }
65
- }
66
- function checkLeaks(warnThreshold = 0) {
67
- if (!_isDev) return 0;
68
- if (warnThreshold > 0 && activeBindingCount > warnThreshold) {
69
- devWarn(
70
- `checkLeaks: ${activeBindingCount} active DOM bindings detected. Expected \u2264${warnThreshold}. This may indicate a component was removed from the DOM without calling dispose().`
71
- );
72
- }
73
- return activeBindingCount;
74
- }
75
-
76
- export {
77
- registerDisposer,
78
- dispose,
79
- checkLeaks
80
- };
@@ -1,34 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/core/dev.ts
8
- function isDev() {
9
- return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
10
- // The bare `__SIBU_DEV__` is a bundler define that only exists in
11
- // production builds; under the test runner it is always undefined, so
12
- // this branch is unreachable here.
13
- /* v8 ignore next 2 */
14
- typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
15
- );
16
- }
17
- var _isDev = isDev();
18
- function devAssert(condition, message) {
19
- if (_isDev && !condition) {
20
- throw new Error(`[SibuJS] ${message}`);
21
- }
22
- }
23
- function devWarn(message) {
24
- if (_isDev) {
25
- console.warn(`[SibuJS] ${message}`);
26
- }
27
- }
28
-
29
- export {
30
- __export,
31
- isDev,
32
- devAssert,
33
- devWarn
34
- };
@@ -1,96 +0,0 @@
1
- import {
2
- isEventHandlerAttr,
3
- sanitizeAttributeString
4
- } from "./chunk-L3GAGWCC.js";
5
- import {
6
- reactiveBinding
7
- } from "./chunk-OOUQUCNN.js";
8
- import {
9
- devWarn,
10
- isDev
11
- } from "./chunk-COY6PUD2.js";
12
-
13
- // src/reactivity/bindAttribute.ts
14
- var _isDev = isDev();
15
- function setProp(el, key, val) {
16
- el[key] = val;
17
- }
18
- function bindAttribute(el, attr, getter) {
19
- if (isEventHandlerAttr(attr)) {
20
- if (_isDev)
21
- devWarn(
22
- `bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
23
- );
24
- return () => {
25
- };
26
- }
27
- function commit() {
28
- let value;
29
- try {
30
- value = getter();
31
- } catch (err) {
32
- if (_isDev)
33
- devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
34
- return;
35
- }
36
- if (typeof value === "boolean") {
37
- if (attr in el && (attr === "checked" || attr === "disabled" || attr === "selected")) {
38
- setProp(el, attr, value);
39
- } else if (value) {
40
- el.setAttribute(attr, "");
41
- } else {
42
- el.removeAttribute(attr);
43
- }
44
- return;
45
- }
46
- const str = String(value);
47
- if ((attr === "value" || attr === "checked") && attr in el) {
48
- setProp(el, attr, attr === "checked" ? Boolean(value) : str);
49
- } else {
50
- el.setAttribute(attr, sanitizeAttributeString(attr, str));
51
- }
52
- }
53
- return reactiveBinding(commit);
54
- }
55
- function bindDynamic(el, nameGetter, valueGetter) {
56
- let prevName = null;
57
- function commit() {
58
- let name;
59
- try {
60
- name = typeof nameGetter === "function" ? nameGetter() : nameGetter;
61
- } catch (err) {
62
- if (_isDev) devWarn(`bindDynamic: name getter threw: ${err instanceof Error ? err.message : String(err)}`);
63
- return;
64
- }
65
- let value;
66
- try {
67
- value = typeof valueGetter === "function" ? valueGetter() : valueGetter;
68
- } catch (err) {
69
- if (_isDev) devWarn(`bindDynamic: value getter threw: ${err instanceof Error ? err.message : String(err)}`);
70
- return;
71
- }
72
- if (isEventHandlerAttr(name)) return;
73
- if (prevName !== null && prevName !== name) {
74
- el.removeAttribute(prevName);
75
- }
76
- const str = String(value);
77
- if ((name === "value" || name === "checked") && name in el) {
78
- setProp(el, name, name === "checked" ? Boolean(value) : str);
79
- } else {
80
- el.setAttribute(name, sanitizeAttributeString(name, str));
81
- }
82
- prevName = name;
83
- }
84
- const teardown = reactiveBinding(commit);
85
- return () => {
86
- teardown();
87
- if (prevName !== null) {
88
- el.removeAttribute(prevName);
89
- }
90
- };
91
- }
92
-
93
- export {
94
- bindAttribute,
95
- bindDynamic
96
- };
@@ -1,111 +0,0 @@
1
- // src/utils/sanitize.ts
2
- function stripControlChars(value) {
3
- return value.replace(/[\x00-\x20\x7f-\x9f]+/g, "");
4
- }
5
- function isEventHandlerAttr(name) {
6
- if (name.length < 3) return false;
7
- const lower = name.toLowerCase();
8
- return lower[0] === "o" && lower[1] === "n" && lower.charCodeAt(2) >= 97 && lower.charCodeAt(2) <= 122;
9
- }
10
- var SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:", "ftp:"];
11
- function sanitizeUrl(url) {
12
- const trimmed = stripControlChars(url).trim();
13
- if (!trimmed) return "";
14
- const lower = trimmed.toLowerCase();
15
- let schemeEnd = -1;
16
- for (let i = 0; i < lower.length; i++) {
17
- const ch = lower.charCodeAt(i);
18
- if (ch === 58) {
19
- schemeEnd = i;
20
- break;
21
- }
22
- if (ch === 47 || ch === 63 || ch === 35) break;
23
- }
24
- if (schemeEnd === -1) return trimmed;
25
- const scheme = lower.slice(0, schemeEnd + 1);
26
- if (!/^[a-z][a-z0-9+.-]*:$/.test(scheme)) return trimmed;
27
- if (SAFE_URL_PROTOCOLS.indexOf(scheme) === -1) return "";
28
- return trimmed;
29
- }
30
- function sanitizeSrcset(value) {
31
- const parts = value.split(",");
32
- const out = [];
33
- for (let i = 0; i < parts.length; i++) {
34
- const part = parts[i].trim();
35
- if (!part) continue;
36
- const m = part.match(/^(\S+)(\s+.+)?$/);
37
- if (!m) continue;
38
- const safe = sanitizeUrl(m[1]);
39
- if (!safe) continue;
40
- out.push(m[2] ? `${safe}${m[2]}` : safe);
41
- }
42
- return out.join(", ");
43
- }
44
- var CSS_DANGER_GATE = /[(:@\\]/;
45
- function sanitizeCSSValue(value) {
46
- if (!CSS_DANGER_GATE.test(value)) return value;
47
- const decoded = value.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (_m, hex) => {
48
- const code = Number.parseInt(hex, 16);
49
- if (!Number.isFinite(code) || code < 0 || code > 1114111) return "";
50
- try {
51
- return String.fromCodePoint(code);
52
- } catch {
53
- return "";
54
- }
55
- });
56
- const lower = decoded.toLowerCase().replace(/\s+/g, "");
57
- if (lower.includes("url(") || lower.includes("expression(") || lower.includes("javascript:") || lower.includes("vbscript:") || lower.includes("-moz-binding") || lower.includes("behavior:") || lower.includes("@import") || lower.includes("image-set(") || lower.includes("filter:progid")) {
58
- return "";
59
- }
60
- return value;
61
- }
62
- function stripHtml(html) {
63
- const input = String(html);
64
- if (typeof DOMParser !== "undefined") {
65
- try {
66
- return new DOMParser().parseFromString(input, "text/html").body.textContent ?? "";
67
- } catch {
68
- }
69
- }
70
- let prev;
71
- let out = input;
72
- do {
73
- prev = out;
74
- out = out.replace(/<[^>]*>/g, "");
75
- } while (out !== prev);
76
- return out.replace(/<[^>]*$/, "");
77
- }
78
- var URL_ATTRIBUTES = /* @__PURE__ */ new Set([
79
- "href",
80
- "xlink:href",
81
- "src",
82
- "action",
83
- "formaction",
84
- "formtarget",
85
- "cite",
86
- "poster",
87
- "background",
88
- "srcset",
89
- "ping",
90
- "data"
91
- ]);
92
- function isUrlAttribute(attr) {
93
- return URL_ATTRIBUTES.has(attr.toLowerCase());
94
- }
95
- function sanitizeAttributeString(attr, value) {
96
- const lower = attr.toLowerCase();
97
- if (lower === "srcset") return sanitizeSrcset(value);
98
- if (URL_ATTRIBUTES.has(lower)) return sanitizeUrl(value);
99
- return value;
100
- }
101
-
102
- export {
103
- stripControlChars,
104
- isEventHandlerAttr,
105
- sanitizeUrl,
106
- sanitizeSrcset,
107
- sanitizeCSSValue,
108
- stripHtml,
109
- isUrlAttribute,
110
- sanitizeAttributeString
111
- };
@@ -1,38 +0,0 @@
1
- import {
2
- signal
3
- } from "./chunk-KZBEVFXZ.js";
4
-
5
- // src/core/rendering/context.ts
6
- function context(defaultValue) {
7
- const [getValue, setValue] = signal(defaultValue);
8
- const ctx = {
9
- provide(value) {
10
- const previous = getValue();
11
- setValue(value);
12
- return () => setValue(previous);
13
- },
14
- use() {
15
- return getValue;
16
- },
17
- get() {
18
- return getValue();
19
- },
20
- set(value) {
21
- setValue(value);
22
- },
23
- withContext(value, fn) {
24
- const previous = getValue();
25
- setValue(value);
26
- try {
27
- return fn();
28
- } finally {
29
- setValue(previous);
30
- }
31
- }
32
- };
33
- return ctx;
34
- }
35
-
36
- export {
37
- context
38
- };