@ngrok/mantle 0.93.7 → 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 +73 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1234 -84
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
- package/dist/alert-center.d.ts +67 -55
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +35 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +17 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +33 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +153 -97
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +36 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +19 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +155 -100
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +47 -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.d.ts +8 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
- package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +8 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +7 -2
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +34 -23
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BLCqzt56.js +1 -0
- package/dist/chart-CChZiCrt.js +1 -0
- package/dist/chart-CUmSu9d7.js +1 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +15 -2
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
- package/dist/choice.d.ts +6 -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 +28 -19
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +6 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +16 -3
- package/dist/code.js +1 -1
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +42 -28
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +59 -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/cx.js +1 -1
- package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +83 -52
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +13 -2
- package/dist/description-list.js +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
- package/dist/dialog-CbEEA0fl.d.ts +32 -0
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +53 -42
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +11 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +35 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +25 -14
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -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 +8 -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 +13 -1
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +37 -5
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +17 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
- package/dist/label.d.ts +6 -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 +147 -90
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +34 -16
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +15 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +82 -79
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +13 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +133 -88
- package/dist/media-object.d.ts +16 -4
- package/dist/media-object.js +1 -1
- package/dist/migrations/0014-chart-named-colors.yml +1389 -0
- package/dist/migrations/0015-segmented-control.yml +788 -0
- package/dist/multi-select.d.ts +42 -29
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +20 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +93 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +7 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +28 -11
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +11 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +9 -4
- package/dist/query.js +1 -1
- package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +21 -100
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +43 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +137 -76
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +136 -0
- package/dist/segmented-control.js +1 -0
- package/dist/select-1xuUx_os.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +29 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +6 -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 +36 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +53 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +15 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +12 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +11 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
- package/dist/slot.d.ts +6 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +20 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +35 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +14 -2
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
- package/dist/table.d.ts +6 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +24 -12
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +12 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +18 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +25 -11
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +15 -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-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +6 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +28 -14
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.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 +14 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +7 -2
- package/dist/well.js +1 -1
- package/package.json +21 -7
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.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-B8k98Pby.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/checkbox-DmSQXs26.js +0 -1
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-7TUgiSzX.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.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-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/icons-DP3lQw5O.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-nHqqYS7e.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-RFRIQxU2.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-C96V8SXi.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/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-CSJc_sB4.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-C-glc5Q-.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-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-DceYk1Id.js +0 -1
package/dist/command.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Command component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/navigation/command
|
|
5
|
+
*/
|
|
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";
|
|
4
9
|
import { ComponentProps, ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
|
|
5
10
|
import { Command as Command$1, useCommandState } from "cmdk";
|
|
6
11
|
/**
|
|
@@ -10,7 +15,7 @@ import { Command as Command$1, useCommandState } from "cmdk";
|
|
|
10
15
|
*/
|
|
11
16
|
type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> & {
|
|
12
17
|
/**
|
|
13
|
-
* The control that opens the palette
|
|
18
|
+
* The control that opens the palette: the row or button a user sees.
|
|
14
19
|
*
|
|
15
20
|
* A single element, required: this part renders no DOM of its own and
|
|
16
21
|
* clones what it is given, so text renders nothing to click and no children
|
|
@@ -22,8 +27,8 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* Makes any control behave like a search field that opens the command palette.
|
|
25
|
-
* It renders no DOM of its own
|
|
26
|
-
* 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
|
|
27
32
|
* opinion about how the trigger looks or how it behaves in a collapsed sidebar
|
|
28
33
|
* rail.
|
|
29
34
|
*
|
|
@@ -50,12 +55,12 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
50
55
|
* binds to `Command.DialogRoot`, because `Sheet` parts read a dialog scope
|
|
51
56
|
* of their own.
|
|
52
57
|
* - `data-state="open" | "closed"`, stamped from the palette's own state so it
|
|
53
|
-
* survives being wrapped in another cloning trigger
|
|
58
|
+
* survives being wrapped in another cloning trigger. A `Sidebar.Tooltip`
|
|
54
59
|
* passes its own `data-state` down, and Radix's prop merge would otherwise
|
|
55
60
|
* let it win.
|
|
56
61
|
* - `aria-keyshortcuts`, so the `⌘K` binding is announced rather than only
|
|
57
|
-
* drawn
|
|
58
|
-
* 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
|
|
59
64
|
* announce a chord you bound yourself.
|
|
60
65
|
* - `onKeyDown` and `onPaste`, composed with the child's own handlers.
|
|
61
66
|
* - `data-slot="command-search-trigger"`, joined ahead of the child's own slot.
|
|
@@ -66,7 +71,7 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
66
71
|
*
|
|
67
72
|
* It adds no accessible name: the child's visible label is the name, so the two
|
|
68
73
|
* cannot drift apart. A visible `⌘K` hint belongs to the child and should be
|
|
69
|
-
* `aria-hidden` there, since `aria-keyshortcuts` already announces the chord
|
|
74
|
+
* `aria-hidden` there, since `aria-keyshortcuts` already announces the chord.
|
|
70
75
|
* `Sidebar.SearchTrigger`'s `shortcut` prop does that for you.
|
|
71
76
|
*
|
|
72
77
|
* @see https://mantle.ngrok.com/components/navigation/command#commandsearchtrigger
|
|
@@ -103,7 +108,7 @@ type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> &
|
|
|
103
108
|
*
|
|
104
109
|
* @example
|
|
105
110
|
* In a sidebar, where `Sidebar.SearchTrigger` owns the row's appearance in both
|
|
106
|
-
* panel states
|
|
111
|
+
* panel states (including its hover-revealed shortcut hint) and
|
|
107
112
|
* `Sidebar.Tooltip` labels it in the collapsed rail. `Command.DialogRoot` sits
|
|
108
113
|
* above `Sidebar.Nav`: below `mobileBreakpoint` the nav is a sheet that
|
|
109
114
|
* unmounts its subtree when it closes, and a root inside it takes the `⌘K`
|
|
@@ -145,7 +150,7 @@ declare const CommandSearchTrigger: ({ "aria-keyshortcuts": ariaKeyshortcuts, ch
|
|
|
145
150
|
type CommandRootProps = ComponentProps<typeof Command$1> & WithDataSlot;
|
|
146
151
|
/**
|
|
147
152
|
* The inline palette, wrapping `Command.Input` and `Command.List`. It owns the
|
|
148
|
-
* filtering and the active item for every part below it
|
|
153
|
+
* filtering and the active item for every part below it. `Command.DialogContent`
|
|
149
154
|
* renders one itself, so a modal palette does not add it.
|
|
150
155
|
*
|
|
151
156
|
* @see https://mantle.ngrok.com/components/navigation/command#commandroot
|
|
@@ -179,15 +184,15 @@ type CommandRootProps = ComponentProps<typeof Command$1> & WithDataSlot;
|
|
|
179
184
|
*/
|
|
180
185
|
declare const CommandRoot: ({ "data-slot": dataSlot, className, ...props }: CommandRootProps) => import("react").JSX.Element;
|
|
181
186
|
/**
|
|
182
|
-
* The props for `Command.DialogRoot`. `Dialog.Root`'s props
|
|
183
|
-
* 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
|
|
184
189
|
* redeclared here, because this part owns them.
|
|
185
190
|
*
|
|
186
191
|
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
187
192
|
*/
|
|
188
193
|
type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children" | "defaultOpen" | "onOpenChange" | "open"> & {
|
|
189
194
|
/**
|
|
190
|
-
* The palette's parts
|
|
195
|
+
* The palette's parts: a `Command.DialogContent`, and any trigger or
|
|
191
196
|
* consumer of `useCommandDialog()`. `DialogRoot` renders no DOM of its own.
|
|
192
197
|
*/
|
|
193
198
|
children?: ReactNode;
|
|
@@ -199,19 +204,19 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
199
204
|
defaultOpen?: boolean;
|
|
200
205
|
/**
|
|
201
206
|
* Bind `⌘K` (macOS) / `Ctrl+K` (Windows/Linux) to toggle the palette. The
|
|
202
|
-
* shortcut requires exactly the platform modifier + `k`, resolved per host
|
|
203
|
-
*
|
|
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
|
|
204
209
|
* to end of line") is left alone. `Shift`/`Alt` combinations pass through.
|
|
205
210
|
*
|
|
206
211
|
* It lives here rather than on `Command.SearchTrigger` because the trigger
|
|
207
|
-
* may be unmounted while the shortcut must still work
|
|
212
|
+
* may be unmounted while the shortcut must still work: a sidebar rendered
|
|
208
213
|
* as a mobile sheet unmounts its whole tree when the sheet is closed.
|
|
209
214
|
*
|
|
210
215
|
* The shortcut is ignored while focus is in a rich-text or code editor
|
|
211
216
|
* (`contenteditable`, or a `<textarea>`, which is what Monaco attaches to),
|
|
212
217
|
* where `⌘K` is already bound to "insert link" or a chord prefix. It
|
|
213
218
|
* deliberately still fires from a plain `<input>`, including the palette's
|
|
214
|
-
* own `Command.Input
|
|
219
|
+
* own `Command.Input`, so the chord closes what it opened.
|
|
215
220
|
*
|
|
216
221
|
* An earlier `keydown` listener that calls `preventDefault()` (on `document`,
|
|
217
222
|
* or on an element) stops the shortcut. Do not bind `⌘K` in your app as
|
|
@@ -222,8 +227,8 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
222
227
|
* a second palette never opens alongside the first.
|
|
223
228
|
*
|
|
224
229
|
* Set `false` to bind the chord yourself with `useCommandDialog()`.
|
|
225
|
-
* `Command.SearchTrigger` then adds no `aria-keyshortcuts` of its own
|
|
226
|
-
* 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`
|
|
227
232
|
* reports the same flag. The *visible* hint always belongs to the trigger's
|
|
228
233
|
* child, so gating that on the flag is the child's job.
|
|
229
234
|
*
|
|
@@ -248,7 +253,7 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
248
253
|
* seed and the open state land in one state update, so `Command.Input` mounts
|
|
249
254
|
* with the character already in it and no keystroke races the dialog's mount.
|
|
250
255
|
*
|
|
251
|
-
* **Opening always starts from a known query
|
|
256
|
+
* **Opening always starts from a known query**: the seed, or empty. That
|
|
252
257
|
* happens at open time rather than by clearing on close, because
|
|
253
258
|
* `Dialog.Content` animates out and clearing on close would swap the visible
|
|
254
259
|
* list mid-animation. So dismissing and reopening never resurrects the previous
|
|
@@ -256,7 +261,7 @@ type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children
|
|
|
256
261
|
*
|
|
257
262
|
* Pass `open`/`onOpenChange` to control the open state; the query stays
|
|
258
263
|
* internal either way. To own the query too, pass `value`/`onValueChange` to
|
|
259
|
-
* `Command.Input
|
|
264
|
+
* `Command.Input`. See that part for the trade-off.
|
|
260
265
|
*
|
|
261
266
|
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
262
267
|
*
|
|
@@ -376,7 +381,7 @@ declare const CommandDialogContent: ({ children, className, description, filter,
|
|
|
376
381
|
* palette, no dialog) it stays uncontrolled and cmdk owns the text.
|
|
377
382
|
*
|
|
378
383
|
* Passing `value` takes the query over completely: your value wins, this stops
|
|
379
|
-
* reporting to `useCommandDialog()`, and **seeding becomes yours to apply
|
|
384
|
+
* reporting to `useCommandDialog()`, and **seeding becomes yours to apply**:
|
|
380
385
|
* read `useCommandDialog().query` and mirror it, or drop
|
|
381
386
|
* `Command.SearchTrigger` for a plain `Command.DialogTrigger`. Prefer leaving
|
|
382
387
|
* it uncontrolled and reading the query from the hook.
|
|
@@ -389,7 +394,7 @@ declare const CommandDialogContent: ({ children, className, description, filter,
|
|
|
389
394
|
* | Data Attribute | Value | Description |
|
|
390
395
|
* | --- | --- | --- |
|
|
391
396
|
* | `data-slot` | `"command-input-wrapper"` | The row holding the magnifier and the field. |
|
|
392
|
-
* | `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. |
|
|
393
398
|
*
|
|
394
399
|
* @see https://mantle.ngrok.com/components/navigation/command#commandinput
|
|
395
400
|
*
|
|
@@ -639,6 +644,13 @@ declare const CommandShortcut: ({ "data-slot": dataSlot, className, ...props }:
|
|
|
639
644
|
* opening a modal, the component is
|
|
640
645
|
* [Combobox](https://mantle.ngrok.com/components/forms/combobox).
|
|
641
646
|
*
|
|
647
|
+
* @useWhen Search for an action or a page and run it from a keyboard-first palette, such as a `⌘K`
|
|
648
|
+
* menu.
|
|
649
|
+
*
|
|
650
|
+
* @siblings
|
|
651
|
+
* - `Combobox`: the text field filters options in place and sets a form value.
|
|
652
|
+
* - `DropdownMenu`: a short list of actions opens from one button.
|
|
653
|
+
*
|
|
642
654
|
* @see https://mantle.ngrok.com/components/navigation/command
|
|
643
655
|
*
|
|
644
656
|
* @example
|
|
@@ -687,7 +699,7 @@ declare const CommandShortcut: ({ "data-slot": dataSlot, className, ...props }:
|
|
|
687
699
|
declare const Command: {
|
|
688
700
|
/**
|
|
689
701
|
* The inline palette, wrapping `Command.Input` and `Command.List`. It owns the
|
|
690
|
-
* filtering and the active item for every part below it
|
|
702
|
+
* filtering and the active item for every part below it. `Command.DialogContent`
|
|
691
703
|
* renders one itself, so a modal palette does not add it.
|
|
692
704
|
*
|
|
693
705
|
* @see https://mantle.ngrok.com/components/navigation/command#commandroot
|
|
@@ -793,7 +805,7 @@ declare const Command: {
|
|
|
793
805
|
*/
|
|
794
806
|
readonly SearchTrigger: typeof CommandSearchTrigger;
|
|
795
807
|
/**
|
|
796
|
-
* A bare button that opens the Command dialog when clicked
|
|
808
|
+
* A bare button that opens the Command dialog when clicked: the escape hatch
|
|
797
809
|
* for a trigger that should not look like a search field. Wrap your own
|
|
798
810
|
* element with `asChild`.
|
|
799
811
|
*
|
|
@@ -1131,8 +1143,8 @@ type CommandDialogState = {
|
|
|
1131
1143
|
*/
|
|
1132
1144
|
open: boolean;
|
|
1133
1145
|
/**
|
|
1134
|
-
* Set the open state. **Opening through this resets the query to empty
|
|
1135
|
-
*
|
|
1146
|
+
* Set the open state. **Opening through this resets the query to empty**.
|
|
1147
|
+
* Use {@link CommandDialogState.openWithQuery} to open with text in the
|
|
1136
1148
|
* field. Calls `onOpenChange` and, when uncontrolled, updates the internal
|
|
1137
1149
|
* state.
|
|
1138
1150
|
*/
|
|
@@ -1153,7 +1165,7 @@ type CommandDialogState = {
|
|
|
1153
1165
|
* The current text of `Command.Input`. Read it to drive your own filtering
|
|
1154
1166
|
* or a server-side search when the palette runs with `shouldFilter={false}`.
|
|
1155
1167
|
*
|
|
1156
|
-
* Only meaningful while `Command.Input` is uncontrolled
|
|
1168
|
+
* Only meaningful while `Command.Input` is uncontrolled. Passing it a
|
|
1157
1169
|
* `value` takes ownership of the query, and this stops tracking the field.
|
|
1158
1170
|
*/
|
|
1159
1171
|
query: string;
|
|
@@ -1174,8 +1186,8 @@ type CommandDialogState = {
|
|
|
1174
1186
|
* Read the nearest `Command.DialogRoot` state. Throws when called outside one
|
|
1175
1187
|
* so misuse fails loudly rather than rendering a trigger that opens nothing.
|
|
1176
1188
|
*
|
|
1177
|
-
* Reach for it to open the palette from somewhere other than its trigger
|
|
1178
|
-
* 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
|
|
1179
1191
|
* build a custom trigger, pairing it with
|
|
1180
1192
|
* [`searchActionFromKeyDown`](https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown)
|
|
1181
1193
|
* so typing into your trigger behaves like typing into `Command.SearchTrigger`.
|
|
@@ -1216,18 +1228,18 @@ type Props = Omit<ComponentProps<"kbd">, "children"> & WithDataSlot;
|
|
|
1216
1228
|
declare function MetaKey({ "data-slot": dataSlot, className, ...props }: Props): import("react").JSX.Element;
|
|
1217
1229
|
/**
|
|
1218
1230
|
* What a keystroke or paste on a search trigger should do to the command
|
|
1219
|
-
* palette. A search trigger looks like a text field but is a `<button>`
|
|
1220
|
-
* 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
|
|
1221
1233
|
* classified before it can mean anything.
|
|
1222
1234
|
*
|
|
1223
1235
|
* Three outcomes, because "type into the trigger" has three honest answers:
|
|
1224
1236
|
*
|
|
1225
|
-
* - `"seed"
|
|
1237
|
+
* - `"seed"`: the event carried text. Open the palette with `query` already
|
|
1226
1238
|
* in `Command.Input`.
|
|
1227
|
-
* - `"open"
|
|
1239
|
+
* - `"open"`: the event was text *intent* that cannot be replayed (an IME
|
|
1228
1240
|
* composition belongs to the element that started it). Open the palette with
|
|
1229
1241
|
* an empty query so the next keystroke has a real text field to land in.
|
|
1230
|
-
* - `"ignore"
|
|
1242
|
+
* - `"ignore"`: the event was navigation, a modifier chord, or the button's
|
|
1231
1243
|
* own activation keys. Leave the palette alone.
|
|
1232
1244
|
*
|
|
1233
1245
|
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown
|
|
@@ -1264,7 +1276,7 @@ type SearchAction = {
|
|
|
1264
1276
|
};
|
|
1265
1277
|
/**
|
|
1266
1278
|
* The properties {@link searchActionFromKeyDown} reads. Satisfied by a native
|
|
1267
|
-
* `KeyboardEvent
|
|
1279
|
+
* `KeyboardEvent`. Pass `event.nativeEvent` from a React handler, since
|
|
1268
1280
|
* React's synthetic keyboard event does not carry `isComposing`.
|
|
1269
1281
|
*/
|
|
1270
1282
|
type SearchKeyDownEvent = {
|
|
@@ -1278,7 +1290,7 @@ type SearchKeyDownEvent = {
|
|
|
1278
1290
|
* Why a deprecated property: `229` is the only reliable marker for the
|
|
1279
1291
|
* keydown that *starts* an IME composition, where `isComposing` is still
|
|
1280
1292
|
* `false` and `key` varies by engine. There is no non-deprecated
|
|
1281
|
-
* replacement
|
|
1293
|
+
* replacement; cmdk reads it for the same reason.
|
|
1282
1294
|
*/
|
|
1283
1295
|
keyCode?: number;
|
|
1284
1296
|
metaKey: boolean;
|
|
@@ -1301,7 +1313,7 @@ type SearchPasteEvent = {
|
|
|
1301
1313
|
* element that started it and cannot be forwarded, so seeding is impossible;
|
|
1302
1314
|
* opening empty at least lands the user in a real text field instead of
|
|
1303
1315
|
* swallowing the keystroke. This is the case the blog's original trigger got
|
|
1304
|
-
* wrong
|
|
1316
|
+
* wrong: it silently did nothing for CJK input. Engines that route dead keys
|
|
1305
1317
|
* through the IME path report them the same way (Chrome on macOS sends
|
|
1306
1318
|
* `key: "Dead"` with `keyCode: 229` for `⌥e`), so those open empty too rather
|
|
1307
1319
|
* than falling through to the named-key case below.
|
|
@@ -1309,16 +1321,16 @@ type SearchPasteEvent = {
|
|
|
1309
1321
|
* text: the palette's own `⌘K`, `⌘V` (the paste path handles it), and the
|
|
1310
1322
|
* browser/OS accelerators. `Alt` is excluded even though macOS `⌥` produces
|
|
1311
1323
|
* real characters, because seeding one means calling `preventDefault()` on
|
|
1312
|
-
* Windows `Alt` accelerators (`Alt+D`, `Alt+Home`)
|
|
1324
|
+
* Windows `Alt` accelerators (`Alt+D`, `Alt+Home`), the worse trade.
|
|
1313
1325
|
* `Shift` is not a modifier here; it is already reflected in `key`.
|
|
1314
1326
|
* - **`Enter` / `Space` → `"ignore"`.** The button's own activation keys.
|
|
1315
1327
|
* - **A single grapheme → `"seed"`.** Counted as the characters a user sees,
|
|
1316
1328
|
* not as `.length` or code points, so an astral character (emoji, less
|
|
1317
1329
|
* common CJK), a skin-tone emoji, or a decomposed accent counts as one and
|
|
1318
1330
|
* is not dropped. Every named key (`"Tab"`,
|
|
1319
|
-
* `"ArrowDown"`, `"Dead"`, `"Unidentified"`) is longer and falls through
|
|
1320
|
-
*
|
|
1321
|
-
*
|
|
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).
|
|
1322
1334
|
*
|
|
1323
1335
|
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown
|
|
1324
1336
|
*
|
|
@@ -1343,9 +1355,9 @@ type SearchPasteEvent = {
|
|
|
1343
1355
|
declare function searchActionFromKeyDown(event: SearchKeyDownEvent): SearchAction;
|
|
1344
1356
|
/**
|
|
1345
1357
|
* Classifies a `paste` on a search trigger. A paste is unambiguous search
|
|
1346
|
-
* intent
|
|
1347
|
-
* always opens the palette, and seeds it whenever the clipboard holds text.
|
|
1348
|
-
*
|
|
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"`.
|
|
1349
1361
|
*
|
|
1350
1362
|
* The text is collapsed to a single space-separated line because the palette's
|
|
1351
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"./slot-DdYN1L1C.js";import{n as a}from"./separator-DfzxVutO.js";import{t as o}from"./dialog-7TUgiSzX.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(o.Trigger,{asChild:!0,children:/* @__PURE__ */ v(i,{...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,i,a,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4],c=n[5],l=n[6]):({children:r,defaultOpen:c,keyboardShortcut:l,onOpenChange:i,open:a,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s,n[5]=c,n[6]=l);let u=c!==void 0&&c,f=l===void 0||l,p=a!=null,[m,_]=g(u),y=p?a:m,[b,x]=g(``),S=h(i),w;n[7]===i?w=n[8]:(w=()=>{S.current=i},n[7]=i,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(o.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:o.Trigger,DialogContent:e=>{let t=d(21),{children:r,className:i,description:a,filter:s,shouldFilter:c,showCloseButton:l,title:u}=e,f=a===void 0?`Search for a command to run...`:a,p=l===void 0||l,m=u===void 0?`Command Palette`:u,g=h(null),_;t[0]===i?_=t[1]:(_=n(`overflow-hidden p-0 relative`,i),t[0]=i,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(o.Title,{children:m}),t[3]=m,t[4]=x);let S;t[5]===f?S=t[6]:(S=/* @__PURE__ */ v(o.Description,{children:f}),t[5]=f,t[6]=S);let C;t[7]!==x||t[8]!==S?(C=/* @__PURE__ */ y(o.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(o.CloseIconButton,{})}),t[14]=p,t[15]=T);let E;return t[16]!==T||t[17]!==_||t[18]!==C||t[19]!==w?(E=/* @__PURE__ */ y(o.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(`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"}` ``.
|
package/dist/cx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./clsx-DUGZgXfJ.js";import{t}from"./cx-CK7o_rVv.js";export{e as clsx,t as cx};
|
|
@@ -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;
|