sibujs 1.0.4 → 1.0.5

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 CHANGED
@@ -3611,35 +3611,123 @@ var errorBoundaryStyles = `
3611
3611
  }
3612
3612
 
3613
3613
  .sibu-error-fallback {
3614
- border: 2px solid #dc3545;
3614
+ border: 1px solid #e5484d;
3615
3615
  border-radius: 8px;
3616
- padding: 20px;
3616
+ padding: 0;
3617
3617
  margin: 10px 0;
3618
- background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
3619
- box-shadow: 0 2px 12px rgba(220, 53, 69, 0.15);
3618
+ background: #1a1a2e;
3619
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
3620
3620
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
3621
+ color: #e1e1e6;
3622
+ overflow: hidden;
3623
+ }
3624
+
3625
+ .sibu-error-fallback .sibu-error-header {
3626
+ display: flex;
3627
+ align-items: center;
3628
+ gap: 8px;
3629
+ padding: 12px 16px;
3630
+ background: #e5484d;
3631
+ color: white;
3621
3632
  }
3622
3633
 
3623
3634
  .sibu-error-fallback .sibu-error-title {
3624
- margin: 0 0 12px 0;
3625
- color: #dc3545;
3626
- font-size: 1.1em;
3635
+ margin: 0;
3636
+ font-size: 0.95em;
3627
3637
  font-weight: 600;
3628
3638
  }
3629
3639
 
3640
+ .sibu-error-fallback .sibu-error-source {
3641
+ margin-left: auto;
3642
+ font-size: 0.8em;
3643
+ opacity: 0.9;
3644
+ font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
3645
+ }
3646
+
3647
+ .sibu-error-fallback .sibu-error-body {
3648
+ padding: 16px;
3649
+ }
3650
+
3630
3651
  .sibu-error-fallback .sibu-error-message {
3631
3652
  font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
3632
- background-color: rgba(0, 0, 0, 0.04);
3633
- padding: 10px 14px;
3634
- border-radius: 6px;
3635
- border: 1px solid rgba(0, 0, 0, 0.08);
3636
- margin: 10px 0;
3637
- color: #495057;
3653
+ margin: 0 0 12px 0;
3654
+ color: #f1a9a0;
3638
3655
  word-break: break-word;
3639
3656
  font-size: 0.9em;
3640
3657
  line-height: 1.5;
3641
3658
  }
3642
3659
 
3660
+ .sibu-error-fallback .sibu-error-stack-container {
3661
+ position: relative;
3662
+ margin: 0 0 12px 0;
3663
+ border-radius: 6px;
3664
+ border: 1px solid #2a2a3e;
3665
+ background: #12121f;
3666
+ overflow: hidden;
3667
+ }
3668
+
3669
+ .sibu-error-fallback .sibu-error-stack-label {
3670
+ display: flex;
3671
+ align-items: center;
3672
+ justify-content: space-between;
3673
+ padding: 6px 12px;
3674
+ background: #1e1e32;
3675
+ border-bottom: 1px solid #2a2a3e;
3676
+ font-size: 0.75em;
3677
+ color: #888;
3678
+ text-transform: uppercase;
3679
+ letter-spacing: 0.05em;
3680
+ }
3681
+
3682
+ .sibu-error-fallback .sibu-error-copy-btn {
3683
+ background: transparent;
3684
+ border: 1px solid #3a3a4e;
3685
+ border-radius: 4px;
3686
+ color: #888;
3687
+ cursor: pointer;
3688
+ padding: 2px 8px;
3689
+ font-size: 1em;
3690
+ transition: all 0.15s ease;
3691
+ }
3692
+
3693
+ .sibu-error-fallback .sibu-error-copy-btn:hover {
3694
+ background: #2a2a3e;
3695
+ color: #ccc;
3696
+ border-color: #4a4a5e;
3697
+ }
3698
+
3699
+ .sibu-error-fallback .sibu-error-stack pre {
3700
+ margin: 0;
3701
+ padding: 12px;
3702
+ overflow-x: auto;
3703
+ font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
3704
+ font-size: 0.82em;
3705
+ line-height: 1.6;
3706
+ color: #a0a0b0;
3707
+ }
3708
+
3709
+ .sibu-error-fallback .sibu-error-stack .sibu-line-num {
3710
+ display: inline-block;
3711
+ width: 3ch;
3712
+ margin-right: 12px;
3713
+ color: #555;
3714
+ text-align: right;
3715
+ user-select: none;
3716
+ }
3717
+
3718
+ .sibu-error-fallback .sibu-error-stack .sibu-stack-fn {
3719
+ color: #7ec8e3;
3720
+ }
3721
+
3722
+ .sibu-error-fallback .sibu-error-stack .sibu-stack-loc {
3723
+ color: #666;
3724
+ }
3725
+
3726
+ .sibu-error-fallback .sibu-error-actions {
3727
+ display: flex;
3728
+ gap: 8px;
3729
+ }
3730
+
3643
3731
  .sibu-error-fallback .sibu-error-btn {
3644
3732
  display: inline-flex;
3645
3733
  align-items: center;
@@ -3648,22 +3736,28 @@ var errorBoundaryStyles = `
3648
3736
  border: none;
