origam 2.41.0 → 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 +49 -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/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/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 +4 -2
- 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 +2 -3
- 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 +1 -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/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 +12 -13
- 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/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/Treeview/OrigamTreeviewNode.vue +24 -18
- package/dist/src/components/Video/OrigamVideo.vue +14 -19
- package/dist/src/components/Window/OrigamWindow.vue +2 -3
- 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/color.composable.cjs +106 -48
- package/dist/src/composables/Commons/color.composable.js +55 -48
- 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 +11 -10
- package/dist/src/composables/Commons/dragResizer.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/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/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/touch.composable.cjs +77 -33
- package/dist/src/composables/Commons/touch.composable.js +77 -33
- 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 +9 -9
- package/dist/src/composables/Parallax/parallax.composable.js +3 -3
- 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/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.js +1 -1
- 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 +5 -3
- package/dist/src/directives/Contrast/contrast.directive.js +5 -3
- package/dist/src/directives/Intersect/intersect.directive.cjs +2 -1
- package/dist/src/directives/Intersect/intersect.directive.js +2 -1
- 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/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/SliderField/slider-field.interface.d.ts +4 -4
- package/dist/src/origam-core.cjs +51 -33
- package/dist/src/origam-core.js +21 -27
- 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/SliderField/slider-field.type.d.ts +8 -0
- 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/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 +11 -11
- package/dist/src/utils/Commons/nested.util.js +1 -1
- 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/token-name.util.cjs +22 -21
- package/dist/src/utils/Commons/token-name.util.js +22 -21
- 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
|
@@ -24,6 +24,54 @@ function pickEffective(rest, isHover, isActive, hoverState, activeState, key) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
const noopRef = (0, _vue.computed)(() => false);
|
|
27
|
+
function resolveBgRole(isHover, isActive, hoverHasOwnBg, activeHasOwnBg) {
|
|
28
|
+
if (isHover && !hoverHasOwnBg) return "hover";
|
|
29
|
+
if (isActive && !activeHasOwnBg) return "active";
|
|
30
|
+
return "default";
|
|
31
|
+
}
|
|
32
|
+
function resolveBackground(bgColor, bgRole) {
|
|
33
|
+
if (bgColor && (0, _color.isIntent)(bgColor)) {
|
|
34
|
+
const m = (0, _color.tokenStylesForIntent)(bgColor, bgRole);
|
|
35
|
+
return {
|
|
36
|
+
bgDecl: `background-color: ${m["background-color"]}`,
|
|
37
|
+
bgIntentFg: (0, _color.tokenStylesForIntent)(bgColor, "default").color
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (bgColor === "transparent") {
|
|
41
|
+
return {
|
|
42
|
+
bgDecl: `background-color: ${(0, _color.rawBgExprWithState)("transparent", bgRole)}`,
|
|
43
|
+
bgIntentFg: null
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (bgColor && typeof bgColor === "string" && (0, _color.isCssColor)(bgColor)) {
|
|
47
|
+
(0, _color.warnLegacyColor)("bgColor", bgColor);
|
|
48
|
+
return {
|
|
49
|
+
bgDecl: `background-color: ${(0, _color.rawBgExprWithState)(bgColor, bgRole)}`,
|
|
50
|
+
bgIntentFg: null
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
bgDecl: null,
|
|
55
|
+
bgIntentFg: null
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function resolveForeground(color, bgColor, bgIntentFg) {
|
|
59
|
+
if (color && (0, _color.isIntent)(color)) {
|
|
60
|
+
const clash = bgIntentFg && bgColor && (0, _color.isIntent)(bgColor) && color === bgColor;
|
|
61
|
+
return `color: ${clash ? bgIntentFg : (0, _color.tokenForegroundForIntent)(color)}`;
|
|
62
|
+
}
|
|
63
|
+
if (color && typeof color === "string" && (0, _color.isCssColor)(color)) {
|
|
64
|
+
if (color !== "transparent") (0, _color.warnLegacyColor)("color", color);
|
|
65
|
+
return `color: ${color}`;
|
|
66
|
+
}
|
|
67
|
+
if (color) return null;
|
|
68
|
+
if (bgIntentFg) return `color: ${bgIntentFg}`;
|
|
69
|
+
if (bgColor && typeof bgColor === "string" && bgColor !== "transparent" && (0, _color.isParsableColor)(bgColor)) {
|
|
70
|
+
const parsed = (0, _color.parseColor)(bgColor);
|
|
71
|
+
if (parsed.a == null || parsed.a === 1) return `color: ${(0, _color.getForeground)(parsed)}`;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
27
75
|
function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState = (0, _vue.computed)(() => void 0), activeState = (0, _vue.computed)(() => void 0), isDisabled = noopRef, flat = noopRef) {
|
|
28
76
|
const statusToIntent = {
|
|
29
77
|
success: "success",
|
|
@@ -63,43 +111,17 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
|
|
|
63
111
|
void isDisabled.value;
|
|
64
112
|
const hoverHasOwnBg = hoverState.value?.bgColor != null && !sameIntent(hoverState.value.bgColor, props.bgColor);
|
|
65
113
|
const activeHasOwnBg = activeState.value?.bgColor != null && !sameIntent(activeState.value.bgColor, props.bgColor);
|
|
66
|
-
const bgRole = isHover.value
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
bgDecl = `background-color: ${m["background-color"]}`;
|
|
73
|
-
bgIntentFg = (0, _color.tokenStylesForIntent)(bgColor.value, "default").color;
|
|
74
|
-
} else if (bgColor.value === "transparent") {
|
|
75
|
-
bgDecl = `background-color: ${(0, _color.rawBgExprWithState)("transparent", bgRole)}`;
|
|
76
|
-
} else if (bgColor.value && typeof bgColor.value === "string" && (0, _color.isCssColor)(bgColor.value)) {
|
|
77
|
-
(0, _color.warnLegacyColor)("bgColor", bgColor.value);
|
|
78
|
-
bgDecl = `background-color: ${(0, _color.rawBgExprWithState)(bgColor.value, bgRole)}`;
|
|
79
|
-
}
|
|
80
|
-
if (color.value && (0, _color.isIntent)(color.value)) {
|
|
81
|
-
if (bgIntentFg && bgColor.value && (0, _color.isIntent)(bgColor.value) && color.value === bgColor.value) {
|
|
82
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
83
|
-
} else {
|
|
84
|
-
fgDecl = `color: ${(0, _color.tokenForegroundForIntent)(color.value)}`;
|
|
85
|
-
}
|
|
86
|
-
} else if (color.value && typeof color.value === "string" && (0, _color.isCssColor)(color.value)) {
|
|
87
|
-
if (color.value !== "transparent") (0, _color.warnLegacyColor)("color", color.value);
|
|
88
|
-
fgDecl = `color: ${color.value}`;
|
|
89
|
-
} else if (!color.value && bgIntentFg) {
|
|
90
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
91
|
-
} else if (!color.value && bgColor.value && typeof bgColor.value === "string" && bgColor.value !== "transparent" && (0, _color.isParsableColor)(bgColor.value)) {
|
|
92
|
-
const parsed = (0, _color.parseColor)(bgColor.value);
|
|
93
|
-
if (parsed.a == null || parsed.a === 1) {
|
|
94
|
-
fgDecl = `color: ${(0, _color.getForeground)(parsed)}`;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
114
|
+
const bgRole = resolveBgRole(isHover.value, isActive.value, hoverHasOwnBg, activeHasOwnBg);
|
|
115
|
+
const {
|
|
116
|
+
bgDecl,
|
|
117
|
+
bgIntentFg
|
|
118
|
+
} = resolveBackground(bgColor.value, bgRole);
|
|
119
|
+
const fgDecl = resolveForeground(color.value, bgColor.value, bgIntentFg);
|
|
97
120
|
const styles = [];
|
|
98
121
|
if (bgDecl) styles.push(bgDecl);
|
|
99
122
|
if (fgDecl) styles.push(fgDecl);
|
|
100
123
|
return styles;
|
|
101
124
|
});
|
|
102
|
-
void _color.intentBgExpr;
|
|
103
125
|
const {
|
|
104
126
|
borderClasses,
|
|
105
127
|
borderStyles
|
|
@@ -5,7 +5,7 @@ import { useMargin } from "./margin.composable.js";
|
|
|
5
5
|
import { useOpacity } from "./opacity.composable.js";
|
|
6
6
|
import { usePadding } from "./padding.composable.js";
|
|
7
7
|
import { useRounded } from "./rounded.composable.js";
|
|
8
|
-
import { getForeground,
|
|
8
|
+
import { getForeground, isCssColor, isIntent, isParsableColor, isUtilityIntent, parseColor, rawBgExprWithState, tokenForegroundForIntent, tokenStylesForIntent, warnLegacyColor } from "../../utils/Commons/color.util.js";
|
|
9
9
|
function pickEffective(rest, isHover, isActive, hoverState, activeState, key) {
|
|
10
10
|
return computed(() => {
|
|
11
11
|
if (isHover.value && hoverState.value?.[key] != null) {
|
|
@@ -18,6 +18,45 @@ function pickEffective(rest, isHover, isActive, hoverState, activeState, key) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
const noopRef = computed(() => false);
|
|
21
|
+
function resolveBgRole(isHover, isActive, hoverHasOwnBg, activeHasOwnBg) {
|
|
22
|
+
if (isHover && !hoverHasOwnBg) return "hover";
|
|
23
|
+
if (isActive && !activeHasOwnBg) return "active";
|
|
24
|
+
return "default";
|
|
25
|
+
}
|
|
26
|
+
function resolveBackground(bgColor, bgRole) {
|
|
27
|
+
if (bgColor && isIntent(bgColor)) {
|
|
28
|
+
const m = tokenStylesForIntent(bgColor, bgRole);
|
|
29
|
+
return {
|
|
30
|
+
bgDecl: `background-color: ${m["background-color"]}`,
|
|
31
|
+
bgIntentFg: tokenStylesForIntent(bgColor, "default").color
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (bgColor === "transparent") {
|
|
35
|
+
return { bgDecl: `background-color: ${rawBgExprWithState("transparent", bgRole)}`, bgIntentFg: null };
|
|
36
|
+
}
|
|
37
|
+
if (bgColor && typeof bgColor === "string" && isCssColor(bgColor)) {
|
|
38
|
+
warnLegacyColor("bgColor", bgColor);
|
|
39
|
+
return { bgDecl: `background-color: ${rawBgExprWithState(bgColor, bgRole)}`, bgIntentFg: null };
|
|
40
|
+
}
|
|
41
|
+
return { bgDecl: null, bgIntentFg: null };
|
|
42
|
+
}
|
|
43
|
+
function resolveForeground(color, bgColor, bgIntentFg) {
|
|
44
|
+
if (color && isIntent(color)) {
|
|
45
|
+
const clash = bgIntentFg && bgColor && isIntent(bgColor) && color === bgColor;
|
|
46
|
+
return `color: ${clash ? bgIntentFg : tokenForegroundForIntent(color)}`;
|
|
47
|
+
}
|
|
48
|
+
if (color && typeof color === "string" && isCssColor(color)) {
|
|
49
|
+
if (color !== "transparent") warnLegacyColor("color", color);
|
|
50
|
+
return `color: ${color}`;
|
|
51
|
+
}
|
|
52
|
+
if (color) return null;
|
|
53
|
+
if (bgIntentFg) return `color: ${bgIntentFg}`;
|
|
54
|
+
if (bgColor && typeof bgColor === "string" && bgColor !== "transparent" && isParsableColor(bgColor)) {
|
|
55
|
+
const parsed = parseColor(bgColor);
|
|
56
|
+
if (parsed.a == null || parsed.a === 1) return `color: ${getForeground(parsed)}`;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
21
60
|
export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState = computed(() => void 0), activeState = computed(() => void 0), isDisabled = noopRef, flat = noopRef) {
|
|
22
61
|
const statusToIntent = {
|
|
23
62
|
success: "success",
|
|
@@ -71,43 +110,14 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
|
|
|
71
110
|
void isDisabled.value;
|
|
72
111
|
const hoverHasOwnBg = hoverState.value?.bgColor != null && !sameIntent(hoverState.value.bgColor, props.bgColor);
|
|
73
112
|
const activeHasOwnBg = activeState.value?.bgColor != null && !sameIntent(activeState.value.bgColor, props.bgColor);
|
|
74
|
-
const bgRole = isHover.value
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
let bgIntentFg = null;
|
|
78
|
-
if (bgColor.value && isIntent(bgColor.value)) {
|
|
79
|
-
const m = tokenStylesForIntent(bgColor.value, bgRole);
|
|
80
|
-
bgDecl = `background-color: ${m["background-color"]}`;
|
|
81
|
-
bgIntentFg = tokenStylesForIntent(bgColor.value, "default").color;
|
|
82
|
-
} else if (bgColor.value === "transparent") {
|
|
83
|
-
bgDecl = `background-color: ${rawBgExprWithState("transparent", bgRole)}`;
|
|
84
|
-
} else if (bgColor.value && typeof bgColor.value === "string" && isCssColor(bgColor.value)) {
|
|
85
|
-
warnLegacyColor("bgColor", bgColor.value);
|
|
86
|
-
bgDecl = `background-color: ${rawBgExprWithState(bgColor.value, bgRole)}`;
|
|
87
|
-
}
|
|
88
|
-
if (color.value && isIntent(color.value)) {
|
|
89
|
-
if (bgIntentFg && bgColor.value && isIntent(bgColor.value) && color.value === bgColor.value) {
|
|
90
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
91
|
-
} else {
|
|
92
|
-
fgDecl = `color: ${tokenForegroundForIntent(color.value)}`;
|
|
93
|
-
}
|
|
94
|
-
} else if (color.value && typeof color.value === "string" && isCssColor(color.value)) {
|
|
95
|
-
if (color.value !== "transparent") warnLegacyColor("color", color.value);
|
|
96
|
-
fgDecl = `color: ${color.value}`;
|
|
97
|
-
} else if (!color.value && bgIntentFg) {
|
|
98
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
99
|
-
} else if (!color.value && bgColor.value && typeof bgColor.value === "string" && bgColor.value !== "transparent" && isParsableColor(bgColor.value)) {
|
|
100
|
-
const parsed = parseColor(bgColor.value);
|
|
101
|
-
if (parsed.a == null || parsed.a === 1) {
|
|
102
|
-
fgDecl = `color: ${getForeground(parsed)}`;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
113
|
+
const bgRole = resolveBgRole(isHover.value, isActive.value, hoverHasOwnBg, activeHasOwnBg);
|
|
114
|
+
const { bgDecl, bgIntentFg } = resolveBackground(bgColor.value, bgRole);
|
|
115
|
+
const fgDecl = resolveForeground(color.value, bgColor.value, bgIntentFg);
|
|
105
116
|
const styles = [];
|
|
106
117
|
if (bgDecl) styles.push(bgDecl);
|
|
107
118
|
if (fgDecl) styles.push(fgDecl);
|
|
108
119
|
return styles;
|
|
109
120
|
});
|
|
110
|
-
void intentBgExpr;
|
|
111
121
|
const { borderClasses, borderStyles } = useBorder(
|
|
112
122
|
reactive({
|
|
113
123
|
get border() {
|
|
@@ -14,7 +14,8 @@ function useTeleport(target) {
|
|
|
14
14
|
const _target = target.value;
|
|
15
15
|
if (_target === true || !_commons.IN_BROWSER) return void 0;
|
|
16
16
|
if (!isHydrated.value) return void 0;
|
|
17
|
-
|
|
17
|
+
let targetElement;
|
|
18
|
+
if (_target === false) targetElement = document.body;else if (typeof _target === "string") targetElement = document.querySelector(_target);else targetElement = _target;
|
|
18
19
|
if (targetElement == null) {
|
|
19
20
|
(0, _console.consoleWarn)(`Unable to locate target ${_target}`);
|
|
20
21
|
return void 0;
|
|
@@ -8,7 +8,10 @@ export function useTeleport(target) {
|
|
|
8
8
|
const _target = target.value;
|
|
9
9
|
if (_target === true || !IN_BROWSER) return void 0;
|
|
10
10
|
if (!isHydrated.value) return void 0;
|
|
11
|
-
|
|
11
|
+
let targetElement;
|
|
12
|
+
if (_target === false) targetElement = document.body;
|
|
13
|
+
else if (typeof _target === "string") targetElement = document.querySelector(_target);
|
|
14
|
+
else targetElement = _target;
|
|
12
15
|
if (targetElement == null) {
|
|
13
16
|
consoleWarn(`Unable to locate target ${_target}`);
|
|
14
17
|
return void 0;
|
|
@@ -42,35 +42,78 @@ function useTouch({
|
|
|
42
42
|
const dragProgress = (0, _vue.shallowRef)(0);
|
|
43
43
|
const offset = (0, _vue.shallowRef)(0);
|
|
44
44
|
let start;
|
|
45
|
+
const distanceFromEdge = pos => {
|
|
46
|
+
switch (position.value) {
|
|
47
|
+
case "left":
|
|
48
|
+
return pos;
|
|
49
|
+
case "right":
|
|
50
|
+
return document.documentElement.clientWidth - pos;
|
|
51
|
+
case "top":
|
|
52
|
+
return pos;
|
|
53
|
+
case "bottom":
|
|
54
|
+
return document.documentElement.clientHeight - pos;
|
|
55
|
+
default:
|
|
56
|
+
return (0, _commons.oops)();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
45
59
|
const getOffset = (pos, active) => {
|
|
46
|
-
return (
|
|
60
|
+
return distanceFromEdge(pos) - (active ? width.value : 0);
|
|
47
61
|
};
|
|
48
62
|
const getProgress = (pos, limit = true) => {
|
|
49
|
-
const progress =
|
|
63
|
+
const progress = (distanceFromEdge(pos) - offset.value) / width.value;
|
|
50
64
|
return limit ? Math.max(0, Math.min(1, progress)) : progress;
|
|
51
65
|
};
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
const isInTouchZone = (touchX, touchY) => {
|
|
67
|
+
switch (position.value) {
|
|
68
|
+
case "left":
|
|
69
|
+
return touchX < _touch.TOUCH_EDGE_ZONE_PX;
|
|
70
|
+
case "right":
|
|
71
|
+
return touchX > document.documentElement.clientWidth - _touch.TOUCH_EDGE_ZONE_PX;
|
|
72
|
+
case "top":
|
|
73
|
+
return touchY < _touch.TOUCH_EDGE_ZONE_PX;
|
|
74
|
+
case "bottom":
|
|
75
|
+
return touchY > document.documentElement.clientHeight - _touch.TOUCH_EDGE_ZONE_PX;
|
|
76
|
+
default:
|
|
77
|
+
return (0, _commons.oops)();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const isInsidePanel = (touchX, touchY) => {
|
|
57
81
|
switch (position.value) {
|
|
58
82
|
case "left":
|
|
59
|
-
|
|
60
|
-
break;
|
|
83
|
+
return touchX < width.value;
|
|
61
84
|
case "right":
|
|
62
|
-
|
|
63
|
-
break;
|
|
85
|
+
return touchX > document.documentElement.clientWidth - width.value;
|
|
64
86
|
case "top":
|
|
65
|
-
|
|
66
|
-
break;
|
|
87
|
+
return touchY < width.value;
|
|
67
88
|
case "bottom":
|
|
68
|
-
|
|
69
|
-
break;
|
|
89
|
+
return touchY > document.documentElement.clientHeight - width.value;
|
|
70
90
|
default:
|
|
71
|
-
|
|
91
|
+
return (0, _commons.oops)();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const trackDragIntent = (e, touchX, touchY) => {
|
|
95
|
+
if (!maybeDragging) return true;
|
|
96
|
+
if (!e.cancelable) {
|
|
97
|
+
maybeDragging = false;
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const dx = Math.abs(touchX - start[0]);
|
|
101
|
+
const dy = Math.abs(touchY - start[1]);
|
|
102
|
+
const thresholdMet = isHorizontal.value ? dx > dy && dx > _touch.TOUCH_DRAG_THRESHOLD_PX : dy > dx && dy > _touch.TOUCH_DRAG_THRESHOLD_PX;
|
|
103
|
+
if (thresholdMet) {
|
|
104
|
+
isDragging.value = true;
|
|
105
|
+
maybeDragging = false;
|
|
106
|
+
} else if ((isHorizontal.value ? dy : dx) > _touch.TOUCH_DRAG_THRESHOLD_PX) {
|
|
107
|
+
maybeDragging = false;
|
|
72
108
|
}
|
|
73
|
-
|
|
109
|
+
return true;
|
|
110
|
+
};
|
|
111
|
+
const handleTouchstart = e => {
|
|
112
|
+
if (touchless.value) return;
|
|
113
|
+
const touchX = e.changedTouches[0].clientX;
|
|
114
|
+
const touchY = e.changedTouches[0].clientY;
|
|
115
|
+
const inTouchZone = isInTouchZone(touchX, touchY);
|
|
116
|
+
const inElement = isActive.value && isInsidePanel(touchX, touchY);
|
|
74
117
|
if (inTouchZone || inElement || isActive.value && isTemporary.value) {
|
|
75
118
|
maybeDragging = true;
|
|
76
119
|
start = [touchX, touchY];
|
|
@@ -83,21 +126,7 @@ function useTouch({
|
|
|
83
126
|
const handleTouchmove = e => {
|
|
84
127
|
const touchX = e.changedTouches[0].clientX;
|
|
85
128
|
const touchY = e.changedTouches[0].clientY;
|
|
86
|
-
if (
|
|
87
|
-
if (!e.cancelable) {
|
|
88
|
-
maybeDragging = false;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const dx = Math.abs(touchX - start[0]);
|
|
92
|
-
const dy = Math.abs(touchY - start[1]);
|
|
93
|
-
const thresholdMet = isHorizontal.value ? dx > dy && dx > _touch.TOUCH_DRAG_THRESHOLD_PX : dy > dx && dy > _touch.TOUCH_DRAG_THRESHOLD_PX;
|
|
94
|
-
if (thresholdMet) {
|
|
95
|
-
isDragging.value = true;
|
|
96
|
-
maybeDragging = false;
|
|
97
|
-
} else if ((isHorizontal.value ? dy : dx) > _touch.TOUCH_DRAG_THRESHOLD_PX) {
|
|
98
|
-
maybeDragging = false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
129
|
+
if (!trackDragIntent(e, touchX, touchY)) return;
|
|
101
130
|
if (!isDragging.value) return;
|
|
102
131
|
e.preventDefault();
|
|
103
132
|
addMovement(e);
|
|
@@ -124,9 +153,24 @@ function useTouch({
|
|
|
124
153
|
isActive.value = dragProgress.value > _touch.TOUCH_SETTLE_PROGRESS;
|
|
125
154
|
}
|
|
126
155
|
};
|
|
156
|
+
const dragTransform = () => {
|
|
157
|
+
const travelled = dragProgress.value * width.value;
|
|
158
|
+
switch (position.value) {
|
|
159
|
+
case "left":
|
|
160
|
+
return `translateX(calc(-100% + ${travelled}px))`;
|
|
161
|
+
case "right":
|
|
162
|
+
return `translateX(calc(100% - ${travelled}px))`;
|
|
163
|
+
case "top":
|
|
164
|
+
return `translateY(calc(-100% + ${travelled}px))`;
|
|
165
|
+
case "bottom":
|
|
166
|
+
return `translateY(calc(100% - ${travelled}px))`;
|
|
167
|
+
default:
|
|
168
|
+
return (0, _commons.oops)();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
127
171
|
const dragStyles = (0, _vue.computed)(() => {
|
|
128
172
|
return isDragging.value ? {
|
|
129
|
-
transform:
|
|
173
|
+
transform: dragTransform(),
|
|
130
174
|
transition: "none"
|
|
131
175
|
} : void 0;
|
|
132
176
|
});
|
|
@@ -27,35 +27,78 @@ export function useTouch({ isActive, isTemporary, width, touchless, position })
|
|
|
27
27
|
const dragProgress = shallowRef(0);
|
|
28
28
|
const offset = shallowRef(0);
|
|
29
29
|
let start;
|
|
30
|
+
const distanceFromEdge = (pos) => {
|
|
31
|
+
switch (position.value) {
|
|
32
|
+
case "left":
|
|
33
|
+
return pos;
|
|
34
|
+
case "right":
|
|
35
|
+
return document.documentElement.clientWidth - pos;
|
|
36
|
+
case "top":
|
|
37
|
+
return pos;
|
|
38
|
+
case "bottom":
|
|
39
|
+
return document.documentElement.clientHeight - pos;
|
|
40
|
+
default:
|
|
41
|
+
return oops();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
30
44
|
const getOffset = (pos, active) => {
|
|
31
|
-
return (
|
|
45
|
+
return distanceFromEdge(pos) - (active ? width.value : 0);
|
|
32
46
|
};
|
|
33
47
|
const getProgress = (pos, limit = true) => {
|
|
34
|
-
const progress =
|
|
48
|
+
const progress = (distanceFromEdge(pos) - offset.value) / width.value;
|
|
35
49
|
return limit ? Math.max(0, Math.min(1, progress)) : progress;
|
|
36
50
|
};
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
const isInTouchZone = (touchX, touchY) => {
|
|
52
|
+
switch (position.value) {
|
|
53
|
+
case "left":
|
|
54
|
+
return touchX < TOUCH_EDGE_ZONE_PX;
|
|
55
|
+
case "right":
|
|
56
|
+
return touchX > document.documentElement.clientWidth - TOUCH_EDGE_ZONE_PX;
|
|
57
|
+
case "top":
|
|
58
|
+
return touchY < TOUCH_EDGE_ZONE_PX;
|
|
59
|
+
case "bottom":
|
|
60
|
+
return touchY > document.documentElement.clientHeight - TOUCH_EDGE_ZONE_PX;
|
|
61
|
+
default:
|
|
62
|
+
return oops();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const isInsidePanel = (touchX, touchY) => {
|
|
42
66
|
switch (position.value) {
|
|
43
67
|
case "left":
|
|
44
|
-
|
|
45
|
-
break;
|
|
68
|
+
return touchX < width.value;
|
|
46
69
|
case "right":
|
|
47
|
-
|
|
48
|
-
break;
|
|
70
|
+
return touchX > document.documentElement.clientWidth - width.value;
|
|
49
71
|
case "top":
|
|
50
|
-
|
|
51
|
-
break;
|
|
72
|
+
return touchY < width.value;
|
|
52
73
|
case "bottom":
|
|
53
|
-
|
|
54
|
-
break;
|
|
74
|
+
return touchY > document.documentElement.clientHeight - width.value;
|
|
55
75
|
default:
|
|
56
|
-
|
|
76
|
+
return oops();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const trackDragIntent = (e, touchX, touchY) => {
|
|
80
|
+
if (!maybeDragging) return true;
|
|
81
|
+
if (!e.cancelable) {
|
|
82
|
+
maybeDragging = false;
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const dx = Math.abs(touchX - start[0]);
|
|
86
|
+
const dy = Math.abs(touchY - start[1]);
|
|
87
|
+
const thresholdMet = isHorizontal.value ? dx > dy && dx > TOUCH_DRAG_THRESHOLD_PX : dy > dx && dy > TOUCH_DRAG_THRESHOLD_PX;
|
|
88
|
+
if (thresholdMet) {
|
|
89
|
+
isDragging.value = true;
|
|
90
|
+
maybeDragging = false;
|
|
91
|
+
} else if ((isHorizontal.value ? dy : dx) > TOUCH_DRAG_THRESHOLD_PX) {
|
|
92
|
+
maybeDragging = false;
|
|
57
93
|
}
|
|
58
|
-
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
const handleTouchstart = (e) => {
|
|
97
|
+
if (touchless.value) return;
|
|
98
|
+
const touchX = e.changedTouches[0].clientX;
|
|
99
|
+
const touchY = e.changedTouches[0].clientY;
|
|
100
|
+
const inTouchZone = isInTouchZone(touchX, touchY);
|
|
101
|
+
const inElement = isActive.value && isInsidePanel(touchX, touchY);
|
|
59
102
|
if (inTouchZone || inElement || isActive.value && isTemporary.value) {
|
|
60
103
|
maybeDragging = true;
|
|
61
104
|
start = [touchX, touchY];
|
|
@@ -68,21 +111,7 @@ export function useTouch({ isActive, isTemporary, width, touchless, position })
|
|
|
68
111
|
const handleTouchmove = (e) => {
|
|
69
112
|
const touchX = e.changedTouches[0].clientX;
|
|
70
113
|
const touchY = e.changedTouches[0].clientY;
|
|
71
|
-
if (
|
|
72
|
-
if (!e.cancelable) {
|
|
73
|
-
maybeDragging = false;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const dx = Math.abs(touchX - start[0]);
|
|
77
|
-
const dy = Math.abs(touchY - start[1]);
|
|
78
|
-
const thresholdMet = isHorizontal.value ? dx > dy && dx > TOUCH_DRAG_THRESHOLD_PX : dy > dx && dy > TOUCH_DRAG_THRESHOLD_PX;
|
|
79
|
-
if (thresholdMet) {
|
|
80
|
-
isDragging.value = true;
|
|
81
|
-
maybeDragging = false;
|
|
82
|
-
} else if ((isHorizontal.value ? dy : dx) > TOUCH_DRAG_THRESHOLD_PX) {
|
|
83
|
-
maybeDragging = false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
114
|
+
if (!trackDragIntent(e, touchX, touchY)) return;
|
|
86
115
|
if (!isDragging.value) return;
|
|
87
116
|
e.preventDefault();
|
|
88
117
|
addMovement(e);
|
|
@@ -109,9 +138,24 @@ export function useTouch({ isActive, isTemporary, width, touchless, position })
|
|
|
109
138
|
isActive.value = dragProgress.value > TOUCH_SETTLE_PROGRESS;
|
|
110
139
|
}
|
|
111
140
|
};
|
|
141
|
+
const dragTransform = () => {
|
|
142
|
+
const travelled = dragProgress.value * width.value;
|
|
143
|
+
switch (position.value) {
|
|
144
|
+
case "left":
|
|
145
|
+
return `translateX(calc(-100% + ${travelled}px))`;
|
|
146
|
+
case "right":
|
|
147
|
+
return `translateX(calc(100% - ${travelled}px))`;
|
|
148
|
+
case "top":
|
|
149
|
+
return `translateY(calc(-100% + ${travelled}px))`;
|
|
150
|
+
case "bottom":
|
|
151
|
+
return `translateY(calc(100% - ${travelled}px))`;
|
|
152
|
+
default:
|
|
153
|
+
return oops();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
112
156
|
const dragStyles = computed(() => {
|
|
113
157
|
return isDragging.value ? {
|
|
114
|
-
transform:
|
|
158
|
+
transform: dragTransform(),
|
|
115
159
|
transition: "none"
|
|
116
160
|
} : void 0;
|
|
117
161
|
});
|
|
@@ -16,7 +16,7 @@ function useVModel(props, prop, defaultValue, transformIn = v => v, transformOut
|
|
|
16
16
|
const internalValue = () => internal.value === _vmodel.UNSEEDED ? seed() : internal.value;
|
|
17
17
|
const kebabProp = (0, _commons.toKebabCase)(prop);
|
|
18
18
|
const checkKebab = kebabProp !== prop;
|
|
19
|
-
const has = key => Object.
|
|
19
|
+
const has = key => Object.hasOwn(vm.vnode.props ?? {}, key);
|
|
20
20
|
const isControlled = checkKebab ? (0, _vue.computed)(() => {
|
|
21
21
|
void props[prop];
|
|
22
22
|
return (has(prop) || has(kebabProp)) && (has(`onUpdate:${prop}`) || has(`onUpdate:${kebabProp}`));
|
|
@@ -10,7 +10,7 @@ export function useVModel(props, prop, defaultValue, transformIn = (v) => v, tra
|
|
|
10
10
|
const internalValue = () => internal.value === UNSEEDED ? seed() : internal.value;
|
|
11
11
|
const kebabProp = toKebabCase(prop);
|
|
12
12
|
const checkKebab = kebabProp !== prop;
|
|
13
|
-
const has = (key) => Object.
|
|
13
|
+
const has = (key) => Object.hasOwn(vm.vnode.props ?? {}, key);
|
|
14
14
|
const isControlled = checkKebab ? computed(() => {
|
|
15
15
|
void props[prop];
|
|
16
16
|
return (has(prop) || has(kebabProp)) && (has(`onUpdate:${prop}`) || has(`onUpdate:${kebabProp}`));
|
|
@@ -47,7 +47,7 @@ function useValidation(props, name = (0, _getCurrentInstance.getCurrentInstanceN
|
|
|
47
47
|
});
|
|
48
48
|
const isValid = (0, _vue.computed)(() => {
|
|
49
49
|
if (props.error || props.errorMessages?.length) return false;
|
|
50
|
-
if (!props.rules
|
|
50
|
+
if (!props.rules?.length) return true;
|
|
51
51
|
if (isPristine.value) {
|
|
52
52
|
return internalErrorMessages.value.length || validateOn.value.lazy ? void 0 : true;
|
|
53
53
|
} else {
|
|
@@ -52,7 +52,7 @@ export function useValidation(props, name = getCurrentInstanceName(), id = getUi
|
|
|
52
52
|
});
|
|
53
53
|
const isValid = computed(() => {
|
|
54
54
|
if (props.error || props.errorMessages?.length) return false;
|
|
55
|
-
if (!props.rules
|
|
55
|
+
if (!props.rules?.length) return true;
|
|
56
56
|
if (isPristine.value) {
|
|
57
57
|
return internalErrorMessages.value.length || validateOn.value.lazy ? void 0 : true;
|
|
58
58
|
} else {
|
|
@@ -49,7 +49,11 @@ function useVelocity() {
|
|
|
49
49
|
y: y2
|
|
50
50
|
} = this;
|
|
51
51
|
const [absX, absY] = [Math.abs(x2), Math.abs(y2)];
|
|
52
|
-
|
|
52
|
+
if (absX > absY && x2 >= 0) return "right";
|
|
53
|
+
if (absX > absY && x2 <= 0) return "left";
|
|
54
|
+
if (absY > absX && y2 >= 0) return "down";
|
|
55
|
+
if (absY > absX && y2 <= 0) return "up";
|
|
56
|
+
return (0, _commons2.oops)();
|
|
53
57
|
}
|
|
54
58
|
};
|
|
55
59
|
}
|
|
@@ -34,7 +34,11 @@ export function useVelocity() {
|
|
|
34
34
|
get direction() {
|
|
35
35
|
const { x: x2, y: y2 } = this;
|
|
36
36
|
const [absX, absY] = [Math.abs(x2), Math.abs(y2)];
|
|
37
|
-
|
|
37
|
+
if (absX > absY && x2 >= 0) return "right";
|
|
38
|
+
if (absX > absY && x2 <= 0) return "left";
|
|
39
|
+
if (absY > absX && y2 >= 0) return "down";
|
|
40
|
+
if (absY > absX && y2 <= 0) return "up";
|
|
41
|
+
return oops();
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
}
|