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.
Files changed (95) hide show
  1. package/README.md +29 -25
  2. package/dist/browser.cjs +804 -2
  3. package/dist/browser.d.cts +591 -1
  4. package/dist/browser.d.ts +591 -1
  5. package/dist/browser.js +50 -8
  6. package/dist/build.cjs +655 -237
  7. package/dist/build.js +15 -93
  8. package/dist/cdn.global.js +188 -7
  9. package/dist/chunk-2BYQDGN3.js +742 -0
  10. package/dist/chunk-32DY64NT.js +282 -0
  11. package/dist/chunk-3AIRKM3B.js +1263 -0
  12. package/dist/chunk-3X2YG6YM.js +505 -0
  13. package/dist/chunk-5X6PP2UK.js +28 -0
  14. package/dist/chunk-77L6NL3X.js +1097 -0
  15. package/dist/chunk-BGN5ZMP4.js +26 -0
  16. package/dist/chunk-BTU3TJDS.js +365 -0
  17. package/dist/chunk-CHF5OHIA.js +61 -0
  18. package/dist/chunk-CMBFNA7L.js +27 -0
  19. package/dist/chunk-CNZ35WI2.js +178 -0
  20. package/dist/chunk-DAHRH4ON.js +331 -0
  21. package/dist/chunk-EBGIRKQY.js +616 -0
  22. package/dist/chunk-EUZND3CB.js +27 -0
  23. package/dist/chunk-F3FA4F32.js +292 -0
  24. package/dist/chunk-JAKHTMQU.js +1000 -0
  25. package/dist/chunk-JCI5M6U6.js +956 -0
  26. package/dist/chunk-KQPDEVVS.js +398 -0
  27. package/dist/chunk-M4NLBH4I.js +725 -0
  28. package/dist/chunk-NEKUBFPT.js +60 -0
  29. package/dist/chunk-NYVAC6P5.js +37 -0
  30. package/dist/chunk-PTQJDMRT.js +146 -0
  31. package/dist/chunk-QWZG56ET.js +2744 -0
  32. package/dist/chunk-TSOKIX5Z.js +654 -0
  33. package/dist/chunk-UHNL42EF.js +2730 -0
  34. package/dist/chunk-VRW3FULF.js +725 -0
  35. package/dist/chunk-WZSPOOER.js +84 -0
  36. package/dist/chunk-YT6HQ6AM.js +14 -0
  37. package/dist/chunk-ZD6OAMTH.js +277 -0
  38. package/dist/chunk-ZWKZCBO6.js +317 -0
  39. package/dist/contracts-DDrwxvJ-.d.cts +245 -0
  40. package/dist/contracts-DDrwxvJ-.d.ts +245 -0
  41. package/dist/contracts-xo5ckdRP.d.cts +240 -0
  42. package/dist/contracts-xo5ckdRP.d.ts +240 -0
  43. package/dist/data.cjs +35 -2
  44. package/dist/data.d.cts +7 -0
  45. package/dist/data.d.ts +7 -0
  46. package/dist/data.js +9 -8
  47. package/dist/devtools.cjs +122 -0
  48. package/dist/devtools.d.cts +69 -461
  49. package/dist/devtools.d.ts +69 -461
  50. package/dist/devtools.js +127 -6
  51. package/dist/ecosystem.cjs +23 -6
  52. package/dist/ecosystem.d.cts +1 -1
  53. package/dist/ecosystem.d.ts +1 -1
  54. package/dist/ecosystem.js +10 -9
  55. package/dist/extras.cjs +1208 -88
  56. package/dist/extras.d.cts +6 -6
  57. package/dist/extras.d.ts +6 -6
  58. package/dist/extras.js +70 -33
  59. package/dist/index.cjs +663 -158
  60. package/dist/index.d.cts +398 -40
  61. package/dist/index.d.ts +398 -40
  62. package/dist/index.js +39 -21
  63. package/dist/introspect-BumjnBKr.d.cts +477 -0
  64. package/dist/introspect-CZrlcaYy.d.ts +477 -0
  65. package/dist/introspect-Cb0zgpi2.d.cts +477 -0
  66. package/dist/introspect-Y2xNXGSf.d.ts +477 -0
  67. package/dist/motion.js +4 -4
  68. package/dist/patterns.cjs +51 -24
  69. package/dist/patterns.d.cts +19 -57
  70. package/dist/patterns.d.ts +19 -57
  71. package/dist/patterns.js +8 -16
  72. package/dist/performance.js +4 -4
  73. package/dist/plugins.cjs +429 -82
  74. package/dist/plugins.d.cts +27 -4
  75. package/dist/plugins.d.ts +27 -4
  76. package/dist/plugins.js +156 -37
  77. package/dist/ssr-4PBXAOO3.js +40 -0
  78. package/dist/ssr-Do_SiVoL.d.cts +201 -0
  79. package/dist/ssr-Do_SiVoL.d.ts +201 -0
  80. package/dist/ssr.cjs +312 -60
  81. package/dist/ssr.d.cts +10 -1
  82. package/dist/ssr.d.ts +10 -1
  83. package/dist/ssr.js +13 -10
  84. package/dist/tagFactory-DaJ0YWX6.d.cts +47 -0
  85. package/dist/tagFactory-DaJ0YWX6.d.ts +47 -0
  86. package/dist/testing.cjs +233 -2
  87. package/dist/testing.d.cts +42 -1
  88. package/dist/testing.d.ts +42 -1
  89. package/dist/testing.js +129 -2
  90. package/dist/ui.cjs +374 -8
  91. package/dist/ui.d.cts +252 -2
  92. package/dist/ui.d.ts +252 -2
  93. package/dist/ui.js +329 -11
  94. package/dist/widgets.js +7 -7
  95. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -22,12 +22,14 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  DynamicComponent: () => DynamicComponent,
