sibujs 1.0.4 → 1.0.6
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/build.cjs +251 -40
- package/dist/build.js +1 -1
- package/dist/cdn.global.js +124 -27
- package/dist/{chunk-32ZISOLJ.js → chunk-VAU366PN.js} +251 -40
- package/dist/index.cjs +251 -40
- package/dist/index.js +1 -1
- package/dist/plugins.cjs +3 -2
- package/dist/plugins.js +3 -2
- package/package.json +1 -1
|
@@ -1728,35 +1728,123 @@ var errorBoundaryStyles = `
|
|
|
1728
1728
|
}
|
|
1729
1729
|
|
|
1730
1730
|
.sibu-error-fallback {
|
|
1731
|
-
border:
|
|
1731
|
+
border: 1px solid #e5484d;
|
|
1732
1732
|
border-radius: 8px;
|
|
1733
|
-
padding:
|
|
1733
|
+
padding: 0;
|
|
1734
1734
|
margin: 10px 0;
|
|
1735
|
-
background:
|
|
1736
|
-
box-shadow: 0
|
|
1735
|
+
background: #1a1a2e;
|
|
1736
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
|
|
1737
1737
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
1738
|
+
color: #e1e1e6;
|
|
1739
|
+
overflow: hidden;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
.sibu-error-fallback .sibu-error-header {
|
|
1743
|
+
display: flex;
|
|
1744
|
+
align-items: center;
|
|
1745
|
+
gap: 8px;
|
|
1746
|
+
padding: 12px 16px;
|
|
1747
|
+
background: #e5484d;
|
|
1748
|
+
color: white;
|
|
1738
1749
|
}
|
|
1739
1750
|
|
|
1740
1751
|
.sibu-error-fallback .sibu-error-title {
|
|
1741
|
-
margin: 0
|
|
1742
|
-
|
|
1743
|
-
font-size: 1.1em;
|
|
1752
|
+
margin: 0;
|
|
1753
|
+
font-size: 0.95em;
|
|
1744
1754
|
font-weight: 600;
|
|
1745
1755
|
}
|
|
1746
1756
|
|
|
1757
|
+
.sibu-error-fallback .sibu-error-source {
|
|
1758
|
+
margin-left: auto;
|
|
1759
|
+
font-size: 0.8em;
|
|
1760
|
+
opacity: 0.9;
|
|
1761
|
+
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
.sibu-error-fallback .sibu-error-body {
|
|
1765
|
+
padding: 16px;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1747
1768
|
.sibu-error-fallback .sibu-error-message {
|
|
1748
1769
|
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
border-radius: 6px;
|
|
1752
|
-
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
1753
|
-
margin: 10px 0;
|
|
1754
|
-
color: #495057;
|
|
1770
|
+
margin: 0 0 12px 0;
|
|
1771
|
+
color: #f1a9a0;
|
|
1755
1772
|
word-break: break-word;
|
|
1756
1773
|
font-size: 0.9em;
|
|
1757
1774
|
line-height: 1.5;
|
|
1758
1775
|
}
|
|
1759
1776
|
|
|
1777
|
+
.sibu-error-fallback .sibu-error-stack-container {
|
|
1778
|
+
position: relative;
|
|
1779
|
+
margin: 0 0 12px 0;
|
|
1780
|
+
border-radius: 6px;
|
|
1781
|
+
border: 1px solid #2a2a3e;
|
|
1782
|
+
background: #12121f;
|
|
1783
|
+
overflow: hidden;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
.sibu-error-fallback .sibu-error-stack-label {
|
|
1787
|
+
display: flex;
|
|
1788
|
+
align-items: center;
|
|
1789
|
+
justify-content: space-between;
|
|
1790
|
+
padding: 6px 12px;
|
|
1791
|
+
background: #1e1e32;
|
|
1792
|
+
border-bottom: 1px solid #2a2a3e;
|
|
1793
|
+
font-size: 0.75em;
|
|
1794
|
+
color: #888;
|
|
1795
|
+
text-transform: uppercase;
|
|
1796
|
+
letter-spacing: 0.05em;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
.sibu-error-fallback .sibu-error-copy-btn {
|
|
1800
|
+
background: transparent;
|
|
1801
|
+
border: 1px solid #3a3a4e;
|
|
1802
|
+
border-radius: 4px;
|
|
1803
|
+
color: #888;
|
|
1804
|
+
cursor: pointer;
|
|
1805
|
+
padding: 2px 8px;
|
|
1806
|
+
font-size: 1em;
|
|
1807
|
+
transition: all 0.15s ease;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
.sibu-error-fallback .sibu-error-copy-btn:hover {
|
|
1811
|
+
background: #2a2a3e;
|
|
1812
|
+
color: #ccc;
|
|
1813
|
+
border-color: #4a4a5e;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
.sibu-error-fallback .sibu-error-stack pre {
|
|
1817
|
+
margin: 0;
|
|
1818
|
+
padding: 12px;
|
|
1819
|
+
overflow-x: auto;
|
|
1820
|
+
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
1821
|
+
font-size: 0.82em;
|
|
1822
|
+
line-height: 1.6;
|
|
1823
|
+
color: #a0a0b0;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
.sibu-error-fallback .sibu-error-stack .sibu-line-num {
|
|
1827
|
+
display: inline-block;
|
|
1828
|
+
width: 3ch;
|
|
1829
|
+
margin-right: 12px;
|
|
1830
|
+
color: #555;
|
|
1831
|
+
text-align: right;
|
|
1832
|
+
user-select: none;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
.sibu-error-fallback .sibu-error-stack .sibu-stack-fn {
|
|
1836
|
+
color: #7ec8e3;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.sibu-error-fallback .sibu-error-stack .sibu-stack-loc {
|
|
1840
|
+
color: #666;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
.sibu-error-fallback .sibu-error-actions {
|
|
1844
|
+
display: flex;
|
|
1845
|
+
gap: 8px;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1760
1848
|
.sibu-error-fallback .sibu-error-btn {
|
|
1761
1849
|
display: inline-flex;
|
|
1762
1850
|
align-items: center;
|
|
@@ -1765,22 +1853,28 @@ var errorBoundaryStyles = `
|
|
|
1765
1853
|
border: none;
|
|
1766
1854
|
border-radius: 6px;
|
|
1767
1855
|
cursor: pointer;
|
|
1768
|
-
font-size:
|
|
1856
|
+
font-size: 13px;
|
|
1769
1857
|
font-weight: 500;
|
|
1770
|
-
transition: all 0.
|
|
1771
|
-
|
|
1772
|
-
|
|
1858
|
+
transition: all 0.15s ease;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
.sibu-error-fallback .sibu-error-btn-retry {
|
|
1862
|
+
background: #e5484d;
|
|
1773
1863
|
color: white;
|
|
1774
1864
|
}
|
|
1775
1865
|
|
|
1776
|
-
.sibu-error-fallback .sibu-error-btn:hover {
|
|
1777
|
-
background
|
|
1778
|
-
|
|
1779
|
-
|
|
1866
|
+
.sibu-error-fallback .sibu-error-btn-retry:hover {
|
|
1867
|
+
background: #d13438;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
.sibu-error-fallback .sibu-error-btn-reload {
|
|
1871
|
+
background: #2a2a3e;
|
|
1872
|
+
color: #ccc;
|
|
1873
|
+
border: 1px solid #3a3a4e;
|
|
1780
1874
|
}
|
|
1781
1875
|
|
|
1782
|
-
.sibu-error-fallback .sibu-error-btn:
|
|
1783
|
-
|
|
1876
|
+
.sibu-error-fallback .sibu-error-btn-reload:hover {
|
|
1877
|
+
background: #3a3a4e;
|
|
1784
1878
|
}
|
|
1785
1879
|
`;
|
|
1786
1880
|
var stylesInjected = false;
|
|
@@ -1804,6 +1898,35 @@ function getMemoizedFallback(fallbackFn, error, retry) {
|
|
|
1804
1898
|
}
|
|
1805
1899
|
return cache2.get(key);
|
|
1806
1900
|
}
|
|
1901
|
+
function parseStack(err) {
|
|
1902
|
+
const stack = err.stack || "";
|
|
1903
|
+
const lines = stack.split("\n");
|
|
1904
|
+
const frames = [];
|
|
1905
|
+
let source2 = "";
|
|
1906
|
+
for (const line2 of lines) {
|
|
1907
|
+
const trimmed = line2.trim();
|
|
1908
|
+
const chromeMatch = trimmed.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
|
|
1909
|
+
if (chromeMatch) {
|
|
1910
|
+
const fn = chromeMatch[1] || "(anonymous)";
|
|
1911
|
+
const loc = chromeMatch[2] || chromeMatch[3] || "";
|
|
1912
|
+
frames.push({ fn, loc });
|
|
1913
|
+
if (!source2 && fn !== "(anonymous)" && !fn.startsWith("Object.") && !fn.startsWith("Module.")) {
|
|
1914
|
+
source2 = fn;
|
|
1915
|
+
}
|
|
1916
|
+
continue;
|
|
1917
|
+
}
|
|
1918
|
+
const firefoxMatch = trimmed.match(/^(.+?)@(.+)$/);
|
|
1919
|
+
if (firefoxMatch) {
|
|
1920
|
+
const fn = firefoxMatch[1] || "(anonymous)";
|
|
1921
|
+
const loc = firefoxMatch[2] || "";
|
|
1922
|
+
frames.push({ fn, loc });
|
|
1923
|
+
if (!source2 && fn !== "(anonymous)") {
|
|
1924
|
+
source2 = fn;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
return { source: source2, frames };
|
|
1929
|
+
}
|
|
1807
1930
|
function ErrorBoundary({ nodes, fallback, onError }) {
|
|
1808
1931
|
injectStyles();
|
|
1809
1932
|
const [error, setError] = signal(null);
|
|
@@ -1819,24 +1942,112 @@ function ErrorBoundary({ nodes, fallback, onError }) {
|
|
|
1819
1942
|
onError?.(errorObj);
|
|
1820
1943
|
return errorObj;
|
|
1821
1944
|
};
|
|
1822
|
-
const defaultFallback = (err, retryFn) =>
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
nodes:
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1945
|
+
const defaultFallback = (err, retryFn) => {
|
|
1946
|
+
if (!_isDev2) {
|
|
1947
|
+
return div({
|
|
1948
|
+
class: "sibu-error-fallback",
|
|
1949
|
+
nodes: [
|
|
1950
|
+
div({
|
|
1951
|
+
class: "sibu-error-header",
|
|
1952
|
+
nodes: [h3({ nodes: "Something went wrong", class: "sibu-error-title" })]
|
|
1953
|
+
}),
|
|
1954
|
+
div({
|
|
1955
|
+
class: "sibu-error-body",
|
|
1956
|
+
nodes: [
|
|
1957
|
+
p({ nodes: "An unexpected error occurred. Please try again.", class: "sibu-error-message" }),
|
|
1958
|
+
div({
|
|
1959
|
+
class: "sibu-error-actions",
|
|
1960
|
+
nodes: [
|
|
1961
|
+
button({
|
|
1962
|
+
nodes: "Retry",
|
|
1963
|
+
class: "sibu-error-btn sibu-error-btn-retry",
|
|
1964
|
+
on: { click: retryFn }
|
|
1965
|
+
}),
|
|
1966
|
+
button({
|
|
1967
|
+
nodes: "Reload Page",
|
|
1968
|
+
class: "sibu-error-btn sibu-error-btn-reload",
|
|
1969
|
+
on: { click: () => location.reload() }
|
|
1970
|
+
})
|
|
1971
|
+
]
|
|
1972
|
+
})
|
|
1973
|
+
]
|
|
1974
|
+
})
|
|
1975
|
+
]
|
|
1976
|
+
});
|
|
1977
|
+
}
|
|
1978
|
+
const { source: source2, frames } = parseStack(err);
|
|
1979
|
+
const fullText = `${err.message}
|
|
1980
|
+
|
|
1981
|
+
${err.stack || ""}`;
|
|
1982
|
+
const copyBtn = button({
|
|
1983
|
+
nodes: "Copy",
|
|
1984
|
+
class: "sibu-error-copy-btn",
|
|
1985
|
+
on: {
|
|
1986
|
+
click: () => {
|
|
1987
|
+
navigator.clipboard.writeText(fullText).then(() => {
|
|
1988
|
+
copyBtn.textContent = "Copied!";
|
|
1989
|
+
setTimeout(() => {
|
|
1990
|
+
copyBtn.textContent = "Copy";
|
|
1991
|
+
}, 1500);
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
1996
|
+
const stackLines = frames.map(
|
|
1997
|
+
(f, i2) => div({
|
|
1998
|
+
nodes: [
|
|
1999
|
+
span({ class: "sibu-line-num", nodes: String(i2 + 1) }),
|
|
2000
|
+
span({ class: "sibu-stack-fn", nodes: f.fn }),
|
|
2001
|
+
span({ class: "sibu-stack-loc", nodes: ` ${f.loc}` })
|
|
2002
|
+
]
|
|
1837
2003
|
})
|
|
1838
|
-
|
|
1839
|
-
|
|
2004
|
+
);
|
|
2005
|
+
return div({
|
|
2006
|
+
class: "sibu-error-fallback",
|
|
2007
|
+
nodes: [
|
|
2008
|
+
div({
|
|
2009
|
+
class: "sibu-error-header",
|
|
2010
|
+
nodes: [
|
|
2011
|
+
h3({ nodes: source2 ? `Error in ${source2}` : "Something went wrong", class: "sibu-error-title" }),
|
|
2012
|
+
...source2 ? [] : [span()]
|
|
2013
|
+
]
|
|
2014
|
+
}),
|
|
2015
|
+
div({
|
|
2016
|
+
class: "sibu-error-body",
|
|
2017
|
+
nodes: [
|
|
2018
|
+
p({ nodes: err.message, class: "sibu-error-message" }),
|
|
2019
|
+
...frames.length > 0 ? [
|
|
2020
|
+
div({
|
|
2021
|
+
class: "sibu-error-stack-container",
|
|
2022
|
+
nodes: [
|
|
2023
|
+
div({
|
|
2024
|
+
class: "sibu-error-stack-label",
|
|
2025
|
+
nodes: [span({ nodes: "Stack Trace" }), copyBtn]
|
|
2026
|
+
}),
|
|
2027
|
+
div({ class: "sibu-error-stack", nodes: [pre({ nodes: stackLines })] })
|
|
2028
|
+
]
|
|
2029
|
+
})
|
|
2030
|
+
] : [],
|
|
2031
|
+
div({
|
|
2032
|
+
class: "sibu-error-actions",
|
|
2033
|
+
nodes: [
|
|
2034
|
+
button({
|
|
2035
|
+
nodes: "Retry",
|
|
2036
|
+
class: "sibu-error-btn sibu-error-btn-retry",
|
|
2037
|
+
on: { click: retryFn }
|
|
2038
|
+
}),
|
|
2039
|
+
button({
|
|
2040
|
+
nodes: "Reload Page",
|
|
2041
|
+
class: "sibu-error-btn sibu-error-btn-reload",
|
|
2042
|
+
on: { click: () => location.reload() }
|
|
2043
|
+
})
|
|
2044
|
+
]
|
|
2045
|
+
})
|
|
2046
|
+
]
|
|
2047
|
+
})
|
|
2048
|
+
]
|
|
2049
|
+
});
|
|
2050
|
+
};
|
|
1840
2051
|
const tryRenderFallback = (err) => {
|
|
1841
2052
|
const fn = fallback || defaultFallback;
|
|
1842
2053
|
try {
|
package/dist/index.cjs
CHANGED
|
@@ -2575,35 +2575,123 @@ var errorBoundaryStyles = `
|
|
|
2575
2575
|
}
|
|
2576
2576
|
|
|
2577
2577
|
.sibu-error-fallback {
|
|
2578
|
-
border:
|
|
2578
|
+
border: 1px solid #e5484d;
|
|
2579
2579
|
border-radius: 8px;
|
|
2580
|
-
padding:
|
|
2580
|
+
padding: 0;
|
|
2581
2581
|
margin: 10px 0;
|
|
2582
|
-
background:
|
|
2583
|
-
box-shadow: 0
|
|
2582
|
+
background: #1a1a2e;
|
|
2583
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
|
|
2584
2584
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
2585
|
+
color: #e1e1e6;
|
|
2586
|
+
overflow: hidden;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
.sibu-error-fallback .sibu-error-header {
|
|
2590
|
+
display: flex;
|
|
2591
|
+
align-items: center;
|
|
2592
|
+
gap: 8px;
|
|
2593
|
+
padding: 12px 16px;
|
|
2594
|
+
background: #e5484d;
|
|
2595
|
+
color: white;
|
|
2585
2596
|
}
|
|
2586
2597
|
|
|
2587
2598
|
.sibu-error-fallback .sibu-error-title {
|
|
2588
|
-
margin: 0
|
|
2589
|
-
|
|
2590
|
-
font-size: 1.1em;
|
|
2599
|
+
margin: 0;
|
|
2600
|
+
font-size: 0.95em;
|
|
2591
2601
|
font-weight: 600;
|
|
2592
2602
|
}
|
|
2593
2603
|
|
|
2604
|
+
.sibu-error-fallback .sibu-error-source {
|
|
2605
|
+
margin-left: auto;
|
|
2606
|
+
font-size: 0.8em;
|
|
2607
|
+
opacity: 0.9;
|
|
2608
|
+
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
.sibu-error-fallback .sibu-error-body {
|
|
2612
|
+
padding: 16px;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2594
2615
|
.sibu-error-fallback .sibu-error-message {
|
|
2595
2616
|
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
border-radius: 6px;
|
|
2599
|
-
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
2600
|
-
margin: 10px 0;
|
|
2601
|
-
color: #495057;
|
|
2617
|
+
margin: 0 0 12px 0;
|
|
2618
|
+
color: #f1a9a0;
|
|
2602
2619
|
word-break: break-word;
|
|
2603
2620
|
font-size: 0.9em;
|
|
2604
2621
|
line-height: 1.5;
|
|
2605
2622
|
}
|
|
2606
2623
|
|
|
2624
|
+
.sibu-error-fallback .sibu-error-stack-container {
|
|
2625
|
+
position: relative;
|
|
2626
|
+
margin: 0 0 12px 0;
|
|
2627
|
+
border-radius: 6px;
|
|
2628
|
+
border: 1px solid #2a2a3e;
|
|
2629
|
+
background: #12121f;
|
|
2630
|
+
overflow: hidden;
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
.sibu-error-fallback .sibu-error-stack-label {
|
|
2634
|
+
display: flex;
|
|
2635
|
+
align-items: center;
|
|
2636
|
+
justify-content: space-between;
|
|
2637
|
+
padding: 6px 12px;
|
|
2638
|
+
background: #1e1e32;
|
|
2639
|
+
border-bottom: 1px solid #2a2a3e;
|
|
2640
|
+
font-size: 0.75em;
|
|
2641
|
+
color: #888;
|
|
2642
|
+
text-transform: uppercase;
|
|
2643
|
+
letter-spacing: 0.05em;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
.sibu-error-fallback .sibu-error-copy-btn {
|
|
2647
|
+
background: transparent;
|
|
2648
|
+
border: 1px solid #3a3a4e;
|
|
2649
|
+
border-radius: 4px;
|
|
2650
|
+
color: #888;
|
|
2651
|
+
cursor: pointer;
|
|
2652
|
+
padding: 2px 8px;
|
|
2653
|
+
font-size: 1em;
|
|
2654
|
+
transition: all 0.15s ease;
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
.sibu-error-fallback .sibu-error-copy-btn:hover {
|
|
2658
|
+
background: #2a2a3e;
|
|
2659
|
+
color: #ccc;
|
|
2660
|
+
border-color: #4a4a5e;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
.sibu-error-fallback .sibu-error-stack pre {
|
|
2664
|
+
margin: 0;
|
|
2665
|
+
padding: 12px;
|
|
2666
|
+
overflow-x: auto;
|
|
2667
|
+
font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
|
|
2668
|
+
font-size: 0.82em;
|
|
2669
|
+
line-height: 1.6;
|
|
2670
|
+
color: #a0a0b0;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
.sibu-error-fallback .sibu-error-stack .sibu-line-num {
|
|
2674
|
+
display: inline-block;
|
|
2675
|
+
width: 3ch;
|
|
2676
|
+
margin-right: 12px;
|
|
2677
|
+
color: #555;
|
|
2678
|
+
text-align: right;
|
|
2679
|
+
user-select: none;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
.sibu-error-fallback .sibu-error-stack .sibu-stack-fn {
|
|
2683
|
+
color: #7ec8e3;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
.sibu-error-fallback .sibu-error-stack .sibu-stack-loc {
|
|
2687
|
+
color: #666;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
.sibu-error-fallback .sibu-error-actions {
|
|
2691
|
+
display: flex;
|
|
2692
|
+
gap: 8px;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2607
2695
|
.sibu-error-fallback .sibu-error-btn {
|
|
2608
2696
|
display: inline-flex;
|
|
2609
2697
|
align-items: center;
|
|
@@ -2612,22 +2700,28 @@ var errorBoundaryStyles = `
|
|
|
2612
2700
|
border: none;
|
|
2613
2701
|
border-radius: 6px;
|
|
2614
2702
|
cursor: pointer;
|
|
2615
|
-
font-size:
|
|
2703
|
+
font-size: 13px;
|
|
2616
2704
|
font-weight: 500;
|
|
2617
|
-
transition: all 0.
|
|
2618
|
-
|
|
2619
|
-
|
|
2705
|
+
transition: all 0.15s ease;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
.sibu-error-fallback .sibu-error-btn-retry {
|
|
2709
|
+
background: #e5484d;
|
|
2620
2710
|
color: white;
|
|
2621
2711
|
}
|
|
2622
2712
|
|
|
2623
|
-
.sibu-error-fallback .sibu-error-btn:hover {
|
|
2624
|
-
background
|
|
2625
|
-
transform: translateY(-1px);
|
|
2626
|
-
box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
|
|
2713
|
+
.sibu-error-fallback .sibu-error-btn-retry:hover {
|
|
2714
|
+
background: #d13438;
|
|
2627
2715
|
}
|
|
2628
2716
|
|
|
2629
|
-
.sibu-error-fallback .sibu-error-btn
|
|
2630
|
-
|
|
2717
|
+
.sibu-error-fallback .sibu-error-btn-reload {
|
|
2718
|
+
background: #2a2a3e;
|
|
2719
|
+
color: #ccc;
|
|
2720
|
+
border: 1px solid #3a3a4e;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
.sibu-error-fallback .sibu-error-btn-reload:hover {
|
|
2724
|
+
background: #3a3a4e;
|
|
2631
2725
|
}
|
|
2632
2726
|
`;
|
|
2633
2727
|
var stylesInjected = false;
|
|
@@ -2651,6 +2745,35 @@ function getMemoizedFallback(fallbackFn, error, retry) {
|
|
|
2651
2745
|
}
|
|
2652
2746
|
return cache2.get(key);
|
|
2653
2747
|
}
|
|
2748
|
+
function parseStack(err) {
|
|
2749
|
+
const stack = err.stack || "";
|
|
2750
|
+
const lines = stack.split("\n");
|
|
2751
|
+
const frames = [];
|
|
2752
|
+
let source2 = "";
|
|
2753
|
+
for (const line2 of lines) {
|
|
2754
|
+
const trimmed = line2.trim();
|
|
2755
|
+
const chromeMatch = trimmed.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
|
|
2756
|
+
if (chromeMatch) {
|
|
2757
|
+
const fn = chromeMatch[1] || "(anonymous)";
|
|
2758
|
+
const loc = chromeMatch[2] || chromeMatch[3] || "";
|
|
2759
|
+
frames.push({ fn, loc });
|
|
2760
|
+
if (!source2 && fn !== "(anonymous)" && !fn.startsWith("Object.") && !fn.startsWith("Module.")) {
|
|
2761
|
+
source2 = fn;
|
|
2762
|
+
}
|
|
2763
|
+
continue;
|
|
2764
|
+
}
|
|
2765
|
+
const firefoxMatch = trimmed.match(/^(.+?)@(.+)$/);
|
|
2766
|
+
if (firefoxMatch) {
|
|
2767
|
+
const fn = firefoxMatch[1] || "(anonymous)";
|
|
2768
|
+
const loc = firefoxMatch[2] || "";
|
|
2769
|
+
frames.push({ fn, loc });
|
|
2770
|
+
if (!source2 && fn !== "(anonymous)") {
|
|
2771
|
+
source2 = fn;
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
return { source: source2, frames };
|
|
2776
|
+
}
|
|
2654
2777
|
function ErrorBoundary({ nodes, fallback, onError }) {
|
|
2655
2778
|
injectStyles();
|
|
2656
2779
|
const [error, setError] = signal(null);
|
|
@@ -2666,24 +2789,112 @@ function ErrorBoundary({ nodes, fallback, onError }) {
|
|
|
2666
2789
|
onError?.(errorObj);
|
|
2667
2790
|
return errorObj;
|
|
2668
2791
|
};
|
|
2669
|
-
const defaultFallback = (err, retryFn) =>
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
nodes:
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2792
|
+
const defaultFallback = (err, retryFn) => {
|
|
2793
|
+
if (!_isDev8) {
|
|
2794
|
+
return div({
|
|
2795
|
+
class: "sibu-error-fallback",
|
|
2796
|
+
nodes: [
|
|
2797
|
+
div({
|
|
2798
|
+
class: "sibu-error-header",
|
|
2799
|
+
nodes: [h3({ nodes: "Something went wrong", class: "sibu-error-title" })]
|
|
2800
|
+
}),
|
|
2801
|
+
div({
|
|
2802
|
+
class: "sibu-error-body",
|
|
2803
|
+
nodes: [
|
|
2804
|
+
p({ nodes: "An unexpected error occurred. Please try again.", class: "sibu-error-message" }),
|
|
2805
|
+
div({
|
|
2806
|
+
class: "sibu-error-actions",
|
|
2807
|
+
nodes: [
|
|
2808
|
+
button({
|
|
2809
|
+
nodes: "Retry",
|
|
2810
|
+
class: "sibu-error-btn sibu-error-btn-retry",
|
|
2811
|
+
on: { click: retryFn }
|
|
2812
|
+
}),
|
|
2813
|
+
button({
|
|
2814
|
+
nodes: "Reload Page",
|
|
2815
|
+
class: "sibu-error-btn sibu-error-btn-reload",
|
|
2816
|
+
on: { click: () => location.reload() }
|
|
2817
|
+
})
|
|
2818
|
+
]
|
|
2819
|
+
})
|
|
2820
|
+
]
|
|
2821
|
+
})
|
|
2822
|
+
]
|
|
2823
|
+
});
|
|
2824
|
+
}
|
|
2825
|
+
const { source: source2, frames } = parseStack(err);
|
|
2826
|
+
const fullText = `${err.message}
|
|
2827
|
+
|
|
2828
|
+
${err.stack || ""}`;
|
|
2829
|
+
const copyBtn = button({
|
|
2830
|
+
nodes: "Copy",
|
|
2831
|
+
class: "sibu-error-copy-btn",
|
|
2832
|
+
on: {
|
|
2833
|
+
click: () => {
|
|
2834
|
+
navigator.clipboard.writeText(fullText).then(() => {
|
|
2835
|
+
copyBtn.textContent = "Copied!";
|
|
2836
|
+
setTimeout(() => {
|
|
2837
|
+
copyBtn.textContent = "Copy";
|
|
2838
|
+
}, 1500);
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
});
|
|
2843
|
+
const stackLines = frames.map(
|
|
2844
|
+
(f, i2) => div({
|
|
2845
|
+
nodes: [
|
|
2846
|
+
span({ class: "sibu-line-num", nodes: String(i2 + 1) }),
|
|
2847
|
+
span({ class: "sibu-stack-fn", nodes: f.fn }),
|
|
2848
|
+
span({ class: "sibu-stack-loc", nodes: ` ${f.loc}` })
|
|
2849
|
+
]
|
|
2684
2850
|
})
|
|
2685
|
-
|
|
2686
|
-
|
|
2851
|
+
);
|
|
2852
|
+
return div({
|
|
2853
|
+
class: "sibu-error-fallback",
|
|
2854
|
+
nodes: [
|
|
2855
|
+
div({
|
|
2856
|
+
class: "sibu-error-header",
|
|
2857
|
+
nodes: [
|
|
2858
|
+
h3({ nodes: source2 ? `Error in ${source2}` : "Something went wrong", class: "sibu-error-title" }),
|
|
2859
|
+
...source2 ? [] : [span()]
|
|
2860
|
+
]
|
|
2861
|
+
}),
|
|
2862
|
+
div({
|
|
2863
|
+
class: "sibu-error-body",
|
|
2864
|
+
nodes: [
|
|
2865
|
+
p({ nodes: err.message, class: "sibu-error-message" }),
|
|
2866
|
+
...frames.length > 0 ? [
|
|
2867
|
+
div({
|
|
2868
|
+
class: "sibu-error-stack-container",
|
|
2869
|
+
nodes: [
|
|
2870
|
+
div({
|
|
2871
|
+
class: "sibu-error-stack-label",
|
|
2872
|
+
nodes: [span({ nodes: "Stack Trace" }), copyBtn]
|
|
2873
|
+
}),
|
|
2874
|
+
div({ class: "sibu-error-stack", nodes: [pre({ nodes: stackLines })] })
|
|
2875
|
+
]
|
|
2876
|
+
})
|
|
2877
|
+
] : [],
|
|
2878
|
+
div({
|
|
2879
|
+
class: "sibu-error-actions",
|
|
2880
|
+
nodes: [
|
|
2881
|
+
button({
|
|
2882
|
+
nodes: "Retry",
|
|
2883
|
+
class: "sibu-error-btn sibu-error-btn-retry",
|
|
2884
|
+
on: { click: retryFn }
|
|
2885
|
+
}),
|
|
2886
|
+
button({
|
|
2887
|
+
nodes: "Reload Page",
|
|
2888
|
+
class: "sibu-error-btn sibu-error-btn-reload",
|
|
2889
|
+
on: { click: () => location.reload() }
|
|
2890
|
+
})
|
|
2891
|
+
]
|
|
2892
|
+
})
|
|
2893
|
+
]
|
|
2894
|
+
})
|
|
2895
|
+
]
|
|
2896
|
+
});
|
|
2897
|
+
};
|
|
2687
2898
|
const tryRenderFallback = (err) => {
|
|
2688
2899
|
const fn = fallback || defaultFallback;
|
|
2689
2900
|
try {
|