ropav 0.1.5 → 0.1.7
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 +10 -0
- package/dist/accordion.css +17 -17
- package/dist/accordion.js +125 -154
- package/dist/alert.css +18 -18
- package/dist/alert.js +20 -20
- 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 +10 -18
- package/dist/badge.css +16 -16
- package/dist/badge.js +6 -6
- package/dist/base.css +18 -13
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +13 -14
- package/dist/button.css +32 -27
- package/dist/button.js +13 -14
- package/dist/{useButtonColor.js → button.scss_vue_type_style_index_0_src_true_lang.js} +3 -2
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +23 -29
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +8 -7
- package/dist/collectionNavigation.js +2 -99
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +15 -14
- package/dist/color-picker.css +40 -40
- package/dist/color-picker.js +222 -202
- package/dist/color-picker2.js +1 -9
- package/dist/color-swatch.css +4 -4
- package/dist/color-swatch.js +7 -9
- package/dist/color.js +5 -10
- package/dist/componentColors.js +165 -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/checkbox/useCheckbox.d.ts +2 -3
- package/dist/components/color-input/color-input.d.ts +2 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +2 -2
- 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/dialog/{dialog-core.d.ts → dialogContext.d.ts} +2 -6
- 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 +3 -3
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +17 -19
- 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 +85 -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 +34 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +22 -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 +29 -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/floating/hoverDisclosureInteractionModel.d.ts +42 -0
- package/dist/components/floating/index.js +1 -1
- package/dist/components/floating/useFloatingPosition.d.ts +0 -1
- package/dist/components/floating/useHoverDisclosureInteractions.d.ts +32 -0
- package/dist/components/floating/useHoverDisclosureOpenState.d.ts +25 -0
- package/dist/components/floating/useHoverDisclosureTargetBinding.d.ts +27 -0
- package/dist/components/input/useInput.d.ts +1 -1
- package/dist/components/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +4 -18
- 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 +16 -0
- package/dist/components/progress/progressModel.d.ts +8 -0
- package/dist/components/progress/useProgress.d.ts +1 -7
- package/dist/components/radio/useRadio.d.ts +3 -4
- 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/types.d.ts +4 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +70 -52
- package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -14
- 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 +10 -8
- package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
- package/dist/components/select/useSelect.d.ts +2 -1
- package/dist/components/select/useSelectNativeValue.d.ts +1 -7
- package/dist/components/slider/rangeSliderModel.d.ts +41 -0
- package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +2 -2
- package/dist/components/slider/useRangeSlider.d.ts +9 -17
- package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
- package/dist/components/slider/useSlider.d.ts +8 -14
- 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/switch/useSwitch.d.ts +1 -1
- package/dist/components/teleport-provider/index.js +1 -1
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
- package/dist/components/textarea/useTextarea.d.ts +1 -1
- package/dist/components/toast/useToastLifecycle.d.ts +19 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -2
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useControllableValue.d.ts +14 -0
- package/dist/css.js +12 -0
- package/dist/dialog.js +227 -216
- package/dist/dropdown-menu.js +1493 -1118
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/floating.js +553 -312
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/icon-button.css +12 -173
- package/dist/icon-button.js +8 -7
- package/dist/index.d.ts +5 -4
- package/dist/index.js +13 -11
- package/dist/input.css +24 -24
- package/dist/input.js +20 -32
- package/dist/interactive.js +18 -0
- package/dist/modal.js +11 -7
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +15 -13
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +67 -65
- package/dist/pointer.js +9 -0
- package/dist/popover.css +34 -34
- package/dist/popover.js +93 -91
- package/dist/progress.css +29 -21
- package/dist/progress.js +25 -21
- package/dist/query.js +40 -0
- package/dist/radio.css +18 -18
- package/dist/radio.js +31 -37
- package/dist/rafScheduler.js +34 -0
- package/dist/scroll-area.css +35 -26
- package/dist/scroll-area.js +553 -500
- package/dist/select.css +45 -45
- package/dist/select.js +70 -56
- package/dist/slider.css +191 -191
- package/dist/slider.js +695 -628
- 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 +15 -16
- package/dist/tabs.css +46 -46
- package/dist/tabs.js +51 -68
- package/dist/text.js +17 -0
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +22 -33
- package/dist/toast.css +26 -26
- package/dist/toast.js +157 -129
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +46 -47
- package/dist/useCollapse.js +19 -17
- package/dist/useControlState.js +4 -7
- package/dist/useControllableValue.js +8 -2
- package/dist/useFloatingPosition.js +122 -1128
- package/dist/useFormControl.js +3 -2
- package/dist/useOverlayZIndex.js +2 -6
- package/dist/useRequiredInject.js +1 -1
- 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/dom/ancestry.d.ts +7 -0
- package/dist/utils/dom/attributes.d.ts +16 -0
- package/dist/utils/dom/componentRef.d.ts +4 -0
- package/dist/utils/dom/events.d.ts +5 -0
- package/dist/utils/dom/focusNavigation.d.ts +7 -0
- package/dist/utils/dom/interactive.d.ts +2 -0
- package/dist/utils/dom/pointer.d.ts +2 -0
- package/dist/utils/dom/query.d.ts +4 -0
- package/dist/utils/dom/scroll.d.ts +23 -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/rafScheduler.d.ts +4 -0
- package/dist/utils/text.d.ts +2 -0
- package/docs/code-architecture.md +118 -0
- package/docs/public-composables-api.md +52 -0
- package/docs/public-floating-api.md +6 -5
- package/package.json +54 -46
- package/src/styles/_mixins.scss +4 -0
- package/src/styles/_tokens.scss +12 -12
- package/src/styles/_variables.scss +1 -1
- package/dist/button-link.css +0 -167
- 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 -37
- 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 -25
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -35
- /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/{composables → internal/composables}/useOverlayLayer.d.ts +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DialogRootContext } from './dialogContext.js';
|
|
2
|
+
import { DialogCloseReason, DialogRootProps, DialogRootSlotProps } from './types.js';
|
|
3
|
+
type DialogRootStateProps = Readonly<DialogRootProps & {
|
|
4
|
+
defaultOpen: boolean;
|
|
5
|
+
modal: boolean;
|
|
6
|
+
closeOnEscape: boolean;
|
|
7
|
+
closeOnOutsideClick: boolean;
|
|
8
|
+
preventScroll: boolean;
|
|
9
|
+
returnFocus: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
interface DialogRootStateEvents {
|
|
12
|
+
openChange: (open: boolean) => void;
|
|
13
|
+
close: (reason: DialogCloseReason) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useDialogRootState(props: DialogRootStateProps, events: Readonly<DialogRootStateEvents>): {
|
|
16
|
+
context: DialogRootContext;
|
|
17
|
+
slotProps: import('vue').ComputedRef<DialogRootSlotProps>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -5,8 +5,8 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
5
5
|
originalEvent: KeyboardEvent;
|
|
6
6
|
}>) => any) | undefined;
|
|
7
7
|
onPointerDownOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
8
|
-
onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
9
8
|
onInteractOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
9
|
+
onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
10
10
|
}> & (typeof globalThis extends {
|
|
11
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
12
12
|
} ? P : {});
|
|
@@ -21,7 +21,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
21
21
|
};
|
|
22
22
|
emit: ((evt: "escapeKeyDown", event: CustomEvent<{
|
|
23
23
|
originalEvent: KeyboardEvent;
|
|
24
|
-
}>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "
|
|
24
|
+
}>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void);
|
|
25
25
|
}>) => import('vue').VNode & {
|
|
26
26
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
27
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ItemPath } from './dropdown-menu-
|
|
1
|
+
import { ItemPath } from './dropdown-menu-model.js';
|
|
2
2
|
import { DropdownMenuItem, DropdownMenuItemSlotProps } from './types.js';
|
|
3
3
|
import { DropdownMenuRenderContext } from './useDropdownMenuRenderItems.js';
|
|
4
4
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ItemPath } from './dropdown-menu-
|
|
1
|
+
import { ItemPath } from './dropdown-menu-model.js';
|
|
2
2
|
import { DropdownMenuItem, DropdownMenuItemSlotProps } from './types.js';
|
|
3
3
|
import { DropdownMenuRenderContext } from './useDropdownMenuRenderItems.js';
|
|
4
4
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DropdownMenuFocusTarget, DropdownMenuItem, DropdownMenuItemPath, DropdownMenuPlacement } from './types.js';
|
|
2
|
+
export declare const DEFAULT_PLACEMENT: DropdownMenuPlacement;
|
|
3
|
+
export declare const DEFAULT_FOCUS_TARGET: DropdownMenuFocusTarget;
|
|
4
|
+
export type ItemPath = DropdownMenuItemPath;
|
|
5
|
+
export type SubmenuFocusTarget = DropdownMenuFocusTarget | false;
|
|
6
|
+
export declare function getItemClass(item: DropdownMenuItem, focused: boolean, disabled: boolean, hasSubmenu: boolean, submenuOpen: boolean): string[];
|
|
7
|
+
export declare function hasItemSubmenu(item: DropdownMenuItem): boolean;
|
|
8
|
+
export declare function hasNestedItems(items: DropdownMenuItem[]): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownMenuFocusTarget, DropdownMenuOpenOptions, DropdownMenuPoint, DropdownMenuRootPrimitiveProps, DropdownMenuRootSlotProps } from './types.js';
|
|
2
2
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: import('vue').PublicProps & __VLS_PrettifyLocal<DropdownMenuRootPrimitiveProps & {
|
|
4
4
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
@@ -7,7 +7,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
7
7
|
} ? P : {});
|
|
8
8
|
expose: (exposed: import('vue').ShallowUnwrapRef<{
|
|
9
9
|
open: (options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) => void;
|
|
10
|
-
close: (options?: DropdownMenuCloseOptions & {
|
|
10
|
+
close: (options?: import('./types.js').DropdownMenuCloseOptions & {
|
|
11
11
|
returnFocus?: boolean;
|
|
12
12
|
}) => void;
|
|
13
13
|
toggle: () => void;
|
|
@@ -5,8 +5,8 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
5
5
|
originalEvent: KeyboardEvent;
|
|
6
6
|
}>) => any) | undefined;
|
|
7
7
|
onPointerDownOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
8
|
-
onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
9
8
|
onInteractOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
9
|
+
onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
10
10
|
}> & (typeof globalThis extends {
|
|
11
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
12
12
|
} ? P : {});
|
|
@@ -21,7 +21,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
21
21
|
};
|
|
22
22
|
emit: ((evt: "escapeKeyDown", event: CustomEvent<{
|
|
23
23
|
originalEvent: KeyboardEvent;
|
|
24
|
-
}>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "
|
|
24
|
+
}>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void);
|
|
25
25
|
}>) => import('vue').VNode & {
|
|
26
26
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
27
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenFocusTarget } from './
|
|
1
|
+
import { OpenFocusTarget } from './dropdownMenuContext.js';
|
|
2
2
|
import { DropdownMenuSubTriggerPrimitiveProps } from './types.js';
|
|
3
3
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: import('vue').PublicProps & __VLS_PrettifyLocal<DropdownMenuSubTriggerPrimitiveProps> & (typeof globalThis extends {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenFocusTarget } from './
|
|
1
|
+
import { OpenFocusTarget } from './dropdownMenuContext.js';
|
|
2
2
|
import { DropdownMenuSubPrimitiveProps } from './types.js';
|
|
3
3
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: import('vue').PublicProps & __VLS_PrettifyLocal<DropdownMenuSubPrimitiveProps & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DropdownMenuItem, DropdownMenuItemSlotProps, DropdownMenuInteractOutsideEvent, DropdownMenuProps, DropdownMenuSelectEvent, DropdownMenuSlotProps } from './types.js';
|
|
2
2
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: import('vue').PublicProps & __VLS_PrettifyLocal<DropdownMenuProps & {
|
|
4
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
5
4
|
onSelect?: ((item: DropdownMenuItem, event: DropdownMenuSelectEvent) => any) | undefined;
|
|
5
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
6
6
|
onPointerDownOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
7
|
-
onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
8
7
|
onInteractOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
8
|
+
onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
|
|
9
9
|
}> & (typeof globalThis extends {
|
|
10
10
|
__VLS_PROPS_FALLBACK: infer P;
|
|
11
11
|
} ? P : {});
|
|
@@ -16,7 +16,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
16
16
|
item?(props: DropdownMenuItemSlotProps): unknown;
|
|
17
17
|
empty?(): unknown;
|
|
18
18
|
};
|
|
19
|
-
emit: ((evt: "
|
|
19
|
+
emit: ((evt: "select", item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void);
|
|
20
20
|
}>) => import('vue').VNode & {
|
|
21
21
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
22
22
|
};
|
package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts}
RENAMED
|
@@ -1,42 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OverlayLayerContext } from '../../composables/useOverlayLayer.js';
|
|
1
|
+
import { ComputedRef, InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { OverlayLayerContext } from '../../internal/composables/useOverlayLayer.js';
|
|
3
|
+
import { ComponentElementRef } from '../../utils/dom/componentRef.js';
|
|
3
4
|
import { FloatingReference } from '../floating/types.js';
|
|
4
|
-
import {
|
|
5
|
+
import { DropdownMenuInteractionFocusTarget, DropdownMenuInteractionRuntime } from './dropdownMenuInteraction.js';
|
|
6
|
+
import { DropdownMenuCloseOptions, DropdownMenuFocusTarget, DropdownMenuItemPrimitiveProps, DropdownMenuItemValue, DropdownMenuOpenOptions, DropdownMenuPlacement, DropdownMenuPoint, DropdownMenuSelectEvent, DropdownMenuVirtualAnchor } from './types.js';
|
|
5
7
|
export type ElementReference = FloatingReference;
|
|
6
|
-
export type OpenFocusTarget =
|
|
7
|
-
export type ComponentRefValue = Element | ComponentPublicInstance | VaporComponentInstance | null;
|
|
8
|
+
export type OpenFocusTarget = DropdownMenuInteractionFocusTarget;
|
|
8
9
|
export interface MenuItemRegistration {
|
|
9
10
|
id: string;
|
|
10
11
|
element: () => HTMLElement | null;
|
|
11
12
|
textValue: () => string;
|
|
12
13
|
disabled: () => boolean;
|
|
13
|
-
activate: (event: Event) =>
|
|
14
|
+
activate: (event: Event) => DropdownMenuSelectEvent | undefined;
|
|
15
|
+
closeOnSelect?: () => boolean;
|
|
14
16
|
submenu?: DropdownMenuSubContext;
|
|
15
17
|
}
|
|
16
18
|
export interface DropdownMenuContext {
|
|
17
19
|
root: DropdownMenuRootContext;
|
|
20
|
+
id: string;
|
|
18
21
|
element: Ref<HTMLElement | null>;
|
|
19
|
-
activeId:
|
|
22
|
+
activeId: ComputedRef<string | null>;
|
|
20
23
|
actualPlacement: Ref<DropdownMenuPlacement>;
|
|
21
24
|
parentSub?: DropdownMenuSubContext;
|
|
22
25
|
registerItem: (item: MenuItemRegistration) => void;
|
|
23
26
|
unregisterItem: (id: string) => void;
|
|
24
|
-
registerSub: (sub: DropdownMenuSubContext) => void;
|
|
25
|
-
unregisterSub: (sub: DropdownMenuSubContext) => void;
|
|
26
27
|
closeSubmenus: (except?: DropdownMenuSubContext) => void;
|
|
27
28
|
setActive: (id: string) => void;
|
|
28
29
|
isActive: (id: string) => boolean;
|
|
29
30
|
focus: (target?: DropdownMenuFocusTarget) => boolean;
|
|
30
31
|
focusElement: () => void;
|
|
32
|
+
activate: (id: string, event?: Event) => void;
|
|
33
|
+
hover: (id: string, openSubmenu?: boolean) => void;
|
|
31
34
|
onKeydown: (event: KeyboardEvent) => void;
|
|
32
35
|
}
|
|
33
36
|
export interface DropdownMenuSubContext {
|
|
37
|
+
menuId: string;
|
|
34
38
|
isOpen: ComputedRef<boolean>;
|
|
35
39
|
trigger: Ref<HTMLElement | null>;
|
|
36
40
|
contentId: Ref<string | undefined>;
|
|
37
41
|
actualPlacement: Ref<DropdownMenuPlacement>;
|
|
38
42
|
pendingFocus: Ref<OpenFocusTarget>;
|
|
39
43
|
menu: DropdownMenuContext | null;
|
|
44
|
+
setOpen: (open: boolean) => void;
|
|
40
45
|
open: (focus?: OpenFocusTarget) => void;
|
|
41
46
|
close: (focusParent?: boolean) => void;
|
|
42
47
|
}
|
|
@@ -51,6 +56,7 @@ export interface DropdownMenuRootContext {
|
|
|
51
56
|
reference: ComputedRef<ElementReference | null>;
|
|
52
57
|
pendingFocus: Ref<OpenFocusTarget>;
|
|
53
58
|
layer: OverlayLayerContext;
|
|
59
|
+
interaction: DropdownMenuInteractionRuntime;
|
|
54
60
|
open: (options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) => void;
|
|
55
61
|
close: (options?: DropdownMenuCloseOptions & {
|
|
56
62
|
returnFocus?: boolean;
|
|
@@ -62,7 +68,6 @@ export interface DropdownMenuRootContext {
|
|
|
62
68
|
setReturnFocus: (element: HTMLElement | null) => void;
|
|
63
69
|
registerInside: (element: HTMLElement) => void;
|
|
64
70
|
unregisterInside: (element: HTMLElement) => void;
|
|
65
|
-
isInside: (event: Event) => boolean;
|
|
66
71
|
}
|
|
67
72
|
export interface DropdownMenuRadioGroupContext {
|
|
68
73
|
value: ComputedRef<DropdownMenuItemValue | null>;
|
|
@@ -77,21 +82,14 @@ export declare const menuKey: InjectionKey<DropdownMenuContext>;
|
|
|
77
82
|
export declare const subKey: InjectionKey<DropdownMenuSubContext>;
|
|
78
83
|
export declare const radioGroupKey: InjectionKey<DropdownMenuRadioGroupContext>;
|
|
79
84
|
export declare const checkedKey: InjectionKey<DropdownMenuCheckedContext>;
|
|
80
|
-
export declare function optionalAttr<T extends boolean | string | undefined>(value: T): T | undefined;
|
|
81
|
-
export declare function getFocusTarget(options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget): DropdownMenuFocusTarget;
|
|
82
|
-
export declare function toHTMLElement(value: ComponentRefValue, fallbackId?: string): HTMLElement | null;
|
|
83
|
-
export declare function resolveHTMLElementRef(value: ComponentRefValue, fallbackId: string, resolve: (element: HTMLElement | null) => void): void;
|
|
84
85
|
export declare function createVirtualAnchor(point: DropdownMenuPoint): DropdownMenuVirtualAnchor;
|
|
85
|
-
export declare function createCustomEvent<T>(type: string, detail: T, originalEvent: Event): CustomEvent<T>;
|
|
86
86
|
export declare function createSelectEvent(originalEvent: Event, value?: DropdownMenuItemValue): DropdownMenuSelectEvent;
|
|
87
|
-
export declare function createOutsideEvent(originalEvent: Event): DropdownMenuInteractOutsideEvent;
|
|
88
|
-
export declare function blockNextDocumentClick(): void;
|
|
89
87
|
export declare function createMenuContext(options: {
|
|
90
88
|
root: DropdownMenuRootContext;
|
|
91
89
|
element: Ref<HTMLElement | null>;
|
|
92
90
|
actualPlacement: Ref<DropdownMenuPlacement>;
|
|
93
91
|
parentSub?: DropdownMenuSubContext;
|
|
94
|
-
onEscape: (event: KeyboardEvent) =>
|
|
92
|
+
onEscape: (event: KeyboardEvent) => boolean;
|
|
95
93
|
}): DropdownMenuContext;
|
|
96
94
|
export declare function usePrimitiveItem(componentName: string, props: Readonly<DropdownMenuItemPrimitiveProps>, emitSelect: (event: DropdownMenuSelectEvent) => void, options: {
|
|
97
95
|
checked?: ComputedRef<boolean | 'mixed'>;
|
|
@@ -106,6 +104,6 @@ export declare function usePrimitiveItem(componentName: string, props: Readonly<
|
|
|
106
104
|
checked: ComputedRef<boolean | "mixed"> | undefined;
|
|
107
105
|
activate: (originalEvent: Event) => void;
|
|
108
106
|
select: () => void;
|
|
109
|
-
setElement: (value:
|
|
107
|
+
setElement: (value: ComponentElementRef) => void;
|
|
110
108
|
onPointerenter: () => void;
|
|
111
109
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ItemPath } from './dropdown-menu-model.js';
|
|
2
|
+
import { DropdownMenuItem } from './types.js';
|
|
3
|
+
export interface DropdownMenuDataEntry {
|
|
4
|
+
item: DropdownMenuItem;
|
|
5
|
+
path: ItemPath;
|
|
6
|
+
itemId: string;
|
|
7
|
+
ownerMenuId: string;
|
|
8
|
+
order: number;
|
|
9
|
+
submenuMenuId: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface DropdownMenuDataIndex {
|
|
12
|
+
entries: readonly DropdownMenuDataEntry[];
|
|
13
|
+
itemIdByPath: ReadonlyMap<string, string>;
|
|
14
|
+
pathByItemId: ReadonlyMap<string, ItemPath>;
|
|
15
|
+
menuIdByPath: ReadonlyMap<string, string>;
|
|
16
|
+
pathByMenuId: ReadonlyMap<string, ItemPath>;
|
|
17
|
+
primaryItemId: WeakMap<DropdownMenuItem, string>;
|
|
18
|
+
}
|
|
19
|
+
export declare function buildDropdownMenuDataIndex(items: readonly DropdownMenuItem[], rootMenuId: string, getStableItemId: (item: DropdownMenuItem) => string): DropdownMenuDataIndex;
|
|
20
|
+
export declare function getDropdownMenuDataCollectionState(items: readonly DropdownMenuItem[]): unknown[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DropdownMenuInteractionHost, DropdownMenuInteractionRuntime } from './dropdownMenuInteractionTypes.js';
|
|
2
|
+
export type { DropdownMenuInteractionDismissalRegistration, DropdownMenuInteractionFocusTarget, DropdownMenuInteractionHost, DropdownMenuInteractionItemRegistration, DropdownMenuInteractionMenuRegistration, DropdownMenuInteractionMenuStateRegistration, DropdownMenuInteractionRuntime, } from './dropdownMenuInteractionTypes.js';
|
|
3
|
+
export declare function useDropdownMenuInteraction(host: DropdownMenuInteractionHost): DropdownMenuInteractionRuntime;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DropdownMenuCloseOptions, DropdownMenuFocusTarget } from './types.js';
|
|
2
|
+
import { DropdownMenuInteractionRegistry } from './dropdownMenuInteractionRegistry.js';
|
|
3
|
+
import { DropdownMenuInteractionFocusTarget, DropdownMenuInteractionHost } from './dropdownMenuInteractionTypes.js';
|
|
4
|
+
interface CreateDropdownMenuInteractionNavigationOptions {
|
|
5
|
+
host: DropdownMenuInteractionHost;
|
|
6
|
+
registry: DropdownMenuInteractionRegistry;
|
|
7
|
+
closeRoot: (options?: DropdownMenuCloseOptions & {
|
|
8
|
+
returnFocus?: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function createDropdownMenuInteractionNavigation({ host, registry, closeRoot, }: CreateDropdownMenuInteractionNavigationOptions): {
|
|
12
|
+
closeMenu: (menuId: string, focusParent?: boolean) => boolean;
|
|
13
|
+
closeSubmenus: (menuId: string, exceptMenuId?: string) => void;
|
|
14
|
+
closeAllSubmenus: () => void;
|
|
15
|
+
focusMenu: (menuId: string, target?: DropdownMenuFocusTarget) => boolean;
|
|
16
|
+
openMenu: (menuId: string, focus?: DropdownMenuInteractionFocusTarget) => boolean;
|
|
17
|
+
selectItem: (id: string, originalEvent?: Event) => void;
|
|
18
|
+
activateItem: (id: string, originalEvent?: Event) => void;
|
|
19
|
+
hoverItem: (id: string, openSubmenu?: boolean) => void;
|
|
20
|
+
reconcile: (menuId?: string) => void;
|
|
21
|
+
reconcileOpenSubmenus: () => void;
|
|
22
|
+
};
|
|
23
|
+
export type DropdownMenuInteractionNavigation = ReturnType<typeof createDropdownMenuInteractionNavigation>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DropdownMenuFocusTarget } from './types.js';
|
|
2
|
+
import { DropdownMenuInteractionFocusTarget, DropdownMenuInteractionHost, DropdownMenuInteractionItemRegistration, DropdownMenuInteractionMenuRegistration, DropdownMenuInteractionMenuStateRegistration } from './dropdownMenuInteractionTypes.js';
|
|
3
|
+
export interface DropdownMenuInteractionRegistryNavigation {
|
|
4
|
+
closeMenu: (menuId: string, focusParent?: boolean) => boolean;
|
|
5
|
+
closeSubmenus: (menuId: string, exceptMenuId?: string) => void;
|
|
6
|
+
focusMenu: (menuId: string, target?: DropdownMenuFocusTarget) => boolean;
|
|
7
|
+
reconcile: (menuId?: string) => void;
|
|
8
|
+
reconcileOpenSubmenus: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createDropdownMenuInteractionRegistry(host: DropdownMenuInteractionHost, navigation: DropdownMenuInteractionRegistryNavigation): {
|
|
11
|
+
activeItemId: import('vue').Ref<string | null, string | null>;
|
|
12
|
+
activeMenuId: import('vue').Ref<string, string>;
|
|
13
|
+
pendingRootFocus: import('vue').Ref<DropdownMenuInteractionFocusTarget, DropdownMenuInteractionFocusTarget>;
|
|
14
|
+
registerMenu: (registration: DropdownMenuInteractionMenuRegistration) => () => void;
|
|
15
|
+
unregisterMenu: (id: string) => void;
|
|
16
|
+
registerMenuState: (registration: DropdownMenuInteractionMenuStateRegistration) => () => void;
|
|
17
|
+
registerItem: (registration: DropdownMenuInteractionItemRegistration) => () => void;
|
|
18
|
+
unregisterItem: (id: string) => void;
|
|
19
|
+
getActiveId: (menuId: string) => import('vue').ComputedRef<string | null>;
|
|
20
|
+
getItem: (id: string) => DropdownMenuInteractionItemRegistration | undefined;
|
|
21
|
+
getMenu: (id: string) => DropdownMenuInteractionMenuRegistration | undefined;
|
|
22
|
+
isActive: (id: string) => boolean;
|
|
23
|
+
isMenuOpen: (menuId: string) => boolean;
|
|
24
|
+
setActive: (id: string | null, focusElement?: boolean) => boolean;
|
|
25
|
+
focusMenuElement: (menuId: string) => void;
|
|
26
|
+
state: {
|
|
27
|
+
getMenuState: (id: string) => DropdownMenuInteractionMenuStateRegistration | undefined;
|
|
28
|
+
getItems: (menuId: string) => DropdownMenuInteractionItemRegistration[];
|
|
29
|
+
getEnabledItems: (menuId: string) => DropdownMenuInteractionItemRegistration[];
|
|
30
|
+
getActiveIdValue: (menuId: string) => string | null;
|
|
31
|
+
clearMenuState: (menuId: string) => void;
|
|
32
|
+
getParentItem: (menuId: string) => DropdownMenuInteractionItemRegistration | undefined;
|
|
33
|
+
setMenuOpen: (menuId: string, open: boolean) => void;
|
|
34
|
+
chooseNeighbor: (menuId: string, previousIndex: number) => void;
|
|
35
|
+
getMenuIds: () => Set<string>;
|
|
36
|
+
getRegisteredMenuIds: () => string[];
|
|
37
|
+
getPendingMenuFocus: (menuId: string) => DropdownMenuInteractionFocusTarget | undefined;
|
|
38
|
+
setPendingMenuFocus: (menuId: string, focus: DropdownMenuInteractionFocusTarget) => Map<string, DropdownMenuInteractionFocusTarget>;
|
|
39
|
+
clearPendingMenuFocus: (menuId: string) => boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type DropdownMenuInteractionRegistry = ReturnType<typeof createDropdownMenuInteractionRegistry>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { DropdownMenuCloseOptions, DropdownMenuFocusTarget, DropdownMenuInteractOutsideEvent, DropdownMenuInteractOutsideTarget, DropdownMenuOpenOptions, DropdownMenuPlacement, DropdownMenuSelectEvent } from './types.js';
|
|
3
|
+
export type DropdownMenuInteractionFocusTarget = DropdownMenuFocusTarget | false;
|
|
4
|
+
export interface DropdownMenuInteractionMenuRegistration {
|
|
5
|
+
id: string;
|
|
6
|
+
parentItemId?: () => string | undefined;
|
|
7
|
+
element: () => HTMLElement | null;
|
|
8
|
+
focusTarget?: () => HTMLElement | null;
|
|
9
|
+
placement: () => DropdownMenuPlacement;
|
|
10
|
+
isOpen: () => boolean;
|
|
11
|
+
setOpen?: (open: boolean) => void;
|
|
12
|
+
stopKeyPropagation?: boolean;
|
|
13
|
+
onEscape?: (event: KeyboardEvent) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface DropdownMenuInteractionMenuStateRegistration {
|
|
16
|
+
id: string;
|
|
17
|
+
isOpen: () => boolean;
|
|
18
|
+
setOpen: (open: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface DropdownMenuInteractionItemRegistration {
|
|
21
|
+
id: string;
|
|
22
|
+
menuId: string;
|
|
23
|
+
element: () => HTMLElement | null;
|
|
24
|
+
textValue: () => string;
|
|
25
|
+
disabled: () => boolean;
|
|
26
|
+
order?: () => number;
|
|
27
|
+
submenuId?: () => string | undefined;
|
|
28
|
+
submenuDirection?: () => 'left' | 'right';
|
|
29
|
+
select?: (originalEvent: Event) => DropdownMenuSelectEvent | undefined;
|
|
30
|
+
closeOnSelect?: () => boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface DropdownMenuInteractionDismissalRegistration {
|
|
33
|
+
ignoredTargets: () => readonly DropdownMenuInteractOutsideTarget[];
|
|
34
|
+
pointerDownOutside?: (event: DropdownMenuInteractOutsideEvent) => void;
|
|
35
|
+
focusOutside?: (event: DropdownMenuInteractOutsideEvent) => void;
|
|
36
|
+
interactOutside?: (event: DropdownMenuInteractOutsideEvent) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface DropdownMenuInteractionHost {
|
|
39
|
+
rootMenuId: string;
|
|
40
|
+
isOpen: Readonly<Ref<boolean>>;
|
|
41
|
+
disabled: Readonly<Ref<boolean>>;
|
|
42
|
+
modal: Readonly<Ref<boolean>>;
|
|
43
|
+
setOpen: (open: boolean) => void;
|
|
44
|
+
isTopLayer: () => boolean;
|
|
45
|
+
focusTrigger: () => void;
|
|
46
|
+
beforeOpen?: () => void;
|
|
47
|
+
beforeClose?: () => void;
|
|
48
|
+
}
|
|
49
|
+
export interface DropdownMenuInteractionRuntime {
|
|
50
|
+
rootMenuId: string;
|
|
51
|
+
activeItemId: Readonly<Ref<string | null>>;
|
|
52
|
+
activeMenuId: Readonly<Ref<string>>;
|
|
53
|
+
pendingRootFocus: Ref<DropdownMenuInteractionFocusTarget>;
|
|
54
|
+
registerMenu: (registration: DropdownMenuInteractionMenuRegistration) => () => void;
|
|
55
|
+
unregisterMenu: (id: string) => void;
|
|
56
|
+
registerMenuState: (registration: DropdownMenuInteractionMenuStateRegistration) => () => void;
|
|
57
|
+
registerItem: (registration: DropdownMenuInteractionItemRegistration) => () => void;
|
|
58
|
+
unregisterItem: (id: string) => void;
|
|
59
|
+
registerInside: (element: Element) => void;
|
|
60
|
+
unregisterInside: (element: Element) => void;
|
|
61
|
+
registerDismissal: (registration: DropdownMenuInteractionDismissalRegistration) => () => void;
|
|
62
|
+
getActiveId: (menuId: string) => ComputedRef<string | null>;
|
|
63
|
+
getItem: (id: string) => DropdownMenuInteractionItemRegistration | undefined;
|
|
64
|
+
getMenu: (id: string) => DropdownMenuInteractionMenuRegistration | undefined;
|
|
65
|
+
isActive: (id: string) => boolean;
|
|
66
|
+
isMenuOpen: (menuId: string) => boolean;
|
|
67
|
+
setActive: (id: string | null, focusElement?: boolean) => boolean;
|
|
68
|
+
focusMenu: (menuId: string, target?: DropdownMenuFocusTarget) => boolean;
|
|
69
|
+
focusMenuElement: (menuId: string) => void;
|
|
70
|
+
open: (options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) => void;
|
|
71
|
+
close: (options?: DropdownMenuCloseOptions & {
|
|
72
|
+
returnFocus?: boolean;
|
|
73
|
+
}) => void;
|
|
74
|
+
toggle: () => void;
|
|
75
|
+
openMenu: (menuId: string, focus?: DropdownMenuInteractionFocusTarget) => boolean;
|
|
76
|
+
closeMenu: (menuId: string, focusParent?: boolean) => boolean;
|
|
77
|
+
closeSubmenus: (menuId: string, exceptMenuId?: string) => void;
|
|
78
|
+
selectItem: (id: string, originalEvent?: Event) => void;
|
|
79
|
+
activateItem: (id: string, originalEvent?: Event) => void;
|
|
80
|
+
hoverItem: (id: string, openSubmenu?: boolean) => void;
|
|
81
|
+
reconcile: (menuId?: string) => void;
|
|
82
|
+
onTriggerClick: (beforeToggle?: () => void) => void;
|
|
83
|
+
onTriggerKeydown: (event: KeyboardEvent, beforeOpen?: () => void) => void;
|
|
84
|
+
onMenuKeydown: (menuId: string, event: KeyboardEvent) => void;
|
|
85
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { DropdownMenuCloseOptions, DropdownMenuInteractOutsideEvent, DropdownMenuItem, DropdownMenuProps, DropdownMenuSelectEvent } from './types.js';
|
|
3
3
|
export declare function useDropdownMenu(props: Readonly<DropdownMenuProps>, emit?: {
|
|
4
4
|
openChange?: (open: boolean) => void;
|
|
5
5
|
select?: (item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void;
|
|
@@ -17,7 +17,7 @@ export declare function useDropdownMenu(props: Readonly<DropdownMenuProps>, emit
|
|
|
17
17
|
renderedItems: import('vue').ComputedRef<import('./types.js').DropdownMenuRenderedItem[]>;
|
|
18
18
|
renderContext: import('./useDropdownMenuRenderItems.js').DropdownMenuRenderContext;
|
|
19
19
|
focusedIndex: import('vue').ComputedRef<number>;
|
|
20
|
-
focusedPath: import('vue').Ref<
|
|
20
|
+
focusedPath: import('vue').Ref<import('./types.js').DropdownMenuItemPath, import('./types.js').DropdownMenuItemPath>;
|
|
21
21
|
activeDescendantId: import('vue').ComputedRef<string | undefined>;
|
|
22
22
|
rootClass: import('vue').ComputedRef<string[]>;
|
|
23
23
|
contentClass: import('vue').ComputedRef<string[]>;
|
|
@@ -28,18 +28,18 @@ export declare function useDropdownMenu(props: Readonly<DropdownMenuProps>, emit
|
|
|
28
28
|
isTargetMode: import('vue').ComputedRef<boolean>;
|
|
29
29
|
teleportTo: import('vue').ComputedRef<import('../floating/index.js').TeleportTargetValue>;
|
|
30
30
|
shouldTeleport: import('vue').ComputedRef<boolean>;
|
|
31
|
-
triggerProps: import('vue').ComputedRef<DropdownMenuTriggerProps>;
|
|
32
|
-
contentProps: import('vue').ComputedRef<DropdownMenuContentProps>;
|
|
33
|
-
slotProps: import('vue').ComputedRef<DropdownMenuSlotProps>;
|
|
31
|
+
triggerProps: import('vue').ComputedRef<import('./types.js').DropdownMenuTriggerProps>;
|
|
32
|
+
contentProps: import('vue').ComputedRef<import('./types.js').DropdownMenuContentProps>;
|
|
33
|
+
slotProps: import('vue').ComputedRef<import('./types.js').DropdownMenuSlotProps>;
|
|
34
34
|
open: (options?: import('./types.js').DropdownMenuOpenOptions | import('./types.js').DropdownMenuFocusTarget) => void;
|
|
35
|
-
close: (options?:
|
|
35
|
+
close: (options?: DropdownMenuCloseOptions) => void;
|
|
36
36
|
toggle: () => void;
|
|
37
37
|
selectItem: (item: DropdownMenuItem, originalEvent?: Event) => void;
|
|
38
|
-
openSubmenu: (path: import('./dropdown-menu-
|
|
39
|
-
closeSubmenu: (path: import('./dropdown-menu-
|
|
40
|
-
onItemMouseenter: (item: DropdownMenuItem, indexOrPath: number | import('./dropdown-menu-
|
|
38
|
+
openSubmenu: (path: import('./dropdown-menu-model.js').ItemPath, focus?: import('./dropdown-menu-model.js').SubmenuFocusTarget, point?: import('../../utils/geometry.js').Point) => boolean;
|
|
39
|
+
closeSubmenu: (path: import('./dropdown-menu-model.js').ItemPath) => boolean;
|
|
40
|
+
onItemMouseenter: (item: DropdownMenuItem, indexOrPath: number | import('./dropdown-menu-model.js').ItemPath, event?: MouseEvent) => void;
|
|
41
41
|
onTriggerKeydown: (event: KeyboardEvent) => void;
|
|
42
42
|
onMenuKeydown: (event: KeyboardEvent) => void;
|
|
43
|
-
getItemProps: (item: DropdownMenuItem, indexOrPath: number | import('./dropdown-menu-
|
|
44
|
-
getItemSlotProps: (item: DropdownMenuItem, indexOrPath: number | import('./dropdown-menu-
|
|
43
|
+
getItemProps: (item: DropdownMenuItem, indexOrPath: number | import('./dropdown-menu-model.js').ItemPath, focused?: boolean, disabled?: boolean, submenuOpen?: boolean) => import('./types.js').DropdownMenuItemProps;
|
|
44
|
+
getItemSlotProps: (item: DropdownMenuItem, indexOrPath: number | import('./dropdown-menu-model.js').ItemPath, focused?: boolean, disabled?: boolean, submenuOpen?: boolean) => import('./types.js').DropdownMenuItemSlotProps;
|
|
45
45
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentElementRef } from '../../utils/dom/componentRef.js';
|
|
2
|
+
import { DropdownMenuContextTriggerPrimitiveProps } from './types.js';
|
|
3
|
+
export declare function useDropdownMenuContextTrigger(props: Readonly<DropdownMenuContextTriggerPrimitiveProps>): {
|
|
4
|
+
isOpen: import('vue').ComputedRef<boolean>;
|
|
5
|
+
rootAttrs: import('vue').ComputedRef<{
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
}>;
|
|
8
|
+
setElement: (value: ComponentElementRef) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Point } from '../../utils/geometry.js';
|
|
3
|
+
import { ItemPath, SubmenuFocusTarget } from './dropdown-menu-model.js';
|
|
4
|
+
import { DropdownMenuInteractionRuntime } from './dropdownMenuInteraction.js';
|
|
5
|
+
import { DropdownMenuItem, DropdownMenuPlacement, DropdownMenuProps, DropdownMenuSelectEvent } from './types.js';
|
|
6
|
+
interface UseDropdownMenuDataControllerOptions {
|
|
7
|
+
props: Readonly<DropdownMenuProps>;
|
|
8
|
+
items: Readonly<Ref<DropdownMenuItem[]>>;
|
|
9
|
+
rootMenuId: string;
|
|
10
|
+
menuId: Readonly<Ref<string>>;
|
|
11
|
+
menuRef: Readonly<Ref<HTMLElement | null>>;
|
|
12
|
+
actualPlacement: Readonly<Ref<DropdownMenuPlacement>>;
|
|
13
|
+
interaction: DropdownMenuInteractionRuntime;
|
|
14
|
+
onSelect?: (item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function useDropdownMenuDataController({ props, items, rootMenuId, menuId, menuRef, actualPlacement, interaction, onSelect, }: UseDropdownMenuDataControllerOptions): {
|
|
17
|
+
focusedPath: Ref<import('./types.js').DropdownMenuItemPath, import('./types.js').DropdownMenuItemPath>;
|
|
18
|
+
focusedIndex: import('vue').ComputedRef<number>;
|
|
19
|
+
activeDescendantId: import('vue').ComputedRef<string | undefined>;
|
|
20
|
+
getItemId: (path: ItemPath) => string;
|
|
21
|
+
getSubmenuId: (path: ItemPath) => string;
|
|
22
|
+
getItemElement: (path: ItemPath) => HTMLElement | null;
|
|
23
|
+
getMenuActiveDescendant: (path: ItemPath) => string | undefined;
|
|
24
|
+
isItemFocused: (indexOrPath: number | ItemPath) => boolean;
|
|
25
|
+
isSubmenuOpen: (path: ItemPath) => boolean;
|
|
26
|
+
openSubmenu: (path: ItemPath, focus?: SubmenuFocusTarget, point?: Point) => boolean;
|
|
27
|
+
closeSubmenu: (path: ItemPath) => boolean;
|
|
28
|
+
focusHoveredItem: (item: DropdownMenuItem, indexOrPath: number | ItemPath, event?: MouseEvent) => void;
|
|
29
|
+
onMenuMousemove: (event: MouseEvent) => void;
|
|
30
|
+
resetHoverIntent: () => void;
|
|
31
|
+
selectItem: (item: DropdownMenuItem, originalEvent?: Event) => void;
|
|
32
|
+
activateItem: (_item: DropdownMenuItem, path: ItemPath, event?: MouseEvent | KeyboardEvent) => void;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { DropdownMenuDataIndex } from './dropdownMenuDataModel.js';
|
|
3
|
+
import { DropdownMenuInteractionRuntime } from './dropdownMenuInteraction.js';
|
|
4
|
+
import { DropdownMenuItem, DropdownMenuProps, DropdownMenuSelectEvent } from './types.js';
|
|
5
|
+
import { ItemPath } from './dropdown-menu-model.js';
|
|
6
|
+
type DropdownMenuDataInteraction = Pick<DropdownMenuInteractionRuntime, 'reconcile' | 'registerItem' | 'registerMenu' | 'unregisterItem' | 'unregisterMenu'>;
|
|
7
|
+
interface UseDropdownMenuDataRegistrationOptions {
|
|
8
|
+
props: Readonly<DropdownMenuProps>;
|
|
9
|
+
items: Readonly<Ref<DropdownMenuItem[]>>;
|
|
10
|
+
rootMenuId: string;
|
|
11
|
+
interaction: DropdownMenuDataInteraction;
|
|
12
|
+
menuRef: Readonly<Ref<HTMLElement | null>>;
|
|
13
|
+
getItemElement: (path: ItemPath) => HTMLElement | null;
|
|
14
|
+
getSubmenuElement: (path: ItemPath) => HTMLElement | null;
|
|
15
|
+
isSubmenuOpeningLeft: (path: ItemPath) => boolean;
|
|
16
|
+
onSelect?: (item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function useDropdownMenuDataRegistration({ props, items, rootMenuId, interaction, menuRef, getItemElement, getSubmenuElement, isSubmenuOpeningLeft, onSelect, }: UseDropdownMenuDataRegistrationOptions): {
|
|
19
|
+
openMenuIds: Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
|
|
20
|
+
registrationIndex: import('vue').ShallowRef<DropdownMenuDataIndex, DropdownMenuDataIndex>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
+
import { Point, Triangle } from '../../utils/geometry.js';
|
|
3
|
+
import { ItemPath } from './dropdown-menu-model.js';
|
|
2
4
|
import { DropdownMenuItem } from './types.js';
|
|
3
|
-
|
|
4
|
-
export type SafeTriangle = [PointerPoint, PointerPoint, PointerPoint];
|
|
5
|
+
export type SafeTriangle = Triangle;
|
|
5
6
|
type GetSafeTriangleOptions = {
|
|
6
7
|
itemRect: DOMRect | null;
|
|
7
8
|
submenuRect: DOMRect;
|
|
8
|
-
origin:
|
|
9
|
+
origin: Point;
|
|
9
10
|
};
|
|
10
|
-
type HoverCommit = (item: DropdownMenuItem, path: ItemPath, point?:
|
|
11
|
+
type HoverCommit = (item: DropdownMenuItem, path: ItemPath, point?: Point) => void;
|
|
11
12
|
type UseDropdownMenuHoverIntentOptions = {
|
|
12
13
|
openSubmenuPath: Ref<ItemPath>;
|
|
13
14
|
getItemElement: (path: ItemPath) => HTMLElement | null;
|
|
@@ -17,7 +18,7 @@ export declare function getDropdownMenuSafeTriangle({ itemRect, submenuRect, ori
|
|
|
17
18
|
export declare function useDropdownMenuHoverIntent({ openSubmenuPath, getItemElement, getSubmenuElement, }: UseDropdownMenuHoverIntentOptions): {
|
|
18
19
|
clearPendingHover: () => void;
|
|
19
20
|
resetHoverIntent: () => void;
|
|
20
|
-
trackSubmenuOpen: (path: ItemPath, point?:
|
|
21
|
+
trackSubmenuOpen: (path: ItemPath, point?: Point) => void;
|
|
21
22
|
handleItemHover: (item: DropdownMenuItem, path: ItemPath, event: MouseEvent | undefined, commit: HoverCommit) => void;
|
|
22
23
|
handleMenuMousemove: (event: MouseEvent, commit: HoverCommit) => void;
|
|
23
24
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DropdownMenuCloseOptions } from './types.js';
|
|
2
|
+
import { DropdownMenuInteractionRegistry } from './dropdownMenuInteractionRegistry.js';
|
|
3
|
+
import { DropdownMenuInteractionDismissalRegistration, DropdownMenuInteractionHost } from './dropdownMenuInteractionTypes.js';
|
|
4
|
+
type DropdownMenuDismissalRegistry = Pick<DropdownMenuInteractionRegistry, 'activeMenuId' | 'focusMenuElement'>;
|
|
5
|
+
interface UseDropdownMenuInteractionDismissalOptions {
|
|
6
|
+
host: DropdownMenuInteractionHost;
|
|
7
|
+
registry: DropdownMenuDismissalRegistry;
|
|
8
|
+
closeRoot: (options?: DropdownMenuCloseOptions & {
|
|
9
|
+
returnFocus?: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function useDropdownMenuInteractionDismissal({ host, registry, closeRoot, }: UseDropdownMenuInteractionDismissalOptions): {
|
|
13
|
+
registerInside: (element: Element) => void;
|
|
14
|
+
unregisterInside: (element: Element) => void;
|
|
15
|
+
registerDismissal: (registration: DropdownMenuInteractionDismissalRegistration) => () => void;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DropdownMenuCloseOptions, DropdownMenuFocusTarget, DropdownMenuOpenOptions } from './types.js';
|
|
2
|
+
import { DropdownMenuInteractionNavigation } from './dropdownMenuInteractionNavigation.js';
|
|
3
|
+
import { DropdownMenuInteractionRegistry } from './dropdownMenuInteractionRegistry.js';
|
|
4
|
+
import { DropdownMenuInteractionHost } from './dropdownMenuInteractionTypes.js';
|
|
5
|
+
interface UseDropdownMenuInteractionKeyboardOptions {
|
|
6
|
+
host: DropdownMenuInteractionHost;
|
|
7
|
+
registry: DropdownMenuInteractionRegistry;
|
|
8
|
+
navigation: DropdownMenuInteractionNavigation;
|
|
9
|
+
openRoot: (options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) => void;
|
|
10
|
+
closeRoot: (options?: DropdownMenuCloseOptions & {
|
|
11
|
+
returnFocus?: boolean;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function useDropdownMenuInteractionKeyboard({ host, registry, navigation, openRoot, closeRoot, }: UseDropdownMenuInteractionKeyboardOptions): {
|
|
15
|
+
onMenuKeydown: (menuId: string, event: KeyboardEvent) => void;
|
|
16
|
+
onTriggerKeydown: (event: KeyboardEvent, beforeOpen?: () => void) => void;
|
|
17
|
+
resetTypeahead: () => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -10,7 +10,6 @@ export declare function useDropdownMenuPortalPosition(options: {
|
|
|
10
10
|
arrowRef: Ref<HTMLElement | null>;
|
|
11
11
|
isVisible: BooleanSource;
|
|
12
12
|
placement: PlacementSource;
|
|
13
|
-
restartKey: () => unknown;
|
|
14
13
|
}): {
|
|
15
14
|
actualPlacement: Readonly<Ref<import('../floating/index.js').FloatingPlacement, import('../floating/index.js').FloatingPlacement>>;
|
|
16
15
|
arrowStyle: Readonly<Ref<import('vue').CSSProperties | undefined, import('vue').CSSProperties | undefined>>;
|