sibujs 4.1.0 → 4.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 +24 -0
- package/dist/browser.cjs +13 -21
- package/dist/browser.js +6 -6
- package/dist/build.cjs +307 -111
- package/dist/build.js +15 -15
- package/dist/cdn.dev.global.js +398 -0
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-ANGSYNPX.js → chunk-2LSY4WDM.js} +86 -44
- package/dist/{chunk-VPP2FONR.js → chunk-2WLZ6757.js} +17 -10
- package/dist/{chunk-DCDS2PQ6.js → chunk-3E5YNK2F.js} +2 -2
- package/dist/{chunk-TIRZCERI.js → chunk-5DXA2J44.js} +1 -1
- package/dist/{chunk-PFTDGEPZ.js → chunk-7BJLKDBI.js} +3 -3
- package/dist/{chunk-XSZRJW76.js → chunk-7BPN4MXR.js} +6 -6
- package/dist/{chunk-BMSN6NWQ.js → chunk-7GQIRV27.js} +6 -6
- package/dist/{chunk-SHDVWATN.js → chunk-7UBG6LDP.js} +7 -8
- package/dist/{chunk-MRAMKDHQ.js → chunk-7UK6BSAT.js} +1 -1
- package/dist/{chunk-LOFZHP6V.js → chunk-AAHT6AKT.js} +7 -8
- package/dist/{chunk-FMHIQNMP.js → chunk-G7GPNB6N.js} +5 -5
- package/dist/{chunk-XIHMS2Y6.js → chunk-GZYQNIPS.js} +8 -8
- package/dist/{chunk-5INI7D2L.js → chunk-IXKSNWV5.js} +74 -11
- package/dist/{chunk-KSOEJGFO.js → chunk-IYHM4FWD.js} +3 -3
- package/dist/{chunk-AW6HPJ3L.js → chunk-KKLW7YWL.js} +1 -1
- package/dist/{chunk-5GJ5RTHA.js → chunk-L4B3Y3OM.js} +7 -8
- package/dist/{chunk-UFSQEO7P.js → chunk-MYA5HEK5.js} +7 -8
- package/dist/{chunk-HYCCIYNS.js → chunk-NIOYEGBQ.js} +13 -14
- package/dist/{chunk-DHDZ7IVN.js → chunk-QKRPLZ2V.js} +7 -8
- package/dist/{chunk-FB7KQXZI.js → chunk-R4EF7V3K.js} +4 -4
- package/dist/{chunk-IM7N5WR4.js → chunk-RE6KLGMV.js} +2 -2
- package/dist/{chunk-D3SZ4LVS.js → chunk-TSL64O5L.js} +5 -6
- package/dist/{chunk-DAKLOMKS.js → chunk-UD6YE2GW.js} +3 -3
- package/dist/{chunk-4U7KD3RY.js → chunk-USS5ENJ2.js} +3 -3
- package/dist/{chunk-I3VI34DP.js → chunk-XGCZ45NH.js} +149 -33
- package/dist/{chunk-4RH6D7GR.js → chunk-ZVYNIUOG.js} +6 -6
- package/dist/{customElement-CKLoO63w.d.ts → customElement-CNZxEB9G.d.cts} +77 -0
- package/dist/{customElement-CKLoO63w.d.cts → customElement-CNZxEB9G.d.ts} +77 -0
- package/dist/data.cjs +15 -24
- package/dist/data.js +9 -9
- package/dist/devtools.cjs +18 -22
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +8 -8
- package/dist/{dispose-4FZ6OFXR.js → dispose-46BOMMQJ.js} +2 -2
- package/dist/ecosystem.cjs +222 -67
- package/dist/ecosystem.js +11 -11
- package/dist/extras.cjs +243 -86
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +25 -25
- package/dist/index.cjs +301 -105
- package/dist/index.d.cts +190 -37
- package/dist/index.d.ts +190 -37
- package/dist/index.js +15 -15
- package/dist/{introspect-RjLfIFpL.d.cts → introspect-D5xF-0Es.d.cts} +7 -0
- package/dist/{introspect-DOZfmC-4.d.ts → introspect-rSBIxEQi.d.ts} +7 -0
- package/dist/motion.cjs +13 -22
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +16 -24
- package/dist/patterns.d.cts +8 -0
- package/dist/patterns.d.ts +8 -0
- package/dist/patterns.js +7 -7
- package/dist/performance.cjs +16 -27
- package/dist/performance.js +9 -9
- package/dist/plugins.cjs +263 -88
- package/dist/plugins.d.cts +102 -2
- package/dist/plugins.d.ts +102 -2
- package/dist/plugins.js +21 -19
- package/dist/{ssr-JFP5535P.js → ssr-Y7XOEPEN.js} +5 -5
- package/dist/ssr.cjs +233 -79
- package/dist/ssr.js +12 -12
- package/dist/testing.cjs +11 -19
- package/dist/testing.js +5 -5
- package/dist/ui.cjs +98 -43
- package/dist/ui.d.cts +7 -1
- package/dist/ui.d.ts +7 -1
- package/dist/ui.js +10 -10
- package/dist/widgets.cjs +13 -21
- package/dist/widgets.d.cts +8 -0
- package/dist/widgets.d.ts +8 -0
- package/dist/widgets.js +9 -9
- package/package.json +5 -2
|
@@ -135,40 +135,42 @@ import {
|
|
|
135
135
|
use,
|
|
136
136
|
var_,
|
|
137
137
|
video
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-7UK6BSAT.js";
|
|
139
139
|
import {
|
|
140
140
|
trustHTML
|
|
141
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-NIOYEGBQ.js";
|
|
142
142
|
import {
|
|
143
143
|
watch
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-IYHM4FWD.js";
|
|
145
145
|
import {
|
|
146
146
|
__resetIdCounter,
|
|
147
147
|
createId
|
|
148
148
|
} from "./chunk-CCSJMTRN.js";
|
|
149
149
|
import {
|
|
150
150
|
context
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-L4B3Y3OM.js";
|
|
152
152
|
import {
|
|
153
153
|
SVG_NS,
|
|
154
154
|
bindChildNode,
|
|
155
|
+
captureFocusWithin,
|
|
156
|
+
restoreFocusWithin,
|
|
155
157
|
tagFactory
|
|
156
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-XGCZ45NH.js";
|
|
157
159
|
import {
|
|
158
160
|
bindAttribute,
|
|
159
161
|
bindDynamic,
|
|
160
162
|
setSafeAttribute
|
|
161
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-7UBG6LDP.js";
|
|
162
164
|
import {
|
|
163
165
|
derived
|
|
164
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-3E5YNK2F.js";
|
|
165
167
|
import {
|
|
166
168
|
globalSingleton
|
|
167
169
|
} from "./chunk-7ZHH77QA.js";
|
|
168
170
|
import {
|
|
169
171
|
effect,
|
|
170
172
|
on
|
|
171
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-7BJLKDBI.js";
|
|
172
174
|
import {
|
|
173
175
|
disableSSR,
|
|
174
176
|
enableSSR,
|
|
@@ -177,7 +179,7 @@ import {
|
|
|
177
179
|
isSSR,
|
|
178
180
|
runInSSRContext,
|
|
179
181
|
withSSR
|
|
180
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-5DXA2J44.js";
|
|
181
183
|
import {
|
|
182
184
|
MAX_DRAIN_TEARDOWNS,
|
|
183
185
|
checkLeaks,
|
|
@@ -186,14 +188,14 @@ import {
|
|
|
186
188
|
replaceChildrenSafely,
|
|
187
189
|
reportDrainRunaway,
|
|
188
190
|
unregisterDisposer
|
|
189
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-QKRPLZ2V.js";
|
|
190
192
|
import {
|
|
191
193
|
batch,
|
|
192
194
|
enqueueBatchedSignal,
|
|
193
195
|
external,
|
|
194
196
|
isBatching,
|
|
195
197
|
signal
|
|
196
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-MYA5HEK5.js";
|
|
197
199
|
import {
|
|
198
200
|
notifySubscribers,
|
|
199
201
|
reactiveBinding,
|
|
@@ -204,17 +206,19 @@ import {
|
|
|
204
206
|
suspendTracking,
|
|
205
207
|
track,
|
|
206
208
|
untracked
|
|
207
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-TSL64O5L.js";
|
|
208
210
|
import {
|
|
211
|
+
DEV,
|
|
209
212
|
__export,
|
|
210
213
|
devAssert,
|
|
211
214
|
devWarn,
|
|
215
|
+
devWarnLazy,
|
|
212
216
|
getRuntimeErrorHandler,
|
|
213
217
|
isDev,
|
|
214
218
|
normalizeError,
|
|
215
219
|
reportError,
|
|
216
220
|
setRuntimeErrorHandler
|
|
217
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-2WLZ6757.js";
|
|
218
222
|
|
|
219
223
|
// index.ts
|
|
220
224
|
var index_exports = {};
|
|
@@ -1749,34 +1753,53 @@ function setGlobalErrorHandler(handler) {
|
|
|
1749
1753
|
|
|
1750
1754
|
// src/core/rendering/directives.ts
|
|
1751
1755
|
function show(condition, element) {
|
|
1756
|
+
const resolved = typeof element === "function" ? element() : element;
|
|
1752
1757
|
const update = () => {
|
|
1753
|
-
|
|
1758
|
+
resolved.style.display = condition() ? "" : "none";
|
|
1754
1759
|
};
|
|
1755
|
-
registerDisposer(
|
|
1756
|
-
return
|
|
1760
|
+
registerDisposer(resolved, track(update));
|
|
1761
|
+
return resolved;
|
|
1762
|
+
}
|
|
1763
|
+
function attachBranch(parent, anchor, branch, attachedOnce, where) {
|
|
1764
|
+
const result = typeof branch === "function" ? branch() : branch;
|
|
1765
|
+
if (result == null || typeof result === "boolean") return { node: null, owned: false };
|
|
1766
|
+
const node = result instanceof Node ? result : document.createTextNode(String(result));
|
|
1767
|
+
const handedIn = node === branch;
|
|
1768
|
+
const seenBefore = attachedOnce.has(node);
|
|
1769
|
+
const owned = !handedIn && !seenBefore;
|
|
1770
|
+
attachedOnce.add(node);
|
|
1771
|
+
if (seenBefore) {
|
|
1772
|
+
devWarnLazy(
|
|
1773
|
+
() => `${where}: ${handedIn ? "a branch was given as an element rather than a function" : "a branch factory returned a node it had already returned"}, so the SAME node is being re-attached \u2014 any state it accumulated while detached (input value, scroll position, classes set imperatively) comes back with it. Its reactive bindings are left intact rather than disposed, because the node is not this directive's to tear down. Return a FRESH node per call (\`() => div(\u2026)\`) for rebuild semantics, or keep this form deliberately when the reuse is what you want.`
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1776
|
+
parent.insertBefore(node, anchor.nextSibling);
|
|
1777
|
+
return { node, owned };
|
|
1757
1778
|
}
|
|
1758
1779
|
function when(condition, thenBranch, elseBranch) {
|
|
1759
1780
|
const anchor = document.createComment("when");
|
|
1760
1781
|
let currentNode = null;
|
|
1761
1782
|
let lastCondition;
|
|
1762
1783
|
let initialized = false;
|
|
1784
|
+
const attachedOnce = /* @__PURE__ */ new WeakSet();
|
|
1785
|
+
let currentNodeOwned = false;
|
|
1763
1786
|
const update = () => {
|
|
1764
1787
|
const show2 = condition();
|
|
1765
1788
|
const parent = anchor.parentNode;
|
|
1766
1789
|
if (!parent) return;
|
|
1767
1790
|
if (initialized && show2 === lastCondition) return;
|
|
1768
1791
|
lastCondition = show2;
|
|
1792
|
+
const focused = currentNode ? captureFocusWithin([currentNode]) : null;
|
|
1769
1793
|
if (currentNode?.parentNode) {
|
|
1770
|
-
dispose(currentNode);
|
|
1794
|
+
if (currentNodeOwned) dispose(currentNode);
|
|
1771
1795
|
currentNode.parentNode.removeChild(currentNode);
|
|
1772
1796
|
currentNode = null;
|
|
1773
1797
|
}
|
|
1774
|
-
const
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
}
|
|
1798
|
+
const branch = show2 ? thenBranch : elseBranch !== void 0 ? elseBranch : null;
|
|
1799
|
+
const attached = attachBranch(parent, anchor, branch, attachedOnce, "when");
|
|
1800
|
+
currentNode = attached.node;
|
|
1801
|
+
currentNodeOwned = attached.owned;
|
|
1802
|
+
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
|
|
1780
1803
|
initialized = true;
|
|
1781
1804
|
};
|
|
1782
1805
|
registerDisposer(anchor, track(update));
|
|
@@ -1792,26 +1815,25 @@ function match(value, cases, fallback) {
|
|
|
1792
1815
|
let currentNode = null;
|
|
1793
1816
|
let lastKey;
|
|
1794
1817
|
let initialized = false;
|
|
1818
|
+
const attachedOnce = /* @__PURE__ */ new WeakSet();
|
|
1819
|
+
let currentNodeOwned = false;
|
|
1795
1820
|
const update = () => {
|
|
1796
1821
|
const key = String(value());
|
|
1797
1822
|
const parent = anchor.parentNode;
|
|
1798
1823
|
if (!parent) return;
|
|
1799
1824
|
if (initialized && key === lastKey) return;
|
|
1800
1825
|
lastKey = key;
|
|
1826
|
+
const focused = currentNode ? captureFocusWithin([currentNode]) : null;
|
|
1801
1827
|
if (currentNode?.parentNode) {
|
|
1802
|
-
dispose(currentNode);
|
|
1828
|
+
if (currentNodeOwned) dispose(currentNode);
|
|
1803
1829
|
currentNode.parentNode.removeChild(currentNode);
|
|
1804
1830
|
currentNode = null;
|
|
1805
1831
|
}
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
parent.insertBefore(node, anchor.nextSibling);
|
|
1812
|
-
currentNode = node;
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1832
|
+
const branch = Object.hasOwn(cases, key) ? cases[key] : fallback;
|
|
1833
|
+
const attached = attachBranch(parent, anchor, branch ?? null, attachedOnce, "match");
|
|
1834
|
+
currentNode = attached.node;
|
|
1835
|
+
currentNodeOwned = attached.owned;
|
|
1836
|
+
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
|
|
1815
1837
|
initialized = true;
|
|
1816
1838
|
};
|
|
1817
1839
|
registerDisposer(anchor, track(update));
|
|
@@ -1856,7 +1878,6 @@ function DynamicComponent(is) {
|
|
|
1856
1878
|
}
|
|
1857
1879
|
|
|
1858
1880
|
// src/core/rendering/each.ts
|
|
1859
|
-
var _isDev = isDev();
|
|
1860
1881
|
function resolveNodeChild(child) {
|
|
1861
1882
|
if (typeof child === "function") {
|
|
1862
1883
|
return resolveNodeChild(child());
|
|
@@ -1947,7 +1968,7 @@ function each(getArray, render, options) {
|
|
|
1947
1968
|
workMap.clear();
|
|
1948
1969
|
keyIndexMap.clear();
|
|
1949
1970
|
for (let i2 = 0; i2 < newLen; i2++) {
|
|
1950
|
-
if (
|
|
1971
|
+
if (DEV && keyIndexMap.has(newKeys[i2])) {
|
|
1951
1972
|
devWarn(
|
|
1952
1973
|
`each: duplicate key "${String(newKeys[i2])}" at index ${i2} (first seen at ${keyIndexMap.get(newKeys[i2])}). Keys must be unique \u2014 duplicates cause rows to be dropped or mis-ordered.`
|
|
1953
1974
|
);
|
|
@@ -2131,7 +2152,6 @@ function resolveChild(child) {
|
|
|
2131
2152
|
}
|
|
2132
2153
|
|
|
2133
2154
|
// src/core/rendering/htm.ts
|
|
2134
|
-
var _isDev2 = isDev();
|
|
2135
2155
|
var RAW_TEXT_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
|
|
2136
2156
|
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
2137
2157
|
"area",
|
|
@@ -2411,7 +2431,7 @@ function executeElement(tmpl, values) {
|
|
|
2411
2431
|
const fn = values[attr.idx];
|
|
2412
2432
|
if (typeof fn === "function") {
|
|
2413
2433
|
el.addEventListener(attr.name, fn);
|
|
2414
|
-
} else if (
|
|
2434
|
+
} else if (DEV) {
|
|
2415
2435
|
devWarn(
|
|
2416
2436
|
`html: on:${attr.name} handler is not a function (got ${typeof fn}). Event listener was not attached.`
|
|
2417
2437
|
);
|
|
@@ -3278,7 +3298,16 @@ function enhance(target, setup) {
|
|
|
3278
3298
|
const teardowns = [];
|
|
3279
3299
|
const owner = /* @__PURE__ */ Symbol("sibujs.enhance");
|
|
3280
3300
|
let disposed = false;
|
|
3281
|
-
|
|
3301
|
+
let closed = false;
|
|
3302
|
+
const isClosed = (method) => {
|
|
3303
|
+
if (!closed) return false;
|
|
3304
|
+
devWarnLazy(
|
|
3305
|
+
() => `enhance: ctx.${method}() was called after this enhancement was rolled back or disposed, so it was ignored. The setup is still running past the point where its transaction ended \u2014 usually an async setup continuing after an await, or a callback it queued before it threw. Registrations made now would belong to nothing: the root carries no enhancement marker and the disposer has already run, so nothing could ever release them.`
|
|
3306
|
+
);
|
|
3307
|
+
return true;
|
|
3308
|
+
};
|
|
3309
|
+
const bind = (method, target_, fn) => {
|
|
3310
|
+
if (isClosed(method)) return;
|
|
3282
3311
|
const el = resolveTarget(root, target_);
|
|
3283
3312
|
if (!el) {
|
|
3284
3313
|
if (typeof console !== "undefined") {
|
|
@@ -3300,14 +3329,14 @@ function enhance(target, setup) {
|
|
|
3300
3329
|
}
|
|
3301
3330
|
},
|
|
3302
3331
|
on: (t, event, handler, options) => {
|
|
3303
|
-
bind(t, (el) => {
|
|
3332
|
+
bind("on", t, (el) => {
|
|
3304
3333
|
const wrapped = (e) => handler(e, el);
|
|
3305
3334
|
el.addEventListener(event, wrapped, options);
|
|
3306
3335
|
teardowns.push(() => el.removeEventListener(event, wrapped, options));
|
|
3307
3336
|
});
|
|
3308
3337
|
},
|
|
3309
3338
|
text: (t, value) => {
|
|
3310
|
-
bind(t, (el) => {
|
|
3339
|
+
bind("text", t, (el) => {
|
|
3311
3340
|
teardowns.push(
|
|
3312
3341
|
bindNode(el, () => {
|
|
3313
3342
|
const v = value();
|
|
@@ -3318,7 +3347,7 @@ function enhance(target, setup) {
|
|
|
3318
3347
|
});
|
|
3319
3348
|
},
|
|
3320
3349
|
attr: (t, name, value) => {
|
|
3321
|
-
bind(t, (el) => {
|
|
3350
|
+
bind("attr", t, (el) => {
|
|
3322
3351
|
teardowns.push(
|
|
3323
3352
|
bindNode(el, () => {
|
|
3324
3353
|
const v = value();
|
|
@@ -3329,7 +3358,7 @@ function enhance(target, setup) {
|
|
|
3329
3358
|
});
|
|
3330
3359
|
},
|
|
3331
3360
|
classed: (t, name, on2) => {
|
|
3332
|
-
bind(t, (el) => {
|
|
3361
|
+
bind("classed", t, (el) => {
|
|
3333
3362
|
teardowns.push(
|
|
3334
3363
|
bindNode(el, () => {
|
|
3335
3364
|
el.classList.toggle(name, Boolean(on2()));
|
|
@@ -3338,7 +3367,7 @@ function enhance(target, setup) {
|
|
|
3338
3367
|
});
|
|
3339
3368
|
},
|
|
3340
3369
|
show: (t, when2) => {
|
|
3341
|
-
bind(t, (el) => {
|
|
3370
|
+
bind("show", t, (el) => {
|
|
3342
3371
|
const prevHidden = el.hidden;
|
|
3343
3372
|
teardowns.push(
|
|
3344
3373
|
bindNode(el, () => {
|
|
@@ -3351,7 +3380,7 @@ function enhance(target, setup) {
|
|
|
3351
3380
|
});
|
|
3352
3381
|
},
|
|
3353
3382
|
model: (t, state, options) => {
|
|
3354
|
-
bind(t, (el) => {
|
|
3383
|
+
bind("model", t, (el) => {
|
|
3355
3384
|
const control = el;
|
|
3356
3385
|
const [get, set] = state;
|
|
3357
3386
|
const evt = options?.event ?? (control instanceof HTMLSelectElement || control instanceof HTMLInputElement && (control.type === "checkbox" || control.type === "radio") ? "change" : "input");
|
|
@@ -3366,6 +3395,7 @@ function enhance(target, setup) {
|
|
|
3366
3395
|
});
|
|
3367
3396
|
},
|
|
3368
3397
|
each: (target_, describe) => {
|
|
3398
|
+
if (isClosed("each")) return;
|
|
3369
3399
|
devAssert(typeof describe === "function", "ctx.each: second argument must be a function.");
|
|
3370
3400
|
const elements = typeof target_ === "string" ? ctx.refs(target_) : Array.from(target_);
|
|
3371
3401
|
for (let i2 = 0; i2 < elements.length; i2++) {
|
|
@@ -3376,14 +3406,25 @@ function enhance(target, setup) {
|
|
|
3376
3406
|
}
|
|
3377
3407
|
},
|
|
3378
3408
|
cleanup: (fn) => {
|
|
3409
|
+
if (isClosed("cleanup")) return;
|
|
3379
3410
|
teardowns.push(fn);
|
|
3380
3411
|
}
|
|
3381
3412
|
};
|
|
3382
3413
|
let extra;
|
|
3383
3414
|
try {
|
|
3384
3415
|
extra = setup(ctx);
|
|
3416
|
+
const returned = extra;
|
|
3417
|
+
if (returned && typeof returned.then === "function") {
|
|
3418
|
+
returned.then(void 0, (reason) => {
|
|
3419
|
+
devWarnLazy(() => `enhance: the promise returned by the setup also rejected: ${String(reason)}`);
|
|
3420
|
+
});
|
|
3421
|
+
throw new Error(
|
|
3422
|
+
(typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) ? "[SibuJS enhance] the setup returned a promise, so its work did not complete inside the enhancement transaction. If it is a lazy import, register it as lazyIsland(() => import(\u2026)): an unwrapped loader is called as a setup, so its module is fetched but the setup it resolves to is discarded. If it is an async setup, make it synchronous \u2014 this enhancement has been rolled back, and ctx registrations made after this point are ignored." : "[SibuJS enhance] setup returned a promise"
|
|
3423
|
+
);
|
|
3424
|
+
}
|
|
3385
3425
|
} catch (err) {
|
|
3386
3426
|
drainTeardowns(teardowns, "enhance");
|
|
3427
|
+
closed = true;
|
|
3387
3428
|
throw err;
|
|
3388
3429
|
}
|
|
3389
3430
|
if (typeof extra === "function") teardowns.push(extra);
|
|
@@ -3396,6 +3437,7 @@ function enhance(target, setup) {
|
|
|
3396
3437
|
}
|
|
3397
3438
|
unregisterDisposer(root, dispose2);
|
|
3398
3439
|
drainTeardowns(teardowns, "enhance");
|
|
3440
|
+
closed = true;
|
|
3399
3441
|
};
|
|
3400
3442
|
registerDisposer(root, dispose2);
|
|
3401
3443
|
enhancementOwner.set(root, owner);
|
|
@@ -11,23 +11,28 @@ var __export = (target, all) => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// src/core/dev.ts
|
|
14
|
+
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
15
|
+
// safe default: off in browser, on in test/dev Node
|
|
16
|
+
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
17
|
+
);
|
|
14
18
|
function isDev() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// this branch is unreachable here.
|
|
19
|
-
/* v8 ignore next 2 */
|
|
20
|
-
typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
21
|
-
);
|
|
19
|
+
if (typeof globalThis.__SIBU_DEV__ !== "undefined") return !!globalThis.__SIBU_DEV__;
|
|
20
|
+
if (typeof __SIBU_DEV__ !== "undefined") return !!__SIBU_DEV__;
|
|
21
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
22
22
|
}
|
|
23
|
-
var _isDev = isDev();
|
|
24
23
|
function devAssert(condition, message) {
|
|
25
|
-
if (
|
|
24
|
+
if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
|
|
26
25
|
throw new Error(`[SibuJS] ${message}`);
|
|
27
26
|
}
|
|
28
27
|
}
|
|
28
|
+
function devWarnLazy(build) {
|
|
29
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
30
|
+
const message = build();
|
|
31
|
+
if (message) console.warn(`[SibuJS] ${message}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
29
34
|
function devWarn(message) {
|
|
30
|
-
if (
|
|
35
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
31
36
|
console.warn(`[SibuJS] ${message}`);
|
|
32
37
|
}
|
|
33
38
|
}
|
|
@@ -132,8 +137,10 @@ function reportError(error, context) {
|
|
|
132
137
|
export {
|
|
133
138
|
__require,
|
|
134
139
|
__export,
|
|
140
|
+
DEV,
|
|
135
141
|
isDev,
|
|
136
142
|
devAssert,
|
|
143
|
+
devWarnLazy,
|
|
137
144
|
devWarn,
|
|
138
145
|
setRuntimeErrorHandler,
|
|
139
146
|
getRuntimeErrorHandler,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
recordDependency,
|
|
4
4
|
retrack,
|
|
5
5
|
track
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TSL64O5L.js";
|
|
7
7
|
import {
|
|
8
8
|
devAssert
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2WLZ6757.js";
|
|
10
10
|
|
|
11
11
|
// src/core/signals/derived.ts
|
|
12
12
|
function derived(getter, options) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isSSR
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5DXA2J44.js";
|
|
4
4
|
import {
|
|
5
5
|
cleanup,
|
|
6
6
|
retrack,
|
|
7
7
|
untracked
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TSL64O5L.js";
|
|
9
9
|
import {
|
|
10
10
|
devAssert,
|
|
11
11
|
reportError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2WLZ6757.js";
|
|
13
13
|
|
|
14
14
|
// src/core/signals/effect.ts
|
|
15
15
|
var _g = globalThis;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
context
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L4B3Y3OM.js";
|
|
4
4
|
import {
|
|
5
5
|
derived
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3E5YNK2F.js";
|
|
7
7
|
import {
|
|
8
8
|
sanitizeUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IXKSNWV5.js";
|
|
10
10
|
import {
|
|
11
11
|
globalSingleton
|
|
12
12
|
} from "./chunk-7ZHH77QA.js";
|
|
13
13
|
import {
|
|
14
14
|
effect
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7BJLKDBI.js";
|
|
16
16
|
import {
|
|
17
17
|
getRequestScopedCache
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5DXA2J44.js";
|
|
19
19
|
import {
|
|
20
20
|
batch,
|
|
21
21
|
signal
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MYA5HEK5.js";
|
|
23
23
|
|
|
24
24
|
// src/data/abort.ts
|
|
25
25
|
function isAbortError(error) {
|
|
@@ -6,29 +6,29 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
div,
|
|
8
8
|
span
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7UK6BSAT.js";
|
|
10
10
|
import {
|
|
11
11
|
STATIC_VALUE_RESOLVER,
|
|
12
12
|
planHeadElementEntry,
|
|
13
13
|
planMetaEntry
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NIOYEGBQ.js";
|
|
15
15
|
import {
|
|
16
16
|
sanitizeUrl
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IXKSNWV5.js";
|
|
18
18
|
import {
|
|
19
19
|
globalSingleton
|
|
20
20
|
} from "./chunk-7ZHH77QA.js";
|
|
21
21
|
import {
|
|
22
22
|
effect
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7BJLKDBI.js";
|
|
24
24
|
import {
|
|
25
25
|
registerDisposer,
|
|
26
26
|
replaceChildrenSafely
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-QKRPLZ2V.js";
|
|
28
28
|
import {
|
|
29
29
|
batch,
|
|
30
30
|
signal
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-MYA5HEK5.js";
|
|
32
32
|
|
|
33
33
|
// src/platform/head.ts
|
|
34
34
|
function escapeScriptJsonLocal(json) {
|
|
@@ -2,18 +2,17 @@ import {
|
|
|
2
2
|
isEventHandlerAttr,
|
|
3
3
|
isHtmlContentAttribute,
|
|
4
4
|
sanitizeAttributeString
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IXKSNWV5.js";
|
|
6
6
|
import {
|
|
7
7
|
reactiveBinding
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TSL64O5L.js";
|
|
9
9
|
import {
|
|
10
|
+
DEV,
|
|
10
11
|
devWarn,
|
|
11
|
-
isDev,
|
|
12
12
|
reportError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2WLZ6757.js";
|
|
14
14
|
|
|
15
15
|
// src/utils/setSafeAttribute.ts
|
|
16
|
-
var _isDev = isDev();
|
|
17
16
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
18
17
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
19
18
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
@@ -36,7 +35,7 @@ function setSafeAttribute(el, name, value, options = {}) {
|
|
|
36
35
|
const ns = namespaceFor(el, name);
|
|
37
36
|
const localName = ns ? name.slice(name.indexOf(":") + 1) : name;
|
|
38
37
|
if (isEventHandlerAttr(name)) {
|
|
39
|
-
if (
|
|
38
|
+
if (DEV) {
|
|
40
39
|
devWarn(
|
|
41
40
|
`${options.label ?? "setSafeAttribute"}: refusing to set event-handler attribute "${name}". Its value would be evaluated as JavaScript. Use on:{ ${name.slice(2)}: fn } instead.`
|
|
42
41
|
);
|
|
@@ -51,7 +50,7 @@ function setSafeAttribute(el, name, value, options = {}) {
|
|
|
51
50
|
return true;
|
|
52
51
|
}
|
|
53
52
|
if (isHtmlContentAttribute(name)) {
|
|
54
|
-
if (
|
|
53
|
+
if (DEV) {
|
|
55
54
|
devWarn(
|
|
56
55
|
`${options.label ?? "setSafeAttribute"}: refusing to set "${name}". The browser parses this attribute as a nested HTML document, so a generic string value cannot be made safe \u2014 attribute escaping is undone before the parse. Build the frame's content another way.`
|
|
57
56
|
);
|
|
@@ -80,7 +79,7 @@ function setSafeAttribute(el, name, value, options = {}) {
|
|
|
80
79
|
setProp(el, idlName, idlName === "checked" ? Boolean(value) : str);
|
|
81
80
|
return true;
|
|
82
81
|
}
|
|
83
|
-
const safe = sanitizeAttributeString(name, str);
|
|
82
|
+
const safe = sanitizeAttributeString(name, str, { element: el });
|
|
84
83
|
const current = ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name);
|
|
85
84
|
if (current === safe) return true;
|
|
86
85
|
if (ns) el.setAttributeNS(ns, name, safe);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sanitizeUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IXKSNWV5.js";
|
|
4
4
|
import {
|
|
5
5
|
globalSingleton
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7BJLKDBI.js";
|
|
10
10
|
import {
|
|
11
11
|
dispose,
|
|
12
12
|
replaceChildrenSafely
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QKRPLZ2V.js";
|
|
14
14
|
import {
|
|
15
15
|
signal
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MYA5HEK5.js";
|
|
17
17
|
import {
|
|
18
|
+
DEV,
|
|
18
19
|
devWarn,
|
|
19
|
-
isDev,
|
|
20
20
|
reportError
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2WLZ6757.js";
|
|
22
22
|
|
|
23
23
|
// src/performance/scheduler.ts
|
|
24
24
|
var Priority = {
|
|
@@ -228,7 +228,6 @@ function uniqueId(suffix) {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// src/performance/domRecycler.ts
|
|
231
|
-
var _isDev = isDev();
|
|
232
231
|
var DOMPool = class {
|
|
233
232
|
constructor(maxSize = 50) {
|
|
234
233
|
this.pools = /* @__PURE__ */ new Map();
|
|
@@ -255,7 +254,7 @@ var DOMPool = class {
|
|
|
255
254
|
* is almost certainly a bug.
|
|
256
255
|
*/
|
|
257
256
|
release(element) {
|
|
258
|
-
if (
|
|
257
|
+
if (DEV && element.isConnected) {
|
|
259
258
|
devWarn(
|
|
260
259
|
"DOMPool.release() called on a still-connected element. Detach it from the DOM first (remove() / dispose())."
|
|
261
260
|
);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IYHM4FWD.js";
|
|
4
4
|
import {
|
|
5
5
|
createId
|
|
6
6
|
} from "./chunk-CCSJMTRN.js";
|
|
7
7
|
import {
|
|
8
8
|
derived
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3E5YNK2F.js";
|
|
10
10
|
import {
|
|
11
11
|
stripHtml
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IXKSNWV5.js";
|
|
13
13
|
import {
|
|
14
14
|
effect
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7BJLKDBI.js";
|
|
16
16
|
import {
|
|
17
17
|
batch,
|
|
18
18
|
signal
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MYA5HEK5.js";
|
|
20
20
|
|
|
21
21
|
// src/widgets/Combobox.ts
|
|
22
22
|
var boundComboboxes = /* @__PURE__ */ new WeakMap();
|