ropav 0.14.0 → 0.15.1

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.
Files changed (34) hide show
  1. package/dist/components/alert-dialog/alert-dialog-backdrop.js +3 -1
  2. package/dist/components/drawer/drawer-backdrop.js +3 -1
  3. package/dist/components/index.d.ts +1 -0
  4. package/dist/components/meter/meter-root.js +1 -1
  5. package/dist/components/modal/modal-backdrop.js +3 -1
  6. package/dist/components/overlay/overlay-popover.js +14 -5
  7. package/dist/components/portal-provider/index.d.ts +3 -0
  8. package/dist/components/portal-provider/index.js +2 -0
  9. package/dist/components/portal-provider/portal-provider.d.ts +21 -0
  10. package/dist/components/portal-provider/portal-provider.js +20 -0
  11. package/dist/components/portal-provider/portal-provider.types.d.ts +22 -0
  12. package/dist/components/toast/toast-provider.js +3 -1
  13. package/dist/components/tooltip/tooltip-content.js +4 -1
  14. package/dist/composables/focus-scope-registry.d.ts +9 -1
  15. package/dist/composables/focus-scope-registry.js +9 -2
  16. package/dist/composables/index.d.ts +1 -0
  17. package/dist/composables/use-combo-box.js +6 -3
  18. package/dist/composables/use-dismissable.d.ts +6 -0
  19. package/dist/composables/use-dismissable.js +8 -10
  20. package/dist/composables/use-focus-scope.d.ts +6 -0
  21. package/dist/composables/use-focus-scope.js +10 -2
  22. package/dist/composables/use-modal-overlay.js +14 -2
  23. package/dist/composables/use-portal.d.ts +35 -0
  24. package/dist/composables/use-portal.js +47 -0
  25. package/dist/index.js +3 -1
  26. package/dist/ropav.min.css +1 -1
  27. package/dist/utils/aria-hide-outside.d.ts +4 -1
  28. package/dist/utils/aria-hide-outside.js +17 -5
  29. package/dist/utils/position.d.ts +1 -1
  30. package/dist/utils/position.js +66 -52
  31. package/dist/utils/region.d.ts +10 -0
  32. package/dist/utils/region.js +13 -0
  33. package/dist/version.js +1 -1
  34. package/package.json +6 -2
@@ -1,5 +1,8 @@
1
1
  export interface AriaHideOutsideOptions {
2
- /** Nothing above this element is hidden. @default document.body */
2
+ /**
3
+ * Nothing outside this element is hidden, and only this element is watched for content added
4
+ * later. @default document.body
5
+ */
3
6
  root?: Element;
4
7
  /**
5
8
  * Uses `inert` instead of `aria-hidden`, which also blocks pointer interaction and focus
@@ -1,3 +1,4 @@
1
+ import { regionsOverlap } from "./region.js";
1
2
  import { TOP_LAYER_SELECTOR } from "./top-layer.js";
2
3
  //#region src/utils/aria-hide-outside.ts
3
4
  var supportsInert = typeof HTMLElement !== "undefined" && "inert" in HTMLElement.prototype;
@@ -9,8 +10,19 @@ var supportsInert = typeof HTMLElement !== "undefined" && "inert" in HTMLElement
9
10
  * itself keeps a count of zero, so it is never un-hidden by this.
10
11
  */
11
12
  var refCounts = /* @__PURE__ */ new WeakMap();
12
- /** Active layers, innermost last. Only the innermost watches the DOM for new content. */
13
+ /**
14
+ * Active layers, innermost last. Only the innermost of the layers whose roots overlap watches the
15
+ * DOM for new content: two modals open in two apps' windows side by side each keep watching their
16
+ * own, while two nested in one place hand watching to the inner one.
17
+ */
13
18
  var layers = [];
19
+ /** Whether a later layer covers this one's root, so this one leaves the watching to it. */
20
+ var isShadowed = (layer) => layers.slice(layers.indexOf(layer) + 1).some((later) => regionsOverlap(later.root, layer.root));
21
+ /** Watch with exactly the layers nothing later covers. */
22
+ var syncObservers = () => {
23
+ for (const layer of layers) if (isShadowed(layer)) layer.disconnect();
24
+ else layer.observe();
25
+ };
14
26
  /** Content that must never be hidden, however deep in the page it sits. */
15
27
  var ALWAYS_VISIBLE_SELECTOR = `[data-live-announcer], ${TOP_LAYER_SELECTOR}`;
16
28
  var isAlwaysVisible = (node) => node instanceof HTMLElement && node.matches(ALWAYS_VISIBLE_SELECTOR);
@@ -67,7 +79,6 @@ var ariaHideOutside = (targets, options = {}) => {
67
79
  node = walker.nextNode();
68
80
  }
69
81
  };
