@public-ui/hydrate 2.2.22-rc.0 → 2.2.22

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
@@ -12295,10 +12295,6 @@ const oppositeSideMap = {
12295
12295
  bottom: 'top',
12296
12296
  top: 'bottom'
12297
12297
  };
12298
- const oppositeAlignmentMap = {
12299
- start: 'end',
12300
- end: 'start'
12301
- };
12302
12298
  function clamp(start, value, end) {
12303
12299
  return max(start, min(value, end));
12304
12300
  }
@@ -12317,9 +12313,9 @@ function getOppositeAxis(axis) {
12317
12313
  function getAxisLength(axis) {
12318
12314
  return axis === 'y' ? 'height' : 'width';
12319
12315
  }
12320
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
12321
12316
  function getSideAxis(placement) {
12322
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
12317
+ const firstChar = placement[0];
12318
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
12323
12319
  }
12324
12320
  function getAlignmentAxis(placement) {
12325
12321
  return getOppositeAxis(getSideAxis(placement));
@@ -12342,7 +12338,7 @@ function getExpandedPlacements(placement) {
12342
12338
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
12343
12339
  }
12344
12340
  function getOppositeAlignmentPlacement(placement) {
12345
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
12341
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
12346
12342
  }
12347
12343
  const lrPlacement = ['left', 'right'];
12348
12344
  const rlPlacement = ['right', 'left'];
@@ -12373,7 +12369,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
12373
12369
  return list;
12374
12370
  }
12375
12371
  function getOppositePlacement(placement) {
12376
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
12372
+ const side = getSide(placement);
12373
+ return oppositeSideMap[side] + placement.slice(side.length);
12377
12374
  }
12378
12375
  function expandPaddingObject(padding) {
12379
12376
  return {
@@ -12532,6 +12529,9 @@ async function detectOverflow(state, options) {
12532
12529
  };
12533
12530
  }
12534
12531
 
12532
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
12533
+ const MAX_RESET_COUNT = 50;
12534
+
12535
12535
  /**
12536
12536
  * Computes the `x` and `y` coordinates that will place the floating element
12537
12537
  * next to a given reference element.
@@ -12546,7 +12546,10 @@ const computePosition$1 = async (reference, floating, config) => {
12546
12546
  middleware = [],
12547
12547
  platform
12548
12548
  } = config;
12549
- const validMiddleware = middleware.filter(Boolean);
12549
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
12550
+ ...platform,
12551
+ detectOverflow
12552
+ };
12550
12553
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
12551
12554
  let rects = await platform.getElementRects({
12552
12555
  reference,
@@ -12558,14 +12561,17 @@ const computePosition$1 = async (reference, floating, config) => {
12558
12561
  y
12559
12562
  } = computeCoordsFromPlacement(rects, placement, rtl);
12560
12563
  let statefulPlacement = placement;
12561
- let middlewareData = {};
12562
12564
  let resetCount = 0;
12563
- for (let i = 0; i < validMiddleware.length; i++) {
12564
- var _platform$detectOverf;
12565
+ const middlewareData = {};
12566
+ for (let i = 0; i < middleware.length; i++) {
12567
+ const currentMiddleware = middleware[i];
12568
+ if (!currentMiddleware) {
12569
+ continue;
12570
+ }
12565
12571
  const {
12566
12572
  name,
12567
12573
  fn
12568
- } = validMiddleware[i];
12574
+ } = currentMiddleware;
12569
12575
  const {
12570
12576
  x: nextX,
12571
12577
  y: nextY,
@@ -12579,10 +12585,7 @@ const computePosition$1 = async (reference, floating, config) => {
12579
12585
  strategy,
12580
12586
  middlewareData,
12581
12587
  rects,
12582
- platform: {
12583
- ...platform,
12584
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
12585
- },
12588
+ platform: platformWithDetectOverflow,
12586
12589
  elements: {
12587
12590
  reference,
12588
12591
  floating
@@ -12590,14 +12593,11 @@ const computePosition$1 = async (reference, floating, config) => {
12590
12593
  });
12591
12594
  x = nextX != null ? nextX : x;
12592
12595
  y = nextY != null ? nextY : y;
12593
- middlewareData = {
12594
- ...middlewareData,
12595
- [name]: {
12596
- ...middlewareData[name],
12597
- ...data
12598
- }
12596
+ middlewareData[name] = {
12597
+ ...middlewareData[name],
12598
+ ...data
12599
12599
  };
12600
- if (reset && resetCount <= 50) {
12600
+ if (reset && resetCount < MAX_RESET_COUNT) {
12601
12601
  resetCount++;
12602
12602
  if (typeof reset === 'object') {
12603
12603
  if (reset.placement) {
@@ -13506,7 +13506,6 @@ function isShadowRoot(value) {
13506
13506
  }
13507
13507
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
13508
13508
  }
13509
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
13510
13509
  function isOverflowElement(element) {
13511
13510
  const {
13512
13511
  overflow,
@@ -13514,32 +13513,35 @@ function isOverflowElement(element) {
13514
13513
  overflowY,
13515
13514
  display
13516
13515
  } = getComputedStyle$1(element);
13517
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
13516
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
13518
13517
  }
13519
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
13520
13518
  function isTableElement(element) {
13521
- return tableElements.has(getNodeName(element));
13519
+ return /^(table|td|th)$/.test(getNodeName(element));
13522
13520
  }
13523
- const topLayerSelectors = [':popover-open', ':modal'];
13524
13521
  function isTopLayer(element) {
13525
- return topLayerSelectors.some(selector => {
13526
- try {
13527
- return element.matches(selector);
13528
- } catch (_e) {
13529
- return false;
13522
+ try {
13523
+ if (element.matches(':popover-open')) {
13524
+ return true;
13530
13525
  }
13531
- });
13526
+ } catch (_e) {
13527
+ // no-op
13528
+ }
13529
+ try {
13530
+ return element.matches(':modal');
13531
+ } catch (_e) {
13532
+ return false;
13533
+ }
13532
13534
  }
13533
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
13534
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
13535
- const containValues = ['paint', 'layout', 'strict', 'content'];
13535
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
13536
+ const containRe = /paint|layout|strict|content/;
13537
+ const isNotNone = value => !!value && value !== 'none';
13538
+ let isWebKitValue;
13536
13539
  function isContainingBlock(elementOrCss) {
13537
- const webkit = isWebKit();
13538
13540
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
13539
13541
 
13540
13542
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
13541
13543
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
13542
- 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));
13544
+ 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 || '');
13543
13545
  }
13544
13546
  function getContainingBlock(element) {
13545
13547
  let currentNode = getParentNode(element);
@@ -13554,12 +13556,13 @@ function getContainingBlock(element) {
13554
13556
  return null;
13555
13557
  }
13556
13558
  function isWebKit() {
13557
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
13558
- return CSS.supports('-webkit-backdrop-filter', 'none');
13559
+ if (isWebKitValue == null) {
13560
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
13561
+ }
13562
+ return isWebKitValue;
13559
13563
  }
13560
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
13561
13564
  function isLastTraversableNode(node) {
13562
- return lastTraversableNodeNames.has(getNodeName(node));
13565
+ return /^(html|body|#document)$/.test(getNodeName(node));
13563
13566
  }
13564
13567
  function getComputedStyle$1(element) {
13565
13568
  return getWindow(element).getComputedStyle(element);
@@ -13615,8 +13618,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
13615
13618
  if (isBody) {
13616
13619
  const frameElement = getFrameElement(win);
13617
13620
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
13621
+ } else {
13622
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
13618
13623
  }
13619
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
13620
13624
  }
13621
13625
  function getFrameElement(win) {
13622
13626
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -13793,7 +13797,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
13793
13797
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
13794
13798
  scroll = getNodeScroll(offsetParent);
13795
13799
  }
13796
- if (isHTMLElement(offsetParent)) {
13800
+ if (isOffsetParentAnElement) {
13797
13801
  const offsetRect = getBoundingClientRect(offsetParent);
13798
13802
  scale = getScale(offsetParent);
13799
13803
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -13881,7 +13885,6 @@ function getViewportRect(element, strategy) {
13881
13885
  };
13882
13886
  }
13883
13887
 
13884
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
13885
13888
  // Returns the inner client rect, subtracting scrollbars if present.
13886
13889
  function getInnerBoundingClientRect(element, strategy) {
13887
13890
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -13946,7 +13949,7 @@ function getClippingElementAncestors(element, cache) {
13946
13949
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
13947
13950
  currentContainingBlockComputedStyle = null;
13948
13951
  }
13949
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
13952
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
13950
13953
  if (shouldDropCurrentNode) {
13951
13954
  // Drop non-containing blocks.
13952
13955
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -13971,20 +13974,23 @@ function getClippingRect(_ref) {
13971
13974
  } = _ref;
13972
13975
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
13973
13976
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
13974
- const firstClippingAncestor = clippingAncestors[0];
13975
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
13976
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
13977
- accRect.top = max(rect.top, accRect.top);
13978
- accRect.right = min(rect.right, accRect.right);
13979
- accRect.bottom = min(rect.bottom, accRect.bottom);
13980
- accRect.left = max(rect.left, accRect.left);
13981
- return accRect;
13982
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
13977
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
13978
+ let top = firstRect.top;
13979
+ let right = firstRect.right;
13980
+ let bottom = firstRect.bottom;
13981
+ let left = firstRect.left;
13982
+ for (let i = 1; i < clippingAncestors.length; i++) {
13983
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
13984
+ top = max(rect.top, top);
13985
+ right = min(rect.right, right);
13986
+ bottom = min(rect.bottom, bottom);
13987
+ left = max(rect.left, left);
13988
+ }
13983
13989
  return {
13984
- width: clippingRect.right - clippingRect.left,
13985
- height: clippingRect.bottom - clippingRect.top,
13986
- x: clippingRect.left,
13987
- y: clippingRect.top
13990
+ width: right - left,
13991
+ height: bottom - top,
13992
+ x: left,
13993
+ y: top
13988
13994
  };
13989
13995
  }
13990
13996
 
@@ -14235,7 +14241,7 @@ function autoUpdate(reference, floating, update, options) {
14235
14241
  animationFrame = false
14236
14242
  } = options;
14237
14243
  const referenceEl = unwrapElement(reference);
14238
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
14244
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
14239
14245
  ancestors.forEach(ancestor => {
14240
14246
  ancestorScroll && ancestor.addEventListener('scroll', update, {
14241
14247
  passive: true
@@ -14248,7 +14254,7 @@ function autoUpdate(reference, floating, update, options) {
14248
14254
  if (elementResize) {
14249
14255
  resizeObserver = new ResizeObserver(_ref => {
14250
14256
  let [firstEntry] = _ref;
14251
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
14257
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
14252
14258
  // Prevent update loops when using the `size` middleware.
14253
14259
  // https://github.com/floating-ui/floating-ui/issues/1740
14254
14260
  resizeObserver.unobserve(floating);
@@ -14263,7 +14269,9 @@ function autoUpdate(reference, floating, update, options) {
14263
14269
  if (referenceEl && !animationFrame) {
14264
14270
  resizeObserver.observe(referenceEl);
14265
14271
  }
14266
- resizeObserver.observe(floating);
14272
+ if (floating) {
14273
+ resizeObserver.observe(floating);
14274
+ }
14267
14275
  }
14268
14276
  let frameId;
14269
14277
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
package/dist/index.mjs CHANGED
@@ -12291,10 +12291,6 @@ const oppositeSideMap = {
12291
12291
  bottom: 'top',
12292
12292
  top: 'bottom'
12293
12293
  };
12294
- const oppositeAlignmentMap = {
12295
- start: 'end',
12296
- end: 'start'
12297
- };
12298
12294
  function clamp(start, value, end) {
12299
12295
  return max(start, min(value, end));
12300
12296
  }
@@ -12313,9 +12309,9 @@ function getOppositeAxis(axis) {
12313
12309
  function getAxisLength(axis) {
12314
12310
  return axis === 'y' ? 'height' : 'width';
12315
12311
  }
12316
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
12317
12312
  function getSideAxis(placement) {
12318
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
12313
+ const firstChar = placement[0];
12314
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
12319
12315
  }
12320
12316
  function getAlignmentAxis(placement) {
12321
12317
  return getOppositeAxis(getSideAxis(placement));
@@ -12338,7 +12334,7 @@ function getExpandedPlacements(placement) {
12338
12334
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
12339
12335
  }
12340
12336
  function getOppositeAlignmentPlacement(placement) {
12341
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
12337
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
12342
12338
  }
12343
12339
  const lrPlacement = ['left', 'right'];
12344
12340
  const rlPlacement = ['right', 'left'];
@@ -12369,7 +12365,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
12369
12365
  return list;
12370
12366
  }
12371
12367
  function getOppositePlacement(placement) {
12372
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
12368
+ const side = getSide(placement);
12369
+ return oppositeSideMap[side] + placement.slice(side.length);
12373
12370
  }
12374
12371
  function expandPaddingObject(padding) {
12375
12372
  return {
@@ -12528,6 +12525,9 @@ async function detectOverflow(state, options) {
12528
12525
  };
12529
12526
  }
12530
12527
 
12528
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
12529
+ const MAX_RESET_COUNT = 50;
12530
+
12531
12531
  /**
12532
12532
  * Computes the `x` and `y` coordinates that will place the floating element
12533
12533
  * next to a given reference element.
@@ -12542,7 +12542,10 @@ const computePosition$1 = async (reference, floating, config) => {
12542
12542
  middleware = [],
12543
12543
  platform
12544
12544
  } = config;
12545
- const validMiddleware = middleware.filter(Boolean);
12545
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
12546
+ ...platform,
12547
+ detectOverflow
12548
+ };
12546
12549
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
12547
12550
  let rects = await platform.getElementRects({
12548
12551
  reference,
@@ -12554,14 +12557,17 @@ const computePosition$1 = async (reference, floating, config) => {
12554
12557
  y
12555
12558
  } = computeCoordsFromPlacement(rects, placement, rtl);
12556
12559
  let statefulPlacement = placement;
12557
- let middlewareData = {};
12558
12560
  let resetCount = 0;
12559
- for (let i = 0; i < validMiddleware.length; i++) {
12560
- var _platform$detectOverf;
12561
+ const middlewareData = {};
12562
+ for (let i = 0; i < middleware.length; i++) {
12563
+ const currentMiddleware = middleware[i];
12564
+ if (!currentMiddleware) {
12565
+ continue;
12566
+ }
12561
12567
  const {
12562
12568
  name,
12563
12569
  fn
12564
- } = validMiddleware[i];
12570
+ } = currentMiddleware;
12565
12571
  const {
12566
12572
  x: nextX,
12567
12573
  y: nextY,
@@ -12575,10 +12581,7 @@ const computePosition$1 = async (reference, floating, config) => {
12575
12581
  strategy,
12576
12582
  middlewareData,
12577
12583
  rects,
12578
- platform: {
12579
- ...platform,
12580
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
12581
- },
12584
+ platform: platformWithDetectOverflow,
12582
12585
  elements: {
12583
12586
  reference,
12584
12587
  floating
@@ -12586,14 +12589,11 @@ const computePosition$1 = async (reference, floating, config) => {
12586
12589
  });
12587
12590
  x = nextX != null ? nextX : x;
12588
12591
  y = nextY != null ? nextY : y;
12589
- middlewareData = {
12590
- ...middlewareData,
12591
- [name]: {
12592
- ...middlewareData[name],
12593
- ...data
12594
- }
12592
+ middlewareData[name] = {
12593
+ ...middlewareData[name],
12594
+ ...data
12595
12595
  };
12596
- if (reset && resetCount <= 50) {
12596
+ if (reset && resetCount < MAX_RESET_COUNT) {
12597
12597
  resetCount++;
12598
12598
  if (typeof reset === 'object') {
12599
12599
  if (reset.placement) {
@@ -13502,7 +13502,6 @@ function isShadowRoot(value) {
13502
13502
  }
13503
13503
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
13504
13504
  }
13505
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
13506
13505
  function isOverflowElement(element) {
13507
13506
  const {
13508
13507
  overflow,
@@ -13510,32 +13509,35 @@ function isOverflowElement(element) {
13510
13509
  overflowY,
13511
13510
  display
13512
13511
  } = getComputedStyle$1(element);
13513
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
13512
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
13514
13513
  }
13515
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
13516
13514
  function isTableElement(element) {
13517
- return tableElements.has(getNodeName(element));
13515
+ return /^(table|td|th)$/.test(getNodeName(element));
13518
13516
  }
13519
- const topLayerSelectors = [':popover-open', ':modal'];
13520
13517
  function isTopLayer(element) {
13521
- return topLayerSelectors.some(selector => {
13522
- try {
13523
- return element.matches(selector);
13524
- } catch (_e) {
13525
- return false;
13518
+ try {
13519
+ if (element.matches(':popover-open')) {
13520
+ return true;
13526
13521
  }
13527
- });
13522
+ } catch (_e) {
13523
+ // no-op
13524
+ }
13525
+ try {
13526
+ return element.matches(':modal');
13527
+ } catch (_e) {
13528
+ return false;
13529
+ }
13528
13530
  }
13529
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
13530
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
13531
- const containValues = ['paint', 'layout', 'strict', 'content'];
13531
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
13532
+ const containRe = /paint|layout|strict|content/;
13533
+ const isNotNone = value => !!value && value !== 'none';
13534
+ let isWebKitValue;
13532
13535
  function isContainingBlock(elementOrCss) {
13533
- const webkit = isWebKit();
13534
13536
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
13535
13537
 
13536
13538
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
13537
13539
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
13538
- 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));
13540
+ 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 || '');
13539
13541
  }
13540
13542
  function getContainingBlock(element) {
13541
13543
  let currentNode = getParentNode(element);
@@ -13550,12 +13552,13 @@ function getContainingBlock(element) {
13550
13552
  return null;
13551
13553
  }
13552
13554
  function isWebKit() {
13553
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
13554
- return CSS.supports('-webkit-backdrop-filter', 'none');
13555
+ if (isWebKitValue == null) {
13556
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
13557
+ }
13558
+ return isWebKitValue;
13555
13559
  }
13556
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
13557
13560
  function isLastTraversableNode(node) {
13558
- return lastTraversableNodeNames.has(getNodeName(node));
13561
+ return /^(html|body|#document)$/.test(getNodeName(node));
13559
13562
  }
13560
13563
  function getComputedStyle$1(element) {
13561
13564
  return getWindow(element).getComputedStyle(element);
@@ -13611,8 +13614,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
13611
13614
  if (isBody) {
13612
13615
  const frameElement = getFrameElement(win);
13613
13616
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
13617
+ } else {
13618
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
13614
13619
  }
13615
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
13616
13620
  }
13617
13621
  function getFrameElement(win) {
13618
13622
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -13789,7 +13793,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
13789
13793
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
13790
13794
  scroll = getNodeScroll(offsetParent);
13791
13795
  }
13792
- if (isHTMLElement(offsetParent)) {
13796
+ if (isOffsetParentAnElement) {
13793
13797
  const offsetRect = getBoundingClientRect(offsetParent);
13794
13798
  scale = getScale(offsetParent);
13795
13799
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -13877,7 +13881,6 @@ function getViewportRect(element, strategy) {
13877
13881
  };
13878
13882
  }
13879
13883
 
13880
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
13881
13884
  // Returns the inner client rect, subtracting scrollbars if present.
13882
13885
  function getInnerBoundingClientRect(element, strategy) {
13883
13886
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -13942,7 +13945,7 @@ function getClippingElementAncestors(element, cache) {
13942
13945
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
13943
13946
  currentContainingBlockComputedStyle = null;
13944
13947
  }
13945
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
13948
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
13946
13949
  if (shouldDropCurrentNode) {
13947
13950
  // Drop non-containing blocks.
13948
13951
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -13967,20 +13970,23 @@ function getClippingRect(_ref) {
13967
13970
  } = _ref;
13968
13971
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
13969
13972
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
13970
- const firstClippingAncestor = clippingAncestors[0];
13971
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
13972
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
13973
- accRect.top = max(rect.top, accRect.top);
13974
- accRect.right = min(rect.right, accRect.right);
13975
- accRect.bottom = min(rect.bottom, accRect.bottom);
13976
- accRect.left = max(rect.left, accRect.left);
13977
- return accRect;
13978
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
13973
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
13974
+ let top = firstRect.top;
13975
+ let right = firstRect.right;
13976
+ let bottom = firstRect.bottom;
13977
+ let left = firstRect.left;
13978
+ for (let i = 1; i < clippingAncestors.length; i++) {
13979
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
13980
+ top = max(rect.top, top);
13981
+ right = min(rect.right, right);
13982
+ bottom = min(rect.bottom, bottom);
13983
+ left = max(rect.left, left);
13984
+ }
13979
13985
  return {
13980
- width: clippingRect.right - clippingRect.left,
13981
- height: clippingRect.bottom - clippingRect.top,
13982
- x: clippingRect.left,
13983
- y: clippingRect.top
13986
+ width: right - left,
13987
+ height: bottom - top,
13988
+ x: left,
13989
+ y: top
13984
13990
  };
13985
13991
  }
13986
13992
 
@@ -14231,7 +14237,7 @@ function autoUpdate(reference, floating, update, options) {
14231
14237
  animationFrame = false
14232
14238
  } = options;
14233
14239
  const referenceEl = unwrapElement(reference);
14234
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
14240
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
14235
14241
  ancestors.forEach(ancestor => {
14236
14242
  ancestorScroll && ancestor.addEventListener('scroll', update, {
14237
14243
  passive: true
@@ -14244,7 +14250,7 @@ function autoUpdate(reference, floating, update, options) {
14244
14250
  if (elementResize) {
14245
14251
  resizeObserver = new ResizeObserver(_ref => {
14246
14252
  let [firstEntry] = _ref;
14247
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
14253
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
14248
14254
  // Prevent update loops when using the `size` middleware.
14249
14255
  // https://github.com/floating-ui/floating-ui/issues/1740
14250
14256
  resizeObserver.unobserve(floating);
@@ -14259,7 +14265,9 @@ function autoUpdate(reference, floating, update, options) {
14259
14265
  if (referenceEl && !animationFrame) {
14260
14266
  resizeObserver.observe(referenceEl);
14261
14267
  }
14262
- resizeObserver.observe(floating);
14268
+ if (floating) {
14269
+ resizeObserver.observe(floating);
14270
+ }
14263
14271
  }
14264
14272
  let frameId;
14265
14273
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/hydrate",
3
- "version": "2.2.22-rc.0",
3
+ "version": "2.2.22",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": {
@@ -46,10 +46,10 @@
46
46
  ],
47
47
  "devDependencies": {
48
48
  "rimraf": "6.1.3",
49
- "@public-ui/components": "2.2.22-rc.0"
49
+ "@public-ui/components": "2.2.22"
50
50
  },
51
51
  "peerDependencies": {
52
- "@public-ui/components": "2.2.22-rc.0"
52
+ "@public-ui/components": "2.2.22"
53
53
  },
54
54
  "sideEffects": false,
55
55
  "type": "commonjs",