sibujs 1.5.0 → 2.1.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/dist/browser.cjs +332 -121
- package/dist/browser.d.cts +5 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +6 -6
- package/dist/build.cjs +1049 -344
- package/dist/build.js +15 -13
- package/dist/cdn.global.js +17 -16
- package/dist/chunk-2RA7SHDA.js +65 -0
- package/dist/chunk-2UPRY23K.js +80 -0
- package/dist/{chunk-BMPL52BF.js → chunk-3DZP6OIT.js} +118 -66
- package/dist/chunk-3JHCYHWN.js +125 -0
- package/dist/{chunk-CZUGLNJS.js → chunk-45YP72ZQ.js} +3 -3
- package/dist/{chunk-JCDUJN2F.js → chunk-AMK2TYNW.js} +490 -153
- package/dist/{chunk-NHUC2QWH.js → chunk-CWBVQML6.js} +1 -1
- package/dist/{chunk-XHK6BDAJ.js → chunk-DRUZZAK4.js} +25 -8
- package/dist/{chunk-RJ46C3CS.js → chunk-GWWURC5M.js} +71 -20
- package/dist/{chunk-3X2YG6YM.js → chunk-JYD2PWXH.js} +59 -28
- package/dist/{chunk-2BYQDGN3.js → chunk-KGYT6UO6.js} +234 -63
- package/dist/{chunk-5X6PP2UK.js → chunk-LMLD24FC.js} +2 -2
- package/dist/{chunk-M4NLBH4I.js → chunk-LYTCUZ7H.js} +3 -2
- package/dist/{chunk-XUEEGU5O.js → chunk-NASX6ST2.js} +16 -4
- package/dist/{chunk-VQDZK23A.js → chunk-O6EFQ3KT.js} +181 -66
- package/dist/{chunk-BGN5ZMP4.js → chunk-OJ3P4ECI.js} +14 -2
- package/dist/chunk-ON5MMR2J.js +1327 -0
- package/dist/{chunk-SFKNRVCU.js → chunk-P2HSJDDN.js} +135 -79
- package/dist/chunk-QO3WC6FS.js +384 -0
- package/dist/{chunk-WZSPOOER.js → chunk-RDTDJCAB.js} +8 -5
- package/dist/{chunk-7GRNSCFT.js → chunk-TH2ILCYW.js} +312 -185
- package/dist/chunk-UCS6AMJ7.js +79 -0
- package/dist/{chunk-VAPYJN4X.js → chunk-V6C4FADE.js} +93 -23
- package/dist/{chunk-OUZZEE4S.js → chunk-WANSMF2L.js} +17 -11
- package/dist/{chunk-23VV7YD3.js → chunk-WIPZPFBQ.js} +25 -30
- package/dist/chunk-WZA53FXU.js +149 -0
- package/dist/{chunk-BGTHZHJ5.js → chunk-ZAQSMOED.js} +188 -44
- package/dist/{customElement-BL3Uo8dL.d.cts → customElement-CPfIrbvg.d.cts} +14 -10
- package/dist/{customElement-BL3Uo8dL.d.ts → customElement-CPfIrbvg.d.ts} +14 -10
- package/dist/data.cjs +536 -151
- package/dist/data.d.cts +20 -2
- package/dist/data.d.ts +20 -2
- package/dist/data.js +11 -9
- package/dist/devtools.cjs +613 -266
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +12 -6
- package/dist/ecosystem.cjs +602 -197
- package/dist/ecosystem.d.cts +9 -7
- package/dist/ecosystem.d.ts +9 -7
- package/dist/ecosystem.js +12 -11
- package/dist/extras.cjs +3500 -1608
- package/dist/extras.d.cts +9 -9
- package/dist/extras.d.ts +9 -9
- package/dist/extras.js +58 -45
- package/dist/index.cjs +1055 -344
- package/dist/index.d.cts +85 -8
- package/dist/index.d.ts +85 -8
- package/dist/index.js +32 -16
- package/dist/{introspect-BumjnBKr.d.cts → introspect-2TOlQ7oa.d.cts} +25 -3
- package/dist/{introspect-CZrlcaYy.d.ts → introspect-DnIpHQQz.d.ts} +25 -3
- package/dist/motion.cjs +122 -63
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +450 -110
- package/dist/patterns.d.cts +11 -12
- package/dist/patterns.d.ts +11 -12
- package/dist/patterns.js +7 -7
- package/dist/performance.cjs +373 -149
- package/dist/performance.d.cts +23 -16
- package/dist/performance.d.ts +23 -16
- package/dist/performance.js +13 -8
- package/dist/plugin-D30wlGW5.d.cts +71 -0
- package/dist/plugin-D30wlGW5.d.ts +71 -0
- package/dist/plugins.cjs +729 -301
- package/dist/plugins.d.cts +10 -3
- package/dist/plugins.d.ts +10 -3
- package/dist/plugins.js +106 -38
- package/dist/{ssr-Do_SiVoL.d.cts → ssr-CrVNy6Pa.d.cts} +9 -15
- package/dist/{ssr-Do_SiVoL.d.ts → ssr-CrVNy6Pa.d.ts} +9 -15
- package/dist/{ssr-4PBXAOO3.js → ssr-FXD2PPMC.js} +4 -3
- package/dist/ssr.cjs +736 -274
- package/dist/ssr.d.cts +26 -6
- package/dist/ssr.d.ts +26 -6
- package/dist/ssr.js +12 -11
- package/dist/{tagFactory-DaJ0YWX6.d.cts → tagFactory-S17H2qxu.d.cts} +9 -1
- package/dist/{tagFactory-DaJ0YWX6.d.ts → tagFactory-S17H2qxu.d.ts} +9 -1
- package/dist/testing.cjs +303 -76
- package/dist/testing.d.cts +17 -4
- package/dist/testing.d.ts +17 -4
- package/dist/testing.js +100 -44
- package/dist/ui.cjs +589 -178
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +20 -17
- package/dist/widgets.cjs +1103 -146
- package/dist/widgets.d.cts +104 -2
- package/dist/widgets.d.ts +104 -2
- package/dist/widgets.js +9 -7
- package/package.json +8 -2
- package/dist/chunk-32DY64NT.js +0 -282
- package/dist/chunk-3AIRKM3B.js +0 -1263
- package/dist/chunk-3ARAQO7B.js +0 -398
- package/dist/chunk-3CRQALYP.js +0 -877
- package/dist/chunk-4EI4AG32.js +0 -482
- package/dist/chunk-4MYMUBRS.js +0 -21
- package/dist/chunk-5ZYQ6KDD.js +0 -154
- package/dist/chunk-6BMPXPUW.js +0 -26
- package/dist/chunk-6HLLIF3K.js +0 -398
- package/dist/chunk-6LSNVCS2.js +0 -937
- package/dist/chunk-6SA3QQES.js +0 -61
- package/dist/chunk-77L6NL3X.js +0 -1097
- package/dist/chunk-7BF6TK55.js +0 -1097
- package/dist/chunk-7TQKR4PP.js +0 -294
- package/dist/chunk-7V26P53V.js +0 -712
- package/dist/chunk-AZ3ISID5.js +0 -298
- package/dist/chunk-B7SWRFUT.js +0 -332
- package/dist/chunk-BTU3TJDS.js +0 -365
- package/dist/chunk-BW3WT46K.js +0 -937
- package/dist/chunk-C6KFWOFV.js +0 -616
- package/dist/chunk-CHF5OHIA.js +0 -61
- package/dist/chunk-CHJ27IGK.js +0 -26
- package/dist/chunk-CMBFNA7L.js +0 -27
- package/dist/chunk-DAHRH4ON.js +0 -331
- package/dist/chunk-DKOHBI74.js +0 -924
- package/dist/chunk-DTCOOBMX.js +0 -725
- package/dist/chunk-EBGIRKQY.js +0 -616
- package/dist/chunk-EUZND3CB.js +0 -27
- package/dist/chunk-EVCZO745.js +0 -365
- package/dist/chunk-EWFVA3TJ.js +0 -282
- package/dist/chunk-F3FA4F32.js +0 -292
- package/dist/chunk-FGOEVHY3.js +0 -60
- package/dist/chunk-G3BOQPVO.js +0 -365
- package/dist/chunk-GCOK2LC3.js +0 -282
- package/dist/chunk-GJPXRJ45.js +0 -37
- package/dist/chunk-HGMJFBC7.js +0 -654
- package/dist/chunk-JAKHTMQU.js +0 -1000
- package/dist/chunk-JCI5M6U6.js +0 -956
- package/dist/chunk-K4G4ZQNR.js +0 -286
- package/dist/chunk-K5ZUMYVS.js +0 -89
- package/dist/chunk-KQPDEVVS.js +0 -398
- package/dist/chunk-L6JRBDNS.js +0 -60
- package/dist/chunk-LA6KQEDU.js +0 -712
- package/dist/chunk-MB6QFH3I.js +0 -2776
- package/dist/chunk-MDVXJWFN.js +0 -304
- package/dist/chunk-MEZVEBPN.js +0 -2008
- package/dist/chunk-MK4ERFYL.js +0 -2249
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-MQ5GOYPH.js +0 -2249
- package/dist/chunk-MYRV7VDM.js +0 -742
- package/dist/chunk-N6IZB6KJ.js +0 -567
- package/dist/chunk-NEKUBFPT.js +0 -60
- package/dist/chunk-NMRUZALC.js +0 -1097
- package/dist/chunk-NYVAC6P5.js +0 -37
- package/dist/chunk-NZIIMDWI.js +0 -84
- package/dist/chunk-OF7UZIVB.js +0 -725
- package/dist/chunk-P3XWXJZU.js +0 -282
- package/dist/chunk-P6W3STU4.js +0 -2249
- package/dist/chunk-PBHF5WKN.js +0 -616
- package/dist/chunk-PDZQY43A.js +0 -616
- package/dist/chunk-PTQJDMRT.js +0 -146
- package/dist/chunk-PZEGYCF5.js +0 -61
- package/dist/chunk-QBMDLBU2.js +0 -975
- package/dist/chunk-QWZG56ET.js +0 -2744
- package/dist/chunk-RQGQSLQK.js +0 -725
- package/dist/chunk-SDLZDHKP.js +0 -107
- package/dist/chunk-TDGZL5CU.js +0 -365
- package/dist/chunk-TNQWPPE6.js +0 -37
- package/dist/chunk-TSOKIX5Z.js +0 -654
- package/dist/chunk-UHNL42EF.js +0 -2730
- package/dist/chunk-UNXCEF6S.js +0 -21
- package/dist/chunk-V2XTI523.js +0 -347
- package/dist/chunk-VAU366PN.js +0 -2241
- package/dist/chunk-VMVDTCXB.js +0 -712
- package/dist/chunk-VQNQZCWJ.js +0 -61
- package/dist/chunk-VRW3FULF.js +0 -725
- package/dist/chunk-WADYRCO2.js +0 -304
- package/dist/chunk-WILQZRO4.js +0 -282
- package/dist/chunk-WR5D4EGH.js +0 -26
- package/dist/chunk-WUHJISPP.js +0 -298
- package/dist/chunk-XYU6TZOW.js +0 -182
- package/dist/chunk-Y6GP4QGG.js +0 -276
- package/dist/chunk-YECR7UIA.js +0 -347
- package/dist/chunk-YUTWTI4B.js +0 -654
- package/dist/chunk-Z65KYU7I.js +0 -26
- package/dist/chunk-Z6POF5YC.js +0 -975
- package/dist/chunk-ZBJP6WFL.js +0 -482
- package/dist/chunk-ZD6OAMTH.js +0 -277
- package/dist/chunk-ZWKZCBO6.js +0 -317
- package/dist/contracts-DDrwxvJ-.d.cts +0 -245
- package/dist/contracts-DDrwxvJ-.d.ts +0 -245
- package/dist/contracts-DOrhwbke.d.cts +0 -245
- package/dist/contracts-DOrhwbke.d.ts +0 -245
- package/dist/contracts-xo5ckdRP.d.cts +0 -240
- package/dist/contracts-xo5ckdRP.d.ts +0 -240
- package/dist/customElement-BKQfbSZQ.d.cts +0 -262
- package/dist/customElement-BKQfbSZQ.d.ts +0 -262
- package/dist/customElement-D2DJp_xn.d.cts +0 -313
- package/dist/customElement-D2DJp_xn.d.ts +0 -313
- package/dist/customElement-yz8uyk-0.d.cts +0 -308
- package/dist/customElement-yz8uyk-0.d.ts +0 -308
- package/dist/introspect-Cb0zgpi2.d.cts +0 -477
- package/dist/introspect-Y2xNXGSf.d.ts +0 -477
- package/dist/plugin-Bek4RhJY.d.cts +0 -43
- package/dist/plugin-Bek4RhJY.d.ts +0 -43
- package/dist/ssr-3RXHP5ES.js +0 -38
- package/dist/ssr-6GIMY5MX.js +0 -38
- package/dist/ssr-BA6sxxUd.d.cts +0 -135
- package/dist/ssr-BA6sxxUd.d.ts +0 -135
- package/dist/ssr-WKUPVSSK.js +0 -36
- package/dist/tagFactory-Dl8QCLga.d.cts +0 -23
- package/dist/tagFactory-Dl8QCLga.d.ts +0 -23
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
bindAttribute
|
|
2
|
+
bindAttribute
|
|
3
|
+
} from "./chunk-WIPZPFBQ.js";
|
|
4
|
+
import {
|
|
3
5
|
registerDisposer
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2UPRY23K.js";
|
|
5
7
|
import {
|
|
6
8
|
isUrlAttribute,
|
|
7
9
|
sanitizeCSSValue,
|
|
10
|
+
sanitizeSrcset,
|
|
8
11
|
sanitizeUrl
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UCS6AMJ7.js";
|
|
10
13
|
import {
|
|
11
14
|
track
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QO3WC6FS.js";
|
|
13
16
|
import {
|
|
14
17
|
devWarn,
|
|
15
18
|
isDev
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LMLD24FC.js";
|
|
17
20
|
|
|
18
21
|
// src/reactivity/bindChildNode.ts
|
|
19
22
|
var _isDev = isDev();
|
|
@@ -43,24 +46,29 @@ function bindChildNode(placeholder, getter) {
|
|
|
43
46
|
let newNodes;
|
|
44
47
|
if (Array.isArray(result)) {
|
|
45
48
|
newNodes = [];
|
|
49
|
+
const seen = /* @__PURE__ */ new Set();
|
|
46
50
|
for (let i = 0; i < result.length; i++) {
|
|
47
51
|
const item = result[i];
|
|
48
52
|
if (item == null || typeof item === "boolean") continue;
|
|
49
|
-
|
|
53
|
+
const node = item instanceof Node ? item : document.createTextNode(String(item));
|
|
54
|
+
if (seen.has(node)) {
|
|
55
|
+
if (_isDev)
|
|
56
|
+
devWarn("bindChildNode: duplicate node reference in array \u2014 only the first occurrence is rendered.");
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
seen.add(node);
|
|
60
|
+
newNodes.push(node);
|
|
50
61
|
}
|
|
51
62
|
} else {
|
|
52
63
|
const node = result instanceof Node ? result : document.createTextNode(String(result));
|
|
53
64
|
newNodes = [node];
|
|
54
65
|
}
|
|
55
|
-
|
|
56
|
-
if (
|
|
66
|
+
let reused;
|
|
67
|
+
if (lastNodes.length > 0 && newNodes.length > 0) {
|
|
68
|
+
const lastSet = new Set(lastNodes);
|
|
69
|
+
reused = /* @__PURE__ */ new Set();
|
|
57
70
|
for (let i = 0; i < newNodes.length; i++) {
|
|
58
|
-
|
|
59
|
-
if (newNodes[i] === lastNodes[j]) {
|
|
60
|
-
reused.add(newNodes[i]);
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
71
|
+
if (lastSet.has(newNodes[i])) reused.add(newNodes[i]);
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
for (let i = 0; i < lastNodes.length; i++) {
|
|
@@ -86,6 +94,30 @@ function bindChildNode(placeholder, getter) {
|
|
|
86
94
|
|
|
87
95
|
// src/core/rendering/tagFactory.ts
|
|
88
96
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
97
|
+
var _isDev2 = isDev();
|
|
98
|
+
var BLOCKED_TAGS = /* @__PURE__ */ new Set(["script", "iframe", "object", "embed", "frame", "frameset"]);
|
|
99
|
+
function validateTagName(tag) {
|
|
100
|
+
const lower = tag.toLowerCase();
|
|
101
|
+
if (BLOCKED_TAGS.has(lower)) {
|
|
102
|
+
throw new Error(`tagFactory: refusing to create <${tag}> \u2014 tag is blocked for security reasons.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
var CLOBBER_RISKY_IDS = /* @__PURE__ */ new Set([
|
|
106
|
+
"config",
|
|
107
|
+
"location",
|
|
108
|
+
"history",
|
|
109
|
+
"document",
|
|
110
|
+
"window",
|
|
111
|
+
"navigator",
|
|
112
|
+
"name",
|
|
113
|
+
"top",
|
|
114
|
+
"parent",
|
|
115
|
+
"self",
|
|
116
|
+
"frames"
|
|
117
|
+
]);
|
|
118
|
+
function setProp(el, key, val) {
|
|
119
|
+
el[key] = val;
|
|
120
|
+
}
|
|
89
121
|
var kebabCache = /* @__PURE__ */ new Map();
|
|
90
122
|
function toKebab(prop) {
|
|
91
123
|
let cached = kebabCache.get(prop);
|
|
@@ -210,79 +242,103 @@ function appendChildren(el, nodes) {
|
|
|
210
242
|
}
|
|
211
243
|
}
|
|
212
244
|
}
|
|
213
|
-
var tagFactory = (tag, ns) =>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
245
|
+
var tagFactory = (tag, ns) => {
|
|
246
|
+
return (first, second) => {
|
|
247
|
+
validateTagName(tag);
|
|
248
|
+
const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
249
|
+
if (first === void 0) return el;
|
|
250
|
+
if (typeof first === "string") {
|
|
251
|
+
if (second !== void 0) {
|
|
252
|
+
el.setAttribute("class", first);
|
|
253
|
+
appendChildren(el, second);
|
|
254
|
+
return el;
|
|
255
|
+
}
|
|
256
|
+
el.textContent = first;
|
|
220
257
|
return el;
|
|
221
258
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (typeof first === "number") {
|
|
226
|
-
el.textContent = String(first);
|
|
227
|
-
return el;
|
|
228
|
-
}
|
|
229
|
-
if (Array.isArray(first) || first instanceof Node || typeof first === "function") {
|
|
230
|
-
appendChildren(el, first);
|
|
231
|
-
return el;
|
|
232
|
-
}
|
|
233
|
-
const props = first;
|
|
234
|
-
const pClass = props.class;
|
|
235
|
-
if (pClass != null) applyClass(el, pClass);
|
|
236
|
-
const pId = props.id;
|
|
237
|
-
if (pId != null) el.id = pId;
|
|
238
|
-
const pNodes = second !== void 0 ? second : props.nodes;
|
|
239
|
-
if (pNodes != null) appendChildren(el, pNodes);
|
|
240
|
-
const pOn = props.on;
|
|
241
|
-
if (pOn) {
|
|
242
|
-
for (const ev in pOn) {
|
|
243
|
-
el.addEventListener(ev, pOn[ev]);
|
|
259
|
+
if (typeof first === "number") {
|
|
260
|
+
el.textContent = String(first);
|
|
261
|
+
return el;
|
|
244
262
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
263
|
+
if (Array.isArray(first) || first instanceof Node || typeof first === "function") {
|
|
264
|
+
appendChildren(el, first);
|
|
265
|
+
return el;
|
|
266
|
+
}
|
|
267
|
+
const props = first;
|
|
268
|
+
const pClass = props.class;
|
|
269
|
+
if (pClass != null) applyClass(el, pClass);
|
|
270
|
+
const pId = props.id;
|
|
271
|
+
if (pId != null) {
|
|
272
|
+
if (_isDev2 && typeof pId === "string" && CLOBBER_RISKY_IDS.has(pId.toLowerCase())) {
|
|
273
|
+
devWarn(
|
|
274
|
+
`tagFactory: element id="${pId}" matches a common global and may cause DOM clobbering. Avoid setting ids from untrusted input.`
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
el.id = pId;
|
|
278
|
+
}
|
|
279
|
+
const pNodes = second !== void 0 ? second : props.nodes;
|
|
280
|
+
if (pNodes != null) appendChildren(el, pNodes);
|
|
281
|
+
const pOn = props.on;
|
|
282
|
+
if (pOn) {
|
|
283
|
+
for (const ev in pOn) {
|
|
284
|
+
const handler = pOn[ev];
|
|
285
|
+
if (typeof handler === "function") {
|
|
286
|
+
el.addEventListener(ev, handler);
|
|
287
|
+
} else if (_isDev2) {
|
|
288
|
+
devWarn(
|
|
289
|
+
`tagFactory: on.${ev} handler is not a function (got ${typeof handler}). Event listener was not attached.`
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const pStyle = props.style;
|
|
295
|
+
if (pStyle != null) applyStyle(el, pStyle);
|
|
296
|
+
const pRef = props.ref;
|
|
297
|
+
if (pRef) pRef.current = el;
|
|
298
|
+
for (const key in props) {
|
|
299
|
+
switch (key) {
|
|
300
|
+
case "class":
|
|
301
|
+
case "id":
|
|
302
|
+
case "nodes":
|
|
303
|
+
case "on":
|
|
304
|
+
case "style":
|
|
305
|
+
case "ref":
|
|
306
|
+
case "onElement":
|
|
307
|
+
continue;
|
|
308
|
+
// already handled above / below
|
|
309
|
+
default: {
|
|
310
|
+
const value = props[key];
|
|
311
|
+
if (value == null) continue;
|
|
312
|
+
const lkey = key.toLowerCase();
|
|
313
|
+
if (lkey[0] === "o" && lkey[1] === "n") continue;
|
|
314
|
+
if (typeof value === "function") {
|
|
315
|
+
registerDisposer(el, bindAttribute(el, key, value));
|
|
316
|
+
} else if (typeof value === "boolean") {
|
|
317
|
+
if (key in el && (key === "checked" || key === "disabled" || key === "selected")) {
|
|
318
|
+
setProp(el, key, value);
|
|
319
|
+
} else if (value) {
|
|
320
|
+
el.setAttribute(key, "");
|
|
321
|
+
} else {
|
|
322
|
+
el.removeAttribute(key);
|
|
323
|
+
}
|
|
272
324
|
} else {
|
|
273
|
-
|
|
325
|
+
const str = String(value);
|
|
326
|
+
if (lkey === "srcset") {
|
|
327
|
+
el.setAttribute(key, sanitizeSrcset(str));
|
|
328
|
+
} else if (isUrlAttribute(lkey)) {
|
|
329
|
+
el.setAttribute(key, sanitizeUrl(str));
|
|
330
|
+
} else {
|
|
331
|
+
el.setAttribute(key, str);
|
|
332
|
+
}
|
|
274
333
|
}
|
|
275
|
-
} else {
|
|
276
|
-
const str = String(value);
|
|
277
|
-
el.setAttribute(key, isUrlAttribute(key) ? sanitizeUrl(str) : str);
|
|
278
334
|
}
|
|
279
335
|
}
|
|
280
336
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
337
|
+
if (props.onElement && typeof props.onElement === "function") {
|
|
338
|
+
props.onElement(el);
|
|
339
|
+
}
|
|
340
|
+
return el;
|
|
341
|
+
};
|
|
286
342
|
};
|
|
287
343
|
|
|
288
344
|
export {
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import {
|
|
2
|
+
devWarn,
|
|
3
|
+
isDev
|
|
4
|
+
} from "./chunk-LMLD24FC.js";
|
|
5
|
+
|
|
6
|
+
// src/reactivity/track.ts
|
|
7
|
+
var _isDev = isDev();
|
|
8
|
+
var STACK_INITIAL = 32;
|
|
9
|
+
var STACK_SHRINK_THRESHOLD = 128;
|
|
10
|
+
var subscriberStack = new Array(STACK_INITIAL);
|
|
11
|
+
var stackCapacity = STACK_INITIAL;
|
|
12
|
+
var stackTop = -1;
|
|
13
|
+
var currentSubscriber = null;
|
|
14
|
+
var SUBS = "__s";
|
|
15
|
+
function syncFastPath(signal, subs) {
|
|
16
|
+
const size = subs.size;
|
|
17
|
+
if (size === 0) {
|
|
18
|
+
signal.__f = void 0;
|
|
19
|
+
delete signal[SUBS];
|
|
20
|
+
} else if (size === 1) {
|
|
21
|
+
signal.__f = subs.values().next().value;
|
|
22
|
+
} else {
|
|
23
|
+
signal.__f = void 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
var notifyDepth = 0;
|
|
27
|
+
var pendingQueue = [];
|
|
28
|
+
var pendingSet = /* @__PURE__ */ new Set();
|
|
29
|
+
var propagateStack = [];
|
|
30
|
+
function safeInvoke(sub) {
|
|
31
|
+
try {
|
|
32
|
+
sub();
|
|
33
|
+
} catch (err) {
|
|
34
|
+
if (_isDev) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
var suspendDepth = 0;
|
|
38
|
+
var trackingSuspended = false;
|
|
39
|
+
var subscriberEpochCounter = 0;
|
|
40
|
+
function retrack(effectFn, subscriber) {
|
|
41
|
+
const prev = currentSubscriber;
|
|
42
|
+
currentSubscriber = subscriber;
|
|
43
|
+
const sub = subscriber;
|
|
44
|
+
const epoch = ++subscriberEpochCounter;
|
|
45
|
+
sub._epoch = epoch;
|
|
46
|
+
try {
|
|
47
|
+
effectFn();
|
|
48
|
+
} finally {
|
|
49
|
+
currentSubscriber = prev;
|
|
50
|
+
pruneStaleDeps(sub, epoch);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function pruneStaleDeps(sub, currentEpoch) {
|
|
54
|
+
if (sub._dep !== void 0) {
|
|
55
|
+
if (sub._depEpoch !== currentEpoch) {
|
|
56
|
+
const sig = sub._dep;
|
|
57
|
+
const subs = sig[SUBS];
|
|
58
|
+
if (subs?.delete(sub)) syncFastPath(sig, subs);
|
|
59
|
+
sub._dep = void 0;
|
|
60
|
+
sub._depEpoch = void 0;
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const deps = sub._deps;
|
|
65
|
+
if (!deps || deps.size === 0) return;
|
|
66
|
+
let stales;
|
|
67
|
+
for (const [signal, epoch] of deps) {
|
|
68
|
+
if (epoch !== currentEpoch) {
|
|
69
|
+
(stales ?? (stales = [])).push(signal);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!stales) return;
|
|
73
|
+
for (const signal of stales) {
|
|
74
|
+
deps.delete(signal);
|
|
75
|
+
const sig = signal;
|
|
76
|
+
const subs = sig[SUBS];
|
|
77
|
+
if (subs?.delete(sub)) syncFastPath(sig, subs);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function track(effectFn, subscriber) {
|
|
81
|
+
if (!subscriber) subscriber = effectFn;
|
|
82
|
+
cleanup(subscriber);
|
|
83
|
+
++stackTop;
|
|
84
|
+
if (stackTop >= stackCapacity) {
|
|
85
|
+
stackCapacity *= 2;
|
|
86
|
+
subscriberStack.length = stackCapacity;
|
|
87
|
+
}
|
|
88
|
+
subscriberStack[stackTop] = subscriber;
|
|
89
|
+
currentSubscriber = subscriber;
|
|
90
|
+
try {
|
|
91
|
+
effectFn();
|
|
92
|
+
} finally {
|
|
93
|
+
stackTop--;
|
|
94
|
+
currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
|
|
95
|
+
if (stackTop < 0 && stackCapacity > STACK_SHRINK_THRESHOLD) {
|
|
96
|
+
stackCapacity = Math.max(STACK_INITIAL, stackCapacity >>> 1);
|
|
97
|
+
subscriberStack.length = stackCapacity;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return () => cleanup(subscriber);
|
|
101
|
+
}
|
|
102
|
+
function suspendTracking() {
|
|
103
|
+
if (suspendDepth === 0) {
|
|
104
|
+
++stackTop;
|
|
105
|
+
if (stackTop >= stackCapacity) {
|
|
106
|
+
stackCapacity *= 2;
|
|
107
|
+
subscriberStack.length = stackCapacity;
|
|
108
|
+
}
|
|
109
|
+
subscriberStack[stackTop] = null;
|
|
110
|
+
currentSubscriber = null;
|
|
111
|
+
trackingSuspended = true;
|
|
112
|
+
}
|
|
113
|
+
suspendDepth++;
|
|
114
|
+
}
|
|
115
|
+
function resumeTracking() {
|
|
116
|
+
suspendDepth--;
|
|
117
|
+
if (suspendDepth === 0) {
|
|
118
|
+
stackTop--;
|
|
119
|
+
currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
|
|
120
|
+
trackingSuspended = false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function untracked(fn) {
|
|
124
|
+
suspendTracking();
|
|
125
|
+
try {
|
|
126
|
+
return fn();
|
|
127
|
+
} finally {
|
|
128
|
+
resumeTracking();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function recordDependency(signal) {
|
|
132
|
+
if (!currentSubscriber) return;
|
|
133
|
+
const sub = currentSubscriber;
|
|
134
|
+
const epoch = sub._epoch;
|
|
135
|
+
if (sub._dep === signal) {
|
|
136
|
+
sub._depEpoch = epoch;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const deps = sub._deps;
|
|
140
|
+
if (deps) {
|
|
141
|
+
deps.set(signal, epoch);
|
|
142
|
+
} else if (sub._dep !== void 0) {
|
|
143
|
+
const map = /* @__PURE__ */ new Map();
|
|
144
|
+
map.set(sub._dep, sub._depEpoch);
|
|
145
|
+
map.set(signal, epoch);
|
|
146
|
+
sub._deps = map;
|
|
147
|
+
sub._dep = void 0;
|
|
148
|
+
sub._depEpoch = void 0;
|
|
149
|
+
} else {
|
|
150
|
+
sub._dep = signal;
|
|
151
|
+
sub._depEpoch = epoch;
|
|
152
|
+
}
|
|
153
|
+
const sig = signal;
|
|
154
|
+
let subs = sig[SUBS];
|
|
155
|
+
if (!subs) {
|
|
156
|
+
subs = /* @__PURE__ */ new Set();
|
|
157
|
+
sig[SUBS] = subs;
|
|
158
|
+
}
|
|
159
|
+
const prevSize = subs.size;
|
|
160
|
+
subs.add(currentSubscriber);
|
|
161
|
+
if (subs.size !== prevSize) {
|
|
162
|
+
if (subs.size === 1) {
|
|
163
|
+
sig.__f = currentSubscriber;
|
|
164
|
+
} else if (sig.__f !== void 0) {
|
|
165
|
+
sig.__f = void 0;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function queueSignalNotification(signal) {
|
|
170
|
+
const subs = signal[SUBS];
|
|
171
|
+
if (!subs) return;
|
|
172
|
+
for (const sub of subs) {
|
|
173
|
+
if (sub._c) {
|
|
174
|
+
propagateDirty(sub);
|
|
175
|
+
} else if (!pendingSet.has(sub)) {
|
|
176
|
+
pendingSet.add(sub);
|
|
177
|
+
pendingQueue.push(sub);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
var maxSubscriberRepeats = 50;
|
|
182
|
+
var maxDrainIterations = 1e6;
|
|
183
|
+
var drainEpoch = 0;
|
|
184
|
+
function setMaxDrainIterations(n) {
|
|
185
|
+
const prev = maxDrainIterations;
|
|
186
|
+
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
187
|
+
return prev;
|
|
188
|
+
}
|
|
189
|
+
function tickRepeat(sub) {
|
|
190
|
+
const s = sub;
|
|
191
|
+
if (s._runEpoch !== drainEpoch) {
|
|
192
|
+
s._runEpoch = drainEpoch;
|
|
193
|
+
s._runs = 1;
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
return ++s._runs > maxSubscriberRepeats;
|
|
197
|
+
}
|
|
198
|
+
function cycleError(sub) {
|
|
199
|
+
if (typeof console !== "undefined") {
|
|
200
|
+
const name = sub.__name ?? "<unnamed>";
|
|
201
|
+
console.error(
|
|
202
|
+
`[SibuJS] subscriber "${name}" fired more than ${maxSubscriberRepeats} times \u2014 likely a write-reads-self cycle between effects/signals. Breaking to prevent infinite loop.`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function absoluteDrainError() {
|
|
207
|
+
if (typeof console !== "undefined") {
|
|
208
|
+
console.error(
|
|
209
|
+
`[SibuJS] Notification drain exceeded ${maxDrainIterations} iterations \u2014 absolute safety net tripped. Breaking to prevent infinite loop.`
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function drainQueue() {
|
|
214
|
+
let i = 0;
|
|
215
|
+
while (i < pendingQueue.length) {
|
|
216
|
+
if (i >= maxDrainIterations) {
|
|
217
|
+
absoluteDrainError();
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
const sub = pendingQueue[i++];
|
|
221
|
+
if (tickRepeat(sub)) {
|
|
222
|
+
cycleError(sub);
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
pendingSet.delete(sub);
|
|
226
|
+
safeInvoke(sub);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function drainNotificationQueue() {
|
|
230
|
+
if (notifyDepth > 0) return;
|
|
231
|
+
notifyDepth++;
|
|
232
|
+
drainEpoch++;
|
|
233
|
+
try {
|
|
234
|
+
drainQueue();
|
|
235
|
+
} finally {
|
|
236
|
+
notifyDepth--;
|
|
237
|
+
if (notifyDepth === 0) {
|
|
238
|
+
pendingQueue.length = 0;
|
|
239
|
+
pendingSet.clear();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function propagateDirty(sub) {
|
|
244
|
+
sub();
|
|
245
|
+
const rootSig = sub._sig;
|
|
246
|
+
if (!rootSig) return;
|
|
247
|
+
const stack = propagateStack;
|
|
248
|
+
const baseLen = stack.length;
|
|
249
|
+
stack.push(rootSig);
|
|
250
|
+
while (stack.length > baseLen) {
|
|
251
|
+
const sig = stack.pop();
|
|
252
|
+
const first = sig.__f;
|
|
253
|
+
if (first) {
|
|
254
|
+
if (first._c) {
|
|
255
|
+
const nSig = first._sig;
|
|
256
|
+
if (!nSig._d) {
|
|
257
|
+
nSig._d = true;
|
|
258
|
+
stack.push(nSig);
|
|
259
|
+
}
|
|
260
|
+
} else if (!pendingSet.has(first)) {
|
|
261
|
+
pendingSet.add(first);
|
|
262
|
+
pendingQueue.push(first);
|
|
263
|
+
}
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const subs = sig[SUBS];
|
|
267
|
+
if (!subs) continue;
|
|
268
|
+
for (const s of subs) {
|
|
269
|
+
if (s._c) {
|
|
270
|
+
const nSig = s._sig;
|
|
271
|
+
if (nSig && !nSig._d) {
|
|
272
|
+
nSig._d = true;
|
|
273
|
+
stack.push(nSig);
|
|
274
|
+
} else if (!nSig) {
|
|
275
|
+
s();
|
|
276
|
+
}
|
|
277
|
+
} else if (!pendingSet.has(s)) {
|
|
278
|
+
pendingSet.add(s);
|
|
279
|
+
pendingQueue.push(s);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function notifySubscribers(signal) {
|
|
285
|
+
const first = signal.__f;
|
|
286
|
+
if (first) {
|
|
287
|
+
if (notifyDepth > 0) {
|
|
288
|
+
if (first._c) {
|
|
289
|
+
propagateDirty(first);
|
|
290
|
+
} else if (!pendingSet.has(first)) {
|
|
291
|
+
pendingSet.add(first);
|
|
292
|
+
pendingQueue.push(first);
|
|
293
|
+
}
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
notifyDepth++;
|
|
297
|
+
drainEpoch++;
|
|
298
|
+
try {
|
|
299
|
+
if (first._c) {
|
|
300
|
+
propagateDirty(first);
|
|
301
|
+
} else if (tickRepeat(first)) {
|
|
302
|
+
cycleError(first);
|
|
303
|
+
} else {
|
|
304
|
+
safeInvoke(first);
|
|
305
|
+
}
|
|
306
|
+
drainQueue();
|
|
307
|
+
} finally {
|
|
308
|
+
notifyDepth--;
|
|
309
|
+
if (notifyDepth === 0) {
|
|
310
|
+
pendingQueue.length = 0;
|
|
311
|
+
pendingSet.clear();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const subs = signal[SUBS];
|
|
317
|
+
if (!subs || subs.size === 0) return;
|
|
318
|
+
if (notifyDepth > 0) {
|
|
319
|
+
for (const sub of subs) {
|
|
320
|
+
if (sub._c) {
|
|
321
|
+
propagateDirty(sub);
|
|
322
|
+
} else if (!pendingSet.has(sub)) {
|
|
323
|
+
pendingSet.add(sub);
|
|
324
|
+
pendingQueue.push(sub);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
notifyDepth++;
|
|
330
|
+
drainEpoch++;
|
|
331
|
+
try {
|
|
332
|
+
for (const sub of subs) {
|
|
333
|
+
if (sub._c) {
|
|
334
|
+
propagateDirty(sub);
|
|
335
|
+
} else if (!pendingSet.has(sub)) {
|
|
336
|
+
pendingSet.add(sub);
|
|
337
|
+
pendingQueue.push(sub);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
drainQueue();
|
|
341
|
+
} finally {
|
|
342
|
+
notifyDepth--;
|
|
343
|
+
if (notifyDepth === 0) {
|
|
344
|
+
pendingQueue.length = 0;
|
|
345
|
+
pendingSet.clear();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function cleanup(subscriber) {
|
|
350
|
+
const sub = subscriber;
|
|
351
|
+
const singleDep = sub._dep;
|
|
352
|
+
if (singleDep !== void 0) {
|
|
353
|
+
const sig = singleDep;
|
|
354
|
+
const subs = sig[SUBS];
|
|
355
|
+
if (subs?.delete(subscriber)) {
|
|
356
|
+
syncFastPath(sig, subs);
|
|
357
|
+
}
|
|
358
|
+
sub._dep = void 0;
|
|
359
|
+
sub._depEpoch = void 0;
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const deps = sub._deps;
|
|
363
|
+
if (!deps || deps.size === 0) return;
|
|
364
|
+
for (const signal of deps.keys()) {
|
|
365
|
+
const sig = signal;
|
|
366
|
+
const subs = sig[SUBS];
|
|
367
|
+
if (subs?.delete(subscriber)) {
|
|
368
|
+
syncFastPath(sig, subs);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
deps.clear();
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export {
|
|
375
|
+
trackingSuspended,
|
|
376
|
+
retrack,
|
|
377
|
+
track,
|
|
378
|
+
untracked,
|
|
379
|
+
recordDependency,
|
|
380
|
+
queueSignalNotification,
|
|
381
|
+
setMaxDrainIterations,
|
|
382
|
+
drainNotificationQueue,
|
|
383
|
+
notifySubscribers
|
|
384
|
+
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
notifySubscribers,
|
|
4
4
|
queueSignalNotification,
|
|
5
5
|
recordDependency
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QO3WC6FS.js";
|
|
7
7
|
import {
|
|
8
8
|
isDev
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LMLD24FC.js";
|
|
10
10
|
|
|
11
11
|
// src/reactivity/batch.ts
|
|
12
12
|
var batchDepth = 0;
|
|
@@ -31,10 +31,13 @@ function isBatching() {
|
|
|
31
31
|
return batchDepth > 0;
|
|
32
32
|
}
|
|
33
33
|
function flushBatch() {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
try {
|
|
35
|
+
for (const signal2 of pendingSignals) {
|
|
36
|
+
queueSignalNotification(signal2);
|
|
37
|
+
}
|
|
38
|
+
} finally {
|
|
39
|
+
pendingSignals.clear();
|
|
36
40
|
}
|
|
37
|
-
pendingSignals.clear();
|
|
38
41
|
drainNotificationQueue();
|
|
39
42
|
}
|
|
40
43
|
|