@bevelo/vue 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/dist/accordion.cjs +89 -0
- package/dist/accordion.d.cts +145 -0
- package/dist/accordion.d.ts +145 -0
- package/dist/accordion.js +88 -0
- package/dist/agent.cjs +74 -0
- package/dist/agent.d.cts +2 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +1 -0
- package/dist/alert-dialog.cjs +48 -0
- package/dist/alert-dialog.d.cts +142 -0
- package/dist/alert-dialog.d.ts +142 -0
- package/dist/alert-dialog.js +47 -0
- package/dist/alert.cjs +77 -0
- package/dist/alert.d.cts +64 -0
- package/dist/alert.d.ts +64 -0
- package/dist/alert.js +76 -0
- package/dist/aspect-ratio.cjs +21 -0
- package/dist/aspect-ratio.d.cts +13 -0
- package/dist/aspect-ratio.d.ts +13 -0
- package/dist/aspect-ratio.js +21 -0
- package/dist/async-options.cjs +76 -0
- package/dist/async-options.d.cts +49 -0
- package/dist/async-options.d.ts +49 -0
- package/dist/async-options.js +75 -0
- package/dist/autocomplete.cjs +274 -0
- package/dist/autocomplete.d.cts +309 -0
- package/dist/autocomplete.d.ts +309 -0
- package/dist/autocomplete.js +273 -0
- package/dist/avatar.cjs +51 -0
- package/dist/avatar.d.cts +69 -0
- package/dist/avatar.d.ts +69 -0
- package/dist/avatar.js +50 -0
- package/dist/badge.cjs +41 -0
- package/dist/badge.d.cts +39 -0
- package/dist/badge.d.ts +39 -0
- package/dist/badge.js +40 -0
- package/dist/breadcrumb.cjs +59 -0
- package/dist/breadcrumb.d.cts +40 -0
- package/dist/breadcrumb.d.ts +40 -0
- package/dist/breadcrumb.js +58 -0
- package/dist/button.cjs +56 -0
- package/dist/button.d.cts +79 -0
- package/dist/button.d.ts +79 -0
- package/dist/button.js +55 -0
- package/dist/calendar-Bcc6HKc9.js +643 -0
- package/dist/calendar-vHGhj3RI.cjs +720 -0
- package/dist/calendar.cjs +4 -0
- package/dist/calendar.d.cts +316 -0
- package/dist/calendar.d.ts +316 -0
- package/dist/calendar.js +1 -0
- package/dist/card-B_ZoLCvt.d.cts +61 -0
- package/dist/card-B_ZoLCvt.d.ts +61 -0
- package/dist/card-CZHRix0r.js +99 -0
- package/dist/card-CvGfpsiU.cjs +140 -0
- package/dist/card.cjs +9 -0
- package/dist/card.d.cts +2 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +1 -0
- package/dist/carousel.cjs +225 -0
- package/dist/carousel.d.cts +214 -0
- package/dist/carousel.d.ts +214 -0
- package/dist/carousel.js +224 -0
- package/dist/checkbox-group.cjs +93 -0
- package/dist/checkbox-group.d.cts +108 -0
- package/dist/checkbox-group.d.ts +108 -0
- package/dist/checkbox-group.js +91 -0
- package/dist/checkbox.cjs +117 -0
- package/dist/checkbox.d.cts +153 -0
- package/dist/checkbox.d.ts +153 -0
- package/dist/checkbox.js +116 -0
- package/dist/collapsible.cjs +70 -0
- package/dist/collapsible.d.cts +141 -0
- package/dist/collapsible.d.ts +141 -0
- package/dist/collapsible.js +69 -0
- package/dist/color-picker.cjs +225 -0
- package/dist/color-picker.d.cts +180 -0
- package/dist/color-picker.d.ts +180 -0
- package/dist/color-picker.js +212 -0
- package/dist/combobox-CDHIXr6J.d.ts +735 -0
- package/dist/combobox-D39Waj6L.d.cts +735 -0
- package/dist/combobox-DlCU0vS1.cjs +945 -0
- package/dist/combobox-wLdV6VA_.js +802 -0
- package/dist/combobox.cjs +26 -0
- package/dist/combobox.d.cts +3 -0
- package/dist/combobox.d.ts +3 -0
- package/dist/combobox.js +1 -0
- package/dist/command-CEJACYpR.d.ts +404 -0
- package/dist/command-CqHZVivR.js +693 -0
- package/dist/command-D54bj6RJ.cjs +836 -0
- package/dist/command-rAVp-wbf.d.cts +404 -0
- package/dist/command.cjs +15 -0
- package/dist/command.d.cts +2 -0
- package/dist/command.d.ts +2 -0
- package/dist/command.js +1 -0
- package/dist/context-menu-BPsgeLQm.cjs +170 -0
- package/dist/context-menu-ByhKzWTm.d.ts +129 -0
- package/dist/context-menu-Co3ABcdp.js +153 -0
- package/dist/context-menu-USbhMQuc.d.cts +129 -0
- package/dist/context-menu.cjs +6 -0
- package/dist/context-menu.d.cts +2 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +2 -0
- package/dist/date-input.cjs +374 -0
- package/dist/date-input.d.cts +234 -0
- package/dist/date-input.d.ts +234 -0
- package/dist/date-input.js +371 -0
- package/dist/date-picker-D1mygz_Y.js +891 -0
- package/dist/date-picker-D_hqHHAV.cjs +938 -0
- package/dist/date-picker.cjs +4 -0
- package/dist/date-picker.d.cts +447 -0
- package/dist/date-picker.d.ts +447 -0
- package/dist/date-picker.js +1 -0
- package/dist/describe-BlNg9SbK.js +25 -0
- package/dist/describe-D_dLtwde.cjs +42 -0
- package/dist/dialog-view-CKtpbGq_.js +26 -0
- package/dist/dialog-view-swgEQvlZ.cjs +31 -0
- package/dist/dialog.cjs +66 -0
- package/dist/dialog.d.cts +158 -0
- package/dist/dialog.d.ts +158 -0
- package/dist/dialog.js +63 -0
- package/dist/direction.cjs +21 -0
- package/dist/direction.d.cts +13 -0
- package/dist/direction.d.ts +13 -0
- package/dist/direction.js +21 -0
- package/dist/dnd.cjs +103 -0
- package/dist/dnd.d.cts +54 -0
- package/dist/dnd.d.ts +54 -0
- package/dist/dnd.js +98 -0
- package/dist/drawer.cjs +137 -0
- package/dist/drawer.d.cts +190 -0
- package/dist/drawer.d.ts +190 -0
- package/dist/drawer.js +134 -0
- package/dist/empty-state.cjs +75 -0
- package/dist/empty-state.d.cts +46 -0
- package/dist/empty-state.d.ts +46 -0
- package/dist/empty-state.js +74 -0
- package/dist/engine-refs-8O6mHfYd.d.cts +4 -0
- package/dist/engine-refs-8O6mHfYd.d.ts +4 -0
- package/dist/engine-refs-CPWFFTfA.cjs +32 -0
- package/dist/engine-refs-sojZQs1R.js +21 -0
- package/dist/error-state.cjs +86 -0
- package/dist/error-state.d.cts +54 -0
- package/dist/error-state.d.ts +54 -0
- package/dist/error-state.js +85 -0
- package/dist/field.cjs +123 -0
- package/dist/field.d.cts +100 -0
- package/dist/field.d.ts +100 -0
- package/dist/field.js +122 -0
- package/dist/file-input.cjs +117 -0
- package/dist/file-input.d.cts +168 -0
- package/dist/file-input.d.ts +168 -0
- package/dist/file-input.js +116 -0
- package/dist/form-CKus_NQE.cjs +23 -0
- package/dist/form-y7b0fcqL.js +18 -0
- package/dist/gauge-parts-BVmw61GR.js +64 -0
- package/dist/gauge-parts-DjqBK9pL.d.cts +15 -0
- package/dist/gauge-parts-V31Fma77.cjs +75 -0
- package/dist/gauge-parts-mAgseDD4.d.ts +15 -0
- package/dist/headless-B3zQWaJm.js +225 -0
- package/dist/headless-BQe1X1Vf.d.ts +2 -0
- package/dist/headless-CbQgxdK1.d.cts +2 -0
- package/dist/headless-D88yFw8W.cjs +248 -0
- package/dist/hover-card.cjs +139 -0
- package/dist/hover-card.d.cts +200 -0
- package/dist/hover-card.d.ts +200 -0
- package/dist/hover-card.js +137 -0
- package/dist/icon-button.cjs +75 -0
- package/dist/icon-button.d.cts +104 -0
- package/dist/icon-button.d.ts +104 -0
- package/dist/icon-button.js +74 -0
- package/dist/image-cropper.cjs +106 -0
- package/dist/image-cropper.d.cts +7 -0
- package/dist/image-cropper.d.ts +7 -0
- package/dist/image-cropper.js +105 -0
- package/dist/image.cjs +87 -0
- package/dist/image.d.cts +92 -0
- package/dist/image.d.ts +92 -0
- package/dist/image.js +86 -0
- package/dist/index.cjs +1685 -0
- package/dist/index.d.cts +1195 -0
- package/dist/index.d.ts +1195 -0
- package/dist/index.js +1042 -0
- package/dist/input-group.cjs +91 -0
- package/dist/input-group.d.cts +84 -0
- package/dist/input-group.d.ts +84 -0
- package/dist/input-group.js +90 -0
- package/dist/input.cjs +114 -0
- package/dist/input.d.cts +186 -0
- package/dist/input.d.ts +186 -0
- package/dist/input.js +113 -0
- package/dist/item-B-QdNtAl.cjs +264 -0
- package/dist/item-D6GSb0WD.d.ts +144 -0
- package/dist/item-DPJnk7ED.js +199 -0
- package/dist/item-DyrvCrsL.d.cts +144 -0
- package/dist/item.cjs +10 -0
- package/dist/item.d.cts +2 -0
- package/dist/item.d.ts +2 -0
- package/dist/item.js +1 -0
- package/dist/kbd.cjs +55 -0
- package/dist/kbd.d.cts +38 -0
- package/dist/kbd.d.ts +38 -0
- package/dist/kbd.js +54 -0
- package/dist/label.cjs +41 -0
- package/dist/label.d.cts +40 -0
- package/dist/label.d.ts +40 -0
- package/dist/label.js +40 -0
- package/dist/listbox.cjs +85 -0
- package/dist/listbox.d.cts +200 -0
- package/dist/listbox.d.ts +200 -0
- package/dist/listbox.js +84 -0
- package/dist/loader.cjs +66 -0
- package/dist/loader.d.cts +68 -0
- package/dist/loader.d.ts +68 -0
- package/dist/loader.js +65 -0
- package/dist/mention-menu.cjs +126 -0
- package/dist/mention-menu.d.cts +144 -0
- package/dist/mention-menu.d.ts +144 -0
- package/dist/mention-menu.js +125 -0
- package/dist/menu.cjs +182 -0
- package/dist/menu.d.cts +240 -0
- package/dist/menu.d.ts +240 -0
- package/dist/menu.js +181 -0
- package/dist/menubar.cjs +38 -0
- package/dist/menubar.d.cts +43 -0
- package/dist/menubar.d.ts +43 -0
- package/dist/menubar.js +37 -0
- package/dist/meter.cjs +113 -0
- package/dist/meter.d.cts +124 -0
- package/dist/meter.d.ts +124 -0
- package/dist/meter.js +108 -0
- package/dist/native-select-52jYpA3c.d.cts +136 -0
- package/dist/native-select-BdJojSQt.d.ts +136 -0
- package/dist/native-select-BwptULNE.js +129 -0
- package/dist/native-select-DjBGWFoh.cjs +146 -0
- package/dist/native-select.cjs +5 -0
- package/dist/native-select.d.cts +2 -0
- package/dist/native-select.d.ts +2 -0
- package/dist/native-select.js +1 -0
- package/dist/navigation-menu.cjs +108 -0
- package/dist/navigation-menu.d.cts +245 -0
- package/dist/navigation-menu.d.ts +245 -0
- package/dist/navigation-menu.js +107 -0
- package/dist/number-input.cjs +189 -0
- package/dist/number-input.d.cts +232 -0
- package/dist/number-input.d.ts +232 -0
- package/dist/number-input.js +187 -0
- package/dist/option-row-DFCj-NoL.js +64 -0
- package/dist/option-row-Dlc6brXH.d.cts +30 -0
- package/dist/option-row-hLg6Ye86.cjs +105 -0
- package/dist/option-row-yJqjEx0G.d.ts +30 -0
- package/dist/options-BDn36q6n.cjs +111 -0
- package/dist/options-BlkyK-uO.js +106 -0
- package/dist/options-CGl5jBEY.d.ts +19 -0
- package/dist/options-DUGLoksA.d.cts +19 -0
- package/dist/otp-input.cjs +85 -0
- package/dist/otp-input.d.cts +113 -0
- package/dist/otp-input.d.ts +113 -0
- package/dist/otp-input.js +84 -0
- package/dist/overlay-controller-78GSJGbM.js +76 -0
- package/dist/overlay-controller-BDeITPoR.d.cts +16 -0
- package/dist/overlay-controller-DmaZ8FLl.cjs +93 -0
- package/dist/overlay-controller-HrMdTomI.d.ts +16 -0
- package/dist/pagination.cjs +87 -0
- package/dist/pagination.d.cts +112 -0
- package/dist/pagination.d.ts +112 -0
- package/dist/pagination.js +86 -0
- package/dist/parts-9zrUGbuI.js +84 -0
- package/dist/parts-DcYZV8ug.cjs +95 -0
- package/dist/password-input.cjs +144 -0
- package/dist/password-input.d.cts +151 -0
- package/dist/password-input.d.ts +151 -0
- package/dist/password-input.js +143 -0
- package/dist/placement-C_WRqvZk.js +49 -0
- package/dist/placement-ChEh6uxa.cjs +60 -0
- package/dist/popover.cjs +159 -0
- package/dist/popover.d.cts +185 -0
- package/dist/popover.d.ts +185 -0
- package/dist/popover.js +157 -0
- package/dist/preferences.cjs +96 -0
- package/dist/preferences.d.cts +36 -0
- package/dist/preferences.d.ts +36 -0
- package/dist/preferences.js +94 -0
- package/dist/presence.cjs +85 -0
- package/dist/presence.d.cts +25 -0
- package/dist/presence.d.ts +25 -0
- package/dist/presence.js +83 -0
- package/dist/progress.cjs +111 -0
- package/dist/progress.d.cts +109 -0
- package/dist/progress.d.ts +109 -0
- package/dist/progress.js +106 -0
- package/dist/query.cjs +152 -0
- package/dist/query.d.cts +68 -0
- package/dist/query.d.ts +68 -0
- package/dist/query.js +142 -0
- package/dist/radio.cjs +102 -0
- package/dist/radio.d.cts +136 -0
- package/dist/radio.d.ts +136 -0
- package/dist/radio.js +101 -0
- package/dist/rating.cjs +88 -0
- package/dist/rating.d.cts +100 -0
- package/dist/rating.d.ts +100 -0
- package/dist/rating.js +87 -0
- package/dist/resizable.cjs +57 -0
- package/dist/resizable.d.cts +119 -0
- package/dist/resizable.d.ts +119 -0
- package/dist/resizable.js +56 -0
- package/dist/scroll-area.cjs +59 -0
- package/dist/scroll-area.d.cts +72 -0
- package/dist/scroll-area.d.ts +72 -0
- package/dist/scroll-area.js +58 -0
- package/dist/segmented-control.cjs +88 -0
- package/dist/segmented-control.d.cts +121 -0
- package/dist/segmented-control.d.ts +121 -0
- package/dist/segmented-control.js +86 -0
- package/dist/select.cjs +160 -0
- package/dist/select.d.cts +385 -0
- package/dist/select.d.ts +385 -0
- package/dist/select.js +159 -0
- package/dist/separator.cjs +32 -0
- package/dist/separator.d.cts +31 -0
- package/dist/separator.d.ts +31 -0
- package/dist/separator.js +31 -0
- package/dist/sheet.cjs +294 -0
- package/dist/sheet.d.cts +456 -0
- package/dist/sheet.d.ts +456 -0
- package/dist/sheet.js +292 -0
- package/dist/sidebar-C-OdvGzD.d.cts +96 -0
- package/dist/sidebar-CZ1-p0-V.d.ts +96 -0
- package/dist/sidebar-DC-mpzMR.js +87 -0
- package/dist/sidebar-gSAgHdkn.cjs +110 -0
- package/dist/sidebar.cjs +6 -0
- package/dist/sidebar.d.cts +2 -0
- package/dist/sidebar.d.ts +2 -0
- package/dist/sidebar.js +1 -0
- package/dist/skeleton.cjs +46 -0
- package/dist/skeleton.d.cts +47 -0
- package/dist/skeleton.d.ts +47 -0
- package/dist/skeleton.js +45 -0
- package/dist/slider.cjs +118 -0
- package/dist/slider.d.cts +181 -0
- package/dist/slider.d.ts +181 -0
- package/dist/slider.js +117 -0
- package/dist/sortable-board-strict.cjs +149 -0
- package/dist/sortable-board-strict.d.cts +181 -0
- package/dist/sortable-board-strict.d.ts +181 -0
- package/dist/sortable-board-strict.js +148 -0
- package/dist/sortable-engine.cjs +136 -0
- package/dist/sortable-engine.d.cts +237 -0
- package/dist/sortable-engine.d.ts +237 -0
- package/dist/sortable-engine.js +135 -0
- package/dist/sortable.cjs +67 -0
- package/dist/sortable.d.cts +217 -0
- package/dist/sortable.d.ts +217 -0
- package/dist/sortable.js +66 -0
- package/dist/spinner.cjs +32 -0
- package/dist/spinner.d.cts +31 -0
- package/dist/spinner.d.ts +31 -0
- package/dist/spinner.js +31 -0
- package/dist/steps-C9Jmrt8G.cjs +122 -0
- package/dist/steps-Cs8AfxV7.js +81 -0
- package/dist/steps-DW5NkzVj.d.ts +71 -0
- package/dist/steps-ymRMdju5.d.cts +71 -0
- package/dist/steps.cjs +8 -0
- package/dist/steps.d.cts +2 -0
- package/dist/steps.d.ts +2 -0
- package/dist/steps.js +1 -0
- package/dist/switch.cjs +100 -0
- package/dist/switch.d.cts +144 -0
- package/dist/switch.d.ts +144 -0
- package/dist/switch.js +99 -0
- package/dist/table.cjs +124 -0
- package/dist/table.d.cts +124 -0
- package/dist/table.d.ts +124 -0
- package/dist/table.js +123 -0
- package/dist/tabs.cjs +89 -0
- package/dist/tabs.d.cts +160 -0
- package/dist/tabs.d.ts +160 -0
- package/dist/tabs.js +88 -0
- package/dist/textarea.cjs +140 -0
- package/dist/textarea.d.cts +231 -0
- package/dist/textarea.d.ts +231 -0
- package/dist/textarea.js +139 -0
- package/dist/time-input.cjs +117 -0
- package/dist/time-input.d.cts +140 -0
- package/dist/time-input.d.ts +140 -0
- package/dist/time-input.js +116 -0
- package/dist/timeline.cjs +82 -0
- package/dist/timeline.d.cts +62 -0
- package/dist/timeline.d.ts +62 -0
- package/dist/timeline.js +81 -0
- package/dist/toast-CfkRzdNd.js +354 -0
- package/dist/toast-DyezF7lm.cjs +401 -0
- package/dist/toast.cjs +16 -0
- package/dist/toast.d.cts +275 -0
- package/dist/toast.d.ts +275 -0
- package/dist/toast.js +1 -0
- package/dist/toggle-group.cjs +65 -0
- package/dist/toggle-group.d.cts +128 -0
- package/dist/toggle-group.d.ts +128 -0
- package/dist/toggle-group.js +64 -0
- package/dist/toggle.cjs +64 -0
- package/dist/toggle.d.cts +97 -0
- package/dist/toggle.d.ts +97 -0
- package/dist/toggle.js +63 -0
- package/dist/token-input-BIC9VLMG.d.cts +170 -0
- package/dist/token-input-BTReOHIv.cjs +336 -0
- package/dist/token-input-CQnZ6-pO.d.ts +170 -0
- package/dist/token-input-DtcCZrcC.js +295 -0
- package/dist/token-input.cjs +9 -0
- package/dist/token-input.d.cts +2 -0
- package/dist/token-input.d.ts +2 -0
- package/dist/token-input.js +1 -0
- package/dist/toolbar.cjs +62 -0
- package/dist/toolbar.d.cts +58 -0
- package/dist/toolbar.d.ts +58 -0
- package/dist/toolbar.js +61 -0
- package/dist/tooltip.cjs +149 -0
- package/dist/tooltip.d.cts +208 -0
- package/dist/tooltip.d.ts +208 -0
- package/dist/tooltip.js +147 -0
- package/dist/tree-grid.cjs +127 -0
- package/dist/tree-grid.d.cts +130 -0
- package/dist/tree-grid.d.ts +130 -0
- package/dist/tree-grid.js +126 -0
- package/dist/tree.cjs +227 -0
- package/dist/tree.d.cts +223 -0
- package/dist/tree.d.ts +223 -0
- package/dist/tree.js +226 -0
- package/dist/trigger-menu-8FAwypbs.d.cts +347 -0
- package/dist/trigger-menu-B898rWkz.cjs +502 -0
- package/dist/trigger-menu-C2YHe7es.d.ts +347 -0
- package/dist/trigger-menu-CxzocSWO.js +431 -0
- package/dist/trigger-menu.cjs +22 -0
- package/dist/trigger-menu.d.cts +2 -0
- package/dist/trigger-menu.d.ts +2 -0
- package/dist/trigger-menu.js +2 -0
- package/dist/virtual-list-strict.cjs +126 -0
- package/dist/virtual-list-strict.d.cts +69 -0
- package/dist/virtual-list-strict.d.ts +69 -0
- package/dist/virtual-list-strict.js +125 -0
- package/dist/virtual-list.cjs +65 -0
- package/dist/virtual-list.d.cts +82 -0
- package/dist/virtual-list.d.ts +82 -0
- package/dist/virtual-list.js +64 -0
- package/dist/virtual.cjs +27 -0
- package/dist/virtual.d.cts +30 -0
- package/dist/virtual.d.ts +30 -0
- package/dist/virtual.js +26 -0
- package/dist/vue-helpers-Bh_YF48i.cjs +102 -0
- package/dist/vue-helpers-Z3oOAHYB.js +55 -0
- package/dist/waterfall-chart.cjs +114 -0
- package/dist/waterfall-chart.d.cts +117 -0
- package/dist/waterfall-chart.d.ts +117 -0
- package/dist/waterfall-chart.js +113 -0
- package/dist/waterfall.cjs +296 -0
- package/dist/waterfall.d.cts +219 -0
- package/dist/waterfall.d.ts +219 -0
- package/dist/waterfall.js +284 -0
- package/package.json +518 -3
- package/README.md +0 -3
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
import { n as usePrimitive, t as renderPart } from "./headless-B3zQWaJm.js";
|
|
2
|
+
import { n as descriptionNodes } from "./describe-BlNg9SbK.js";
|
|
3
|
+
import { t as vueOptions } from "./options-BlkyK-uO.js";
|
|
4
|
+
import { n as createVuePartsRoot, t as createVuePart } from "./parts-9zrUGbuI.js";
|
|
5
|
+
import { i as isBlank } from "./vue-helpers-Z3oOAHYB.js";
|
|
6
|
+
import { commandEntryMatches, commandHighlighted, commandKeyAction, commandPrimitive, commandRunnable, commandTextSegments, resolveCommandFilter } from "@bevelo/core";
|
|
7
|
+
import { Fragment, computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, shallowRef } from "vue";
|
|
8
|
+
import { commandPrimitive as commandPrimitive$1 } from "@bevelo/core/primitives/command";
|
|
9
|
+
// src/command-parts.ts
|
|
10
|
+
/**
|
|
11
|
+
* The composition root: it creates the instance and renders the root part's
|
|
12
|
+
* element with the host's attrs and slot children inside it.
|
|
13
|
+
*/
|
|
14
|
+
const CommandRootPart = createVuePartsRoot(commandPrimitive$1);
|
|
15
|
+
/** The `panel` part. */
|
|
16
|
+
const CommandPanelPart = createVuePart(commandPrimitive$1, "panel");
|
|
17
|
+
/** The `input` part. */
|
|
18
|
+
const CommandInputPart = createVuePart(commandPrimitive$1, "input");
|
|
19
|
+
/** The `status` part. */
|
|
20
|
+
const CommandStatusPart = createVuePart(commandPrimitive$1, "status");
|
|
21
|
+
/** The `list` part. */
|
|
22
|
+
const CommandListPart = createVuePart(commandPrimitive$1, "list");
|
|
23
|
+
/** The `group-label` part. */
|
|
24
|
+
const CommandGroupLabelPart = createVuePart(commandPrimitive$1, "group-label");
|
|
25
|
+
/** The `option` part. */
|
|
26
|
+
const CommandOptionPart = createVuePart(commandPrimitive$1, "option");
|
|
27
|
+
/** The `item-icon` part. */
|
|
28
|
+
const CommandItemIconPart = createVuePart(commandPrimitive$1, "item-icon");
|
|
29
|
+
/** The `option-label` part. */
|
|
30
|
+
const CommandOptionLabelPart = createVuePart(commandPrimitive$1, "option-label");
|
|
31
|
+
/** The `option-shortcut` part. */
|
|
32
|
+
const CommandOptionShortcutPart = createVuePart(commandPrimitive$1, "option-shortcut");
|
|
33
|
+
/** The `empty` part. */
|
|
34
|
+
const CommandEmptyPart = createVuePart(commandPrimitive$1, "empty");
|
|
35
|
+
// src/command-inline.ts
|
|
36
|
+
const INLINE = Symbol("command-inline");
|
|
37
|
+
const GROUP = Symbol("command-group");
|
|
38
|
+
const ITEM = Symbol("command-item");
|
|
39
|
+
const NO_ITEMS = [];
|
|
40
|
+
/** The palette methods an inline list has no use for: it is always open and owns no ids. */
|
|
41
|
+
const inlinePaletteStubs = {
|
|
42
|
+
isOpen: () => true,
|
|
43
|
+
open: () => {},
|
|
44
|
+
close: () => {},
|
|
45
|
+
toggle: () => {},
|
|
46
|
+
matches: () => [],
|
|
47
|
+
options: () => [],
|
|
48
|
+
active: () => void 0,
|
|
49
|
+
runItem: () => {},
|
|
50
|
+
move: () => {},
|
|
51
|
+
inputId: () => "",
|
|
52
|
+
listboxId: () => "",
|
|
53
|
+
optionId: () => "",
|
|
54
|
+
groupLabelId: () => "",
|
|
55
|
+
instanceId: () => ""
|
|
56
|
+
};
|
|
57
|
+
/** The inline list's setup: state, the provided scope, and the root's render. */
|
|
58
|
+
function setupInlineCommand(props, { attrs, slots, emit, expose }) {
|
|
59
|
+
const ownQuery = ref("");
|
|
60
|
+
const query = computed(() => props.query ?? ownQuery.value);
|
|
61
|
+
const requested = ref(void 0);
|
|
62
|
+
const ownPages = ref(props.page === void 0 ? [] : [props.page]);
|
|
63
|
+
const pages = computed(() => props.pages ?? (props.page === void 0 ? ownPages.value : [props.page]));
|
|
64
|
+
const page = computed(() => pages.value[pages.value.length - 1]);
|
|
65
|
+
const filter = computed(() => resolveCommandFilter(props.filter));
|
|
66
|
+
const registry = shallowRef(/* @__PURE__ */ new Map());
|
|
67
|
+
const entries = computed(() => [...registry.value.values()].map((read) => read()));
|
|
68
|
+
const runnable = computed(() => commandRunnable(entries.value, query.value, filter.value));
|
|
69
|
+
const highlighted = computed(() => commandHighlighted(runnable.value, requested.value));
|
|
70
|
+
const status = computed(() => props.status ?? "idle");
|
|
71
|
+
const root = ref(null);
|
|
72
|
+
const state = computed(() => ({
|
|
73
|
+
empty: !entries.value.some((entry) => commandEntryMatches(entry, query.value, filter.value)),
|
|
74
|
+
loading: status.value === "loading",
|
|
75
|
+
count: runnable.value.length,
|
|
76
|
+
query: query.value,
|
|
77
|
+
status: status.value
|
|
78
|
+
}));
|
|
79
|
+
const setQuery = (next) => {
|
|
80
|
+
if (props.query === void 0) ownQuery.value = next;
|
|
81
|
+
emit("input", next);
|
|
82
|
+
emit("update:query", next);
|
|
83
|
+
};
|
|
84
|
+
const highlight = (value) => {
|
|
85
|
+
requested.value = value;
|
|
86
|
+
emit("highlight", value, { index: value === void 0 ? -1 : runnable.value.findIndex((entry) => entry.value === value) });
|
|
87
|
+
};
|
|
88
|
+
const setPages = (next) => {
|
|
89
|
+
if (props.pages === void 0) ownPages.value = next;
|
|
90
|
+
emit("pagesChange", [...next]);
|
|
91
|
+
emit("update:pages", [...next]);
|
|
92
|
+
emit("pageChange", next[next.length - 1]);
|
|
93
|
+
emit("update:page", next[next.length - 1]);
|
|
94
|
+
};
|
|
95
|
+
const push = (next) => setPages([...pages.value, next]);
|
|
96
|
+
const pop = () => setPages(pages.value.slice(0, -1));
|
|
97
|
+
const run = (value) => {
|
|
98
|
+
const target = value ?? highlighted.value;
|
|
99
|
+
if (target === void 0) return false;
|
|
100
|
+
const entry = entries.value.find((candidate) => candidate.value === target);
|
|
101
|
+
if (entry === void 0) emit("run", target);
|
|
102
|
+
else entry.run();
|
|
103
|
+
return true;
|
|
104
|
+
};
|
|
105
|
+
provide(INLINE, {
|
|
106
|
+
query,
|
|
107
|
+
highlighted,
|
|
108
|
+
filter,
|
|
109
|
+
state,
|
|
110
|
+
items: computed(() => props.items ?? NO_ITEMS),
|
|
111
|
+
page,
|
|
112
|
+
setQuery,
|
|
113
|
+
highlight,
|
|
114
|
+
push,
|
|
115
|
+
register(key, entry) {
|
|
116
|
+
const next = new Map(registry.value);
|
|
117
|
+
next.set(key, entry);
|
|
118
|
+
registry.value = next;
|
|
119
|
+
},
|
|
120
|
+
unregister(key) {
|
|
121
|
+
const next = new Map(registry.value);
|
|
122
|
+
next.delete(key);
|
|
123
|
+
registry.value = next;
|
|
124
|
+
},
|
|
125
|
+
groupMatches(group) {
|
|
126
|
+
return entries.value.some((entry) => entry.groups.includes(group) && commandEntryMatches(entry, query.value, filter.value));
|
|
127
|
+
},
|
|
128
|
+
report(value) {
|
|
129
|
+
emit("run", value);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const api = {
|
|
133
|
+
...inlinePaletteStubs,
|
|
134
|
+
query: () => query.value,
|
|
135
|
+
setQuery,
|
|
136
|
+
typeQuery: setQuery,
|
|
137
|
+
activeId: () => highlighted.value,
|
|
138
|
+
run,
|
|
139
|
+
runActive: () => {
|
|
140
|
+
run();
|
|
141
|
+
},
|
|
142
|
+
count: () => runnable.value.length,
|
|
143
|
+
push,
|
|
144
|
+
pop,
|
|
145
|
+
setValue: (value) => highlight(value ?? void 0),
|
|
146
|
+
focus: () => root.value?.querySelector("input")?.focus()
|
|
147
|
+
};
|
|
148
|
+
if (props.controller !== void 0) props.controller.api = api;
|
|
149
|
+
onBeforeUnmount(() => {
|
|
150
|
+
if (props.controller !== void 0) delete props.controller.api;
|
|
151
|
+
});
|
|
152
|
+
expose({ api });
|
|
153
|
+
const onKeydown = (event) => {
|
|
154
|
+
const action = commandKeyAction(runnable.value, highlighted.value, event.key);
|
|
155
|
+
if (action === void 0) return;
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
if (action.kind === "highlight") highlight(action.entry.value);
|
|
158
|
+
else action.entry.run();
|
|
159
|
+
};
|
|
160
|
+
return () => h("div", {
|
|
161
|
+
...attrs,
|
|
162
|
+
ref: root,
|
|
163
|
+
role: "region",
|
|
164
|
+
"aria-label": props.label ?? "Command",
|
|
165
|
+
"data-slot": "command",
|
|
166
|
+
onKeydown
|
|
167
|
+
}, slots.default?.());
|
|
168
|
+
}
|
|
169
|
+
/** A row's text as a reader hears it: aria-hidden icons and shortcuts are skipped. */
|
|
170
|
+
function visibleText(node) {
|
|
171
|
+
if (node.nodeType === 3) return node.textContent ?? "";
|
|
172
|
+
if (node instanceof Element && node.getAttribute("aria-hidden") === "true") return "";
|
|
173
|
+
let text = "";
|
|
174
|
+
for (const child of node.childNodes) text += visibleText(child);
|
|
175
|
+
return text;
|
|
176
|
+
}
|
|
177
|
+
function useInline() {
|
|
178
|
+
return inject(INLINE, void 0);
|
|
179
|
+
}
|
|
180
|
+
/** The search field. Outside an inline list it is the palette's `input` part. */
|
|
181
|
+
const CommandInput = defineComponent({
|
|
182
|
+
name: "CommandInput",
|
|
183
|
+
inheritAttrs: false,
|
|
184
|
+
setup(_props, { attrs, slots }) {
|
|
185
|
+
const scope = useInline();
|
|
186
|
+
return () => {
|
|
187
|
+
if (scope === void 0) return h(CommandInputPart, attrs, slots);
|
|
188
|
+
const hostInput = [attrs["onInput"]].flat().filter((handler) => typeof handler === "function");
|
|
189
|
+
return h("input", {
|
|
190
|
+
type: "text",
|
|
191
|
+
role: "combobox",
|
|
192
|
+
"aria-expanded": "true",
|
|
193
|
+
"data-part": "input",
|
|
194
|
+
...attrs,
|
|
195
|
+
value: scope.query.value,
|
|
196
|
+
onInput: [(event) => {
|
|
197
|
+
scope.setQuery(event.target.value);
|
|
198
|
+
}, ...hostInput]
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
/** The listbox. Its slot receives `{ items, highlightedValue }`. */
|
|
204
|
+
const CommandList = defineComponent({
|
|
205
|
+
name: "CommandList",
|
|
206
|
+
inheritAttrs: false,
|
|
207
|
+
setup(_props, { attrs, slots }) {
|
|
208
|
+
const scope = useInline();
|
|
209
|
+
return () => {
|
|
210
|
+
if (scope === void 0) return h(CommandListPart, attrs, () => slots.default?.({
|
|
211
|
+
items: NO_ITEMS,
|
|
212
|
+
highlightedValue: void 0
|
|
213
|
+
}));
|
|
214
|
+
return h("div", {
|
|
215
|
+
role: "listbox",
|
|
216
|
+
"data-part": "list",
|
|
217
|
+
...attrs
|
|
218
|
+
}, slots.default?.({
|
|
219
|
+
items: scope.items.value,
|
|
220
|
+
highlightedValue: scope.highlighted.value
|
|
221
|
+
}));
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
/**
|
|
226
|
+
* Shown while no row matches. Its slot receives the list's state, and a slot
|
|
227
|
+
* that renders nothing (a `v-if` on the loading state) renders no element.
|
|
228
|
+
*/
|
|
229
|
+
const CommandEmpty = defineComponent({
|
|
230
|
+
name: "CommandEmpty",
|
|
231
|
+
inheritAttrs: false,
|
|
232
|
+
setup(_props, { attrs, slots }) {
|
|
233
|
+
const scope = useInline();
|
|
234
|
+
return () => {
|
|
235
|
+
if (scope === void 0) return h(CommandEmptyPart, attrs, slots);
|
|
236
|
+
const state = scope.state.value;
|
|
237
|
+
if (!state.empty) return null;
|
|
238
|
+
const content = slots.default?.(state);
|
|
239
|
+
if (isBlank(content)) return null;
|
|
240
|
+
return h("div", {
|
|
241
|
+
"data-part": "empty",
|
|
242
|
+
...attrs
|
|
243
|
+
}, content);
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
/** A polite live region; its slot receives the list's state. */
|
|
248
|
+
const CommandStatus = defineComponent({
|
|
249
|
+
name: "CommandStatus",
|
|
250
|
+
inheritAttrs: false,
|
|
251
|
+
setup(_props, { attrs, slots }) {
|
|
252
|
+
const scope = useInline();
|
|
253
|
+
return () => scope === void 0 ? h(CommandStatusPart, attrs, slots) : h("div", {
|
|
254
|
+
role: "status",
|
|
255
|
+
"aria-live": "polite",
|
|
256
|
+
"data-part": "status",
|
|
257
|
+
...attrs
|
|
258
|
+
}, slots.default?.(scope.state.value));
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* A titled set of rows, hidden while a query leaves none of them matching. It
|
|
263
|
+
* hides rather than unmounts: its rows stay registered, so the group comes
|
|
264
|
+
* back when a later query matches one of them.
|
|
265
|
+
*/
|
|
266
|
+
const CommandGroup = defineComponent({
|
|
267
|
+
name: "CommandGroup",
|
|
268
|
+
inheritAttrs: false,
|
|
269
|
+
props: {
|
|
270
|
+
label: {
|
|
271
|
+
type: String,
|
|
272
|
+
required: false
|
|
273
|
+
},
|
|
274
|
+
heading: {
|
|
275
|
+
type: String,
|
|
276
|
+
required: false
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
setup(props, { attrs, slots }) {
|
|
280
|
+
const scope = useInline();
|
|
281
|
+
const id = Symbol("group");
|
|
282
|
+
provide(GROUP, [...inject(GROUP, []), id]);
|
|
283
|
+
return () => {
|
|
284
|
+
const hidden = scope !== void 0 && scope.query.value !== "" && !scope.groupMatches(id);
|
|
285
|
+
const title = props.label ?? props.heading;
|
|
286
|
+
return h("div", {
|
|
287
|
+
role: "group",
|
|
288
|
+
"data-part": "group",
|
|
289
|
+
...attrs,
|
|
290
|
+
hidden
|
|
291
|
+
}, [title === void 0 ? null : h("div", { "data-part": "group-label" }, title), slots.default?.()]);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
/** A group's heading. Outside an inline list it is the palette's `group-label` part. */
|
|
296
|
+
const CommandGroupLabel = defineComponent({
|
|
297
|
+
name: "CommandGroupLabel",
|
|
298
|
+
inheritAttrs: false,
|
|
299
|
+
setup(_props, { attrs, slots }) {
|
|
300
|
+
const scope = useInline();
|
|
301
|
+
return () => scope === void 0 ? h(CommandGroupLabelPart, attrs, slots) : h("div", {
|
|
302
|
+
"data-part": "group-label",
|
|
303
|
+
...attrs
|
|
304
|
+
}, slots.default?.());
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
/** A row's icon, hidden from assistive technology. `mirror` flips it in right-to-left text. */
|
|
308
|
+
const CommandItemIcon = defineComponent({
|
|
309
|
+
name: "CommandItemIcon",
|
|
310
|
+
inheritAttrs: false,
|
|
311
|
+
props: { mirror: {
|
|
312
|
+
type: Boolean,
|
|
313
|
+
default: false
|
|
314
|
+
} },
|
|
315
|
+
setup(props, { attrs, slots }) {
|
|
316
|
+
const scope = useInline();
|
|
317
|
+
return () => {
|
|
318
|
+
const own = props.mirror ? {
|
|
319
|
+
"data-mirror": "",
|
|
320
|
+
...attrs
|
|
321
|
+
} : attrs;
|
|
322
|
+
return scope === void 0 ? h(CommandItemIconPart, own, slots) : h("span", {
|
|
323
|
+
"data-part": "item-icon",
|
|
324
|
+
"aria-hidden": "true",
|
|
325
|
+
...own
|
|
326
|
+
}, slots.default?.());
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
/** A divider between rows or groups. */
|
|
331
|
+
const CommandSeparator = defineComponent({
|
|
332
|
+
name: "CommandSeparator",
|
|
333
|
+
setup() {
|
|
334
|
+
return () => h("div", {
|
|
335
|
+
role: "separator",
|
|
336
|
+
"data-slot": "command-separator"
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
/**
|
|
341
|
+
* One row. Its value is `value`, else its label; its label is `label`, else its
|
|
342
|
+
* text. Choosing it pushes `page` when given, calls `onSelect` (a returned
|
|
343
|
+
* promise marks the row pending until it settles) and reports `run`.
|
|
344
|
+
*/
|
|
345
|
+
const CommandItem = defineComponent({
|
|
346
|
+
name: "CommandItem",
|
|
347
|
+
inheritAttrs: false,
|
|
348
|
+
props: {
|
|
349
|
+
value: {
|
|
350
|
+
type: String,
|
|
351
|
+
required: false
|
|
352
|
+
},
|
|
353
|
+
label: {
|
|
354
|
+
type: String,
|
|
355
|
+
required: false
|
|
356
|
+
},
|
|
357
|
+
keywords: {
|
|
358
|
+
type: Array,
|
|
359
|
+
required: false
|
|
360
|
+
},
|
|
361
|
+
shortcut: {
|
|
362
|
+
type: String,
|
|
363
|
+
default: ""
|
|
364
|
+
},
|
|
365
|
+
page: {
|
|
366
|
+
type: String,
|
|
367
|
+
required: false
|
|
368
|
+
},
|
|
369
|
+
disabled: {
|
|
370
|
+
type: Boolean,
|
|
371
|
+
default: false
|
|
372
|
+
},
|
|
373
|
+
onSelect: {
|
|
374
|
+
type: Function,
|
|
375
|
+
required: false
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
setup(props, { attrs, slots }) {
|
|
379
|
+
const scope = useInline();
|
|
380
|
+
const groups = inject(GROUP, []);
|
|
381
|
+
const pending = ref(false);
|
|
382
|
+
const error = shallowRef(void 0);
|
|
383
|
+
const slotText = ref("");
|
|
384
|
+
const label = () => props.label ?? (slotText.value === "" ? props.value ?? "" : slotText.value);
|
|
385
|
+
const value = () => props.value ?? label();
|
|
386
|
+
const key = Symbol("item");
|
|
387
|
+
const choose = () => {
|
|
388
|
+
if (props.disabled) return;
|
|
389
|
+
if (props.page !== void 0) scope?.push(props.page);
|
|
390
|
+
if (props.onSelect !== void 0) try {
|
|
391
|
+
const result = props.onSelect(value());
|
|
392
|
+
if (result instanceof Promise) {
|
|
393
|
+
pending.value = true;
|
|
394
|
+
error.value = void 0;
|
|
395
|
+
result.then(() => {
|
|
396
|
+
pending.value = false;
|
|
397
|
+
}, (reason) => {
|
|
398
|
+
pending.value = false;
|
|
399
|
+
error.value = reason;
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
} catch (reason) {
|
|
403
|
+
error.value = reason;
|
|
404
|
+
}
|
|
405
|
+
scope?.report(value());
|
|
406
|
+
};
|
|
407
|
+
if (scope !== void 0) {
|
|
408
|
+
scope.register(key, () => ({
|
|
409
|
+
value: value(),
|
|
410
|
+
label: label(),
|
|
411
|
+
keywords: props.keywords,
|
|
412
|
+
disabled: props.disabled,
|
|
413
|
+
groups,
|
|
414
|
+
run: choose
|
|
415
|
+
}));
|
|
416
|
+
onBeforeUnmount(() => scope.unregister(key));
|
|
417
|
+
}
|
|
418
|
+
provide(ITEM, {
|
|
419
|
+
label,
|
|
420
|
+
shortcut: () => props.shortcut
|
|
421
|
+
});
|
|
422
|
+
const element = ref(null);
|
|
423
|
+
onMounted(() => {
|
|
424
|
+
if (props.label === void 0 && element.value !== null) slotText.value = visibleText(element.value);
|
|
425
|
+
});
|
|
426
|
+
return () => {
|
|
427
|
+
const own = value();
|
|
428
|
+
if (scope !== void 0 && scope.query.value !== "") {
|
|
429
|
+
if (!commandEntryMatches({
|
|
430
|
+
value: own,
|
|
431
|
+
label: label(),
|
|
432
|
+
keywords: props.keywords
|
|
433
|
+
}, scope.query.value, scope.filter.value)) return null;
|
|
434
|
+
}
|
|
435
|
+
const active = scope?.highlighted.value === own;
|
|
436
|
+
const state = {
|
|
437
|
+
highlighted: active,
|
|
438
|
+
selected: active,
|
|
439
|
+
disabled: props.disabled,
|
|
440
|
+
pending: pending.value,
|
|
441
|
+
error: error.value
|
|
442
|
+
};
|
|
443
|
+
return h("div", {
|
|
444
|
+
ref: element,
|
|
445
|
+
role: "option",
|
|
446
|
+
tabindex: -1,
|
|
447
|
+
"data-part": "option",
|
|
448
|
+
"data-value": own,
|
|
449
|
+
"aria-selected": active ? "true" : "false",
|
|
450
|
+
"data-active": active ? "" : void 0,
|
|
451
|
+
"data-highlighted": active ? "" : void 0,
|
|
452
|
+
"data-pending": pending.value ? "" : void 0,
|
|
453
|
+
"aria-disabled": props.disabled ? "true" : void 0,
|
|
454
|
+
"data-disabled": props.disabled ? "" : void 0,
|
|
455
|
+
...attrs,
|
|
456
|
+
onPointermove: () => {
|
|
457
|
+
if (scope !== void 0 && !props.disabled && !active) scope.highlight(own);
|
|
458
|
+
},
|
|
459
|
+
onClick: choose
|
|
460
|
+
}, slots.default?.(state));
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
/** A row's label. Its slot receives `{ segments }`: the label split around what the query matched. */
|
|
465
|
+
const CommandItemText = defineComponent({
|
|
466
|
+
name: "CommandItemText",
|
|
467
|
+
inheritAttrs: false,
|
|
468
|
+
setup(_props, { attrs, slots }) {
|
|
469
|
+
const scope = useInline();
|
|
470
|
+
const item = inject(ITEM, void 0);
|
|
471
|
+
return () => {
|
|
472
|
+
const label = item?.label() ?? "";
|
|
473
|
+
const content = slots.default === void 0 ? label : slots.default({ segments: commandTextSegments(label, scope?.query.value ?? "") });
|
|
474
|
+
return h("span", {
|
|
475
|
+
"data-part": "option-label",
|
|
476
|
+
...attrs
|
|
477
|
+
}, content);
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
/** The row's `shortcut`, or the slot's own content; its slot receives `{ text }`. */
|
|
482
|
+
const CommandShortcut = defineComponent({
|
|
483
|
+
name: "CommandShortcut",
|
|
484
|
+
inheritAttrs: false,
|
|
485
|
+
setup(_props, { attrs, slots }) {
|
|
486
|
+
const item = inject(ITEM, void 0);
|
|
487
|
+
return () => {
|
|
488
|
+
const text = item?.shortcut() ?? "";
|
|
489
|
+
return h("span", {
|
|
490
|
+
"data-part": "option-shortcut",
|
|
491
|
+
"aria-hidden": "true",
|
|
492
|
+
...attrs
|
|
493
|
+
}, slots.default?.({ text }) ?? text);
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
/**
|
|
498
|
+
* Rows for one page of the stack: `value` names the page, and a page without a
|
|
499
|
+
* value is the root, shown while the stack is empty.
|
|
500
|
+
*/
|
|
501
|
+
const CommandPage = defineComponent({
|
|
502
|
+
name: "CommandPage",
|
|
503
|
+
props: {
|
|
504
|
+
value: {
|
|
505
|
+
type: String,
|
|
506
|
+
required: false
|
|
507
|
+
},
|
|
508
|
+
id: {
|
|
509
|
+
type: String,
|
|
510
|
+
required: false
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
setup(props, { slots }) {
|
|
514
|
+
const scope = useInline();
|
|
515
|
+
return () => {
|
|
516
|
+
if (scope !== void 0 && scope.page.value !== (props.id ?? props.value)) return null;
|
|
517
|
+
return slots.default?.();
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
// src/command.ts
|
|
522
|
+
const schema = vueOptions(commandPrimitive, {
|
|
523
|
+
modelValue: ["open", "onOpenChange"],
|
|
524
|
+
open: ["open", "onOpenChange"],
|
|
525
|
+
query: ["query", "onInput"]
|
|
526
|
+
});
|
|
527
|
+
const NO_GROUPS = [];
|
|
528
|
+
const noop = () => {};
|
|
529
|
+
const Command = defineComponent({
|
|
530
|
+
name: "Command",
|
|
531
|
+
inheritAttrs: false,
|
|
532
|
+
props: {
|
|
533
|
+
...schema.props,
|
|
534
|
+
open: {
|
|
535
|
+
type: Boolean,
|
|
536
|
+
required: false,
|
|
537
|
+
default: void 0
|
|
538
|
+
},
|
|
539
|
+
defaultOpen: {
|
|
540
|
+
type: Boolean,
|
|
541
|
+
required: false,
|
|
542
|
+
default: void 0
|
|
543
|
+
},
|
|
544
|
+
query: {
|
|
545
|
+
type: String,
|
|
546
|
+
required: false
|
|
547
|
+
},
|
|
548
|
+
placeholder: {
|
|
549
|
+
type: String,
|
|
550
|
+
default: "Type a command…"
|
|
551
|
+
},
|
|
552
|
+
label: {
|
|
553
|
+
type: String,
|
|
554
|
+
required: false
|
|
555
|
+
},
|
|
556
|
+
groups: {
|
|
557
|
+
type: Array,
|
|
558
|
+
required: false
|
|
559
|
+
},
|
|
560
|
+
filter: {
|
|
561
|
+
type: [
|
|
562
|
+
Function,
|
|
563
|
+
Boolean,
|
|
564
|
+
String
|
|
565
|
+
],
|
|
566
|
+
required: false,
|
|
567
|
+
default: void 0
|
|
568
|
+
},
|
|
569
|
+
shortcuts: {
|
|
570
|
+
type: Object,
|
|
571
|
+
required: false
|
|
572
|
+
},
|
|
573
|
+
openShortcut: {
|
|
574
|
+
type: String,
|
|
575
|
+
default: ""
|
|
576
|
+
},
|
|
577
|
+
id: {
|
|
578
|
+
type: String,
|
|
579
|
+
default: ""
|
|
580
|
+
},
|
|
581
|
+
idSeed: {
|
|
582
|
+
type: String,
|
|
583
|
+
required: false
|
|
584
|
+
},
|
|
585
|
+
/** Structured command data the inline list's slot receives as `items`. */
|
|
586
|
+
items: {
|
|
587
|
+
type: Array,
|
|
588
|
+
required: false
|
|
589
|
+
},
|
|
590
|
+
/** The inline list's loading status (`"loading"`, `"idle"`, ...). */
|
|
591
|
+
status: {
|
|
592
|
+
type: String,
|
|
593
|
+
required: false
|
|
594
|
+
},
|
|
595
|
+
/** The inline list's page stack; `v-model:pages` keeps it in step. */
|
|
596
|
+
pages: {
|
|
597
|
+
type: Array,
|
|
598
|
+
required: false
|
|
599
|
+
},
|
|
600
|
+
/** A one-page stack; `v-model:page` keeps it in step. */
|
|
601
|
+
page: {
|
|
602
|
+
type: String,
|
|
603
|
+
required: false
|
|
604
|
+
},
|
|
605
|
+
/** Receives `api` while mounted. */
|
|
606
|
+
controller: {
|
|
607
|
+
type: Object,
|
|
608
|
+
required: false
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
emits: {
|
|
612
|
+
...schema.emits,
|
|
613
|
+
highlight: (_value, _details) => true,
|
|
614
|
+
pagesChange: (_pages) => true,
|
|
615
|
+
"update:pages": (_pages) => true,
|
|
616
|
+
pageChange: (_page) => true,
|
|
617
|
+
"update:page": (_page) => true
|
|
618
|
+
},
|
|
619
|
+
setup(props, { attrs, slots, emit, expose }) {
|
|
620
|
+
if (props.groups === void 0 && props.open === void 0 && props.modelValue === void 0 && props.defaultOpen === void 0 && props.openShortcut === "" && (slots.default !== void 0 || props.items !== void 0 || props.pages !== void 0)) return setupInlineCommand(props, {
|
|
621
|
+
attrs,
|
|
622
|
+
slots,
|
|
623
|
+
expose,
|
|
624
|
+
emit
|
|
625
|
+
});
|
|
626
|
+
const handle = usePrimitive(commandPrimitive, schema.bind(props, () => ({
|
|
627
|
+
groups: props.groups ?? NO_GROUPS,
|
|
628
|
+
label: props.label ?? "Command palette",
|
|
629
|
+
filter: typeof props.filter === "function" ? props.filter : void 0
|
|
630
|
+
})));
|
|
631
|
+
const primitiveApi = handle.api;
|
|
632
|
+
const api = handle.api;
|
|
633
|
+
const controllerApi = {
|
|
634
|
+
...primitiveApi,
|
|
635
|
+
run: (id) => id === void 0 ? primitiveApi.activeId() !== void 0 && (primitiveApi.runActive(), true) : primitiveApi.run(id),
|
|
636
|
+
push: noop,
|
|
637
|
+
pop: noop,
|
|
638
|
+
setValue: noop,
|
|
639
|
+
focus: noop
|
|
640
|
+
};
|
|
641
|
+
if (props.controller !== void 0) props.controller.api = controllerApi;
|
|
642
|
+
onBeforeUnmount(() => {
|
|
643
|
+
if (props.controller !== void 0) delete props.controller.api;
|
|
644
|
+
});
|
|
645
|
+
expose({ api: controllerApi });
|
|
646
|
+
return () => {
|
|
647
|
+
handle.revision.value;
|
|
648
|
+
const total = api.count();
|
|
649
|
+
const matched = api.matches();
|
|
650
|
+
const countText = total === 0 ? "No commands" : total === 1 ? "1 command" : String(total) + " commands";
|
|
651
|
+
const input = renderPart(handle, "input", {
|
|
652
|
+
key: "input",
|
|
653
|
+
onChange: noop
|
|
654
|
+
});
|
|
655
|
+
const status = renderPart(handle, "status", { key: "status" }, total > 0 ? countText : null);
|
|
656
|
+
const empty = renderPart(handle, "empty", { key: "empty" }, "No commands found");
|
|
657
|
+
const rows = [];
|
|
658
|
+
matched.forEach((match, groupIndex) => {
|
|
659
|
+
const items = [];
|
|
660
|
+
match.items.forEach((item, itemIndex) => {
|
|
661
|
+
const address = {
|
|
662
|
+
index: itemIndex,
|
|
663
|
+
scope: String(groupIndex)
|
|
664
|
+
};
|
|
665
|
+
const icon = item.icon === void 0 ? null : renderPart(handle, "item-icon", { key: "icon" }, descriptionNodes(item.icon), address);
|
|
666
|
+
const labelNode = renderPart(handle, "option-label", { key: "label" }, item.label, address);
|
|
667
|
+
const shortcut = renderPart(handle, "option-shortcut", { key: "shortcut" }, item.shortcut ?? "", address);
|
|
668
|
+
items.push(renderPart(handle, "option", { key: item.id }, [h(Fragment, null, [
|
|
669
|
+
icon,
|
|
670
|
+
labelNode,
|
|
671
|
+
shortcut
|
|
672
|
+
])], address));
|
|
673
|
+
});
|
|
674
|
+
const heading = renderPart(handle, "group-label", { key: "heading" }, match.group.label, { index: groupIndex });
|
|
675
|
+
rows.push(renderPart(handle, "group", { key: match.group.id }, [h(Fragment, null, [heading, ...items])], { index: groupIndex }));
|
|
676
|
+
});
|
|
677
|
+
const list = renderPart(handle, "list", { key: "list" }, [h(Fragment, null, [...rows, total === 0 ? empty : null])]);
|
|
678
|
+
const slotContent = slots.default?.();
|
|
679
|
+
const body = h("div", {
|
|
680
|
+
"data-slot": "panel-content",
|
|
681
|
+
style: { display: "contents" }
|
|
682
|
+
}, slotContent);
|
|
683
|
+
const host = { ...attrs };
|
|
684
|
+
return renderPart(handle, "root", host, [h(Fragment, null, [
|
|
685
|
+
input,
|
|
686
|
+
status,
|
|
687
|
+
list,
|
|
688
|
+
body
|
|
689
|
+
])], { portal: true });
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
export { CommandRootPart as C, CommandPanelPart as S, CommandItemIconPart as _, CommandInput as a, CommandOptionPart as b, CommandItemText as c, CommandSeparator as d, CommandShortcut as f, CommandInputPart as g, CommandGroupLabelPart as h, CommandGroupLabel as i, CommandList as l, CommandEmptyPart as m, CommandEmpty as n, CommandItem as o, CommandStatus as p, CommandGroup as r, CommandItemIcon as s, Command as t, CommandPage as u, CommandListPart as v, CommandStatusPart as w, CommandOptionShortcutPart as x, CommandOptionLabelPart as y };
|