ropav 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/accordion.css +17 -17
- package/dist/accordion.js +123 -155
- package/dist/alert.css +18 -18
- package/dist/alert.js +10 -11
- package/dist/ancestry.js +136 -0
- package/dist/aria.js +14 -0
- package/dist/aspect-ratio.js +1 -1
- package/dist/attributes.js +9 -0
- package/dist/attributes2.js +29 -0
- package/dist/avatar.css +19 -19
- package/dist/avatar.js +9 -17
- package/dist/badge.css +16 -16
- package/dist/badge.js +5 -5
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +4 -3
- package/dist/button.js +4 -3
- package/dist/button.scss_vue_type_style_index_0_src_true_lang.js +1 -1
- package/dist/calendar.css +173 -0
- package/dist/calendar.js +714 -0
- package/dist/calendar2.js +37 -0
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +22 -28
- package/dist/chevron-left.js +12 -0
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +7 -6
- package/dist/collectionNavigation.js +2 -99
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +14 -13
- package/dist/color-picker.css +40 -40
- package/dist/color-picker.js +247 -276
- package/dist/color-picker2.js +1 -9
- package/dist/color-swatch.css +4 -4
- package/dist/color-swatch.js +6 -8
- package/dist/color.js +5 -10
- package/dist/combobox.css +251 -0
- package/dist/combobox.js +410 -0
- package/dist/componentColors.js +125 -84
- package/dist/componentRef.js +26 -0
- package/dist/components/accordion/accordionContext.d.ts +3 -0
- package/dist/components/accordion/accordionModel.d.ts +14 -0
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/types.d.ts +1 -2
- package/dist/components/accordion/useAccordion.d.ts +2 -2
- package/dist/components/accordion/useAccordionItem.d.ts +2 -0
- package/dist/components/calendar/calendar.d.ts +30 -0
- package/dist/components/calendar/calendarBehavior.d.ts +49 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.js +3 -0
- package/dist/components/calendar/types.d.ts +53 -0
- package/dist/components/calendar/useCalendar.d.ts +24 -0
- package/dist/components/checkbox/useCheckbox.d.ts +1 -2
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +2 -2
- package/dist/components/color-picker/useColorPickerDrag.d.ts +1 -1
- package/dist/components/color-picker/useColorPickerSaturation.d.ts +22 -0
- package/dist/components/color-picker/useColorPickerSlider.d.ts +20 -0
- package/dist/components/color-picker/useColorPickerValue.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts +29 -0
- package/dist/components/combobox/comboboxModel.d.ts +4 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/combobox/types.d.ts +43 -0
- package/dist/components/combobox/useCombobox.d.ts +45 -0
- package/dist/components/date-picker/date-picker.d.ts +33 -0
- package/dist/components/date-picker/datePickerModel.d.ts +10 -0
- package/dist/components/date-picker/index.d.ts +4 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/date-picker/types.d.ts +57 -0
- package/dist/components/date-picker/useDatePicker.d.ts +29 -0
- package/dist/components/date-picker/useDatePickerValueState.d.ts +21 -0
- package/dist/components/dialog/{dialog-core.d.ts → dialogContext.d.ts} +1 -5
- package/dist/components/dialog/useDialogContentInteractions.d.ts +18 -0
- package/dist/components/dialog/useDialogRootState.d.ts +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-model.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +17 -30
- package/dist/components/dropdown-menu/dropdownMenuDataModel.d.ts +20 -0
- package/dist/components/dropdown-menu/dropdownMenuInteraction.d.ts +3 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionNavigation.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionRegistry.d.ts +42 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionTypes.d.ts +114 -0
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +11 -11
- package/dist/components/dropdown-menu/useDropdownMenuContextTrigger.d.ts +9 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataController.d.ts +35 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +24 -0
- package/dist/components/dropdown-menu/useDropdownMenuHoverIntent.d.ts +6 -5
- package/dist/components/dropdown-menu/useDropdownMenuInteractionDismissal.d.ts +17 -0
- package/dist/components/dropdown-menu/useDropdownMenuInteractionKeyboard.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +0 -1
- package/dist/components/dropdown-menu/useDropdownMenuPresentation.d.ts +28 -0
- package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +2 -2
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +1 -1
- package/dist/components/dropdown-menu/useDropdownMenuTargetBindings.d.ts +19 -0
- package/dist/components/dropzone/dropzone.d.ts +31 -0
- package/dist/components/dropzone/dropzoneModel.d.ts +16 -0
- package/dist/components/dropzone/index.d.ts +3 -0
- package/dist/components/dropzone/index.js +2 -0
- package/dist/components/dropzone/types.d.ts +56 -0
- package/dist/components/dropzone/useDropzone.d.ts +25 -0
- package/dist/components/file-input/file-input.d.ts +29 -0
- package/dist/components/file-input/index.d.ts +3 -0
- package/dist/components/file-input/index.js +2 -0
- package/dist/components/file-input/types.d.ts +37 -0
- package/dist/components/file-input/useFileInput.d.ts +15 -0
- package/dist/components/floating/index.js +2 -2
- package/dist/components/floating/useFloatingPosition.d.ts +1 -14
- package/dist/components/floating/useFloatingTargetLifecycle.d.ts +32 -0
- package/dist/components/floating/useHoverDisclosure.d.ts +10 -0
- package/dist/components/hover-card/hover-card.d.ts +25 -0
- package/dist/components/hover-card/index.d.ts +3 -0
- package/dist/components/hover-card/index.js +2 -0
- package/dist/components/hover-card/types.d.ts +45 -0
- package/dist/components/hover-card/useHoverCard.d.ts +22 -0
- package/dist/components/hover-card/useHoverCardDisclosure.d.ts +19 -0
- package/dist/components/multi-select/index.d.ts +3 -0
- package/dist/components/multi-select/index.js +2 -0
- package/dist/components/multi-select/multi-select.d.ts +30 -0
- package/dist/components/multi-select/multiSelectModel.d.ts +3 -0
- package/dist/components/multi-select/types.d.ts +49 -0
- package/dist/components/multi-select/useMultiSelect.d.ts +46 -0
- package/dist/components/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +3 -19
- package/dist/components/pagination/index.d.ts +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/paginationModel.d.ts +4 -0
- package/dist/components/pagination/types.d.ts +15 -0
- package/dist/components/pagination/usePagination.d.ts +3 -19
- package/dist/components/popover/usePopoverBindings.d.ts +13 -0
- package/dist/components/progress/progressModel.d.ts +8 -0
- package/dist/components/progress/useProgress.d.ts +0 -6
- package/dist/components/radio/useRadio.d.ts +1 -2
- package/dist/components/scroll-area/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area/scrollAreaModel.d.ts +64 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +70 -53
- package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -17
- package/dist/components/scroll-area/useScrollAreaDerivedState.d.ts +8 -0
- package/dist/components/scroll-area/useScrollAreaMeasurement.d.ts +35 -0
- package/dist/components/scroll-area/useScrollAreaPointer.d.ts +11 -9
- package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
- package/dist/components/segmented-control/index.d.ts +3 -0
- package/dist/components/segmented-control/index.js +2 -0
- package/dist/components/segmented-control/segmented-control.d.ts +26 -0
- package/dist/components/segmented-control/types.d.ts +47 -0
- package/dist/components/segmented-control/useSegmentedControl.d.ts +15 -0
- package/dist/components/select/useSelect.d.ts +31 -19
- package/dist/components/slider/rangeSliderModel.d.ts +41 -0
- package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +0 -1
- package/dist/components/slider/useRangeSlider.d.ts +9 -17
- package/dist/components/slider/useRangeSliderPointer.d.ts +1 -1
- package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
- package/dist/components/slider/useSlider.d.ts +7 -13
- package/dist/components/slider/useSliderPointerPreview.d.ts +22 -0
- package/dist/components/slider/useSliderTooltipState.d.ts +40 -0
- package/dist/components/slider/useSliderValueState.d.ts +33 -0
- package/dist/components/tags-input/index.d.ts +3 -0
- package/dist/components/tags-input/index.js +2 -0
- package/dist/components/tags-input/tags-input.d.ts +27 -0
- package/dist/components/tags-input/tagsInputModel.d.ts +12 -0
- package/dist/components/tags-input/types.d.ts +37 -0
- package/dist/components/tags-input/useTagsInput.d.ts +23 -0
- package/dist/components/teleport-provider/index.js +1 -1
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
- package/dist/components/toast/useToastLifecycle.d.ts +19 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -2
- package/dist/components/tooltip/useTooltipTargetBindings.d.ts +12 -0
- package/dist/css.js +12 -0
- package/dist/date-picker.css +49 -0
- package/dist/date-picker.js +809 -0
- package/dist/dialog.js +215 -218
- package/dist/direction.js +6 -0
- package/dist/dropdown-menu.css +21 -3
- package/dist/dropdown-menu.js +1626 -1185
- package/dist/dropzone.css +135 -0
- package/dist/dropzone.js +431 -0
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/file-input.css +135 -0
- package/dist/file-input.js +198 -0
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/hover-card.css +80 -0
- package/dist/hover-card.js +402 -0
- package/dist/icon-button.css +8 -8
- package/dist/icon-button.js +7 -6
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20 -9
- package/dist/input.css +24 -24
- package/dist/input.js +19 -31
- package/dist/interactive.js +18 -0
- package/dist/internal/composables/useOverlayLayer.d.ts +12 -0
- package/dist/modal.js +2 -2
- package/dist/multi-select.css +316 -0
- package/dist/multi-select.js +481 -0
- package/dist/nativeChoice.js +169 -0
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +44 -44
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +66 -73
- package/dist/pointerSession.js +130 -0
- package/dist/popover.css +55 -37
- package/dist/popover.js +75 -101
- package/dist/progress.js +10 -13
- package/dist/query.js +40 -0
- package/dist/radio.css +18 -18
- package/dist/radio.js +30 -36
- package/dist/rafScheduler.js +34 -0
- package/dist/scroll-area.css +28 -28
- package/dist/scroll-area.js +540 -554
- package/dist/segmented-control.css +176 -0
- package/dist/segmented-control.js +382 -0
- package/dist/select.css +50 -48
- package/dist/select.js +131 -289
- package/dist/slider.css +191 -191
- package/dist/slider.js +720 -706
- package/dist/styles-api.d.ts +0 -1
- package/dist/styles-api.js +1 -4
- package/dist/switch.css +17 -17
- package/dist/switch.js +14 -15
- package/dist/tabs.css +43 -43
- package/dist/tabs.js +29 -56
- package/dist/tags-input.css +197 -0
- package/dist/tags-input.js +380 -0
- package/dist/text.js +17 -0
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +21 -32
- package/dist/toast.css +26 -26
- package/dist/toast.js +141 -118
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +64 -63
- package/dist/useCollapse.js +8 -11
- package/dist/useControlState.js +3 -6
- package/dist/useEditableOptionList.js +216 -0
- package/dist/useFlatOptionCollection.js +134 -0
- package/dist/useFloatingPosition.js +14 -40
- package/dist/useFloatingTargetLifecycle.js +127 -0
- package/dist/useFormControl.js +1 -0
- package/dist/useHoverDisclosure.js +561 -0
- package/dist/useNativeChoiceTransaction.js +46 -0
- package/dist/useNativeFileSelection.js +86 -0
- package/dist/useOverlayZIndex.js +246 -19
- package/dist/useTeleportTarget.js +3 -14
- package/dist/useTypeahead.js +94 -0
- package/dist/utils/aria.d.ts +3 -0
- package/dist/utils/attributes.d.ts +2 -0
- package/dist/utils/bem.d.ts +3 -0
- package/dist/utils/collectionNavigation.d.ts +2 -0
- package/dist/utils/color.d.ts +7 -0
- package/dist/{components/color-picker/color-picker-utils.d.ts → utils/colorPicker.d.ts} +5 -4
- package/dist/utils/componentColors.d.ts +7 -0
- package/dist/utils/css.d.ts +3 -0
- package/dist/utils/date.d.ts +13 -0
- package/dist/utils/dateAvailability.d.ts +7 -0
- package/dist/utils/dom/ancestry.d.ts +8 -0
- package/dist/utils/dom/attributes.d.ts +16 -0
- package/dist/utils/dom/componentRef.d.ts +4 -0
- package/dist/utils/dom/direction.d.ts +2 -0
- package/dist/utils/dom/events.d.ts +5 -0
- package/dist/utils/dom/files.d.ts +3 -0
- package/dist/utils/dom/focusNavigation.d.ts +7 -0
- package/dist/utils/dom/interactive.d.ts +2 -0
- package/dist/utils/dom/nativeChoice.d.ts +17 -0
- package/dist/utils/dom/pointerSession.d.ts +20 -0
- package/dist/utils/dom/query.d.ts +4 -0
- package/dist/utils/dom/scroll.d.ts +24 -0
- package/dist/utils/floatingOffset.d.ts +10 -0
- package/dist/utils/geometry.d.ts +14 -0
- package/dist/utils/indexPath.d.ts +6 -0
- package/dist/utils/number.d.ts +4 -0
- package/dist/utils/optionFilter.d.ts +5 -0
- package/dist/utils/rafScheduler.d.ts +4 -0
- package/dist/utils/text.d.ts +2 -0
- package/docs/code-architecture.md +118 -0
- package/docs/public-floating-api.md +13 -9
- package/docs/public-styles-api.md +25 -12
- package/package.json +51 -14
- package/src/styles/_mixins.scss +26 -0
- package/src/styles/styles-manifest.json +1 -2
- package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +0 -3
- package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +0 -21
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +0 -36
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +0 -29
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +0 -52
- package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +0 -17
- package/dist/components/dropdown-menu/useDropdownSubmenus.d.ts +0 -18
- package/dist/components/scroll-area/scrollAreaCore.d.ts +0 -30
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -38
- package/dist/components/select/useSelectNativeControl.d.ts +0 -9
- package/dist/components/select/useSelectNativeValue.d.ts +0 -9
- package/dist/floating.js +0 -415
- /package/dist/components/alert/{useAlertColor.d.ts → alertColor.d.ts} +0 -0
- /package/dist/components/avatar/{useAvatarColor.d.ts → avatarColor.d.ts} +0 -0
- /package/dist/components/badge/{useBadgeColor.d.ts → badgeColor.d.ts} +0 -0
- /package/dist/components/button/{useButtonColor.d.ts → buttonColor.d.ts} +0 -0
- /package/dist/components/color-swatch/{useColorSwatchColor.d.ts → colorSwatchColor.d.ts} +0 -0
- /package/dist/components/toast/{useToastColor.d.ts → toastColor.d.ts} +0 -0
package/dist/useOverlayZIndex.js
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
|
+
import { n as isEventWithinElement } from "./events.js";
|
|
2
|
+
import { n as observeComposedAncestry } from "./ancestry.js";
|
|
1
3
|
import { computed, inject, onBeforeUnmount, provide, readonly, ref, shallowRef, toValue, watch } from "vue";
|
|
2
4
|
//#region src/internal/composables/useOverlayLayer.ts
|
|
3
5
|
var overlayLayerKey = Symbol("overlay-layer");
|
|
4
6
|
var documentStates = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
var activeInteractionLayers = [];
|
|
8
|
+
var interactionListenerDefinitions = {
|
|
9
|
+
escapeKeyDown: {
|
|
10
|
+
capture: false,
|
|
11
|
+
eventName: "keydown",
|
|
12
|
+
outside: false,
|
|
13
|
+
matches: (event) => event.key === "Escape"
|
|
14
|
+
},
|
|
15
|
+
pointerDownOutside: {
|
|
16
|
+
capture: true,
|
|
17
|
+
eventName: "pointerdown",
|
|
18
|
+
outside: true
|
|
19
|
+
},
|
|
20
|
+
focusOutside: {
|
|
21
|
+
capture: true,
|
|
22
|
+
eventName: "focusin",
|
|
23
|
+
outside: true
|
|
24
|
+
},
|
|
25
|
+
clickOutside: {
|
|
26
|
+
capture: true,
|
|
27
|
+
eventName: "click",
|
|
28
|
+
outside: true
|
|
29
|
+
}
|
|
30
|
+
};
|
|
5
31
|
var layerMetadata = /* @__PURE__ */ new WeakMap();
|
|
6
32
|
function createState() {
|
|
7
33
|
return {
|
|
8
34
|
layers: [],
|
|
35
|
+
interactionLayers: [],
|
|
9
36
|
inertSnapshots: /* @__PURE__ */ new Map(),
|
|
37
|
+
interactionListeners: {},
|
|
10
38
|
originalBodyOverflow: "",
|
|
11
39
|
scrollLocked: false,
|
|
12
40
|
observer: null,
|
|
@@ -28,6 +56,24 @@ function isDescendantLayer(layer, ancestor) {
|
|
|
28
56
|
}
|
|
29
57
|
return false;
|
|
30
58
|
}
|
|
59
|
+
function insertLayer(layers, layer) {
|
|
60
|
+
const currentIndex = layers.indexOf(layer);
|
|
61
|
+
if (currentIndex >= 0) layers.splice(currentIndex, 1);
|
|
62
|
+
const descendantIndex = layers.findIndex((candidate) => isDescendantLayer(candidate, layer));
|
|
63
|
+
if (descendantIndex >= 0) layers.splice(descendantIndex, 0, layer);
|
|
64
|
+
else layers.push(layer);
|
|
65
|
+
}
|
|
66
|
+
function insertPhysicalLayer(layers, layer) {
|
|
67
|
+
removeLayerFromStack(layers, layer);
|
|
68
|
+
const layerIndex = activeInteractionLayers.indexOf(layer);
|
|
69
|
+
const nextIndex = layers.findIndex((candidate) => activeInteractionLayers.indexOf(candidate) > layerIndex);
|
|
70
|
+
if (nextIndex >= 0) layers.splice(nextIndex, 0, layer);
|
|
71
|
+
else layers.push(layer);
|
|
72
|
+
}
|
|
73
|
+
function removeLayerFromStack(layers, layer) {
|
|
74
|
+
const index = layers.indexOf(layer);
|
|
75
|
+
if (index >= 0) layers.splice(index, 1);
|
|
76
|
+
}
|
|
31
77
|
function syncLayerZIndices(state) {
|
|
32
78
|
let highestZIndex = Number.NEGATIVE_INFINITY;
|
|
33
79
|
for (const layer of state.layers) {
|
|
@@ -38,10 +84,64 @@ function syncLayerZIndices(state) {
|
|
|
38
84
|
highestZIndex = zIndex;
|
|
39
85
|
}
|
|
40
86
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
87
|
+
function syncDocumentInteractionLayers(document) {
|
|
88
|
+
const state = getState(document);
|
|
89
|
+
state.interactionLayers = activeInteractionLayers.filter((layer) => layerMetadata.get(layer)?.interactionDocuments.has(document));
|
|
90
|
+
syncInteractionListeners(document, state);
|
|
91
|
+
}
|
|
92
|
+
function reconcileInteractionDocuments(layer) {
|
|
93
|
+
const affectedDocuments = /* @__PURE__ */ new Set();
|
|
94
|
+
const layers = activeInteractionLayers.filter((candidate) => candidate === layer || isDescendantLayer(candidate, layer));
|
|
95
|
+
if (!layers.includes(layer)) layers.unshift(layer);
|
|
96
|
+
for (const candidate of layers) {
|
|
97
|
+
const metadata = layerMetadata.get(candidate);
|
|
98
|
+
if (!metadata) continue;
|
|
99
|
+
for (const document of metadata.interactionDocuments) affectedDocuments.add(document);
|
|
100
|
+
const nextDocuments = metadata.registered ? new Set(metadata.ownInteractionDocuments) : /* @__PURE__ */ new Set();
|
|
101
|
+
const parentDocuments = metadata.parent ? layerMetadata.get(metadata.parent)?.interactionDocuments : void 0;
|
|
102
|
+
if (metadata.registered && parentDocuments) for (const document of parentDocuments) nextDocuments.add(document);
|
|
103
|
+
metadata.interactionDocuments = nextDocuments;
|
|
104
|
+
for (const document of nextDocuments) affectedDocuments.add(document);
|
|
105
|
+
}
|
|
106
|
+
for (const document of affectedDocuments) syncDocumentInteractionLayers(document);
|
|
107
|
+
}
|
|
108
|
+
function hasInteractionHandler(state, name) {
|
|
109
|
+
return state.interactionLayers.some((layer) => [...layerMetadata.get(layer)?.interactions ?? []].some((interaction) => typeof interaction[name] === "function"));
|
|
110
|
+
}
|
|
111
|
+
function routeLayerInteraction(state, name, event) {
|
|
112
|
+
const layer = state.interactionLayers[state.interactionLayers.length - 1];
|
|
113
|
+
if (!layer) return;
|
|
114
|
+
const definition = interactionListenerDefinitions[name];
|
|
115
|
+
if (definition.matches && !definition.matches(event)) return;
|
|
116
|
+
const interactions = [...layerMetadata.get(layer)?.interactions ?? []];
|
|
117
|
+
for (const interaction of interactions) {
|
|
118
|
+
const handler = interaction[name];
|
|
119
|
+
if (!handler) continue;
|
|
120
|
+
const additionalInside = interaction.inside ? toValue(interaction.inside) : [];
|
|
121
|
+
if (definition.outside && layer.isInside(event, additionalInside)) continue;
|
|
122
|
+
handler(event);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function syncInteractionListeners(document, state) {
|
|
126
|
+
for (const name of Object.keys(interactionListenerDefinitions)) {
|
|
127
|
+
const existing = state.interactionListeners[name];
|
|
128
|
+
if (!hasInteractionHandler(state, name)) {
|
|
129
|
+
if (existing) {
|
|
130
|
+
document.removeEventListener(existing.eventName, existing.listener, existing.capture);
|
|
131
|
+
delete state.interactionListeners[name];
|
|
132
|
+
}
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (existing) continue;
|
|
136
|
+
const definition = interactionListenerDefinitions[name];
|
|
137
|
+
const listener = (event) => routeLayerInteraction(state, name, event);
|
|
138
|
+
document.addEventListener(definition.eventName, listener, definition.capture);
|
|
139
|
+
state.interactionListeners[name] = {
|
|
140
|
+
capture: definition.capture,
|
|
141
|
+
eventName: definition.eventName,
|
|
142
|
+
listener
|
|
143
|
+
};
|
|
144
|
+
}
|
|
45
145
|
}
|
|
46
146
|
function restoreInertBackground(state) {
|
|
47
147
|
for (const [element, snapshot] of state.inertSnapshots) {
|
|
@@ -127,11 +227,41 @@ function syncModalEffects(document, state) {
|
|
|
127
227
|
}
|
|
128
228
|
}
|
|
129
229
|
function removeLayer(layer, document, state) {
|
|
130
|
-
|
|
131
|
-
if (index >= 0) state.layers.splice(index, 1);
|
|
230
|
+
removeLayerFromStack(state.layers, layer);
|
|
132
231
|
syncLayerZIndices(state);
|
|
133
232
|
syncModalEffects(document, state);
|
|
134
233
|
}
|
|
234
|
+
function createOverlayLayerAncestryObserver(options) {
|
|
235
|
+
let cleanups = [];
|
|
236
|
+
let disposed = false;
|
|
237
|
+
function stop() {
|
|
238
|
+
for (const cleanup of cleanups) cleanup();
|
|
239
|
+
cleanups = [];
|
|
240
|
+
}
|
|
241
|
+
function reset() {
|
|
242
|
+
stop();
|
|
243
|
+
if (disposed || !options.active.value) return;
|
|
244
|
+
const content = options.element.value;
|
|
245
|
+
if (content) cleanups.push(observeComposedAncestry(() => [content], options.onContentChange, { deferWhileDisconnected: true }));
|
|
246
|
+
const auxiliaryElements = new Set(options.branches);
|
|
247
|
+
for (const interaction of options.interactions) {
|
|
248
|
+
if (!interaction.inside) continue;
|
|
249
|
+
for (const element of toValue(interaction.inside)) if (element) auxiliaryElements.add(element);
|
|
250
|
+
}
|
|
251
|
+
if (content) auxiliaryElements.delete(content);
|
|
252
|
+
for (const element of auxiliaryElements) cleanups.push(observeComposedAncestry(() => [element], options.onAuxiliaryChange, {
|
|
253
|
+
deferWhileDisconnected: true,
|
|
254
|
+
notifyOnDisconnect: true
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
reset,
|
|
259
|
+
dispose() {
|
|
260
|
+
disposed = true;
|
|
261
|
+
stop();
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
135
265
|
function useOverlayLayer(options) {
|
|
136
266
|
const parent = inject(overlayLayerKey, null);
|
|
137
267
|
const active = computed(() => Boolean(toValue(options.active)));
|
|
@@ -142,14 +272,26 @@ function useOverlayLayer(options) {
|
|
|
142
272
|
const branchSet = /* @__PURE__ */ new Set();
|
|
143
273
|
const focusBranchSet = /* @__PURE__ */ new Set();
|
|
144
274
|
const insideBranchSet = /* @__PURE__ */ new Set();
|
|
275
|
+
const interactions = /* @__PURE__ */ new Set();
|
|
276
|
+
const interactionSetRevision = ref(0);
|
|
145
277
|
const baseZIndex = computed(() => toValue(options.baseZIndex ?? 100));
|
|
146
278
|
const zIndex = ref(baseZIndex.value);
|
|
147
279
|
let registeredDocument = null;
|
|
148
280
|
let registeredElement = null;
|
|
149
281
|
let parentBranchCleanup;
|
|
282
|
+
const ancestryObserver = createOverlayLayerAncestryObserver({
|
|
283
|
+
active,
|
|
284
|
+
element: options.element,
|
|
285
|
+
branches: branchSet,
|
|
286
|
+
interactions,
|
|
287
|
+
onContentChange: syncObservedAncestry,
|
|
288
|
+
onAuxiliaryChange: syncObservedAuxiliaryAncestry
|
|
289
|
+
});
|
|
150
290
|
function syncBranches() {
|
|
151
291
|
branches.value = [...branchSet];
|
|
152
292
|
focusBranches.value = [...focusBranchSet];
|
|
293
|
+
syncOwnInteractionDocuments();
|
|
294
|
+
ancestryObserver.reset();
|
|
153
295
|
if (registeredDocument) syncModalEffects(registeredDocument, getState(registeredDocument));
|
|
154
296
|
}
|
|
155
297
|
function registerBranch(element, branchOptions = {}) {
|
|
@@ -170,6 +312,36 @@ function useOverlayLayer(options) {
|
|
|
170
312
|
parentBranchCleanup?.();
|
|
171
313
|
parentBranchCleanup = element ? parent?.registerBranch(element) : void 0;
|
|
172
314
|
}
|
|
315
|
+
function connectInteraction(interaction) {
|
|
316
|
+
interactions.add(interaction);
|
|
317
|
+
interactionSetRevision.value += 1;
|
|
318
|
+
let connected = true;
|
|
319
|
+
return Object.assign(() => {
|
|
320
|
+
if (!connected) return;
|
|
321
|
+
connected = false;
|
|
322
|
+
interactions.delete(interaction);
|
|
323
|
+
interactionSetRevision.value += 1;
|
|
324
|
+
}, { refresh() {
|
|
325
|
+
if (!connected) return;
|
|
326
|
+
syncOwnInteractionDocuments();
|
|
327
|
+
ancestryObserver.reset();
|
|
328
|
+
} });
|
|
329
|
+
}
|
|
330
|
+
function readOwnInteractionDocuments() {
|
|
331
|
+
const documents = /* @__PURE__ */ new Set();
|
|
332
|
+
if (registeredElement) documents.add(registeredElement.ownerDocument);
|
|
333
|
+
for (const branch of branchSet) if (branch.isConnected) documents.add(branch.ownerDocument);
|
|
334
|
+
for (const interaction of interactions) if (interaction.inside) {
|
|
335
|
+
for (const element of toValue(interaction.inside)) if (element?.isConnected) documents.add(element.ownerDocument);
|
|
336
|
+
}
|
|
337
|
+
return [...documents];
|
|
338
|
+
}
|
|
339
|
+
function syncOwnInteractionDocuments(documents = readOwnInteractionDocuments()) {
|
|
340
|
+
const metadata = layerMetadata.get(context);
|
|
341
|
+
if (!metadata) return;
|
|
342
|
+
metadata.ownInteractionDocuments = new Set(documents);
|
|
343
|
+
reconcileInteractionDocuments(context);
|
|
344
|
+
}
|
|
173
345
|
const context = {
|
|
174
346
|
id: Symbol("overlay-layer"),
|
|
175
347
|
element: options.element,
|
|
@@ -192,49 +364,100 @@ function useOverlayLayer(options) {
|
|
|
192
364
|
...additional
|
|
193
365
|
].some((element) => element != null && isEventWithinElement(event, element));
|
|
194
366
|
},
|
|
195
|
-
registerBranch
|
|
367
|
+
registerBranch,
|
|
368
|
+
connectInteraction
|
|
196
369
|
};
|
|
197
370
|
layerMetadata.set(context, {
|
|
198
371
|
baseZIndex,
|
|
372
|
+
interactions,
|
|
373
|
+
interactionDocuments: /* @__PURE__ */ new Set(),
|
|
374
|
+
ownInteractionDocuments: /* @__PURE__ */ new Set(),
|
|
199
375
|
parent,
|
|
376
|
+
registered: false,
|
|
200
377
|
setZIndex(value) {
|
|
201
378
|
zIndex.value = value;
|
|
202
379
|
}
|
|
203
380
|
});
|
|
381
|
+
watch(() => {
|
|
382
|
+
interactionSetRevision.value;
|
|
383
|
+
return readOwnInteractionDocuments();
|
|
384
|
+
}, (documents) => {
|
|
385
|
+
syncOwnInteractionDocuments(documents);
|
|
386
|
+
ancestryObserver.reset();
|
|
387
|
+
}, {
|
|
388
|
+
flush: "sync",
|
|
389
|
+
immediate: true
|
|
390
|
+
});
|
|
204
391
|
function unregister() {
|
|
205
|
-
replaceParentBranch(null);
|
|
206
392
|
if (!registeredDocument) return;
|
|
207
393
|
const document = registeredDocument;
|
|
208
394
|
registeredDocument = null;
|
|
209
395
|
registeredElement = null;
|
|
396
|
+
const metadata = layerMetadata.get(context);
|
|
397
|
+
if (metadata) metadata.registered = false;
|
|
398
|
+
removeLayerFromStack(activeInteractionLayers, context);
|
|
399
|
+
syncOwnInteractionDocuments();
|
|
400
|
+
replaceParentBranch(null);
|
|
210
401
|
removeLayer(context, document, getState(document));
|
|
211
402
|
}
|
|
403
|
+
function moveRegistration(element) {
|
|
404
|
+
const previousDocument = registeredDocument;
|
|
405
|
+
if (!previousDocument) return;
|
|
406
|
+
registeredDocument = element.ownerDocument;
|
|
407
|
+
registeredElement = element;
|
|
408
|
+
removeLayer(context, previousDocument, getState(previousDocument));
|
|
409
|
+
const state = getState(registeredDocument);
|
|
410
|
+
insertPhysicalLayer(state.layers, context);
|
|
411
|
+
syncOwnInteractionDocuments();
|
|
412
|
+
replaceParentBranch(element);
|
|
413
|
+
syncLayerZIndices(state);
|
|
414
|
+
syncModalEffects(registeredDocument, state);
|
|
415
|
+
}
|
|
212
416
|
function register(element) {
|
|
213
417
|
const document = element.ownerDocument;
|
|
214
418
|
if (registeredDocument === document) {
|
|
215
419
|
if (registeredElement !== element) {
|
|
216
|
-
replaceParentBranch(element);
|
|
217
420
|
registeredElement = element;
|
|
421
|
+
syncOwnInteractionDocuments();
|
|
422
|
+
replaceParentBranch(element);
|
|
218
423
|
syncModalEffects(document, getState(document));
|
|
219
424
|
}
|
|
220
425
|
return;
|
|
221
426
|
}
|
|
222
|
-
|
|
427
|
+
if (registeredDocument) {
|
|
428
|
+
moveRegistration(element);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
223
431
|
const state = getState(document);
|
|
224
|
-
const currentIndex = state.layers.indexOf(context);
|
|
225
|
-
if (currentIndex >= 0) state.layers.splice(currentIndex, 1);
|
|
226
|
-
const descendantIndex = state.layers.findIndex((layer) => isDescendantLayer(layer, context));
|
|
227
|
-
if (descendantIndex >= 0) state.layers.splice(descendantIndex, 0, context);
|
|
228
|
-
else state.layers.push(context);
|
|
229
432
|
registeredDocument = document;
|
|
230
433
|
registeredElement = element;
|
|
434
|
+
const metadata = layerMetadata.get(context);
|
|
435
|
+
if (metadata) metadata.registered = true;
|
|
436
|
+
insertLayer(activeInteractionLayers, context);
|
|
437
|
+
insertPhysicalLayer(state.layers, context);
|
|
438
|
+
syncOwnInteractionDocuments();
|
|
231
439
|
replaceParentBranch(element);
|
|
232
440
|
syncLayerZIndices(state);
|
|
233
441
|
syncModalEffects(document, state);
|
|
234
442
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
443
|
+
function syncRegistration() {
|
|
444
|
+
const element = options.element.value;
|
|
445
|
+
if (active.value && element?.isConnected) {
|
|
446
|
+
register(element);
|
|
447
|
+
syncOwnInteractionDocuments();
|
|
448
|
+
} else unregister();
|
|
449
|
+
}
|
|
450
|
+
function syncObservedAncestry() {
|
|
451
|
+
syncRegistration();
|
|
452
|
+
if (registeredDocument) syncModalEffects(registeredDocument, getState(registeredDocument));
|
|
453
|
+
}
|
|
454
|
+
function syncObservedAuxiliaryAncestry() {
|
|
455
|
+
syncOwnInteractionDocuments();
|
|
456
|
+
if (registeredDocument) syncModalEffects(registeredDocument, getState(registeredDocument));
|
|
457
|
+
}
|
|
458
|
+
watch([active, options.element], () => {
|
|
459
|
+
syncRegistration();
|
|
460
|
+
ancestryObserver.reset();
|
|
238
461
|
}, {
|
|
239
462
|
flush: "post",
|
|
240
463
|
immediate: true
|
|
@@ -246,7 +469,11 @@ function useOverlayLayer(options) {
|
|
|
246
469
|
if (registeredDocument) syncLayerZIndices(getState(registeredDocument));
|
|
247
470
|
else zIndex.value = value;
|
|
248
471
|
});
|
|
249
|
-
onBeforeUnmount(
|
|
472
|
+
onBeforeUnmount(() => {
|
|
473
|
+
ancestryObserver.dispose();
|
|
474
|
+
unregister();
|
|
475
|
+
interactions.clear();
|
|
476
|
+
});
|
|
250
477
|
provide(overlayLayerKey, context);
|
|
251
478
|
return context;
|
|
252
479
|
}
|
|
@@ -7,21 +7,14 @@ function readTeleportTarget(target) {
|
|
|
7
7
|
function hasTarget(target) {
|
|
8
8
|
return target != null && target !== "";
|
|
9
9
|
}
|
|
10
|
-
function provideTeleportTarget(props
|
|
10
|
+
function provideTeleportTarget(props) {
|
|
11
11
|
const parentContext = inject(teleportTargetKey, void 0);
|
|
12
12
|
const target = computed(() => {
|
|
13
13
|
const ownTarget = readTeleportTarget(props.teleportTo);
|
|
14
14
|
if (hasTarget(ownTarget)) return ownTarget;
|
|
15
15
|
return parentContext?.target.value ?? "body";
|
|
16
16
|
});
|
|
17
|
-
provide(teleportTargetKey, {
|
|
18
|
-
target,
|
|
19
|
-
positioningKey: computed(() => [
|
|
20
|
-
target.value,
|
|
21
|
-
toValue(positioningKey),
|
|
22
|
-
parentContext?.positioningKey.value
|
|
23
|
-
])
|
|
24
|
-
});
|
|
17
|
+
provide(teleportTargetKey, { target });
|
|
25
18
|
return target;
|
|
26
19
|
}
|
|
27
20
|
function useTeleportTarget(target) {
|
|
@@ -32,9 +25,5 @@ function useTeleportTarget(target) {
|
|
|
32
25
|
return providedContext?.target.value ?? "body";
|
|
33
26
|
});
|
|
34
27
|
}
|
|
35
|
-
function useTeleportPositioningKey() {
|
|
36
|
-
const providedContext = inject(teleportTargetKey, void 0);
|
|
37
|
-
return computed(() => providedContext?.positioningKey.value);
|
|
38
|
-
}
|
|
39
28
|
//#endregion
|
|
40
|
-
export {
|
|
29
|
+
export { useTeleportTarget as n, provideTeleportTarget as t };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { n as normalizeTypeaheadText } from "./text.js";
|
|
2
|
+
import { onBeforeUnmount } from "vue";
|
|
3
|
+
//#region src/internal/composables/useTypeahead.ts
|
|
4
|
+
var DEFAULT_TYPEAHEAD_TIMEOUT = 1e3;
|
|
5
|
+
function isRepeatedQuery(query) {
|
|
6
|
+
const characters = [...query];
|
|
7
|
+
return characters.length > 1 && characters.every((character) => character === characters[0]);
|
|
8
|
+
}
|
|
9
|
+
function useTypeahead(options) {
|
|
10
|
+
let buffer = "";
|
|
11
|
+
let timer;
|
|
12
|
+
let lastMatch;
|
|
13
|
+
let currentScope = options.scopeKey?.();
|
|
14
|
+
const isDisabled = options.isDisabled ?? (() => false);
|
|
15
|
+
function clearTimer() {
|
|
16
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
17
|
+
timer = void 0;
|
|
18
|
+
}
|
|
19
|
+
function reset() {
|
|
20
|
+
clearTimer();
|
|
21
|
+
buffer = "";
|
|
22
|
+
lastMatch = void 0;
|
|
23
|
+
currentScope = options.scopeKey?.();
|
|
24
|
+
}
|
|
25
|
+
function scheduleReset() {
|
|
26
|
+
clearTimer();
|
|
27
|
+
timer = setTimeout(reset, options.timeout ?? DEFAULT_TYPEAHEAD_TIMEOUT);
|
|
28
|
+
}
|
|
29
|
+
function hasBuffer() {
|
|
30
|
+
return buffer.length > 0;
|
|
31
|
+
}
|
|
32
|
+
function getMatchIndex(query, startIndex, keepCurrent) {
|
|
33
|
+
const items = options.items();
|
|
34
|
+
if (items.length === 0) return -1;
|
|
35
|
+
function matches(index) {
|
|
36
|
+
const item = items[index];
|
|
37
|
+
return Boolean(item && !isDisabled(item) && normalizeTypeaheadText(options.getTextValue(item)).startsWith(query));
|
|
38
|
+
}
|
|
39
|
+
if (keepCurrent && startIndex >= 0 && matches(startIndex)) return startIndex;
|
|
40
|
+
for (let offset = 1; offset <= items.length; offset += 1) {
|
|
41
|
+
const index = (startIndex + offset + items.length) % items.length;
|
|
42
|
+
if (matches(index)) return index;
|
|
43
|
+
}
|
|
44
|
+
return -1;
|
|
45
|
+
}
|
|
46
|
+
function getLastMatchIndex(items) {
|
|
47
|
+
const match = lastMatch;
|
|
48
|
+
if (!match) return -1;
|
|
49
|
+
if (Object.is(items[match.index], match.item)) return match.index;
|
|
50
|
+
const identityIndex = items.findIndex((item) => Object.is(item, match.item));
|
|
51
|
+
if (identityIndex >= 0) return identityIndex;
|
|
52
|
+
let keyIndex = -1;
|
|
53
|
+
for (let index = 0; index < items.length; index += 1) {
|
|
54
|
+
if (!Object.is(options.getKey(items[index]), match.key)) continue;
|
|
55
|
+
if (keyIndex >= 0) return -1;
|
|
56
|
+
keyIndex = index;
|
|
57
|
+
}
|
|
58
|
+
return keyIndex;
|
|
59
|
+
}
|
|
60
|
+
function handleKey(event) {
|
|
61
|
+
const nextScope = options.scopeKey?.();
|
|
62
|
+
if (!Object.is(currentScope, nextScope)) reset();
|
|
63
|
+
currentScope = nextScope;
|
|
64
|
+
if (event.ctrlKey || event.metaKey || event.altKey || event.isComposing || [...event.key].length !== 1 || event.key === " " && !hasBuffer()) return false;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
buffer += event.key;
|
|
67
|
+
scheduleReset();
|
|
68
|
+
const normalizedBuffer = normalizeTypeaheadText(buffer);
|
|
69
|
+
if (!normalizedBuffer) return true;
|
|
70
|
+
const repeated = isRepeatedQuery(normalizedBuffer);
|
|
71
|
+
const query = repeated ? [...normalizedBuffer][0] : normalizedBuffer;
|
|
72
|
+
const items = options.items();
|
|
73
|
+
const lastMatchIndex = getLastMatchIndex(items);
|
|
74
|
+
const matchIndex = getMatchIndex(query, lastMatchIndex >= 0 ? lastMatchIndex : options.activeIndex(), !repeated && [...query].length > 1);
|
|
75
|
+
if (matchIndex < 0) return true;
|
|
76
|
+
const item = items[matchIndex];
|
|
77
|
+
if (!item) return true;
|
|
78
|
+
lastMatch = {
|
|
79
|
+
item,
|
|
80
|
+
index: matchIndex,
|
|
81
|
+
key: options.getKey(item)
|
|
82
|
+
};
|
|
83
|
+
options.onMatch(item, matchIndex);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
onBeforeUnmount(clearTimer);
|
|
87
|
+
return {
|
|
88
|
+
handleKey,
|
|
89
|
+
hasBuffer,
|
|
90
|
+
reset
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { useTypeahead as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function parseAriaIdRefs(value: string | null | undefined): string[];
|
|
2
|
+
export declare function hasAriaIdRef(value: string | null | undefined, id: string): boolean;
|
|
3
|
+
export declare function mergeAriaIdRefs(...values: Array<string | null | undefined>): string | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function getEnabledIndexes<T>(items: readonly T[], isDisabled: (item: T) => boolean): number[];
|
|
2
|
+
export declare function getNextEnabledIndex<T>(items: readonly T[], currentIndex: number, direction: 1 | -1, isDisabled: (item: T) => boolean, loop?: boolean): number | undefined;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
export declare const colorPickerFormats: readonly ["hex", "hexa", "rgb", "rgba", "hsl", "hsla"];
|
|
2
|
+
export type ColorPickerFormat = (typeof colorPickerFormats)[number];
|
|
2
3
|
export declare const DEFAULT_HUE = 0;
|
|
3
4
|
export declare const HUE_MAX = 359;
|
|
4
|
-
export declare const KEYBOARD_STEP = 1;
|
|
5
|
-
export declare const KEYBOARD_LARGE_STEP = 10;
|
|
6
5
|
export declare const DEFAULT_OPACITY = 100;
|
|
6
|
+
export declare const COLOR_PICKER_KEYBOARD_STEP = 1;
|
|
7
|
+
export declare const COLOR_PICKER_KEYBOARD_LARGE_STEP = 10;
|
|
7
8
|
export interface ColorPickerHsvColor {
|
|
8
9
|
hue: number;
|
|
9
10
|
saturation: number;
|
|
10
11
|
value: number;
|
|
11
12
|
opacity: number;
|
|
12
13
|
}
|
|
13
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
|
14
14
|
export declare function clampPercent(value: number | undefined): number;
|
|
15
15
|
export declare function normalizeHue(value: number | undefined): number;
|
|
16
16
|
export declare function normalizeHueForColor(value: number | undefined): number;
|
|
17
17
|
export declare function clampHue(value: number): number;
|
|
18
18
|
export declare function clampOpacity(value: number | undefined): number;
|
|
19
19
|
export declare function roundPercent(value: number): number;
|
|
20
|
+
export declare function getColorPickerKeyboardValue(key: string, currentValue: number, maxValue: number, step?: number): number | undefined;
|
|
20
21
|
export declare function isColorPickerAlphaFormat(format: ColorPickerFormat): format is "hexa" | "rgba" | "hsla";
|
|
21
22
|
export declare function parseColorPickerValue(value: string): ColorPickerHsvColor | undefined;
|
|
22
23
|
export declare function formatColorPickerValue(color: ColorPickerHsvColor, format: ColorPickerFormat): string;
|
|
@@ -46,6 +46,12 @@ export interface ComponentVariantColorOptions extends ComponentContrastColorOpti
|
|
|
46
46
|
variant: ComponentColorVariant | undefined;
|
|
47
47
|
defaultColor?: ComponentColorValue;
|
|
48
48
|
}
|
|
49
|
+
export interface ComponentCheckedColorStyleOptions extends ComponentContrastColorOptions {
|
|
50
|
+
color: ComponentColorValue | undefined;
|
|
51
|
+
colorProperty: `--${string}`;
|
|
52
|
+
checkedColorProperty: `--${string}`;
|
|
53
|
+
defaultColor?: ComponentColorValue;
|
|
54
|
+
}
|
|
49
55
|
export type ParsedComponentColor = {
|
|
50
56
|
kind: 'empty';
|
|
51
57
|
} | {
|
|
@@ -68,6 +74,7 @@ export declare function isComponentPresetColor(color: ComponentColorValue | unde
|
|
|
68
74
|
export declare function parseComponentColor(color: ComponentColorValue | undefined): ParsedComponentColor;
|
|
69
75
|
export declare function getComponentColorValue(color: ComponentColorValue | undefined): string | undefined;
|
|
70
76
|
export declare function getComponentContrastColor(color: ComponentColorValue | undefined, options?: ComponentContrastColorOptions): string;
|
|
77
|
+
export declare function getComponentCheckedColorStyle({ color, colorProperty, checkedColorProperty, defaultColor, autoContrast, contrastColor, }: ComponentCheckedColorStyleOptions): Record<string, string> | undefined;
|
|
71
78
|
export declare function getComponentContrastColorRoles(color: ComponentColorValue | undefined, options?: ComponentContrastColorOptions): ComponentContrastColorRoles;
|
|
72
79
|
export declare function getComponentColorRoles(color: ComponentColorValue | undefined): ComponentColorRoles | undefined;
|
|
73
80
|
export declare function getComponentVariantColorRoles({ color, variant, defaultColor, autoContrast, contrastColor, }: ComponentVariantColorOptions): ComponentVariantColorRoles | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function isValidDate(value: unknown): value is Date;
|
|
2
|
+
export declare function toLocalDate(value: Date): Date;
|
|
3
|
+
export declare function normalizeDate(value: Date | null | undefined): Date | null;
|
|
4
|
+
export declare function toDateKey(value: Date): string;
|
|
5
|
+
export declare function parseDateKey(value: string): Date | null;
|
|
6
|
+
export declare function compareDates(left: Date, right: Date): number;
|
|
7
|
+
export declare function isSameDate(left: Date | null | undefined, right: Date | null | undefined): boolean;
|
|
8
|
+
export declare function isSameMonth(left: Date, right: Date): boolean;
|
|
9
|
+
export declare function startOfMonth(value: Date): Date;
|
|
10
|
+
export declare function endOfMonth(value: Date): Date;
|
|
11
|
+
export declare function addCalendarDays(value: Date, amount: number): Date;
|
|
12
|
+
export declare function addCalendarMonths(value: Date, amount: number): Date;
|
|
13
|
+
export declare function addCalendarYears(value: Date, amount: number): Date;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DisabledDateRule = readonly Date[] | ((date: Date) => boolean);
|
|
2
|
+
export interface DateAvailabilityOptions {
|
|
3
|
+
min?: Date;
|
|
4
|
+
max?: Date;
|
|
5
|
+
disabledDates?: DisabledDateRule;
|
|
6
|
+
}
|
|
7
|
+
export declare function isDateUnavailable(date: Date, options: DateAvailabilityOptions): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ObserveComposedAncestryOptions {
|
|
2
|
+
deferWhileDisconnected?: boolean;
|
|
3
|
+
notifyOnDisconnect?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function getComposedParent(node: Node): Node | null;
|
|
6
|
+
export declare function getComposedAncestry(node: Node | null | undefined): Node[];
|
|
7
|
+
export declare function areNodeListsIdentical(left: readonly Node[], right: readonly Node[]): boolean;
|
|
8
|
+
export declare function observeComposedAncestry(getNodes: () => readonly (Node | null | undefined)[], onChange: () => void, options?: ObserveComposedAncestryOptions): () => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type AttributeSnapshot<Name extends string = string> = ReadonlyMap<Name, string | null>;
|
|
2
|
+
export interface CompatibilityAttributes {
|
|
3
|
+
class?: unknown;
|
|
4
|
+
style?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export type EventHandler<EventType extends Event> = (event: EventType) => unknown;
|
|
7
|
+
export declare function splitCompatibilityAttributes<Attributes extends CompatibilityAttributes>(attributes: Attributes): {
|
|
8
|
+
compatibilityClass: Attributes['class'];
|
|
9
|
+
compatibilityStyle: Attributes['style'];
|
|
10
|
+
forwardedAttributes: Omit<Attributes, 'class' | 'style'>;
|
|
11
|
+
};
|
|
12
|
+
export declare function composeEventHandlers<EventType extends Event>(...handlers: ReadonlyArray<EventHandler<EventType> | undefined>): (event: EventType) => void;
|
|
13
|
+
export declare function parseAttributeTokens(value: string | null | undefined): string[];
|
|
14
|
+
export declare function hasAttributeToken(value: string | null | undefined, token: string): boolean;
|
|
15
|
+
export declare function snapshotAttributes<Name extends string>(element: Element, attributes: readonly Name[]): AttributeSnapshot<Name>;
|
|
16
|
+
export declare function restoreAttributes(element: Element, snapshot: AttributeSnapshot): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComponentPublicInstance, VaporComponentInstance } from 'vue';
|
|
2
|
+
export type ComponentElementRef = Element | ComponentPublicInstance | VaporComponentInstance | null;
|
|
3
|
+
export declare function toHTMLElement(value: ComponentElementRef, fallbackId?: string): HTMLElement | null;
|
|
4
|
+
export declare function resolveHTMLElementRef(value: ComponentElementRef, fallbackId: string, resolve: (element: HTMLElement | null) => void): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isNodeWithinElement(value: unknown, element: unknown): value is Node;
|
|
2
|
+
export declare function isEventWithinElement(event: Event, element: Element): boolean;
|
|
3
|
+
export type EventContainmentTarget = string | Element | null | undefined;
|
|
4
|
+
export declare function isEventWithinTargets(event: Event, targets: readonly EventContainmentTarget[]): boolean;
|
|
5
|
+
export declare function createCancelableCustomEvent<T>(type: string, detail: T, originalEvent: Event): CustomEvent<T>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function normalizeSelectedFiles(files: Iterable<File>, multiple: boolean): File[];
|
|
2
|
+
export declare function haveSameFiles(fileList: FileList | null, files: readonly File[]): boolean;
|
|
3
|
+
export declare function replaceInputFiles(input: HTMLInputElement, files: readonly File[]): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type FocusNavigationOrientation = 'horizontal' | 'vertical';
|
|
2
|
+
export interface FocusNavigationOptions {
|
|
3
|
+
itemSelector: string;
|
|
4
|
+
collectionSelector: string;
|
|
5
|
+
orientation: FocusNavigationOrientation;
|
|
6
|
+
}
|
|
7
|
+
export declare function getFocusNavigationTarget<ElementType extends HTMLElement>(event: Pick<KeyboardEvent, 'key' | 'target'>, collection: HTMLElement, options: FocusNavigationOptions): ElementType | undefined;
|