24
24
  ErrorBoundary: () => ErrorBoundary,
25
+ ErrorDisplay: () => ErrorDisplay,
25
26
  Fragment: () => Fragment,
26
27
  KeepAlive: () => KeepAlive,
27
28
  Loading: () => Loading,
28
29
  Portal: () => Portal,
29
30
  SVG_NS: () => SVG_NS,
30
31
  Suspense: () => Suspense,
32
+ __resetIdCounter: () => __resetIdCounter,
31
33
  a: () => a,
32
34
  abbr: () => abbr,
33
35
  action: () => action,
@@ -36,6 +38,7 @@ __export(index_exports, {
36
38
  array: () => array,
37
39
  article: () => article,
38
40
  aside: () => aside,
41
+ asyncDerived: () => asyncDerived,
39
42
  audio: () => audio,
40
43
  autoResize: () => autoResize,
41
44
  b: () => b,
@@ -63,12 +66,14 @@ __export(index_exports, {
63
66
  colgroup: () => colgroup,
64
67
  context: () => context,
65
68
  copyOnClick: () => copyOnClick,
69
+ createId: () => createId,
66
70
  customElement: () => customElement,
67
71
  data: () => data,
68
72
  datalist: () => datalist,
69
73
  dd: () => dd,
70
74
  deepEqual: () => deepEqual,
71
75
  deepSignal: () => deepSignal,
76
+ defer: () => defer,
72
77
  defs: () => defs,
73
78
  del: () => del,
74
79
  derived: () => derived,
@@ -129,13 +134,12 @@ __export(index_exports, {
129
134
  mask: () => mask,
130
135
  match: () => match,
131
136
  math: () => math,
132
- memo: () => memo,
133
- memoFn: () => memoFn,
134
137
  menu: () => menu,
135
138
  meta: () => meta,
136
139
  meter: () => meter,
137
140
  mount: () => mount,
138
141
  nav: () => nav,
142
+ nextTick: () => nextTick,
139
143
  noscript: () => noscript,
140
144
  object: () => object,
141
145
  ol: () => ol,
@@ -181,6 +185,8 @@ __export(index_exports, {
181
185
  span: () => span,
182
186
  stop: () => stop,
183
187
  store: () => store,
188
+ strict: () => strict,
189
+ strictEffect: () => strictEffect,
184
190
  strong: () => strong,
185
191
  style: () => style,
186
192
  sub: () => sub,
@@ -202,6 +208,7 @@ __export(index_exports, {
202
208
  title: () => title,
203
209
  tr: () => tr,
204
210
  track: () => track2,
211
+ transition: () => transition,
205
212
  trapFocus: () => trapFocus,
206
213
  tspan: () => tspan,
207
214
  u: () => u,
@@ -521,7 +528,20 @@ function cleanup(subscriber) {
521
528
 
522
529
  // src/reactivity/bindAttribute.ts
523
530
  var _isDev3 = isDev();
531
+ function isEventHandlerAttr(name) {
532
+ if (name.length < 3) return false;
533
+ const lower = name.toLowerCase();
534
+ return lower[0] === "o" && lower[1] === "n" && lower.charCodeAt(2) >= 97 && lower.charCodeAt(2) <= 122;
535
+ }
524
536
  function bindAttribute(el, attr, getter) {
537
+ if (isEventHandlerAttr(attr)) {
538
+ if (_isDev3)
539
+ devWarn(
540
+ `bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
541
+ );
542
+ return () => {
543
+ };
544
+ }
525
545
  function commit() {
526
546
  let value;
527
547
  try {
@@ -831,16 +851,20 @@ function appendChildren(el, nodes) {
831
851
  var tagFactory = (tag, ns) => (first, second) => {
832
852
  const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
833
853
  if (first === void 0) return el;
834
- if (second === void 0 && typeof first === "string") {
854
+ if (typeof first === "string") {
855
+ if (second !== void 0) {
856
+ el.setAttribute("class", first);
857
+ appendChildren(el, second);
858
+ return el;
859
+ }
835
860
  el.textContent = first;
836
861
  return el;
837
862
  }
838
- if (second !== void 0) {
839
- el.setAttribute("class", first);
840
- appendChildren(el, second);
863
+ if (typeof first === "number") {
864
+ el.textContent = String(first);
841
865
  return el;
842
866
  }
843
- if (Array.isArray(first) || first instanceof Node) {
867
+ if (Array.isArray(first) || first instanceof Node || typeof first === "function") {
844
868
  appendChildren(el, first);
845
869
  return el;
846
870
  }
@@ -849,7 +873,7 @@ var tagFactory = (tag, ns) => (first, second) => {
849
873
  if (pClass != null) applyClass(el, pClass);
850
874
  const pId = props.id;
851
875
  if (pId != null) el.id = pId;
852
- const pNodes = props.nodes;
876
+ const pNodes = second !== void 0 ? second : props.nodes;
853
877
  if (pNodes != null) appendChildren(el, pNodes);
854
878
  const pOn = props.on;
855
879
  if (pOn) {
@@ -1933,6 +1957,16 @@ function setGlobalErrorHandler(handler) {
1933
1957
  globalErrorHandler = handler;
1934
1958
  }
1935
1959
 
1960
+ // src/core/rendering/createId.ts
1961
+ var idCounter = 0;
1962
+ function createId(prefix = "sibu") {
1963
+ idCounter++;
1964
+ return `${prefix}-${idCounter}`;
1965
+ }
1966
+ function __resetIdCounter() {
1967
+ idCounter = 0;
1968
+ }
1969
+
1936
1970
  // src/reactivity/batch.ts
1937
1971
  var batchDepth = 0;
1938
1972
  var pendingSignals = /* @__PURE__ */ new Set();
@@ -2013,11 +2047,12 @@ function disableSSR() {
2013
2047
  ssrMode = false;
2014
2048
  }
2015
2049
  function withSSR(fn) {
2050
+ const wasSSR = ssrMode;
2016
2051
  enableSSR();
2017
2052
  try {
2018
2053
  return fn();
2019
2054
  } finally {
2020
- disableSSR();
2055
+ if (!wasSSR) disableSSR();
2021
2056
  }
2022
2057
  }
2023
2058
 
@@ -2230,16 +2265,6 @@ function ref(initial) {
2230
2265
  };
2231
2266
  }
2232
2267
 
2233
- // src/core/signals/memo.ts
2234
- function memo(factory) {
2235
- return derived(factory);
2236
- }
2237
-
2238
- // src/core/signals/memoFn.ts
2239
- function memoFn(callback) {
2240
- return derived(callback);
2241
- }
2242
-
2243
2268
  // src/core/signals/array.ts
2244
2269
  function array(initial = []) {
2245
2270
  const [arr, setArr] = signal([...initial]);
@@ -2467,6 +2492,47 @@ function writable(get, set, options) {
2467
2492
  return [getter, setter];
2468
2493
  }
2469
2494
 
2495
+ // src/core/signals/asyncDerived.ts
2496
+ function asyncDerived(factory, initial) {
2497
+ const [value, setValue] = signal(initial);
2498
+ const [loading, setLoading] = signal(false);
2499
+ const [error, setError] = signal(null);
2500
+ const [tick, setTick] = signal(0);
2501
+ let runId = 0;
2502
+ effect(() => {
2503
+ tick();
2504
+ const currentRun = ++runId;
2505
+ setLoading(true);
2506
+ setError(null);
2507
+ let promise;
2508
+ try {
2509
+ promise = factory();
2510
+ } catch (err) {
2511
+ setError(err);
2512
+ setLoading(false);
2513
+ return;
2514
+ }
2515
+ promise.then(
2516
+ (result) => {
2517
+ if (currentRun !== runId) return;
2518
+ setValue(result);
2519
+ setLoading(false);
2520
+ },
2521
+ (err) => {
2522
+ if (currentRun !== runId) return;
2523
+ setError(err);
2524
+ setLoading(false);
2525
+ }
2526
+ );
2527
+ });
2528
+ return {
2529
+ value,
2530
+ loading,
2531
+ error,
2532
+ refresh: () => setTick((n) => n + 1)
2533
+ };
2534
+ }
2535
+
2470
2536
  // src/core/rendering/lifecycle.ts
2471
2537
  function safeCall(cb, hookName) {
2472
2538
  try {
@@ -2545,6 +2611,116 @@ function context(defaultValue) {
2545
2611
  };
2546
2612
  }
2547
2613
 
2614
+ // src/core/strict.ts
2615
+ function strict(fn) {
2616
+ const result = fn();
2617
+ if (isDev()) {
2618
+ queueMicrotask(() => {
2619
+ try {
2620
+ fn();
2621
+ } catch (err) {
2622
+ console.warn("[Sibu strict] second run threw:", err);
2623
+ }
2624
+ });
2625
+ }
2626
+ return result;
2627
+ }
2628
+ function strictEffect(fn) {
2629
+ if (!isDev()) {
2630
+ return effect(fn);
2631
+ }
2632
+ const firstTeardown = effect(fn);
2633
+ let secondTeardown = null;
2634
+ queueMicrotask(() => {
2635
+ try {
2636
+ secondTeardown = effect(fn);
2637
+ } catch (err) {
2638
+ console.warn("[Sibu strictEffect] second run threw:", err);
2639
+ }
2640
+ });
2641
+ return () => {
2642
+ firstTeardown();
2643
+ if (secondTeardown) secondTeardown();
2644
+ };
2645
+ }
2646
+
2647
+ // src/reactivity/nextTick.ts
2648
+ function nextTick() {
2649
+ return new Promise((resolve) => {
2650
+ queueMicrotask(() => {
2651
+ if (typeof requestAnimationFrame === "function") {
2652
+ requestAnimationFrame(() => resolve());
2653
+ } else {
2654
+ resolve();
2655
+ }
2656
+ });
2657
+ });
2658
+ }
2659
+
2660
+ // src/reactivity/concurrent.ts
2661
+ function defer(getter) {
2662
+ const [value, setValue] = signal(getter());
2663
+ let pending = false;
2664
+ let latest = value();
2665
+ const flush = () => {
2666
+ pending = false;
2667
+ setValue(latest);
2668
+ };
2669
+ const schedule = () => {
2670
+ if (pending) return;
2671
+ pending = true;
2672
+ queueMicrotask(() => {
2673
+ if (typeof requestAnimationFrame === "function") {
2674
+ requestAnimationFrame(flush);
2675
+ } else {
2676
+ flush();
2677
+ }
2678
+ });
2679
+ };
2680
+ track(() => {
2681
+ latest = getter();
2682
+ schedule();
2683
+ });
2684
+ return value;
2685
+ }
2686
+ var IDLE_FALLBACK_MS = 16;
2687
+ function scheduleIdle(fn) {
2688
+ const g2 = globalThis;
2689
+ if (typeof g2.requestIdleCallback === "function") {
2690
+ g2.requestIdleCallback(fn, { timeout: IDLE_FALLBACK_MS * 4 });
2691
+ return;
2692
+ }
2693
+ if (typeof requestAnimationFrame === "function") {
2694
+ requestAnimationFrame(() => fn());
2695
+ return;
2696
+ }
2697
+ setTimeout(fn, IDLE_FALLBACK_MS);
2698
+ }
2699
+ function transition() {
2700
+ const [pending, setPending] = signal(false);
2701
+ function start(fn) {
2702
+ setPending(true);
2703
+ scheduleIdle(() => {
2704
+ let result;
2705
+ try {
2706
+ result = fn();
2707
+ } catch {
2708
+ setPending(false);
2709
+ return;
2710
+ }
2711
+ if (result && typeof result.then === "function") {
2712
+ result.then(
2713
+ () => setPending(false),
2714
+ () => setPending(false)
2715
+ );
2716
+ } else {
2717
+ setPending(false);
2718
+ }
2719
+ });
2720
+ }
2721
+ return { pending, start };
2722
+ }
2723
+
2548
2724
  // src/core/rendering/lazy.ts
2549
2725
  function lazy(importFn) {
2550
2726
  let cached = null;
@@ -2603,8 +2779,446 @@ function Suspense({ nodes, fallback }) {
2603
2779
  return container;
2604
2780
  }
2605
2781
 
2606
- // src/components/ErrorBoundary.ts
2782
+ // src/components/ErrorDisplay.ts
2607
2783
  var _isDev8 = isDev();
2784
+ var STYLES = `
2785
+ .sibu-error-display {
2786
+ border: 1px solid var(--sibu-err-border, #e5484d);
2787
+ border-radius: 10px;
2788
+ margin: 12px 0;
2789
+ background: #0f0f1a;
2790
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
2791
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
2792
+ color: #e5e7eb;
2793
+ overflow: hidden;
2794
+ }
2795
+ .sibu-error-display[data-severity="warning"] { --sibu-err-border: #d97706; --sibu-err-accent: #d97706; }
2796
+ .sibu-error-display[data-severity="info"] { --sibu-err-border: #3b82f6; --sibu-err-accent: #3b82f6; }
2797
+ .sibu-error-display { --sibu-err-accent: #e5484d; }
2798
+
2799
+ .sibu-error-display .sibu-err-header {
2800
+ display: flex;
2801
+ align-items: center;
2802
+ gap: 10px;
2803
+ padding: 12px 18px;
2804
+ background: var(--sibu-err-accent);
2805
+ color: white;
2806
+ user-select: none;
2807
+ }
2808
+ .sibu-error-display .sibu-err-icon {
2809
+ font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
2810
+ font-weight: bold;
2811
+ font-size: 1.05em;
2812
+ padding: 2px 8px;
2813
+ background: rgba(0, 0, 0, 0.22);
2814
+ border-radius: 4px;
2815
+ letter-spacing: 0.02em;
2816
+ }
2817
+ .sibu-error-display .sibu-err-title {
2818
+ margin: 0;
2819
+ font-size: 0.98em;
2820
+ font-weight: 600;
2821
+ flex: 1;
2822
+ text-overflow: ellipsis;
2823
+ overflow: hidden;
2824
+ white-space: nowrap;
2825
+ }
2826
+ .sibu-error-display .sibu-err-timestamp {
2827
+ font-size: 0.75em;
2828
+ opacity: 0.85;
2829
+ font-family: 'SF Mono', 'JetBrains Mono', monospace;
2830
+ }
2831
+
2832
+ .sibu-error-display .sibu-err-body {
2833
+ padding: 16px 18px;
2834
+ }
2835
+ .sibu-error-display .sibu-err-message {
2836
+ font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
2837
+ margin: 0 0 14px;
2838
+ color: #fecaca;
2839
+ word-break: break-word;
2840
+ font-size: 0.9em;
2841
+ line-height: 1.55;
2842
+ padding: 10px 12px;
2843
+ background: rgba(229, 72, 77, 0.08);
2844
+ border-left: 3px solid var(--sibu-err-accent);
2845
+ border-radius: 4px;
2846
+ }
2847
+
2848
+ .sibu-error-display .sibu-err-section {
2849
+ margin-top: 14px;
2850
+ border-radius: 6px;
2851
+ border: 1px solid #2a2a3e;
2852
+ background: #0a0a14;
2853
+ overflow: hidden;
2854
+ }
2855
+ .sibu-error-display .sibu-err-section-head {
2856
+ display: flex;
2857
+ align-items: center;
2858
+ justify-content: space-between;
2859
+ padding: 6px 12px;
2860
+ background: #16162a;
2861
+ border-bottom: 1px solid #2a2a3e;
2862
+ font-size: 0.72em;
2863
+ color: #8b8fa3;
2864
+ text-transform: uppercase;
2865
+ letter-spacing: 0.08em;
2866
+ font-weight: 600;
2867
+ }
2868
+ .sibu-error-display .sibu-err-copy-btn {
2869
+ background: transparent;
2870
+ border: 1px solid #3a3a4e;
2871
+ border-radius: 4px;
2872
+ color: #a0a3b8;
2873
+ cursor: pointer;
2874
+ padding: 2px 10px;
2875
+ font-size: 0.95em;
2876
+ font-family: inherit;
2877
+ transition: all 0.12s ease;
2878
+ }
2879
+ .sibu-error-display .sibu-err-copy-btn:hover {
2880
+ background: #2a2a3e;
2881
+ color: #e5e7eb;
2882
+ border-color: #4a4a5e;
2883
+ }
2884
+
2885
+ .sibu-error-display .sibu-err-stack {
2886
+ margin: 0;
2887
+ padding: 10px 12px;
2888
+ overflow-x: auto;
2889
+ font-family: 'SF Mono', 'JetBrains Mono', monospace;
2890
+ font-size: 0.8em;
2891
+ line-height: 1.7;
2892
+ }
2893
+ .sibu-error-display .sibu-err-frame {
2894
+ display: flex;
2895
+ gap: 10px;
2896
+ padding: 1px 0;
2897
+ }
2898
+ .sibu-error-display .sibu-err-line {
2899
+ display: inline-block;
2900
+ min-width: 2.2ch;
2901
+ color: #4b5066;
2902
+ text-align: right;
2903
+ user-select: none;
2904
+ flex-shrink: 0;
2905
+ }
2906
+ .sibu-error-display .sibu-err-fn {
2907
+ color: #7dd3fc;
2908
+ font-weight: 500;
2909
+ }
2910
+ .sibu-error-display .sibu-err-loc {
2911
+ color: #6b7280;
2912
+ white-space: nowrap;
2913
+ }
2914
+ .sibu-error-display .sibu-err-cause-label {
2915
+ margin: 12px 0 6px;
2916
+ color: #a0a3b8;
2917
+ font-size: 0.75em;
2918
+ text-transform: uppercase;
2919
+ letter-spacing: 0.05em;
2920
+ }
2921
+
2922
+ .sibu-error-display .sibu-err-meta {
2923
+ margin: 0;
2924
+ padding: 10px 12px;
2925
+ font-family: 'SF Mono', 'JetBrains Mono', monospace;
2926
+ font-size: 0.78em;
2927
+ color: #a0a3b8;
2928
+ display: grid;
2929
+ grid-template-columns: minmax(120px, auto) 1fr;
2930
+ gap: 4px 16px;
2931
+ }
2932
+ .sibu-error-display .sibu-err-meta dt { color: #6b7280; }
2933
+ .sibu-error-display .sibu-err-meta dd { margin: 0; color: #d1d5db; word-break: break-word; }
2934
+
2935
+ .sibu-error-display .sibu-err-actions {
2936
+ display: flex;
2937
+ gap: 8px;
2938
+ margin-top: 16px;
2939
+ }
2940
+ .sibu-error-display .sibu-err-btn {
2941
+ display: inline-flex;
2942
+ align-items: center;
2943
+ gap: 6px;
2944
+ padding: 8px 18px;
2945
+ border: none;
2946
+ border-radius: 6px;
2947
+ cursor: pointer;
2948
+ font-size: 13px;
2949
+ font-weight: 500;
2950
+ transition: all 0.12s ease;
2951
+ font-family: inherit;
2952
+ }
2953
+ .sibu-error-display .sibu-err-btn-retry {
2954
+ background: var(--sibu-err-accent);
2955
+ color: white;
2956
+ }
2957
+ .sibu-error-display .sibu-err-btn-retry:hover { filter: brightness(1.1); }
2958
+ .sibu-error-display .sibu-err-btn-reload {
2959
+ background: #1f2133;
2960
+ color: #d1d5db;
2961
+ border: 1px solid #3a3a4e;
2962
+ }
2963
+ .sibu-error-display .sibu-err-btn-reload:hover { background: #2a2b40; }
2964
+ `;
2965
+ var _stylesInjected = false;
2966
+ function injectStyles() {
2967
+ if (_stylesInjected || typeof document === "undefined") return;
2968
+ const el = style({ nodes: STYLES });
2969
+ document.head.appendChild(el);
2970
+ _stylesInjected = true;
2971
+ }
2972
+ function parseStack(stack) {
2973
+ const frames = [];
2974
+ const lines = stack.split("\n");
2975
+ for (const raw of lines) {
2976
+ const line2 = raw.trim();
2977
+ const chrome = line2.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
2978
+ if (chrome) {
2979
+ frames.push({ fn: chrome[1] || "(anonymous)", loc: chrome[2] || chrome[3] || "" });
2980
+ continue;
2981
+ }
2982
+ const ff = line2.match(/^(.+?)@(.+)$/);
2983
+ if (ff) {
2984
+ frames.push({ fn: ff[1] || "(anonymous)", loc: ff[2] || "" });
2985
+ }
2986
+ }
2987
+ return frames;
2988
+ }
2989
+ function normalizeError(err) {
2990
+ if (err instanceof Error) {
2991
+ const code2 = err.code ?? err.name ?? "ERROR";
2992
+ const message = err.message || "Unknown error";
2993
+ const stack = err.stack ?? "";
2994
+ const frames = parseStack(stack);
2995
+ const rawCause = err.cause;
2996
+ const cause = rawCause != null ? normalizeError(rawCause) : null;
2997
+ return { code: code2, message, stack, frames, cause };
2998
+ }
2999
+ return {
3000
+ code: "NON_ERROR",
3001
+ message: typeof err === "string" ? err : JSON.stringify(err),
3002
+ stack: "",
3003
+ frames: [],
3004
+ cause: null
3005
+ };
3006
+ }
3007
+ function buildCopyText(err, meta2) {
3008
+ const lines = [];
3009
+ lines.push(`[${err.code}] ${err.message}`);
3010
+ if (err.stack) {
3011
+ lines.push("");
3012
+ lines.push(err.stack);
3013
+ }
3014
+ if (err.cause) {
3015
+ lines.push("");
3016
+ lines.push("Caused by:");
3017
+ lines.push(` [${err.cause.code}] ${err.cause.message}`);
3018
+ if (err.cause.stack) {
3019
+ const indented = err.cause.stack.split("\n").map((l) => ` ${l}`).join("\n");
3020
+ lines.push(indented);
3021
+ }
3022
+ }
3023
+ if (meta2 && Object.keys(meta2).length > 0) {
3024
+ lines.push("");
3025
+ lines.push("Metadata:");
3026
+ for (const [k, v] of Object.entries(meta2)) {
3027
+ lines.push(` ${k}: ${String(v)}`);
3028
+ }
3029
+ }
3030
+ lines.push("");
3031
+ lines.push(`At: ${(/* @__PURE__ */ new Date()).toISOString()}`);
3032
+ if (typeof navigator !== "undefined" && navigator.userAgent) {
3033
+ lines.push(`UA: ${navigator.userAgent}`);
3034
+ }
3035
+ return lines.join("\n");
3036
+ }
3037
+ function renderFrames(frames) {
3038
+ const rows = frames.map(
3039
+ (f, i2) => div({
3040
+ class: "sibu-err-frame",
3041
+ nodes: [
3042
+ span({ class: "sibu-err-line", nodes: String(i2 + 1) }),
3043
+ span({ class: "sibu-err-fn", nodes: f.fn }),
3044
+ span({ class: "sibu-err-loc", nodes: ` \u2014 ${f.loc}` })
3045
+ ]
3046
+ })
3047
+ );
3048
+ return pre({ class: "sibu-err-stack", nodes: rows });
3049
+ }
3050
+ function renderCauseChain(cause) {
3051
+ if (!cause) return [];
3052
+ return [
3053
+ div({ class: "sibu-err-cause-label", nodes: "Caused by" }),
3054
+ div({
3055
+ class: "sibu-err-section",
3056
+ nodes: [
3057
+ div({
3058
+ class: "sibu-err-section-head",
3059
+ nodes: [span({ nodes: `[${cause.code}] ${cause.message}` }), span({ nodes: "" })]
3060
+ }),
3061
+ cause.frames.length > 0 ? renderFrames(cause.frames) : div({ class: "sibu-err-stack", nodes: "(no stack)" })
3062
+ ]
3063
+ }),
3064
+ ...renderCauseChain(cause.cause)
3065
+ ];
3066
+ }
3067
+ function renderMetadata(meta2) {
3068
+ const rows = [];
3069
+ for (const [k, v] of Object.entries(meta2)) {
3070
+ rows.push(document.createElement("dt"));
3071
+ rows[rows.length - 1].textContent = k;
3072
+ const dd2 = document.createElement("dd");
3073
+ dd2.textContent = v == null ? "(null)" : String(v);
3074
+ rows.push(dd2);
3075
+ }
3076
+ const dl2 = document.createElement("dl");
3077
+ dl2.className = "sibu-err-meta";
3078
+ for (const r of rows) dl2.appendChild(r);
3079
+ return dl2;
3080
+ }
3081
+ function ErrorDisplay(props) {
3082
+ injectStyles();
3083
+ const severity = props.severity ?? "error";
3084
+ const normalized = normalizeError(props.error);
3085
+ const showDetails = props.alwaysShowDetails ?? _isDev8;
3086
+ const headline = props.title ?? normalized.message;
3087
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
3088
+ const [copyLabel, setCopyLabel] = signal("Copy");
3089
+ const copyBtn = button({
3090
+ class: "sibu-err-copy-btn",
3091
+ nodes: () => copyLabel(),
3092
+ on: {
3093
+ click: () => {
3094
+ const text2 = buildCopyText(normalized, props.metadata);
3095
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
3096
+ navigator.clipboard.writeText(text2).then(
3097
+ () => {
3098
+ setCopyLabel("Copied!");
3099
+ setTimeout(() => setCopyLabel("Copy"), 1500);
3100
+ },
3101
+ () => {
3102
+ setCopyLabel("Copy failed");
3103
+ setTimeout(() => setCopyLabel("Copy"), 1500);
3104
+ }
3105
+ );
3106
+ }
3107
+ }
3108
+ }
3109
+ });
3110
+ const header2 = div({
3111
+ class: "sibu-err-header",
3112
+ nodes: [
3113
+ code({ class: "sibu-err-icon", nodes: normalized.code }),
3114
+ h3({ class: "sibu-err-title", nodes: headline }),
3115
+ span({ class: "sibu-err-timestamp", nodes: timestamp })
3116
+ ]
3117
+ });
3118
+ const bodyChildren = [p({ class: "sibu-err-message", nodes: normalized.message })];
3119
+ if (showDetails && normalized.frames.length > 0) {
3120
+ bodyChildren.push(
3121
+ div({
3122
+ class: "sibu-err-section",
3123
+ nodes: [
3124
+ div({
3125
+ class: "sibu-err-section-head",
3126
+ nodes: [span({ nodes: "Stack Trace" }), copyBtn]
3127
+ }),
3128
+ renderFrames(normalized.frames)
3129
+ ]
3130
+ })
3131
+ );
3132
+ } else if (showDetails) {
3133
+ bodyChildren.push(
3134
+ div({
3135
+ class: "sibu-err-section",
3136
+ nodes: [
3137
+ div({
3138
+ class: "sibu-err-section-head",
3139
+ nodes: [span({ nodes: "Details" }), copyBtn]
3140
+ }),
3141
+ div({ class: "sibu-err-stack", nodes: "(no stack available)" })
3142
+ ]
3143
+ })
3144
+ );
3145
+ }
3146
+ if (showDetails) {
3147
+ bodyChildren.push(...renderCauseChain(normalized.cause));
3148
+ }
3149
+ if (showDetails && props.metadata && Object.keys(props.metadata).length > 0) {
3150
+ bodyChildren.push(
3151
+ div({
3152
+ class: "sibu-err-section",
3153
+ nodes: [
3154
+ div({ class: "sibu-err-section-head", nodes: [span({ nodes: "Metadata" })] }),
3155
+ renderMetadata(props.metadata)
3156
+ ]
3157
+ })
3158
+ );
3159
+ }
3160
+ if (showDetails && typeof navigator !== "undefined" && navigator.userAgent) {
3161
+ bodyChildren.push(
3162
+ div({
3163
+ class: "sibu-err-section",
3164
+ nodes: [
3165
+ div({ class: "sibu-err-section-head", nodes: [span({ nodes: "Environment" })] }),
3166
+ div({
3167
+ class: "sibu-err-meta",
3168
+ nodes: (() => {
3169
+ const dl2 = document.createElement("dl");
3170
+ dl2.className = "sibu-err-meta";
3171
+ const entries = [
3172
+ ["User Agent", navigator.userAgent],
3173
+ ["URL", typeof location !== "undefined" ? location.href : "(n/a)"],
3174
+ ["Timestamp", (/* @__PURE__ */ new Date()).toISOString()]
3175
+ ];
3176
+ for (const [k, v] of entries) {
3177
+ const dt2 = document.createElement("dt");
3178
+ dt2.textContent = k;
3179
+ const dd2 = document.createElement("dd");
3180
+ dd2.textContent = v;
3181
+ dl2.appendChild(dt2);
3182
+ dl2.appendChild(dd2);
3183
+ }
3184
+ return dl2;
3185
+ })()
3186
+ })
3187
+ ]
3188
+ })
3189
+ );
3190
+ }
3191
+ const actionButtons = [];
3192
+ if (props.onRetry) {
3193
+ actionButtons.push(
3194
+ button({
3195
+ class: "sibu-err-btn sibu-err-btn-retry",
3196
+ nodes: props.retryLabel ?? "Retry",
3197
+ on: { click: props.onRetry }
3198
+ })
3199
+ );
3200
+ }
3201
+ if (!props.hideReload && typeof location !== "undefined") {
3202
+ actionButtons.push(
3203
+ button({
3204
+ class: "sibu-err-btn sibu-err-btn-reload",
3205
+ nodes: "Reload Page",
3206
+ on: { click: () => location.reload() }
3207
+ })
3208
+ );
3209
+ }
3210
+ if (actionButtons.length > 0) {
3211
+ bodyChildren.push(div({ class: "sibu-err-actions", nodes: actionButtons }));
3212
+ }
3213
+ const body2 = div({ class: "sibu-err-body", nodes: bodyChildren });
3214
+ return div({
3215
+ class: "sibu-error-display",
3216
+ "data-severity": severity,
3217
+ nodes: [header2, body2]
3218
+ });
3219
+ }
3220
+
3221
+ // src/components/ErrorBoundary.ts
2608
3222
  var errorBoundaryStyles = `
2609
3223
  .sibu-error-boundary {
2610
3224
  position: relative;
@@ -2761,7 +3375,7 @@ var errorBoundaryStyles = `
2761
3375
  }
2762
3376
  `;
2763
3377
  var stylesInjected = false;
2764
- function injectStyles() {
3378
+ function injectStyles2() {
2765
3379
  if (!stylesInjected && typeof document !== "undefined") {
2766
3380
  const styleElement = style({ nodes: errorBoundaryStyles });
2767
3381
  document.head.appendChild(styleElement);
@@ -2781,37 +3395,8 @@ function getMemoizedFallback(fallbackFn, error, retry) {
2781
3395
  }
2782
3396
  return cache2.get(key);
2783
3397
  }
2784
- function parseStack(err) {
2785
- const stack = err.stack || "";
2786
- const lines = stack.split("\n");
2787
- const frames = [];
2788
- let source2 = "";
2789
- for (const line2 of lines) {
2790
- const trimmed = line2.trim();
2791
- const chromeMatch = trimmed.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
2792
- if (chromeMatch) {
2793
- const fn = chromeMatch[1] || "(anonymous)";
2794
- const loc = chromeMatch[2] || chromeMatch[3] || "";
2795
- frames.push({ fn, loc });
2796
- if (!source2 && fn !== "(anonymous)" && !fn.startsWith("Object.") && !fn.startsWith("Module.")) {
2797
- source2 = fn;
2798
- }
2799
- continue;
2800
- }
2801
- const firefoxMatch = trimmed.match(/^(.+?)@(.+)$/);
2802
- if (firefoxMatch) {
2803
- const fn = firefoxMatch[1] || "(anonymous)";
2804
- const loc = firefoxMatch[2] || "";
2805
- frames.push({ fn, loc });
2806
- if (!source2 && fn !== "(anonymous)") {
2807
- source2 = fn;
2808
- }
2809
- }
2810
- }
2811
- return { source: source2, frames };
2812
- }
2813
- function ErrorBoundary({ nodes, fallback, onError }) {
2814
- injectStyles();
3398
+ function ErrorBoundary({ nodes, fallback, onError, resetKeys }) {
3399
+ injectStyles2();
2815
3400
  const [error, setError] = signal(null);
2816
3401
  const retry = () => {
2817
3402
  if (fallback) {
@@ -2819,6 +3404,22 @@ function ErrorBoundary({ nodes, fallback, onError }) {
2819
3404
  }
2820
3405
  setError(null);
2821
3406
  };
3407
+ if (resetKeys && resetKeys.length > 0) {
3408
+ let initialized = false;
3409
+ effect(() => {
3410
+ for (const k of resetKeys) {
3411
+ try {
3412
+ k();
3413
+ } catch {
3414
+ }
3415
+ }
3416
+ if (!initialized) {
3417
+ initialized = true;
3418
+ return;
3419
+ }
3420
+ if (error() !== null) retry();
3421
+ });
3422
+ }
2822
3423
  const handleError = (e) => {
2823
3424
  const errorObj = e instanceof Error ? e : new Error(String(e));
2824
3425
  setError(errorObj);
@@ -2826,110 +3427,7 @@ function ErrorBoundary({ nodes, fallback, onError }) {
2826
3427
  return errorObj;
2827
3428
  };
2828
3429
  const defaultFallback = (err, retryFn) => {
2829
- if (!_isDev8) {
2830
- return div({
2831
- class: "sibu-error-fallback",
2832
- nodes: [
2833
- div({
2834
- class: "sibu-error-header",
2835
- nodes: [h3({ nodes: "Something went wrong", class: "sibu-error-title" })]
2836
- }),
2837
- div({
2838
- class: "sibu-error-body",
2839
- nodes: [
2840
- p({ nodes: "An unexpected error occurred. Please try again.", class: "sibu-error-message" }),
2841
- div({
2842
- class: "sibu-error-actions",
2843
- nodes: [
2844
- button({
2845
- nodes: "Retry",
2846
- class: "sibu-error-btn sibu-error-btn-retry",
2847
- on: { click: retryFn }
2848
- }),
2849
- button({
2850
- nodes: "Reload Page",
2851
- class: "sibu-error-btn sibu-error-btn-reload",
2852
- on: { click: () => location.reload() }
2853
- })
2854
- ]
2855
- })
2856
- ]
2857
- })
2858
- ]
2859
- });
2860
- }
2861
- const { source: source2, frames } = parseStack(err);
2862
- const fullText = `${err.message}
2863
-
2864
- ${err.stack || ""}`;
2865
- const copyBtn = button({
2866
- nodes: "Copy",
2867
- class: "sibu-error-copy-btn",
2868
- on: {
2869
- click: () => {
2870
- navigator.clipboard.writeText(fullText).then(() => {
2871
- copyBtn.textContent = "Copied!";
2872
- setTimeout(() => {
2873
- copyBtn.textContent = "Copy";
2874
- }, 1500);
2875
- });
2876
- }
2877
- }
2878
- });
2879
- const stackLines = frames.map(
2880
- (f, i2) => div({
2881
- nodes: [
2882
- span({ class: "sibu-line-num", nodes: String(i2 + 1) }),
2883
- span({ class: "sibu-stack-fn", nodes: f.fn }),
2884
- span({ class: "sibu-stack-loc", nodes: ` ${f.loc}` })
2885
- ]
2886
- })
2887
- );
2888
- return div({
2889
- class: "sibu-error-fallback",
2890
- nodes: [
2891
- div({
2892
- class: "sibu-error-header",
2893
- nodes: [
2894
- h3({ nodes: source2 ? `Error in ${source2}` : "Something went wrong", class: "sibu-error-title" }),
2895
- ...source2 ? [] : [span()]
2896
- ]
2897
- }),
2898
- div({
2899
- class: "sibu-error-body",
2900
- nodes: [
2901
- p({ nodes: err.message, class: "sibu-error-message" }),
2902
- ...frames.length > 0 ? [
2903
- div({
2904
- class: "sibu-error-stack-container",
2905
- nodes: [
2906
- div({
2907
- class: "sibu-error-stack-label",
2908
- nodes: [span({ nodes: "Stack Trace" }), copyBtn]
2909
- }),
2910
- div({ class: "sibu-error-stack", nodes: [pre({ nodes: stackLines })] })
2911
- ]
2912
- })
2913
- ] : [],
2914
- div({
2915
- class: "sibu-error-actions",
2916
- nodes: [
2917
- button({
2918
- nodes: "Retry",
2919
- class: "sibu-error-btn sibu-error-btn-retry",
2920
- on: { click: retryFn }
2921
- }),
2922
- button({
2923
- nodes: "Reload Page",
2924
- class: "sibu-error-btn sibu-error-btn-reload",
2925
- on: { click: () => location.reload() }
2926
- })
2927
- ]
2928
- })
2929
- ]
2930
- })
2931
- ]
2932
- });
3430
+ return ErrorDisplay({ error: err, severity: "error", onRetry: retryFn });
2933
3431
  };
2934
3432
  const tryRenderFallback = (err) => {
2935
3433
  const fn = fallback || defaultFallback;
@@ -3083,12 +3581,14 @@ function Loading(props = {}) {
3083
3581
  0 && (module.exports = {
3084
3582
  DynamicComponent,
3085
3583
  ErrorBoundary,
3584
+ ErrorDisplay,
3086
3585
  Fragment,
3087
3586
  KeepAlive,
3088
3587
  Loading,
3089
3588
  Portal,
3090
3589
  SVG_NS,
3091
3590
  Suspense,
3591
+ __resetIdCounter,
3092
3592
  a,
3093
3593
  abbr,
3094
3594
  action,
@@ -3097,6 +3597,7 @@ function Loading(props = {}) {
3097
3597
  array,
3098
3598
  article,
3099
3599
  aside,
3600
+ asyncDerived,
3100
3601
  audio,
3101
3602
  autoResize,
3102
3603
  b,
@@ -3124,12 +3625,14 @@ function Loading(props = {}) {
3124
3625
  colgroup,
3125
3626
  context,
3126
3627
  copyOnClick,
3628
+ createId,
3127
3629
  customElement,
3128
3630
  data,
3129
3631
  datalist,
3130
3632
  dd,
3131
3633
  deepEqual,
3132
3634
  deepSignal,
3635
+ defer,
3133
3636
  defs,
3134
3637
  del,
3135
3638
  derived,
@@ -3190,13 +3693,12 @@ function Loading(props = {}) {
3190
3693
  mask,
3191
3694
  match,
3192
3695
  math,
3193
- memo,
3194
- memoFn,
3195
3696
  menu,
3196
3697
  meta,
3197
3698
  meter,
3198
3699
  mount,
3199
3700
  nav,
3701
+ nextTick,
3200
3702
  noscript,
3201
3703
  object,
3202
3704
  ol,
@@ -3242,6 +3744,8 @@ function Loading(props = {}) {
3242
3744
  span,
3243
3745
  stop,
3244
3746
  store,
3747
+ strict,
3748
+ strictEffect,
3245
3749
  strong,
3246
3750
  style,
3247
3751
  sub,
@@ -3263,6 +3767,7 @@ function Loading(props = {}) {
3263
3767
  title,
3264
3768
  tr,
3265
3769
  track,
3770
+ transition,
3266
3771
  trapFocus,
3267
3772
  tspan,
3268
3773
  u,