sibujs 1.2.0 → 1.3.0

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