@strands.gg/accui 2.10.4 → 2.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -862,7 +862,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
862
862
  };
863
863
  }
864
864
  });
865
- const StrandsUiCard = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-d53b5273"]]);
865
+ const StrandsUiCard = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-49be5a80"]]);
866
866
  /**
867
867
  * @license lucide-vue-next v0.542.0 - ISC
868
868
  *
@@ -2622,26 +2622,6 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2622
2622
  },
2623
2623
  emits: ["update:modelValue"],
2624
2624
  setup(__props, { emit: __emit }) {
2625
- let lastCalculationTime = 0;
2626
- let calculationInProgress = false;
2627
- const isSafeToCalculate = () => {
2628
- if (calculationInProgress) {
2629
- return false;
2630
- }
2631
- const now = Date.now();
2632
- const timeSinceLastCalc = now - lastCalculationTime;
2633
- if (timeSinceLastCalc < 16) {
2634
- return false;
2635
- }
2636
- return true;
2637
- };
2638
- const startCalculation = () => {
2639
- calculationInProgress = true;
2640
- lastCalculationTime = Date.now();
2641
- };
2642
- const endCalculation = () => {
2643
- calculationInProgress = false;
2644
- };
2645
2625
  const props = __props;
2646
2626
  const emit = __emit;
2647
2627
  const slots = useSlots();
@@ -2668,248 +2648,195 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2668
2648
  let currentTabIndex = -1;
2669
2649
  let isAnimating = false;
2670
2650
  const calculateUnderlineDimensions = (tabElement, containerElement) => {
2671
- if (!tabElement || !containerElement) {
2672
- return {
2673
- width: 0,
2674
- left: 0,
2675
- height: 0,
2676
- top: 0
2677
- };
2678
- }
2679
- if (!isSafeToCalculate()) {
2651
+ const tabRect = tabElement.getBoundingClientRect();
2652
+ const containerRect = containerElement.getBoundingClientRect();
2653
+ const computedStyle = getComputedStyle(containerElement);
2654
+ const underlineThickness = parseFloat(computedStyle.getPropertyValue("--underline-thickness") || "5");
2655
+ let actualPadding = 5;
2656
+ if (props.size === "sm") {
2657
+ actualPadding = 4;
2658
+ } else if (props.size === "lg") {
2659
+ actualPadding = 6;
2660
+ }
2661
+ const containerHeight = containerRect.height;
2662
+ if (props.orientation === "vertical") {
2663
+ const tabTop = tabRect.top - containerRect.top;
2664
+ const tabHeight = tabRect.height;
2680
2665
  return {
2681
- width: 0,
2682
- left: 0,
2683
- height: 0,
2684
- top: 0
2666
+ height: tabHeight - actualPadding * 4,
2667
+ // More padding for shorter underline
2668
+ top: tabTop + actualPadding * 2,
2669
+ // Better centering with more offset
2670
+ width: underlineThickness,
2671
+ // Use dynamic thickness
2672
+ left: actualPadding - underlineThickness / 2
2673
+ // Position at container left edge
2685
2674
  };
2686
- }
2687
- startCalculation();
2688
- try {
2689
- const tabRect = tabElement.getBoundingClientRect();
2690
- const containerRect = containerElement.getBoundingClientRect();
2691
- if (!tabRect || !containerRect || tabRect.width === 0 || containerRect.width === 0) {
2692
- endCalculation();
2693
- return {
2694
- width: 0,
2695
- left: 0,
2696
- height: 0,
2697
- top: 0
2698
- };
2699
- }
2700
- const computedStyle = getComputedStyle(containerElement);
2701
- const underlineThickness = parseFloat(computedStyle.getPropertyValue("--underline-thickness") || "5");
2702
- let actualPadding = 5;
2703
- if (props.size === "sm") {
2704
- actualPadding = 4;
2705
- } else if (props.size === "lg") {
2706
- actualPadding = 6;
2707
- }
2708
- const containerHeight = containerRect.height;
2709
- if (props.orientation === "vertical") {
2710
- const tabTop = tabRect.top - containerRect.top;
2711
- const tabHeight = tabRect.height;
2712
- endCalculation();
2713
- return {
2714
- height: tabHeight - actualPadding * 4,
2715
- // More padding for shorter underline
2716
- top: tabTop + actualPadding * 2,
2717
- // Better centering with more offset
2718
- width: underlineThickness,
2719
- // Use dynamic thickness
2720
- left: actualPadding - underlineThickness / 2
2721
- // Position at container left edge
2722
- };
2723
- } else {
2724
- const tabLeft = tabRect.left - containerRect.left;
2725
- const tabWidth = tabRect.width;
2726
- if (props.underlineWidth === "full") {
2727
- endCalculation();
2728
- return {
2729
- width: tabWidth - 30,
2730
- // Fixed 15px margin on each side for horizontal tabs
2731
- left: tabLeft + 15,
2732
- height: underlineThickness,
2733
- top: containerHeight - actualPadding - underlineThickness / 2
2734
- // Position near bottom of container
2735
- };
2736
- }
2737
- let underlineWidth;
2738
- if (props.underlineWidth.endsWith("%")) {
2739
- const percentage = parseFloat(props.underlineWidth) / 100;
2740
- underlineWidth = tabWidth * percentage;
2741
- } else if (props.underlineWidth.endsWith("px")) {
2742
- underlineWidth = parseFloat(props.underlineWidth);
2743
- } else if (props.underlineWidth.endsWith("rem")) {
2744
- const remValue = parseFloat(props.underlineWidth);
2745
- const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
2746
- underlineWidth = remValue * fontSize;
2747
- } else {
2748
- underlineWidth = parseFloat(props.underlineWidth) || tabWidth;
2749
- }
2750
- const offset = (tabWidth - underlineWidth) / 2;
2751
- endCalculation();
2675
+ } else {
2676
+ const tabLeft = tabRect.left - containerRect.left;
2677
+ const tabWidth = tabRect.width;
2678
+ if (props.underlineWidth === "full") {
2752
2679
  return {
2753
- width: underlineWidth,
2754
- left: tabLeft + offset,
2680
+ width: tabWidth - 30,
2681
+ // Fixed 15px margin on each side for horizontal tabs
2682
+ left: tabLeft + 15,
2755
2683
  height: underlineThickness,
2756
2684
  top: containerHeight - actualPadding - underlineThickness / 2
2757
2685
  // Position near bottom of container
2758
2686
  };
2759
2687
  }
2760
- } catch (error) {
2761
- endCalculation();
2762
- console.warn("Tab dimension calculation failed, using fallback values:", error);
2688
+ let underlineWidth;
2689
+ if (props.underlineWidth.endsWith("%")) {
2690
+ const percentage = parseFloat(props.underlineWidth) / 100;
2691
+ underlineWidth = tabWidth * percentage;
2692
+ } else if (props.underlineWidth.endsWith("px")) {
2693
+ underlineWidth = parseFloat(props.underlineWidth);
2694
+ } else if (props.underlineWidth.endsWith("rem")) {
2695
+ const remValue = parseFloat(props.underlineWidth);
2696
+ const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
2697
+ underlineWidth = remValue * fontSize;
2698
+ } else {
2699
+ underlineWidth = parseFloat(props.underlineWidth) || tabWidth;
2700
+ }
2701
+ const offset = (tabWidth - underlineWidth) / 2;
2763
2702
  return {
2764
- width: 0,
2765
- left: 0,
2766
- height: 0,
2767
- top: 0
2703
+ width: underlineWidth,
2704
+ left: tabLeft + offset,
2705
+ height: underlineThickness,
2706
+ top: containerHeight - actualPadding - underlineThickness / 2
2707
+ // Position near bottom of container
2768
2708
  };
2769
2709
  }
2770
2710
  };
2771
2711
  const handleTabClick = async (value, index) => {
2772
2712
  if (isAnimating) return;
2773
2713
  emit("update:modelValue", value);
2774
- if (isDevToolsOpen()) {
2775
- currentTabIndex = index;
2776
- return;
2777
- }
2778
2714
  await nextTick();
2779
2715
  animateUnderlineStretch(index);
2780
2716
  };
2781
2717
  const animateUnderlineStretch = async (newIndex) => {
2782
- if (isDevToolsOpen()) {
2783
- currentTabIndex = newIndex;
2784
- return;
2785
- }
2786
2718
  if (!tabButtons.value[newIndex] || newIndex === currentTabIndex) return;
2787
2719
  isAnimating = true;
2788
2720
  const newTab = tabButtons.value[newIndex];
2789
2721
  const container = newTab.parentElement;
2790
2722
  if (!container) return;
2791
2723
  const newDimensions = calculateUnderlineDimensions(newTab, container);
2792
- try {
2793
- const newTabRect = newTab.getBoundingClientRect();
2794
- const containerRect = container.getBoundingClientRect();
2795
- let newTabPos, newTabSize;
2724
+ const newTabRect = newTab.getBoundingClientRect();
2725
+ const containerRect = container.getBoundingClientRect();
2726
+ let newTabPos, newTabSize;
2727
+ if (props.orientation === "vertical") {
2728
+ newTabPos = newTabRect.top - containerRect.top;
2729
+ newTabSize = newTabRect.height;
2730
+ } else {
2731
+ newTabPos = newTabRect.left - containerRect.left;
2732
+ newTabSize = newTabRect.width;
2733
+ }
2734
+ if (currentTabIndex === -1) {
2796
2735
  if (props.orientation === "vertical") {
2797
- newTabPos = newTabRect.top - containerRect.top;
2798
- newTabSize = newTabRect.height;
2736
+ underlineStyle.value = {
2737
+ height: `${newDimensions.height}px`,
2738
+ top: `${newDimensions.top}px`,
2739
+ width: `${newDimensions.width}px`,
2740
+ left: `${newDimensions.left}px`,
2741
+ opacity: "1"
2742
+ };
2743
+ backgroundStyle.value = {
2744
+ height: `${newTabSize}px`,
2745
+ top: `${newTabPos}px`,
2746
+ width: `${newTabRect.width}px`,
2747
+ left: "0",
2748
+ opacity: "1"
2749
+ };
2799
2750
  } else {
2800
- newTabPos = newTabRect.left - containerRect.left;
2801
- newTabSize = newTabRect.width;
2751
+ underlineStyle.value = {
2752
+ width: `${newDimensions.width}px`,
2753
+ left: `${newDimensions.left}px`,
2754
+ height: `${newDimensions.height}px`,
2755
+ top: `${newDimensions.top}px`,
2756
+ opacity: "1"
2757
+ };
2758
+ backgroundStyle.value = {
2759
+ width: `${newTabSize}px`,
2760
+ left: `${newTabPos}px`,
2761
+ height: "100%",
2762
+ top: "0",
2763
+ opacity: "1"
2764
+ };
2802
2765
  }
2803
- if (currentTabIndex === -1) {
2804
- if (props.orientation === "vertical") {
2805
- underlineStyle.value = {
2806
- height: `${newDimensions.height}px`,
2807
- top: `${newDimensions.top}px`,
2808
- width: `${newDimensions.width}px`,
2809
- left: `${newDimensions.left}px`,
2810
- opacity: "1"
2811
- };
2812
- backgroundStyle.value = {
2813
- height: `${newTabSize}px`,
2814
- top: `${newTabPos}px`,
2815
- width: `${newTabRect.width}px`,
2816
- left: "0",
2817
- opacity: "1"
2818
- };
2819
- } else {
2820
- underlineStyle.value = {
2821
- width: `${newDimensions.width}px`,
2822
- left: `${newDimensions.left}px`,
2823
- height: `${newDimensions.height}px`,
2824
- top: `${newDimensions.top}px`,
2825
- opacity: "1"
2826
- };
2827
- backgroundStyle.value = {
2828
- width: `${newTabSize}px`,
2829
- left: `${newTabPos}px`,
2830
- height: "100%",
2831
- top: "0",
2832
- opacity: "1"
2833
- };
2834
- }
2835
- currentTabIndex = newIndex;
2836
- isAnimating = false;
2837
- return;
2766
+ currentTabIndex = newIndex;
2767
+ isAnimating = false;
2768
+ return;
2769
+ }
2770
+ const currentTab = tabButtons.value[currentTabIndex];
2771
+ calculateUnderlineDimensions(currentTab, container);
2772
+ currentTab.getBoundingClientRect();
2773
+ const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2774
+ if (prefersReducedMotion) {
2775
+ underlineStyle.value = {
2776
+ width: `${newDimensions.width || 0}px`,
2777
+ left: `${newDimensions.left || 0}px`,
2778
+ height: `${newDimensions.height || 7}px`,
2779
+ top: `${newDimensions.top}px`,
2780
+ opacity: "1"
2781
+ };
2782
+ if (props.orientation === "vertical") {
2783
+ backgroundStyle.value = {
2784
+ height: `${newTabSize}px`,
2785
+ top: `${newTabPos}px`,
2786
+ width: "100%",
2787
+ left: "0",
2788
+ opacity: "1"
2789
+ };
2790
+ } else {
2791
+ backgroundStyle.value = {
2792
+ width: `${newTabSize}px`,
2793
+ left: `${newTabPos}px`,
2794
+ height: "100%",
2795
+ top: "0",
2796
+ opacity: "1"
2797
+ };
2838
2798
  }
2839
- const currentTab = tabButtons.value[currentTabIndex];
2840
- calculateUnderlineDimensions(currentTab, container);
2841
- currentTab.getBoundingClientRect();
2842
- const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2843
- if (prefersReducedMotion) {
2799
+ currentTabIndex = newIndex;
2800
+ isAnimating = false;
2801
+ return;
2802
+ }
2803
+ requestAnimationFrame(() => {
2804
+ if (props.orientation === "vertical") {
2805
+ underlineStyle.value = {
2806
+ height: `${newDimensions.height}px`,
2807
+ top: `${newDimensions.top}px`,
2808
+ width: `${newDimensions.width || 7}px`,
2809
+ left: `${newDimensions.left}px`,
2810
+ opacity: "1"
2811
+ };
2812
+ backgroundStyle.value = {
2813
+ height: `${newTabSize}px`,
2814
+ top: `${newTabPos}px`,
2815
+ width: "100%",
2816
+ left: "0",
2817
+ opacity: "1"
2818
+ };
2819
+ } else {
2844
2820
  underlineStyle.value = {
2845
- width: `${newDimensions.width || 0}px`,
2846
- left: `${newDimensions.left || 0}px`,
2821
+ width: `${newDimensions.width}px`,
2822
+ left: `${newDimensions.left}px`,
2847
2823
  height: `${newDimensions.height || 7}px`,
2848
2824
  top: `${newDimensions.top}px`,
2849
2825
  opacity: "1"
2850
2826
  };
2851
- if (props.orientation === "vertical") {
2852
- backgroundStyle.value = {
2853
- height: `${newTabSize}px`,
2854
- top: `${newTabPos}px`,
2855
- width: "100%",
2856
- left: "0",
2857
- opacity: "1"
2858
- };
2859
- } else {
2860
- backgroundStyle.value = {
2861
- width: `${newTabSize}px`,
2862
- left: `${newTabPos}px`,
2863
- height: "100%",
2864
- top: "0",
2865
- opacity: "1"
2866
- };
2867
- }
2868
- currentTabIndex = newIndex;
2869
- isAnimating = false;
2870
- return;
2827
+ backgroundStyle.value = {
2828
+ width: `${newTabSize}px`,
2829
+ left: `${newTabPos}px`,
2830
+ height: "100%",
2831
+ top: "0",
2832
+ opacity: "1"
2833
+ };
2871
2834
  }
2872
- requestAnimationFrame(() => {
2873
- if (props.orientation === "vertical") {
2874
- underlineStyle.value = {
2875
- height: `${newDimensions.height}px`,
2876
- top: `${newDimensions.top}px`,
2877
- width: `${newDimensions.width || 7}px`,
2878
- left: `${newDimensions.left}px`,
2879
- opacity: "1"
2880
- };
2881
- backgroundStyle.value = {
2882
- height: `${newTabSize}px`,
2883
- top: `${newTabPos}px`,
2884
- width: "100%",
2885
- left: "0",
2886
- opacity: "1"
2887
- };
2888
- } else {
2889
- underlineStyle.value = {
2890
- width: `${newDimensions.width}px`,
2891
- left: `${newDimensions.left}px`,
2892
- height: `${newDimensions.height || 7}px`,
2893
- top: `${newDimensions.top}px`,
2894
- opacity: "1"
2895
- };
2896
- backgroundStyle.value = {
2897
- width: `${newTabSize}px`,
2898
- left: `${newTabPos}px`,
2899
- height: "100%",
2900
- top: "0",
2901
- opacity: "1"
2902
- };
2903
- }
2904
- currentTabIndex = newIndex;
2905
- setTimeout(() => {
2906
- isAnimating = false;
2907
- }, 200);
2908
- });
2909
- } catch (error) {
2910
- console.warn("Tab animation calculation failed:", error);
2911
- isAnimating = false;
2912
- }
2835
+ currentTabIndex = newIndex;
2836
+ setTimeout(() => {
2837
+ isAnimating = false;
2838
+ }, 200);
2839
+ });
2913
2840
  };
2914
2841
  let resizeTimeout = null;
2915
2842
  const handleResize = () => {
@@ -2975,10 +2902,6 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2975
2902
  };
2976
2903
  onMounted(async () => {
2977
2904
  await nextTick();
2978
- if (isDevToolsOpen()) {
2979
- enableTransitions.value = true;
2980
- return;
2981
- }
2982
2905
  const activeIndex = props.tabs.findIndex((tab) => tab.value === props.modelValue);
2983
2906
  if (activeIndex !== -1) {
2984
2907
  animateUnderlineStretch(activeIndex);
@@ -2998,9 +2921,6 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2998
2921
  const { modelValue } = toRefs(props);
2999
2922
  watch(modelValue, async () => {
3000
2923
  await nextTick();
3001
- if (isDevToolsOpen()) {
3002
- return;
3003
- }
3004
2924
  const activeIndex = props.tabs.findIndex((tab) => tab.value === props.modelValue);
3005
2925
  if (activeIndex !== -1) {
3006
2926
  animateUnderlineStretch(activeIndex);
@@ -3077,7 +2997,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
3077
2997
  };
3078
2998
  }
3079
2999
  });
3080
- const StrandsUiTabs = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-473634b2"]]);
3000
+ const StrandsUiTabs = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-edff91a5"]]);
3081
3001
  const _hoisted_1$I = {
3082
3002
  key: 0,
3083
3003
  class: "ui-divider-text"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.10.4",
3
+ "version": "2.10.6",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",