3649
3737
  border-radius: 6px;
3650
3738
  cursor: pointer;
3651
- font-size: 14px;
3739
+ font-size: 13px;
3652
3740
  font-weight: 500;
3653
- transition: all 0.2s ease;
3654
- margin-top: 8px;
3655
- background-color: #dc3545;
3741
+ transition: all 0.15s ease;
3742
+ }
3743
+
3744
+ .sibu-error-fallback .sibu-error-btn-retry {
3745
+ background: #e5484d;
3656
3746
  color: white;
3657
3747
  }
3658
3748
 
3659
- .sibu-error-fallback .sibu-error-btn:hover {
3660
- background-color: #c82333;
3661
- transform: translateY(-1px);
3662
- box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
3749
+ .sibu-error-fallback .sibu-error-btn-retry:hover {
3750
+ background: #d13438;
3751
+ }
3752
+
3753
+ .sibu-error-fallback .sibu-error-btn-reload {
3754
+ background: #2a2a3e;
3755
+ color: #ccc;
3756
+ border: 1px solid #3a3a4e;
3663
3757
  }
3664
3758
 
3665
- .sibu-error-fallback .sibu-error-btn:active {
3666
- transform: translateY(0);
3759
+ .sibu-error-fallback .sibu-error-btn-reload:hover {
3760
+ background: #3a3a4e;
3667
3761
  }
3668
3762
  `;
3669
3763
  var stylesInjected = false;
@@ -3687,6 +3781,35 @@ function getMemoizedFallback(fallbackFn, error, retry) {
3687
3781
  }
3688
3782
  return cache2.get(key);
3689
3783
  }
3784
+ function parseStack(err) {
3785
+ const stack = err.stack || "";
3786
+ const lines = stack.split("\n");
3787
+ const frames = [];
3788
+ let source2 = "";
3789
+ for (const line2 of lines) {
3790
+ const trimmed = line2.trim();
3791
+ const chromeMatch = trimmed.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);
3792
+ if (chromeMatch) {
3793
+ const fn = chromeMatch[1] || "(anonymous)";
3794
+ const loc = chromeMatch[2] || chromeMatch[3] || "";
3795
+ frames.push({ fn, loc });
3796
+ if (!source2 && fn !== "(anonymous)" && !fn.startsWith("Object.") && !fn.startsWith("Module.")) {
3797
+ source2 = fn;
3798
+ }
3799
+ continue;
3800
+ }
3801
+ const firefoxMatch = trimmed.match(/^(.+?)@(.+)$/);
3802
+ if (firefoxMatch) {
3803
+ const fn = firefoxMatch[1] || "(anonymous)";
3804
+ const loc = firefoxMatch[2] || "";
3805
+ frames.push({ fn, loc });
3806
+ if (!source2 && fn !== "(anonymous)") {
3807
+ source2 = fn;
3808
+ }
3809
+ }
3810
+ }
3811
+ return { source: source2, frames };
3812
+ }
3690
3813
  function ErrorBoundary({ nodes, fallback, onError }) {
3691
3814
  injectStyles();
3692
3815
  const [error, setError] = signal(null);
@@ -3702,24 +3825,112 @@ function ErrorBoundary({ nodes, fallback, onError }) {
3702
3825
  onError?.(errorObj);
3703
3826
  return errorObj;
3704
3827
  };
3705
- const defaultFallback = (err, retryFn) => div({
3706
- class: "sibu-error-fallback",
3707
- nodes: [
3708
- h3({
3709
- nodes: "Something went wrong",
3710
- class: "sibu-error-title"
3711
- }),
3712
- p({
3713
- nodes: _isDev8 ? err.message : "An unexpected error occurred. Please try again.",
3714
- class: "sibu-error-message"
3715
- }),
3716
- button({
3717
- nodes: "Retry",
3718
- class: "sibu-error-btn",
3719
- on: { click: retryFn }
3828
+ const defaultFallback = (err, retryFn) => {
3829
+ if (!_isDev8) {
3830
+ return div({
3831
+ class: "sibu-error-fallback",
3832
+ nodes: [
3833
+ div({
3834
+ class: "sibu-error-header",
3835
+ nodes: [h3({ nodes: "Something went wrong", class: "sibu-error-title" })]
3836
+ }),
3837
+ div({
3838
+ class: "sibu-error-body",
3839
+ nodes: [
3840
+ p({ nodes: "An unexpected error occurred. Please try again.", class: "sibu-error-message" }),
3841
+ div({
3842
+ class: "sibu-error-actions",
3843
+ nodes: [
3844
+ button({
3845
+ nodes: "Retry",
3846
+ class: "sibu-error-btn sibu-error-btn-retry",
3847
+ on: { click: retryFn }
3848
+ }),
3849
+ button({
3850
+ nodes: "Reload Page",
3851
+ class: "sibu-error-btn sibu-error-btn-reload",
3852
+ on: { click: () => location.reload() }
3853
+ })
3854
+ ]
3855
+ })
3856
+ ]
3857
+ })
3858
+ ]
3859
+ });
3860
+ }
3861
+ const { source: source2, frames } = parseStack(err);
3862
+ const fullText = `${err.message}
3863
+
3864
+ ${err.stack || ""}`;
3865
+ const copyBtn = button({
3866
+ nodes: "Copy",
3867
+ class: "sibu-error-copy-btn",
3868
+ on: {
3869
+ click: () => {
3870
+ navigator.clipboard.writeText(fullText).then(() => {
3871
+ copyBtn.textContent = "Copied!";
3872
+ setTimeout(() => {
3873
+ copyBtn.textContent = "Copy";
3874
+ }, 1500);
3875
+ });
3876
+ }
3877
+ }
3878
+ });
3879
+ const stackLines = frames.map(
3880
+ (f, i2) => div({
3881
+ nodes: [
3882
+ span({ class: "sibu-line-num", nodes: String(i2 + 1) }),
3883
+ span({ class: "sibu-stack-fn", nodes: f.fn }),
3884
+ span({ class: "sibu-stack-loc", nodes: ` ${f.loc}` })
3885
+ ]
3720
3886
  })
3721
- ]
3722
- });
3887
+ );
3888
+ return div({
3889
+ class: "sibu-error-fallback",
3890
+ nodes: [
3891
+ div({
3892
+ class: "sibu-error-header",
3893
+ nodes: [
3894
+ h3({ nodes: source2 ? `Error in ${source2}` : "Something went wrong", class: "sibu-error-title" }),
3895
+ ...source2 ? [] : [span()]
3896
+ ]
3897
+ }),
3898
+ div({
3899
+ class: "sibu-error-body",
3900
+ nodes: [
3901
+ p({ nodes: err.message, class: "sibu-error-message" }),
3902
+ ...frames.length > 0 ? [
3903
+ div({
3904
+ class: "sibu-error-stack-container",
3905
+ nodes: [
3906
+ div({
3907
+ class: "sibu-error-stack-label",
3908
+ nodes: [span({ nodes: "Stack Trace" }), copyBtn]
3909
+ }),
3910
+ div({ class: "sibu-error-stack", nodes: [pre({ nodes: stackLines })] })
3911
+ ]
3912
+ })
3913
+ ] : [],
3914
+ div({
3915
+ class: "sibu-error-actions",
3916
+ nodes: [
3917
+ button({
3918
+ nodes: "Retry",
3919
+ class: "sibu-error-btn sibu-error-btn-retry",
3920
+ on: { click: retryFn }
3921
+ }),
3922
+ button({
3923
+ nodes: "Reload Page",
3924
+ class: "sibu-error-btn sibu-error-btn-reload",
3925
+ on: { click: () => location.reload() }
3926
+ })
3927
+ ]
3928
+ })
3929
+ ]
3930
+ })
3931
+ ]
3932
+ });
3933
+ };
3723
3934
  const tryRenderFallback = (err) => {
3724
3935
  const fn = fallback || defaultFallback;
3725
3936
  try {
package/dist/build.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  index_exports
3
- } from "./chunk-32ZISOLJ.js";
3
+ } from "./chunk-VAU366PN.js";
4
4
  import "./chunk-EWFVA3TJ.js";
5
5
  import "./chunk-CZUGLNJS.js";
6
6
  import "./chunk-Z65KYU7I.js";