@karmo-co/drift-kit-public 23.18.2 → 23.19.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.
package/components.js CHANGED
@@ -9729,8 +9729,46 @@
9729
9729
  root.removeAttribute('data-indicator');
9730
9730
  else
9731
9731
  root.setAttribute('data-indicator', '');
9732
+ paintBar(animate);
9732
9733
  });
9733
9734
  }
9735
+ function paintBar(animate) {
9736
+ var ind = q(root, ':scope > .' + P + '__bar-indicator');
9737
+ if (presentation !== 'bar') {
9738
+ if (ind)
9739
+ ind.remove();
9740
+ root.removeAttribute('data-bar-indicator');
9741
+ return;
9742
+ }
9743
+ if (!ind) {
9744
+ ind = document.createElement('span');
9745
+ ind.className = P + '__bar-indicator';
9746
+ ind.setAttribute('aria-hidden', 'true');
9747
+ ind.hidden = true;
9748
+ root.insertBefore(ind, root.firstChild);
9749
+ }
9750
+ root.setAttribute('data-bar-indicator', '');
9751
+ var target = q(root, '.' + P + '__item[aria-current="page"]');
9752
+ if (!visible(target))
9753
+ target = q(root, '.' + P + '__item[data-current-within]');
9754
+ if (!visible(target)) {
9755
+ ind.hidden = true;
9756
+ ind.__placed = false;
9757
+ return;
9758
+ }
9759
+ var first = !ind.__placed || ind.hidden;
9760
+ if (!animate || first)
9761
+ ind.style.transition = 'none';
9762
+ ind.hidden = false;
9763
+ ind.style.width = target.offsetWidth + 'px';
9764
+ ind.style.height = target.offsetHeight + 'px';
9765
+ ind.style.translate = target.offsetLeft + 'px ' + target.offsetTop + 'px';
9766
+ ind.__placed = true;
9767
+ if (!animate || first) {
9768
+ void ind.offsetWidth;
9769
+ ind.style.transition = '';
9770
+ }
9771
+ }
9734
9772
  var panelKey = null;
9735
9773
  function keyOf(p) {
9736
9774
  if (!p)