sibujs 1.2.0 → 1.4.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 +655 -237
- package/dist/build.js +15 -93
- 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-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-CNZ35WI2.js +178 -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-JAKHTMQU.js +1000 -0
- package/dist/chunk-JCI5M6U6.js +956 -0
- package/dist/chunk-KQPDEVVS.js +398 -0
- package/dist/chunk-M4NLBH4I.js +725 -0
- package/dist/chunk-NEKUBFPT.js +60 -0
- package/dist/chunk-NYVAC6P5.js +37 -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-UHNL42EF.js +2730 -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/chunk-ZWKZCBO6.js +317 -0
- package/dist/contracts-DDrwxvJ-.d.cts +245 -0
- package/dist/contracts-DDrwxvJ-.d.ts +245 -0
- package/dist/contracts-xo5ckdRP.d.cts +240 -0
- package/dist/contracts-xo5ckdRP.d.ts +240 -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 +23 -6
- package/dist/ecosystem.d.cts +1 -1
- package/dist/ecosystem.d.ts +1 -1
- package/dist/ecosystem.js +10 -9
- package/dist/extras.cjs +1208 -88
- package/dist/extras.d.cts +6 -6
- package/dist/extras.d.ts +6 -6
- package/dist/extras.js +70 -33
- package/dist/index.cjs +663 -158
- package/dist/index.d.cts +398 -40
- package/dist/index.d.ts +398 -40
- package/dist/index.js +39 -21
- 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 -24
- package/dist/patterns.d.cts +19 -57
- package/dist/patterns.d.ts +19 -57
- package/dist/patterns.js +8 -16
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +429 -82
- 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 +312 -60
- 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 -8
- package/dist/ui.d.cts +252 -2
- package/dist/ui.d.ts +252 -2
- package/dist/ui.js +329 -11
- package/dist/widgets.js +7 -7
- package/package.json +1 -1
package/dist/build.cjs
CHANGED
|
@@ -633,7 +633,6 @@ function injectPureAnnotations(code2) {
|
|
|
633
633
|
const sibuFactories = [
|
|
634
634
|
"tagFactory",
|
|
635
635
|
"context",
|
|
636
|
-
"composable",
|
|
637
636
|
"defineComponent",
|
|
638
637
|
"withProps",
|
|
639
638
|
"withDefaults",
|
|
@@ -855,7 +854,6 @@ function deepMerge(target, source2) {
|
|
|
855
854
|
var PURE_FACTORIES = [
|
|
856
855
|
"tagFactory",
|
|
857
856
|
"context",
|
|
858
|
-
"composable",
|
|
859
857
|
"defineComponent",
|
|
860
858
|
"withProps",
|
|
861
859
|
"withDefaults",
|
|
@@ -1059,12 +1057,14 @@ var index_exports = {};
|
|
|
1059
1057
|
__export(index_exports, {
|
|
1060
1058
|
DynamicComponent: () => DynamicComponent,
|
|
1061
1059
|
ErrorBoundary: () => ErrorBoundary,
|
|
1060
|
+
ErrorDisplay: () => ErrorDisplay,
|
|
1062
1061
|
Fragment: () => Fragment,
|
|
1063
1062
|
KeepAlive: () => KeepAlive,
|
|
1064
1063
|
Loading: () => Loading,
|
|
1065
1064
|
Portal: () => Portal,
|
|
1066
1065
|
SVG_NS: () => SVG_NS,
|
|
1067
1066
|
Suspense: () => Suspense,
|
|
1067
|
+
__resetIdCounter: () => __resetIdCounter,
|
|
1068
1068
|
a: () => a,
|
|
1069
1069
|
abbr: () => abbr,
|
|
1070
1070
|
action: () => action,
|
|
@@ -1073,6 +1073,7 @@ __export(index_exports, {
|
|
|
1073
1073
|
array: () => array,
|
|
1074
1074
|
article: () => article,
|
|
1075
1075
|
aside: () => aside,
|
|
1076
|
+
asyncDerived: () => asyncDerived,
|
|
1076
1077
|
audio: () => audio,
|
|
1077
1078
|
autoResize: () => autoResize,
|
|
1078
1079
|
b: () => b,
|
|
@@ -1100,12 +1101,14 @@ __export(index_exports, {
|
|
|
1100
1101
|
colgroup: () => colgroup,
|
|
1101
1102
|
context: () => context,
|
|
1102
1103
|
copyOnClick: () => copyOnClick,
|
|
1104
|
+
createId: () => createId,
|
|
1103
1105
|
customElement: () => customElement,
|
|
1104
1106
|
data: () => data,
|
|
1105
1107
|
datalist: () => datalist,
|
|
1106
1108
|
dd: () => dd,
|
|
1107
1109
|
deepEqual: () => deepEqual,
|
|
1108
1110
|
deepSignal: () => deepSignal,
|
|
1111
|
+
defer: () => defer,
|
|
1109
1112
|
defs: () => defs,
|
|
1110
1113
|
del: () => del,
|
|
1111
1114
|
derived: () => derived,
|
|
@@ -1166,13 +1169,12 @@ __export(index_exports, {
|
|
|
1166
1169
|
mask: () => mask,
|
|
1167
1170
|
match: () => match,
|
|
1168
1171
|
math: () => math,
|
|
1169
|
-
memo: () => memo,
|
|
1170
|
-
memoFn: () => memoFn,
|
|
1171
1172
|
menu: () => menu,
|
|
1172
1173
|
meta: () => meta,
|
|
1173
1174
|
meter: () => meter,
|
|
1174
1175
|
mount: () => mount,
|
|
1175
1176
|
nav: () => nav,
|
|
1177
|
+
nextTick: () => nextTick,
|
|
1176
1178
|
noscript: () => noscript,
|
|
1177
1179
|
object: () => object,
|
|
1178
1180
|
ol: () => ol,
|
|
@@ -1218,6 +1220,8 @@ __export(index_exports, {
|
|
|
1218
1220
|
span: () => span,
|
|
1219
1221
|
stop: () => stop,
|
|
1220
1222
|
store: () => store,
|
|
1223
|
+
strict: () => strict,
|
|
1224
|
+
strictEffect: () => strictEffect,
|
|
1221
1225
|
strong: () => strong,
|
|
1222
1226
|
style: () => style,
|
|
1223
1227
|
sub: () => sub,
|
|
@@ -1239,6 +1243,7 @@ __export(index_exports, {
|
|
|
1239
1243
|
title: () => title,
|
|
1240
1244
|
tr: () => tr,
|
|
1241
1245
|
track: () => track2,
|
|
1246
|
+
transition: () => transition,
|
|
1242
1247
|
trapFocus: () => trapFocus,
|
|
1243
1248
|
tspan: () => tspan,
|
|
1244
1249
|
u: () => u,
|
|
@@ -1557,7 +1562,20 @@ function cleanup(subscriber) {
|
|
|
1557
1562
|
|
|
1558
1563
|
// src/reactivity/bindAttribute.ts
|
|
1559
1564
|
var _isDev3 = isDev();
|
|
1565
|
+
function isEventHandlerAttr(name) {
|
|
1566
|
+
if (name.length < 3) return false;
|
|
1567
|
+
const lower = name.toLowerCase();
|
|
1568
|
+
return lower[0] === "o" && lower[1] === "n" && lower.charCodeAt(2) >= 97 && lower.charCodeAt(2) <= 122;
|
|
1569
|
+
}
|
|
1560
1570
|
function bindAttribute(el, attr, getter) {
|
|
1571
|
+
if (isEventHandlerAttr(attr)) {
|
|
1572
|
+
if (_isDev3)
|
|
1573
|
+
devWarn(
|
|
1574
|
+
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
1575
|
+
);
|
|
1576
|
+
return () => {
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1561
1579
|
function commit() {
|
|
1562
1580
|
let value;
|
|
1563
1581
|
try {
|
|
@@ -1867,16 +1885,20 @@ function appendChildren(el, nodes) {
|
|
|
1867
1885
|
var tagFactory = (tag, ns) => (first, second) => {
|
|
1868
1886
|
const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
1869
1887
|
if (first === void 0) return el;
|
|
1870
|
-
if (
|
|
1888
|
+
if (typeof first === "string") {
|
|
1889
|
+
if (second !== void 0) {
|
|
1890
|
+
el.setAttribute("class", first);
|
|
1891
|
+
appendChildren(el, second);
|
|
1892
|
+
return el;
|
|
1893
|
+
}
|
|
1871
1894
|
el.textContent = first;
|
|
1872
1895
|
return el;
|
|
1873
1896
|
}
|
|
1874
|
-
if (
|
|
1875
|
-
el.
|
|
1876
|
-
appendChildren(el, second);
|
|
1897
|
+
if (typeof first === "number") {
|
|
1898
|
+
el.textContent = String(first);
|
|
1877
1899
|
return el;
|
|
1878
1900
|
}
|
|
1879
|
-
if (Array.isArray(first) || first instanceof Node) {
|
|
1901
|
+
if (Array.isArray(first) || first instanceof Node || typeof first === "function") {
|
|
1880
1902
|
appendChildren(el, first);
|
|
1881
1903
|
return el;
|
|
1882
1904
|
}
|
|
@@ -1885,7 +1907,7 @@ var tagFactory = (tag, ns) => (first, second) => {
|
|
|
1885
1907
|
if (pClass != null) applyClass(el, pClass);
|
|
1886
1908
|
const pId = props.id;
|
|
1887
1909
|
if (pId != null) el.id = pId;
|
|
1888
|
-
const pNodes = props.nodes;
|
|
1910
|
+
const pNodes = second !== void 0 ? second : props.nodes;
|
|
1889
1911
|
if (pNodes != null) appendChildren(el, pNodes);
|
|
1890
1912
|
const pOn = props.on;
|
|
1891
1913
|
if (pOn) {
|
|
@@ -2969,6 +2991,16 @@ function setGlobalErrorHandler(handler) {
|
|
|
2969
2991
|
globalErrorHandler = handler;
|
|
2970
2992
|
}
|
|
2971
2993
|
|
|
2994
|
+
// src/core/rendering/createId.ts
|
|
2995
|
+
var idCounter = 0;
|
|
2996
|
+
function createId(prefix = "sibu") {
|
|
2997
|
+
idCounter++;
|
|
2998
|
+
return `${prefix}-${idCounter}`;
|
|
2999
|
+
}
|
|
3000
|
+
function __resetIdCounter() {
|
|
3001
|
+
idCounter = 0;
|
|
3002
|
+
}
|
|
3003
|
+
|
|
2972
3004
|
// src/reactivity/batch.ts
|
|
2973
3005
|
var batchDepth = 0;
|
|
2974
3006
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
@@ -3049,11 +3081,12 @@ function disableSSR() {
|
|
|
3049
3081
|
ssrMode = false;
|
|
3050
3082
|
}
|
|
3051
3083
|
function withSSR(fn) {
|
|
3084
|
+
const wasSSR = ssrMode;
|
|
3052
3085
|
enableSSR();
|
|
3053
3086
|
try {
|
|
3054
3087
|
return fn();
|
|
3055
3088
|
} finally {
|
|
3056
|
-
disableSSR();
|
|
3089
|
+
if (!wasSSR) disableSSR();
|
|
3057
3090
|
}
|
|
3058
3091
|
}
|
|
3059
3092
|
|
|
@@ -3266,16 +3299,6 @@ function ref(initial) {
|
|
|
3266
3299
|
};
|
|
3267
3300
|
}
|
|
3268
3301
|
|
|
3269
|
-
// src/core/signals/memo.ts
|
|
3270
|
-
function memo(factory) {
|
|
3271
|
-
return derived(factory);
|
|
3272
|
-
}
|
|
3273
|
-
|
|
3274
|
-
// src/core/signals/memoFn.ts
|
|
3275
|
-
function memoFn(callback) {
|
|
3276
|
-
return derived(callback);
|
|
3277
|
-
}
|
|
3278
|
-
|
|
3279
3302
|
// src/core/signals/array.ts
|
|
3280
3303
|
function array(initial = []) {
|
|
3281
3304
|
const [arr, setArr] = signal([...initial]);
|
|
@@ -3503,6 +3526,47 @@ function writable(get, set, options) {
|
|
|
3503
3526
|
return [getter, setter];
|
|
3504
3527
|
}
|
|
3505
3528
|
|
|
3529
|
+
// src/core/signals/asyncDerived.ts
|
|
3530
|
+
function asyncDerived(factory, initial) {
|
|
3531
|
+
const [value, setValue] = signal(initial);
|
|
3532
|
+
const [loading, setLoading] = signal(false);
|
|
3533
|
+
const [error, setError] = signal(null);
|
|
3534
|
+
const [tick, setTick] = signal(0);
|
|
3535
|
+
let runId = 0;
|
|
3536
|
+
effect(() => {
|
|
3537
|
+
tick();
|
|
3538
|
+
const currentRun = ++runId;
|
|
3539
|
+
setLoading(true);
|
|
3540
|
+
setError(null);
|
|
3541
|
+
let promise;
|
|
3542
|
+
try {
|
|
3543
|
+
promise = factory();
|
|
3544
|
+
} catch (err) {
|
|
3545
|
+
setError(err);
|
|
3546
|
+
setLoading(false);
|
|
3547
|
+
return;
|
|
3548
|
+
}
|
|
3549
|
+
promise.then(
|
|
3550
|
+
(result) => {
|
|
3551
|
+
if (currentRun !== runId) return;
|
|
3552
|
+
setValue(result);
|
|
3553
|
+
setLoading(false);
|
|
3554
|
+
},
|
|
3555
|
+
(err) => {
|
|
3556
|
+
if (currentRun !== runId) return;
|
|
3557
|
+
setError(err);
|
|
3558
|
+
setLoading(false);
|
|
3559
|
+
}
|
|
3560
|
+
);
|
|
3561
|
+
});
|
|
3562
|
+
return {
|
|
3563
|
+
value,
|
|
3564
|
+
loading,
|
|
3565
|
+
error,
|
|
3566
|
+
refresh: () => setTick((n) => n + 1)
|
|
3567
|
+
};
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3506
3570
|
// src/core/rendering/lifecycle.ts
|
|
3507
3571
|
function safeCall(cb, hookName) {
|
|
3508
3572
|
try {
|
|
@@ -3581,6 +3645,116 @@ function context(defaultValue) {
|
|
|
3581
3645
|
};
|
|
3582
3646
|
}
|
|
3583
3647
|
|
|
3648
|
+
// src/core/strict.ts
|
|
3649
|
+
function strict(fn) {
|
|
3650
|
+
const result = fn();
|
|
3651
|
+
if (isDev()) {
|
|
3652
|
+
queueMicrotask(() => {
|
|
3653
|
+
try {
|
|
3654
|
+
fn();
|
|
3655
|
+
} catch (err) {
|
|
3656
|
+
console.warn("[Sibu strict] second run threw:", err);
|
|
3657
|
+
}
|
|
3658
|
+
});
|
|
3659
|
+
}
|
|
3660
|
+
return result;
|
|
3661
|
+
}
|
|
3662
|
+
function strictEffect(fn) {
|
|
3663
|
+
if (!isDev()) {
|
|
3664
|
+
return effect(fn);
|
|
3665
|
+
}
|
|
3666
|
+
const firstTeardown = effect(fn);
|
|
3667
|
+
let secondTeardown = null;
|
|
3668
|
+
queueMicrotask(() => {
|
|
3669
|
+
try {
|
|
3670
|
+
secondTeardown = effect(fn);
|
|
3671
|
+
} catch (err) {
|
|
3672
|
+
console.warn("[Sibu strictEffect] second run threw:", err);
|
|
3673
|
+
}
|
|
3674
|
+
});
|
|
3675
|
+
return () => {
|
|
3676
|
+
firstTeardown();
|
|
3677
|
+
if (secondTeardown) secondTeardown();
|
|
3678
|
+
};
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
// src/reactivity/nextTick.ts
|
|
3682
|
+
function nextTick() {
|
|
3683
|
+
return new Promise((resolve) => {
|
|
3684
|
+
queueMicrotask(() => {
|
|
3685
|
+
if (typeof requestAnimationFrame === "function") {
|
|
3686
|
+
requestAnimationFrame(() => resolve());
|
|
3687
|
+
} else {
|
|
3688
|
+
resolve();
|
|
3689
|
+
}
|
|
3690
|
+
});
|
|
3691
|
+
});
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
// src/reactivity/concurrent.ts
|
|
3695
|
+
function defer(getter) {
|
|
3696
|
+
const [value, setValue] = signal(getter());
|
|
3697
|
+
let pending = false;
|
|
3698
|
+
let latest = value();
|
|
3699
|
+
const flush = () => {
|
|
3700
|
+
pending = false;
|
|
3701
|
+
setValue(latest);
|
|
3702
|
+
};
|
|
3703
|
+
const schedule = () => {
|
|
3704
|
+
if (pending) return;
|
|
3705
|
+
pending = true;
|
|
3706
|
+
queueMicrotask(() => {
|
|
3707
|
+
if (typeof requestAnimationFrame === "function") {
|
|
3708
|
+
requestAnimationFrame(flush);
|
|
3709
|
+
} else {
|
|
3710
|
+
flush();
|
|
3711
|
+
}
|
|
3712
|
+
});
|
|
3713
|
+
};
|
|
3714
|
+
track(() => {
|
|
3715
|
+
latest = getter();
|
|
3716
|
+
schedule();
|
|
3717
|
+
});
|
|
3718
|
+
return value;
|
|
3719
|
+
}
|
|
3720
|
+
var IDLE_FALLBACK_MS = 16;
|
|
3721
|
+
function scheduleIdle(fn) {
|
|
3722
|
+
const g2 = globalThis;
|
|
3723
|
+
if (typeof g2.requestIdleCallback === "function") {
|
|
3724
|
+
g2.requestIdleCallback(fn, { timeout: IDLE_FALLBACK_MS * 4 });
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
if (typeof requestAnimationFrame === "function") {
|
|
3728
|
+
requestAnimationFrame(() => fn());
|
|
3729
|
+
return;
|
|
3730
|
+
}
|
|
3731
|
+
setTimeout(fn, IDLE_FALLBACK_MS);
|
|
3732
|
+
}
|
|
3733
|
+
function transition() {
|
|
3734
|
+
const [pending, setPending] = signal(false);
|
|
3735
|
+
function start(fn) {
|
|
3736
|
+
setPending(true);
|
|
3737
|
+
scheduleIdle(() => {
|
|
3738
|
+
let result;
|
|
3739
|
+
try {
|
|
3740
|
+
result = fn();
|
|
3741
|
+
} catch {
|
|
3742
|
+
setPending(false);
|
|
3743
|
+
return;
|
|
3744
|
+
}
|
|
3745
|
+
if (result && typeof result.then === "function") {
|
|
3746
|
+
result.then(
|
|
3747
|
+
() => setPending(false),
|
|
3748
|
+
() => setPending(false)
|
|
3749
|
+
);
|
|
3750
|
+
} else {
|
|
3751
|
+
setPending(false);
|
|
3752
|
+
}
|
|
3753
|
+
});
|
|
3754
|
+
}
|
|
3755
|
+
return { pending, start };
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3584
3758
|
// src/core/rendering/lazy.ts
|
|
3585
3759
|
function lazy(importFn) {
|
|
3586
3760
|
let cached = null;
|
|
@@ -3639,8 +3813,446 @@ function Suspense({ nodes, fallback }) {
|
|
|
3639
3813
|
return container;
|
|
3640
3814
|
}
|
|
3641
3815
|
|
|
3642
|
-
// src/components/
|
|
3816
|
+
// src/components/ErrorDisplay.ts
|
|
3643
3817
|
var _isDev8 = isDev();
|
|
3818
|
+
var STYLES = `
|
|
3819
|
+
.sibu-error-display {
|
|
3820
|
+
border: 1px solid var(--sibu-err-border, #e5484d);
|
|
3821
|
+
border-radius: 10px;
|
|
3822
|
+
margin: 12px 0;
|
|
3823
|
+
background: #0f0f1a;
|
|
3824
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
3825
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
3826
|
+
color: #e5e7eb;
|
|
3827
|
+
overflow: hidden;
|
|
3828
|
+
}
|
|
3829
|
+
.sibu-error-display[data-severity="warning"] { --sibu-err-border: #d97706; --sibu-err-accent: #d97706; }
|
|
3830
|
+
.sibu-error-display[data-severity="info"] { --sibu-err-border: #3b82f6; --sibu-err-accent: #3b82f6; }
|
|
3831
|
+
.sibu-error-display { --sibu-err-accent: #e5484d; }
|
|
3832
|
+
|
|
3833
|
+
.sibu-error-display .sibu-err-header {
|
|
3834
|
+
display: flex;
|
|
3835
|
+
align-items: center;
|
|
3836
|
+
gap: 10px;
|
|
3837
|
+
padding: 12px 18px;
|
|
3838
|
+
background: var(--sibu-err-accent);
|
|
3839
|
+
color: white;
|
|
3840
|
+
user-select: none;
|
|
3841
|
+
}
|
|
3842
|
+
.sibu-error-display .sibu-err-icon {
|
|
3843
|
+
font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
|
|
3844
|
+
font-weight: bold;
|
|
3845
|
+
font-size: 1.05em;
|
|
3846
|
+
padding: 2px 8px;
|
|
3847
|
+
background: rgba(0, 0, 0, 0.22);
|
|
3848
|
+
border-radius: 4px;
|
|
3849
|
+
letter-spacing: 0.02em;
|
|
3850
|
+
}
|
|
3851
|
+
.sibu-error-display .sibu-err-title {
|
|
3852
|
+
margin: 0;
|
|
3853
|
+
font-size: 0.98em;
|
|
3854
|
+
font-weight: 600;
|
|
3855
|
+
flex: 1;
|
|
3856
|
+
text-overflow: ellipsis;
|
|
3857
|
+
overflow: hidden;
|
|
3858
|
+
white-space: nowrap;
|
|
3859
|
+
}
|
|
3860
|
+
.sibu-error-display .sibu-err-timestamp {
|
|
3861
|
+
font-size: 0.75em;
|
|
3862
|
+
opacity: 0.85;
|
|
3863
|
+
font-family: 'SF Mono', 'JetBrains Mono', monospace;
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3866
|
+
.sibu-error-display .sibu-err-body {
|
|
3867
|
+
padding: 16px 18px;
|
|
3868
|
+
}
|
|
3869
|
+
.sibu-error-display .sibu-err-message {
|
|
3870
|
+
font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
|
|
3871
|
+
margin: 0 0 14px;
|
|
3872
|
+
color: #fecaca;
|
|
3873
|
+
word-break: break-word;
|
|
3874
|
+
font-size: 0.9em;
|
|
3875
|
+
line-height: 1.55;
|
|
3876
|
+
padding: 10px 12px;
|
|
3877
|
+
background: rgba(229, 72, 77, 0.08);
|
|
3878
|
+
border-left: 3px solid var(--sibu-err-accent);
|
|
3879
|
+
border-radius: 4px;
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
.sibu-error-display .sibu-err-section {
|
|
3883
|
+
margin-top: 14px;
|
|
3884
|
+
border-radius: 6px;
|
|
3885
|
+
border: 1px solid #2a2a3e;
|
|
3886
|
+
background: #0a0a14;
|
|
3887
|
+
overflow: hidden;
|
|
3888
|
+
}
|
|
3889
|
+
.sibu-error-display .sibu-err-section-head {
|
|
3890
|
+
display: flex;
|
|
3891
|
+
align-items: center;
|
|
3892
|
+
justify-content: space-between;
|
|
3893
|
+
padding: 6px 12px;
|
|
3894
|
+
background: #16162a;
|
|
3895
|
+
border-bottom: 1px solid #2a2a3e;
|
|
3896
|
+
font-size: 0.72em;
|
|
3897
|
+
color: #8b8fa3;
|
|
3898
|
+
text-transform: uppercase;
|
|
3899
|
+
letter-spacing: 0.08em;
|
|
3900
|
+
font-weight: 600;
|
|
3901
|
+
}
|
|
3902
|
+
.sibu-error-display .sibu-err-copy-btn {
|
|
3903
|
+
background: transparent;
|
|
3904
|
+
border: 1px solid #3a3a4e;
|
|
3905
|
+
border-radius: 4px;
|
|
3906
|
+
color: #a0a3b8;
|
|
3907
|
+
cursor: pointer;
|
|
3908
|
+
padding: 2px 10px;
|
|
3909
|
+
font-size: 0.95em;
|
|
3910
|
+
font-family: inherit;
|
|
3911
|
+
transition: all 0.12s ease;
|
|
3912
|
+
}
|
|
3913
|
+
.sibu-error-display .sibu-err-copy-btn:hover {
|
|
3914
|
+
background: #2a2a3e;
|
|
3915
|
+
color: #e5e7eb;
|
|
3916
|
+
border-color: #4a4a5e;
|
|
3917
|
+
}
|
|
3918
|
+
|
|
3919
|
+
.sibu-error-display .sibu-err-stack {
|
|
3920
|
+
margin: 0;
|
|
3921
|
+
padding: 10px 12px;
|
|
3922
|
+
overflow-x: auto;
|
|
3923
|
+
font-family: 'SF Mono', 'JetBrains Mono', monospace;
|
|
3924
|
+
font-size: 0.8em;
|
|
3925
|
+
line-height: 1.7;
|
|
3926
|
+
}
|
|
3927
|
+
.sibu-error-display .sibu-err-frame {
|
|
3928
|
+
display: flex;
|
|
3929
|
+
gap: 10px;
|
|
3930
|
+
padding: 1px 0;
|
|
3931
|
+
}
|
|
3932
|
+
.sibu-error-display .sibu-err-line {
|
|
3933
|
+
display: inline-block;
|
|
3934
|
+
min-width: 2.2ch;
|
|
3935
|
+
color: #4b5066;
|
|
3936
|
+
text-align: right;
|
|
3937
|
+
user-select: none;
|
|
3938
|
+
flex-shrink: 0;
|
|
3939
|
+
}
|
|
3940
|
+
.sibu-error-display .sibu-err-fn {
|
|
3941
|
+
color: #7dd3fc;
|
|
3942
|
+
font-weight: 500;
|
|
3943
|
+
}
|
|
3944
|
+
.sibu-error-display .sibu-err-loc {
|
|
3945
|
+
color: #6b7280;
|
|
3946
|
+
white-space: nowrap;
|
|
3947
|
+
}
|
|
3948
|
+
.sibu-error-display .sibu-err-cause-label {
|
|
3949
|
+
margin: 12px 0 6px;
|
|
3950
|
+
color: #a0a3b8;
|
|
3951
|
+
font-size: 0.75em;
|
|
3952
|
+
text-transform: uppercase;
|
|
3953
|
+
letter-spacing: 0.05em;
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
.sibu-error-display .sibu-err-meta {
|
|
3957
|
+
margin: 0;
|
|
3958
|
+
padding: 10px 12px;
|
|
3959
|
+
font-family: 'SF Mono', 'JetBrains Mono', monospace;
|
|
3960
|
+
font-size: 0.78em;
|
|
3961
|
+
color: #a0a3b8;
|
|
3962
|
+
display: grid;
|
|
3963
|
+
grid-template-columns: minmax(120px, auto) 1fr;
|
|
3964
|
+
gap: 4px 16px;
|
|
3965
|
+
}
|
|
3966
|
+
.sibu-error-display .sibu-err-meta dt { color: #6b7280; }
|
|
3967
|
+
.sibu-error-display .sibu-err-meta dd { margin: 0; color: #d1d5db; word-break: break-word; }
|
|
3968
|
+
|
|
3969
|
+
.sibu-error-display .sibu-err-actions {
|
|
3970
|
+
display: flex;
|
|
3971
|
+
gap: 8px;
|
|
3972
|
+
margin-top: 16px;
|
|
3973
|
+
}
|
|
3974
|
+
.sibu-error-display .sibu-err-btn {
|
|
3975
|
+
display: inline-flex;
|
|
3976
|
+
align-items: center;
|
|
3977
|
+
gap: 6px;
|
|
3978
|
+
padding: 8px 18px;
|
|
3979
|
+
border: none;
|
|
3980
|
+
border-radius: 6px;
|
|
3981
|
+
cursor: pointer;
|
|
3982
|
+
font-size: 13px;
|
|
3983
|
+
font-weight: 500;
|
|
3984
|
+
transition: all 0.12s ease;
|
|
3985
|
+
font-family: inherit;
|
|
3986
|
+
}
|
|
3987
|
+
.sibu-error-display .sibu-err-btn-retry {
|
|
3988
|
+
background: var(--sibu-err-accent);
|
|
3989
|
+
color: white;
|
|
3990
|
+
}
|
|
3991
|
+
.sibu-error-display .sibu-err-btn-retry:hover { filter: brightness(1.1); }
|
|
3992
|
+
.sibu-error-display .sibu-err-btn-reload {
|
|
3993
|
+
background: #1f2133;
|
|
3994
|
+
color: #d1d5db;
|
|
3995
|
+
border: 1px solid #3a3a4e;
|
|
3996
|
+
}
|
|
3997
|
+
.sibu-error-display .sibu-err-btn-reload:hover { background: #2a2b40; }
|
|
3998
|
+
`;
|
|
3999
|
+
var _stylesInjected = false;
|
|
4000
|
+
function injectStyles() {
|
|
4001
|
+
if (_stylesInjected || typeof document === "undefined") return;
|
|
4002
|
+
const el = style({ nodes: STYLES });
|
|
4003
|
+
document.head.appendChild(el);
|
|
4004
|
+
_stylesInjected = true;
|
|
4005
|
+
}
|
|
4006
|
+
function parseStack(stack) {
|
|
4007
|
+
const frames = [];
|
|
4008
|
+
const lines = stack.split("\n");
|
|
4009
|
+
for (const raw of lines) {
|
|
4010
|
+
const line2 = raw.trim();
|
|
4011
|
+
const chrome = line2.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
|
|
4012
|
+
if (chrome) {
|
|
4013
|
+
frames.push({ fn: chrome[1] || "(anonymous)", loc: chrome[2] || chrome[3] || "" });
|
|
4014
|
+
continue;
|
|
4015
|
+
}
|
|
4016
|
+
const ff = line2.match(/^(.+?)@(.+)$/);
|
|
4017
|
+
if (ff) {
|
|
4018
|
+
frames.push({ fn: ff[1] || "(anonymous)", loc: ff[2] || "" });
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
return frames;
|
|
4022
|
+
}
|
|
4023
|
+
function normalizeError(err) {
|
|
4024
|
+
if (err instanceof Error) {
|
|
4025
|
+
const code2 = err.code ?? err.name ?? "ERROR";
|
|
4026
|
+
const message = err.message || "Unknown error";
|
|
4027
|
+
const stack = err.stack ?? "";
|
|
4028
|
+
const frames = parseStack(stack);
|
|
4029
|
+
const rawCause = err.cause;
|
|
4030
|
+
const cause = rawCause != null ? normalizeError(rawCause) : null;
|
|
4031
|
+
return { code: code2, message, stack, frames, cause };
|
|
4032
|
+
}
|
|
4033
|
+
return {
|
|
4034
|
+
code: "NON_ERROR",
|
|
4035
|
+
message: typeof err === "string" ? err : JSON.stringify(err),
|
|
4036
|
+
stack: "",
|
|
4037
|
+
frames: [],
|
|
4038
|
+
cause: null
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
function buildCopyText(err, meta2) {
|
|
4042
|
+
const lines = [];
|
|
4043
|
+
lines.push(`[${err.code}] ${err.message}`);
|
|
4044
|
+
if (err.stack) {
|
|
4045
|
+
lines.push("");
|
|
4046
|
+
lines.push(err.stack);
|
|
4047
|
+
}
|
|
4048
|
+
if (err.cause) {
|
|
4049
|
+
lines.push("");
|
|
4050
|
+
lines.push("Caused by:");
|
|
4051
|
+
lines.push(` [${err.cause.code}] ${err.cause.message}`);
|
|
4052
|
+
if (err.cause.stack) {
|
|
4053
|
+
const indented = err.cause.stack.split("\n").map((l) => ` ${l}`).join("\n");
|
|
4054
|
+
lines.push(indented);
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4057
|
+
if (meta2 && Object.keys(meta2).length > 0) {
|
|
4058
|
+
lines.push("");
|
|
4059
|
+
lines.push("Metadata:");
|
|
4060
|
+
for (const [k, v] of Object.entries(meta2)) {
|
|
4061
|
+
lines.push(` ${k}: ${String(v)}`);
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
lines.push("");
|
|
4065
|
+
lines.push(`At: ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
4066
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
4067
|
+
lines.push(`UA: ${navigator.userAgent}`);
|
|
4068
|
+
}
|
|
4069
|
+
return lines.join("\n");
|
|
4070
|
+
}
|
|
4071
|
+
function renderFrames(frames) {
|
|
4072
|
+
const rows = frames.map(
|
|
4073
|
+
(f, i2) => div({
|
|
4074
|
+
class: "sibu-err-frame",
|
|
4075
|
+
nodes: [
|
|
4076
|
+
span({ class: "sibu-err-line", nodes: String(i2 + 1) }),
|
|
4077
|
+
span({ class: "sibu-err-fn", nodes: f.fn }),
|
|
4078
|
+
span({ class: "sibu-err-loc", nodes: ` \u2014 ${f.loc}` })
|
|
4079
|
+
]
|
|
4080
|
+
})
|
|
4081
|
+
);
|
|
4082
|
+
return pre({ class: "sibu-err-stack", nodes: rows });
|
|
4083
|
+
}
|
|
4084
|
+
function renderCauseChain(cause) {
|
|
4085
|
+
if (!cause) return [];
|
|
4086
|
+
return [
|
|
4087
|
+
div({ class: "sibu-err-cause-label", nodes: "Caused by" }),
|
|
4088
|
+
div({
|
|
4089
|
+
class: "sibu-err-section",
|
|
4090
|
+
nodes: [
|
|
4091
|
+
div({
|
|
4092
|
+
class: "sibu-err-section-head",
|
|
4093
|
+
nodes: [span({ nodes: `[${cause.code}] ${cause.message}` }), span({ nodes: "" })]
|
|
4094
|
+
}),
|
|
4095
|
+
cause.frames.length > 0 ? renderFrames(cause.frames) : div({ class: "sibu-err-stack", nodes: "(no stack)" })
|
|
4096
|
+
]
|
|
4097
|
+
}),
|
|
4098
|
+
...renderCauseChain(cause.cause)
|
|
4099
|
+
];
|
|
4100
|
+
}
|
|
4101
|
+
function renderMetadata(meta2) {
|
|
4102
|
+
const rows = [];
|
|
4103
|
+
for (const [k, v] of Object.entries(meta2)) {
|
|
4104
|
+
rows.push(document.createElement("dt"));
|
|
4105
|
+
rows[rows.length - 1].textContent = k;
|
|
4106
|
+
const dd2 = document.createElement("dd");
|
|
4107
|
+
dd2.textContent = v == null ? "(null)" : String(v);
|
|
4108
|
+
rows.push(dd2);
|
|
4109
|
+
}
|
|
4110
|
+
const dl2 = document.createElement("dl");
|
|
4111
|
+
dl2.className = "sibu-err-meta";
|
|
4112
|
+
for (const r of rows) dl2.appendChild(r);
|
|
4113
|
+
return dl2;
|
|
4114
|
+
}
|
|
4115
|
+
function ErrorDisplay(props) {
|
|
4116
|
+
injectStyles();
|
|
4117
|
+
const severity = props.severity ?? "error";
|
|
4118
|
+
const normalized = normalizeError(props.error);
|
|
4119
|
+
const showDetails = props.alwaysShowDetails ?? _isDev8;
|
|
4120
|
+
const headline = props.title ?? normalized.message;
|
|
4121
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
|
|
4122
|
+
const [copyLabel, setCopyLabel] = signal("Copy");
|
|
4123
|
+
const copyBtn = button({
|
|
4124
|
+
class: "sibu-err-copy-btn",
|
|
4125
|
+
nodes: () => copyLabel(),
|
|
4126
|
+
on: {
|
|
4127
|
+
click: () => {
|
|
4128
|
+
const text2 = buildCopyText(normalized, props.metadata);
|
|
4129
|
+
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
4130
|
+
navigator.clipboard.writeText(text2).then(
|
|
4131
|
+
() => {
|
|
4132
|
+
setCopyLabel("Copied!");
|
|
4133
|
+
setTimeout(() => setCopyLabel("Copy"), 1500);
|
|
4134
|
+
},
|
|
4135
|
+
() => {
|
|
4136
|
+
setCopyLabel("Copy failed");
|
|
4137
|
+
setTimeout(() => setCopyLabel("Copy"), 1500);
|
|
4138
|
+
}
|
|
4139
|
+
);
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
});
|
|
4144
|
+
const header2 = div({
|
|
4145
|
+
class: "sibu-err-header",
|
|
4146
|
+
nodes: [
|
|
4147
|
+
code({ class: "sibu-err-icon", nodes: normalized.code }),
|
|
4148
|
+
h3({ class: "sibu-err-title", nodes: headline }),
|
|
4149
|
+
span({ class: "sibu-err-timestamp", nodes: timestamp })
|
|
4150
|
+
]
|
|
4151
|
+
});
|
|
4152
|
+
const bodyChildren = [p({ class: "sibu-err-message", nodes: normalized.message })];
|
|
4153
|
+
if (showDetails && normalized.frames.length > 0) {
|
|
4154
|
+
bodyChildren.push(
|
|
4155
|
+
div({
|
|
4156
|
+
class: "sibu-err-section",
|
|
4157
|
+
nodes: [
|
|
4158
|
+
div({
|
|
4159
|
+
class: "sibu-err-section-head",
|
|
4160
|
+
nodes: [span({ nodes: "Stack Trace" }), copyBtn]
|
|
4161
|
+
}),
|
|
4162
|
+
renderFrames(normalized.frames)
|
|
4163
|
+
]
|
|
4164
|
+
})
|
|
4165
|
+
);
|
|
4166
|
+
} else if (showDetails) {
|
|
4167
|
+
bodyChildren.push(
|
|
4168
|
+
div({
|
|
4169
|
+
class: "sibu-err-section",
|
|
4170
|
+
nodes: [
|
|
4171
|
+
div({
|
|
4172
|
+
class: "sibu-err-section-head",
|
|
4173
|
+
nodes: [span({ nodes: "Details" }), copyBtn]
|
|
4174
|
+
}),
|
|
4175
|
+
div({ class: "sibu-err-stack", nodes: "(no stack available)" })
|
|
4176
|
+
]
|
|
4177
|
+
})
|
|
4178
|
+
);
|
|
4179
|
+
}
|
|
4180
|
+
if (showDetails) {
|
|
4181
|
+
bodyChildren.push(...renderCauseChain(normalized.cause));
|
|
4182
|
+
}
|
|
4183
|
+
if (showDetails && props.metadata && Object.keys(props.metadata).length > 0) {
|
|
4184
|
+
bodyChildren.push(
|
|
4185
|
+
div({
|
|
4186
|
+
class: "sibu-err-section",
|
|
4187
|
+
nodes: [
|
|
4188
|
+
div({ class: "sibu-err-section-head", nodes: [span({ nodes: "Metadata" })] }),
|
|
4189
|
+
renderMetadata(props.metadata)
|
|
4190
|
+
]
|
|
4191
|
+
})
|
|
4192
|
+
);
|
|
4193
|
+
}
|
|
4194
|
+
if (showDetails && typeof navigator !== "undefined" && navigator.userAgent) {
|
|
4195
|
+
bodyChildren.push(
|
|
4196
|
+
div({
|
|
4197
|
+
class: "sibu-err-section",
|
|
4198
|
+
nodes: [
|
|
4199
|
+
div({ class: "sibu-err-section-head", nodes: [span({ nodes: "Environment" })] }),
|
|
4200
|
+
div({
|
|
4201
|
+
class: "sibu-err-meta",
|
|
4202
|
+
nodes: (() => {
|
|
4203
|
+
const dl2 = document.createElement("dl");
|
|
4204
|
+
dl2.className = "sibu-err-meta";
|
|
4205
|
+
const entries = [
|
|
4206
|
+
["User Agent", navigator.userAgent],
|
|
4207
|
+
["URL", typeof location !== "undefined" ? location.href : "(n/a)"],
|
|
4208
|
+
["Timestamp", (/* @__PURE__ */ new Date()).toISOString()]
|
|
4209
|
+
];
|
|
4210
|
+
for (const [k, v] of entries) {
|
|
4211
|
+
const dt2 = document.createElement("dt");
|
|
4212
|
+
dt2.textContent = k;
|
|
4213
|
+
const dd2 = document.createElement("dd");
|
|
4214
|
+
dd2.textContent = v;
|
|
4215
|
+
dl2.appendChild(dt2);
|
|
4216
|
+
dl2.appendChild(dd2);
|
|
4217
|
+
}
|
|
4218
|
+
return dl2;
|
|
4219
|
+
})()
|
|
4220
|
+
})
|
|
4221
|
+
]
|
|
4222
|
+
})
|
|
4223
|
+
);
|
|
4224
|
+
}
|
|
4225
|
+
const actionButtons = [];
|
|
4226
|
+
if (props.onRetry) {
|
|
4227
|
+
actionButtons.push(
|
|
4228
|
+
button({
|
|
4229
|
+
class: "sibu-err-btn sibu-err-btn-retry",
|
|
4230
|
+
nodes: props.retryLabel ?? "Retry",
|
|
4231
|
+
on: { click: props.onRetry }
|
|
4232
|
+
})
|
|
4233
|
+
);
|
|
4234
|
+
}
|
|
4235
|
+
if (!props.hideReload && typeof location !== "undefined") {
|
|
4236
|
+
actionButtons.push(
|
|
4237
|
+
button({
|
|
4238
|
+
class: "sibu-err-btn sibu-err-btn-reload",
|
|
4239
|
+
nodes: "Reload Page",
|
|
4240
|
+
on: { click: () => location.reload() }
|
|
4241
|
+
})
|
|
4242
|
+
);
|
|
4243
|
+
}
|
|
4244
|
+
if (actionButtons.length > 0) {
|
|
4245
|
+
bodyChildren.push(div({ class: "sibu-err-actions", nodes: actionButtons }));
|
|
4246
|
+
}
|
|
4247
|
+
const body2 = div({ class: "sibu-err-body", nodes: bodyChildren });
|
|
4248
|
+
return div({
|
|
4249
|
+
class: "sibu-error-display",
|
|
4250
|
+
"data-severity": severity,
|
|
4251
|
+
nodes: [header2, body2]
|
|
4252
|
+
});
|
|
4253
|
+
}
|
|
4254
|
+
|
|
4255
|
+
// src/components/ErrorBoundary.ts
|
|
3644
4256
|
var errorBoundaryStyles = `
|
|
3645
4257
|
.sibu-error-boundary {
|
|
3646
4258
|
position: relative;
|
|
@@ -3797,7 +4409,7 @@ var errorBoundaryStyles = `
|
|
|
3797
4409
|
}
|
|
3798
4410
|
`;
|
|
3799
4411
|
var stylesInjected = false;
|
|
3800
|
-
function
|
|
4412
|
+
function injectStyles2() {
|
|
3801
4413
|
if (!stylesInjected && typeof document !== "undefined") {
|
|
3802
4414
|
const styleElement = style({ nodes: errorBoundaryStyles });
|
|
3803
4415
|
document.head.appendChild(styleElement);
|
|
@@ -3817,37 +4429,8 @@ function getMemoizedFallback(fallbackFn, error, retry) {
|
|
|
3817
4429
|
}
|
|
3818
4430
|
return cache2.get(key);
|
|
3819
4431
|
}
|
|
3820
|
-
function
|
|
3821
|
-
|
|
3822
|
-
const lines = stack.split("\n");
|
|
3823
|
-
const frames = [];
|
|
3824
|
-
let source2 = "";
|
|
3825
|
-
for (const line2 of lines) {
|
|
3826
|
-
const trimmed = line2.trim();
|
|
3827
|
-
const chromeMatch = trimmed.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
|
|
3828
|
-
if (chromeMatch) {
|
|
3829
|
-
const fn = chromeMatch[1] || "(anonymous)";
|
|
3830
|
-
const loc = chromeMatch[2] || chromeMatch[3] || "";
|
|
3831
|
-
frames.push({ fn, loc });
|
|
3832
|
-
if (!source2 && fn !== "(anonymous)" && !fn.startsWith("Object.") && !fn.startsWith("Module.")) {
|
|
3833
|
-
source2 = fn;
|
|
3834
|
-
}
|
|
3835
|
-
continue;
|
|
3836
|
-
}
|
|
3837
|
-
const firefoxMatch = trimmed.match(/^(.+?)@(.+)$/);
|
|
3838
|
-
if (firefoxMatch) {
|
|
3839
|
-
const fn = firefoxMatch[1] || "(anonymous)";
|
|
3840
|
-
const loc = firefoxMatch[2] || "";
|
|
3841
|
-
frames.push({ fn, loc });
|
|
3842
|
-
if (!source2 && fn !== "(anonymous)") {
|
|
3843
|
-
source2 = fn;
|
|
3844
|
-
}
|
|
3845
|
-
}
|
|
3846
|
-
}
|
|
3847
|
-
return { source: source2, frames };
|
|
3848
|
-
}
|
|
3849
|
-
function ErrorBoundary({ nodes, fallback, onError }) {
|
|
3850
|
-
injectStyles();
|
|
4432
|
+
function ErrorBoundary({ nodes, fallback, onError, resetKeys }) {
|
|
4433
|
+
injectStyles2();
|
|
3851
4434
|
const [error, setError] = signal(null);
|
|
3852
4435
|
const retry = () => {
|
|
3853
4436
|
if (fallback) {
|
|
@@ -3855,6 +4438,22 @@ function ErrorBoundary({ nodes, fallback, onError }) {
|
|
|
3855
4438
|
}
|
|
3856
4439
|
setError(null);
|
|
3857
4440
|
};
|
|
4441
|
+
if (resetKeys && resetKeys.length > 0) {
|
|
4442
|
+
let initialized = false;
|
|
4443
|
+
effect(() => {
|
|
4444
|
+
for (const k of resetKeys) {
|
|
4445
|
+
try {
|
|
4446
|
+
k();
|
|
4447
|
+
} catch {
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4450
|
+
if (!initialized) {
|
|
4451
|
+
initialized = true;
|
|
4452
|
+
return;
|
|
4453
|
+
}
|
|
4454
|
+
if (error() !== null) retry();
|
|
4455
|
+
});
|
|
4456
|
+
}
|
|
3858
4457
|
const handleError = (e) => {
|
|
3859
4458
|
const errorObj = e instanceof Error ? e : new Error(String(e));
|
|
3860
4459
|
setError(errorObj);
|
|
@@ -3862,110 +4461,7 @@ function ErrorBoundary({ nodes, fallback, onError }) {
|
|
|
3862
4461
|
return errorObj;
|
|
3863
4462
|
};
|
|
3864
4463
|
const defaultFallback = (err, retryFn) => {
|
|
3865
|
-
|
|
3866
|
-
return div({
|
|
3867
|
-
class: "sibu-error-fallback",
|
|
3868
|
-
nodes: [
|
|
3869
|
-
div({
|
|
3870
|
-
class: "sibu-error-header",
|
|
3871
|
-
nodes: [h3({ nodes: "Something went wrong", class: "sibu-error-title" })]
|
|
3872
|
-
}),
|
|
3873
|
-
div({
|
|
3874
|
-
class: "sibu-error-body",
|
|
3875
|
-
nodes: [
|
|
3876
|
-
p({ nodes: "An unexpected error occurred. Please try again.", class: "sibu-error-message" }),
|
|
3877
|
-
div({
|
|
3878
|
-
class: "sibu-error-actions",
|
|
3879
|
-
nodes: [
|
|
3880
|
-
button({
|
|
3881
|
-
nodes: "Retry",
|
|
3882
|
-
class: "sibu-error-btn sibu-error-btn-retry",
|
|
3883
|
-
on: { click: retryFn }
|
|
3884
|
-
}),
|
|
3885
|
-
button({
|
|
3886
|
-
nodes: "Reload Page",
|
|
3887
|
-
class: "sibu-error-btn sibu-error-btn-reload",
|
|
3888
|
-
on: { click: () => location.reload() }
|
|
3889
|
-
})
|
|
3890
|
-
]
|
|
3891
|
-
})
|
|
3892
|
-
]
|
|
3893
|
-
})
|
|
3894
|
-
]
|
|
3895
|
-
});
|
|
3896
|
-
}
|
|
3897
|
-
const { source: source2, frames } = parseStack(err);
|
|
3898
|
-
const fullText = `${err.message}
|
|
3899
|
-
|
|
3900
|
-
${err.stack || ""}`;
|
|
3901
|
-
const copyBtn = button({
|
|
3902
|
-
nodes: "Copy",
|
|
3903
|
-
class: "sibu-error-copy-btn",
|
|
3904
|
-
on: {
|
|
3905
|
-
click: () => {
|
|
3906
|
-
navigator.clipboard.writeText(fullText).then(() => {
|
|
3907
|
-
copyBtn.textContent = "Copied!";
|
|
3908
|
-
setTimeout(() => {
|
|
3909
|
-
copyBtn.textContent = "Copy";
|
|
3910
|
-
}, 1500);
|
|
3911
|
-
});
|
|
3912
|
-
}
|
|
3913
|
-
}
|
|
3914
|
-
});
|
|
3915
|
-
const stackLines = frames.map(
|
|
3916
|
-
(f, i2) => div({
|
|
3917
|
-
nodes: [
|
|
3918
|
-
span({ class: "sibu-line-num", nodes: String(i2 + 1) }),
|
|
3919
|
-
span({ class: "sibu-stack-fn", nodes: f.fn }),
|
|
3920
|
-
span({ class: "sibu-stack-loc", nodes: ` ${f.loc}` })
|
|
3921
|
-
]
|
|
3922
|
-
})
|
|
3923
|
-
);
|
|
3924
|
-
return div({
|
|
3925
|
-
class: "sibu-error-fallback",
|
|
3926
|
-
nodes: [
|
|
3927
|
-
div({
|
|
3928
|
-
class: "sibu-error-header",
|
|
3929
|
-
nodes: [
|
|
3930
|
-
h3({ nodes: source2 ? `Error in ${source2}` : "Something went wrong", class: "sibu-error-title" }),
|
|
3931
|
-
...source2 ? [] : [span()]
|
|
3932
|
-
]
|
|
3933
|
-
}),
|
|
3934
|
-
div({
|
|
3935
|
-
class: "sibu-error-body",
|
|
3936
|
-
nodes: [
|
|
3937
|
-
p({ nodes: err.message, class: "sibu-error-message" }),
|
|
3938
|
-
...frames.length > 0 ? [
|
|
3939
|
-
div({
|
|
3940
|
-
class: "sibu-error-stack-container",
|
|
3941
|
-
nodes: [
|
|
3942
|
-
div({
|
|
3943
|
-
class: "sibu-error-stack-label",
|
|
3944
|
-
nodes: [span({ nodes: "Stack Trace" }), copyBtn]
|
|
3945
|
-
}),
|
|
3946
|
-
div({ class: "sibu-error-stack", nodes: [pre({ nodes: stackLines })] })
|
|
3947
|
-
]
|
|
3948
|
-
})
|
|
3949
|
-
] : [],
|
|
3950
|
-
div({
|
|
3951
|
-
class: "sibu-error-actions",
|
|
3952
|
-
nodes: [
|
|
3953
|
-
button({
|
|
3954
|
-
nodes: "Retry",
|
|
3955
|
-
class: "sibu-error-btn sibu-error-btn-retry",
|
|
3956
|
-
on: { click: retryFn }
|
|
3957
|
-
}),
|
|
3958
|
-
button({
|
|
3959
|
-
nodes: "Reload Page",
|
|
3960
|
-
class: "sibu-error-btn sibu-error-btn-reload",
|
|
3961
|
-
on: { click: () => location.reload() }
|
|
3962
|
-
})
|
|
3963
|
-
]
|
|
3964
|
-
})
|
|
3965
|
-
]
|
|
3966
|
-
})
|
|
3967
|
-
]
|
|
3968
|
-
});
|
|
4464
|
+
return ErrorDisplay({ error: err, severity: "error", onRetry: retryFn });
|
|
3969
4465
|
};
|
|
3970
4466
|
const tryRenderFallback = (err) => {
|
|
3971
4467
|
const fn = fallback || defaultFallback;
|
|
@@ -4397,14 +4893,11 @@ var moduleSizes = {
|
|
|
4397
4893
|
"core/watch": 300,
|
|
4398
4894
|
"core/store": 380,
|
|
4399
4895
|
"core/ref": 150,
|
|
4400
|
-
"core/memo": 180,
|
|
4401
|
-
"core/memoFn": 160,
|
|
4402
4896
|
"core/array": 420,
|
|
4403
4897
|
"core/deepSignal": 500,
|
|
4404
4898
|
"core/lifecycle": 300,
|
|
4405
4899
|
"core/context": 350,
|
|
4406
4900
|
"core/persist": 400,
|
|
4407
|
-
"core/primitives": 200,
|
|
4408
4901
|
"core/hoc": 280,
|
|
4409
4902
|
"core/transition": 600,
|
|
4410
4903
|
"core/form": 750,
|
|
@@ -4555,7 +5048,7 @@ var lintRules = {
|
|
|
4555
5048
|
description: "Signal functions should not be called inside conditionals, loops, or nested functions",
|
|
4556
5049
|
check(source2) {
|
|
4557
5050
|
const violations = [];
|
|
4558
|
-
const hookNames = ["signal", "effect", "derived", "
|
|
5051
|
+
const hookNames = ["signal", "effect", "derived", "ref", "watch", "store"];
|
|
4559
5052
|
const hookPattern = new RegExp(`\\b(${hookNames.join("|")})\\s*\\(`, "g");
|
|
4560
5053
|
const lines = source2.split("\n");
|
|
4561
5054
|
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
@@ -4914,30 +5407,6 @@ function getComponentMetadata() {
|
|
|
4914
5407
|
}
|
|
4915
5408
|
]
|
|
4916
5409
|
},
|
|
4917
|
-
{
|
|
4918
|
-
name: "memo",
|
|
4919
|
-
description: "Returns a memoized value that only recomputes when its reactive dependencies change. Alias for derived.",
|
|
4920
|
-
props: [
|
|
4921
|
-
{
|
|
4922
|
-
name: "factory",
|
|
4923
|
-
type: "() => T",
|
|
4924
|
-
required: true,
|
|
4925
|
-
description: "Function that computes the memoized value"
|
|
4926
|
-
}
|
|
4927
|
-
]
|
|
4928
|
-
},
|
|
4929
|
-
{
|
|
4930
|
-
name: "memoFn",
|
|
4931
|
-
description: "Returns a memoized callback that only updates when its reactive dependencies change.",
|
|
4932
|
-
props: [
|
|
4933
|
-
{
|
|
4934
|
-
name: "callback",
|
|
4935
|
-
type: "() => T",
|
|
4936
|
-
required: true,
|
|
4937
|
-
description: "The callback factory function to memoize"
|
|
4938
|
-
}
|
|
4939
|
-
]
|
|
4940
|
-
},
|
|
4941
5410
|
{
|
|
4942
5411
|
name: "ref",
|
|
4943
5412
|
description: "Creates a mutable reference object that persists across renders. Updating a ref does NOT trigger re-renders.",
|
|
@@ -4981,43 +5450,6 @@ function getComponentMetadata() {
|
|
|
4981
5450
|
}
|
|
4982
5451
|
]
|
|
4983
5452
|
},
|
|
4984
|
-
// ── SolidJS-style Primitives ─────────────────────────────────────
|
|
4985
|
-
{
|
|
4986
|
-
name: "createSignal",
|
|
4987
|
-
description: "Creates a reactive signal. SolidJS-style alias for signal. Returns [getter, setter].",
|
|
4988
|
-
props: [
|
|
4989
|
-
{
|
|
4990
|
-
name: "value",
|
|
4991
|
-
type: "T",
|
|
4992
|
-
required: true,
|
|
4993
|
-
description: "Initial value"
|
|
4994
|
-
}
|
|
4995
|
-
]
|
|
4996
|
-
},
|
|
4997
|
-
{
|
|
4998
|
-
name: "createMemo",
|
|
4999
|
-
description: "Creates a derived/computed reactive value. SolidJS-style alias for derived.",
|
|
5000
|
-
props: [
|
|
5001
|
-
{
|
|
5002
|
-
name: "fn",
|
|
5003
|
-
type: "() => T",
|
|
5004
|
-
required: true,
|
|
5005
|
-
description: "Computation function that reads other signals"
|
|
5006
|
-
}
|
|
5007
|
-
]
|
|
5008
|
-
},
|
|
5009
|
-
{
|
|
5010
|
-
name: "createEffect",
|
|
5011
|
-
description: "Creates a reactive side effect. SolidJS-style alias for effect.",
|
|
5012
|
-
props: [
|
|
5013
|
-
{
|
|
5014
|
-
name: "fn",
|
|
5015
|
-
type: "() => void",
|
|
5016
|
-
required: true,
|
|
5017
|
-
description: "Effect function that reads reactive signals"
|
|
5018
|
-
}
|
|
5019
|
-
]
|
|
5020
|
-
},
|
|
5021
5453
|
// ── Lifecycle ────────────────────────────────────────────────────
|
|
5022
5454
|
{
|
|
5023
5455
|
name: "onMount",
|
|
@@ -5349,11 +5781,6 @@ function generateVSCodeSnippets() {
|
|
|
5349
5781
|
"});"
|
|
5350
5782
|
],
|
|
5351
5783
|
description: "Create a reactive form with validation"
|
|
5352
|
-
},
|
|
5353
|
-
"SibuJS createSignal": {
|
|
5354
|
-
prefix: "sibu-signal",
|
|
5355
|
-
body: ["const [${1:value}, ${2:setValue}] = createSignal(${3:initialValue});"],
|
|
5356
|
-
description: "Create a reactive signal (SolidJS-style alias for signal)"
|
|
5357
5784
|
}
|
|
5358
5785
|
};
|
|
5359
5786
|
}
|
|
@@ -5385,10 +5812,6 @@ function generateTypeStubs() {
|
|
|
5385
5812
|
signal: ["declare function signal<T>(initial: T): [() => T, (next: T | ((prev: T) => T)) => void];"].join("\n"),
|
|
5386
5813
|
effect: ["declare function effect(effectFn: () => void): () => void;"].join("\n"),
|
|
5387
5814
|
derived: ["declare function derived<T>(getter: () => T): () => T;"].join("\n"),
|
|
5388
|
-
memo: ["declare function memo<T>(factory: () => T): () => T;"].join("\n"),
|
|
5389
|
-
memoFn: ["declare function memoFn<T extends (...args: unknown[]) => unknown>(callback: () => T): () => T;"].join(
|
|
5390
|
-
"\n"
|
|
5391
|
-
),
|
|
5392
5815
|
ref: [
|
|
5393
5816
|
"interface Ref<T> { current: T; }",
|
|
5394
5817
|
"declare function ref<T>(initial: T): Ref<T>;",
|
|
@@ -5407,11 +5830,6 @@ function generateTypeStubs() {
|
|
|
5407
5830
|
"}",
|
|
5408
5831
|
"declare function store<T extends object>(initialState: T): [{ readonly [K in keyof T]: T[K] }, StoreActions<T>];"
|
|
5409
5832
|
].join("\n"),
|
|
5410
|
-
createSignal: ["declare function createSignal<T>(value: T): [() => T, (next: T | ((prev: T) => T)) => void];"].join(
|
|
5411
|
-
"\n"
|
|
5412
|
-
),
|
|
5413
|
-
createMemo: ["declare function createMemo<T>(fn: () => T): () => T;"].join("\n"),
|
|
5414
|
-
createEffect: ["declare function createEffect(fn: () => void): () => void;"].join("\n"),
|
|
5415
5833
|
mount: [
|
|
5416
5834
|
"declare function mount(component: (() => HTMLElement) | HTMLElement | Node, container: HTMLElement | null): { node: Node; unmount: () => void };"
|
|
5417
5835
|
].join("\n"),
|