@ngrok/mantle 0.94.0 → 0.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/accordion.d.ts +61 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +61 -56
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-HffaioZM.d.ts → alert-D0zRRUHV.d.ts} +6 -6
- package/dist/alert-center.d.ts +53 -53
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +22 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +5 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +18 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +13 -13
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +24 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +7 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +12 -12
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +36 -36
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CZfkNw5A.js +1 -0
- package/dist/browser-only-ymFoM3Ya.js +1 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-K0pKc3GN.d.ts → button-5Pc7Mby_.d.ts} +3 -3
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-Cgf2IcEC.d.ts → button-Ddj6yr10.d.ts} +26 -26
- package/dist/{button-BGwOPjGV.d.ts → button-DnYv7IOT.d.ts} +22 -21
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +23 -23
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-CE5Uaqz9.js → chart-BLCqzt56.js} +1 -1
- package/dist/{chart-DCTGGlWL.js → chart-CChZiCrt.js} +1 -1
- package/dist/{chart-BO9EwQ60.js → chart-CUmSu9d7.js} +1 -1
- package/dist/{chart-jitNqimS.d.ts → chart-Dl8gFo_D.d.ts} +22 -22
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BwfmbepO.d.ts → choice-CNiOSzqV.d.ts} +20 -20
- package/dist/choice.d.ts +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-BPKNY1_w.js +1 -0
- package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
- package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
- package/dist/code-block.d.ts +15 -17
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +3 -3
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +15 -15
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +47 -47
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdRUneoc.js +1 -0
- package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
- package/dist/cx.d.ts +4 -4
- package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +36 -36
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +1 -1
- package/dist/description-list.js +1 -1
- package/dist/{dialog-DD5H3EH1.d.ts → dialog-CIEuwNys.d.ts} +24 -8
- package/dist/{dialog-B9JAGy_x.d.ts → dialog-CbEEA0fl.d.ts} +7 -3
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-DmDxYPde.d.ts → dropdown-menu-CeY498yk.d.ts} +10 -10
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +2 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +41 -41
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +3 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +30 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +3 -3
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-NYvyyRMG.d.ts → icon-DuIYoyft.d.ts} +2 -2
- package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
- package/dist/icon-xb7d9M7X.js +1 -0
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons-DEDCLZ8B.js +1 -0
- package/dist/icons-DXadFwpo.js +1 -0
- package/dist/icons-DcesO4Ng.js +1 -0
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{input-q8o5uMhW.d.ts → input-DC4nW0Sr.d.ts} +1 -1
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +4 -4
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +5 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-r2sJcSQ4.d.ts → label-epgtywRz.d.ts} +8 -8
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/layer-container-DL4yclOu.js +1 -0
- package/dist/layer-container.d.ts +2 -2
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +12 -12
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +17 -17
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +1 -1
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +23 -22
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +25 -25
- package/dist/media-object.d.ts +4 -4
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +28 -28
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +3 -3
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +4 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-lwkwWcRW.d.ts → popover-Bei0jyfH.d.ts} +73 -7
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +2 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +1 -1
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +3 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +8 -3
- package/dist/query.js +1 -1
- package/dist/{radio-group-sLz5AA9I.d.ts → radio-group-BJQ6EOqh.d.ts} +1 -1
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +2 -2
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +30 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +13 -14
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/select-1xuUx_os.js +1 -0
- package/dist/{select-BqmpVJJT.d.ts → select-BpaXHxJm.d.ts} +6 -6
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +18 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-QfH0ot5K.d.ts → separator-Ck4sPrdN.d.ts} +1 -1
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
- package/dist/sheet-DHy_vlme.js +1 -0
- package/dist/sheet.d.ts +23 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +37 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +4 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +1 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-D12N_fZJ.d.ts → slot-BEMQMbk3.d.ts} +4 -4
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +9 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +22 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-rWiVWEgB.d.ts → table-Ii9hHUWN.d.ts} +5 -5
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +2 -2
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +4 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +14 -12
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +2 -2
- package/dist/toast.js +1 -1
- package/dist/tokens.dark.json +3261 -0
- package/dist/tokens.json +4933 -0
- package/dist/tokens.resolver.json +37 -0
- package/dist/{tooltip-CpK3XTor.d.ts → tooltip-CstGDKwy.d.ts} +4 -4
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +1 -1
- package/dist/truncated-text.js +1 -1
- package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
- package/dist/use-callback-ref-DiOXFQzM.js +1 -0
- package/dist/use-composed-refs-DPYmLDSe.js +1 -0
- package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
- package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
- package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
- package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
- package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
- package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
- package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
- package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
- package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +1 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +1 -1
- package/dist/well.js +1 -1
- package/package.json +16 -2
- package/dist/alert-CH99Rw-R.js +0 -1
- package/dist/anchor-CgcbWEUs.js +0 -1
- package/dist/browser-only-BTSrYWLj.js +0 -1
- package/dist/button-69InNC_m.js +0 -1
- package/dist/button-BWGUuWnu.js +0 -1
- package/dist/button-Cu9e3SM7.js +0 -1
- package/dist/chart-DudCw24t.js +0 -2
- package/dist/checkbox-CS504fKk.js +0 -1
- package/dist/choice-uyYccm0A.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-CsugEt2A.js +0 -1
- package/dist/dropdown-menu-DHdgaw4P.js +0 -1
- package/dist/field-Bihblt8U.js +0 -1
- package/dist/field-CPvjazWN.js +0 -1
- package/dist/icon-kK0c-POG.js +0 -1
- package/dist/icons-4JA-SGfv.js +0 -1
- package/dist/icons-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/input-DHovzBjS.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-DmDwzPD8.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-CO_yLdln.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-BhTFutCz.d.ts +0 -1
- package/dist/popover-DxOqLKxy.js +0 -1
- package/dist/primitive-Dz9Al-us.js +0 -1
- package/dist/radio-group-HDVxTNPi.js +0 -1
- package/dist/radio-group-jj2abc0t.js +0 -1
- package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-C6Su0dU0.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-Bd2LIhzF.js +0 -1
- package/dist/skeleton-DBpI-ko5.js +0 -1
- package/dist/slot-DdYN1L1C.js +0 -1
- package/dist/table-CFHiDBW8.js +0 -1
- package/dist/theme-DdZgLvKH.js +0 -1
- package/dist/tooltip-b6oiTaWq.js +0 -1
- package/dist/use-breakpoint--mo7kr9d.js +0 -1
- package/dist/use-callback-ref-BvVyI5K1.js +0 -1
- package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
- package/dist/use-inert-siblings-CNmNuS2h.js +0 -1
- package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
- package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
- package/dist/use-matches-media-query-m860lols.js +0 -1
- package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
- package/dist/use-swipe-to-dismiss-i__cTF2v.js +0 -1
package/dist/command.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @see https://mantle.ngrok.com/components/navigation/command
|
|
5
5
|
*/
|
|
6
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
7
|
-
import { t as Dialog } from "./dialog-
|
|
8
|
-
import { t as Slot } from "./slot-
|
|
6
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
7
|
+
import { t as Dialog } from "./dialog-CIEuwNys.js";
|
|
8
|
+
import { t as Slot } from "./slot-BEMQMbk3.js";
|
|
9
9
|
import { ComponentProps, ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
|
|
10
10
|
import { Command as Command$1, useCommandState } from "cmdk";
|
|
11
11
|
/**
|
|
@@ -15,7 +15,7 @@ import { Command as Command$1, useCommandState } from "cmdk";
|
|
|
15
15
|
*/
|
|
16
16
|
type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> & {
|
|
17
17
|
/**
|
|
18
|
-
* The control that opens the palette
|
|
18
|
+
* The control that opens the palette: the row or button a user sees.
|
|
19
19
|
*
|
|
20
20
|
* A single element, required: this part renders no DOM of its own and
|
|
21
21
|
* clones what it is given, so text renders nothing to click and no children
|
|
@@ -27,8 +27,8 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* Makes any control behave like a search field that opens the command palette.
|
|
30
|
-
* It renders no DOM of its own
|
|
31
|
-
* so **presentation belongs entirely to the child
|
|
30
|
+
* It renders no DOM of its own (it clones its child and gives it the wiring),
|
|
31
|
+
* so **presentation belongs entirely to the child**. This part never has an
|
|
32
32
|
* opinion about how the trigger looks or how it behaves in a collapsed sidebar
|
|
33
33
|
* rail.
|
|
34
34
|
*
|
|
@@ -55,12 +55,12 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
55
55
|
* binds to `Command.DialogRoot`, because `Sheet` parts read a dialog scope
|
|
56
56
|
* of their own.
|
|
57
57
|
* - `data-state="open" | "closed"`, stamped from the palette's own state so it
|
|
58
|
-
* survives being wrapped in another cloning trigger
|
|
58
|
+
* survives being wrapped in another cloning trigger. A `Sidebar.Tooltip`
|
|
59
59
|
* passes its own `data-state` down, and Radix's prop merge would otherwise
|
|
60
60
|
* let it win.
|
|
61
61
|
* - `aria-keyshortcuts`, so the `⌘K` binding is announced rather than only
|
|
62
|
-
* drawn
|
|
63
|
-
* never advertise a binding that is not bound. Pass your own value to
|
|
62
|
+
* drawn. It is present only when `Command.DialogRoot` owns the shortcut, so it
|
|
63
|
+
* can never advertise a binding that is not bound. Pass your own value to
|
|
64
64
|
* announce a chord you bound yourself.
|
|
65
65
|
* - `onKeyDown` and `onPaste`, composed with the child's own handlers.
|
|
66
66
|
* - `data-slot="command-search-trigger"`, joined ahead of the child's own slot.
|
|
@@ -71,7 +71,7 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
71
71
|
*
|
|
72
72
|
* It adds no accessible name: the child's visible label is the name, so the two
|
|
73
73
|
* cannot drift apart. A visible `⌘K` hint belongs to the child and should be
|
|
74
|
-
* `aria-hidden` there, since `aria-keyshortcuts` already announces the chord
|
|
74
|
+
* `aria-hidden` there, since `aria-keyshortcuts` already announces the chord.
|
|
75
75
|
* `Sidebar.SearchTrigger`'s `shortcut` prop does that for you.
|
|
76
76
|
*
|
|
77
77
|
* @see https://mantle.ngrok.com/components/navigation/command#commandsearchtrigger
|
|
@@ -108,7 +108,7 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
108
108
|
*
|
|
109
109
|
* @example
|
|
110
110
|
* In a sidebar, where `Sidebar.SearchTrigger` owns the row's appearance in both
|
|
111
|
-
* panel states
|
|
111
|
+
* panel states (including its hover-revealed shortcut hint) and
|
|
112
112
|
* `Sidebar.Tooltip` labels it in the collapsed rail. `Command.DialogRoot` sits
|
|
113
113
|
* above `Sidebar.Nav`: below `mobileBreakpoint` the nav is a sheet that
|
|
114
114
|
* unmounts its subtree when it closes, and a root inside it takes the `⌘K`
|
|
@@ -150,7 +150,7 @@ declare const CommandSearchTrigger: ({ "aria-keyshortcuts": ariaKeyshortcuts, ch
|
|
|
150
150
|
type CommandRootProps = ComponentProps<typeof Command$1> & WithDataSlot;
|
|
151
151
|
/**
|
|
152
152
|
* The inline palette, wrapping `Command.Input` and `Command.List`. It owns the
|
|
153
|
-
* filtering and the active item for every part below it
|
|
153
|
+
* filtering and the active item for every part below it. `Command.DialogContent`
|
|
154
154
|
* renders one itself, so a modal palette does not add it.
|
|
155
155
|
*
|
|
156
156
|
* @see https://mantle.ngrok.com/components/navigation/command#commandroot
|
|
@@ -184,15 +184,15 @@ type CommandRootProps = ComponentProps<typeof Command$1> & WithDataSlot;
|
|
|
184
184
|
*/
|
|
185
185
|
declare const CommandRoot: ({ "data-slot": dataSlot, className, ...props }: CommandRootProps) => import("react").JSX.Element;
|
|
186
186
|
/**
|
|
187
|
-
* The props for `Command.DialogRoot`. `Dialog.Root`'s props
|
|
188
|
-
* reaches the underlying dialog
|
|
187
|
+
* The props for `Command.DialogRoot`. `Dialog.Root`'s props (so `modal` still
|
|
188
|
+
* reaches the underlying dialog), with the open state and the keyboard shortcut
|
|
189
189
|
* redeclared here, because this part owns them.
|
|
190
190
|
*
|
|
191
191
|
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
192
192
|
*/
|
|
193
193
|
type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children" | "defaultOpen" | "onOpenChange" | "open"> & {
|
|
194
194
|
/**
|
|
195
|
-
* The palette's parts
|
|
195
|
+
* The palette's parts: a `Command.DialogContent`, and any trigger or
|
|
196
196
|
* consumer of `useCommandDialog()`. `DialogRoot` renders no DOM of its own.
|
|
197
197
|
*/
|
|
198
198
|
children?: ReactNode;
|
|
@@ -204,19 +204,19 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
204
204
|
defaultOpen?: boolean;
|
|
205
205
|
/**
|
|
206
206
|
* Bind `⌘K` (macOS) / `Ctrl+K` (Windows/Linux) to toggle the palette. The
|
|
207
|
-
* shortcut requires exactly the platform modifier + `k`, resolved per host
|
|
208
|
-
*
|
|
207
|
+
* shortcut requires exactly the platform modifier + `k`, resolved per host.
|
|
208
|
+
* The two never substitute for each other, so macOS's native `Ctrl+K` ("kill
|
|
209
209
|
* to end of line") is left alone. `Shift`/`Alt` combinations pass through.
|
|
210
210
|
*
|
|
211
211
|
* It lives here rather than on `Command.SearchTrigger` because the trigger
|
|
212
|
-
* may be unmounted while the shortcut must still work
|
|
212
|
+
* may be unmounted while the shortcut must still work: a sidebar rendered
|
|
213
213
|
* as a mobile sheet unmounts its whole tree when the sheet is closed.
|
|
214
214
|
*
|
|
215
215
|
* The shortcut is ignored while focus is in a rich-text or code editor
|
|
216
216
|
* (`contenteditable`, or a `<textarea>`, which is what Monaco attaches to),
|
|
217
217
|
* where `⌘K` is already bound to "insert link" or a chord prefix. It
|
|
218
218
|
* deliberately still fires from a plain `<input>`, including the palette's
|
|
219
|
-
* own `Command.Input
|
|
219
|
+
* own `Command.Input`, so the chord closes what it opened.
|
|
220
220
|
*
|
|
221
221
|
* An earlier `keydown` listener that calls `preventDefault()` (on `document`,
|
|
222
222
|
* or on an element) stops the shortcut. Do not bind `⌘K` in your app as
|
|
@@ -227,8 +227,8 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
227
227
|
* a second palette never opens alongside the first.
|
|
228
228
|
*
|
|
229
229
|
* Set `false` to bind the chord yourself with `useCommandDialog()`.
|
|
230
|
-
* `Command.SearchTrigger` then adds no `aria-keyshortcuts` of its own
|
|
231
|
-
* one to announce the chord you bound
|
|
230
|
+
* `Command.SearchTrigger` then adds no `aria-keyshortcuts` of its own (pass
|
|
231
|
+
* one to announce the chord you bound), and `useCommandDialog().keyboardShortcut`
|
|
232
232
|
* reports the same flag. The *visible* hint always belongs to the trigger's
|
|
233
233
|
* child, so gating that on the flag is the child's job.
|
|
234
234
|
*
|
|
@@ -253,7 +253,7 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
253
253
|
* seed and the open state land in one state update, so `Command.Input` mounts
|
|
254
254
|
* with the character already in it and no keystroke races the dialog's mount.
|
|
255
255
|
*
|
|
256
|
-
* **Opening always starts from a known query
|
|
256
|
+
* **Opening always starts from a known query**: the seed, or empty. That
|
|
257
257
|
* happens at open time rather than by clearing on close, because
|
|
258
258
|
* `Dialog.Content` animates out and clearing on close would swap the visible
|
|
259
259
|
* list mid-animation. So dismissing and reopening never resurrects the previous
|
|
@@ -261,7 +261,7 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
261
261
|
*
|
|
262
262
|
* Pass `open`/`onOpenChange` to control the open state; the query stays
|
|
263
263
|
* internal either way. To own the query too, pass `value`/`onValueChange` to
|
|
264
|
-
* `Command.Input
|
|
264
|
+
* `Command.Input`. See that part for the trade-off.
|
|
265
265
|
*
|
|
266
266
|
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
267
267
|
*
|
|
@@ -381,7 +381,7 @@ declare const CommandDialogContent: ({ children, className, description, filter,
|
|
|
381
381
|
* palette, no dialog) it stays uncontrolled and cmdk owns the text.
|
|
382
382
|
*
|
|
383
383
|
* Passing `value` takes the query over completely: your value wins, this stops
|
|
384
|
-
* reporting to `useCommandDialog()`, and **seeding becomes yours to apply
|
|
384
|
+
* reporting to `useCommandDialog()`, and **seeding becomes yours to apply**:
|
|
385
385
|
* read `useCommandDialog().query` and mirror it, or drop
|
|
386
386
|
* `Command.SearchTrigger` for a plain `Command.DialogTrigger`. Prefer leaving
|
|
387
387
|
* it uncontrolled and reading the query from the hook.
|
|
@@ -394,7 +394,7 @@ declare const CommandDialogContent: ({ children, className, description, filter,
|
|
|
394
394
|
* | Data Attribute | Value | Description |
|
|
395
395
|
* | --- | --- | --- |
|
|
396
396
|
* | `data-slot` | `"command-input-wrapper"` | The row holding the magnifier and the field. |
|
|
397
|
-
* | `data-slot` | `"command-input"` | The `<input>` itself, joined after any `data-slot` you forward.
|
|
397
|
+
* | `data-slot` | `"command-input"` | The `<input>` itself, joined after any `data-slot` you forward. Beyond styling, `Command.DialogContent` finds the field by this slot when the palette opens, to place the caret after a seeded query instead of over it, so this part of the chain is never replaced. |
|
|
398
398
|
*
|
|
399
399
|
* @see https://mantle.ngrok.com/components/navigation/command#commandinput
|
|
400
400
|
*
|
|
@@ -699,7 +699,7 @@ declare const CommandShortcut: ({ "data-slot": dataSlot, className, ...props }:
|
|
|
699
699
|
declare const Command: {
|
|
700
700
|
/**
|
|
701
701
|
* The inline palette, wrapping `Command.Input` and `Command.List`. It owns the
|
|
702
|
-
* filtering and the active item for every part below it
|
|
702
|
+
* filtering and the active item for every part below it. `Command.DialogContent`
|
|
703
703
|
* renders one itself, so a modal palette does not add it.
|
|
704
704
|
*
|
|
705
705
|
* @see https://mantle.ngrok.com/components/navigation/command#commandroot
|
|
@@ -805,7 +805,7 @@ declare const Command: {
|
|
|
805
805
|
*/
|
|
806
806
|
readonly SearchTrigger: typeof CommandSearchTrigger;
|
|
807
807
|
/**
|
|
808
|
-
* A bare button that opens the Command dialog when clicked
|
|
808
|
+
* A bare button that opens the Command dialog when clicked: the escape hatch
|
|
809
809
|
* for a trigger that should not look like a search field. Wrap your own
|
|
810
810
|
* element with `asChild`.
|
|
811
811
|
*
|
|
@@ -1143,8 +1143,8 @@ type CommandDialogState = {
|
|
|
1143
1143
|
*/
|
|
1144
1144
|
open: boolean;
|
|
1145
1145
|
/**
|
|
1146
|
-
* Set the open state. **Opening through this resets the query to empty
|
|
1147
|
-
*
|
|
1146
|
+
* Set the open state. **Opening through this resets the query to empty**.
|
|
1147
|
+
* Use {@link CommandDialogState.openWithQuery} to open with text in the
|
|
1148
1148
|
* field. Calls `onOpenChange` and, when uncontrolled, updates the internal
|
|
1149
1149
|
* state.
|
|
1150
1150
|
*/
|
|
@@ -1165,7 +1165,7 @@ type CommandDialogState = {
|
|
|
1165
1165
|
* The current text of `Command.Input`. Read it to drive your own filtering
|
|
1166
1166
|
* or a server-side search when the palette runs with `shouldFilter={false}`.
|
|
1167
1167
|
*
|
|
1168
|
-
* Only meaningful while `Command.Input` is uncontrolled
|
|
1168
|
+
* Only meaningful while `Command.Input` is uncontrolled. Passing it a
|
|
1169
1169
|
* `value` takes ownership of the query, and this stops tracking the field.
|
|
1170
1170
|
*/
|
|
1171
1171
|
query: string;
|
|
@@ -1186,8 +1186,8 @@ type CommandDialogState = {
|
|
|
1186
1186
|
* Read the nearest `Command.DialogRoot` state. Throws when called outside one
|
|
1187
1187
|
* so misuse fails loudly rather than rendering a trigger that opens nothing.
|
|
1188
1188
|
*
|
|
1189
|
-
* Reach for it to open the palette from somewhere other than its trigger
|
|
1190
|
-
* sidebar row, an empty state, a "no results, search everything" link
|
|
1189
|
+
* Reach for it to open the palette from somewhere other than its trigger (a
|
|
1190
|
+
* sidebar row, an empty state, a "no results, search everything" link), or to
|
|
1191
1191
|
* build a custom trigger, pairing it with
|
|
1192
1192
|
* [`searchActionFromKeyDown`](https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown)
|
|
1193
1193
|
* so typing into your trigger behaves like typing into `Command.SearchTrigger`.
|
|
@@ -1228,18 +1228,18 @@ type Props = Omit<ComponentProps<"kbd">, "children"> & WithDataSlot;
|
|
|
1228
1228
|
declare function MetaKey({ "data-slot": dataSlot, className, ...props }: Props): import("react").JSX.Element;
|
|
1229
1229
|
/**
|
|
1230
1230
|
* What a keystroke or paste on a search trigger should do to the command
|
|
1231
|
-
* palette. A search trigger looks like a text field but is a `<button>`
|
|
1232
|
-
* has no editable value
|
|
1231
|
+
* palette. A search trigger looks like a text field but is a `<button>` (it
|
|
1232
|
+
* has no editable value), so every input event it receives has to be
|
|
1233
1233
|
* classified before it can mean anything.
|
|
1234
1234
|
*
|
|
1235
1235
|
* Three outcomes, because "type into the trigger" has three honest answers:
|
|
1236
1236
|
*
|
|
1237
|
-
* - `"seed"
|
|
1237
|
+
* - `"seed"`: the event carried text. Open the palette with `query` already
|
|
1238
1238
|
* in `Command.Input`.
|
|
1239
|
-
* - `"open"
|
|
1239
|
+
* - `"open"`: the event was text *intent* that cannot be replayed (an IME
|
|
1240
1240
|
* composition belongs to the element that started it). Open the palette with
|
|
1241
1241
|
* an empty query so the next keystroke has a real text field to land in.
|
|
1242
|
-
* - `"ignore"
|
|
1242
|
+
* - `"ignore"`: the event was navigation, a modifier chord, or the button's
|
|
1243
1243
|
* own activation keys. Leave the palette alone.
|
|
1244
1244
|
*
|
|
1245
1245
|
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown
|
|
@@ -1276,7 +1276,7 @@ type SearchAction = {
|
|
|
1276
1276
|
};
|
|
1277
1277
|
/**
|
|
1278
1278
|
* The properties {@link searchActionFromKeyDown} reads. Satisfied by a native
|
|
1279
|
-
* `KeyboardEvent
|
|
1279
|
+
* `KeyboardEvent`. Pass `event.nativeEvent` from a React handler, since
|
|
1280
1280
|
* React's synthetic keyboard event does not carry `isComposing`.
|
|
1281
1281
|
*/
|
|
1282
1282
|
type SearchKeyDownEvent = {
|
|
@@ -1290,7 +1290,7 @@ type SearchKeyDownEvent = {
|
|
|
1290
1290
|
* Why a deprecated property: `229` is the only reliable marker for the
|
|
1291
1291
|
* keydown that *starts* an IME composition, where `isComposing` is still
|
|
1292
1292
|
* `false` and `key` varies by engine. There is no non-deprecated
|
|
1293
|
-
* replacement
|
|
1293
|
+
* replacement; cmdk reads it for the same reason.
|
|
1294
1294
|
*/
|
|
1295
1295
|
keyCode?: number;
|
|
1296
1296
|
metaKey: boolean;
|
|
@@ -1313,7 +1313,7 @@ type SearchPasteEvent = {
|
|
|
1313
1313
|
* element that started it and cannot be forwarded, so seeding is impossible;
|
|
1314
1314
|
* opening empty at least lands the user in a real text field instead of
|
|
1315
1315
|
* swallowing the keystroke. This is the case the blog's original trigger got
|
|
1316
|
-
* wrong
|
|
1316
|
+
* wrong: it silently did nothing for CJK input. Engines that route dead keys
|
|
1317
1317
|
* through the IME path report them the same way (Chrome on macOS sends
|
|
1318
1318
|
* `key: "Dead"` with `keyCode: 229` for `⌥e`), so those open empty too rather
|
|
1319
1319
|
* than falling through to the named-key case below.
|
|
@@ -1321,16 +1321,16 @@ type SearchPasteEvent = {
|
|
|
1321
1321
|
* text: the palette's own `⌘K`, `⌘V` (the paste path handles it), and the
|
|
1322
1322
|
* browser/OS accelerators. `Alt` is excluded even though macOS `⌥` produces
|
|
1323
1323
|
* real characters, because seeding one means calling `preventDefault()` on
|
|
1324
|
-
* Windows `Alt` accelerators (`Alt+D`, `Alt+Home`)
|
|
1324
|
+
* Windows `Alt` accelerators (`Alt+D`, `Alt+Home`), the worse trade.
|
|
1325
1325
|
* `Shift` is not a modifier here; it is already reflected in `key`.
|
|
1326
1326
|
* - **`Enter` / `Space` → `"ignore"`.** The button's own activation keys.
|
|
1327
1327
|
* - **A single grapheme → `"seed"`.** Counted as the characters a user sees,
|
|
1328
1328
|
* not as `.length` or code points, so an astral character (emoji, less
|
|
1329
1329
|
* common CJK), a skin-tone emoji, or a decomposed accent counts as one and
|
|
1330
1330
|
* is not dropped. Every named key (`"Tab"`,
|
|
1331
|
-
* `"ArrowDown"`, `"Dead"`, `"Unidentified"`) is longer and falls through
|
|
1332
|
-
*
|
|
1333
|
-
*
|
|
1331
|
+
* `"ArrowDown"`, `"Dead"`, `"Unidentified"`) is longer and falls through,
|
|
1332
|
+
* unless the engine also flags it as IME processing (the case above claims
|
|
1333
|
+
* it first).
|
|
1334
1334
|
*
|
|
1335
1335
|
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown
|
|
1336
1336
|
*
|
|
@@ -1355,9 +1355,9 @@ type SearchPasteEvent = {
|
|
|
1355
1355
|
declare function searchActionFromKeyDown(event: SearchKeyDownEvent): SearchAction;
|
|
1356
1356
|
/**
|
|
1357
1357
|
* Classifies a `paste` on a search trigger. A paste is unambiguous search
|
|
1358
|
-
* intent
|
|
1359
|
-
* always opens the palette, and seeds it whenever the clipboard holds text.
|
|
1360
|
-
*
|
|
1358
|
+
* intent (the user pasted into a control that looks like a text field), so it
|
|
1359
|
+
* always opens the palette, and seeds it whenever the clipboard holds text. It
|
|
1360
|
+
* never returns `"ignore"`.
|
|
1361
1361
|
*
|
|
1362
1362
|
* The text is collapsed to a single space-separated line because the palette's
|
|
1363
1363
|
* query is a one-line field: pasting a multi-line selection should search for
|
package/dist/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./browser-only-BTSrYWLj.js";import{t}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./dialog-CsugEt2A.js";import{n as a}from"./separator-DfzxVutO.js";import{t as o}from"./slot-DdYN1L1C.js";import{n as s,t as c}from"./use-is-apple-platform-D4nifHMx.js";import{t as l}from"./use-callback-ref-BvVyI5K1.js";import{t as u}from"./kbd-CLHsJ99p.js";import{c as d}from"react/compiler-runtime";import{createContext as f,useContext as p,useEffect as m,useRef as h,useState as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{MagnifyingGlassIcon as b}from"@phosphor-icons/react/MagnifyingGlass";import{Command as x,useCommandState as S}from"cmdk";const C=f(null);function w(){let e=p(C);return _(e,`useCommandDialog must be used within Command.DialogRoot.`),e}function T(){return p(C)}function E(e){let t=p(C);return _(t,`Command.${e} must be rendered inside Command.DialogRoot.`),t}const D=/* @__PURE__ */ new Set([` `,`Enter`]);let O;function k(e){O??=new Intl.Segmenter(void 0,{granularity:`grapheme`});let t=O.segment(e)[Symbol.iterator]();return!t.next().done&&t.next().done===!0}function A(e){return e.isComposing||e.key===`Process`||e.keyCode===229?{type:`open`}:e.metaKey||e.ctrlKey||e.altKey||D.has(e.key)?{type:`ignore`}:k(e.key)?{type:`seed`,query:e.key}:{type:`ignore`}}function j(e){let t=(e.clipboardData?.getData(`text/plain`)??``).replace(/\s+/g,` `).trim();return t===``?{type:`open`}:{type:`seed`,query:t}}const M=e=>{let t=d(25),n,a,s,l,u,f;t[0]===e?(n=t[1],a=t[2],s=t[3],l=t[4],u=t[5],f=t[6]):({"aria-keyshortcuts":n,children:a,"data-slot":s,onKeyDown:l,onPaste:u,...f}=e,t[0]=e,t[1]=n,t[2]=a,t[3]=s,t[4]=l,t[5]=u,t[6]=f);let{keyboardShortcut:p,open:m,openWithQuery:h}=E(`SearchTrigger`),g=c(),_;t[7]===h?_=t[8]:(_=e=>{e.type!==`ignore`&&h(e.type===`seed`?e.query:void 0)},t[7]=h,t[8]=_);let y=_,b=n??(p?g?`Meta+K`:`Control+K`:void 0),x;t[9]===s?x=t[10]:(x=r(s,`command-search-trigger`),t[9]=s,t[10]=x);let S=m?`open`:`closed`,C;t[11]!==y||t[12]!==l?(C=e=>{if(l?.(e),e.defaultPrevented)return;let t=A(e.nativeEvent);t.type===`seed`&&e.preventDefault(),y(t)},t[11]=y,t[12]=l,t[13]=C):C=t[13];let w;t[14]!==y||t[15]!==u?(w=e=>{u?.(e),e.defaultPrevented||y(j(e.nativeEvent))},t[14]=y,t[15]=u,t[16]=w):w=t[16];let T;return t[17]!==a||t[18]!==f||t[19]!==b||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==w?(T=/* @__PURE__ */ v(i.Trigger,{asChild:!0,children:/* @__PURE__ */ v(o,{...f,"aria-keyshortcuts":b,"data-slot":x,"data-state":S,onKeyDown:C,onPaste:w,children:a})}),t[17]=a,t[18]=f,t[19]=b,t[20]=x,t[21]=S,t[22]=C,t[23]=w,t[24]=T):T=t[24],T},N=[];function P(){let e=Symbol(`command-keyboard-shortcut`);return N.push(e),{isOwner:()=>N[0]===e,release:()=>{let t=N.indexOf(e);t!==-1&&N.splice(t,1)}}}function F(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`TEXTAREA`:!1}function I(e){let t=d(4),{enabled:n,onTrigger:r}=e,i=l(r),a,o;t[0]!==n||t[1]!==i?(a=()=>{if(!n)return;let e=P(),t=s(),r=n=>{if(!e.isOwner()||n.defaultPrevented||n.repeat||F(n.target))return;let r=t?n.metaKey:n.ctrlKey,a=t?n.ctrlKey:n.metaKey;n.key?.toLowerCase()===`k`&&r&&!a&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),i())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),e.release()}},o=[n,i],t[0]=n,t[1]=i,t[2]=a,t[3]=o):(a=t[2],o=t[3]),m(a,o)}const L=e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`bg-popover flex h-full w-full flex-col overflow-hidden rounded-md`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},R={Root:L,DialogRoot:e=>{let n=d(36),r,a,o,s,c,l;n[0]===e?(r=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6]):({children:r,defaultOpen:c,keyboardShortcut:l,onOpenChange:a,open:o,...s}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o,n[4]=s,n[5]=c,n[6]=l);let u=c!==void 0&&c,f=l===void 0||l,p=o!=null,[m,_]=g(u),y=p?o:m,[b,x]=g(``),S=h(a),w;n[7]===a?w=n[8]:(w=()=>{S.current=a},n[7]=a,n[8]=w),t(w);let T;n[9]===p?T=n[10]:(T=(e,t)=>{e&&x(t??``),p||_(e),S.current?.(e)},n[9]=p,n[10]=T);let E=T,D;n[11]===E?D=n[12]:(D=e=>{E(e)},n[11]=E,n[12]=D);let O=D,k;n[13]===E?k=n[14]:(k=e=>{E(!0,e)},n[13]=E,n[14]=k);let A=k,j;n[15]!==E||n[16]!==y?(j=()=>{E(!y)},n[15]=E,n[16]=y,n[17]=j):j=n[17];let M=j,N;n[18]!==f||n[19]!==M?(N={enabled:f,onTrigger:M},n[18]=f,n[19]=M,n[20]=N):N=n[20],I(N);let P;n[21]!==f||n[22]!==y||n[23]!==A||n[24]!==b||n[25]!==O||n[26]!==M?(P={keyboardShortcut:f,open:y,openWithQuery:A,query:b,setOpen:O,setQuery:x,toggle:M},n[21]=f,n[22]=y,n[23]=A,n[24]=b,n[25]=O,n[26]=M,n[27]=P):P=n[27];let F=P,L;n[28]!==r||n[29]!==y||n[30]!==s||n[31]!==O?(L=/* @__PURE__ */ v(i.Root,{open:y,onOpenChange:O,...s,children:r}),n[28]=r,n[29]=y,n[30]=s,n[31]=O,n[32]=L):L=n[32];let R;return n[33]!==F||n[34]!==L?(R=/* @__PURE__ */ v(C.Provider,{value:F,children:L}),n[33]=F,n[34]=L,n[35]=R):R=n[35],R},SearchTrigger:M,DialogTrigger:i.Trigger,DialogContent:e=>{let t=d(21),{children:r,className:a,description:o,filter:s,shouldFilter:c,showCloseButton:l,title:u}=e,f=o===void 0?`Search for a command to run...`:o,p=l===void 0||l,m=u===void 0?`Command Palette`:u,g=h(null),_;t[0]===a?_=t[1]:(_=n(`overflow-hidden p-0 relative`,a),t[0]=a,t[1]=_);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{let t=g.current?.querySelector(`[data-slot~="command-input"]`);if(!(t instanceof HTMLInputElement)||t.disabled)return;e.preventDefault(),t.focus({preventScroll:!0});let n=t.value.length;t.setSelectionRange(n,n)},t[2]=b):b=t[2];let x;t[3]===m?x=t[4]:(x=/* @__PURE__ */ v(i.Title,{children:m}),t[3]=m,t[4]=x);let S;t[5]===f?S=t[6]:(S=/* @__PURE__ */ v(i.Description,{children:f}),t[5]=f,t[6]=S);let C;t[7]!==x||t[8]!==S?(C=/* @__PURE__ */ y(i.Header,{className:`sr-only absolute`,children:[x,S]}),t[7]=x,t[8]=S,t[9]=C):C=t[9];let w;t[10]!==r||t[11]!==s||t[12]!==c?(w=/* @__PURE__ */ v(L,{className:`**:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-input]]:h-12 **:data-[slot=command-group]:px-2 **:data-[slot=command-list]:pb-1`,filter:s,shouldFilter:c,children:r}),t[10]=r,t[11]=s,t[12]=c,t[13]=w):w=t[13];let T;t[14]===p?T=t[15]:(T=p&&/* @__PURE__ */ v(`div`,{className:`absolute top-1.5 right-1.5`,children:/* @__PURE__ */ v(i.CloseIconButton,{})}),t[14]=p,t[15]=T);let E;return t[16]!==T||t[17]!==_||t[18]!==C||t[19]!==w?(E=/* @__PURE__ */ y(i.Content,{ref:g,className:_,onOpenAutoFocus:b,children:[C,w,T]}),t[16]=T,t[17]=_,t[18]=C,t[19]=w,t[20]=E):E=t[20],E},Input:e=>{let t=d(25),i,a,o,s,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({className:i,"data-slot":a,onValueChange:o,ref:c,value:l,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=T(),f=l!=null,p=f?l:u?.query,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=/* @__PURE__ */ v(b,{"aria-hidden":!0,className:`size-5 shrink-0 opacity-50`}),t[7]=m):m=t[7];let h;t[8]===i?h=t[9]:(h=n(`pointer-coarse:text-base`,`placeholder:text-muted flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,i),t[8]=i,t[9]=h);let g;t[10]!==u||t[11]!==f||t[12]!==o?(g=e=>{f||u?.setQuery(e),o?.(e)},t[10]=u,t[11]=f,t[12]=o,t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=r(a,`command-input`),t[14]=a,t[15]=_);let S;t[16]!==s||t[17]!==p||t[18]!==h||t[19]!==g||t[20]!==_?(S=/* @__PURE__ */ v(x.Input,{className:h,onValueChange:g,value:p,...s,"data-slot":_}),t[16]=s,t[17]=p,t[18]=h,t[19]=g,t[20]=_,t[21]=S):S=t[21];let C;return t[22]!==c||t[23]!==S?(C=/* @__PURE__ */ y(`div`,{ref:c,"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b border-popover px-3`,children:[m,S]}),t[22]=c,t[23]=S,t[24]=C):C=t[24],C},List:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-list`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto scrollbar`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x.List,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Empty:t=>{let i=d(12),a,o,s;if(i[0]===t?(a=i[1],o=i[2],s=i[3]):({"data-slot":o,className:a,...s}=t,i[0]=t,i[1]=a,i[2]=o,i[3]=s),!e())return null;let c;i[4]===o?c=i[5]:(c=r(o,`command-empty`),i[4]=o,i[5]=c);let l;i[6]===a?l=i[7]:(l=n(`py-6 text-center text-sm`,a),i[6]=a,i[7]=l);let u;return i[8]!==s||i[9]!==c||i[10]!==l?(u=/* @__PURE__ */ v(x.Empty,{"data-slot":c,className:l,...s}),i[8]=s,i[9]=c,i[10]=l,i[11]=u):u=i[11],u},Group:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-group`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`*:[[cmdk-group-heading]]:text-muted overflow-hidden p-1 *:[[cmdk-group-heading]]:px-2 *:[[cmdk-group-heading]]:py-1.5 *:[[cmdk-group-heading]]:text-xs *:[[cmdk-group-heading]]:font-medium`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x.Group,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Item:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-item`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`data-[selected=true]:bg-active-menu-item [:where(&_svg)]:text-muted relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [:where(&_svg)]:size-5`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x.Item,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Shortcut:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-shortcut`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`text-muted ml-auto text-xs tracking-widest`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(`span`,{"data-slot":s,className:c,...o,translate:`no`}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Separator:e=>{let t=d(14),i,o,s;t[0]===e?(i=t[1],o=t[2],s=t[3]):({"data-slot":o,className:i,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s);let c;t[4]===o?c=t[5]:(c=r(o,`command-separator`),t[4]=o,t[5]=c);let l;t[6]===i?l=t[7]:(l=n(`-mx-1 my-1 w-auto`,i),t[6]=i,t[7]=l);let u;t[8]===l?u=t[9]:(u=/* @__PURE__ */ v(a,{className:l}),t[8]=l,t[9]=u);let f;return t[10]!==s||t[11]!==c||t[12]!==u?(f=/* @__PURE__ */ v(x.Separator,{"data-slot":c,asChild:!0,...s,children:u}),t[10]=s,t[11]=c,t[12]=u,t[13]=f):f=t[13],f}};function z(e){let t=d(19),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s=c(),l=s?`⌘`:`⌃`,f=s?`Command`:`Control`,p;t[4]===a?p=t[5]:(p=r(a,`meta-key`),t[4]=a,t[5]=p);let m=l===`⌃`&&`font-medium`,h;t[6]!==i||t[7]!==m?(h=n(m,i),t[6]=i,t[7]=m,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=/* @__PURE__ */ v(`span`,{className:`sr-only`,children:f}),t[9]=f,t[10]=g);let _;t[11]===l?_=t[12]:(_=/* @__PURE__ */ v(`span`,{"aria-hidden":!0,children:l}),t[11]=l,t[12]=_);let b;return t[13]!==o||t[14]!==p||t[15]!==h||t[16]!==g||t[17]!==_?(b=/* @__PURE__ */ y(u,{...o,suppressHydrationWarning:!0,"data-slot":p,className:h,children:[g,_]}),t[13]=o,t[14]=p,t[15]=h,t[16]=g,t[17]=_,t[18]=b):b=t[18],b}export{R as Command,z as MetaKey,A as searchActionFromKeyDown,j as searchActionFromPaste,w as useCommandDialog,S as useCommandState};
|
|
1
|
+
"use client";import{t as e}from"./use-is-hydrated-BeLOGKwE.js";import{t}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./dialog-DmzoDfY3.js";import{n as a}from"./separator-DnvhwY2J.js";import{t as o}from"./slot-B7rwscwd.js";import{n as s,t as c}from"./use-is-apple-platform-Bq6_KbVX.js";import{t as l}from"./use-callback-ref-DiOXFQzM.js";import{t as u}from"./kbd-P1nQshWo.js";import{c as d}from"react/compiler-runtime";import{createContext as f,useContext as p,useEffect as m,useRef as h,useState as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{MagnifyingGlassIcon as b}from"@phosphor-icons/react/MagnifyingGlass";import{Command as x,useCommandState as S}from"cmdk";const C=f(null);function w(){let e=p(C);return _(e,`useCommandDialog must be used within Command.DialogRoot.`),e}function T(){return p(C)}function E(e){let t=p(C);return _(t,`Command.${e} must be rendered inside Command.DialogRoot.`),t}const D=/* @__PURE__ */ new Set([` `,`Enter`]);let O;function k(e){O??=new Intl.Segmenter(void 0,{granularity:`grapheme`});let t=O.segment(e)[Symbol.iterator]();return!t.next().done&&t.next().done===!0}function A(e){return e.isComposing||e.key===`Process`||e.keyCode===229?{type:`open`}:e.metaKey||e.ctrlKey||e.altKey||D.has(e.key)?{type:`ignore`}:k(e.key)?{type:`seed`,query:e.key}:{type:`ignore`}}function j(e){let t=(e.clipboardData?.getData(`text/plain`)??``).replace(/\s+/g,` `).trim();return t===``?{type:`open`}:{type:`seed`,query:t}}const M=e=>{let t=d(25),n,a,s,l,u,f;t[0]===e?(n=t[1],a=t[2],s=t[3],l=t[4],u=t[5],f=t[6]):({"aria-keyshortcuts":n,children:a,"data-slot":s,onKeyDown:l,onPaste:u,...f}=e,t[0]=e,t[1]=n,t[2]=a,t[3]=s,t[4]=l,t[5]=u,t[6]=f);let{keyboardShortcut:p,open:m,openWithQuery:h}=E(`SearchTrigger`),g=c(),_;t[7]===h?_=t[8]:(_=e=>{e.type!==`ignore`&&h(e.type===`seed`?e.query:void 0)},t[7]=h,t[8]=_);let y=_,b=n??(p?g?`Meta+K`:`Control+K`:void 0),x;t[9]===s?x=t[10]:(x=r(s,`command-search-trigger`),t[9]=s,t[10]=x);let S=m?`open`:`closed`,C;t[11]!==y||t[12]!==l?(C=e=>{if(l?.(e),e.defaultPrevented)return;let t=A(e.nativeEvent);t.type===`seed`&&e.preventDefault(),y(t)},t[11]=y,t[12]=l,t[13]=C):C=t[13];let w;t[14]!==y||t[15]!==u?(w=e=>{u?.(e),e.defaultPrevented||y(j(e.nativeEvent))},t[14]=y,t[15]=u,t[16]=w):w=t[16];let T;return t[17]!==a||t[18]!==f||t[19]!==b||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==w?(T=/* @__PURE__ */ v(i.Trigger,{asChild:!0,children:/* @__PURE__ */ v(o,{...f,"aria-keyshortcuts":b,"data-slot":x,"data-state":S,onKeyDown:C,onPaste:w,children:a})}),t[17]=a,t[18]=f,t[19]=b,t[20]=x,t[21]=S,t[22]=C,t[23]=w,t[24]=T):T=t[24],T},N=[];function P(){let e=Symbol(`command-keyboard-shortcut`);return N.push(e),{isOwner:()=>N[0]===e,release:()=>{let t=N.indexOf(e);t!==-1&&N.splice(t,1)}}}function F(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`TEXTAREA`:!1}function I(e){let t=d(4),{enabled:n,onTrigger:r}=e,i=l(r),a,o;t[0]!==n||t[1]!==i?(a=()=>{if(!n)return;let e=P(),t=s(),r=n=>{if(!e.isOwner()||n.defaultPrevented||n.repeat||F(n.target))return;let r=t?n.metaKey:n.ctrlKey,a=t?n.ctrlKey:n.metaKey;n.key?.toLowerCase()===`k`&&r&&!a&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),i())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),e.release()}},o=[n,i],t[0]=n,t[1]=i,t[2]=a,t[3]=o):(a=t[2],o=t[3]),m(a,o)}const L=e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`bg-popover flex h-full w-full flex-col overflow-hidden rounded-md`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},R={Root:L,DialogRoot:e=>{let n=d(36),r,a,o,s,c,l;n[0]===e?(r=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6]):({children:r,defaultOpen:c,keyboardShortcut:l,onOpenChange:a,open:o,...s}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o,n[4]=s,n[5]=c,n[6]=l);let u=c!==void 0&&c,f=l===void 0||l,p=o!=null,[m,_]=g(u),y=p?o:m,[b,x]=g(``),S=h(a),w;n[7]===a?w=n[8]:(w=()=>{S.current=a},n[7]=a,n[8]=w),t(w);let T;n[9]===p?T=n[10]:(T=(e,t)=>{e&&x(t??``),p||_(e),S.current?.(e)},n[9]=p,n[10]=T);let E=T,D;n[11]===E?D=n[12]:(D=e=>{E(e)},n[11]=E,n[12]=D);let O=D,k;n[13]===E?k=n[14]:(k=e=>{E(!0,e)},n[13]=E,n[14]=k);let A=k,j;n[15]!==E||n[16]!==y?(j=()=>{E(!y)},n[15]=E,n[16]=y,n[17]=j):j=n[17];let M=j,N;n[18]!==f||n[19]!==M?(N={enabled:f,onTrigger:M},n[18]=f,n[19]=M,n[20]=N):N=n[20],I(N);let P;n[21]!==f||n[22]!==y||n[23]!==A||n[24]!==b||n[25]!==O||n[26]!==M?(P={keyboardShortcut:f,open:y,openWithQuery:A,query:b,setOpen:O,setQuery:x,toggle:M},n[21]=f,n[22]=y,n[23]=A,n[24]=b,n[25]=O,n[26]=M,n[27]=P):P=n[27];let F=P,L;n[28]!==r||n[29]!==y||n[30]!==s||n[31]!==O?(L=/* @__PURE__ */ v(i.Root,{open:y,onOpenChange:O,...s,children:r}),n[28]=r,n[29]=y,n[30]=s,n[31]=O,n[32]=L):L=n[32];let R;return n[33]!==F||n[34]!==L?(R=/* @__PURE__ */ v(C.Provider,{value:F,children:L}),n[33]=F,n[34]=L,n[35]=R):R=n[35],R},SearchTrigger:M,DialogTrigger:i.Trigger,DialogContent:e=>{let t=d(21),{children:r,className:a,description:o,filter:s,shouldFilter:c,showCloseButton:l,title:u}=e,f=o===void 0?`Search for a command to run...`:o,p=l===void 0||l,m=u===void 0?`Command Palette`:u,g=h(null),_;t[0]===a?_=t[1]:(_=n(`overflow-hidden p-0 relative`,a),t[0]=a,t[1]=_);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{let t=g.current?.querySelector(`[data-slot~="command-input"]`);if(!(t instanceof HTMLInputElement)||t.disabled)return;e.preventDefault(),t.focus({preventScroll:!0});let n=t.value.length;t.setSelectionRange(n,n)},t[2]=b):b=t[2];let x;t[3]===m?x=t[4]:(x=/* @__PURE__ */ v(i.Title,{children:m}),t[3]=m,t[4]=x);let S;t[5]===f?S=t[6]:(S=/* @__PURE__ */ v(i.Description,{children:f}),t[5]=f,t[6]=S);let C;t[7]!==x||t[8]!==S?(C=/* @__PURE__ */ y(i.Header,{className:`sr-only absolute`,children:[x,S]}),t[7]=x,t[8]=S,t[9]=C):C=t[9];let w;t[10]!==r||t[11]!==s||t[12]!==c?(w=/* @__PURE__ */ v(L,{className:`**:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-input]]:h-12 **:data-[slot=command-group]:px-2 **:data-[slot=command-list]:pb-1`,filter:s,shouldFilter:c,children:r}),t[10]=r,t[11]=s,t[12]=c,t[13]=w):w=t[13];let T;t[14]===p?T=t[15]:(T=p&&/* @__PURE__ */ v(`div`,{className:`absolute top-1.5 right-1.5`,children:/* @__PURE__ */ v(i.CloseIconButton,{})}),t[14]=p,t[15]=T);let E;return t[16]!==T||t[17]!==_||t[18]!==C||t[19]!==w?(E=/* @__PURE__ */ y(i.Content,{ref:g,className:_,onOpenAutoFocus:b,children:[C,w,T]}),t[16]=T,t[17]=_,t[18]=C,t[19]=w,t[20]=E):E=t[20],E},Input:e=>{let t=d(25),i,a,o,s,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({className:i,"data-slot":a,onValueChange:o,ref:c,value:l,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=T(),f=l!=null,p=f?l:u?.query,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=/* @__PURE__ */ v(b,{"aria-hidden":!0,className:`size-5 shrink-0 opacity-50`}),t[7]=m):m=t[7];let h;t[8]===i?h=t[9]:(h=n(`pointer-coarse:text-base`,`placeholder:text-muted flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,i),t[8]=i,t[9]=h);let g;t[10]!==u||t[11]!==f||t[12]!==o?(g=e=>{f||u?.setQuery(e),o?.(e)},t[10]=u,t[11]=f,t[12]=o,t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=r(a,`command-input`),t[14]=a,t[15]=_);let S;t[16]!==s||t[17]!==p||t[18]!==h||t[19]!==g||t[20]!==_?(S=/* @__PURE__ */ v(x.Input,{className:h,onValueChange:g,value:p,...s,"data-slot":_}),t[16]=s,t[17]=p,t[18]=h,t[19]=g,t[20]=_,t[21]=S):S=t[21];let C;return t[22]!==c||t[23]!==S?(C=/* @__PURE__ */ y(`div`,{ref:c,"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b border-popover px-3`,children:[m,S]}),t[22]=c,t[23]=S,t[24]=C):C=t[24],C},List:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-list`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto scrollbar`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x.List,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Empty:t=>{let i=d(12),a,o,s;if(i[0]===t?(a=i[1],o=i[2],s=i[3]):({"data-slot":o,className:a,...s}=t,i[0]=t,i[1]=a,i[2]=o,i[3]=s),!e())return null;let c;i[4]===o?c=i[5]:(c=r(o,`command-empty`),i[4]=o,i[5]=c);let l;i[6]===a?l=i[7]:(l=n(`py-6 text-center text-sm`,a),i[6]=a,i[7]=l);let u;return i[8]!==s||i[9]!==c||i[10]!==l?(u=/* @__PURE__ */ v(x.Empty,{"data-slot":c,className:l,...s}),i[8]=s,i[9]=c,i[10]=l,i[11]=u):u=i[11],u},Group:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-group`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`*:[[cmdk-group-heading]]:text-muted overflow-hidden p-1 *:[[cmdk-group-heading]]:px-2 *:[[cmdk-group-heading]]:py-1.5 *:[[cmdk-group-heading]]:text-xs *:[[cmdk-group-heading]]:font-medium`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x.Group,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Item:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-item`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`data-[selected=true]:bg-active-menu-item [:where(&_svg)]:text-muted relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [:where(&_svg)]:size-5`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(x.Item,{"data-slot":s,className:c,...o}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Shortcut:e=>{let t=d(12),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s;t[4]===a?s=t[5]:(s=r(a,`command-shortcut`),t[4]=a,t[5]=s);let c;t[6]===i?c=t[7]:(c=n(`text-muted ml-auto text-xs tracking-widest`,i),t[6]=i,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=/* @__PURE__ */ v(`span`,{"data-slot":s,className:c,...o,translate:`no`}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l},Separator:e=>{let t=d(14),i,o,s;t[0]===e?(i=t[1],o=t[2],s=t[3]):({"data-slot":o,className:i,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s);let c;t[4]===o?c=t[5]:(c=r(o,`command-separator`),t[4]=o,t[5]=c);let l;t[6]===i?l=t[7]:(l=n(`-mx-1 my-1 w-auto`,i),t[6]=i,t[7]=l);let u;t[8]===l?u=t[9]:(u=/* @__PURE__ */ v(a,{className:l}),t[8]=l,t[9]=u);let f;return t[10]!==s||t[11]!==c||t[12]!==u?(f=/* @__PURE__ */ v(x.Separator,{"data-slot":c,asChild:!0,...s,children:u}),t[10]=s,t[11]=c,t[12]=u,t[13]=f):f=t[13],f}};function z(e){let t=d(19),i,a,o;t[0]===e?(i=t[1],a=t[2],o=t[3]):({"data-slot":a,className:i,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o);let s=c(),l=s?`⌘`:`⌃`,f=s?`Command`:`Control`,p;t[4]===a?p=t[5]:(p=r(a,`meta-key`),t[4]=a,t[5]=p);let m=l===`⌃`&&`font-medium`,h;t[6]!==i||t[7]!==m?(h=n(m,i),t[6]=i,t[7]=m,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=/* @__PURE__ */ v(`span`,{className:`sr-only`,children:f}),t[9]=f,t[10]=g);let _;t[11]===l?_=t[12]:(_=/* @__PURE__ */ v(`span`,{"aria-hidden":!0,children:l}),t[11]=l,t[12]=_);let b;return t[13]!==o||t[14]!==p||t[15]!==h||t[16]!==g||t[17]!==_?(b=/* @__PURE__ */ y(u,{...o,suppressHydrationWarning:!0,"data-slot":p,className:h,children:[g,_]}),t[13]=o,t[14]=p,t[15]=h,t[16]=g,t[17]=_,t[18]=b):b=t[18],b}export{R as Command,z as MetaKey,A as searchActionFromKeyDown,j as searchActionFromPaste,w as useCommandDialog,S as useCommandState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function t(...t){return n=>{let r=!1,i=t.map(t=>{let i=e(t,n);return typeof i==`function`&&(r=!0),i});if(r)return()=>{for(let n=0;n<i.length;n++){let r=i[n];typeof r==`function`?r():e(t[n],null)}}}}export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"./browser-only-ymFoM3Ya.js";async function t(t){if(!e())throw Error(`copyToClipboard requires a DOM environment`);try{if(typeof navigator.clipboard?.writeText==`function`)await navigator.clipboard.writeText(t);else throw Error(`writeText not supported`)}catch(e){try{n(t)}catch{throw e}}}function n(e){let t=document.createElement(`textarea`);t.value=e,document.body.appendChild(t);try{if(t.select(),!document.execCommand(`copy`))throw Error(`document.execCommand("copy") failed`)}finally{document.body.removeChild(t)}}export{t};
|
package/dist/cx.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type ClassValue = string | number | bigint | boolean | null | undefined | ClassV
|
|
|
5
5
|
declare const clsx$1: (...inputs: ClassValue[]) => string;
|
|
6
6
|
/**
|
|
7
7
|
* Conditionally join class names into a single space-separated string, with falsy
|
|
8
|
-
* values ignored
|
|
8
|
+
* values ignored, **without** Tailwind conflict resolution.
|
|
9
9
|
*
|
|
10
10
|
* Vendored `clsx`. Prefer {@link cx} for composing a `className` (it also resolves
|
|
11
11
|
* Tailwind conflicts); reach for `clsx` only when you need a plain space-join that
|
|
@@ -27,8 +27,8 @@ type ClassNameFunction = {
|
|
|
27
27
|
* Conditionally compose class names and resolve Tailwind CSS conflicts, so later
|
|
28
28
|
* classes override earlier ones (the same precedence model as inline styles).
|
|
29
29
|
*
|
|
30
|
-
* Accepts the same inputs as `clsx`
|
|
31
|
-
* `{ [className]: boolean }` objects, with falsy values ignored
|
|
30
|
+
* Accepts the same inputs as `clsx` (strings, numbers, arrays, and
|
|
31
|
+
* `{ [className]: boolean }` objects, with falsy values ignored), then resolves
|
|
32
32
|
* Tailwind utility conflicts so the rightmost class in each conflicting group wins.
|
|
33
33
|
* This makes `cx` safe for prop overrides: `cx("bg-blue-500", className)` lets a
|
|
34
34
|
* consumer's `className` win.
|
|
@@ -37,7 +37,7 @@ type ClassNameFunction = {
|
|
|
37
37
|
* `./vendor`) with mantle's overrides baked into the default config: the `em` spacing
|
|
38
38
|
* scale (`w-em`, `p-em`, …) and the `text-mono` / `text-size-inherit` font-size
|
|
39
39
|
* utilities are conflict-aware with no `extendTailwindMerge` call. Results are cached so
|
|
40
|
-
* repeated calls with the same arguments
|
|
40
|
+
* repeated calls with the same arguments (the common case across re-renders) are cheap.
|
|
41
41
|
*
|
|
42
42
|
* Also callable as a tagged template, which caches by call-site identity for hot
|
|
43
43
|
* re-rendering paths: `` cx`px-2 px-4 ${active && "bg-blue-500"}` ``.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The incoming `data-slot` chain a part receives when an ancestor composes it
|
|
3
|
-
* via `asChild
|
|
3
|
+
* via `asChild`. Mantle's `Slot` forwards the ancestor chain so parts can
|
|
4
4
|
* concatenate it ahead of their own slot name instead of clobbering it.
|
|
5
5
|
*/
|
|
6
6
|
type WithDataSlot = {
|
|
7
7
|
/**
|
|
8
8
|
* The `data-slot` chain accumulated by ancestor `asChild` composition.
|
|
9
9
|
* Parts merge it ancestors-first with their own slot name via
|
|
10
|
-
* `joinDataSlot`, so the rendered attribute reads in DOM order
|
|
10
|
+
* `joinDataSlot`, so the rendered attribute reads in DOM order, from the outermost
|
|
11
11
|
* ancestor through to the rendered element.
|
|
12
12
|
*/
|
|
13
13
|
"data-slot"?: string;
|