origam 2.40.1 → 2.41.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.
- package/CHANGELOG.md +69 -0
- package/dist/src/components/Alert/OrigamAlert.vue +1 -2
- package/dist/src/components/Audio/OrigamAudio.vue +15 -14
- package/dist/src/components/Badge/OrigamBadge.vue +6 -1
- package/dist/src/components/Bracket/OrigamBracket.vue +5 -5
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +2 -1
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +1 -2
- package/dist/src/components/Btn/OrigamBtn.vue +14 -15
- package/dist/src/components/Card/OrigamCard.vue +2 -1
- package/dist/src/components/Carousel/OrigamCarousel.vue +14 -13
- package/dist/src/components/Chart/OrigamChartBullet.vue +4 -1
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1 -2
- package/dist/src/components/Chart/OrigamChartPictorial.vue +3 -6
- package/dist/src/components/Chart/OrigamChartPolar.vue +2 -1
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +3 -1
- package/dist/src/components/Chart/OrigamChartSankey.vue +9 -167
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +14 -12
- package/dist/src/components/Chart/OrigamChartSunburst.vue +10 -2
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +39 -36
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +3 -4
- package/dist/src/components/Chip/OrigamChip.vue +2 -3
- package/dist/src/components/Chip/OrigamChipGroup.vue +2 -3
- package/dist/src/components/Clipboard/OrigamClipboard.vue +1 -1
- package/dist/src/components/Code/OrigamCode.vue +9 -18
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +5 -1
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +1 -2
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +1 -2
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +1 -2
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +6 -2
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +2 -4
- package/dist/src/components/Counter/OrigamCounter.vue +1 -0
- package/dist/src/components/DataTable/OrigamDataTable.vue +6 -8
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +1 -2
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +3 -2
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +2 -3
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +43 -39
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +3 -4
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +1 -1
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1 -2
- package/dist/src/components/Dialog/OrigamDialog.vue +4 -12
- package/dist/src/components/Drawer/OrigamDrawer.vue +4 -2
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +2 -3
- package/dist/src/components/Field/OrigamField.vue +2 -6
- package/dist/src/components/FileField/OrigamFileField.vue +23 -6
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +3 -4
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +3 -4
- package/dist/src/components/Form/OrigamForm.vue +0 -2
- package/dist/src/components/Grids/OrigamRow.vue +8 -11
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +7 -7
- package/dist/src/components/Input/OrigamInput.vue +3 -11
- package/dist/src/components/List/OrigamListGroup.vue +2 -3
- package/dist/src/components/List/OrigamListItem.vue +4 -5
- package/dist/src/components/Media/OrigamMediaController.vue +15 -15
- package/dist/src/components/Media/OrigamMediaScrubber.vue +15 -12
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +4 -5
- package/dist/src/components/Menu/OrigamMenu.vue +1 -2
- package/dist/src/components/NumberField/OrigamNumberField.vue +7 -10
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +7 -1
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1 -1
- package/dist/src/components/Overlay/OrigamOverlay.vue +3 -4
- package/dist/src/components/Pagination/OrigamPagination.vue +4 -5
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +1 -4
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +9 -7
- package/dist/src/components/Radio/OrigamRadioBtn.vue +2 -3
- package/dist/src/components/RatingField/OrigamRatingField.vue +1 -2
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +2 -3
- package/dist/src/components/Select/OrigamSelect.vue +135 -105
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +7 -2
- package/dist/src/components/Slide/OrigamSlideGroup.vue +7 -10
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +9 -10
- package/dist/src/components/Stepper/OrigamStepper.vue +7 -11
- package/dist/src/components/Stepper/OrigamStepperItem.vue +2 -3
- package/dist/src/components/Switch/OrigamSwitch.vue +0 -9
- package/dist/src/components/Tabs/OrigamTabs.vue +1 -1
- package/dist/src/components/TextField/OrigamTextField.vue +2 -5
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +3 -2
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +13 -14
- package/dist/src/components/Transition/OrigamExpandX.vue +4 -10
- package/dist/src/components/Transition/OrigamExpandY.vue +4 -10
- package/dist/src/components/Transition/OrigamSnack.vue +2 -8
- package/dist/src/components/Transition/OrigamTranslateScale.vue +4 -1
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +24 -18
- package/dist/src/components/Video/OrigamVideo.vue +14 -19
- package/dist/src/components/Window/OrigamWindow.vue +4 -6
- package/dist/src/composables/Audio/use-waveform.composable.cjs +24 -19
- package/dist/src/composables/Audio/use-waveform.composable.js +24 -19
- package/dist/src/composables/Calendar/calendar.composable.cjs +11 -11
- package/dist/src/composables/Calendar/calendar.composable.js +1 -1
- package/dist/src/composables/Chart/chart.composable.cjs +541 -415
- package/dist/src/composables/Chart/chart.composable.d.ts +2 -5
- package/dist/src/composables/Chart/chart.composable.js +392 -338
- package/dist/src/composables/Code/code.composable.cjs +4 -4
- package/dist/src/composables/Code/code.composable.js +1 -1
- package/dist/src/composables/Commons/accessibleCommand.composable.cjs +2 -1
- package/dist/src/composables/Commons/accessibleCommand.composable.js +2 -1
- package/dist/src/composables/Commons/backButton.composable.cjs +14 -18
- package/dist/src/composables/Commons/backButton.composable.d.ts +4 -2
- package/dist/src/composables/Commons/backButton.composable.js +14 -18
- package/dist/src/composables/Commons/backgroundColor.composable.cjs +7 -3
- package/dist/src/composables/Commons/backgroundColor.composable.js +6 -3
- package/dist/src/composables/Commons/bothColor.composable.cjs +6 -2
- package/dist/src/composables/Commons/bothColor.composable.js +7 -4
- package/dist/src/composables/Commons/color.composable.cjs +106 -48
- package/dist/src/composables/Commons/color.composable.js +55 -48
- package/dist/src/composables/Commons/colorEffect.composable.cjs +2 -1
- package/dist/src/composables/Commons/colorEffect.composable.js +3 -1
- package/dist/src/composables/Commons/createLayout.composable.cjs +3 -2
- package/dist/src/composables/Commons/createLayout.composable.js +3 -2
- package/dist/src/composables/Commons/cssSupportClient.composable.d.ts +2 -1
- package/dist/src/composables/Commons/display.composable.cjs +7 -1
- package/dist/src/composables/Commons/display.composable.js +2 -2
- package/dist/src/composables/Commons/dragResizer.composable.cjs +16 -18
- package/dist/src/composables/Commons/dragResizer.composable.d.ts +2 -2
- package/dist/src/composables/Commons/dragResizer.composable.js +9 -11
- package/dist/src/composables/Commons/elevation.composable.cjs +2 -1
- package/dist/src/composables/Commons/elevation.composable.js +2 -1
- package/dist/src/composables/Commons/group.composable.cjs +17 -14
- package/dist/src/composables/Commons/group.composable.js +19 -15
- package/dist/src/composables/Commons/locationStrategies.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nested.composable.cjs +16 -16
- package/dist/src/composables/Commons/nested.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nested.composable.js +1 -1
- package/dist/src/composables/Commons/nestedItem.composable.cjs +3 -3
- package/dist/src/composables/Commons/nestedItem.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nestedItem.composable.js +1 -1
- package/dist/src/composables/Commons/passedProps.composable.cjs +1 -1
- package/dist/src/composables/Commons/passedProps.composable.js +1 -1
- package/dist/src/composables/Commons/size.composable.cjs +1 -1
- package/dist/src/composables/Commons/size.composable.js +1 -1
- package/dist/src/composables/Commons/stateEffect.composable.cjs +54 -32
- package/dist/src/composables/Commons/stateEffect.composable.js +43 -33
- package/dist/src/composables/Commons/teleport.composable.cjs +2 -1
- package/dist/src/composables/Commons/teleport.composable.js +4 -1
- package/dist/src/composables/Commons/textColor.composable.cjs +7 -3
- package/dist/src/composables/Commons/textColor.composable.js +6 -3
- package/dist/src/composables/Commons/touch.composable.cjs +80 -20
- package/dist/src/composables/Commons/touch.composable.js +80 -20
- package/dist/src/composables/Commons/vModel.composable.cjs +1 -1
- package/dist/src/composables/Commons/vModel.composable.js +1 -1
- package/dist/src/composables/Commons/validation.composable.cjs +1 -1
- package/dist/src/composables/Commons/validation.composable.js +1 -1
- package/dist/src/composables/Commons/velocity.composable.cjs +5 -1
- package/dist/src/composables/Commons/velocity.composable.js +5 -1
- package/dist/src/composables/DataTable/headers.composable.cjs +36 -30
- package/dist/src/composables/DataTable/headers.composable.d.ts +1 -1
- package/dist/src/composables/DataTable/headers.composable.js +29 -23
- package/dist/src/composables/DataTable/headersCell.composable.cjs +2 -2
- package/dist/src/composables/DataTable/headersCell.composable.js +1 -1
- package/dist/src/composables/DataTable/select.composable.cjs +4 -4
- package/dist/src/composables/DataTable/select.composable.js +1 -1
- package/dist/src/composables/DataTable/sort.composable.cjs +6 -6
- package/dist/src/composables/DataTable/sort.composable.js +1 -1
- package/dist/src/composables/Form/form.composable.cjs +1 -1
- package/dist/src/composables/Form/form.composable.js +3 -1
- package/dist/src/composables/Masonry/masonry.composable.cjs +29 -20
- package/dist/src/composables/Masonry/masonry.composable.d.ts +0 -14
- package/dist/src/composables/Masonry/masonry.composable.js +29 -20
- package/dist/src/composables/NumberFormat/number-format.composable.cjs +28 -23
- package/dist/src/composables/NumberFormat/number-format.composable.js +28 -23
- package/dist/src/composables/Parallax/parallax.composable.cjs +11 -19
- package/dist/src/composables/Parallax/parallax.composable.js +5 -13
- package/dist/src/composables/Parallax/transform.composable.cjs +14 -13
- package/dist/src/composables/Parallax/transform.composable.js +2 -1
- package/dist/src/composables/PasswordField/passwordStrength.composable.cjs +2 -2
- package/dist/src/composables/PasswordField/passwordStrength.composable.js +1 -1
- package/dist/src/composables/QrCode/qr-code.composable.cjs +1 -1
- package/dist/src/composables/QrCode/qr-code.composable.js +1 -1
- package/dist/src/composables/Sheet/sheetSwipe.composable.cjs +3 -4
- package/dist/src/composables/Sheet/sheetSwipe.composable.js +4 -4
- package/dist/src/composables/TextareaField/textarea-field-rich.composable.cjs +31 -31
- package/dist/src/composables/TextareaField/textarea-field-rich.composable.js +1 -1
- package/dist/src/composables/Watermark/watermark.composable.cjs +1 -1
- package/dist/src/composables/Watermark/watermark.composable.js +1 -1
- package/dist/src/consts/Audio/audio.const.cjs +5 -4
- package/dist/src/consts/Audio/audio.const.d.ts +2 -1
- package/dist/src/consts/Audio/audio.const.js +2 -1
- package/dist/src/consts/Blockquote/blockquote.const.cjs +3 -3
- package/dist/src/consts/Blockquote/blockquote.const.js +1 -1
- package/dist/src/consts/Bracket/bracket.const.cjs +4 -3
- package/dist/src/consts/Bracket/bracket.const.js +2 -1
- package/dist/src/consts/Code/code.const.cjs +3 -3
- package/dist/src/consts/Code/code.const.d.ts +1 -1
- package/dist/src/consts/Code/code.const.js +1 -1
- package/dist/src/consts/Commons/autocomplete.const.cjs +2 -2
- package/dist/src/consts/Commons/autocomplete.const.d.ts +1 -1
- package/dist/src/consts/Commons/autocomplete.const.js +1 -1
- package/dist/src/consts/Commons/border.const.cjs +5 -1
- package/dist/src/consts/Commons/border.const.js +5 -1
- package/dist/src/consts/Commons/display.const.cjs +2 -2
- package/dist/src/consts/Commons/display.const.js +1 -1
- package/dist/src/consts/Commons/hotkey.const.cjs +2 -2
- package/dist/src/consts/Commons/hotkey.const.js +1 -1
- package/dist/src/consts/Commons/margin.const.cjs +1 -1
- package/dist/src/consts/Commons/margin.const.js +1 -1
- package/dist/src/consts/Commons/padding.const.cjs +1 -1
- package/dist/src/consts/Commons/padding.const.js +1 -1
- package/dist/src/consts/Commons/rounded.const.cjs +6 -2
- package/dist/src/consts/Commons/rounded.const.js +6 -2
- package/dist/src/consts/EmptyState/empty-state.const.cjs +12 -12
- package/dist/src/consts/EmptyState/empty-state.const.js +6 -6
- package/dist/src/consts/PasswordField/password-field.const.cjs +1 -1
- package/dist/src/consts/PasswordField/password-field.const.js +1 -1
- package/dist/src/consts/QrCode/qr-code.const.cjs +2 -2
- package/dist/src/consts/QrCode/qr-code.const.js +1 -1
- package/dist/src/consts/TextField/text-field.const.cjs +21 -21
- package/dist/src/consts/TextField/text-field.const.d.ts +1 -2
- package/dist/src/consts/TextField/text-field.const.js +1 -2
- package/dist/src/consts/TextareaField/textarea-field.const.cjs +32 -4
- package/dist/src/consts/TextareaField/textarea-field.const.d.ts +1 -0
- package/dist/src/consts/TextareaField/textarea-field.const.js +29 -1
- package/dist/src/directives/Contrast/contrast.directive.cjs +6 -4
- package/dist/src/directives/Contrast/contrast.directive.js +6 -4
- package/dist/src/directives/Intersect/intersect.directive.cjs +2 -1
- package/dist/src/directives/Intersect/intersect.directive.js +2 -1
- package/dist/src/enums/BottomNav/bottom-nav.enum.cjs +4 -5
- package/dist/src/enums/BottomNav/bottom-nav.enum.js +4 -5
- package/dist/src/interfaces/Blockquote/blockquote.interface.d.ts +1 -1
- package/dist/src/interfaces/Chart/chart-map.interface.d.ts +5 -4
- package/dist/src/interfaces/Chart/chart.interface.d.ts +70 -1
- package/dist/src/interfaces/ColorPicker/color-picker.interface.d.ts +1 -1
- package/dist/src/interfaces/Commons/activator.interface.d.ts +1 -1
- package/dist/src/interfaces/Commons/border.interface.d.ts +11 -10
- package/dist/src/interfaces/Commons/filters.interface.d.ts +7 -0
- package/dist/src/interfaces/Commons/margin.interface.d.ts +12 -11
- package/dist/src/interfaces/Commons/padding.interface.d.ts +12 -11
- package/dist/src/interfaces/Commons/ripple.interface.d.ts +1 -3
- package/dist/src/interfaces/Commons/rounded.interface.d.ts +10 -9
- package/dist/src/interfaces/DataTable/sort.interface.d.ts +6 -0
- package/dist/src/interfaces/Grid/grid.interface.d.ts +4 -4
- package/dist/src/interfaces/Parallax/parallax.interface.d.ts +3 -2
- package/dist/src/interfaces/SliderField/slider-field.interface.d.ts +4 -4
- package/dist/src/origam-core.cjs +52 -34
- package/dist/src/origam-core.js +22 -28
- package/dist/src/types/Commons/box-value.type.cjs +1 -0
- package/dist/src/types/Commons/box-value.type.d.ts +1 -0
- package/dist/src/types/Commons/box-value.type.js +0 -0
- package/dist/src/types/Commons/location.type.d.ts +13 -0
- package/dist/src/types/Commons/point.type.d.ts +1 -1
- package/dist/src/types/DataTable/data-table.type.d.ts +1 -0
- package/dist/src/types/Grid/grid.type.d.ts +7 -0
- package/dist/src/types/Grids/row.type.d.ts +2 -1
- package/dist/src/types/Parallax/parallax.type.d.ts +1 -2
- package/dist/src/types/SliderField/slider-field.type.d.ts +8 -0
- package/dist/src/types/TextField/text-field.type.d.ts +2 -1
- package/dist/src/utils/Bracket/bracket-surface.util.cjs +9 -2
- package/dist/src/utils/Bracket/bracket-surface.util.js +9 -2
- package/dist/src/utils/Calendar/rrule.util.cjs +12 -7
- package/dist/src/utils/Calendar/rrule.util.js +12 -7
- package/dist/src/utils/Chart/chart-point.util.cjs +15 -0
- package/dist/src/utils/Chart/chart-point.util.d.ts +11 -0
- package/dist/src/utils/Chart/chart-point.util.js +8 -0
- package/dist/src/utils/Chart/sankey-layout.util.cjs +144 -0
- package/dist/src/utils/Chart/sankey-layout.util.d.ts +27 -0
- package/dist/src/utils/Chart/sankey-layout.util.js +130 -0
- package/dist/src/utils/Code/parse-highlight-lines.util.cjs +17 -14
- package/dist/src/utils/Code/parse-highlight-lines.util.js +17 -14
- package/dist/src/utils/CommandPalette/fuzzy-match.util.cjs +13 -9
- package/dist/src/utils/CommandPalette/fuzzy-match.util.js +13 -9
- package/dist/src/utils/Commons/anchor.util.cjs +6 -1
- package/dist/src/utils/Commons/anchor.util.js +6 -1
- package/dist/src/utils/Commons/animation.util.cjs +7 -4
- package/dist/src/utils/Commons/animation.util.js +4 -1
- package/dist/src/utils/Commons/apply-mask.util.cjs +11 -14
- package/dist/src/utils/Commons/apply-mask.util.js +7 -10
- package/dist/src/utils/Commons/apply-theme.util.cjs +6 -4
- package/dist/src/utils/Commons/apply-theme.util.js +6 -4
- package/dist/src/utils/Commons/bindProps.util.cjs +3 -5
- package/dist/src/utils/Commons/bindProps.util.js +3 -5
- package/dist/src/utils/Commons/color.util.cjs +43 -36
- package/dist/src/utils/Commons/color.util.js +44 -31
- package/dist/src/utils/Commons/commons.util.cjs +3 -3
- package/dist/src/utils/Commons/commons.util.js +3 -3
- package/dist/src/utils/Commons/console.util.cjs +6 -0
- package/dist/src/utils/Commons/console.util.d.ts +11 -0
- package/dist/src/utils/Commons/console.util.js +5 -0
- package/dist/src/utils/Commons/date.util.cjs +2 -27
- package/dist/src/utils/Commons/date.util.js +2 -27
- package/dist/src/utils/Commons/display.util.cjs +10 -1
- package/dist/src/utils/Commons/display.util.d.ts +8 -1
- package/dist/src/utils/Commons/display.util.js +9 -1
- package/dist/src/utils/Commons/eventListener.util.cjs +1 -2
- package/dist/src/utils/Commons/eventListener.util.js +1 -2
- package/dist/src/utils/Commons/filters.util.cjs +48 -34
- package/dist/src/utils/Commons/filters.util.d.ts +3 -8
- package/dist/src/utils/Commons/filters.util.js +47 -34
- package/dist/src/utils/Commons/forwardRefs.util.cjs +44 -40
- package/dist/src/utils/Commons/forwardRefs.util.js +44 -40
- package/dist/src/utils/Commons/group.util.cjs +1 -1
- package/dist/src/utils/Commons/group.util.js +1 -1
- package/dist/src/utils/Commons/hotkey.util.cjs +65 -61
- package/dist/src/utils/Commons/hotkey.util.js +56 -53
- package/dist/src/utils/Commons/hover.util.cjs +2 -2
- package/dist/src/utils/Commons/hover.util.js +2 -2
- package/dist/src/utils/Commons/locale.util.cjs +1 -1
- package/dist/src/utils/Commons/locale.util.js +1 -1
- package/dist/src/utils/Commons/location.util.cjs +87 -92
- package/dist/src/utils/Commons/location.util.js +75 -83
- package/dist/src/utils/Commons/nested.util.cjs +12 -10
- package/dist/src/utils/Commons/nested.util.js +5 -2
- package/dist/src/utils/Commons/point.util.cjs +16 -14
- package/dist/src/utils/Commons/point.util.js +13 -8
- package/dist/src/utils/Commons/ripple.util.cjs +4 -4
- package/dist/src/utils/Commons/ripple.util.js +4 -4
- package/dist/src/utils/Commons/scroll.util.cjs +9 -6
- package/dist/src/utils/Commons/scroll.util.js +9 -6
- package/dist/src/utils/Commons/spacing.util.cjs +1 -1
- package/dist/src/utils/Commons/spacing.util.js +1 -1
- package/dist/src/utils/Commons/token-name.util.cjs +31 -27
- package/dist/src/utils/Commons/token-name.util.js +31 -27
- package/dist/src/utils/Commons/validate-pattern.util.cjs +6 -6
- package/dist/src/utils/Commons/validate-pattern.util.js +1 -1
- package/dist/src/utils/DataTable/headers.util.cjs +20 -26
- package/dist/src/utils/DataTable/headers.util.js +18 -26
- package/dist/src/utils/DataTable/sort.util.cjs +41 -47
- package/dist/src/utils/DataTable/sort.util.d.ts +2 -7
- package/dist/src/utils/DataTable/sort.util.js +49 -47
- package/dist/src/utils/List/list-item.util.cjs +6 -1
- package/dist/src/utils/List/list-item.util.js +6 -1
- package/dist/src/utils/Parallax/parallax-element.util.cjs +13 -14
- package/dist/src/utils/Parallax/parallax-element.util.js +10 -11
- package/dist/src/utils/Slide/slide-group.util.cjs +4 -4
- package/dist/src/utils/Slide/slide-group.util.js +4 -4
- package/dist/src/utils/TextareaField/html-to-markdown.util.cjs +5 -36
- package/dist/src/utils/TextareaField/html-to-markdown.util.js +5 -36
- package/dist/src/utils/TextareaField/sanitize-html.util.cjs +18 -22
- package/dist/src/utils/TextareaField/sanitize-html.util.js +19 -23
- package/dist/src/utils/index.cjs +11 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { KEYBOARD_ALIASES } from "../../consts/Commons/hotkey.const.js";
|
|
2
2
|
import { consoleWarn } from "./console.util.js";
|
|
3
|
-
|
|
4
|
-
if (!combination) {
|
|
5
|
-
if (!isInternal) consoleWarn("Invalid hotkey combination: empty string provided");
|
|
6
|
-
return [];
|
|
7
|
-
}
|
|
3
|
+
function hasInvalidCombinationStructure(combination) {
|
|
8
4
|
const startsWithPlusOrUnderscore = combination.startsWith("+") || combination.startsWith("_");
|
|
9
5
|
const hasInvalidLeadingSeparator = (
|
|
10
6
|
// Starts with a single '+' or '_' followed by a non-separator character (e.g. '+a', '_a')
|
|
11
7
|
startsWithPlusOrUnderscore && !(combination.startsWith("++") || combination.startsWith("__"))
|
|
12
8
|
);
|
|
13
|
-
|
|
9
|
+
return (
|
|
14
10
|
// Invalid leading separator patterns
|
|
15
11
|
combination.length > 1 && hasInvalidLeadingSeparator || // Disallow literal + or _ keys (they require shift)
|
|
16
12
|
combination.includes("++") || combination.includes("__") || combination === "+" || combination === "_" || // Ends with a separator that is not part of a doubled literal
|
|
17
13
|
combination.length > 1 && (combination.endsWith("+") || combination.endsWith("_")) && combination.at(-2) !== combination.at(-1) || // Stand-alone doubled separators (dangling)
|
|
18
14
|
combination === "++" || combination === "--" || combination === "__"
|
|
19
15
|
);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
16
|
+
}
|
|
17
|
+
function parseCombinationKeys(combination) {
|
|
24
18
|
const keys = [];
|
|
25
19
|
let buffer = "";
|
|
26
20
|
const flushBuffer = () => {
|
|
@@ -32,74 +26,71 @@ export function splitKeyCombination(combination, isInternal = false) {
|
|
|
32
26
|
for (let i = 0; i < combination.length; i++) {
|
|
33
27
|
const char = combination[i];
|
|
34
28
|
const nextChar = combination[i + 1];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} else {
|
|
43
|
-
buffer += char;
|
|
44
|
-
}
|
|
29
|
+
const isSeparator = char === "+" || char === "_" || char === "-";
|
|
30
|
+
if (isSeparator && char === nextChar) {
|
|
31
|
+
flushBuffer();
|
|
32
|
+
keys.push(char);
|
|
33
|
+
i++;
|
|
34
|
+
} else if (char === "+" || char === "_") {
|
|
35
|
+
flushBuffer();
|
|
45
36
|
} else {
|
|
46
37
|
buffer += char;
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
flushBuffer();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
export function splitKeyCombination(combination, isInternal = false) {
|
|
44
|
+
if (!combination) {
|
|
45
|
+
if (!isInternal) consoleWarn("Invalid hotkey combination: empty string provided");
|
|
53
46
|
return [];
|
|
54
47
|
}
|
|
48
|
+
const warnInvalidStructure = () => {
|
|
49
|
+
if (!isInternal) consoleWarn(`Invalid hotkey combination: "${combination}" has invalid structure`);
|
|
50
|
+
return [];
|
|
51
|
+
};
|
|
52
|
+
if (hasInvalidCombinationStructure(combination)) return warnInvalidStructure();
|
|
53
|
+
const keys = parseCombinationKeys(combination);
|
|
54
|
+
const hasInvalidMinus = keys.some((key) => key.length > 1 && key.includes("-") && key !== "--");
|
|
55
|
+
if (hasInvalidMinus) return warnInvalidStructure();
|
|
55
56
|
if (keys.length === 0 && combination) {
|
|
56
57
|
return [normalizeKey(combination)];
|
|
57
58
|
}
|
|
58
59
|
return keys;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
if (!str) {
|
|
62
|
-
consoleWarn("Invalid hotkey sequence: empty string provided");
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
61
|
+
function hasInvalidSequenceEdges(str) {
|
|
65
62
|
const hasInvalidStart = str.startsWith("-") && !["---", "--+"].includes(str);
|
|
66
63
|
const hasInvalidEnd = str.endsWith("-") && !str.endsWith("+-") && !str.endsWith("_-") && str !== "-" && str !== "---";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
return hasInvalidStart || hasInvalidEnd;
|
|
65
|
+
}
|
|
66
|
+
function isHyphenInCombination(str, i) {
|
|
67
|
+
const prevChar = str[i - 1];
|
|
68
|
+
const prevPrevChar = i > 1 ? str[i - 2] : void 0;
|
|
69
|
+
return (prevChar === "+" || prevChar === "_") && prevPrevChar !== "+";
|
|
70
|
+
}
|
|
71
|
+
function tokenizeSequence(str) {
|
|
71
72
|
const result = [];
|
|
72
73
|
let buffer = "";
|
|
73
|
-
let i = 0;
|
|
74
|
-
while (i < str.length) {
|
|
74
|
+
for (let i = 0; i < str.length; i++) {
|
|
75
75
|
const char = str[i];
|
|
76
|
-
if (char
|
|
77
|
-
const prevChar = str[i - 1];
|
|
78
|
-
const prevPrevChar = i > 1 ? str[i - 2] : void 0;
|
|
79
|
-
const precededBySinglePlusOrUnderscore = (prevChar === "+" || prevChar === "_") && prevPrevChar !== "+";
|
|
80
|
-
if (precededBySinglePlusOrUnderscore) {
|
|
81
|
-
buffer += char;
|
|
82
|
-
i++;
|
|
83
|
-
} else {
|
|
84
|
-
if (buffer) {
|
|
85
|
-
result.push(buffer);
|
|
86
|
-
buffer = "";
|
|
87
|
-
} else {
|
|
88
|
-
result.push("-");
|
|
89
|
-
}
|
|
90
|
-
i++;
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
76
|
+
if (char !== "-" || isHyphenInCombination(str, i)) {
|
|
93
77
|
buffer += char;
|
|
94
|
-
|
|
78
|
+
} else if (buffer) {
|
|
79
|
+
result.push(buffer);
|
|
80
|
+
buffer = "";
|
|
81
|
+
} else {
|
|
82
|
+
result.push("-");
|
|
95
83
|
}
|
|
96
84
|
}
|
|
97
85
|
if (buffer) {
|
|
98
86
|
result.push(buffer);
|
|
99
87
|
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
function collapseMinusRuns(parts) {
|
|
100
91
|
const collapsed = [];
|
|
101
92
|
let minusCount = 0;
|
|
102
|
-
for (const part of
|
|
93
|
+
for (const part of parts) {
|
|
103
94
|
if (part === "-") {
|
|
104
95
|
if (minusCount % 2 === 0) collapsed.push("-");
|
|
105
96
|
minusCount++;
|
|
@@ -108,6 +99,18 @@ export function splitKeySequence(str) {
|
|
|
108
99
|
collapsed.push(part);
|
|
109
100
|
}
|
|
110
101
|
}
|
|
102
|
+
return collapsed;
|
|
103
|
+
}
|
|
104
|
+
export function splitKeySequence(str) {
|
|
105
|
+
if (!str) {
|
|
106
|
+
consoleWarn("Invalid hotkey sequence: empty string provided");
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
if (hasInvalidSequenceEdges(str)) {
|
|
110
|
+
consoleWarn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
const collapsed = collapseMinusRuns(tokenizeSequence(str));
|
|
111
114
|
const areAllValid = collapsed.every((s) => splitKeyCombination(s, true).length > 0);
|
|
112
115
|
if (!areAllValid) {
|
|
113
116
|
consoleWarn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
|
|
@@ -66,8 +66,8 @@ function hoverShow(e) {
|
|
|
66
66
|
if ((0, _ripple.isTouchEvent)(e)) {
|
|
67
67
|
element._hover.touched = true;
|
|
68
68
|
element._hover.isTouch = true;
|
|
69
|
-
} else {
|
|
70
|
-
|
|
69
|
+
} else if (element._hover.isTouch) {
|
|
70
|
+
return;
|
|
71
71
|
}
|
|
72
72
|
if (element._hover.class) {
|
|
73
73
|
value.class = element._hover.class;
|
|
@@ -42,8 +42,8 @@ export function hoverShow(e) {
|
|
|
42
42
|
if (isTouchEvent(e)) {
|
|
43
43
|
element._hover.touched = true;
|
|
44
44
|
element._hover.isTouch = true;
|
|
45
|
-
} else {
|
|
46
|
-
|
|
45
|
+
} else if (element._hover.isTouch) {
|
|
46
|
+
return;
|
|
47
47
|
}
|
|
48
48
|
if (element._hover.class) {
|
|
49
49
|
value.class = element._hover.class;
|
|
@@ -12,7 +12,7 @@ var _vModel = require("../../composables/Commons/vModel.composable.cjs");
|
|
|
12
12
|
function callI18nT(fn, key, params) {
|
|
13
13
|
if (typeof key !== "string" || !key) return key;
|
|
14
14
|
if (!params.length) return fn(key);
|
|
15
|
-
const list = params.map(p => p
|
|
15
|
+
const list = params.map(p => p ?? "");
|
|
16
16
|
return fn(key, list);
|
|
17
17
|
}
|
|
18
18
|
function createVueI18nAdapter({
|
|
@@ -3,7 +3,7 @@ import { useVModel } from "../../composables/Commons/vModel.composable.js";
|
|
|
3
3
|
function callI18nT(fn, key, params) {
|
|
4
4
|
if (typeof key !== "string" || !key) return key;
|
|
5
5
|
if (!params.length) return fn(key);
|
|
6
|
-
const list = params.map((p) => p
|
|
6
|
+
const list = params.map((p) => p ?? "");
|
|
7
7
|
return fn(key, list);
|
|
8
8
|
}
|
|
9
9
|
export function createVueI18nAdapter({ i18n, useI18n }) {
|
|
@@ -34,7 +34,7 @@ function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
34
34
|
preferredOrigin
|
|
35
35
|
} = (0, _commons.destructComputed)(() => {
|
|
36
36
|
const parsedAnchor = (0, _anchor.parseAnchor)(props.location);
|
|
37
|
-
const parsedOrigin = props.origin
|
|
37
|
+
const parsedOrigin = resolveOrigin(props.origin, parsedAnchor);
|
|
38
38
|
if (parsedAnchor.side === parsedOrigin.side && parsedAnchor.align === (0, _anchor.flipAlign)(parsedOrigin).align) {
|
|
39
39
|
return {
|
|
40
40
|
preferredAnchor: (0, _anchor.flipCorner)(parsedAnchor),
|
|
@@ -107,24 +107,7 @@ function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
107
107
|
contentBox.y -= parseFloat(document.documentElement.style.getPropertyValue("--origam-body-scroll-y") || "0");
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const viewport = scrollParents
|
|
111
|
-
const rect = el.getBoundingClientRect();
|
|
112
|
-
const scrollBox = new _box.Box({
|
|
113
|
-
x: el === document.documentElement ? 0 : rect.x,
|
|
114
|
-
y: el === document.documentElement ? 0 : rect.y,
|
|
115
|
-
width: el.clientWidth,
|
|
116
|
-
height: el.clientHeight
|
|
117
|
-
});
|
|
118
|
-
if (box) {
|
|
119
|
-
return new _box.Box({
|
|
120
|
-
x: Math.max(box.left, scrollBox.left),
|
|
121
|
-
y: Math.max(box.top, scrollBox.top),
|
|
122
|
-
width: Math.min(box.right, scrollBox.right) - Math.max(box.left, scrollBox.left),
|
|
123
|
-
height: Math.min(box.bottom, scrollBox.bottom) - Math.max(box.top, scrollBox.top)
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
return scrollBox;
|
|
127
|
-
}, void 0);
|
|
110
|
+
const viewport = intersectScrollParents(scrollParents);
|
|
128
111
|
viewport.x += viewportMargin;
|
|
129
112
|
viewport.y += viewportMargin;
|
|
130
113
|
viewport.width -= viewportMargin * 2;
|
|
@@ -141,34 +124,8 @@ function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
141
124
|
x: x2,
|
|
142
125
|
y: y2
|
|
143
126
|
} = (0, _point.getOffset)(targetPoint, contentPoint);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
y2 -= offset.value[0];
|
|
147
|
-
break;
|
|
148
|
-
case "bottom":
|
|
149
|
-
y2 += offset.value[0];
|
|
150
|
-
break;
|
|
151
|
-
case "left":
|
|
152
|
-
x2 -= offset.value[0];
|
|
153
|
-
break;
|
|
154
|
-
case "right":
|
|
155
|
-
x2 += offset.value[0];
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
switch (_placement.anchor.align) {
|
|
159
|
-
case "top":
|
|
160
|
-
y2 -= offset.value[1];
|
|
161
|
-
break;
|
|
162
|
-
case "bottom":
|
|
163
|
-
y2 += offset.value[1];
|
|
164
|
-
break;
|
|
165
|
-
case "left":
|
|
166
|
-
x2 -= offset.value[1];
|
|
167
|
-
break;
|
|
168
|
-
case "right":
|
|
169
|
-
x2 += offset.value[1];
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
127
|
+
[x2, y2] = applyEdgeOffset(x2, y2, _placement.anchor.side, offset.value[0]);
|
|
128
|
+
[x2, y2] = applyEdgeOffset(x2, y2, _placement.anchor.align, offset.value[1]);
|
|
172
129
|
box.x += x2;
|
|
173
130
|
box.y += y2;
|
|
174
131
|
box.width = Math.min(box.width, maxWidth.value);
|
|
@@ -205,51 +162,13 @@ function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
205
162
|
y += _y;
|
|
206
163
|
contentBox.x += _x;
|
|
207
164
|
contentBox.y += _y;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const newPlacement = {
|
|
216
|
-
anchor: {
|
|
217
|
-
...placement.anchor
|
|
218
|
-
},
|
|
219
|
-
origin: {
|
|
220
|
-
...placement.origin
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
const flip = key === _drag.AXIS.X ? axis2 === _drag.AXIS.Y ? _anchor.flipAlign : _anchor.flipSide : axis2 === _drag.AXIS.Y ? _anchor.flipSide : _anchor.flipAlign;
|
|
224
|
-
newPlacement.anchor = flip(newPlacement.anchor);
|
|
225
|
-
newPlacement.origin = flip(newPlacement.origin);
|
|
226
|
-
const {
|
|
227
|
-
overflows: newOverflows
|
|
228
|
-
} = checkOverflow(newPlacement);
|
|
229
|
-
if (newOverflows[key].before <= overflows[key].before && newOverflows[key].after <= overflows[key].after || newOverflows[key].before + newOverflows[key].after < (overflows[key].before + overflows[key].after) / 2) {
|
|
230
|
-
placement = newPlacement;
|
|
231
|
-
reset = flipped[key] = true;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
if (reset) continue;
|
|
236
|
-
}
|
|
237
|
-
if (overflows.x.before) {
|
|
238
|
-
x += overflows.x.before;
|
|
239
|
-
contentBox.x += overflows.x.before;
|
|
240
|
-
}
|
|
241
|
-
if (overflows.x.after) {
|
|
242
|
-
x -= overflows.x.after;
|
|
243
|
-
contentBox.x -= overflows.x.after;
|
|
244
|
-
}
|
|
245
|
-
if (overflows.y.before) {
|
|
246
|
-
y += overflows.y.before;
|
|
247
|
-
contentBox.y += overflows.y.before;
|
|
248
|
-
}
|
|
249
|
-
if (overflows.y.after) {
|
|
250
|
-
y -= overflows.y.after;
|
|
251
|
-
contentBox.y -= overflows.y.after;
|
|
252
|
-
}
|
|
165
|
+
const flip = flipPlacement(placement, overflows, flipped, checkOverflow);
|
|
166
|
+
placement = flip.placement;
|
|
167
|
+
if (flip.reset) continue;
|
|
168
|
+
x = shiftAxis(x, overflows.x);
|
|
169
|
+
contentBox.x = shiftAxis(contentBox.x, overflows.x);
|
|
170
|
+
y = shiftAxis(y, overflows.y);
|
|
171
|
+
contentBox.y = shiftAxis(contentBox.y, overflows.y);
|
|
253
172
|
{
|
|
254
173
|
const overflows2 = (0, _box2.getOverflow)(contentBox, viewport);
|
|
255
174
|
available.x = viewport.width - overflows2.x.before - overflows2.x.after;
|
|
@@ -299,6 +218,82 @@ function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
299
218
|
updateLocation
|
|
300
219
|
};
|
|
301
220
|
}
|
|
221
|
+
function resolveOrigin(origin, anchor) {
|
|
222
|
+
if (origin === "overlap") return anchor;
|
|
223
|
+
if (origin === "auto") return (0, _anchor.flipSide)(anchor);
|
|
224
|
+
return (0, _anchor.parseAnchor)(origin);
|
|
225
|
+
}
|
|
226
|
+
function intersectScrollParents(scrollParents) {
|
|
227
|
+
return scrollParents.reduce((box, el) => {
|
|
228
|
+
const rect = el.getBoundingClientRect();
|
|
229
|
+
const scrollBox = new _box.Box({
|
|
230
|
+
x: el === document.documentElement ? 0 : rect.x,
|
|
231
|
+
y: el === document.documentElement ? 0 : rect.y,
|
|
232
|
+
width: el.clientWidth,
|
|
233
|
+
height: el.clientHeight
|
|
234
|
+
});
|
|
235
|
+
if (box) {
|
|
236
|
+
return new _box.Box({
|
|
237
|
+
x: Math.max(box.left, scrollBox.left),
|
|
238
|
+
y: Math.max(box.top, scrollBox.top),
|
|
239
|
+
width: Math.min(box.right, scrollBox.right) - Math.max(box.left, scrollBox.left),
|
|
240
|
+
height: Math.min(box.bottom, scrollBox.bottom) - Math.max(box.top, scrollBox.top)
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return scrollBox;
|
|
244
|
+
}, void 0);
|
|
245
|
+
}
|
|
246
|
+
function applyEdgeOffset(x, y, edge, amount) {
|
|
247
|
+
switch (edge) {
|
|
248
|
+
case "top":
|
|
249
|
+
return [x, y - amount];
|
|
250
|
+
case "bottom":
|
|
251
|
+
return [x, y + amount];
|
|
252
|
+
case "left":
|
|
253
|
+
return [x - amount, y];
|
|
254
|
+
case "right":
|
|
255
|
+
return [x + amount, y];
|
|
256
|
+
default:
|
|
257
|
+
return [x, y];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function shiftAxis(value, overflow) {
|
|
261
|
+
if (overflow.before) value += overflow.before;
|
|
262
|
+
if (overflow.after) value -= overflow.after;
|
|
263
|
+
return value;
|
|
264
|
+
}
|
|
265
|
+
function flipPlacement(initial, overflows, flipped, checkOverflow) {
|
|
266
|
+
let placement = initial;
|
|
267
|
+
let reset = false;
|
|
268
|
+
const axis = (0, _anchor.getAxis)(placement.anchor);
|
|
269
|
+
const hasOverflow = {
|
|
270
|
+
x: overflows.x.before || overflows.x.after,
|
|
271
|
+
y: overflows.y.before || overflows.y.after
|
|
272
|
+
};
|
|
273
|
+
for (const key of [_drag.AXIS.X, _drag.AXIS.Y]) {
|
|
274
|
+
if (!hasOverflow[key] || flipped[key]) continue;
|
|
275
|
+
const flip = key === _drag.AXIS.X === (axis === _drag.AXIS.Y) ? _anchor.flipAlign : _anchor.flipSide;
|
|
276
|
+
const newPlacement = {
|
|
277
|
+
anchor: flip({
|
|
278
|
+
...placement.anchor
|
|
279
|
+
}),
|
|
280
|
+
origin: flip({
|
|
281
|
+
...placement.origin
|
|
282
|
+
})
|
|
283
|
+
};
|
|
284
|
+
const {
|
|
285
|
+
overflows: newOverflows
|
|
286
|
+
} = checkOverflow(newPlacement);
|
|
287
|
+
if (newOverflows[key].before <= overflows[key].before && newOverflows[key].after <= overflows[key].after || newOverflows[key].before + newOverflows[key].after < (overflows[key].before + overflows[key].after) / 2) {
|
|
288
|
+
placement = newPlacement;
|
|
289
|
+
reset = flipped[key] = true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return {
|
|
293
|
+
placement,
|
|
294
|
+
reset
|
|
295
|
+
};
|
|
296
|
+
}
|
|
302
297
|
function getIntrinsicSize(el) {
|
|
303
298
|
el.style.removeProperty("right");
|
|
304
299
|
const contentBox = (0, _animation.nullifyTransforms)(el);
|
|
@@ -21,7 +21,7 @@ export function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
21
21
|
}
|
|
22
22
|
const { preferredAnchor, preferredOrigin } = destructComputed(() => {
|
|
23
23
|
const parsedAnchor = parseAnchor(props.location);
|
|
24
|
-
const parsedOrigin = props.origin
|
|
24
|
+
const parsedOrigin = resolveOrigin(props.origin, parsedAnchor);
|
|
25
25
|
if (parsedAnchor.side === parsedOrigin.side && parsedAnchor.align === flipAlign(parsedOrigin).align) {
|
|
26
26
|
return {
|
|
27
27
|
preferredAnchor: flipCorner(parsedAnchor),
|
|
@@ -94,24 +94,7 @@ export function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
94
94
|
contentBox.y -= parseFloat(document.documentElement.style.getPropertyValue("--origam-body-scroll-y") || "0");
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
const viewport = scrollParents
|
|
98
|
-
const rect = el.getBoundingClientRect();
|
|
99
|
-
const scrollBox = new Box({
|
|
100
|
-
x: el === document.documentElement ? 0 : rect.x,
|
|
101
|
-
y: el === document.documentElement ? 0 : rect.y,
|
|
102
|
-
width: el.clientWidth,
|
|
103
|
-
height: el.clientHeight
|
|
104
|
-
});
|
|
105
|
-
if (box) {
|
|
106
|
-
return new Box({
|
|
107
|
-
x: Math.max(box.left, scrollBox.left),
|
|
108
|
-
y: Math.max(box.top, scrollBox.top),
|
|
109
|
-
width: Math.min(box.right, scrollBox.right) - Math.max(box.left, scrollBox.left),
|
|
110
|
-
height: Math.min(box.bottom, scrollBox.bottom) - Math.max(box.top, scrollBox.top)
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return scrollBox;
|
|
114
|
-
}, void 0);
|
|
97
|
+
const viewport = intersectScrollParents(scrollParents);
|
|
115
98
|
viewport.x += viewportMargin;
|
|
116
99
|
viewport.y += viewportMargin;
|
|
117
100
|
viewport.width -= viewportMargin * 2;
|
|
@@ -125,34 +108,8 @@ export function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
125
108
|
const targetPoint = anchorToPoint(_placement.anchor, targetBox);
|
|
126
109
|
const contentPoint = anchorToPoint(_placement.origin, box);
|
|
127
110
|
let { x: x2, y: y2 } = getOffset(targetPoint, contentPoint);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
y2 -= offset.value[0];
|
|
131
|
-
break;
|
|
132
|
-
case "bottom":
|
|
133
|
-
y2 += offset.value[0];
|
|
134
|
-
break;
|
|
135
|
-
case "left":
|
|
136
|
-
x2 -= offset.value[0];
|
|
137
|
-
break;
|
|
138
|
-
case "right":
|
|
139
|
-
x2 += offset.value[0];
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
switch (_placement.anchor.align) {
|
|
143
|
-
case "top":
|
|
144
|
-
y2 -= offset.value[1];
|
|
145
|
-
break;
|
|
146
|
-
case "bottom":
|
|
147
|
-
y2 += offset.value[1];
|
|
148
|
-
break;
|
|
149
|
-
case "left":
|
|
150
|
-
x2 -= offset.value[1];
|
|
151
|
-
break;
|
|
152
|
-
case "right":
|
|
153
|
-
x2 += offset.value[1];
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
111
|
+
[x2, y2] = applyEdgeOffset(x2, y2, _placement.anchor.side, offset.value[0]);
|
|
112
|
+
[x2, y2] = applyEdgeOffset(x2, y2, _placement.anchor.align, offset.value[1]);
|
|
156
113
|
box.x += x2;
|
|
157
114
|
box.y += y2;
|
|
158
115
|
box.width = Math.min(box.width, maxWidth.value);
|
|
@@ -175,42 +132,13 @@ export function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
175
132
|
y += _y;
|
|
176
133
|
contentBox.x += _x;
|
|
177
134
|
contentBox.y += _y;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const newPlacement = { anchor: { ...placement.anchor }, origin: { ...placement.origin } };
|
|
186
|
-
const flip = key === AXIS.X ? axis2 === AXIS.Y ? flipAlign : flipSide : axis2 === AXIS.Y ? flipSide : flipAlign;
|
|
187
|
-
newPlacement.anchor = flip(newPlacement.anchor);
|
|
188
|
-
newPlacement.origin = flip(newPlacement.origin);
|
|
189
|
-
const { overflows: newOverflows } = checkOverflow(newPlacement);
|
|
190
|
-
if (newOverflows[key].before <= overflows[key].before && newOverflows[key].after <= overflows[key].after || newOverflows[key].before + newOverflows[key].after < (overflows[key].before + overflows[key].after) / 2) {
|
|
191
|
-
placement = newPlacement;
|
|
192
|
-
reset = flipped[key] = true;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
if (reset) continue;
|
|
197
|
-
}
|
|
198
|
-
if (overflows.x.before) {
|
|
199
|
-
x += overflows.x.before;
|
|
200
|
-
contentBox.x += overflows.x.before;
|
|
201
|
-
}
|
|
202
|
-
if (overflows.x.after) {
|
|
203
|
-
x -= overflows.x.after;
|
|
204
|
-
contentBox.x -= overflows.x.after;
|
|
205
|
-
}
|
|
206
|
-
if (overflows.y.before) {
|
|
207
|
-
y += overflows.y.before;
|
|
208
|
-
contentBox.y += overflows.y.before;
|
|
209
|
-
}
|
|
210
|
-
if (overflows.y.after) {
|
|
211
|
-
y -= overflows.y.after;
|
|
212
|
-
contentBox.y -= overflows.y.after;
|
|
213
|
-
}
|
|
135
|
+
const flip = flipPlacement(placement, overflows, flipped, checkOverflow);
|
|
136
|
+
placement = flip.placement;
|
|
137
|
+
if (flip.reset) continue;
|
|
138
|
+
x = shiftAxis(x, overflows.x);
|
|
139
|
+
contentBox.x = shiftAxis(contentBox.x, overflows.x);
|
|
140
|
+
y = shiftAxis(y, overflows.y);
|
|
141
|
+
contentBox.y = shiftAxis(contentBox.y, overflows.y);
|
|
214
142
|
{
|
|
215
143
|
const overflows2 = getOverflow(contentBox, viewport);
|
|
216
144
|
available.x = viewport.width - overflows2.x.before - overflows2.x.after;
|
|
@@ -266,6 +194,70 @@ export function connectedLocationStrategy(data, props, contentStyles) {
|
|
|
266
194
|
});
|
|
267
195
|
return { updateLocation };
|
|
268
196
|
}
|
|
197
|
+
function resolveOrigin(origin, anchor) {
|
|
198
|
+
if (origin === "overlap") return anchor;
|
|
199
|
+
if (origin === "auto") return flipSide(anchor);
|
|
200
|
+
return parseAnchor(origin);
|
|
201
|
+
}
|
|
202
|
+
function intersectScrollParents(scrollParents) {
|
|
203
|
+
return scrollParents.reduce((box, el) => {
|
|
204
|
+
const rect = el.getBoundingClientRect();
|
|
205
|
+
const scrollBox = new Box({
|
|
206
|
+
x: el === document.documentElement ? 0 : rect.x,
|
|
207
|
+
y: el === document.documentElement ? 0 : rect.y,
|
|
208
|
+
width: el.clientWidth,
|
|
209
|
+
height: el.clientHeight
|
|
210
|
+
});
|
|
211
|
+
if (box) {
|
|
212
|
+
return new Box({
|
|
213
|
+
x: Math.max(box.left, scrollBox.left),
|
|
214
|
+
y: Math.max(box.top, scrollBox.top),
|
|
215
|
+
width: Math.min(box.right, scrollBox.right) - Math.max(box.left, scrollBox.left),
|
|
216
|
+
height: Math.min(box.bottom, scrollBox.bottom) - Math.max(box.top, scrollBox.top)
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return scrollBox;
|
|
220
|
+
}, void 0);
|
|
221
|
+
}
|
|
222
|
+
function applyEdgeOffset(x, y, edge, amount) {
|
|
223
|
+
switch (edge) {
|
|
224
|
+
case "top":
|
|
225
|
+
return [x, y - amount];
|
|
226
|
+
case "bottom":
|
|
227
|
+
return [x, y + amount];
|
|
228
|
+
case "left":
|
|
229
|
+
return [x - amount, y];
|
|
230
|
+
case "right":
|
|
231
|
+
return [x + amount, y];
|
|
232
|
+
default:
|
|
233
|
+
return [x, y];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function shiftAxis(value, overflow) {
|
|
237
|
+
if (overflow.before) value += overflow.before;
|
|
238
|
+
if (overflow.after) value -= overflow.after;
|
|
239
|
+
return value;
|
|
240
|
+
}
|
|
241
|
+
function flipPlacement(initial, overflows, flipped, checkOverflow) {
|
|
242
|
+
let placement = initial;
|
|
243
|
+
let reset = false;
|
|
244
|
+
const axis = getAxis(placement.anchor);
|
|
245
|
+
const hasOverflow = {
|
|
246
|
+
x: overflows.x.before || overflows.x.after,
|
|
247
|
+
y: overflows.y.before || overflows.y.after
|
|
248
|
+
};
|
|
249
|
+
for (const key of [AXIS.X, AXIS.Y]) {
|
|
250
|
+
if (!hasOverflow[key] || flipped[key]) continue;
|
|
251
|
+
const flip = key === AXIS.X === (axis === AXIS.Y) ? flipAlign : flipSide;
|
|
252
|
+
const newPlacement = { anchor: flip({ ...placement.anchor }), origin: flip({ ...placement.origin }) };
|
|
253
|
+
const { overflows: newOverflows } = checkOverflow(newPlacement);
|
|
254
|
+
if (newOverflows[key].before <= overflows[key].before && newOverflows[key].after <= overflows[key].after || newOverflows[key].before + newOverflows[key].after < (overflows[key].before + overflows[key].after) / 2) {
|
|
255
|
+
placement = newPlacement;
|
|
256
|
+
reset = flipped[key] = true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return { placement, reset };
|
|
260
|
+
}
|
|
269
261
|
export function getIntrinsicSize(el) {
|
|
270
262
|
el.style.removeProperty("right");
|
|
271
263
|
const contentBox = nullifyTransforms(el);
|