@adam-milo/ui 1.0.35 → 1.0.40
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/README.md +217 -337
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -108
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +4 -103
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +4 -230
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +9 -325
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +11 -279
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +2 -150
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +5 -65
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +4 -71
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +4 -125
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +8 -93
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +4 -42
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +2 -482
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +5 -169
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +11 -44
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +2 -38
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +2 -46
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +2 -118
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +7 -55
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +2 -45
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +2 -53
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +2 -55
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +2 -45
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +2 -72
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +10 -14
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +1 -332
- package/dist/index33.cjs +1 -0
- package/dist/index33.js +1 -0
- package/dist/index34.cjs +1 -0
- package/dist/index34.js +1 -0
- package/dist/index35.cjs +1 -0
- package/dist/index35.js +1 -0
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -386
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +15 -16
- package/dist/index38.cjs +1 -0
- package/dist/index38.js +1 -0
- package/dist/index39.cjs +1 -0
- package/dist/index39.js +1 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +3 -70
- package/dist/index40.cjs +1 -0
- package/dist/index40.js +1 -0
- package/dist/index41.cjs +1 -0
- package/dist/index41.js +1 -0
- package/dist/index42.cjs +1 -0
- package/dist/index42.js +1 -0
- package/dist/index43.cjs +1 -0
- package/dist/index43.js +1 -0
- package/dist/index44.cjs +1 -0
- package/dist/index44.js +1 -0
- package/dist/index45.cjs +1 -0
- package/dist/index45.js +1 -0
- package/dist/index46.cjs +1 -0
- package/dist/index46.js +1 -0
- package/dist/index47.cjs +1 -0
- package/dist/index47.js +1 -0
- package/dist/index48.cjs +1 -0
- package/dist/index48.js +1 -0
- package/dist/index49.cjs +1 -0
- package/dist/index49.js +1 -0
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +2 -45
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +1 -9
- package/dist/index51.cjs +1 -0
- package/dist/index51.js +1 -0
- package/dist/index52.cjs +1 -0
- package/dist/index52.js +1 -0
- package/dist/index53.cjs +1 -0
- package/dist/index53.js +1 -0
- package/dist/index54.cjs +1 -0
- package/dist/index54.js +1 -0
- package/dist/index55.cjs +1 -0
- package/dist/index55.js +1 -0
- package/dist/index56.cjs +1 -0
- package/dist/index56.js +1 -0
- package/dist/index57.cjs +1 -0
- package/dist/index57.js +1 -0
- package/dist/index58.cjs +1 -0
- package/dist/index58.js +1 -0
- package/dist/index59.cjs +1 -0
- package/dist/index59.js +1 -0
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +2 -22
- package/dist/index60.cjs +1 -0
- package/dist/index60.js +1 -0
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +1 -21
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +1 -502
- package/dist/index63.cjs +1 -0
- package/dist/index63.js +5 -0
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +1 -11
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +1 -39
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +1 -64
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +2 -212
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +1 -14
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +1 -293
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +1 -61
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +4 -18
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +1 -129
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +1 -43
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +1 -99
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +3 -71
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +1 -36
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +1 -14
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +1 -17
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +1 -6
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -297
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +2 -112
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +1 -25
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +2 -39
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +1 -625
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +1 -721
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +1 -154
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +1 -173
- package/dist/index86.cjs +1 -0
- package/dist/index86.js +1 -0
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +2 -112
- package/dist/src/components/core/button/Button.component.d.ts +2 -35
- package/dist/src/components/core/button/Button.component.d.ts.map +1 -1
- package/dist/src/components/core/button/Button.styles.d.ts +5 -0
- package/dist/src/components/core/button/Button.styles.d.ts.map +1 -0
- package/dist/src/components/core/button/Button.types.d.ts +11 -0
- package/dist/src/components/core/button/Button.types.d.ts.map +1 -0
- package/dist/src/components/core/icon-button/IconButton.component.d.ts +2 -33
- package/dist/src/components/core/icon-button/IconButton.component.d.ts.map +1 -1
- package/dist/src/components/core/icon-button/IconButton.styles.d.ts +3 -0
- package/dist/src/components/core/icon-button/IconButton.styles.d.ts.map +1 -0
- package/dist/src/components/core/icon-button/IconButton.types.d.ts +12 -0
- package/dist/src/components/core/icon-button/IconButton.types.d.ts.map +1 -0
- package/dist/src/components/core/menu-icon-button/MenuIconButton.component.d.ts +2 -76
- package/dist/src/components/core/menu-icon-button/MenuIconButton.component.d.ts.map +1 -1
- package/dist/src/components/core/menu-icon-button/MenuIconButton.styles.d.ts +9 -0
- package/dist/src/components/core/menu-icon-button/MenuIconButton.styles.d.ts.map +1 -0
- package/dist/src/components/core/menu-icon-button/MenuIconButton.types.d.ts +11 -0
- package/dist/src/components/core/menu-icon-button/MenuIconButton.types.d.ts.map +1 -0
- package/dist/src/components/data-display/card/Card.component.d.ts +2 -34
- package/dist/src/components/data-display/card/Card.component.d.ts.map +1 -1
- package/dist/src/components/data-display/card/Card.styles.d.ts +12 -0
- package/dist/src/components/data-display/card/Card.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/card/Card.types.d.ts +28 -0
- package/dist/src/components/data-display/card/Card.types.d.ts.map +1 -0
- package/dist/src/components/data-display/chip/Chip.component.d.ts +2 -33
- package/dist/src/components/data-display/chip/Chip.component.d.ts.map +1 -1
- package/dist/src/components/data-display/chip/Chip.styles.d.ts +24 -0
- package/dist/src/components/data-display/chip/Chip.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/chip/Chip.types.d.ts +11 -0
- package/dist/src/components/data-display/chip/Chip.types.d.ts.map +1 -0
- package/dist/src/components/data-display/chip-group/ChipGroup.component.d.ts +2 -69
- package/dist/src/components/data-display/chip-group/ChipGroup.component.d.ts.map +1 -1
- package/dist/src/components/data-display/chip-group/ChipGroup.styles.d.ts +14 -0
- package/dist/src/components/data-display/chip-group/ChipGroup.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/chip-group/ChipGroup.types.d.ts +21 -0
- package/dist/src/components/data-display/chip-group/ChipGroup.types.d.ts.map +1 -0
- package/dist/src/components/data-display/datatable/DataTable.component.d.ts +2 -22
- package/dist/src/components/data-display/datatable/DataTable.component.d.ts.map +1 -1
- package/dist/src/components/data-display/datatable/DataTable.styles.d.ts +10 -0
- package/dist/src/components/data-display/datatable/DataTable.styles.d.ts.map +1 -0
- package/dist/src/components/data-display/datatable/DataTable.types.d.ts +16 -0
- package/dist/src/components/data-display/datatable/DataTable.types.d.ts.map +1 -0
- package/dist/src/components/feedback/alert/Alert.component.d.ts +2 -16
- package/dist/src/components/feedback/alert/Alert.component.d.ts.map +1 -1
- package/dist/src/components/feedback/alert/Alert.styles.d.ts +10 -0
- package/dist/src/components/feedback/alert/Alert.styles.d.ts.map +1 -0
- package/dist/src/components/feedback/alert/Alert.types.d.ts +10 -0
- package/dist/src/components/feedback/alert/Alert.types.d.ts.map +1 -0
- package/dist/src/components/feedback/spinner/Spinner.component.d.ts +2 -59
- package/dist/src/components/feedback/spinner/Spinner.component.d.ts.map +1 -1
- package/dist/src/components/feedback/spinner/Spinner.styles.d.ts +7 -0
- package/dist/src/components/feedback/spinner/Spinner.styles.d.ts.map +1 -0
- package/dist/src/components/feedback/spinner/Spinner.types.d.ts +14 -0
- package/dist/src/components/feedback/spinner/Spinner.types.d.ts.map +1 -0
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.component.d.ts +2 -44
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.types.d.ts +10 -0
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.types.d.ts.map +1 -0
- package/dist/src/components/forms/checkbox/Checkbox.component.d.ts +2 -99
- package/dist/src/components/forms/checkbox/Checkbox.component.d.ts.map +1 -1
- package/dist/src/components/forms/checkbox/Checkbox.styles.d.ts +10 -0
- package/dist/src/components/forms/checkbox/Checkbox.styles.d.ts.map +1 -0
- package/dist/src/components/forms/checkbox/Checkbox.types.d.ts +17 -0
- package/dist/src/components/forms/checkbox/Checkbox.types.d.ts.map +1 -0
- package/dist/src/components/forms/email-input/EmailInput.component.d.ts +2 -28
- package/dist/src/components/forms/email-input/EmailInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/email-input/EmailInput.types.d.ts +7 -0
- package/dist/src/components/forms/email-input/EmailInput.types.d.ts.map +1 -0
- package/dist/src/components/forms/input/Input.component.d.ts +2 -107
- package/dist/src/components/forms/input/Input.component.d.ts.map +1 -1
- package/dist/src/components/forms/input/Input.styles.d.ts +13 -0
- package/dist/src/components/forms/input/Input.styles.d.ts.map +1 -0
- package/dist/src/components/forms/input/Input.types.d.ts +17 -0
- package/dist/src/components/forms/input/Input.types.d.ts.map +1 -0
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts +2 -41
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/numeric-input/NumericInput.types.d.ts +9 -0
- package/dist/src/components/forms/numeric-input/NumericInput.types.d.ts.map +1 -0
- package/dist/src/components/forms/otp-input/OTPInput.component.d.ts +2 -79
- package/dist/src/components/forms/otp-input/OTPInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/otp-input/OTPInput.styles.d.ts +12 -0
- package/dist/src/components/forms/otp-input/OTPInput.styles.d.ts.map +1 -0
- package/dist/src/components/forms/otp-input/OTPInput.types.d.ts +23 -0
- package/dist/src/components/forms/otp-input/OTPInput.types.d.ts.map +1 -0
- package/dist/src/components/forms/password-input/PasswordInput.component.d.ts +2 -25
- package/dist/src/components/forms/password-input/PasswordInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/password-input/PasswordInput.types.d.ts +6 -0
- package/dist/src/components/forms/password-input/PasswordInput.types.d.ts.map +1 -0
- package/dist/src/components/forms/phone-input/PhoneInput.component.d.ts +2 -91
- package/dist/src/components/forms/phone-input/PhoneInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/phone-input/PhoneInput.styles.d.ts +22 -0
- package/dist/src/components/forms/phone-input/PhoneInput.styles.d.ts.map +1 -0
- package/dist/src/components/forms/phone-input/PhoneInput.types.d.ts +19 -0
- package/dist/src/components/forms/phone-input/PhoneInput.types.d.ts.map +1 -0
- package/dist/src/components/forms/phone-input/countries.d.ts +3 -79
- package/dist/src/components/forms/phone-input/countries.d.ts.map +1 -1
- package/dist/src/components/forms/phone-input/countries.types.d.ts +12 -0
- package/dist/src/components/forms/phone-input/countries.types.d.ts.map +1 -0
- package/dist/src/components/forms/radio/Radio.component.d.ts +2 -97
- package/dist/src/components/forms/radio/Radio.component.d.ts.map +1 -1
- package/dist/src/components/forms/radio/Radio.styles.d.ts +10 -0
- package/dist/src/components/forms/radio/Radio.styles.d.ts.map +1 -0
- package/dist/src/components/forms/radio/Radio.types.d.ts +16 -0
- package/dist/src/components/forms/radio/Radio.types.d.ts.map +1 -0
- package/dist/src/components/forms/select/Select.component.d.ts +2 -94
- package/dist/src/components/forms/select/Select.component.d.ts.map +1 -1
- package/dist/src/components/forms/select/Select.styles.d.ts +18 -0
- package/dist/src/components/forms/select/Select.styles.d.ts.map +1 -0
- package/dist/src/components/forms/select/Select.types.d.ts +34 -0
- package/dist/src/components/forms/select/Select.types.d.ts.map +1 -0
- package/dist/src/components/forms/toggle/Toggle.component.d.ts +2 -77
- package/dist/src/components/forms/toggle/Toggle.component.d.ts.map +1 -1
- package/dist/src/components/forms/toggle/Toggle.styles.d.ts +23 -0
- package/dist/src/components/forms/toggle/Toggle.styles.d.ts.map +1 -0
- package/dist/src/components/forms/toggle/Toggle.types.d.ts +14 -0
- package/dist/src/components/forms/toggle/Toggle.types.d.ts.map +1 -0
- package/dist/src/components/layout/auth-layout/AuthLayout.component.d.ts +2 -83
- package/dist/src/components/layout/auth-layout/AuthLayout.component.d.ts.map +1 -1
- package/dist/src/components/layout/auth-layout/AuthLayout.styles.d.ts +11 -0
- package/dist/src/components/layout/auth-layout/AuthLayout.styles.d.ts.map +1 -0
- package/dist/src/components/layout/auth-layout/AuthLayout.types.d.ts +16 -0
- package/dist/src/components/layout/auth-layout/AuthLayout.types.d.ts.map +1 -0
- package/dist/src/components/layout/container/Container.component.d.ts +2 -23
- package/dist/src/components/layout/container/Container.component.d.ts.map +1 -1
- package/dist/src/components/layout/container/Container.styles.d.ts +15 -0
- package/dist/src/components/layout/container/Container.styles.d.ts.map +1 -0
- package/dist/src/components/layout/container/Container.types.d.ts +9 -0
- package/dist/src/components/layout/container/Container.types.d.ts.map +1 -0
- package/dist/src/components/layout/divider/Divider.component.d.ts +2 -36
- package/dist/src/components/layout/divider/Divider.component.d.ts.map +1 -1
- package/dist/src/components/layout/divider/Divider.styles.d.ts +4 -0
- package/dist/src/components/layout/divider/Divider.styles.d.ts.map +1 -0
- package/dist/src/components/layout/divider/Divider.types.d.ts +11 -0
- package/dist/src/components/layout/divider/Divider.types.d.ts.map +1 -0
- package/dist/src/components/layout/grid/Grid.component.d.ts +2 -50
- package/dist/src/components/layout/grid/Grid.component.d.ts.map +1 -1
- package/dist/src/components/layout/grid/Grid.styles.d.ts +79 -0
- package/dist/src/components/layout/grid/Grid.styles.d.ts.map +1 -0
- package/dist/src/components/layout/grid/Grid.types.d.ts +15 -0
- package/dist/src/components/layout/grid/Grid.types.d.ts.map +1 -0
- package/dist/src/components/layout/stack/Stack.component.d.ts +2 -18
- package/dist/src/components/layout/stack/Stack.component.d.ts.map +1 -1
- package/dist/src/components/layout/stack/Stack.styles.d.ts +5 -0
- package/dist/src/components/layout/stack/Stack.styles.d.ts.map +1 -0
- package/dist/src/components/layout/stack/Stack.types.d.ts +12 -0
- package/dist/src/components/layout/stack/Stack.types.d.ts.map +1 -0
- package/dist/src/components/navigation/tabs/Tabs.component.d.ts +2 -38
- package/dist/src/components/navigation/tabs/Tabs.component.d.ts.map +1 -1
- package/dist/src/components/navigation/tabs/Tabs.styles.d.ts +4 -0
- package/dist/src/components/navigation/tabs/Tabs.styles.d.ts.map +1 -0
- package/dist/src/components/navigation/tabs/Tabs.types.d.ts +17 -0
- package/dist/src/components/navigation/tabs/Tabs.types.d.ts.map +1 -0
- package/dist/src/components/overlays/dialog/Dialog.component.d.ts +2 -55
- package/dist/src/components/overlays/dialog/Dialog.component.d.ts.map +1 -1
- package/dist/src/components/overlays/dialog/Dialog.styles.d.ts +20 -0
- package/dist/src/components/overlays/dialog/Dialog.styles.d.ts.map +1 -0
- package/dist/src/components/overlays/dialog/Dialog.types.d.ts +41 -0
- package/dist/src/components/overlays/dialog/Dialog.types.d.ts.map +1 -0
- package/dist/src/components/typography/heading/Heading.component.d.ts +2 -89
- package/dist/src/components/typography/heading/Heading.component.d.ts.map +1 -1
- package/dist/src/components/typography/heading/Heading.styles.d.ts +9 -0
- package/dist/src/components/typography/heading/Heading.styles.d.ts.map +1 -0
- package/dist/src/components/typography/heading/Heading.types.d.ts +19 -0
- package/dist/src/components/typography/heading/Heading.types.d.ts.map +1 -0
- package/dist/src/components/typography/link/Link.component.d.ts +2 -77
- package/dist/src/components/typography/link/Link.component.d.ts.map +1 -1
- package/dist/src/components/typography/link/Link.styles.d.ts +9 -0
- package/dist/src/components/typography/link/Link.styles.d.ts.map +1 -0
- package/dist/src/components/typography/link/Link.types.d.ts +17 -0
- package/dist/src/components/typography/link/Link.types.d.ts.map +1 -0
- package/dist/src/components/typography/text/Text.component.d.ts +4 -91
- package/dist/src/components/typography/text/Text.component.d.ts.map +1 -1
- package/dist/src/components/typography/text/Text.styles.d.ts +8 -0
- package/dist/src/components/typography/text/Text.styles.d.ts.map +1 -0
- package/dist/src/components/typography/text/Text.types.d.ts +20 -0
- package/dist/src/components/typography/text/Text.types.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +8 -13
- package/dist/index2.cjs +0 -1
- package/dist/index2.js +0 -40
- package/dist/style.css +0 -1
package/dist/index82.js
CHANGED
|
@@ -1,625 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createCoords, round, max, min, rectToClientRect, floor } from "./index84.js";
|
|
3
|
-
import { isElement, getDocumentElement, getOverflowAncestors, getComputedStyle as getComputedStyle$1, isHTMLElement, getWindow, isTopLayer, getParentNode, isLastTraversableNode, isTableElement, isContainingBlock, getContainingBlock, getNodeName, isOverflowElement, getNodeScroll, getFrameElement, isWebKit } from "./index85.js";
|
|
4
|
-
function getCssDimensions(element) {
|
|
5
|
-
const css = getComputedStyle$1(element);
|
|
6
|
-
let width = parseFloat(css.width) || 0;
|
|
7
|
-
let height = parseFloat(css.height) || 0;
|
|
8
|
-
const hasOffset = isHTMLElement(element);
|
|
9
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
10
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
11
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
12
|
-
if (shouldFallback) {
|
|
13
|
-
width = offsetWidth;
|
|
14
|
-
height = offsetHeight;
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
width,
|
|
18
|
-
height,
|
|
19
|
-
$: shouldFallback
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function unwrapElement(element) {
|
|
23
|
-
return !isElement(element) ? element.contextElement : element;
|
|
24
|
-
}
|
|
25
|
-
function getScale(element) {
|
|
26
|
-
const domElement = unwrapElement(element);
|
|
27
|
-
if (!isHTMLElement(domElement)) {
|
|
28
|
-
return createCoords(1);
|
|
29
|
-
}
|
|
30
|
-
const rect = domElement.getBoundingClientRect();
|
|
31
|
-
const {
|
|
32
|
-
width,
|
|
33
|
-
height,
|
|
34
|
-
$
|
|
35
|
-
} = getCssDimensions(domElement);
|
|
36
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
37
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
38
|
-
if (!x || !Number.isFinite(x)) {
|
|
39
|
-
x = 1;
|
|
40
|
-
}
|
|
41
|
-
if (!y || !Number.isFinite(y)) {
|
|
42
|
-
y = 1;
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
x,
|
|
46
|
-
y
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
50
|
-
function getVisualOffsets(element) {
|
|
51
|
-
const win = getWindow(element);
|
|
52
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
53
|
-
return noOffsets;
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
x: win.visualViewport.offsetLeft,
|
|
57
|
-
y: win.visualViewport.offsetTop
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
61
|
-
if (isFixed === void 0) {
|
|
62
|
-
isFixed = false;
|
|
63
|
-
}
|
|
64
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
return isFixed;
|
|
68
|
-
}
|
|
69
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
70
|
-
if (includeScale === void 0) {
|
|
71
|
-
includeScale = false;
|
|
72
|
-
}
|
|
73
|
-
if (isFixedStrategy === void 0) {
|
|
74
|
-
isFixedStrategy = false;
|
|
75
|
-
}
|
|
76
|
-
const clientRect = element.getBoundingClientRect();
|
|
77
|
-
const domElement = unwrapElement(element);
|
|
78
|
-
let scale = createCoords(1);
|
|
79
|
-
if (includeScale) {
|
|
80
|
-
if (offsetParent) {
|
|
81
|
-
if (isElement(offsetParent)) {
|
|
82
|
-
scale = getScale(offsetParent);
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
scale = getScale(element);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
89
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
90
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
91
|
-
let width = clientRect.width / scale.x;
|
|
92
|
-
let height = clientRect.height / scale.y;
|
|
93
|
-
if (domElement) {
|
|
94
|
-
const win = getWindow(domElement);
|
|
95
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
96
|
-
let currentWin = win;
|
|
97
|
-
let currentIFrame = getFrameElement(currentWin);
|
|
98
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
99
|
-
const iframeScale = getScale(currentIFrame);
|
|
100
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
101
|
-
const css = getComputedStyle$1(currentIFrame);
|
|
102
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
103
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
104
|
-
x *= iframeScale.x;
|
|
105
|
-
y *= iframeScale.y;
|
|
106
|
-
width *= iframeScale.x;
|
|
107
|
-
height *= iframeScale.y;
|
|
108
|
-
x += left;
|
|
109
|
-
y += top;
|
|
110
|
-
currentWin = getWindow(currentIFrame);
|
|
111
|
-
currentIFrame = getFrameElement(currentWin);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return rectToClientRect({
|
|
115
|
-
width,
|
|
116
|
-
height,
|
|
117
|
-
x,
|
|
118
|
-
y
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function getWindowScrollBarX(element, rect) {
|
|
122
|
-
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
123
|
-
if (!rect) {
|
|
124
|
-
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
125
|
-
}
|
|
126
|
-
return rect.left + leftScroll;
|
|
127
|
-
}
|
|
128
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
129
|
-
const htmlRect = documentElement.getBoundingClientRect();
|
|
130
|
-
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
131
|
-
const y = htmlRect.top + scroll.scrollTop;
|
|
132
|
-
return {
|
|
133
|
-
x,
|
|
134
|
-
y
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
138
|
-
let {
|
|
139
|
-
elements,
|
|
140
|
-
rect,
|
|
141
|
-
offsetParent,
|
|
142
|
-
strategy
|
|
143
|
-
} = _ref;
|
|
144
|
-
const isFixed = strategy === "fixed";
|
|
145
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
146
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
147
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
148
|
-
return rect;
|
|
149
|
-
}
|
|
150
|
-
let scroll = {
|
|
151
|
-
scrollLeft: 0,
|
|
152
|
-
scrollTop: 0
|
|
153
|
-
};
|
|
154
|
-
let scale = createCoords(1);
|
|
155
|
-
const offsets = createCoords(0);
|
|
156
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
157
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
158
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
159
|
-
scroll = getNodeScroll(offsetParent);
|
|
160
|
-
}
|
|
161
|
-
if (isHTMLElement(offsetParent)) {
|
|
162
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
163
|
-
scale = getScale(offsetParent);
|
|
164
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
165
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
169
|
-
return {
|
|
170
|
-
width: rect.width * scale.x,
|
|
171
|
-
height: rect.height * scale.y,
|
|
172
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
173
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function getClientRects(element) {
|
|
177
|
-
return Array.from(element.getClientRects());
|
|
178
|
-
}
|
|
179
|
-
function getDocumentRect(element) {
|
|
180
|
-
const html = getDocumentElement(element);
|
|
181
|
-
const scroll = getNodeScroll(element);
|
|
182
|
-
const body = element.ownerDocument.body;
|
|
183
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
184
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
185
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
186
|
-
const y = -scroll.scrollTop;
|
|
187
|
-
if (getComputedStyle$1(body).direction === "rtl") {
|
|
188
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
width,
|
|
192
|
-
height,
|
|
193
|
-
x,
|
|
194
|
-
y
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
const SCROLLBAR_MAX = 25;
|
|
198
|
-
function getViewportRect(element, strategy) {
|
|
199
|
-
const win = getWindow(element);
|
|
200
|
-
const html = getDocumentElement(element);
|
|
201
|
-
const visualViewport = win.visualViewport;
|
|
202
|
-
let width = html.clientWidth;
|
|
203
|
-
let height = html.clientHeight;
|
|
204
|
-
let x = 0;
|
|
205
|
-
let y = 0;
|
|
206
|
-
if (visualViewport) {
|
|
207
|
-
width = visualViewport.width;
|
|
208
|
-
height = visualViewport.height;
|
|
209
|
-
const visualViewportBased = isWebKit();
|
|
210
|
-
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
211
|
-
x = visualViewport.offsetLeft;
|
|
212
|
-
y = visualViewport.offsetTop;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
216
|
-
if (windowScrollbarX <= 0) {
|
|
217
|
-
const doc = html.ownerDocument;
|
|
218
|
-
const body = doc.body;
|
|
219
|
-
const bodyStyles = getComputedStyle(body);
|
|
220
|
-
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
221
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
222
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
223
|
-
width -= clippingStableScrollbarWidth;
|
|
224
|
-
}
|
|
225
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
226
|
-
width += windowScrollbarX;
|
|
227
|
-
}
|
|
228
|
-
return {
|
|
229
|
-
width,
|
|
230
|
-
height,
|
|
231
|
-
x,
|
|
232
|
-
y
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
236
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
237
|
-
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
238
|
-
const top = clientRect.top + element.clientTop;
|
|
239
|
-
const left = clientRect.left + element.clientLeft;
|
|
240
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
241
|
-
const width = element.clientWidth * scale.x;
|
|
242
|
-
const height = element.clientHeight * scale.y;
|
|
243
|
-
const x = left * scale.x;
|
|
244
|
-
const y = top * scale.y;
|
|
245
|
-
return {
|
|
246
|
-
width,
|
|
247
|
-
height,
|
|
248
|
-
x,
|
|
249
|
-
y
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
253
|
-
let rect;
|
|
254
|
-
if (clippingAncestor === "viewport") {
|
|
255
|
-
rect = getViewportRect(element, strategy);
|
|
256
|
-
} else if (clippingAncestor === "document") {
|
|
257
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
258
|
-
} else if (isElement(clippingAncestor)) {
|
|
259
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
260
|
-
} else {
|
|
261
|
-
const visualOffsets = getVisualOffsets(element);
|
|
262
|
-
rect = {
|
|
263
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
264
|
-
y: clippingAncestor.y - visualOffsets.y,
|
|
265
|
-
width: clippingAncestor.width,
|
|
266
|
-
height: clippingAncestor.height
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
return rectToClientRect(rect);
|
|
270
|
-
}
|
|
271
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
272
|
-
const parentNode = getParentNode(element);
|
|
273
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
277
|
-
}
|
|
278
|
-
function getClippingElementAncestors(element, cache) {
|
|
279
|
-
const cachedResult = cache.get(element);
|
|
280
|
-
if (cachedResult) {
|
|
281
|
-
return cachedResult;
|
|
282
|
-
}
|
|
283
|
-
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
284
|
-
let currentContainingBlockComputedStyle = null;
|
|
285
|
-
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
286
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
287
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
288
|
-
const computedStyle = getComputedStyle$1(currentNode);
|
|
289
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
290
|
-
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
291
|
-
currentContainingBlockComputedStyle = null;
|
|
292
|
-
}
|
|
293
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
294
|
-
if (shouldDropCurrentNode) {
|
|
295
|
-
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
296
|
-
} else {
|
|
297
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
298
|
-
}
|
|
299
|
-
currentNode = getParentNode(currentNode);
|
|
300
|
-
}
|
|
301
|
-
cache.set(element, result);
|
|
302
|
-
return result;
|
|
303
|
-
}
|
|
304
|
-
function getClippingRect(_ref) {
|
|
305
|
-
let {
|
|
306
|
-
element,
|
|
307
|
-
boundary,
|
|
308
|
-
rootBoundary,
|
|
309
|
-
strategy
|
|
310
|
-
} = _ref;
|
|
311
|
-
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
312
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
313
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
314
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
315
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
316
|
-
accRect.top = max(rect.top, accRect.top);
|
|
317
|
-
accRect.right = min(rect.right, accRect.right);
|
|
318
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
319
|
-
accRect.left = max(rect.left, accRect.left);
|
|
320
|
-
return accRect;
|
|
321
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
322
|
-
return {
|
|
323
|
-
width: clippingRect.right - clippingRect.left,
|
|
324
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
325
|
-
x: clippingRect.left,
|
|
326
|
-
y: clippingRect.top
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function getDimensions(element) {
|
|
330
|
-
const {
|
|
331
|
-
width,
|
|
332
|
-
height
|
|
333
|
-
} = getCssDimensions(element);
|
|
334
|
-
return {
|
|
335
|
-
width,
|
|
336
|
-
height
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
340
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
341
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
342
|
-
const isFixed = strategy === "fixed";
|
|
343
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
344
|
-
let scroll = {
|
|
345
|
-
scrollLeft: 0,
|
|
346
|
-
scrollTop: 0
|
|
347
|
-
};
|
|
348
|
-
const offsets = createCoords(0);
|
|
349
|
-
function setLeftRTLScrollbarOffset() {
|
|
350
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
351
|
-
}
|
|
352
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
353
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
354
|
-
scroll = getNodeScroll(offsetParent);
|
|
355
|
-
}
|
|
356
|
-
if (isOffsetParentAnElement) {
|
|
357
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
358
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
359
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
360
|
-
} else if (documentElement) {
|
|
361
|
-
setLeftRTLScrollbarOffset();
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
365
|
-
setLeftRTLScrollbarOffset();
|
|
366
|
-
}
|
|
367
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
368
|
-
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
369
|
-
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
370
|
-
return {
|
|
371
|
-
x,
|
|
372
|
-
y,
|
|
373
|
-
width: rect.width,
|
|
374
|
-
height: rect.height
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
function isStaticPositioned(element) {
|
|
378
|
-
return getComputedStyle$1(element).position === "static";
|
|
379
|
-
}
|
|
380
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
381
|
-
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
|
|
382
|
-
return null;
|
|
383
|
-
}
|
|
384
|
-
if (polyfill) {
|
|
385
|
-
return polyfill(element);
|
|
386
|
-
}
|
|
387
|
-
let rawOffsetParent = element.offsetParent;
|
|
388
|
-
if (getDocumentElement(element) === rawOffsetParent) {
|
|
389
|
-
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
390
|
-
}
|
|
391
|
-
return rawOffsetParent;
|
|
392
|
-
}
|
|
393
|
-
function getOffsetParent(element, polyfill) {
|
|
394
|
-
const win = getWindow(element);
|
|
395
|
-
if (isTopLayer(element)) {
|
|
396
|
-
return win;
|
|
397
|
-
}
|
|
398
|
-
if (!isHTMLElement(element)) {
|
|
399
|
-
let svgOffsetParent = getParentNode(element);
|
|
400
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
401
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
402
|
-
return svgOffsetParent;
|
|
403
|
-
}
|
|
404
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
405
|
-
}
|
|
406
|
-
return win;
|
|
407
|
-
}
|
|
408
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
409
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
410
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
411
|
-
}
|
|
412
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
413
|
-
return win;
|
|
414
|
-
}
|
|
415
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
416
|
-
}
|
|
417
|
-
const getElementRects = async function(data) {
|
|
418
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
419
|
-
const getDimensionsFn = this.getDimensions;
|
|
420
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
421
|
-
return {
|
|
422
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
423
|
-
floating: {
|
|
424
|
-
x: 0,
|
|
425
|
-
y: 0,
|
|
426
|
-
width: floatingDimensions.width,
|
|
427
|
-
height: floatingDimensions.height
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
};
|
|
431
|
-
function isRTL(element) {
|
|
432
|
-
return getComputedStyle$1(element).direction === "rtl";
|
|
433
|
-
}
|
|
434
|
-
const platform = {
|
|
435
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
436
|
-
getDocumentElement,
|
|
437
|
-
getClippingRect,
|
|
438
|
-
getOffsetParent,
|
|
439
|
-
getElementRects,
|
|
440
|
-
getClientRects,
|
|
441
|
-
getDimensions,
|
|
442
|
-
getScale,
|
|
443
|
-
isElement,
|
|
444
|
-
isRTL
|
|
445
|
-
};
|
|
446
|
-
function rectsAreEqual(a, b) {
|
|
447
|
-
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
448
|
-
}
|
|
449
|
-
function observeMove(element, onMove) {
|
|
450
|
-
let io = null;
|
|
451
|
-
let timeoutId;
|
|
452
|
-
const root = getDocumentElement(element);
|
|
453
|
-
function cleanup() {
|
|
454
|
-
var _io;
|
|
455
|
-
clearTimeout(timeoutId);
|
|
456
|
-
(_io = io) == null || _io.disconnect();
|
|
457
|
-
io = null;
|
|
458
|
-
}
|
|
459
|
-
function refresh(skip, threshold) {
|
|
460
|
-
if (skip === void 0) {
|
|
461
|
-
skip = false;
|
|
462
|
-
}
|
|
463
|
-
if (threshold === void 0) {
|
|
464
|
-
threshold = 1;
|
|
465
|
-
}
|
|
466
|
-
cleanup();
|
|
467
|
-
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
468
|
-
const {
|
|
469
|
-
left,
|
|
470
|
-
top,
|
|
471
|
-
width,
|
|
472
|
-
height
|
|
473
|
-
} = elementRectForRootMargin;
|
|
474
|
-
if (!skip) {
|
|
475
|
-
onMove();
|
|
476
|
-
}
|
|
477
|
-
if (!width || !height) {
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
const insetTop = floor(top);
|
|
481
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
|
482
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
|
483
|
-
const insetLeft = floor(left);
|
|
484
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
485
|
-
const options = {
|
|
486
|
-
rootMargin,
|
|
487
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
488
|
-
};
|
|
489
|
-
let isFirstUpdate = true;
|
|
490
|
-
function handleObserve(entries) {
|
|
491
|
-
const ratio = entries[0].intersectionRatio;
|
|
492
|
-
if (ratio !== threshold) {
|
|
493
|
-
if (!isFirstUpdate) {
|
|
494
|
-
return refresh();
|
|
495
|
-
}
|
|
496
|
-
if (!ratio) {
|
|
497
|
-
timeoutId = setTimeout(() => {
|
|
498
|
-
refresh(false, 1e-7);
|
|
499
|
-
}, 1e3);
|
|
500
|
-
} else {
|
|
501
|
-
refresh(false, ratio);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
505
|
-
refresh();
|
|
506
|
-
}
|
|
507
|
-
isFirstUpdate = false;
|
|
508
|
-
}
|
|
509
|
-
try {
|
|
510
|
-
io = new IntersectionObserver(handleObserve, {
|
|
511
|
-
...options,
|
|
512
|
-
// Handle <iframe>s
|
|
513
|
-
root: root.ownerDocument
|
|
514
|
-
});
|
|
515
|
-
} catch (_e) {
|
|
516
|
-
io = new IntersectionObserver(handleObserve, options);
|
|
517
|
-
}
|
|
518
|
-
io.observe(element);
|
|
519
|
-
}
|
|
520
|
-
refresh(true);
|
|
521
|
-
return cleanup;
|
|
522
|
-
}
|
|
523
|
-
function autoUpdate(reference, floating, update, options) {
|
|
524
|
-
if (options === void 0) {
|
|
525
|
-
options = {};
|
|
526
|
-
}
|
|
527
|
-
const {
|
|
528
|
-
ancestorScroll = true,
|
|
529
|
-
ancestorResize = true,
|
|
530
|
-
elementResize = typeof ResizeObserver === "function",
|
|
531
|
-
layoutShift = typeof IntersectionObserver === "function",
|
|
532
|
-
animationFrame = false
|
|
533
|
-
} = options;
|
|
534
|
-
const referenceEl = unwrapElement(reference);
|
|
535
|
-
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
536
|
-
ancestors.forEach((ancestor) => {
|
|
537
|
-
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
538
|
-
passive: true
|
|
539
|
-
});
|
|
540
|
-
ancestorResize && ancestor.addEventListener("resize", update);
|
|
541
|
-
});
|
|
542
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
543
|
-
let reobserveFrame = -1;
|
|
544
|
-
let resizeObserver = null;
|
|
545
|
-
if (elementResize) {
|
|
546
|
-
resizeObserver = new ResizeObserver((_ref) => {
|
|
547
|
-
let [firstEntry] = _ref;
|
|
548
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
549
|
-
resizeObserver.unobserve(floating);
|
|
550
|
-
cancelAnimationFrame(reobserveFrame);
|
|
551
|
-
reobserveFrame = requestAnimationFrame(() => {
|
|
552
|
-
var _resizeObserver;
|
|
553
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
update();
|
|
557
|
-
});
|
|
558
|
-
if (referenceEl && !animationFrame) {
|
|
559
|
-
resizeObserver.observe(referenceEl);
|
|
560
|
-
}
|
|
561
|
-
resizeObserver.observe(floating);
|
|
562
|
-
}
|
|
563
|
-
let frameId;
|
|
564
|
-
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
565
|
-
if (animationFrame) {
|
|
566
|
-
frameLoop();
|
|
567
|
-
}
|
|
568
|
-
function frameLoop() {
|
|
569
|
-
const nextRefRect = getBoundingClientRect(reference);
|
|
570
|
-
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
571
|
-
update();
|
|
572
|
-
}
|
|
573
|
-
prevRefRect = nextRefRect;
|
|
574
|
-
frameId = requestAnimationFrame(frameLoop);
|
|
575
|
-
}
|
|
576
|
-
update();
|
|
577
|
-
return () => {
|
|
578
|
-
var _resizeObserver2;
|
|
579
|
-
ancestors.forEach((ancestor) => {
|
|
580
|
-
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
581
|
-
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
582
|
-
});
|
|
583
|
-
cleanupIo == null || cleanupIo();
|
|
584
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
585
|
-
resizeObserver = null;
|
|
586
|
-
if (animationFrame) {
|
|
587
|
-
cancelAnimationFrame(frameId);
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
const offset = offset$1;
|
|
592
|
-
const shift = shift$1;
|
|
593
|
-
const flip = flip$1;
|
|
594
|
-
const size = size$1;
|
|
595
|
-
const hide = hide$1;
|
|
596
|
-
const arrow = arrow$1;
|
|
597
|
-
const limitShift = limitShift$1;
|
|
598
|
-
const computePosition = (reference, floating, options) => {
|
|
599
|
-
const cache = /* @__PURE__ */ new Map();
|
|
600
|
-
const mergedOptions = {
|
|
601
|
-
platform,
|
|
602
|
-
...options
|
|
603
|
-
};
|
|
604
|
-
const platformWithCache = {
|
|
605
|
-
...mergedOptions.platform,
|
|
606
|
-
_c: cache
|
|
607
|
-
};
|
|
608
|
-
return computePosition$1(reference, floating, {
|
|
609
|
-
...mergedOptions,
|
|
610
|
-
platform: platformWithCache
|
|
611
|
-
});
|
|
612
|
-
};
|
|
613
|
-
export {
|
|
614
|
-
arrow,
|
|
615
|
-
autoUpdate,
|
|
616
|
-
computePosition,
|
|
617
|
-
flip,
|
|
618
|
-
getOverflowAncestors,
|
|
619
|
-
hide,
|
|
620
|
-
limitShift,
|
|
621
|
-
offset,
|
|
622
|
-
platform,
|
|
623
|
-
shift,
|
|
624
|
-
size
|
|
625
|
-
};
|
|
1
|
+
import*as e from"react";import{useLayoutEffect as r}from"./index79.js";function t(t){const[i,o]=e.useState(void 0);return r(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const r=e[0];let i,s;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,s=t.blockSize}else i=t.offsetWidth,s=t.offsetHeight;o({width:i,height:s})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}o(void 0)},[t]),i}export{t as useSize};
|