@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,503 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { e as rectToClientRect } from './floating-ui.js';
|
7
|
+
|
8
|
+
/*!
|
9
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
10
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
11
|
+
* v1.0.0-beta.97
|
12
|
+
*/
|
13
|
+
/**
|
14
|
+
* This module provides utils to fix positioning across shadow DOM in non-Chromium browsers
|
15
|
+
*
|
16
|
+
* It is based on floating-ui's distributable
|
17
|
+
*/
|
18
|
+
/**
|
19
|
+
* 👇 the following are needed to fix shadow DOM positioning 👇️
|
20
|
+
*
|
21
|
+
* @param element
|
22
|
+
*/
|
23
|
+
function getTrueOffsetParent(element) {
|
24
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
25
|
+
return null;
|
26
|
+
}
|
27
|
+
return composedOffsetParent(element);
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Polyfills the old offsetParent behavior from before the spec was changed:
|
31
|
+
* https://github.com/w3c/csswg-drafts/issues/159
|
32
|
+
*
|
33
|
+
* @param element
|
34
|
+
*/
|
35
|
+
function composedOffsetParent(element) {
|
36
|
+
let { offsetParent } = element;
|
37
|
+
let ancestor = element;
|
38
|
+
let foundInsideSlot = false;
|
39
|
+
while (ancestor && ancestor !== offsetParent) {
|
40
|
+
const { assignedSlot } = ancestor;
|
41
|
+
if (assignedSlot) {
|
42
|
+
let newOffsetParent = assignedSlot.offsetParent;
|
43
|
+
if (getComputedStyle(assignedSlot).display === "contents") {
|
44
|
+
const hadStyleAttribute = assignedSlot.hasAttribute("style");
|
45
|
+
const oldDisplay = assignedSlot.style.display;
|
46
|
+
assignedSlot.style.display = getComputedStyle(ancestor).display;
|
47
|
+
newOffsetParent = assignedSlot.offsetParent;
|
48
|
+
assignedSlot.style.display = oldDisplay;
|
49
|
+
if (!hadStyleAttribute) {
|
50
|
+
assignedSlot.removeAttribute("style");
|
51
|
+
}
|
52
|
+
}
|
53
|
+
ancestor = assignedSlot;
|
54
|
+
if (offsetParent !== newOffsetParent) {
|
55
|
+
offsetParent = newOffsetParent;
|
56
|
+
foundInsideSlot = true;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
ancestor = (isShadowRoot(ancestor) && ancestor.host) || ancestor.parentNode;
|
63
|
+
}
|
64
|
+
return offsetParent;
|
65
|
+
}
|
66
|
+
function getElementRects(_ref) {
|
67
|
+
const { reference, floating, strategy } = _ref;
|
68
|
+
return {
|
69
|
+
reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
|
70
|
+
floating: { ...getDimensions(floating), x: 0, y: 0 }
|
71
|
+
};
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* ☝️ the following are needed to fix shadow DOM positioning ☝️
|
75
|
+
*/
|
76
|
+
/**
|
77
|
+
* 👇 the following are taken directly from floating-ui's ESM distributable to support the exports above 👇️
|
78
|
+
*
|
79
|
+
* **Notes**:
|
80
|
+
* unused functions are removed
|
81
|
+
* ESLint is disabled
|
82
|
+
* TS-warnings are suppressed
|
83
|
+
*/
|
84
|
+
/* eslint-disable */
|
85
|
+
function isWindow(value) {
|
86
|
+
return value && value.document && value.location && value.alert && value.setInterval;
|
87
|
+
}
|
88
|
+
function getWindow(node) {
|
89
|
+
if (node == null) {
|
90
|
+
return window;
|
91
|
+
}
|
92
|
+
if (!isWindow(node)) {
|
93
|
+
const ownerDocument = node.ownerDocument;
|
94
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
95
|
+
}
|
96
|
+
return node;
|
97
|
+
}
|
98
|
+
function getComputedStyle(element) {
|
99
|
+
return getWindow(element).getComputedStyle(element);
|
100
|
+
}
|
101
|
+
function getNodeName(node) {
|
102
|
+
return isWindow(node) ? "" : node ? (node.nodeName || "").toLowerCase() : "";
|
103
|
+
}
|
104
|
+
function getUAString() {
|
105
|
+
// @ts-ignore
|
106
|
+
const uaData = navigator.userAgentData;
|
107
|
+
if (uaData != null && uaData.brands) {
|
108
|
+
return uaData.brands.map((item) => item.brand + "/" + item.version).join(" ");
|
109
|
+
}
|
110
|
+
return navigator.userAgent;
|
111
|
+
}
|
112
|
+
function isHTMLElement(value) {
|
113
|
+
return value instanceof getWindow(value).HTMLElement;
|
114
|
+
}
|
115
|
+
function isElement(value) {
|
116
|
+
return value instanceof getWindow(value).Element;
|
117
|
+
}
|
118
|
+
function isNode(value) {
|
119
|
+
return value instanceof getWindow(value).Node;
|
120
|
+
}
|
121
|
+
function isShadowRoot(node) {
|
122
|
+
// Browsers without `ShadowRoot` support
|
123
|
+
if (typeof ShadowRoot === "undefined") {
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
const OwnElement = getWindow(node).ShadowRoot;
|
127
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
128
|
+
}
|
129
|
+
function isOverflowElement(element) {
|
130
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
131
|
+
const { overflow, overflowX, overflowY, display } = getComputedStyle(element);
|
132
|
+
return (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display));
|
133
|
+
}
|
134
|
+
function isTableElement(element) {
|
135
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
136
|
+
}
|
137
|
+
function isContainingBlock(element) {
|
138
|
+
// TODO: Try and use feature detection here instead
|
139
|
+
const isFirefox = /firefox/i.test(getUAString());
|
140
|
+
const css = getComputedStyle(element); // This is non-exhaustive but covers the most common CSS properties that
|
141
|
+
// create a containing block.
|
142
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
143
|
+
return (css.transform !== "none" ||
|
144
|
+
css.perspective !== "none" ||
|
145
|
+
(isFirefox && css.willChange === "filter") ||
|
146
|
+
(isFirefox && (css.filter ? css.filter !== "none" : false)) ||
|
147
|
+
["transform", "perspective"].some((value) => css.willChange.includes(value)) ||
|
148
|
+
["paint", "layout", "strict", "content"].some(
|
149
|
+
// TS 4.1 compat
|
150
|
+
(value) => {
|
151
|
+
const contain = css.contain;
|
152
|
+
return contain != null ? contain.includes(value) : false;
|
153
|
+
}));
|
154
|
+
}
|
155
|
+
function isLayoutViewport() {
|
156
|
+
// Not Safari
|
157
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
|
158
|
+
// • Always-visible scrollbar or not
|
159
|
+
// • Width of <html>, etc.
|
160
|
+
// const vV = win.visualViewport;
|
161
|
+
// return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
|
162
|
+
}
|
163
|
+
function isLastTraversableNode(node) {
|
164
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
165
|
+
}
|
166
|
+
const min = Math.min;
|
167
|
+
const max = Math.max;
|
168
|
+
const round = Math.round;
|
169
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
170
|
+
var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
|
171
|
+
if (includeScale === void 0) {
|
172
|
+
includeScale = false;
|
173
|
+
}
|
174
|
+
if (isFixedStrategy === void 0) {
|
175
|
+
isFixedStrategy = false;
|
176
|
+
}
|
177
|
+
const clientRect = element.getBoundingClientRect();
|
178
|
+
let scaleX = 1;
|
179
|
+
let scaleY = 1;
|
180
|
+
if (includeScale && isHTMLElement(element)) {
|
181
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
182
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
183
|
+
}
|
184
|
+
const win = isElement(element) ? getWindow(element) : window;
|
185
|
+
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
186
|
+
const x = (clientRect.left +
|
187
|
+
(addVisualOffsets
|
188
|
+
? (_win$visualViewport$o =
|
189
|
+
(_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null
|
190
|
+
? _win$visualViewport$o
|
191
|
+
: 0
|
192
|
+
: 0)) /
|
193
|
+
scaleX;
|
194
|
+
const y = (clientRect.top +
|
195
|
+
(addVisualOffsets
|
196
|
+
? (_win$visualViewport$o2 =
|
197
|
+
(_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null
|
198
|
+
? _win$visualViewport$o2
|
199
|
+
: 0
|
200
|
+
: 0)) /
|
201
|
+
scaleY;
|
202
|
+
const width = clientRect.width / scaleX;
|
203
|
+
const height = clientRect.height / scaleY;
|
204
|
+
return {
|
205
|
+
width,
|
206
|
+
height,
|
207
|
+
top: y,
|
208
|
+
right: x + width,
|
209
|
+
bottom: y + height,
|
210
|
+
left: x,
|
211
|
+
x,
|
212
|
+
y
|
213
|
+
};
|
214
|
+
}
|
215
|
+
function getDocumentElement(node) {
|
216
|
+
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
217
|
+
}
|
218
|
+
function getNodeScroll(element) {
|
219
|
+
if (isElement(element)) {
|
220
|
+
return {
|
221
|
+
scrollLeft: element.scrollLeft,
|
222
|
+
scrollTop: element.scrollTop
|
223
|
+
};
|
224
|
+
}
|
225
|
+
return {
|
226
|
+
scrollLeft: element.pageXOffset,
|
227
|
+
scrollTop: element.pageYOffset
|
228
|
+
};
|
229
|
+
}
|
230
|
+
function getWindowScrollBarX(element) {
|
231
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
232
|
+
// incorrect for RTL.
|
233
|
+
// @ts-ignore
|
234
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
235
|
+
}
|
236
|
+
function isScaled(element) {
|
237
|
+
// @ts-ignore
|
238
|
+
const rect = getBoundingClientRect(element);
|
239
|
+
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
|
240
|
+
}
|
241
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
242
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
243
|
+
const documentElement = getDocumentElement(offsetParent);
|
244
|
+
const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
|
245
|
+
isOffsetParentAnElement && isScaled(offsetParent), strategy === "fixed");
|
246
|
+
let scroll = {
|
247
|
+
scrollLeft: 0,
|
248
|
+
scrollTop: 0
|
249
|
+
};
|
250
|
+
const offsets = {
|
251
|
+
x: 0,
|
252
|
+
y: 0
|
253
|
+
};
|
254
|
+
if (isOffsetParentAnElement || (!isOffsetParentAnElement && strategy !== "fixed")) {
|
255
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
256
|
+
scroll = getNodeScroll(offsetParent);
|
257
|
+
}
|
258
|
+
if (isHTMLElement(offsetParent)) {
|
259
|
+
// @ts-ignore
|
260
|
+
const offsetRect = getBoundingClientRect(offsetParent, true);
|
261
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
262
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
263
|
+
}
|
264
|
+
else if (documentElement) {
|
265
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
266
|
+
}
|
267
|
+
}
|
268
|
+
return {
|
269
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
270
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
271
|
+
width: rect.width,
|
272
|
+
height: rect.height
|
273
|
+
};
|
274
|
+
}
|
275
|
+
function getParentNode(node) {
|
276
|
+
if (getNodeName(node) === "html") {
|
277
|
+
return node;
|
278
|
+
}
|
279
|
+
return (
|
280
|
+
// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
281
|
+
// @ts-ignore
|
282
|
+
node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
283
|
+
node.parentNode || // DOM Element detected
|
284
|
+
(isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
|
285
|
+
getDocumentElement(node) // fallback
|
286
|
+
);
|
287
|
+
}
|
288
|
+
function getContainingBlock(element) {
|
289
|
+
let currentNode = getParentNode(element);
|
290
|
+
if (isShadowRoot(currentNode)) {
|
291
|
+
currentNode = currentNode.host;
|
292
|
+
}
|
293
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
294
|
+
if (isContainingBlock(currentNode)) {
|
295
|
+
return currentNode;
|
296
|
+
}
|
297
|
+
else {
|
298
|
+
const parent = currentNode.parentNode;
|
299
|
+
currentNode = isShadowRoot(parent) ? parent.host : parent;
|
300
|
+
}
|
301
|
+
}
|
302
|
+
return null;
|
303
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
304
|
+
// such as table ancestors and cross browser bugs.
|
305
|
+
function getOffsetParent(element) {
|
306
|
+
const window = getWindow(element);
|
307
|
+
let offsetParent = getTrueOffsetParent(element);
|
308
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
|
309
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
310
|
+
}
|
311
|
+
if (offsetParent &&
|
312
|
+
(getNodeName(offsetParent) === "html" ||
|
313
|
+
(getNodeName(offsetParent) === "body" &&
|
314
|
+
getComputedStyle(offsetParent).position === "static" &&
|
315
|
+
!isContainingBlock(offsetParent)))) {
|
316
|
+
return window;
|
317
|
+
}
|
318
|
+
return offsetParent || getContainingBlock(element) || window;
|
319
|
+
}
|
320
|
+
function getDimensions(element) {
|
321
|
+
if (isHTMLElement(element)) {
|
322
|
+
return {
|
323
|
+
width: element.offsetWidth,
|
324
|
+
height: element.offsetHeight
|
325
|
+
};
|
326
|
+
}
|
327
|
+
// @ts-ignore
|
328
|
+
const rect = getBoundingClientRect(element);
|
329
|
+
return {
|
330
|
+
width: rect.width,
|
331
|
+
height: rect.height
|
332
|
+
};
|
333
|
+
}
|
334
|
+
function getViewportRect(element, strategy) {
|
335
|
+
const win = getWindow(element);
|
336
|
+
const html = getDocumentElement(element);
|
337
|
+
const visualViewport = win.visualViewport;
|
338
|
+
let width = html.clientWidth;
|
339
|
+
let height = html.clientHeight;
|
340
|
+
let x = 0;
|
341
|
+
let y = 0;
|
342
|
+
if (visualViewport) {
|
343
|
+
width = visualViewport.width;
|
344
|
+
height = visualViewport.height;
|
345
|
+
const layoutViewport = isLayoutViewport();
|
346
|
+
if (layoutViewport || (!layoutViewport && strategy === "fixed")) {
|
347
|
+
x = visualViewport.offsetLeft;
|
348
|
+
y = visualViewport.offsetTop;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
return {
|
352
|
+
width,
|
353
|
+
height,
|
354
|
+
x,
|
355
|
+
y
|
356
|
+
};
|
357
|
+
}
|
358
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
359
|
+
function getDocumentRect(element) {
|
360
|
+
var _element$ownerDocumen;
|
361
|
+
const html = getDocumentElement(element);
|
362
|
+
const scroll = getNodeScroll(element);
|
363
|
+
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
364
|
+
const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
365
|
+
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
366
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
367
|
+
const y = -scroll.scrollTop;
|
368
|
+
if (getComputedStyle(body || html).direction === "rtl") {
|
369
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
370
|
+
}
|
371
|
+
return {
|
372
|
+
width,
|
373
|
+
height,
|
374
|
+
x,
|
375
|
+
y
|
376
|
+
};
|
377
|
+
}
|
378
|
+
function getNearestOverflowAncestor(node) {
|
379
|
+
const parentNode = getParentNode(node);
|
380
|
+
if (isLastTraversableNode(parentNode)) {
|
381
|
+
// @ts-ignore assume body is always available
|
382
|
+
return node.ownerDocument.body;
|
383
|
+
}
|
384
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
385
|
+
return parentNode;
|
386
|
+
}
|
387
|
+
return getNearestOverflowAncestor(parentNode);
|
388
|
+
}
|
389
|
+
function getOverflowAncestors(node, list) {
|
390
|
+
var _node$ownerDocument;
|
391
|
+
if (list === void 0) {
|
392
|
+
list = [];
|
393
|
+
}
|
394
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
395
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
396
|
+
const win = getWindow(scrollableAncestor);
|
397
|
+
const target = isBody
|
398
|
+
? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [])
|
399
|
+
: scrollableAncestor;
|
400
|
+
const updatedList = list.concat(target);
|
401
|
+
return isBody
|
402
|
+
? updatedList // @ts-ignore: isBody tells us target will be an HTMLElement here
|
403
|
+
: updatedList.concat(getOverflowAncestors(target));
|
404
|
+
}
|
405
|
+
function contains(parent, child) {
|
406
|
+
const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
|
407
|
+
if (parent.contains(child)) {
|
408
|
+
return true;
|
409
|
+
} // then fallback to custom implementation with Shadow DOM support
|
410
|
+
else if (rootNode && isShadowRoot(rootNode)) {
|
411
|
+
let next = child;
|
412
|
+
do {
|
413
|
+
// use `===` replace node.isSameNode()
|
414
|
+
if (next && parent === next) {
|
415
|
+
return true;
|
416
|
+
} // @ts-ignore: need a better way to handle this...
|
417
|
+
next = next.parentNode || next.host;
|
418
|
+
} while (next);
|
419
|
+
}
|
420
|
+
return false;
|
421
|
+
}
|
422
|
+
function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) {
|
423
|
+
let currentNode = element;
|
424
|
+
while (currentNode && !isLastTraversableNode(currentNode) && !clippingAncestors.includes(currentNode)) {
|
425
|
+
if (isElement(currentNode) && ["absolute", "fixed"].includes(getComputedStyle(currentNode).position)) {
|
426
|
+
break;
|
427
|
+
}
|
428
|
+
const parentNode = getParentNode(currentNode);
|
429
|
+
currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode;
|
430
|
+
}
|
431
|
+
return currentNode;
|
432
|
+
}
|
433
|
+
function getInnerBoundingClientRect(element, strategy) {
|
434
|
+
const clientRect = getBoundingClientRect(element, false, strategy === "fixed");
|
435
|
+
const top = clientRect.top + element.clientTop;
|
436
|
+
const left = clientRect.left + element.clientLeft;
|
437
|
+
return {
|
438
|
+
top,
|
439
|
+
left,
|
440
|
+
x: left,
|
441
|
+
y: top,
|
442
|
+
right: left + element.clientWidth,
|
443
|
+
bottom: top + element.clientHeight,
|
444
|
+
width: element.clientWidth,
|
445
|
+
height: element.clientHeight
|
446
|
+
};
|
447
|
+
}
|
448
|
+
function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
|
449
|
+
if (clippingParent === "viewport") {
|
450
|
+
return rectToClientRect(getViewportRect(element, strategy));
|
451
|
+
}
|
452
|
+
if (isElement(clippingParent)) {
|
453
|
+
return getInnerBoundingClientRect(clippingParent, strategy);
|
454
|
+
}
|
455
|
+
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
456
|
+
} // A "clipping ancestor" is an overflowable container with the characteristic of
|
457
|
+
// clipping (or hiding) overflowing elements with a position different from
|
458
|
+
// `initial`
|
459
|
+
function getClippingAncestors(element) {
|
460
|
+
// @ts-ignore
|
461
|
+
const clippingAncestors = getOverflowAncestors(element);
|
462
|
+
const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors);
|
463
|
+
let clipperElement = null;
|
464
|
+
if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) {
|
465
|
+
const offsetParent = getOffsetParent(nearestEscapableParent);
|
466
|
+
if (isOverflowElement(nearestEscapableParent)) {
|
467
|
+
clipperElement = nearestEscapableParent;
|
468
|
+
}
|
469
|
+
else if (isHTMLElement(offsetParent)) {
|
470
|
+
clipperElement = offsetParent;
|
471
|
+
}
|
472
|
+
}
|
473
|
+
if (!isElement(clipperElement)) {
|
474
|
+
return [];
|
475
|
+
} // @ts-ignore isElement check ensures we return Array<Element>
|
476
|
+
return clippingAncestors.filter((clippingAncestors) => clipperElement &&
|
477
|
+
isElement(clippingAncestors) &&
|
478
|
+
contains(clippingAncestors, clipperElement) &&
|
479
|
+
getNodeName(clippingAncestors) !== "body");
|
480
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
481
|
+
// clipping ancestors
|
482
|
+
function getClippingRect(_ref) {
|
483
|
+
let { element, boundary, rootBoundary, strategy } = _ref;
|
484
|
+
const mainClippingAncestors = boundary === "clippingAncestors" ? getClippingAncestors(element) : [].concat(boundary);
|
485
|
+
const clippingAncestors = [...mainClippingAncestors, rootBoundary];
|
486
|
+
const firstClippingAncestor = clippingAncestors[0];
|
487
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
488
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
489
|
+
accRect.top = max(rect.top, accRect.top);
|
490
|
+
accRect.right = min(rect.right, accRect.right);
|
491
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
492
|
+
accRect.left = max(rect.left, accRect.left);
|
493
|
+
return accRect;
|
494
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
495
|
+
return {
|
496
|
+
width: clippingRect.right - clippingRect.left,
|
497
|
+
height: clippingRect.bottom - clippingRect.top,
|
498
|
+
x: clippingRect.left,
|
499
|
+
y: clippingRect.top
|
500
|
+
};
|
501
|
+
}
|
502
|
+
|
503
|
+
export { getClippingRect, getElementRects, getOffsetParent };
|