@strands.gg/accui 2.10.2 → 2.10.4

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
@@ -2622,12 +2622,25 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2622
2622
  },
2623
2623
  emits: ["update:modelValue"],
2624
2624
  setup(__props, { emit: __emit }) {
2625
- const isDevToolsOpen = () => {
2626
- try {
2627
- return window.outerHeight - window.innerHeight > 160 || window.outerWidth - window.innerWidth > 160;
2628
- } catch {
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) {
2629
2634
  return false;
2630
2635
  }
2636
+ return true;
2637
+ };
2638
+ const startCalculation = () => {
2639
+ calculationInProgress = true;
2640
+ lastCalculationTime = Date.now();
2641
+ };
2642
+ const endCalculation = () => {
2643
+ calculationInProgress = false;
2631
2644
  };
2632
2645
  const props = __props;
2633
2646
  const emit = __emit;
@@ -2655,17 +2668,35 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2655
2668
  let currentTabIndex = -1;
2656
2669
  let isAnimating = false;
2657
2670
  const calculateUnderlineDimensions = (tabElement, containerElement) => {
2658
- if (isDevToolsOpen()) {
2671
+ if (!tabElement || !containerElement) {
2659
2672
  return {
2660
- width: 100,
2673
+ width: 0,
2661
2674
  left: 0,
2662
- height: 3,
2675
+ height: 0,
2663
2676
  top: 0
2664
2677
  };
2665
2678
  }
2679
+ if (!isSafeToCalculate()) {
2680
+ return {
2681
+ width: 0,
2682
+ left: 0,
2683
+ height: 0,
2684
+ top: 0
2685
+ };
2686
+ }
2687
+ startCalculation();
2666
2688
  try {
2667
2689
  const tabRect = tabElement.getBoundingClientRect();
2668
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
+ }
2669
2700
  const computedStyle = getComputedStyle(containerElement);
2670
2701
  const underlineThickness = parseFloat(computedStyle.getPropertyValue("--underline-thickness") || "5");
2671
2702
  let actualPadding = 5;
@@ -2678,6 +2709,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2678
2709
  if (props.orientation === "vertical") {
2679
2710
  const tabTop = tabRect.top - containerRect.top;
2680
2711
  const tabHeight = tabRect.height;
2712
+ endCalculation();
2681
2713
  return {
2682
2714
  height: tabHeight - actualPadding * 4,
2683
2715
  // More padding for shorter underline
@@ -2692,6 +2724,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2692
2724
  const tabLeft = tabRect.left - containerRect.left;
2693
2725
  const tabWidth = tabRect.width;
2694
2726
  if (props.underlineWidth === "full") {
2727
+ endCalculation();
2695
2728
  return {
2696
2729
  width: tabWidth - 30,
2697
2730
  // Fixed 15px margin on each side for horizontal tabs
@@ -2715,6 +2748,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2715
2748
  underlineWidth = parseFloat(props.underlineWidth) || tabWidth;
2716
2749
  }
2717
2750
  const offset = (tabWidth - underlineWidth) / 2;
2751
+ endCalculation();
2718
2752
  return {
2719
2753
  width: underlineWidth,
2720
2754
  left: tabLeft + offset,
@@ -2724,11 +2758,12 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
2724
2758
  };
2725
2759
  }
2726
2760
  } catch (error) {
2761
+ endCalculation();
2727
2762
  console.warn("Tab dimension calculation failed, using fallback values:", error);
2728
2763
  return {
2729
- width: 100,
2764
+ width: 0,
2730
2765
  left: 0,
2731
- height: 3,
2766
+ height: 0,
2732
2767
  top: 0
2733
2768
  };
2734
2769
  }
@@ -3042,7 +3077,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
3042
3077
  };
3043
3078
  }
3044
3079
  });
3045
- const StrandsUiTabs = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-8e8f1aec"]]);
3080
+ const StrandsUiTabs = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-473634b2"]]);
3046
3081
  const _hoisted_1$I = {
3047
3082
  key: 0,
3048
3083
  class: "ui-divider-text"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.10.2",
3
+ "version": "2.10.4",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",