70
- layers.at(-1)?.disconnect();
71
82
  walk(root);
72
83
  const observer = new MutationObserver((changes) => {
73
84
  for (const change of changes) {
@@ -88,10 +99,11 @@ var ariaHideOutside = (targets, options = {}) => {
88
99
  childList: true,
89
100
  subtree: true
90
101
  }),
102
+ root,
91
103
  visibleNodes
92
104
  };
93
- layer.observe();
94
105
  layers.push(layer);
106
+ syncObservers();
95
107
  return () => {
96
108
  observer.disconnect();
97
109
  for (const node of hiddenNodes) {
@@ -104,7 +116,7 @@ var ariaHideOutside = (targets, options = {}) => {
104
116
  }
105
117
  const index = layers.indexOf(layer);
106
118
  if (index >= 0) layers.splice(index, 1);
107
- layers.at(-1)?.observe();
119
+ syncObservers();
108
120
  };
109
121
  };
110
122
  /**
@@ -116,7 +128,7 @@ var ariaHideOutside = (targets, options = {}) => {
116
128
  * @returns A function withdrawing the exemption, or `undefined` if nothing is hiding anything.
117
129
  */
118
130
  var keepVisible = (element) => {
119
- const layer = layers.at(-1);
131
+ const layer = layers.findLast((candidate) => candidate.root.contains(element)) ?? layers.at(-1);
120
132
  if (!layer || layer.visibleNodes.has(element)) return void 0;
121
133
  layer.visibleNodes.add(element);
122
134
  return () => {
@@ -74,7 +74,7 @@ export interface PositionResult {
74
74
  /** The element's rectangle, ignoring any scale transform when asked. */
75
75
  export declare const getRect: (node: Element, ignoreScale: boolean) => Offset;
76
76
  /** @private Exported for tests, which drive the arithmetic without a real layout. */
77
- export declare const calculatePositionInternal: (placementInput: Placement, childOffset: Offset, overlaySize: Offset, margins: Position, padding: number, flip: boolean, boundaryDimensions: Dimensions, containerDimensions: Dimensions, containerOffsetWithBoundary: Offset, offset: number, crossOffset: number, isContainerPositioned: boolean, userSetMaxHeight: number | undefined, arrowSize: number, arrowBoundaryOffset: number, isContainerDescendentOfBoundary: boolean, visualViewport: VisualViewport | null) => PositionResult;
77
+ export declare const calculatePositionInternal: (placementInput: Placement, childOffset: Offset, overlaySize: Offset, margins: Position, padding: number, flip: boolean, boundary: Offset, containerDimensions: Dimensions, viewport: Offset | null, offset: number, crossOffset: number, isContainerPositioned: boolean, userSetMaxHeight: number | undefined, arrowSize: number, arrowBoundaryOffset: number) => PositionResult;
78
78
  /**
79
79
  * Where to put an overlay so it sits next to its trigger and stays inside the boundary.
80
80
  *
@@ -25,8 +25,15 @@ var TOTAL_SIZE = {
25
25
  };
26
26
  var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
27
27
  var getVisualViewport = () => typeof document === "undefined" ? null : window.visualViewport;
28
- /** Whether one node is the other, or contains it. */
29
- var nodeContains = (node, other) => Boolean(node && other && node.contains(other));
28
+ /** Whether a boundary element stands for the viewport, as the body and the document element do. */
29
+ var isViewportElement = (node) => node.tagName === "BODY" || node.tagName === "HTML";
30
+ /**
31
+ * Whether the container is the viewport. Only the document element ever is: the body is the
32
+ * container only once it is positioned or a containing block, and then an overlay is placed from
33
+ * the body's own padding box, which a body taller than the viewport, or set apart from it by its
34
+ * margin, does not share with the viewport.
35
+ */
36
+ var isViewportContainer = (node) => node === document.documentElement;
30
37
  var isWebKit = () => typeof navigator !== "undefined" && /AppleWebKit/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
31
38
  /** The element's rectangle, ignoring any scale transform when asked. */
32
39
  var getRect = (node, ignoreScale) => {
@@ -76,7 +83,7 @@ var getPosition = (node, parent, ignoreScale, overrideRect) => {
76
83
  */
77
84
  var isContainingBlock = (node) => {
78
85
  const style = window.getComputedStyle(node);
79
- return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || "backdropFilter" in style && style.backdropFilter !== "none";
86
+ return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || /\b(layout|paint|strict|content)\b/.test(style.contain) || "backdropFilter" in style && style.backdropFilter !== "none";
80
87
  };
81
88
  /** The element an absolutely positioned overlay is placed relative to. */
82
89
  var getContainingBlock = (node) => {
@@ -98,26 +105,28 @@ var getContainerDimensions = (containerNode, visualViewport) => {
98
105
  let left = 0;
99
106
  const scroll = {};
100
107
  const isPinchZoomedIn = (visualViewport?.scale ?? 1) > 1;
101
- if (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") {
108
+ if (isViewportContainer(containerNode)) {
102
109
  const documentElement = document.documentElement;
103
110
  totalWidth = documentElement.clientWidth;
104
111
  totalHeight = documentElement.clientHeight;
105
112
  width = visualViewport?.width ?? totalWidth;
106
113
  height = visualViewport?.height ?? totalHeight;
107
- scroll.top = documentElement.scrollTop || containerNode.scrollTop;
108
- scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
114
+ scroll.top = documentElement.scrollTop;
115
+ scroll.left = documentElement.scrollLeft;
109
116
  if (visualViewport) {
110
117
  top = visualViewport.offsetTop;
111
118
  left = visualViewport.offsetLeft;
112
119
  }
113
120
  } else {
114
- ({height, left, top, width} = getOffset(containerNode, false));
121
+ ({left, top} = getOffset(containerNode, false));
122
+ width = containerNode.clientWidth;
123
+ height = containerNode.clientHeight;
115
124
  scroll.top = containerNode.scrollTop;
116
125
  scroll.left = containerNode.scrollLeft;
117
126
  totalWidth = width;
118
127
  totalHeight = height;
119
128
  }
120
- if (isWebKit() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
129
+ if (isWebKit() && isViewportContainer(containerNode) && isPinchZoomedIn) {
121
130
  scroll.top = 0;
122
131
  scroll.left = 0;
123
132
  top = visualViewport?.pageTop ?? 0;
@@ -134,13 +143,11 @@ var getContainerDimensions = (containerNode, visualViewport) => {
134
143
  };
135
144
  };
136
145
  /** How far the overlay must shift along `axis` to stay inside the boundary. */
137
- var getDelta = (axis, offset, size, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) => {
138
- const containerScroll = containerDimensions.scroll[axis] ?? 0;
139
- const boundarySize = boundaryDimensions[AXIS_SIZE[axis]];
140
- const boundaryScroll = boundaryDimensions.scroll[AXIS[axis]] ?? 0;
141
- const boundaryStartEdge = containerOffsetWithBoundary[axis] + boundaryScroll + padding;
142
- const boundaryEndEdge = containerOffsetWithBoundary[axis] + boundaryScroll + boundarySize - padding;
143
- const startEdgeOffset = offset - containerScroll + boundaryScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[AXIS[axis]];
146
+ var getDelta = (axis, offset, size, boundary, containerDimensions, padding) => {
147
+ const boundaryStart = boundary[axis] + (containerDimensions.scroll[axis] ?? 0);
148
+ const boundaryStartEdge = boundaryStart + padding;
149
+ const boundaryEndEdge = boundaryStart + boundary[AXIS_SIZE[axis]] - padding;
150
+ const startEdgeOffset = offset;
144
151
  const endEdgeOffset = startEdgeOffset + size;
145
152
  if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
146
153
  if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
@@ -189,36 +196,35 @@ var computePosition = (childOffset, overlaySize, placementInfo, offset, crossOff
189
196
  } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
190
197
  return position;
191
198
  };
192
- var getMaxHeight = (position, boundaryDimensions, containerOffsetWithBoundary, margins, padding, overlayHeight, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport) => {
199
+ var getMaxHeight = (position, boundary, viewport, margins, padding, overlayHeight, heightGrowthDirection, containerDimensions) => {
193
200
  const overlayTop = (position.top != null ? position.top : containerDimensions[TOTAL_SIZE.height] - (position.bottom ?? 0) - overlayHeight) - (containerDimensions.scroll.top ?? 0);
194
- const boundaryToContainerTransformOffset = isContainerDescendentOfBoundary ? containerOffsetWithBoundary.top : 0;
195
- const viewportTop = visualViewport?.offsetTop ?? boundaryDimensions.top;
196
- const viewportBottom = visualViewport ? visualViewport.offsetTop + visualViewport.height : boundaryDimensions.top + boundaryDimensions.height;
201
+ const visible = viewport ?? boundary;
197
202
  const boundingRect = {
198
- bottom: Math.min(boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset, viewportBottom),
199
- top: Math.max(boundaryDimensions.top + boundaryToContainerTransformOffset, viewportTop + boundaryToContainerTransformOffset)
203
+ bottom: Math.min(boundary.top + boundary.height, visible.top + visible.height),
204
+ top: Math.max(boundary.top, visible.top)
200
205
  };
201
206
  const reserved = (margins.top ?? 0) + (margins.bottom ?? 0) + padding;
202
207
  return heightGrowthDirection !== "top" ? Math.max(0, boundingRect.bottom - overlayTop - reserved) : Math.max(0, overlayTop + overlayHeight - boundingRect.top - reserved);
203
208
  };
204
209
  /** How much room there is on the side the overlay wants to be on. */
205
- var getAvailableSpace = (boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo, containerDimensions, isContainerDescendentOfBoundary) => {
210
+ var getAvailableSpace = (boundary, childOffset, margins, padding, placementInfo, containerDimensions) => {
206
211
  const { axis, placement, size } = placementInfo;
207
- const containerOffset = isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0;
208
- if (placement === axis) return Math.max(0, childOffset[axis] - (containerDimensions.scroll[axis] ?? 0) - (boundaryDimensions[axis] + containerOffset) - (margins[axis] ?? 0) - (margins[FLIPPED_DIRECTION[axis]] ?? 0) - padding);
209
- return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + containerOffset - childOffset[axis] - childOffset[size] + (containerDimensions.scroll[axis] ?? 0) - (margins[axis] ?? 0) - (margins[FLIPPED_DIRECTION[axis]] ?? 0) - padding);
212
+ const boundaryStart = boundary[axis] + (containerDimensions.scroll[axis] ?? 0);
213
+ const reserved = (margins[axis] ?? 0) + (margins[FLIPPED_DIRECTION[axis]] ?? 0) + padding;
214
+ if (placement === axis) return Math.max(0, childOffset[axis] - boundaryStart - reserved);
215
+ return Math.max(0, boundaryStart + boundary[size] - childOffset[axis] - childOffset[size] - reserved);
210
216
  };
211
217
  /** @private Exported for tests, which drive the arithmetic without a real layout. */
212
- var calculatePositionInternal = (placementInput, childOffset, overlaySize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport) => {
218
+ var calculatePositionInternal = (placementInput, childOffset, overlaySize, margins, padding, flip, boundary, containerDimensions, viewport, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) => {
213
219
  let placementInfo = parsePlacement(placementInput);
214
220
  const { crossAxis, crossSize, size } = placementInfo;
215
221
  let { crossPlacement, placement } = placementInfo;
216
222
  let position = computePosition(childOffset, overlaySize, placementInfo, offset, crossOffset, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
217
- const space = getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo, containerDimensions, isContainerDescendentOfBoundary);
223
+ const space = getAvailableSpace(boundary, childOffset, margins, padding + offset, placementInfo, containerDimensions);
218
224
  if (flip && overlaySize[size] > space) {
219
225
  const flippedPlacementInfo = parsePlacement(`${FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
220
226
  const flippedPosition = computePosition(childOffset, overlaySize, flippedPlacementInfo, offset, crossOffset, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
221
- if (getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo, containerDimensions, isContainerDescendentOfBoundary) > space) {
227
+ if (getAvailableSpace(boundary, childOffset, margins, padding + offset, flippedPlacementInfo, containerDimensions) > space) {
222
228
  placementInfo = flippedPlacementInfo;
223
229
  position = flippedPosition;
224
230
  }
@@ -229,12 +235,12 @@ var calculatePositionInternal = (placementInput, childOffset, overlaySize, margi
229
235
  } else if (placementInfo.crossAxis === "top") {
230
236
  if (placementInfo.crossPlacement === "bottom") heightGrowthDirection = "top";
231
237
  }
232
- position[crossAxis] += getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
233
- let maxHeight = getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, margins, padding, overlaySize.height, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport);
238
+ position[crossAxis] += getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundary, containerDimensions, padding);
239
+ let maxHeight = getMaxHeight(position, boundary, viewport, margins, padding, overlaySize.height, heightGrowthDirection, containerDimensions);
234
240
  if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
235
241
  overlaySize.height = Math.min(overlaySize.height, maxHeight);
236
242
  position = computePosition(childOffset, overlaySize, placementInfo, offset, crossOffset, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
237
- position[crossAxis] += getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
243
+ position[crossAxis] += getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundary, containerDimensions, padding);
238
244
  const arrowPosition = {};
239
245
  let origin = childOffset[crossAxis] - position[crossAxis] - (margins[AXIS[crossAxis]] ?? 0);
240
246
  const preferredArrowPosition = origin + .5 * childOffset[crossSize];
@@ -268,11 +274,11 @@ var calculatePosition = (options) => {
268
274
  const { arrowBoundaryOffset = 0, arrowSize = 0, boundaryElement, crossOffset, maxHeight, offset, overlayNode, padding, placement, shouldFlip, targetNode, targetRect } = options;
269
275
  const visualViewport = getVisualViewport();
270
276
  const container = overlayNode instanceof HTMLElement ? getContainingBlock(overlayNode) : document.documentElement;
271
- const isViewportContainer = container === document.documentElement;
277
+ const isContainerViewport = isViewportContainer(container);
272
278
  const containerPositionStyle = window.getComputedStyle(container).position;
273
279
  const isContainerPositioned = Boolean(containerPositionStyle) && containerPositionStyle !== "static";
274
- const childOffset = isViewportContainer ? getOffset(targetNode, false, targetRect) : getPosition(targetNode, container, false, targetRect);
275
- if (!isViewportContainer) {
280
+ const childOffset = isContainerViewport ? getOffset(targetNode, false, targetRect) : getPosition(targetNode, container, false, targetRect);
281
+ if (!isContainerViewport) {
276
282
  const { marginLeft, marginTop } = window.getComputedStyle(targetNode);
277
283
  childOffset.top += parseInt(marginTop, 10) || 0;
278
284
  childOffset.left += parseInt(marginLeft, 10) || 0;
@@ -281,26 +287,34 @@ var calculatePosition = (options) => {
281
287
  const margins = getMargins(overlayNode);
282
288
  overlaySize.width += (margins.left ?? 0) + (margins.right ?? 0);
283
289
  overlaySize.height += (margins.top ?? 0) + (margins.bottom ?? 0);
284
- const boundaryDimensions = getContainerDimensions(boundaryElement, visualViewport);
285
290
  const containerDimensions = getContainerDimensions(container, visualViewport);
286
- let containerOffsetWithBoundary;
287
- const isBoundaryViewport = boundaryElement.tagName === "BODY" || boundaryElement.tagName === "HTML";
288
- if (isBoundaryViewport && !isViewportContainer) {
289
- const containerRect = getRect(container, false);
290
- containerOffsetWithBoundary = {
291
- height: 0,
292
- left: -(containerRect.left - boundaryDimensions.left),
293
- top: -(containerRect.top - boundaryDimensions.top),
294
- width: 0
295
- };
296
- } else if (isBoundaryViewport && isViewportContainer) containerOffsetWithBoundary = {
297
- height: 0,
298
- left: 0,
299
- top: 0,
300
- width: 0
291
+ const { clientHeight, clientWidth } = document.documentElement;
292
+ const viewportRect = {
293
+ height: visualViewport?.height ?? clientHeight,
294
+ left: visualViewport?.offsetLeft ?? 0,
295
+ top: visualViewport?.offsetTop ?? 0,
296
+ width: visualViewport?.width ?? clientWidth
301
297
  };
302
- else containerOffsetWithBoundary = getPosition(boundaryElement, container, false);
303
- return calculatePositionInternal(placement, childOffset, overlaySize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset, nodeContains(boundaryElement, container), visualViewport);
298
+ let origin;
299
+ if (isContainerViewport) origin = {
300
+ left: viewportRect.left - containerDimensions.left,
301
+ top: viewportRect.top - containerDimensions.top
302
+ };
303
+ else {
304
+ const containerRect = container.getBoundingClientRect();
305
+ origin = {
306
+ left: containerRect.left + container.clientLeft,
307
+ top: containerRect.top + container.clientTop
308
+ };
309
+ }
310
+ const toContainer = ({ height, left, top, width }) => ({
311
+ height,
312
+ left: left - origin.left,
313
+ top: top - origin.top,
314
+ width
315
+ });
316
+ const viewport = toContainer(viewportRect);
317
+ return calculatePositionInternal(placement, childOffset, overlaySize, margins, padding, shouldFlip, isViewportElement(boundaryElement) ? viewport : toContainer(getRect(boundaryElement, false)), containerDimensions, visualViewport ? viewport : null, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
304
318
  };
305
319
  /** Resolves the logical `start`/`end` in a placement against the writing direction. */
306
320
  var translateRTL = (placement, direction) => direction === "rtl" ? placement.replace("start", "right").replace("end", "left") : placement.replace("start", "left").replace("end", "right");
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether two parts of the page can see each other's overlays.
3
+ *
4
+ * An overlay belongs to a region: the root its `PortalProvider` names, or the whole document
5
+ * (`null`) without one. The page-wide stacks — which overlay is innermost, which one watches the
6
+ * DOM, which one holds focus — are only shared between overlays whose regions overlap. Two apps'
7
+ * windows side by side are separate regions, so a modal in one is not stacked over a modal in the
8
+ * other; the whole document overlaps everything, so without a provider nothing changes.
9
+ */
10
+ export declare const regionsOverlap: (a: Element | null, b: Element | null) => boolean;
@@ -0,0 +1,13 @@
1
+ //#region src/utils/region.ts
2
+ /**
3
+ * Whether two parts of the page can see each other's overlays.
4
+ *
5
+ * An overlay belongs to a region: the root its `PortalProvider` names, or the whole document
6
+ * (`null`) without one. The page-wide stacks — which overlay is innermost, which one watches the
7
+ * DOM, which one holds focus — are only shared between overlays whose regions overlap. Two apps'
8
+ * windows side by side are separate regions, so a modal in one is not stacked over a modal in the
9
+ * other; the whole document overlaps everything, so without a provider nothing changes.
10
+ */
11
+ var regionsOverlap = (a, b) => a == null || b == null || a.contains(b) || b.contains(a);
12
+ //#endregion
13
+ export { regionsOverlap };
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/version.ts
2
- var ROPAV_VERSION = "0.14.0";
2
+ var ROPAV_VERSION = "0.15.1";
3
3
  //#endregion
4
4
  export { ROPAV_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ropav",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "Vapor-native Vue 3 component library — accessible by default, styled with framework-agnostic CSS.",
5
5
  "keywords": [
6
6
  "components",
@@ -277,6 +277,10 @@
277
277
  "import": "./dist/components/popover/index.js",
278
278
  "types": "./dist/components/popover/index.d.ts"
279
279
  },
280
+ "./portal-provider": {
281
+ "import": "./dist/components/portal-provider/index.js",
282
+ "types": "./dist/components/portal-provider/index.d.ts"
283
+ },
280
284
  "./progress-bar": {
281
285
  "import": "./dist/components/progress-bar/index.js",
282
286
  "types": "./dist/components/progress-bar/index.d.ts"
@@ -417,7 +421,7 @@
417
421
  "@internationalized/date": "3.12.4",
418
422
  "@internationalized/number": "3.6.8",
419
423
  "@internationalized/string": "3.2.10",
420
- "@ropav/styles": "0.14.0"
424
+ "@ropav/styles": "0.15.1"
421
425
  },
422
426
  "peerDependencies": {
423
427
  "vue": "^3.6.0-rc.8"