sibujs 1.0.3 → 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.
Files changed (41) hide show
  1. package/LICENSE +21 -21
  2. package/dist/build.cjs +271 -40
  3. package/dist/build.js +1 -1
  4. package/dist/cdn.global.js +124 -27
  5. package/dist/{chunk-7TQKR4PP.js → chunk-AZ3ISID5.js} +4 -0
  6. package/dist/{chunk-3CRQALYP.js → chunk-DKOHBI74.js} +49 -2
  7. package/dist/{chunk-DTCOOBMX.js → chunk-OF7UZIVB.js} +1 -1
  8. package/dist/{chunk-N6IZB6KJ.js → chunk-PBHF5WKN.js} +56 -7
  9. package/dist/{chunk-MEZVEBPN.js → chunk-VAU366PN.js} +273 -40
  10. package/dist/{customElement-BKQfbSZQ.d.ts → customElement-yz8uyk-0.d.cts} +52 -6
  11. package/dist/{customElement-BKQfbSZQ.d.cts → customElement-yz8uyk-0.d.ts} +52 -6
  12. package/dist/extras.cjs +111 -9
  13. package/dist/extras.d.cts +3 -2
  14. package/dist/extras.d.ts +3 -2
  15. package/dist/extras.js +9 -5
  16. package/dist/index.cjs +273 -40
  17. package/dist/index.d.cts +27 -2
  18. package/dist/index.d.ts +27 -2
  19. package/dist/index.js +5 -1
  20. package/dist/patterns.d.cts +8 -2
  21. package/dist/patterns.d.ts +8 -2
  22. package/dist/plugins.cjs +142 -1
  23. package/dist/plugins.d.cts +39 -3
  24. package/dist/plugins.d.ts +39 -3
  25. package/dist/plugins.js +119 -3
  26. package/dist/{ssr-WKUPVSSK.js → ssr-6GIMY5MX.js} +5 -3
  27. package/dist/ssr-BA6sxxUd.d.cts +135 -0
  28. package/dist/ssr-BA6sxxUd.d.ts +135 -0
  29. package/dist/ssr.cjs +5 -0
  30. package/dist/ssr.d.cts +3 -113
  31. package/dist/ssr.d.ts +3 -113
  32. package/dist/ssr.js +4 -2
  33. package/dist/ui.cjs +50 -2
  34. package/dist/ui.d.cts +1 -1
  35. package/dist/ui.d.ts +1 -1
  36. package/dist/ui.js +3 -1
  37. package/dist/widgets.cjs +56 -7
  38. package/dist/widgets.d.cts +4 -2
  39. package/dist/widgets.d.ts +4 -2
  40. package/dist/widgets.js +1 -1
  41. package/package.json +139 -139
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Fran Ramírez
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Fran Ramírez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/build.cjs CHANGED
@@ -1074,6 +1074,7 @@ __export(index_exports, {
1074
1074
  article: () => article,
1075
1075
  aside: () => aside,
1076
1076
  audio: () => audio,
1077
+ autoResize: () => autoResize,
1077
1078
  b: () => b,
1078
1079
  base: () => base,
1079
1080
  batch: () => batch,
@@ -1098,6 +1099,7 @@ __export(index_exports, {
1098
1099
  col: () => col,
1099
1100
  colgroup: () => colgroup,
1100
1101
  context: () => context,
1102
+ copyOnClick: () => copyOnClick,
1101
1103
  customElement: () => customElement,
1102
1104
  data: () => data,
1103
1105
  datalist: () => datalist,
@@ -2847,6 +2849,24 @@ var longPress = (element, options) => {
2847
2849
  element.removeEventListener("pointerleave", cancel);
2848
2850
  };
2849
2851
  };
2852
+ var copyOnClick = (element, getText) => {
2853
+ const handler = () => {
2854
+ const text2 = typeof getText === "function" ? getText() : element.textContent ?? "";
2855
+ navigator.clipboard.writeText(text2);
2856
+ };
2857
+ element.addEventListener("click", handler);
2858
+ return () => element.removeEventListener("click", handler);
2859
+ };
2860
+ var autoResize = (element) => {
2861
+ const resize = () => {
2862
+ element.style.overflow = "hidden";
2863
+ element.style.height = "auto";
2864
+ element.style.height = `${element.scrollHeight}px`;
2865
+ };
2866
+ resize();
2867
+ element.addEventListener("input", resize);
2868
+ return () => element.removeEventListener("input", resize);
2869
+ };
2850
2870
  var trapFocus = (element) => {
2851
2871
  const focusable = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
2852
2872
  const handler = (e) => {
@@ -3591,35 +3611,123 @@ var errorBoundaryStyles = `
3591
3611
  }
3592
3612
 
3593
3613
  .sibu-error-fallback {
3594
- border: 2px solid #dc3545;
3614
+ border: 1px solid #e5484d;
3595
3615
  border-radius: 8px;
3596
- padding: 20px;
3616
+ padding: 0;
3597
3617
  margin: 10px 0;
3598
- background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
3599
- 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);
3600
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;
3601
3632
  }
3602
3633
 
3603
3634
  .sibu-error-fallback .sibu-error-title {
3604
- margin: 0 0 12px 0;
3605
- color: #dc3545;
3606
- font-size: 1.1em;
3635
+ margin: 0;
3636
+ font-size: 0.95em;
3607
3637
  font-weight: 600;
3608
3638
  }
3609
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
+
3610
3651
  .sibu-error-fallback .sibu-error-message {
3611
3652
  font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
3612
- background-color: rgba(0, 0, 0, 0.04);
3613
- padding: 10px 14px;
3614
- border-radius: 6px;
3615
- border: 1px solid rgba(0, 0, 0, 0.08);
3616
- margin: 10px 0;
3617
- color: #495057;
3653
+ margin: 0 0 12px 0;
3654
+ color: #f1a9a0;
3618
3655
  word-break: break-word;
3619
3656
  font-size: 0.9em;
3620
3657
  line-height: 1.5;
3621
3658
  }
3622
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
+
3623
3731
  .sibu-error-fallback .sibu-error-btn {
3624
3732
  display: inline-flex;
3625
3733
  align-items: center;
@@ -3628,22 +3736,28 @@ var errorBoundaryStyles = `
3628
3736
  border: none;
3629
3737
  border-radius: 6px;
3630
3738
  cursor: pointer;
3631
- font-size: 14px;
3739
+ font-size: 13px;
3632
3740
  font-weight: 500;
3633
- transition: all 0.2s ease;
3634
- margin-top: 8px;
3635
- background-color: #dc3545;
3741
+ transition: all 0.15s ease;
3742
+ }
3743
+
3744
+ .sibu-error-fallback .sibu-error-btn-retry {
3745
+ background: #e5484d;
3636
3746
  color: white;
3637
3747
  }
3638
3748
 
3639
- .sibu-error-fallback .sibu-error-btn:hover {
3640
- background-color: #c82333;
3641
- transform: translateY(-1px);
3642
- box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
3749
+ .sibu-error-fallback .sibu-error-btn-retry:hover {
3750
+ background: #d13438;
3643
3751
  }
3644
3752
 
3645
- .sibu-error-fallback .sibu-error-btn:active {
3646
- transform: translateY(0);
3753
+ .sibu-error-fallback .sibu-error-btn-reload {
3754
+ background: #2a2a3e;
3755
+ color: #ccc;
3756
+ border: 1px solid #3a3a4e;
3757
+ }
3758
+
3759
+ .sibu-error-fallback .sibu-error-btn-reload:hover {
3760
+ background: #3a3a4e;
3647
3761
  }
3648
3762
  `;
3649
3763
  var stylesInjected = false;
@@ -3667,6 +3781,35 @@ function getMemoizedFallback(fallbackFn, error, retry) {
3667
3781
  }
3668
3782
  return cache2.get(key);
3669
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
+ }
3670
3813
  function ErrorBoundary({ nodes, fallback, onError }) {
3671
3814
  injectStyles();
3672
3815
  const [error, setError] = signal(null);
@@ -3682,24 +3825,112 @@ function ErrorBoundary({ nodes, fallback, onError }) {
3682
3825
  onError?.(errorObj);
3683
3826
  return errorObj;
3684
3827
  };
3685
- const defaultFallback = (err, retryFn) => div({
3686
- class: "sibu-error-fallback",
3687
- nodes: [
3688
- h3({
3689
- nodes: "Something went wrong",
3690
- class: "sibu-error-title"
3691
- }),
3692
- p({
3693
- nodes: _isDev8 ? err.message : "An unexpected error occurred. Please try again.",
3694
- class: "sibu-error-message"
3695
- }),
3696
- button({
3697
- nodes: "Retry",
3698
- class: "sibu-error-btn",
3699
- 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
+ ]
3700
3886
  })
3701
- ]
3702
- });
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
+ };
3703
3934
  const tryRenderFallback = (err) => {
3704
3935
  const fn = fallback || defaultFallback;
3705
3936
  try {
package/dist/build.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  index_exports
3
- } from "./chunk-MEZVEBPN.js";
3
+ } from "./chunk-VAU366PN.js";
4
4
  import "./chunk-EWFVA3TJ.js";
5
5
  import "./chunk-CZUGLNJS.js";
6
6
  import "./chunk-Z65KYU7I.js";