@nuxt/ui 4.2.1 → 4.4.0
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/.nuxt/ui.css +2 -0
- package/README.md +6 -5
- package/cli/package.json +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -4
- package/dist/runtime/components/Accordion.d.vue.ts +16 -7
- package/dist/runtime/components/Accordion.vue +2 -1
- package/dist/runtime/components/Accordion.vue.d.ts +16 -7
- package/dist/runtime/components/Alert.d.vue.ts +4 -4
- package/dist/runtime/components/Alert.vue.d.ts +4 -4
- package/dist/runtime/components/App.d.vue.ts +10 -6
- package/dist/runtime/components/App.vue.d.ts +10 -6
- package/dist/runtime/components/AuthForm.d.vue.ts +53 -11
- package/dist/runtime/components/AuthForm.vue.d.ts +53 -11
- package/dist/runtime/components/Avatar.d.vue.ts +2 -2
- package/dist/runtime/components/Avatar.vue.d.ts +2 -2
- package/dist/runtime/components/AvatarGroup.d.vue.ts +1 -1
- package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Badge.d.vue.ts +2 -2
- package/dist/runtime/components/Badge.vue.d.ts +2 -2
- package/dist/runtime/components/Banner.d.vue.ts +5 -6
- package/dist/runtime/components/Banner.vue +49 -23
- package/dist/runtime/components/Banner.vue.d.ts +5 -6
- package/dist/runtime/components/BlogPost.d.vue.ts +2 -2
- package/dist/runtime/components/BlogPost.vue +0 -1
- package/dist/runtime/components/BlogPost.vue.d.ts +2 -2
- package/dist/runtime/components/BlogPosts.d.vue.ts +10 -6
- package/dist/runtime/components/BlogPosts.vue.d.ts +10 -6
- package/dist/runtime/components/Breadcrumb.d.vue.ts +10 -6
- package/dist/runtime/components/Breadcrumb.vue.d.ts +10 -6
- package/dist/runtime/components/Button.d.vue.ts +1 -1
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.d.vue.ts +17 -12
- package/dist/runtime/components/Calendar.vue +13 -2
- package/dist/runtime/components/Calendar.vue.d.ts +17 -12
- package/dist/runtime/components/Card.d.vue.ts +1 -1
- package/dist/runtime/components/Card.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.d.vue.ts +14 -10
- package/dist/runtime/components/Carousel.vue +22 -0
- package/dist/runtime/components/Carousel.vue.d.ts +14 -10
- package/dist/runtime/components/ChangelogVersion.d.vue.ts +2 -2
- package/dist/runtime/components/ChangelogVersion.vue +0 -1
- package/dist/runtime/components/ChangelogVersion.vue.d.ts +2 -2
- package/dist/runtime/components/ChangelogVersions.d.vue.ts +14 -8
- package/dist/runtime/components/ChangelogVersions.vue +3 -2
- package/dist/runtime/components/ChangelogVersions.vue.d.ts +14 -8
- package/dist/runtime/components/ChatMessage.d.vue.ts +2 -2
- package/dist/runtime/components/ChatMessage.vue.d.ts +2 -2
- package/dist/runtime/components/ChatMessages.d.vue.ts +5 -5
- package/dist/runtime/components/ChatMessages.vue.d.ts +5 -5
- package/dist/runtime/components/ChatPalette.d.vue.ts +1 -1
- package/dist/runtime/components/ChatPalette.vue.d.ts +1 -1
- package/dist/runtime/components/ChatPrompt.d.vue.ts +3 -3
- package/dist/runtime/components/ChatPrompt.vue.d.ts +3 -3
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +7 -7
- package/dist/runtime/components/ChatPromptSubmit.vue +1 -20
- package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +7 -7
- package/dist/runtime/components/Checkbox.d.vue.ts +2 -2
- package/dist/runtime/components/Checkbox.vue.d.ts +2 -2
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +12 -8
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +12 -8
- package/dist/runtime/components/Chip.d.vue.ts +2 -2
- package/dist/runtime/components/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/Collapsible.d.vue.ts +2 -2
- package/dist/runtime/components/Collapsible.vue.d.ts +2 -2
- package/dist/runtime/components/ColorPicker.d.vue.ts +2 -2
- package/dist/runtime/components/ColorPicker.vue.d.ts +2 -2
- package/dist/runtime/components/CommandPalette.d.vue.ts +31 -13
- package/dist/runtime/components/CommandPalette.vue +26 -18
- package/dist/runtime/components/CommandPalette.vue.d.ts +31 -13
- package/dist/runtime/components/Container.d.vue.ts +1 -1
- package/dist/runtime/components/Container.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +17 -9
- package/dist/runtime/components/ContextMenu.vue.d.ts +17 -9
- package/dist/runtime/components/ContextMenuContent.d.vue.ts +11 -7
- package/dist/runtime/components/ContextMenuContent.vue +12 -13
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +11 -7
- package/dist/runtime/components/DashboardGroup.d.vue.ts +2 -2
- package/dist/runtime/components/DashboardGroup.vue.d.ts +2 -2
- package/dist/runtime/components/DashboardNavbar.d.vue.ts +5 -5
- package/dist/runtime/components/DashboardNavbar.vue.d.ts +5 -5
- package/dist/runtime/components/DashboardPanel.d.vue.ts +2 -2
- package/dist/runtime/components/DashboardPanel.vue.d.ts +2 -2
- package/dist/runtime/components/DashboardResizeHandle.d.vue.ts +1 -1
- package/dist/runtime/components/DashboardResizeHandle.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardSearch.d.vue.ts +10 -6
- package/dist/runtime/components/DashboardSearch.vue +3 -1
- package/dist/runtime/components/DashboardSearch.vue.d.ts +10 -6
- package/dist/runtime/components/DashboardSearchButton.d.vue.ts +5 -5
- package/dist/runtime/components/DashboardSearchButton.vue +1 -20
- package/dist/runtime/components/DashboardSearchButton.vue.d.ts +5 -5
- package/dist/runtime/components/DashboardSidebar.d.vue.ts +13 -9
- package/dist/runtime/components/DashboardSidebar.vue.d.ts +13 -9
- package/dist/runtime/components/DashboardSidebarCollapse.d.vue.ts +5 -5
- package/dist/runtime/components/DashboardSidebarCollapse.vue +1 -20
- package/dist/runtime/components/DashboardSidebarCollapse.vue.d.ts +5 -5
- package/dist/runtime/components/DashboardSidebarToggle.d.vue.ts +5 -5
- package/dist/runtime/components/DashboardSidebarToggle.vue +1 -20
- package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +5 -5
- package/dist/runtime/components/DashboardToolbar.d.vue.ts +1 -1
- package/dist/runtime/components/DashboardToolbar.vue.d.ts +1 -1
- package/dist/runtime/components/Drawer.d.vue.ts +3 -3
- package/dist/runtime/components/Drawer.vue.d.ts +3 -3
- package/dist/runtime/components/DropdownMenu.d.vue.ts +17 -9
- package/dist/runtime/components/DropdownMenu.vue.d.ts +17 -9
- package/dist/runtime/components/DropdownMenuContent.d.vue.ts +11 -7
- package/dist/runtime/components/DropdownMenuContent.vue +12 -13
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +11 -7
- package/dist/runtime/components/Editor.d.vue.ts +101 -0
- package/dist/runtime/components/Editor.vue +199 -0
- package/dist/runtime/components/Editor.vue.d.ts +101 -0
- package/dist/runtime/components/EditorDragHandle.d.vue.ts +68 -0
- package/dist/runtime/components/EditorDragHandle.vue +127 -0
- package/dist/runtime/components/EditorDragHandle.vue.d.ts +68 -0
- package/dist/runtime/components/EditorEmojiMenu.d.vue.ts +41 -0
- package/dist/runtime/components/EditorEmojiMenu.vue +73 -0
- package/dist/runtime/components/EditorEmojiMenu.vue.d.ts +41 -0
- package/dist/runtime/components/EditorMentionMenu.d.vue.ts +49 -0
- package/dist/runtime/components/EditorMentionMenu.vue +79 -0
- package/dist/runtime/components/EditorMentionMenu.vue.d.ts +49 -0
- package/dist/runtime/components/EditorSuggestionMenu.d.vue.ts +58 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue +83 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue.d.ts +58 -0
- package/dist/runtime/components/EditorToolbar.d.vue.ts +92 -0
- package/dist/runtime/components/EditorToolbar.vue +242 -0
- package/dist/runtime/components/EditorToolbar.vue.d.ts +92 -0
- package/dist/runtime/components/Empty.d.vue.ts +1 -1
- package/dist/runtime/components/Empty.vue.d.ts +1 -1
- package/dist/runtime/components/Error.d.vue.ts +6 -5
- package/dist/runtime/components/Error.vue +1 -1
- package/dist/runtime/components/Error.vue.d.ts +6 -5
- package/dist/runtime/components/FieldGroup.d.vue.ts +2 -2
- package/dist/runtime/components/FieldGroup.vue.d.ts +2 -2
- package/dist/runtime/components/FileUpload.d.vue.ts +13 -9
- package/dist/runtime/components/FileUpload.vue +2 -2
- package/dist/runtime/components/FileUpload.vue.d.ts +13 -9
- package/dist/runtime/components/Footer.d.vue.ts +2 -2
- package/dist/runtime/components/Footer.vue.d.ts +2 -2
- package/dist/runtime/components/FooterColumns.d.vue.ts +10 -6
- package/dist/runtime/components/FooterColumns.vue.d.ts +10 -6
- package/dist/runtime/components/Form.d.vue.ts +11 -7
- package/dist/runtime/components/Form.vue.d.ts +11 -7
- package/dist/runtime/components/FormField.d.vue.ts +8 -1
- package/dist/runtime/components/FormField.vue +6 -5
- package/dist/runtime/components/FormField.vue.d.ts +8 -1
- package/dist/runtime/components/Header.d.vue.ts +13 -9
- package/dist/runtime/components/Header.vue.d.ts +13 -9
- package/dist/runtime/components/Icon.d.vue.ts +1 -1
- package/dist/runtime/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/Input.d.vue.ts +14 -10
- package/dist/runtime/components/Input.vue.d.ts +14 -10
- package/dist/runtime/components/InputDate.d.vue.ts +13 -9
- package/dist/runtime/components/InputDate.vue.d.ts +13 -9
- package/dist/runtime/components/InputMenu.d.vue.ts +34 -13
- package/dist/runtime/components/InputMenu.vue +56 -11
- package/dist/runtime/components/InputMenu.vue.d.ts +34 -13
- package/dist/runtime/components/InputNumber.d.vue.ts +18 -14
- package/dist/runtime/components/InputNumber.vue +1 -1
- package/dist/runtime/components/InputNumber.vue.d.ts +18 -14
- package/dist/runtime/components/InputTags.d.vue.ts +13 -9
- package/dist/runtime/components/InputTags.vue.d.ts +13 -9
- package/dist/runtime/components/InputTime.d.vue.ts +4 -4
- package/dist/runtime/components/InputTime.vue.d.ts +4 -4
- package/dist/runtime/components/Kbd.d.vue.ts +2 -2
- package/dist/runtime/components/Kbd.vue.d.ts +2 -2
- package/dist/runtime/components/Link.d.vue.ts +8 -3
- package/dist/runtime/components/Link.vue.d.ts +8 -3
- package/dist/runtime/components/LinkBase.d.vue.ts +3 -3
- package/dist/runtime/components/LinkBase.vue.d.ts +3 -3
- package/dist/runtime/components/Main.d.vue.ts +4 -2
- package/dist/runtime/components/Main.vue +1 -1
- package/dist/runtime/components/Main.vue.d.ts +4 -2
- package/dist/runtime/components/Marquee.d.vue.ts +3 -3
- package/dist/runtime/components/Marquee.vue.d.ts +3 -3
- package/dist/runtime/components/Modal.d.vue.ts +7 -7
- package/dist/runtime/components/Modal.vue.d.ts +7 -7
- package/dist/runtime/components/NavigationMenu.d.vue.ts +17 -8
- package/dist/runtime/components/NavigationMenu.vue +3 -2
- package/dist/runtime/components/NavigationMenu.vue.d.ts +17 -8
- package/dist/runtime/components/Page.d.vue.ts +1 -1
- package/dist/runtime/components/Page.vue.d.ts +1 -1
- package/dist/runtime/components/PageAnchors.d.vue.ts +10 -6
- package/dist/runtime/components/PageAnchors.vue.d.ts +10 -6
- package/dist/runtime/components/PageAside.d.vue.ts +2 -2
- package/dist/runtime/components/PageAside.vue.d.ts +2 -2
- package/dist/runtime/components/PageBody.d.vue.ts +1 -1
- package/dist/runtime/components/PageBody.vue.d.ts +1 -1
- package/dist/runtime/components/PageCTA.d.vue.ts +2 -2
- package/dist/runtime/components/PageCTA.vue.d.ts +2 -2
- package/dist/runtime/components/PageCard.d.vue.ts +2 -2
- package/dist/runtime/components/PageCard.vue.d.ts +2 -2
- package/dist/runtime/components/PageColumns.d.vue.ts +1 -1
- package/dist/runtime/components/PageColumns.vue.d.ts +1 -1
- package/dist/runtime/components/PageFeature.d.vue.ts +2 -2
- package/dist/runtime/components/PageFeature.vue +2 -2
- package/dist/runtime/components/PageFeature.vue.d.ts +2 -2
- package/dist/runtime/components/PageGrid.d.vue.ts +1 -1
- package/dist/runtime/components/PageGrid.vue.d.ts +1 -1
- package/dist/runtime/components/PageHeader.d.vue.ts +1 -1
- package/dist/runtime/components/PageHeader.vue.d.ts +1 -1
- package/dist/runtime/components/PageHero.d.vue.ts +2 -2
- package/dist/runtime/components/PageHero.vue.d.ts +2 -2
- package/dist/runtime/components/PageLinks.d.vue.ts +10 -6
- package/dist/runtime/components/PageLinks.vue.d.ts +10 -6
- package/dist/runtime/components/PageList.d.vue.ts +2 -2
- package/dist/runtime/components/PageList.vue.d.ts +2 -2
- package/dist/runtime/components/PageLogos.d.vue.ts +2 -2
- package/dist/runtime/components/PageLogos.vue.d.ts +2 -2
- package/dist/runtime/components/PageSection.d.vue.ts +2 -2
- package/dist/runtime/components/PageSection.vue.d.ts +2 -2
- package/dist/runtime/components/Pagination.d.vue.ts +4 -5
- package/dist/runtime/components/Pagination.vue.d.ts +4 -5
- package/dist/runtime/components/PinInput.d.vue.ts +13 -9
- package/dist/runtime/components/PinInput.vue +1 -1
- package/dist/runtime/components/PinInput.vue.d.ts +13 -9
- package/dist/runtime/components/Popover.d.vue.ts +11 -7
- package/dist/runtime/components/Popover.vue.d.ts +11 -7
- package/dist/runtime/components/PricingPlan.d.vue.ts +2 -2
- package/dist/runtime/components/PricingPlan.vue.d.ts +2 -2
- package/dist/runtime/components/PricingPlans.d.vue.ts +10 -6
- package/dist/runtime/components/PricingPlans.vue.d.ts +10 -6
- package/dist/runtime/components/PricingTable.d.vue.ts +10 -6
- package/dist/runtime/components/PricingTable.vue.d.ts +10 -6
- package/dist/runtime/components/Progress.d.vue.ts +2 -2
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.d.vue.ts +12 -8
- package/dist/runtime/components/RadioGroup.vue.d.ts +12 -8
- package/dist/runtime/components/ScrollArea.d.vue.ts +85 -0
- package/dist/runtime/components/ScrollArea.vue +187 -0
- package/dist/runtime/components/ScrollArea.vue.d.ts +85 -0
- package/dist/runtime/components/Select.d.vue.ts +21 -9
- package/dist/runtime/components/Select.vue +24 -6
- package/dist/runtime/components/Select.vue.d.ts +21 -9
- package/dist/runtime/components/SelectMenu.d.vue.ts +34 -13
- package/dist/runtime/components/SelectMenu.vue +58 -12
- package/dist/runtime/components/SelectMenu.vue.d.ts +34 -13
- package/dist/runtime/components/Separator.d.vue.ts +4 -4
- package/dist/runtime/components/Separator.vue.d.ts +4 -4
- package/dist/runtime/components/Skeleton.d.vue.ts +2 -2
- package/dist/runtime/components/Skeleton.vue.d.ts +2 -2
- package/dist/runtime/components/Slideover.d.vue.ts +12 -7
- package/dist/runtime/components/Slideover.vue +3 -1
- package/dist/runtime/components/Slideover.vue.d.ts +12 -7
- package/dist/runtime/components/Slider.d.vue.ts +12 -8
- package/dist/runtime/components/Slider.vue +2 -2
- package/dist/runtime/components/Slider.vue.d.ts +12 -8
- package/dist/runtime/components/Stepper.d.vue.ts +21 -9
- package/dist/runtime/components/Stepper.vue +20 -16
- package/dist/runtime/components/Stepper.vue.d.ts +21 -9
- package/dist/runtime/components/Switch.d.vue.ts +2 -2
- package/dist/runtime/components/Switch.vue.d.ts +2 -2
- package/dist/runtime/components/Table.d.vue.ts +27 -23
- package/dist/runtime/components/Table.vue +55 -33
- package/dist/runtime/components/Table.vue.d.ts +27 -23
- package/dist/runtime/components/Tabs.d.vue.ts +17 -8
- package/dist/runtime/components/Tabs.vue +5 -4
- package/dist/runtime/components/Tabs.vue.d.ts +17 -8
- package/dist/runtime/components/Textarea.d.vue.ts +14 -10
- package/dist/runtime/components/Textarea.vue.d.ts +14 -10
- package/dist/runtime/components/Timeline.d.vue.ts +24 -10
- package/dist/runtime/components/Timeline.vue +26 -17
- package/dist/runtime/components/Timeline.vue.d.ts +24 -10
- package/dist/runtime/components/Toast.d.vue.ts +5 -5
- package/dist/runtime/components/Toast.vue.d.ts +5 -5
- package/dist/runtime/components/Toaster.d.vue.ts +2 -2
- package/dist/runtime/components/Toaster.vue.d.ts +2 -2
- package/dist/runtime/components/Tooltip.d.vue.ts +2 -2
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/components/Tree.d.vue.ts +13 -9
- package/dist/runtime/components/Tree.vue.d.ts +13 -9
- package/dist/runtime/components/User.d.vue.ts +2 -2
- package/dist/runtime/components/User.vue +0 -1
- package/dist/runtime/components/User.vue.d.ts +2 -2
- package/dist/runtime/components/color-mode/ColorModeAvatar.d.vue.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue.d.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +5 -5
- package/dist/runtime/components/color-mode/ColorModeButton.vue +3 -22
- package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +5 -5
- package/dist/runtime/components/color-mode/ColorModeImage.d.vue.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeImage.vue.d.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeSelect.d.vue.ts +2 -2
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +5 -0
- package/dist/runtime/components/color-mode/ColorModeSelect.vue.d.ts +2 -2
- package/dist/runtime/components/color-mode/ColorModeSwitch.d.vue.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +11 -7
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +11 -7
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +18 -10
- package/dist/runtime/components/content/ContentSearch.vue +3 -1
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +18 -10
- package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +5 -5
- package/dist/runtime/components/content/ContentSearchButton.vue +1 -20
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +5 -5
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +10 -6
- package/dist/runtime/components/content/ContentSurround.vue +1 -1
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +10 -6
- package/dist/runtime/components/content/ContentToc.d.vue.ts +11 -7
- package/dist/runtime/components/content/ContentToc.vue.d.ts +11 -7
- package/dist/runtime/components/locale/LocaleSelect.d.vue.ts +2 -2
- package/dist/runtime/components/locale/LocaleSelect.vue +14 -3
- package/dist/runtime/components/locale/LocaleSelect.vue.d.ts +2 -2
- package/dist/runtime/components/prose/A.d.vue.ts +1 -1
- package/dist/runtime/components/prose/A.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Accordion.d.vue.ts +2 -2
- package/dist/runtime/components/prose/Accordion.vue.d.ts +2 -2
- package/dist/runtime/components/prose/AccordionItem.d.vue.ts +1 -1
- package/dist/runtime/components/prose/AccordionItem.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Badge.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Badge.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Blockquote.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Blockquote.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Callout.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Callout.vue +0 -1
- package/dist/runtime/components/prose/Callout.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Card.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Card.vue +0 -1
- package/dist/runtime/components/prose/Card.vue.d.ts +1 -1
- package/dist/runtime/components/prose/CardGroup.d.vue.ts +1 -1
- package/dist/runtime/components/prose/CardGroup.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Code.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Code.vue.d.ts +1 -1
- package/dist/runtime/components/prose/CodeCollapse.d.vue.ts +2 -2
- package/dist/runtime/components/prose/CodeCollapse.vue.d.ts +2 -2
- package/dist/runtime/components/prose/CodeGroup.d.vue.ts +2 -2
- package/dist/runtime/components/prose/CodeGroup.vue.d.ts +2 -2
- package/dist/runtime/components/prose/CodeIcon.d.vue.ts +1 -1
- package/dist/runtime/components/prose/CodeIcon.vue.d.ts +1 -1
- package/dist/runtime/components/prose/CodePreview.d.vue.ts +1 -1
- package/dist/runtime/components/prose/CodePreview.vue.d.ts +1 -1
- package/dist/runtime/components/prose/CodeTree.d.vue.ts +20 -1
- package/dist/runtime/components/prose/CodeTree.vue +34 -7
- package/dist/runtime/components/prose/CodeTree.vue.d.ts +20 -1
- package/dist/runtime/components/prose/Collapsible.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Collapsible.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Em.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Em.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Field.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Field.vue.d.ts +1 -1
- package/dist/runtime/components/prose/FieldGroup.d.vue.ts +1 -1
- package/dist/runtime/components/prose/FieldGroup.vue.d.ts +1 -1
- package/dist/runtime/components/prose/H1.d.vue.ts +1 -1
- package/dist/runtime/components/prose/H1.vue.d.ts +1 -1
- package/dist/runtime/components/prose/H2.d.vue.ts +1 -1
- package/dist/runtime/components/prose/H2.vue.d.ts +1 -1
- package/dist/runtime/components/prose/H3.d.vue.ts +1 -1
- package/dist/runtime/components/prose/H3.vue.d.ts +1 -1
- package/dist/runtime/components/prose/H4.d.vue.ts +1 -1
- package/dist/runtime/components/prose/H4.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Hr.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Hr.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Icon.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Img.d.vue.ts +2 -2
- package/dist/runtime/components/prose/Img.vue.d.ts +2 -2
- package/dist/runtime/components/prose/Kbd.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Kbd.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Li.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Li.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Ol.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Ol.vue.d.ts +1 -1
- package/dist/runtime/components/prose/P.d.vue.ts +1 -1
- package/dist/runtime/components/prose/P.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Pre.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Pre.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Steps.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Steps.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Strong.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Strong.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Table.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Table.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Tabs.d.vue.ts +2 -2
- package/dist/runtime/components/prose/Tabs.vue.d.ts +2 -2
- package/dist/runtime/components/prose/TabsItem.d.vue.ts +1 -1
- package/dist/runtime/components/prose/TabsItem.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Tbody.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Tbody.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Td.d.vue.ts +2 -1
- package/dist/runtime/components/prose/Td.vue +2 -1
- package/dist/runtime/components/prose/Td.vue.d.ts +2 -1
- package/dist/runtime/components/prose/Th.d.vue.ts +2 -1
- package/dist/runtime/components/prose/Th.vue +2 -1
- package/dist/runtime/components/prose/Th.vue.d.ts +2 -1
- package/dist/runtime/components/prose/Thead.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Thead.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Tr.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Tr.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Ul.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Ul.vue.d.ts +1 -1
- package/dist/runtime/components/prose/callout/Caution.d.vue.ts +2 -2
- package/dist/runtime/components/prose/callout/Caution.vue.d.ts +2 -2
- package/dist/runtime/components/prose/callout/Note.d.vue.ts +2 -2
- package/dist/runtime/components/prose/callout/Note.vue.d.ts +2 -2
- package/dist/runtime/components/prose/callout/Tip.d.vue.ts +2 -2
- package/dist/runtime/components/prose/callout/Tip.vue.d.ts +2 -2
- package/dist/runtime/components/prose/callout/Warning.d.vue.ts +2 -2
- package/dist/runtime/components/prose/callout/Warning.vue.d.ts +2 -2
- package/dist/runtime/composables/defineShortcuts.d.ts +2 -1
- package/dist/runtime/composables/defineShortcuts.js +63 -16
- package/dist/runtime/composables/useEditorMenu.d.ts +75 -0
- package/dist/runtime/composables/useEditorMenu.js +435 -0
- package/dist/runtime/composables/useFileUpload.d.ts +1 -2
- package/dist/runtime/composables/useOverlay.d.ts +3 -1
- package/dist/runtime/locale/cs.js +2 -2
- package/dist/runtime/locale/en_gb.d.ts +3 -0
- package/dist/runtime/locale/en_gb.js +7 -0
- package/dist/runtime/locale/eu.d.ts +3 -0
- package/dist/runtime/locale/eu.js +129 -0
- package/dist/runtime/locale/index.d.ts +3 -0
- package/dist/runtime/locale/index.js +3 -0
- package/dist/runtime/locale/lo.d.ts +3 -0
- package/dist/runtime/locale/lo.js +129 -0
- package/dist/runtime/locale/sk.js +2 -2
- package/dist/runtime/types/editor.d.ts +70 -0
- package/dist/runtime/types/editor.js +0 -0
- package/dist/runtime/types/index.d.ts +8 -0
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/utils/ai.d.ts +7 -0
- package/dist/runtime/utils/content.d.ts +2 -2
- package/dist/runtime/utils/editor.d.ts +69 -0
- package/dist/runtime/utils/editor.js +382 -0
- package/dist/runtime/utils/fuse.js +22 -3
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +2 -2
- package/dist/runtime/utils/locale.d.ts +1 -2
- package/dist/runtime/utils/virtualizer.d.ts +1 -3
- package/dist/runtime/utils/virtualizer.js +15 -6
- package/dist/runtime/vue/components/Icon.d.vue.ts +1 -1
- package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.d.vue.ts +2 -2
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +5 -0
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue.d.ts +2 -2
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.d.vue.ts +1 -1
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
- package/dist/runtime/{inertia/components → vue/overrides/inertia}/Link.d.vue.ts +4 -4
- package/dist/runtime/{inertia/components → vue/overrides/inertia}/Link.vue +3 -3
- package/dist/runtime/{inertia/components → vue/overrides/inertia}/Link.vue.d.ts +4 -4
- package/dist/runtime/{inertia/components → vue/overrides/inertia}/LinkBase.d.vue.ts +4 -4
- package/dist/runtime/{inertia/components → vue/overrides/inertia}/LinkBase.vue.d.ts +4 -4
- package/dist/runtime/vue/overrides/none/Link.d.vue.ts +76 -0
- package/dist/runtime/vue/overrides/none/Link.vue +130 -0
- package/dist/runtime/vue/overrides/none/Link.vue.d.ts +76 -0
- package/dist/runtime/vue/{components → overrides/vue-router}/Link.d.vue.ts +4 -4
- package/dist/runtime/vue/{components → overrides/vue-router}/Link.vue +6 -6
- package/dist/runtime/vue/{components → overrides/vue-router}/Link.vue.d.ts +4 -4
- package/dist/runtime/vue/plugins/router.d.ts +4 -0
- package/dist/runtime/vue/plugins/router.js +7 -0
- package/dist/runtime/vue/{stubs.d.ts → stubs/base.d.ts} +4 -5
- package/dist/runtime/vue/{stubs.js → stubs/base.js} +4 -5
- package/dist/runtime/vue/stubs/inertia.d.ts +5 -0
- package/dist/runtime/vue/stubs/inertia.js +10 -0
- package/dist/runtime/vue/stubs/none.d.ts +56 -0
- package/dist/runtime/vue/stubs/none.js +48 -0
- package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
- package/dist/runtime/vue/stubs/vue-router.js +2 -0
- package/dist/shared/{ui.B77q-Dvh.mjs → ui.Ddb3hKxo.mjs} +511 -81
- package/dist/unplugin.d.mts +14 -0
- package/dist/unplugin.mjs +77 -50
- package/dist/vite.d.mts +2 -3
- package/dist/vite.mjs +1 -1
- package/package.json +64 -34
- package/dist/runtime/inertia/stubs.d.ts +0 -44
- package/dist/runtime/inertia/stubs.js +0 -84
- /package/dist/runtime/{inertia/components → vue/overrides/inertia}/LinkBase.vue +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_8: {
|
|
2
2
|
mdcUnwrap: string;
|
|
3
3
|
};
|
|
4
4
|
type __VLS_Slots = {} & {
|
|
5
|
-
default?: (props: typeof
|
|
5
|
+
default?: (props: typeof __VLS_8) => any;
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -9,7 +9,8 @@ export interface ShortcutsConfig {
|
|
|
9
9
|
}
|
|
10
10
|
export interface ShortcutsOptions {
|
|
11
11
|
chainDelay?: number;
|
|
12
|
+
layoutIndependent?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare function extractShortcuts(items: any[] | any[][]): Record<string, Handler>;
|
|
14
|
+
export declare function extractShortcuts(items: any[] | any[][], separator?: '_' | '-'): Record<string, Handler>;
|
|
14
15
|
export declare function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options?: ShortcutsOptions): import("@vueuse/shared").Fn;
|
|
15
16
|
export {};
|
|
@@ -4,12 +4,36 @@ import { useKbd } from "./useKbd.js";
|
|
|
4
4
|
const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/;
|
|
5
5
|
const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/;
|
|
6
6
|
const shiftableKeys = ["arrowleft", "arrowright", "arrowup", "arrowright", "tab", "escape", "enter", "backspace"];
|
|
7
|
-
|
|
7
|
+
function convertKeyToCode(key) {
|
|
8
|
+
if (/^[a-z]$/i.test(key)) {
|
|
9
|
+
return `Key${key.toUpperCase()}`;
|
|
10
|
+
}
|
|
11
|
+
if (/^\d$/.test(key)) {
|
|
12
|
+
return `Digit${key}`;
|
|
13
|
+
}
|
|
14
|
+
if (/^f\d+$/i.test(key)) {
|
|
15
|
+
return key.toUpperCase();
|
|
16
|
+
}
|
|
17
|
+
const specialKeys = {
|
|
18
|
+
space: "Space",
|
|
19
|
+
enter: "Enter",
|
|
20
|
+
escape: "Escape",
|
|
21
|
+
tab: "Tab",
|
|
22
|
+
backspace: "Backspace",
|
|
23
|
+
delete: "Delete",
|
|
24
|
+
arrowup: "ArrowUp",
|
|
25
|
+
arrowdown: "ArrowDown",
|
|
26
|
+
arrowleft: "ArrowLeft",
|
|
27
|
+
arrowright: "ArrowRight"
|
|
28
|
+
};
|
|
29
|
+
return specialKeys[key.toLowerCase()] || key;
|
|
30
|
+
}
|
|
31
|
+
export function extractShortcuts(items, separator = "_") {
|
|
8
32
|
const shortcuts = {};
|
|
9
33
|
function traverse(items2) {
|
|
10
34
|
items2.forEach((item) => {
|
|
11
35
|
if (item.kbds?.length && (item.onSelect || item.onClick)) {
|
|
12
|
-
const shortcutKey = item.kbds.join(
|
|
36
|
+
const shortcutKey = item.kbds.join(separator);
|
|
13
37
|
shortcuts[shortcutKey] = item.onSelect || item.onClick;
|
|
14
38
|
}
|
|
15
39
|
if (item.children) {
|
|
@@ -31,14 +55,16 @@ export function defineShortcuts(config, options = {}) {
|
|
|
31
55
|
const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800);
|
|
32
56
|
const { macOS } = useKbd();
|
|
33
57
|
const activeElement = useActiveElement();
|
|
58
|
+
const layoutIndependent = options.layoutIndependent ?? false;
|
|
59
|
+
const shiftableCodes = shiftableKeys.map((k) => convertKeyToCode(k));
|
|
34
60
|
const onKeyDown = (e) => {
|
|
35
61
|
if (!e.key) {
|
|
36
62
|
return;
|
|
37
63
|
}
|
|
38
|
-
const alphabetKey = /^[a-z]{1}$/i.test(e.key);
|
|
39
|
-
const shiftableKey = shiftableKeys.includes(e.key.toLowerCase());
|
|
64
|
+
const alphabetKey = layoutIndependent ? /^Key[A-Z]$/i.test(e.code) : /^[a-z]{1}$/i.test(e.key);
|
|
65
|
+
const shiftableKey = layoutIndependent ? shiftableCodes.includes(e.code) : shiftableKeys.includes(e.key.toLowerCase());
|
|
40
66
|
let chainedKey;
|
|
41
|
-
chainedInputs.value.push(e.key);
|
|
67
|
+
chainedInputs.value.push(layoutIndependent ? e.code : e.key);
|
|
42
68
|
if (chainedInputs.value.length >= 2) {
|
|
43
69
|
chainedKey = chainedInputs.value.slice(-2).join("-");
|
|
44
70
|
for (const shortcut of shortcuts.value.filter((s) => s.chained)) {
|
|
@@ -54,8 +80,14 @@ export function defineShortcuts(config, options = {}) {
|
|
|
54
80
|
}
|
|
55
81
|
}
|
|
56
82
|
for (const shortcut of shortcuts.value.filter((s) => !s.chained)) {
|
|
57
|
-
if (
|
|
58
|
-
|
|
83
|
+
if (layoutIndependent) {
|
|
84
|
+
if (e.code !== shortcut.key) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
if (e.key.toLowerCase() !== shortcut.key) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
59
91
|
}
|
|
60
92
|
if (e.metaKey !== shortcut.metaKey) {
|
|
61
93
|
continue;
|
|
@@ -63,7 +95,7 @@ export function defineShortcuts(config, options = {}) {
|
|
|
63
95
|
if (e.ctrlKey !== shortcut.ctrlKey) {
|
|
64
96
|
continue;
|
|
65
97
|
}
|
|
66
|
-
if ((alphabetKey || shiftableKey) && e.shiftKey !== shortcut.shiftKey) {
|
|
98
|
+
if ((alphabetKey || shiftableKey || shortcut.shiftKey || e.shiftKey) && e.shiftKey !== shortcut.shiftKey) {
|
|
67
99
|
continue;
|
|
68
100
|
}
|
|
69
101
|
if (shortcut.enabled) {
|
|
@@ -98,17 +130,32 @@ export function defineShortcuts(config, options = {}) {
|
|
|
98
130
|
}
|
|
99
131
|
const chained = key.includes("-") && key !== "-" && !key.includes("_");
|
|
100
132
|
if (chained) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
133
|
+
if (layoutIndependent) {
|
|
134
|
+
const parts = key.split("-").map((p) => convertKeyToCode(p));
|
|
135
|
+
shortcut = {
|
|
136
|
+
key: parts.join("-"),
|
|
137
|
+
metaKey: false,
|
|
138
|
+
ctrlKey: false,
|
|
139
|
+
shiftKey: false,
|
|
140
|
+
altKey: false
|
|
141
|
+
};
|
|
142
|
+
} else {
|
|
143
|
+
shortcut = {
|
|
144
|
+
key: key.toLowerCase(),
|
|
145
|
+
metaKey: false,
|
|
146
|
+
ctrlKey: false,
|
|
147
|
+
shiftKey: false,
|
|
148
|
+
altKey: false
|
|
149
|
+
};
|
|
150
|
+
}
|
|
108
151
|
} else {
|
|
109
152
|
const keySplit = key.toLowerCase().split("_").map((k) => k);
|
|
153
|
+
let baseKey = keySplit.filter((k) => !["meta", "command", "ctrl", "shift", "alt", "option"].includes(k)).join("_");
|
|
154
|
+
if (layoutIndependent) {
|
|
155
|
+
baseKey = convertKeyToCode(baseKey);
|
|
156
|
+
}
|
|
110
157
|
shortcut = {
|
|
111
|
-
key:
|
|
158
|
+
key: baseKey,
|
|
112
159
|
metaKey: keySplit.includes("meta") || keySplit.includes("command"),
|
|
113
160
|
ctrlKey: keySplit.includes("ctrl"),
|
|
114
161
|
shiftKey: keySplit.includes("shift"),
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Ref, ComputedRef, MaybeRef } from 'vue';
|
|
2
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
3
|
+
import type { FloatingUIOptions } from '../types/editor';
|
|
4
|
+
export interface EditorMenuOptions<T = any> {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
/**
|
|
7
|
+
* The trigger character (e.g., '/', '@', ':')
|
|
8
|
+
*/
|
|
9
|
+
char: string;
|
|
10
|
+
/**
|
|
11
|
+
* Plugin key to identify this menu
|
|
12
|
+
*/
|
|
13
|
+
pluginKey: string;
|
|
14
|
+
/**
|
|
15
|
+
* The items to display (can be a flat array or grouped)
|
|
16
|
+
*/
|
|
17
|
+
items?: MaybeRef<T[] | T[][] | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Fields to filter items by.
|
|
20
|
+
* @defaultValue ['label']
|
|
21
|
+
*/
|
|
22
|
+
filterFields?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Function to filter items based on query
|
|
25
|
+
*/
|
|
26
|
+
filter?: (items: T[], query: string) => T[];
|
|
27
|
+
/**
|
|
28
|
+
* Whether to ignore the default filtering.
|
|
29
|
+
* When `true`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
30
|
+
* @defaultValue false
|
|
31
|
+
*/
|
|
32
|
+
ignoreFilter?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum number of items to display
|
|
35
|
+
* @defaultValue 42
|
|
36
|
+
*/
|
|
37
|
+
limit?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Ref to sync the current search term with
|
|
40
|
+
*/
|
|
41
|
+
searchTerm?: Ref<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Function to execute when an item is selected
|
|
44
|
+
*/
|
|
45
|
+
onSelect: (editor: Editor, range: any, item: T) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Function to render each menu item
|
|
48
|
+
*/
|
|
49
|
+
renderItem: (item: T, ui: ComputedRef<any>) => any;
|
|
50
|
+
/**
|
|
51
|
+
* The options for positioning the menu. Those are passed to Floating UI and include options for the placement, offset, flip, shift, size, autoPlacement, hide, and inline middleware.
|
|
52
|
+
* @defaultValue { strategy: 'absolute', placement: 'bottom-start', offset: 8, shift: { padding: 8 } }
|
|
53
|
+
* @see https://floating-ui.com/docs/computePosition#options
|
|
54
|
+
*/
|
|
55
|
+
options?: FloatingUIOptions;
|
|
56
|
+
/**
|
|
57
|
+
* The DOM element to append the menu to. Default is the editor's parent element.
|
|
58
|
+
*
|
|
59
|
+
* Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
|
|
60
|
+
*
|
|
61
|
+
* @type {HTMLElement}
|
|
62
|
+
* @default editor.view.dom.parentElement
|
|
63
|
+
*/
|
|
64
|
+
appendTo?: HTMLElement | (() => HTMLElement);
|
|
65
|
+
/**
|
|
66
|
+
* UI styles computed ref
|
|
67
|
+
*/
|
|
68
|
+
ui: ComputedRef<any>;
|
|
69
|
+
}
|
|
70
|
+
export declare function useEditorMenu<T = any>(options: EditorMenuOptions<T>): {
|
|
71
|
+
plugin: import("@tiptap/pm/state").Plugin<any>;
|
|
72
|
+
destroy: () => void;
|
|
73
|
+
filteredItems: Ref<T[], T[]>;
|
|
74
|
+
searchTerm: Ref<string, string>;
|
|
75
|
+
};
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { ref, h, computed, unref, watch } from "vue";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
import { useFilter } from "reka-ui";
|
|
4
|
+
import { computePosition } from "@floating-ui/dom";
|
|
5
|
+
import { VueRenderer } from "@tiptap/vue-3";
|
|
6
|
+
import Suggestion from "@tiptap/suggestion";
|
|
7
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
8
|
+
import { buildFloatingUIMiddleware } from "../utils/editor.js";
|
|
9
|
+
import { get, isArrayOfArray } from "../utils/index.js";
|
|
10
|
+
export function useEditorMenu(options) {
|
|
11
|
+
const filteredItems = ref([]);
|
|
12
|
+
const selectedIndex = ref(0);
|
|
13
|
+
const menuState = ref("closed");
|
|
14
|
+
const searchTerm = options.searchTerm ?? ref("");
|
|
15
|
+
let renderer = null;
|
|
16
|
+
let element = null;
|
|
17
|
+
let handleMouseDown = null;
|
|
18
|
+
let commandFn = null;
|
|
19
|
+
let keyDownHandler = null;
|
|
20
|
+
let globalKeyHandler = null;
|
|
21
|
+
let blurHandler = null;
|
|
22
|
+
let triggerClientRect = null;
|
|
23
|
+
let handleHover = null;
|
|
24
|
+
let scrollHandler = null;
|
|
25
|
+
let stopItemsWatch = null;
|
|
26
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
27
|
+
const cleanupMenu = () => {
|
|
28
|
+
if (menuState.value === "closed") return;
|
|
29
|
+
menuState.value = "closed";
|
|
30
|
+
if (globalKeyHandler) {
|
|
31
|
+
document.removeEventListener("keydown", globalKeyHandler, true);
|
|
32
|
+
globalKeyHandler = null;
|
|
33
|
+
}
|
|
34
|
+
if (blurHandler) {
|
|
35
|
+
options.editor.view.dom.removeEventListener("blur", blurHandler);
|
|
36
|
+
blurHandler = null;
|
|
37
|
+
}
|
|
38
|
+
if (scrollHandler) {
|
|
39
|
+
window.removeEventListener("scroll", scrollHandler, true);
|
|
40
|
+
scrollHandler = null;
|
|
41
|
+
}
|
|
42
|
+
if (element && handleMouseDown) {
|
|
43
|
+
element.removeEventListener("mousedown", handleMouseDown);
|
|
44
|
+
handleMouseDown = null;
|
|
45
|
+
}
|
|
46
|
+
if (renderer) {
|
|
47
|
+
renderer.destroy();
|
|
48
|
+
renderer = null;
|
|
49
|
+
}
|
|
50
|
+
if (element) {
|
|
51
|
+
element.remove();
|
|
52
|
+
element = null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const filterFields = options.filterFields ?? ["label"];
|
|
56
|
+
const defaultFilter = (items2, query) => {
|
|
57
|
+
if (!query) return items2;
|
|
58
|
+
return items2.filter((item) => {
|
|
59
|
+
return filterFields.some((field) => {
|
|
60
|
+
const value = get(item, field);
|
|
61
|
+
if (value === void 0 || value === null) return false;
|
|
62
|
+
const stringValue = Array.isArray(value) ? value.join(" ") : String(value);
|
|
63
|
+
return contains(stringValue, query) || contains(stringValue.replace(/[\s_-]/g, ""), query);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const filter = options.filter || defaultFilter;
|
|
68
|
+
const limit = options.limit ?? 42;
|
|
69
|
+
const pluginKeyInstance = typeof options.pluginKey === "string" ? new PluginKey(options.pluginKey) : options.pluginKey;
|
|
70
|
+
const groups = computed(() => {
|
|
71
|
+
const items2 = unref(options.items);
|
|
72
|
+
return items2?.length ? isArrayOfArray(items2) ? items2 : [items2] : [];
|
|
73
|
+
});
|
|
74
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
75
|
+
const filteredGroups = computed(() => {
|
|
76
|
+
if (!filteredItems.value.length) return [];
|
|
77
|
+
if (options.ignoreFilter) {
|
|
78
|
+
return [filteredItems.value];
|
|
79
|
+
}
|
|
80
|
+
return groups.value.map((group) => group.filter((item) => filteredItems.value.includes(item))).filter((group) => group.length > 0);
|
|
81
|
+
});
|
|
82
|
+
const selectableItems = computed(() => {
|
|
83
|
+
return filteredItems.value.filter((item) => {
|
|
84
|
+
return item.type !== "label" && item.type !== "separator";
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
const floatingUIOptions = defu(options.options, {
|
|
88
|
+
strategy: "absolute",
|
|
89
|
+
placement: "bottom-start",
|
|
90
|
+
offset: 8,
|
|
91
|
+
flip: {},
|
|
92
|
+
shift: { padding: 8 },
|
|
93
|
+
size: false,
|
|
94
|
+
autoPlacement: false,
|
|
95
|
+
hide: false,
|
|
96
|
+
inline: false
|
|
97
|
+
});
|
|
98
|
+
const middleware = buildFloatingUIMiddleware(floatingUIOptions);
|
|
99
|
+
const updatePosition = (el) => {
|
|
100
|
+
if (!triggerClientRect) return;
|
|
101
|
+
const rect = triggerClientRect();
|
|
102
|
+
if (!rect) return;
|
|
103
|
+
const virtualElement = {
|
|
104
|
+
getBoundingClientRect: () => rect
|
|
105
|
+
};
|
|
106
|
+
computePosition(virtualElement, el, {
|
|
107
|
+
placement: floatingUIOptions.placement,
|
|
108
|
+
strategy: floatingUIOptions.strategy,
|
|
109
|
+
middleware
|
|
110
|
+
}).then(({ x, y, strategy }) => {
|
|
111
|
+
el.style.width = "max-content";
|
|
112
|
+
el.style.position = strategy;
|
|
113
|
+
el.style.top = "0";
|
|
114
|
+
el.style.left = "0";
|
|
115
|
+
el.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const showMenu = () => {
|
|
119
|
+
menuState.value = "open";
|
|
120
|
+
if (!globalKeyHandler) {
|
|
121
|
+
globalKeyHandler = (e) => {
|
|
122
|
+
if (keyDownHandler) {
|
|
123
|
+
const handled = keyDownHandler({ event: e });
|
|
124
|
+
if (handled) {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
document.addEventListener("keydown", globalKeyHandler, true);
|
|
131
|
+
}
|
|
132
|
+
if (!blurHandler) {
|
|
133
|
+
blurHandler = () => {
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
if (menuState.value === "open") {
|
|
136
|
+
const tr = options.editor.view.state.tr.setMeta(pluginKeyInstance, { exit: true });
|
|
137
|
+
options.editor.view.dispatch(tr);
|
|
138
|
+
}
|
|
139
|
+
}, 0);
|
|
140
|
+
};
|
|
141
|
+
options.editor.view.dom.addEventListener("blur", blurHandler);
|
|
142
|
+
}
|
|
143
|
+
if (!scrollHandler) {
|
|
144
|
+
scrollHandler = () => {
|
|
145
|
+
if (element) {
|
|
146
|
+
updatePosition(element);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
window.addEventListener("scroll", scrollHandler, true);
|
|
150
|
+
}
|
|
151
|
+
handleHover = (index) => {
|
|
152
|
+
selectedIndex.value = index;
|
|
153
|
+
if (renderer) {
|
|
154
|
+
renderer.updateProps({
|
|
155
|
+
groups: filteredGroups.value,
|
|
156
|
+
selectedIndex: index,
|
|
157
|
+
onSelect: commandFn,
|
|
158
|
+
onHover: handleHover,
|
|
159
|
+
state: menuState.value
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
renderer = new VueRenderer(MenuComponent, {
|
|
164
|
+
props: {
|
|
165
|
+
groups: filteredGroups.value,
|
|
166
|
+
selectedIndex: selectedIndex.value,
|
|
167
|
+
onSelect: commandFn,
|
|
168
|
+
onHover: handleHover,
|
|
169
|
+
state: menuState.value
|
|
170
|
+
},
|
|
171
|
+
editor: options.editor
|
|
172
|
+
});
|
|
173
|
+
element = document.createElement("div");
|
|
174
|
+
element.style.position = floatingUIOptions.strategy;
|
|
175
|
+
element.style.zIndex = "50";
|
|
176
|
+
handleMouseDown = (e) => {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
};
|
|
179
|
+
element.addEventListener("mousedown", handleMouseDown);
|
|
180
|
+
const appendToElement = typeof options.appendTo === "function" ? options.appendTo() : options.appendTo;
|
|
181
|
+
(appendToElement ?? options.editor.view.dom.parentElement)?.appendChild(element);
|
|
182
|
+
if (renderer.element) {
|
|
183
|
+
element.appendChild(renderer.element);
|
|
184
|
+
}
|
|
185
|
+
updatePosition(element);
|
|
186
|
+
};
|
|
187
|
+
if (options.ignoreFilter) {
|
|
188
|
+
stopItemsWatch = watch(() => unref(options.items), (newItems) => {
|
|
189
|
+
if (!triggerClientRect) return;
|
|
190
|
+
const normalizedItems = newItems?.length ? isArrayOfArray(newItems) ? newItems.flat() : newItems : [];
|
|
191
|
+
filteredItems.value = normalizedItems.slice(0, limit);
|
|
192
|
+
if (!filteredItems.value.length) {
|
|
193
|
+
cleanupMenu();
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (selectedIndex.value >= selectableItems.value.length) {
|
|
197
|
+
selectedIndex.value = Math.max(0, selectableItems.value.length - 1);
|
|
198
|
+
}
|
|
199
|
+
if (menuState.value === "closed" && filteredItems.value.length) {
|
|
200
|
+
showMenu();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (renderer) {
|
|
204
|
+
renderer.updateProps({
|
|
205
|
+
groups: filteredGroups.value,
|
|
206
|
+
selectedIndex: selectedIndex.value,
|
|
207
|
+
onSelect: commandFn,
|
|
208
|
+
onHover: handleHover,
|
|
209
|
+
state: menuState.value
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (element) {
|
|
213
|
+
updatePosition(element);
|
|
214
|
+
}
|
|
215
|
+
}, { deep: true, flush: "sync" });
|
|
216
|
+
}
|
|
217
|
+
const MenuComponent = {
|
|
218
|
+
props: {
|
|
219
|
+
groups: { type: Array, required: true },
|
|
220
|
+
selectedIndex: { type: Number, required: true },
|
|
221
|
+
onSelect: { type: Function, required: true },
|
|
222
|
+
onHover: { type: Function, required: true },
|
|
223
|
+
state: { type: String, required: true }
|
|
224
|
+
},
|
|
225
|
+
setup(menuProps) {
|
|
226
|
+
function handleClick(e, item, selectableIndex) {
|
|
227
|
+
e.preventDefault();
|
|
228
|
+
menuProps.onSelect(item, selectableIndex);
|
|
229
|
+
}
|
|
230
|
+
function handleMouseEnter(selectableIndex) {
|
|
231
|
+
menuProps.onHover(selectableIndex);
|
|
232
|
+
}
|
|
233
|
+
return () => {
|
|
234
|
+
const groupsData = menuProps.groups;
|
|
235
|
+
const selectableIndexMap = /* @__PURE__ */ new Map();
|
|
236
|
+
let selectableCounter = 0;
|
|
237
|
+
for (const group of groupsData) {
|
|
238
|
+
for (const item of group) {
|
|
239
|
+
const itemData = item;
|
|
240
|
+
if (itemData.type !== "label" && itemData.type !== "separator") {
|
|
241
|
+
selectableIndexMap.set(item, selectableCounter++);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return h("div", {
|
|
246
|
+
"class": options.ui.value.content(),
|
|
247
|
+
"role": "listbox",
|
|
248
|
+
"data-state": menuProps.state
|
|
249
|
+
}, [
|
|
250
|
+
h("div", {
|
|
251
|
+
class: options.ui.value.viewport(),
|
|
252
|
+
role: "presentation"
|
|
253
|
+
}, groupsData.map(
|
|
254
|
+
(group, groupIndex) => h("div", {
|
|
255
|
+
key: `group-${groupIndex}`,
|
|
256
|
+
class: options.ui.value.group(),
|
|
257
|
+
role: "group"
|
|
258
|
+
}, group.map((item, itemInGroupIndex) => {
|
|
259
|
+
const itemData = item;
|
|
260
|
+
if (itemData.type === "label") {
|
|
261
|
+
return h("div", {
|
|
262
|
+
key: `label-${groupIndex}-${itemInGroupIndex}`,
|
|
263
|
+
class: options.ui.value.label({ class: itemData.class })
|
|
264
|
+
}, options.renderItem(item, options.ui));
|
|
265
|
+
}
|
|
266
|
+
if (itemData.type === "separator") {
|
|
267
|
+
return h("div", {
|
|
268
|
+
key: `separator-${groupIndex}-${itemInGroupIndex}`,
|
|
269
|
+
class: options.ui.value.separator({ class: itemData.class }),
|
|
270
|
+
role: "separator"
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const selectableIndex = selectableIndexMap.get(item);
|
|
274
|
+
const isHighlighted = selectableIndex === menuProps.selectedIndex;
|
|
275
|
+
return h("div", {
|
|
276
|
+
"key": `item-${selectableIndex}`,
|
|
277
|
+
"class": options.ui.value.item({ class: itemData.class, active: false }),
|
|
278
|
+
"role": "option",
|
|
279
|
+
"aria-selected": isHighlighted,
|
|
280
|
+
"data-highlighted": isHighlighted ? "" : void 0,
|
|
281
|
+
"data-disabled": itemData.disabled ? "" : void 0,
|
|
282
|
+
"onMousedown": (e) => handleClick(e, item, selectableIndex),
|
|
283
|
+
"onMouseenter": () => handleMouseEnter(selectableIndex),
|
|
284
|
+
"ref": (el) => {
|
|
285
|
+
if (el && isHighlighted) {
|
|
286
|
+
el.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}, options.renderItem(item, options.ui));
|
|
290
|
+
}))
|
|
291
|
+
))
|
|
292
|
+
]);
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const plugin = Suggestion({
|
|
297
|
+
pluginKey: pluginKeyInstance,
|
|
298
|
+
editor: options.editor,
|
|
299
|
+
char: options.char,
|
|
300
|
+
items: ({ query: q }) => {
|
|
301
|
+
searchTerm.value = q;
|
|
302
|
+
if (options.ignoreFilter) {
|
|
303
|
+
return items.value.slice(0, limit);
|
|
304
|
+
}
|
|
305
|
+
const filtered = filter(items.value, q);
|
|
306
|
+
return filtered.slice(0, limit);
|
|
307
|
+
},
|
|
308
|
+
command: ({ editor, range, props }) => {
|
|
309
|
+
options.onSelect(editor, range, props);
|
|
310
|
+
},
|
|
311
|
+
render: () => {
|
|
312
|
+
keyDownHandler = (props) => {
|
|
313
|
+
const { event } = props;
|
|
314
|
+
if (!renderer || !selectableItems.value.length) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
if (event.key === "Escape") {
|
|
318
|
+
cleanupMenu();
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
if (event.key === "ArrowUp") {
|
|
322
|
+
selectedIndex.value = (selectedIndex.value + selectableItems.value.length - 1) % selectableItems.value.length;
|
|
323
|
+
renderer?.updateProps({
|
|
324
|
+
groups: filteredGroups.value,
|
|
325
|
+
selectedIndex: selectedIndex.value,
|
|
326
|
+
onSelect: commandFn,
|
|
327
|
+
onHover: handleHover,
|
|
328
|
+
state: menuState.value
|
|
329
|
+
});
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
if (event.key === "ArrowDown") {
|
|
333
|
+
selectedIndex.value = (selectedIndex.value + 1) % selectableItems.value.length;
|
|
334
|
+
renderer?.updateProps({
|
|
335
|
+
groups: filteredGroups.value,
|
|
336
|
+
selectedIndex: selectedIndex.value,
|
|
337
|
+
onSelect: commandFn,
|
|
338
|
+
onHover: handleHover,
|
|
339
|
+
state: menuState.value
|
|
340
|
+
});
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
344
|
+
const selectedItem = selectableItems.value[selectedIndex.value];
|
|
345
|
+
if (selectedItem && commandFn) {
|
|
346
|
+
commandFn(selectedItem);
|
|
347
|
+
}
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
return false;
|
|
351
|
+
};
|
|
352
|
+
const handlers = {
|
|
353
|
+
onStart: (suggestionProps) => {
|
|
354
|
+
filteredItems.value = options.ignoreFilter ? items.value.slice(0, limit) : suggestionProps.items;
|
|
355
|
+
selectedIndex.value = 0;
|
|
356
|
+
commandFn = (item) => suggestionProps.command(item);
|
|
357
|
+
triggerClientRect = suggestionProps.clientRect;
|
|
358
|
+
if (!filteredItems.value.length) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
showMenu();
|
|
362
|
+
},
|
|
363
|
+
onUpdate: (suggestionProps) => {
|
|
364
|
+
filteredItems.value = options.ignoreFilter ? items.value.slice(0, limit) : suggestionProps.items;
|
|
365
|
+
commandFn = (item) => suggestionProps.command(item);
|
|
366
|
+
if (selectedIndex.value >= selectableItems.value.length) {
|
|
367
|
+
selectedIndex.value = Math.max(0, selectableItems.value.length - 1);
|
|
368
|
+
}
|
|
369
|
+
if (!filteredItems.value.length) {
|
|
370
|
+
cleanupMenu();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (!renderer) {
|
|
374
|
+
showMenu();
|
|
375
|
+
} else {
|
|
376
|
+
renderer.updateProps({
|
|
377
|
+
groups: filteredGroups.value,
|
|
378
|
+
selectedIndex: selectedIndex.value,
|
|
379
|
+
onSelect: commandFn,
|
|
380
|
+
onHover: handleHover,
|
|
381
|
+
state: menuState.value
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
if (element) {
|
|
385
|
+
updatePosition(element);
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
onKeyDown: keyDownHandler,
|
|
389
|
+
onExit: () => {
|
|
390
|
+
cleanupMenu();
|
|
391
|
+
triggerClientRect = null;
|
|
392
|
+
searchTerm.value = "";
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
return handlers;
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
const destroy = () => {
|
|
399
|
+
menuState.value = "closed";
|
|
400
|
+
if (globalKeyHandler) {
|
|
401
|
+
document.removeEventListener("keydown", globalKeyHandler, true);
|
|
402
|
+
globalKeyHandler = null;
|
|
403
|
+
}
|
|
404
|
+
if (blurHandler) {
|
|
405
|
+
options.editor.view.dom.removeEventListener("blur", blurHandler);
|
|
406
|
+
blurHandler = null;
|
|
407
|
+
}
|
|
408
|
+
if (scrollHandler) {
|
|
409
|
+
window.removeEventListener("scroll", scrollHandler, true);
|
|
410
|
+
scrollHandler = null;
|
|
411
|
+
}
|
|
412
|
+
if (element && handleMouseDown) {
|
|
413
|
+
element.removeEventListener("mousedown", handleMouseDown);
|
|
414
|
+
handleMouseDown = null;
|
|
415
|
+
}
|
|
416
|
+
if (renderer) {
|
|
417
|
+
renderer.destroy();
|
|
418
|
+
renderer = null;
|
|
419
|
+
}
|
|
420
|
+
if (element) {
|
|
421
|
+
element.remove();
|
|
422
|
+
element = null;
|
|
423
|
+
}
|
|
424
|
+
if (stopItemsWatch) {
|
|
425
|
+
stopItemsWatch();
|
|
426
|
+
stopItemsWatch = null;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
return {
|
|
430
|
+
plugin,
|
|
431
|
+
destroy,
|
|
432
|
+
filteredItems,
|
|
433
|
+
searchTerm
|
|
434
|
+
};
|
|
435
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ComponentPublicInstance } from 'vue';
|
|
2
|
-
import type { MaybeRef } from '@vueuse/core';
|
|
1
|
+
import type { ComponentPublicInstance, MaybeRef } from 'vue';
|
|
3
2
|
export interface UseFileUploadOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Specifies the allowed file types. Provide a comma-separated list of MIME types or file extensions.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
2
|
import type { ComponentProps, ComponentEmit } from 'vue-component-type-helpers';
|
|
3
|
+
type CloseEventArgTypeSimple<T> = T extends (event: 'close', arg_0: infer Arg, ...args: any[]) => void ? Arg : never;
|
|
3
4
|
/**
|
|
4
5
|
* This is a workaround for a design limitation in TypeScript.
|
|
5
6
|
*
|
|
@@ -9,7 +10,7 @@ import type { ComponentProps, ComponentEmit } from 'vue-component-type-helpers';
|
|
|
9
10
|
*
|
|
10
11
|
* @see https://github.com/microsoft/TypeScript/issues/32164
|
|
11
12
|
*/
|
|
12
|
-
type
|
|
13
|
+
type CloseEventArgTypeComplex<T> = T extends {
|
|
13
14
|
(event: 'close', arg_0: infer Arg, ...args: any[]): void;
|
|
14
15
|
(...args: any[]): void;
|
|
15
16
|
(...args: any[]): void;
|
|
@@ -28,6 +29,7 @@ type CloseEventArgType<T> = T extends {
|
|
|
28
29
|
(...args: any[]): void;
|
|
29
30
|
(...args: any[]): void;
|
|
30
31
|
} ? Arg : never;
|
|
32
|
+
type CloseEventArgType<T> = CloseEventArgTypeSimple<T> | CloseEventArgTypeComplex<T>;
|
|
31
33
|
export type OverlayOptions<OverlayAttrs = Record<string, any>> = {
|
|
32
34
|
defaultOpen?: boolean;
|
|
33
35
|
props?: OverlayAttrs;
|