@public-ui/hydrate 3.1.4-rc.0 → 3.1.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.js CHANGED
@@ -146,7 +146,7 @@ function _mergeNamespaces(n, m) {
146
146
 
147
147
  const NAMESPACE = 'kolibri';
148
148
  const BUILD = /* kolibri */ { hydratedSelectorName: "hydrated", slotRelocation: true, state: true, updatable: true};
149
- const Env = /* kolibri */ {"kolibriVersion":"3.1.4-rc.0"};
149
+ const Env = /* kolibri */ {"kolibriVersion":"3.1.4"};
150
150
 
151
151
  function getDefaultExportFromCjs (x) {
152
152
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -25452,10 +25452,6 @@ const oppositeSideMap = {
25452
25452
  bottom: 'top',
25453
25453
  top: 'bottom'
25454
25454
  };
25455
- const oppositeAlignmentMap = {
25456
- start: 'end',
25457
- end: 'start'
25458
- };
25459
25455
  function clamp(start, value, end) {
25460
25456
  return max(start, min(value, end));
25461
25457
  }
@@ -25474,9 +25470,9 @@ function getOppositeAxis(axis) {
25474
25470
  function getAxisLength(axis) {
25475
25471
  return axis === 'y' ? 'height' : 'width';
25476
25472
  }
25477
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
25478
25473
  function getSideAxis(placement) {
25479
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
25474
+ const firstChar = placement[0];
25475
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
25480
25476
  }
25481
25477
  function getAlignmentAxis(placement) {
25482
25478
  return getOppositeAxis(getSideAxis(placement));
@@ -25499,7 +25495,7 @@ function getExpandedPlacements(placement) {
25499
25495
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
25500
25496
  }
25501
25497
  function getOppositeAlignmentPlacement(placement) {
25502
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
25498
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
25503
25499
  }
25504
25500
  const lrPlacement = ['left', 'right'];
25505
25501
  const rlPlacement = ['right', 'left'];
@@ -25530,7 +25526,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
25530
25526
  return list;
25531
25527
  }
25532
25528
  function getOppositePlacement(placement) {
25533
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
25529
+ const side = getSide(placement);
25530
+ return oppositeSideMap[side] + placement.slice(side.length);
25534
25531
  }
25535
25532
  function expandPaddingObject(padding) {
25536
25533
  return {
@@ -25689,6 +25686,9 @@ async function detectOverflow(state, options) {
25689
25686
  };
25690
25687
  }
25691
25688
 
25689
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
25690
+ const MAX_RESET_COUNT = 50;
25691
+
25692
25692
  /**
25693
25693
  * Computes the `x` and `y` coordinates that will place the floating element
25694
25694
  * next to a given reference element.
@@ -25703,7 +25703,10 @@ const computePosition$1 = async (reference, floating, config) => {
25703
25703
  middleware = [],
25704
25704
  platform
25705
25705
  } = config;
25706
- const validMiddleware = middleware.filter(Boolean);
25706
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
25707
+ ...platform,
25708
+ detectOverflow
25709
+ };
25707
25710
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
25708
25711
  let rects = await platform.getElementRects({
25709
25712
  reference,
@@ -25715,14 +25718,17 @@ const computePosition$1 = async (reference, floating, config) => {
25715
25718
  y
25716
25719
  } = computeCoordsFromPlacement(rects, placement, rtl);
25717
25720
  let statefulPlacement = placement;
25718
- let middlewareData = {};
25719
25721
  let resetCount = 0;
25720
- for (let i = 0; i < validMiddleware.length; i++) {
25721
- var _platform$detectOverf;
25722
+ const middlewareData = {};
25723
+ for (let i = 0; i < middleware.length; i++) {
25724
+ const currentMiddleware = middleware[i];
25725
+ if (!currentMiddleware) {
25726
+ continue;
25727
+ }
25722
25728
  const {
25723
25729
  name,
25724
25730
  fn
25725
- } = validMiddleware[i];
25731
+ } = currentMiddleware;
25726
25732
  const {
25727
25733
  x: nextX,
25728
25734
  y: nextY,
@@ -25736,10 +25742,7 @@ const computePosition$1 = async (reference, floating, config) => {
25736
25742
  strategy,
25737
25743
  middlewareData,
25738
25744
  rects,
25739
- platform: {
25740
- ...platform,
25741
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
25742
- },
25745
+ platform: platformWithDetectOverflow,
25743
25746
  elements: {
25744
25747
  reference,
25745
25748
  floating
@@ -25747,14 +25750,11 @@ const computePosition$1 = async (reference, floating, config) => {
25747
25750
  });
25748
25751
  x = nextX != null ? nextX : x;
25749
25752
  y = nextY != null ? nextY : y;
25750
- middlewareData = {
25751
- ...middlewareData,
25752
- [name]: {
25753
- ...middlewareData[name],
25754
- ...data
25755
- }
25753
+ middlewareData[name] = {
25754
+ ...middlewareData[name],
25755
+ ...data
25756
25756
  };
25757
- if (reset && resetCount <= 50) {
25757
+ if (reset && resetCount < MAX_RESET_COUNT) {
25758
25758
  resetCount++;
25759
25759
  if (typeof reset === 'object') {
25760
25760
  if (reset.placement) {
@@ -26207,7 +26207,6 @@ function isShadowRoot(value) {
26207
26207
  }
26208
26208
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
26209
26209
  }
26210
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
26211
26210
  function isOverflowElement(element) {
26212
26211
  const {
26213
26212
  overflow,
@@ -26215,32 +26214,35 @@ function isOverflowElement(element) {
26215
26214
  overflowY,
26216
26215
  display
26217
26216
  } = getComputedStyle$1(element);
26218
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
26217
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
26219
26218
  }
26220
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
26221
26219
  function isTableElement(element) {
26222
- return tableElements.has(getNodeName(element));
26220
+ return /^(table|td|th)$/.test(getNodeName(element));
26223
26221
  }
26224
- const topLayerSelectors = [':popover-open', ':modal'];
26225
26222
  function isTopLayer(element) {
26226
- return topLayerSelectors.some(selector => {
26227
- try {
26228
- return element.matches(selector);
26229
- } catch (_e) {
26230
- return false;
26223
+ try {
26224
+ if (element.matches(':popover-open')) {
26225
+ return true;
26231
26226
  }
26232
- });
26227
+ } catch (_e) {
26228
+ // no-op
26229
+ }
26230
+ try {
26231
+ return element.matches(':modal');
26232
+ } catch (_e) {
26233
+ return false;
26234
+ }
26233
26235
  }
26234
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
26235
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
26236
- const containValues = ['paint', 'layout', 'strict', 'content'];
26236
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
26237
+ const containRe = /paint|layout|strict|content/;
26238
+ const isNotNone = value => !!value && value !== 'none';
26239
+ let isWebKitValue;
26237
26240
  function isContainingBlock(elementOrCss) {
26238
- const webkit = isWebKit();
26239
26241
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
26240
26242
 
26241
26243
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
26242
26244
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
26243
- 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));
26245
+ 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 || '');
26244
26246
  }
26245
26247
  function getContainingBlock(element) {
26246
26248
  let currentNode = getParentNode(element);
@@ -26255,12 +26257,13 @@ function getContainingBlock(element) {
26255
26257
  return null;
26256
26258
  }
26257
26259
  function isWebKit() {
26258
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
26259
- return CSS.supports('-webkit-backdrop-filter', 'none');
26260
+ if (isWebKitValue == null) {
26261
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
26262
+ }
26263
+ return isWebKitValue;
26260
26264
  }
26261
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
26262
26265
  function isLastTraversableNode(node) {
26263
- return lastTraversableNodeNames.has(getNodeName(node));
26266
+ return /^(html|body|#document)$/.test(getNodeName(node));
26264
26267
  }
26265
26268
  function getComputedStyle$1(element) {
26266
26269
  return getWindow(element).getComputedStyle(element);
@@ -26316,8 +26319,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
26316
26319
  if (isBody) {
26317
26320
  const frameElement = getFrameElement(win);
26318
26321
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
26322
+ } else {
26323
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
26319
26324
  }
26320
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
26321
26325
  }
26322
26326
  function getFrameElement(win) {
26323
26327
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -26494,7 +26498,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
26494
26498
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
26495
26499
  scroll = getNodeScroll(offsetParent);
26496
26500
  }
26497
- if (isHTMLElement(offsetParent)) {
26501
+ if (isOffsetParentAnElement) {
26498
26502
  const offsetRect = getBoundingClientRect(offsetParent);
26499
26503
  scale = getScale(offsetParent);
26500
26504
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -26582,7 +26586,6 @@ function getViewportRect(element, strategy) {
26582
26586
  };
26583
26587
  }
26584
26588
 
26585
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
26586
26589
  // Returns the inner client rect, subtracting scrollbars if present.
26587
26590
  function getInnerBoundingClientRect(element, strategy) {
26588
26591
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -26647,7 +26650,7 @@ function getClippingElementAncestors(element, cache) {
26647
26650
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
26648
26651
  currentContainingBlockComputedStyle = null;
26649
26652
  }
26650
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
26653
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
26651
26654
  if (shouldDropCurrentNode) {
26652
26655
  // Drop non-containing blocks.
26653
26656
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -26672,20 +26675,23 @@ function getClippingRect(_ref) {
26672
26675
  } = _ref;
26673
26676
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
26674
26677
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
26675
- const firstClippingAncestor = clippingAncestors[0];
26676
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
26677
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
26678
- accRect.top = max(rect.top, accRect.top);
26679
- accRect.right = min(rect.right, accRect.right);
26680
- accRect.bottom = min(rect.bottom, accRect.bottom);
26681
- accRect.left = max(rect.left, accRect.left);
26682
- return accRect;
26683
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
26678
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
26679
+ let top = firstRect.top;
26680
+ let right = firstRect.right;
26681
+ let bottom = firstRect.bottom;
26682
+ let left = firstRect.left;
26683
+ for (let i = 1; i < clippingAncestors.length; i++) {
26684
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
26685
+ top = max(rect.top, top);
26686
+ right = min(rect.right, right);
26687
+ bottom = min(rect.bottom, bottom);
26688
+ left = max(rect.left, left);
26689
+ }
26684
26690
  return {
26685
- width: clippingRect.right - clippingRect.left,
26686
- height: clippingRect.bottom - clippingRect.top,
26687
- x: clippingRect.left,
26688
- y: clippingRect.top
26691
+ width: right - left,
26692
+ height: bottom - top,
26693
+ x: left,
26694
+ y: top
26689
26695
  };
26690
26696
  }
26691
26697
 
@@ -26936,7 +26942,7 @@ function autoUpdate(reference, floating, update, options) {
26936
26942
  animationFrame = false
26937
26943
  } = options;
26938
26944
  const referenceEl = unwrapElement(reference);
26939
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
26945
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
26940
26946
  ancestors.forEach(ancestor => {
26941
26947
  ancestorScroll && ancestor.addEventListener('scroll', update, {
26942
26948
  passive: true
@@ -26949,7 +26955,7 @@ function autoUpdate(reference, floating, update, options) {
26949
26955
  if (elementResize) {
26950
26956
  resizeObserver = new ResizeObserver(_ref => {
26951
26957
  let [firstEntry] = _ref;
26952
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
26958
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
26953
26959
  // Prevent update loops when using the `size` middleware.
26954
26960
  // https://github.com/floating-ui/floating-ui/issues/1740
26955
26961
  resizeObserver.unobserve(floating);
@@ -26964,7 +26970,9 @@ function autoUpdate(reference, floating, update, options) {
26964
26970
  if (referenceEl && !animationFrame) {
26965
26971
  resizeObserver.observe(referenceEl);
26966
26972
  }
26967
- resizeObserver.observe(floating);
26973
+ if (floating) {
26974
+ resizeObserver.observe(floating);
26975
+ }
26968
26976
  }
26969
26977
  let frameId;
26970
26978
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
package/dist/index.mjs CHANGED
@@ -144,7 +144,7 @@ function _mergeNamespaces(n, m) {
144
144
 
145
145
  const NAMESPACE = 'kolibri';
146
146
  const BUILD = /* kolibri */ { hydratedSelectorName: "hydrated", slotRelocation: true, state: true, updatable: true};
147
- const Env = /* kolibri */ {"kolibriVersion":"3.1.4-rc.0"};
147
+ const Env = /* kolibri */ {"kolibriVersion":"3.1.4"};
148
148
 
149
149
  function getDefaultExportFromCjs (x) {
150
150
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -25450,10 +25450,6 @@ const oppositeSideMap = {
25450
25450
  bottom: 'top',
25451
25451
  top: 'bottom'
25452
25452
  };
25453
- const oppositeAlignmentMap = {
25454
- start: 'end',
25455
- end: 'start'
25456
- };
25457
25453
  function clamp(start, value, end) {
25458
25454
  return max(start, min(value, end));
25459
25455
  }
@@ -25472,9 +25468,9 @@ function getOppositeAxis(axis) {
25472
25468
  function getAxisLength(axis) {
25473
25469
  return axis === 'y' ? 'height' : 'width';
25474
25470
  }
25475
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
25476
25471
  function getSideAxis(placement) {
25477
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
25472
+ const firstChar = placement[0];
25473
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
25478
25474
  }
25479
25475
  function getAlignmentAxis(placement) {
25480
25476
  return getOppositeAxis(getSideAxis(placement));
@@ -25497,7 +25493,7 @@ function getExpandedPlacements(placement) {
25497
25493
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
25498
25494
  }
25499
25495
  function getOppositeAlignmentPlacement(placement) {
25500
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
25496
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
25501
25497
  }
25502
25498
  const lrPlacement = ['left', 'right'];
25503
25499
  const rlPlacement = ['right', 'left'];
@@ -25528,7 +25524,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
25528
25524
  return list;
25529
25525
  }
25530
25526
  function getOppositePlacement(placement) {
25531
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
25527
+ const side = getSide(placement);
25528
+ return oppositeSideMap[side] + placement.slice(side.length);
25532
25529
  }
25533
25530
  function expandPaddingObject(padding) {
25534
25531
  return {
@@ -25687,6 +25684,9 @@ async function detectOverflow(state, options) {
25687
25684
  };
25688
25685
  }
25689
25686
 
25687
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
25688
+ const MAX_RESET_COUNT = 50;
25689
+
25690
25690
  /**
25691
25691
  * Computes the `x` and `y` coordinates that will place the floating element
25692
25692
  * next to a given reference element.
@@ -25701,7 +25701,10 @@ const computePosition$1 = async (reference, floating, config) => {
25701
25701
  middleware = [],
25702
25702
  platform
25703
25703
  } = config;
25704
- const validMiddleware = middleware.filter(Boolean);
25704
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
25705
+ ...platform,
25706
+ detectOverflow
25707
+ };
25705
25708
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
25706
25709
  let rects = await platform.getElementRects({
25707
25710
  reference,
@@ -25713,14 +25716,17 @@ const computePosition$1 = async (reference, floating, config) => {
25713
25716
  y
25714
25717
  } = computeCoordsFromPlacement(rects, placement, rtl);
25715
25718
  let statefulPlacement = placement;
25716
- let middlewareData = {};
25717
25719
  let resetCount = 0;
25718
- for (let i = 0; i < validMiddleware.length; i++) {
25719
- var _platform$detectOverf;
25720
+ const middlewareData = {};
25721
+ for (let i = 0; i < middleware.length; i++) {
25722
+ const currentMiddleware = middleware[i];
25723
+ if (!currentMiddleware) {
25724
+ continue;
25725
+ }
25720
25726
  const {
25721
25727
  name,
25722
25728
  fn
25723
- } = validMiddleware[i];
25729
+ } = currentMiddleware;
25724
25730
  const {
25725
25731
  x: nextX,
25726
25732
  y: nextY,
@@ -25734,10 +25740,7 @@ const computePosition$1 = async (reference, floating, config) => {
25734
25740
  strategy,
25735
25741
  middlewareData,
25736
25742
  rects,
25737
- platform: {
25738
- ...platform,
25739
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
25740
- },
25743
+ platform: platformWithDetectOverflow,
25741
25744
  elements: {
25742
25745
  reference,
25743
25746
  floating
@@ -25745,14 +25748,11 @@ const computePosition$1 = async (reference, floating, config) => {
25745
25748
  });
25746
25749
  x = nextX != null ? nextX : x;
25747
25750
  y = nextY != null ? nextY : y;
25748
- middlewareData = {
25749
- ...middlewareData,
25750
- [name]: {
25751
- ...middlewareData[name],
25752
- ...data
25753
- }
25751
+ middlewareData[name] = {
25752
+ ...middlewareData[name],
25753
+ ...data
25754
25754
  };
25755
- if (reset && resetCount <= 50) {
25755
+ if (reset && resetCount < MAX_RESET_COUNT) {
25756
25756
  resetCount++;
25757
25757
  if (typeof reset === 'object') {
25758
25758
  if (reset.placement) {
@@ -26205,7 +26205,6 @@ function isShadowRoot(value) {
26205
26205
  }
26206
26206
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
26207
26207
  }
26208
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
26209
26208
  function isOverflowElement(element) {
26210
26209
  const {
26211
26210
  overflow,
@@ -26213,32 +26212,35 @@ function isOverflowElement(element) {
26213
26212
  overflowY,
26214
26213
  display
26215
26214
  } = getComputedStyle$1(element);
26216
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
26215
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
26217
26216
  }
26218
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
26219
26217
  function isTableElement(element) {
26220
- return tableElements.has(getNodeName(element));
26218
+ return /^(table|td|th)$/.test(getNodeName(element));
26221
26219
  }
26222
- const topLayerSelectors = [':popover-open', ':modal'];
26223
26220
  function isTopLayer(element) {
26224
- return topLayerSelectors.some(selector => {
26225
- try {
26226
- return element.matches(selector);
26227
- } catch (_e) {
26228
- return false;
26221
+ try {
26222
+ if (element.matches(':popover-open')) {
26223
+ return true;
26229
26224
  }
26230
- });
26225
+ } catch (_e) {
26226
+ // no-op
26227
+ }
26228
+ try {
26229
+ return element.matches(':modal');
26230
+ } catch (_e) {
26231
+ return false;
26232
+ }
26231
26233
  }
26232
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
26233
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
26234
- const containValues = ['paint', 'layout', 'strict', 'content'];
26234
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
26235
+ const containRe = /paint|layout|strict|content/;
26236
+ const isNotNone = value => !!value && value !== 'none';
26237
+ let isWebKitValue;
26235
26238
  function isContainingBlock(elementOrCss) {
26236
- const webkit = isWebKit();
26237
26239
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
26238
26240
 
26239
26241
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
26240
26242
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
26241
- 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));
26243
+ 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 || '');
26242
26244
  }
26243
26245
  function getContainingBlock(element) {
26244
26246
  let currentNode = getParentNode(element);
@@ -26253,12 +26255,13 @@ function getContainingBlock(element) {
26253
26255
  return null;
26254
26256
  }
26255
26257
  function isWebKit() {
26256
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
26257
- return CSS.supports('-webkit-backdrop-filter', 'none');
26258
+ if (isWebKitValue == null) {
26259
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
26260
+ }
26261
+ return isWebKitValue;
26258
26262
  }
26259
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
26260
26263
  function isLastTraversableNode(node) {
26261
- return lastTraversableNodeNames.has(getNodeName(node));
26264
+ return /^(html|body|#document)$/.test(getNodeName(node));
26262
26265
  }
26263
26266
  function getComputedStyle$1(element) {
26264
26267
  return getWindow(element).getComputedStyle(element);
@@ -26314,8 +26317,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
26314
26317
  if (isBody) {
26315
26318
  const frameElement = getFrameElement(win);
26316
26319
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
26320
+ } else {
26321
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
26317
26322
  }
26318
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
26319
26323
  }
26320
26324
  function getFrameElement(win) {
26321
26325
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -26492,7 +26496,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
26492
26496
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
26493
26497
  scroll = getNodeScroll(offsetParent);
26494
26498
  }
26495
- if (isHTMLElement(offsetParent)) {
26499
+ if (isOffsetParentAnElement) {
26496
26500
  const offsetRect = getBoundingClientRect(offsetParent);
26497
26501
  scale = getScale(offsetParent);
26498
26502
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -26580,7 +26584,6 @@ function getViewportRect(element, strategy) {
26580
26584
  };
26581
26585
  }
26582
26586
 
26583
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
26584
26587
  // Returns the inner client rect, subtracting scrollbars if present.
26585
26588
  function getInnerBoundingClientRect(element, strategy) {
26586
26589
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -26645,7 +26648,7 @@ function getClippingElementAncestors(element, cache) {
26645
26648
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
26646
26649
  currentContainingBlockComputedStyle = null;
26647
26650
  }
26648
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
26651
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
26649
26652
  if (shouldDropCurrentNode) {
26650
26653
  // Drop non-containing blocks.
26651
26654
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -26670,20 +26673,23 @@ function getClippingRect(_ref) {
26670
26673
  } = _ref;
26671
26674
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
26672
26675
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
26673
- const firstClippingAncestor = clippingAncestors[0];
26674
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
26675
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
26676
- accRect.top = max(rect.top, accRect.top);
26677
- accRect.right = min(rect.right, accRect.right);
26678
- accRect.bottom = min(rect.bottom, accRect.bottom);
26679
- accRect.left = max(rect.left, accRect.left);
26680
- return accRect;
26681
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
26676
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
26677
+ let top = firstRect.top;
26678
+ let right = firstRect.right;
26679
+ let bottom = firstRect.bottom;
26680
+ let left = firstRect.left;
26681
+ for (let i = 1; i < clippingAncestors.length; i++) {
26682
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
26683
+ top = max(rect.top, top);
26684
+ right = min(rect.right, right);
26685
+ bottom = min(rect.bottom, bottom);
26686
+ left = max(rect.left, left);
26687
+ }
26682
26688
  return {
26683
- width: clippingRect.right - clippingRect.left,
26684
- height: clippingRect.bottom - clippingRect.top,
26685
- x: clippingRect.left,
26686
- y: clippingRect.top
26689
+ width: right - left,
26690
+ height: bottom - top,
26691
+ x: left,
26692
+ y: top
26687
26693
  };
26688
26694
  }
26689
26695
 
@@ -26934,7 +26940,7 @@ function autoUpdate(reference, floating, update, options) {
26934
26940
  animationFrame = false
26935
26941
  } = options;
26936
26942
  const referenceEl = unwrapElement(reference);
26937
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
26943
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
26938
26944
  ancestors.forEach(ancestor => {
26939
26945
  ancestorScroll && ancestor.addEventListener('scroll', update, {
26940
26946
  passive: true
@@ -26947,7 +26953,7 @@ function autoUpdate(reference, floating, update, options) {
26947
26953
  if (elementResize) {
26948
26954
  resizeObserver = new ResizeObserver(_ref => {
26949
26955
  let [firstEntry] = _ref;
26950
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
26956
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
26951
26957
  // Prevent update loops when using the `size` middleware.
26952
26958
  // https://github.com/floating-ui/floating-ui/issues/1740
26953
26959
  resizeObserver.unobserve(floating);
@@ -26962,7 +26968,9 @@ function autoUpdate(reference, floating, update, options) {
26962
26968
  if (referenceEl && !animationFrame) {
26963
26969
  resizeObserver.observe(referenceEl);
26964
26970
  }
26965
- resizeObserver.observe(floating);
26971
+ if (floating) {
26972
+ resizeObserver.observe(floating);
26973
+ }
26966
26974
  }
26967
26975
  let frameId;
26968
26976
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/hydrate",
3
- "version": "3.1.4-rc.0",
3
+ "version": "3.1.4",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": {
@@ -52,7 +52,7 @@
52
52
  "prettier": "3.8.1",
53
53
  "prettier-plugin-organize-imports": "4.3.0",
54
54
  "rimraf": "6.1.3",
55
- "@public-ui/components": "3.1.4-rc.0"
55
+ "@public-ui/components": "3.1.4"
56
56
  },
57
57
  "sideEffects": false,
58
58
  "type": "commonjs",