@codbex/harmonia 1.4.1 → 1.4.2

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.
@@ -2775,10 +2775,6 @@ var oppositeSideMap = {
2775
2775
  bottom: "top",
2776
2776
  top: "bottom"
2777
2777
  };
2778
- var oppositeAlignmentMap = {
2779
- start: "end",
2780
- end: "start"
2781
- };
2782
2778
  function clamp(start, value, end2) {
2783
2779
  return max(start, min(value, end2));
2784
2780
  }
@@ -2797,9 +2793,9 @@ function getOppositeAxis(axis) {
2797
2793
  function getAxisLength(axis) {
2798
2794
  return axis === "y" ? "height" : "width";
2799
2795
  }
2800
- var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
2801
2796
  function getSideAxis(placement) {
2802
- return yAxisSides.has(getSide(placement)) ? "y" : "x";
2797
+ const firstChar = placement[0];
2798
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
2803
2799
  }
2804
2800
  function getAlignmentAxis(placement) {
2805
2801
  return getOppositeAxis(getSideAxis(placement));
@@ -2822,7 +2818,7 @@ function getExpandedPlacements(placement) {
2822
2818
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2823
2819
  }
2824
2820
  function getOppositeAlignmentPlacement(placement) {
2825
- return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
2821
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2826
2822
  }
2827
2823
  var lrPlacement = ["left", "right"];
2828
2824
  var rlPlacement = ["right", "left"];
@@ -2853,7 +2849,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2853
2849
  return list;
2854
2850
  }
2855
2851
  function getOppositePlacement(placement) {
2856
- return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
2852
+ const side = getSide(placement);
2853
+ return oppositeSideMap[side] + placement.slice(side.length);
2857
2854
  }
2858
2855
  function expandPaddingObject(padding) {
2859
2856
  return {
@@ -3003,6 +3000,7 @@ async function detectOverflow(state, options) {
3003
3000
  right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
3004
3001
  };
3005
3002
  }
3003
+ var MAX_RESET_COUNT = 50;
3006
3004
  var computePosition = async (reference, floating, config) => {
3007
3005
  const {
3008
3006
  placement = "bottom",
@@ -3010,7 +3008,10 @@ var computePosition = async (reference, floating, config) => {
3010
3008
  middleware = [],
3011
3009
  platform: platform2
3012
3010
  } = config;
3013
- const validMiddleware = middleware.filter(Boolean);
3011
+ const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
3012
+ ...platform2,
3013
+ detectOverflow
3014
+ };
3014
3015
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
3015
3016
  let rects = await platform2.getElementRects({
3016
3017
  reference,
@@ -3022,14 +3023,17 @@ var computePosition = async (reference, floating, config) => {
3022
3023
  y
3023
3024
  } = computeCoordsFromPlacement(rects, placement, rtl);
3024
3025
  let statefulPlacement = placement;
3025
- let middlewareData = {};
3026
3026
  let resetCount = 0;
3027
- for (let i = 0; i < validMiddleware.length; i++) {
3028
- var _platform$detectOverf;
3027
+ const middlewareData = {};
3028
+ for (let i = 0; i < middleware.length; i++) {
3029
+ const currentMiddleware = middleware[i];
3030
+ if (!currentMiddleware) {
3031
+ continue;
3032
+ }
3029
3033
  const {
3030
3034
  name,
3031
3035
  fn
3032
- } = validMiddleware[i];
3036
+ } = currentMiddleware;
3033
3037
  const {
3034
3038
  x: nextX,
3035
3039
  y: nextY,
@@ -3043,10 +3047,7 @@ var computePosition = async (reference, floating, config) => {
3043
3047
  strategy,
3044
3048
  middlewareData,
3045
3049
  rects,
3046
- platform: {
3047
- ...platform2,
3048
- detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
3049
- },
3050
+ platform: platformWithDetectOverflow,
3050
3051
  elements: {
3051
3052
  reference,
3052
3053
  floating
@@ -3054,14 +3055,11 @@ var computePosition = async (reference, floating, config) => {
3054
3055
  });
3055
3056
  x = nextX != null ? nextX : x;
3056
3057
  y = nextY != null ? nextY : y;
3057
- middlewareData = {
3058
- ...middlewareData,
3059
- [name]: {
3060
- ...middlewareData[name],
3061
- ...data
3062
- }
3058
+ middlewareData[name] = {
3059
+ ...middlewareData[name],
3060
+ ...data
3063
3061
  };
3064
- if (reset && resetCount <= 50) {
3062
+ if (reset && resetCount < MAX_RESET_COUNT) {
3065
3063
  resetCount++;
3066
3064
  if (typeof reset === "object") {
3067
3065
  if (reset.placement) {
@@ -3523,7 +3521,6 @@ function isShadowRoot(value) {
3523
3521
  }
3524
3522
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
3525
3523
  }
3526
- var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
3527
3524
  function isOverflowElement(element) {
3528
3525
  const {
3529
3526
  overflow,
@@ -3531,29 +3528,31 @@ function isOverflowElement(element) {
3531
3528
  overflowY,
3532
3529
  display
3533
3530
  } = getComputedStyle2(element);
3534
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
3531
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
3535
3532
  }
3536
- var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
3537
3533
  function isTableElement(element) {
3538
- return tableElements.has(getNodeName(element));
3534
+ return /^(table|td|th)$/.test(getNodeName(element));
3539
3535
  }
3540
- var topLayerSelectors = [":popover-open", ":modal"];
3541
3536
  function isTopLayer(element) {
3542
- return topLayerSelectors.some((selector) => {
3543
- try {
3544
- return element.matches(selector);
3545
- } catch (_e) {
3546
- return false;
3537
+ try {
3538
+ if (element.matches(":popover-open")) {
3539
+ return true;
3547
3540
  }
3548
- });
3541
+ } catch (_e) {
3542
+ }
3543
+ try {
3544
+ return element.matches(":modal");
3545
+ } catch (_e) {
3546
+ return false;
3547
+ }
3549
3548
  }
3550
- var transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
3551
- var willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
3552
- var containValues = ["paint", "layout", "strict", "content"];
3549
+ var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
3550
+ var containRe = /paint|layout|strict|content/;
3551
+ var isNotNone = (value) => !!value && value !== "none";
3552
+ var isWebKitValue;
3553
3553
  function isContainingBlock(elementOrCss) {
3554
- const webkit = isWebKit();
3555
3554
  const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
3556
- return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
3555
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
3557
3556
  }
3558
3557
  function getContainingBlock(element) {
3559
3558
  let currentNode = getParentNode(element);
@@ -3568,12 +3567,13 @@ function getContainingBlock(element) {
3568
3567
  return null;
3569
3568
  }
3570
3569
  function isWebKit() {
3571
- if (typeof CSS === "undefined" || !CSS.supports) return false;
3572
- return CSS.supports("-webkit-backdrop-filter", "none");
3570
+ if (isWebKitValue == null) {
3571
+ isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
3572
+ }
3573
+ return isWebKitValue;
3573
3574
  }
3574
- var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
3575
3575
  function isLastTraversableNode(node) {
3576
- return lastTraversableNodeNames.has(getNodeName(node));
3576
+ return /^(html|body|#document)$/.test(getNodeName(node));
3577
3577
  }
3578
3578
  function getComputedStyle2(element) {
3579
3579
  return getWindow(element).getComputedStyle(element);
@@ -3627,8 +3627,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
3627
3627
  if (isBody) {
3628
3628
  const frameElement = getFrameElement(win);
3629
3629
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
3630
+ } else {
3631
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
3630
3632
  }
3631
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
3632
3633
  }
3633
3634
  function getFrameElement(win) {
3634
3635
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -3792,7 +3793,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
3792
3793
  if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3793
3794
  scroll = getNodeScroll(offsetParent);
3794
3795
  }
3795
- if (isHTMLElement(offsetParent)) {
3796
+ if (isOffsetParentAnElement) {
3796
3797
  const offsetRect = getBoundingClientRect(offsetParent);
3797
3798
  scale = getScale(offsetParent);
3798
3799
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -3866,7 +3867,6 @@ function getViewportRect(element, strategy) {
3866
3867
  y
3867
3868
  };
3868
3869
  }
3869
- var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
3870
3870
  function getInnerBoundingClientRect(element, strategy) {
3871
3871
  const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
3872
3872
  const top2 = clientRect.top + element.clientTop;
@@ -3924,7 +3924,7 @@ function getClippingElementAncestors(element, cache) {
3924
3924
  if (!currentNodeIsContaining && computedStyle.position === "fixed") {
3925
3925
  currentContainingBlockComputedStyle = null;
3926
3926
  }
3927
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3927
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3928
3928
  if (shouldDropCurrentNode) {
3929
3929
  result = result.filter((ancestor) => ancestor !== currentNode);
3930
3930
  } else {
@@ -3944,20 +3944,23 @@ function getClippingRect(_ref) {
3944
3944
  } = _ref;
3945
3945
  const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
3946
3946
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
3947
- const firstClippingAncestor = clippingAncestors[0];
3948
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
3949
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
3950
- accRect.top = max(rect.top, accRect.top);
3951
- accRect.right = min(rect.right, accRect.right);
3952
- accRect.bottom = min(rect.bottom, accRect.bottom);
3953
- accRect.left = max(rect.left, accRect.left);
3954
- return accRect;
3955
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
3947
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
3948
+ let top2 = firstRect.top;
3949
+ let right = firstRect.right;
3950
+ let bottom = firstRect.bottom;
3951
+ let left = firstRect.left;
3952
+ for (let i = 1; i < clippingAncestors.length; i++) {
3953
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
3954
+ top2 = max(rect.top, top2);
3955
+ right = min(rect.right, right);
3956
+ bottom = min(rect.bottom, bottom);
3957
+ left = max(rect.left, left);
3958
+ }
3956
3959
  return {
3957
- width: clippingRect.right - clippingRect.left,
3958
- height: clippingRect.bottom - clippingRect.top,
3959
- x: clippingRect.left,
3960
- y: clippingRect.top
3960
+ width: right - left,
3961
+ height: bottom - top2,
3962
+ x: left,
3963
+ y: top2
3961
3964
  };
3962
3965
  }
3963
3966
  function getDimensions(element) {
@@ -4166,7 +4169,7 @@ function autoUpdate(reference, floating, update, options) {
4166
4169
  animationFrame = false
4167
4170
  } = options;
4168
4171
  const referenceEl = unwrapElement(reference);
4169
- const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
4172
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
4170
4173
  ancestors.forEach((ancestor) => {
4171
4174
  ancestorScroll && ancestor.addEventListener("scroll", update, {
4172
4175
  passive: true
@@ -4179,7 +4182,7 @@ function autoUpdate(reference, floating, update, options) {
4179
4182
  if (elementResize) {
4180
4183
  resizeObserver = new ResizeObserver((_ref) => {
4181
4184
  let [firstEntry] = _ref;
4182
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
4185
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
4183
4186
  resizeObserver.unobserve(floating);
4184
4187
  cancelAnimationFrame(reobserveFrame);
4185
4188
  reobserveFrame = requestAnimationFrame(() => {
@@ -4192,7 +4195,9 @@ function autoUpdate(reference, floating, update, options) {
4192
4195
  if (referenceEl && !animationFrame) {
4193
4196
  resizeObserver.observe(referenceEl);
4194
4197
  }
4195
- resizeObserver.observe(floating);
4198
+ if (floating) {
4199
+ resizeObserver.observe(floating);
4200
+ }
4196
4201
  }
4197
4202
  let frameId;
4198
4203
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -7961,6 +7966,10 @@ function split_default(Alpine) {
7961
7966
  refreshGutters();
7962
7967
  queueLayout();
7963
7968
  },
7969
+ gutterHidden() {
7970
+ refreshGutters();
7971
+ queueLayout();
7972
+ },
7964
7973
  panelChange() {
7965
7974
  queueLayout();
7966
7975
  },
@@ -7999,6 +8008,7 @@ function split_default(Alpine) {
7999
8008
  el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
8000
8009
  el.setAttribute("tabindex", "-1");
8001
8010
  el.setAttribute("data-slot", "split-panel");
8011
+ let gutterless = el.getAttribute("data-gutterless") === "true";
8002
8012
  const gutter = document.createElement("span");
8003
8013
  gutter.setAttribute("data-slot", "split-gutter");
8004
8014
  gutter.setAttribute("aria-disabled", el.getAttribute("data-locked") === "true");
@@ -8120,7 +8130,7 @@ function split_default(Alpine) {
8120
8130
  }
8121
8131
  },
8122
8132
  setGutter(last) {
8123
- if (this.hidden || last) {
8133
+ if (this.hidden || gutterless || last) {
8124
8134
  gutter.remove();
8125
8135
  } else if (!gutter.parentElement) {
8126
8136
  el.after(gutter);
@@ -8234,7 +8244,10 @@ function split_default(Alpine) {
8234
8244
  };
8235
8245
  const observer = new MutationObserver((mutations) => {
8236
8246
  mutations.forEach((mutation) => {
8237
- if (mutation.attributeName === "data-hidden") {
8247
+ if (mutation.attributeName === "data-gutterless") {
8248
+ gutterless = el.getAttribute("data-gutterless") === "true";
8249
+ split._h_split.gutterHidden();
8250
+ } else if (mutation.attributeName === "data-hidden") {
8238
8251
  panel.hidden = el.getAttribute("data-hidden") === "true";
8239
8252
  if (panel.hidden) {
8240
8253
  el.classList.add("hidden");
@@ -8253,7 +8266,7 @@ function split_default(Alpine) {
8253
8266
  }
8254
8267
  });
8255
8268
  });
8256
- observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse"] });
8269
+ observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse", "data-gutterless"] });
8257
8270
  cleanup(() => {
8258
8271
  gutter.remove();
8259
8272
  gutter.removeEventListener("pointerdown", drag);
@@ -9611,7 +9624,7 @@ function toolbar_default(Alpine) {
9611
9624
  el.setAttribute("data-slot", "toolbar-image");
9612
9625
  });
9613
9626
  Alpine.directive("h-toolbar-title", (el) => {
9614
- el.classList.add("text", "[[data-size=sm]_&]:text-sm", "[[data-size=md]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
9627
+ el.classList.add("text", "[[data-size=sm]_&]:text-sm", "[[data-size=md]_&]:text-sm", "first-of-type:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
9615
9628
  el.setAttribute("data-slot", "toolbar-title");
9616
9629
  });
9617
9630
  Alpine.directive("h-toolbar-spacer", (el) => {
@@ -9930,7 +9943,7 @@ function tree_default(Alpine) {
9930
9943
  }
9931
9944
 
9932
9945
  // package.json
9933
- var version = "1.4.1";
9946
+ var version = "1.4.2";
9934
9947
 
9935
9948
  // src/utils/breakpoint-listener.js
9936
9949
  function getBreakpointListener(handler, breakpoint = 768) {