@raycast/api 1.27.1 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/arm64/ray +0 -0
- package/bin/x86/ray +0 -0
- package/package.json +2 -2
- package/types/api/app/app.d.ts +171 -0
- package/types/api/app/clipboard.d.ts +47 -0
- package/types/api/app/index.d.ts +4 -0
- package/types/api/app/keyboard.d.ts +56 -0
- package/types/api/app/localStorage.d.ts +117 -0
- package/types/api/components/ActionPanel.d.ts +297 -0
- package/types/api/components/Detail.d.ts +40 -0
- package/types/api/components/Form.d.ts +992 -0
- package/types/api/components/List.d.ts +275 -0
- package/types/api/components/actions/Action.d.ts +396 -0
- package/types/api/components/actions/CopyToClipboardAction.d.ts +39 -0
- package/types/api/components/actions/OpenAction.d.ts +47 -0
- package/types/api/components/actions/OpenInBrowserAction.d.ts +42 -0
- package/types/api/components/actions/OpenWithAction.d.ts +40 -0
- package/types/api/components/actions/PasteAction.d.ts +39 -0
- package/types/api/components/actions/PushAction.d.ts +38 -0
- package/types/api/components/actions/ShowInFinderAction.d.ts +42 -0
- package/types/api/components/actions/SubmitFormAction.d.ts +34 -0
- package/types/api/components/actions/TrashAction.d.ts +43 -0
- package/types/api/components/actions/index.d.ts +1 -0
- package/types/api/components/index.d.ts +5 -0
- package/types/api/components/propTypes.d.ts +1 -0
- package/types/api/components/types.d.ts +30 -0
- package/types/api/deprecated.d.ts +410 -0
- package/types/api/environment/environment.d.ts +48 -0
- package/types/api/environment/index.d.ts +3 -0
- package/types/api/environment/preferences.d.ts +31 -0
- package/types/api/environment/workspace.d.ts +62 -0
- package/types/api/hooks/index.d.ts +1 -0
- package/types/api/hooks/useNavigation.d.ts +66 -0
- package/types/api/index.d.ts +6 -0
- package/types/api/internal/comm/index.d.ts +1 -0
- package/types/api/internal/components/ErrorBoundary.d.ts +1 -0
- package/types/api/internal/components/Navigation.d.ts +1 -0
- package/types/api/internal/components/Root.d.ts +1 -0
- package/types/api/internal/components/index.d.ts +4 -0
- package/types/api/internal/components/portal/components/portal/Portal.d.ts +4 -0
- package/types/api/internal/components/portal/components/portal/index.d.ts +1 -0
- package/types/api/internal/components/portal/components/portalHost/PortalHost.d.ts +4 -0
- package/types/api/internal/components/portal/components/portalHost/index.d.ts +1 -0
- package/types/api/internal/components/portal/components/portalProvider/PortalProvider.d.ts +4 -0
- package/types/api/internal/components/portal/components/portalProvider/index.d.ts +1 -0
- package/types/api/internal/components/portal/contexts/index.d.ts +1 -0
- package/types/api/internal/components/portal/contexts/portal.d.ts +5 -0
- package/types/api/internal/components/portal/hooks/index.d.ts +2 -0
- package/types/api/internal/components/portal/hooks/usePortal.d.ts +8 -0
- package/types/api/internal/components/portal/hooks/usePortalState.d.ts +1 -0
- package/types/api/internal/components/portal/index.d.ts +5 -0
- package/types/api/internal/components/portal/state/constants.d.ts +9 -0
- package/types/api/internal/components/portal/state/index.d.ts +3 -0
- package/types/api/internal/components/portal/state/reducer.d.ts +3 -0
- package/types/api/internal/components/portal/utilities/logger.d.ts +9 -0
- package/types/api/internal/devtools/index.d.ts +1 -0
- package/types/api/internal/devtools/react.d.ts +1 -0
- package/types/api/internal/hooks/index.d.ts +2 -0
- package/types/api/internal/hooks/useActionPanel.d.ts +1 -0
- package/types/api/internal/hooks/useId.d.ts +1 -0
- package/types/api/internal/index.d.ts +6 -0
- package/types/api/internal/rendering/callbacks.d.ts +1 -0
- package/types/api/internal/rendering/index.d.ts +5 -0
- package/types/api/internal/rendering/node-builders/actions.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/detail.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/forms.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/keyboard.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/list.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/navigationStack.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/root.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/types.d.ts +1 -0
- package/types/api/internal/rendering/node-builders/utils.d.ts +1 -0
- package/types/api/internal/rendering/reconciler.d.ts +1 -0
- package/types/api/internal/rendering/renderer.d.ts +1 -0
- package/types/api/internal/utils/ids.d.ts +1 -0
- package/types/api/internal/utils/index.d.ts +1 -0
- package/types/api/ui/color.d.ts +115 -0
- package/types/api/ui/errors.d.ts +1 -0
- package/types/api/ui/feedback/alert.d.ts +97 -0
- package/types/api/ui/feedback/hud.d.ts +16 -0
- package/types/api/ui/feedback/index.d.ts +3 -0
- package/types/api/ui/feedback/toast.d.ts +171 -0
- package/types/api/ui/icon.d.ts +88 -0
- package/types/api/ui/image.d.ts +161 -0
- package/types/api/ui/index.d.ts +5 -0
- package/types/core/message-types.d.ts +17 -0
- package/types/core/preferences.d.ts +69 -0
- package/types/index.d.ts +2777 -2536
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Image } from "../ui";
|
|
3
|
+
import { ActionsInterface, NavigationChildInterface } from "./types";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
/**
|
|
6
|
+
* Displays {@link List.Section} or {@link List.Item}.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The list uses built-in filtering by indexing the title of list items and additionally keywords.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { List } from "@raycast/api";
|
|
14
|
+
*
|
|
15
|
+
* export default function Command() {
|
|
16
|
+
* return (
|
|
17
|
+
* <List navigationTitle="Search Beers" searchBarPlaceholder="Search your favorite beer">
|
|
18
|
+
* <List.Item title="Augustiner Helles" />
|
|
19
|
+
* <List.Item title="Camden Hells" />
|
|
20
|
+
* <List.Item title="Leffe Blonde" />
|
|
21
|
+
* <List.Item title="Sierra Nevada IPA" />
|
|
22
|
+
* </List>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function List(props: List.Props): ReactElement<List.Props>;
|
|
28
|
+
export declare namespace List {
|
|
29
|
+
var propTypes: {
|
|
30
|
+
selectedItemId: PropTypes.Requireable<string>;
|
|
31
|
+
searchBarPlaceholder: PropTypes.Requireable<string>;
|
|
32
|
+
throttle: PropTypes.Requireable<boolean>;
|
|
33
|
+
onSearchTextChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
+
onSelectionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
+
};
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* See {@link List.Section}
|
|
40
|
+
*/
|
|
41
|
+
declare function ListSection(props: List.Section.Props): ReactElement<List.Section.Props>;
|
|
42
|
+
declare namespace ListSection {
|
|
43
|
+
var propTypes: {
|
|
44
|
+
id: PropTypes.Requireable<string>;
|
|
45
|
+
title: PropTypes.Requireable<string>;
|
|
46
|
+
subtitle: PropTypes.Requireable<string>;
|
|
47
|
+
};
|
|
48
|
+
var displayName: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* See {@link List.Item}
|
|
52
|
+
*/
|
|
53
|
+
declare function ListItem(props: List.Item.Props): ReactElement<List.Item.Props>;
|
|
54
|
+
declare namespace ListItem {
|
|
55
|
+
var propTypes: {
|
|
56
|
+
id: PropTypes.Requireable<string>;
|
|
57
|
+
title: PropTypes.Validator<string>;
|
|
58
|
+
subtitle: PropTypes.Requireable<string>;
|
|
59
|
+
accessoryTitle: PropTypes.Requireable<string>;
|
|
60
|
+
keywords: PropTypes.Requireable<string[]>;
|
|
61
|
+
icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
|
|
62
|
+
fileIcon: PropTypes.Validator<string>;
|
|
63
|
+
}>> | PropTypes.InferProps<{
|
|
64
|
+
source: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
65
|
+
light: PropTypes.Validator<string>;
|
|
66
|
+
dark: PropTypes.Validator<string>;
|
|
67
|
+
}>>;
|
|
68
|
+
fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
69
|
+
/**
|
|
70
|
+
* Displays {@link List.Section} or {@link List.Item}.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The list uses built-in filtering by indexing the title of list items and additionally keywords.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import { List } from "@raycast/api";
|
|
78
|
+
*
|
|
79
|
+
* export default function Command() {
|
|
80
|
+
* return (
|
|
81
|
+
* <List navigationTitle="Search Beers" searchBarPlaceholder="Search your favorite beer">
|
|
82
|
+
* <List.Item title="Augustiner Helles" />
|
|
83
|
+
* <List.Item title="Camden Hells" />
|
|
84
|
+
* <List.Item title="Leffe Blonde" />
|
|
85
|
+
* <List.Item title="Sierra Nevada IPA" />
|
|
86
|
+
* </List>
|
|
87
|
+
* );
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
light: PropTypes.Validator<string>;
|
|
92
|
+
dark: PropTypes.Validator<string>;
|
|
93
|
+
}>>;
|
|
94
|
+
/**
|
|
95
|
+
* Displays {@link List.Section} or {@link List.Item}.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* The list uses built-in filtering by indexing the title of list items and additionally keywords.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import { List } from "@raycast/api";
|
|
103
|
+
*
|
|
104
|
+
* export default function Command() {
|
|
105
|
+
* return (
|
|
106
|
+
* <List navigationTitle="Search Beers" searchBarPlaceholder="Search your favorite beer">
|
|
107
|
+
* <List.Item title="Augustiner Helles" />
|
|
108
|
+
* <List.Item title="Camden Hells" />
|
|
109
|
+
* <List.Item title="Leffe Blonde" />
|
|
110
|
+
* <List.Item title="Sierra Nevada IPA" />
|
|
111
|
+
* </List>
|
|
112
|
+
* );
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
mask: PropTypes.Requireable<Image.Mask>;
|
|
117
|
+
tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
118
|
+
light: PropTypes.Validator<string>;
|
|
119
|
+
dark: PropTypes.Validator<string>;
|
|
120
|
+
adjustContrast: PropTypes.Requireable<boolean>;
|
|
121
|
+
}>>;
|
|
122
|
+
}>>;
|
|
123
|
+
};
|
|
124
|
+
var displayName: string;
|
|
125
|
+
}
|
|
126
|
+
export declare namespace List {
|
|
127
|
+
/**
|
|
128
|
+
* A item in the {@link List}.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* This is one of the foundational UI components of Raycast. A list item represents a single entity. It can be a
|
|
132
|
+
* GitHub pull request, a file, or anything else. You most likely want to perform actions on this item, so make it clear
|
|
133
|
+
* to the user what this list item is about.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* import { Icon, List } from "@raycast/api";
|
|
138
|
+
*
|
|
139
|
+
* export default function Command() {
|
|
140
|
+
* return (
|
|
141
|
+
* <List>
|
|
142
|
+
* <List.Item icon={Icon.Star} title="Augustiner Helles" subtitle="0,5 Liter" accessoryTitle="Germany" />
|
|
143
|
+
* </List>
|
|
144
|
+
* );
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
const Item: typeof ListItem;
|
|
149
|
+
/**
|
|
150
|
+
* A group of related {@link List.Item}.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* Sections are a great way to structure your list. For example, group GitHub issues with the same status and order them by priority.
|
|
154
|
+
* This way, users can quickly access what is most relevant.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* import { List } from "@raycast/api";
|
|
159
|
+
*
|
|
160
|
+
* export default function Command() {
|
|
161
|
+
* return (
|
|
162
|
+
* <List>
|
|
163
|
+
* <List.Section title="Lager">
|
|
164
|
+
* <List.Item title="Camden Hells" />
|
|
165
|
+
* </List.Section>
|
|
166
|
+
* <List.Section title="IPA">
|
|
167
|
+
* <List.Item title="Sierra Nevada IPA" />
|
|
168
|
+
* </List.Section>
|
|
169
|
+
* </List>
|
|
170
|
+
* );
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
const Section: typeof ListSection;
|
|
175
|
+
/**
|
|
176
|
+
* Props of the {@link List} React component.
|
|
177
|
+
*/
|
|
178
|
+
interface Props extends ActionsInterface, NavigationChildInterface {
|
|
179
|
+
/**
|
|
180
|
+
* List sections or items. If {@link List.Item} elements are specified, a default section is automatically created.
|
|
181
|
+
*/
|
|
182
|
+
children?: ReactNode;
|
|
183
|
+
/**
|
|
184
|
+
* Callback triggered when the item selection in the list changes.
|
|
185
|
+
*/
|
|
186
|
+
onSelectionChange?: (id?: string) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Placeholder text that will be shown in the search bar.
|
|
189
|
+
*
|
|
190
|
+
* @defaultValue Search value...
|
|
191
|
+
*/
|
|
192
|
+
searchBarPlaceholder?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Selects the item with the specified id.
|
|
195
|
+
*/
|
|
196
|
+
selectedItemId?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Defines whether the {@link ListProps.onSearchTextChange} will be triggered on every keyboard press or with a delay for throttling the events.
|
|
199
|
+
* Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests).
|
|
200
|
+
* @defaultValue false
|
|
201
|
+
*/
|
|
202
|
+
throttle?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Callback triggered when the search bar text changes.
|
|
205
|
+
* Note that built-in list filtering will be disabled when this callback is set.
|
|
206
|
+
*/
|
|
207
|
+
onSearchTextChange?: (text: string) => void;
|
|
208
|
+
}
|
|
209
|
+
namespace Item {
|
|
210
|
+
/**
|
|
211
|
+
* Props of the {@link List.Item} React component.
|
|
212
|
+
*/
|
|
213
|
+
interface Props extends ActionsInterface {
|
|
214
|
+
/**
|
|
215
|
+
* ID of the item.
|
|
216
|
+
* Make sure to assign each item a unique ID or a UUID will be auto generated.
|
|
217
|
+
*/
|
|
218
|
+
id?: string;
|
|
219
|
+
/**
|
|
220
|
+
* The main title displayed for that item.
|
|
221
|
+
*/
|
|
222
|
+
title: string;
|
|
223
|
+
/**
|
|
224
|
+
* An optional subtitle displayed next to the main title.
|
|
225
|
+
*/
|
|
226
|
+
subtitle?: string;
|
|
227
|
+
/**
|
|
228
|
+
* An additional title displayed for the item.
|
|
229
|
+
*/
|
|
230
|
+
accessoryTitle?: string;
|
|
231
|
+
/**
|
|
232
|
+
* An optional property used for providing additional indexable strings for search.
|
|
233
|
+
* When filtering the list in Raycast through the search bar, the keywords will be searched in addition to the title.
|
|
234
|
+
*/
|
|
235
|
+
keywords?: string[];
|
|
236
|
+
/**
|
|
237
|
+
* A optional icon displayed for the list item.
|
|
238
|
+
*/
|
|
239
|
+
icon?: Image.ImageLike;
|
|
240
|
+
/**
|
|
241
|
+
* A optional icon displayed as accessory for the list item.
|
|
242
|
+
*/
|
|
243
|
+
accessoryIcon?: Image.ImageLike;
|
|
244
|
+
/**
|
|
245
|
+
* An {@link ActionPanel} that will be updated for the selected list item.
|
|
246
|
+
*/
|
|
247
|
+
actions?: ReactNode | null;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
namespace Section {
|
|
251
|
+
/**
|
|
252
|
+
* Props of the {@link List.Section} React component.
|
|
253
|
+
*/
|
|
254
|
+
interface Props {
|
|
255
|
+
/**
|
|
256
|
+
* The {@link List.Item} elements of the section.
|
|
257
|
+
*/
|
|
258
|
+
children?: ReactNode;
|
|
259
|
+
/**
|
|
260
|
+
* ID of the section.
|
|
261
|
+
* Make sure to assign each section a unique ID or a UUID will be auto generated.
|
|
262
|
+
*/
|
|
263
|
+
id?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Title displayed above the section.
|
|
266
|
+
*/
|
|
267
|
+
title?: string;
|
|
268
|
+
/**
|
|
269
|
+
* An optional subtitle displayed next to the title of the section.
|
|
270
|
+
*/
|
|
271
|
+
subtitle?: string;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
export {};
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { Keyboard } from "../../app";
|
|
4
|
+
import { Image } from "../../ui";
|
|
5
|
+
import { CopyToClipboardAction, CopyToClipboardActionProps } from "./CopyToClipboardAction";
|
|
6
|
+
import { OpenAction, OpenActionProps } from "./OpenAction";
|
|
7
|
+
import { OpenInBrowserAction, OpenInBrowserActionProps } from "./OpenInBrowserAction";
|
|
8
|
+
import { OpenWithAction, OpenWithActionProps } from "./OpenWithAction";
|
|
9
|
+
import { PasteAction, PasteActionProps } from "./PasteAction";
|
|
10
|
+
import { PushAction, PushActionProps } from "./PushAction";
|
|
11
|
+
import { ShowInFinderAction, ShowInFinderActionProps } from "./ShowInFinderAction";
|
|
12
|
+
import { SubmitFormAction, SubmitFormActionProps } from "./SubmitFormAction";
|
|
13
|
+
import { TrashAction, TrashActionProps } from "./TrashAction";
|
|
14
|
+
/**
|
|
15
|
+
* A context-specific action that can be performed by the user.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Assign keyboard shortcuts to items to make it easier for users to perform frequently used actions.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { ActionPanel, Action, List } from "@raycast/api";
|
|
23
|
+
*
|
|
24
|
+
* export default function Command() {
|
|
25
|
+
* return (
|
|
26
|
+
* <List navigationTitle="Open Pull Requests">
|
|
27
|
+
* <List.Item
|
|
28
|
+
* title="Docs: Update API Reference"
|
|
29
|
+
* subtitle="#1"
|
|
30
|
+
* actions={
|
|
31
|
+
* <ActionPanel title="#1 in raycast/extensions">
|
|
32
|
+
* <Action.OpenInBrowser url="https://github.com/raycast/extensions/pull/1" />
|
|
33
|
+
* <Action.CopyToClipboard title="Copy Pull Request Number" content="#1" />
|
|
34
|
+
* <Action title="Close Pull Request" onAction={() => console.log("Close PR #1")} />
|
|
35
|
+
* </ActionPanel>
|
|
36
|
+
* }
|
|
37
|
+
* />
|
|
38
|
+
* </List>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function Action(props: Action.Props): ReactElement<Action.Props>;
|
|
44
|
+
export declare namespace Action {
|
|
45
|
+
var propTypes: {
|
|
46
|
+
id: PropTypes.Requireable<string>;
|
|
47
|
+
title: PropTypes.Validator<string>;
|
|
48
|
+
icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
|
|
49
|
+
fileIcon: PropTypes.Validator<string>;
|
|
50
|
+
}>> | PropTypes.InferProps<{
|
|
51
|
+
source: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
52
|
+
light: PropTypes.Validator<string>;
|
|
53
|
+
dark: PropTypes.Validator<string>;
|
|
54
|
+
}>>;
|
|
55
|
+
fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
56
|
+
light: PropTypes.Validator<string>;
|
|
57
|
+
dark: PropTypes.Validator<string>;
|
|
58
|
+
}>>;
|
|
59
|
+
mask: PropTypes.Requireable<Image.Mask>;
|
|
60
|
+
tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
61
|
+
light: PropTypes.Validator<string>;
|
|
62
|
+
dark: PropTypes.Validator<string>;
|
|
63
|
+
adjustContrast: PropTypes.Requireable<boolean>;
|
|
64
|
+
}>>;
|
|
65
|
+
}>>;
|
|
66
|
+
shortcut: PropTypes.Requireable<Required<PropTypes.InferProps<{
|
|
67
|
+
modifiers: PropTypes.Validator<string[]>;
|
|
68
|
+
key: PropTypes.Validator<string>;
|
|
69
|
+
}>>>;
|
|
70
|
+
onAction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
|
+
};
|
|
72
|
+
var displayName: string;
|
|
73
|
+
}
|
|
74
|
+
export declare namespace Action {
|
|
75
|
+
/**
|
|
76
|
+
* Action that copies the content to the clipboard.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* The main window is closed, and a HUD is shown after the content was copied to the clipboard.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* import { ActionPanel, Action, Detail } from "@raycast/api";
|
|
84
|
+
*
|
|
85
|
+
* export default function Command() {
|
|
86
|
+
* return (
|
|
87
|
+
* <Detail
|
|
88
|
+
* markdown="Press `⌘ + .` and share some love."
|
|
89
|
+
* actions={
|
|
90
|
+
* <ActionPanel>
|
|
91
|
+
* <Action.CopyToClipboard content="I ❤️ Raycast" shortcut={{ modifiers: ["cmd"], key: "." }} />
|
|
92
|
+
* </ActionPanel>
|
|
93
|
+
* }
|
|
94
|
+
* />
|
|
95
|
+
* );
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
const CopyToClipboard: typeof CopyToClipboardAction;
|
|
100
|
+
/**
|
|
101
|
+
* An action to open a file or folder with a specific application, just as if you had double-clicked the
|
|
102
|
+
* file's icon.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* The main window is closed after the file is opened.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
110
|
+
*
|
|
111
|
+
* export default function Command() {
|
|
112
|
+
* return (
|
|
113
|
+
* <Detail
|
|
114
|
+
* markdown="Check out your extension code."
|
|
115
|
+
* actions={
|
|
116
|
+
* <ActionPanel>
|
|
117
|
+
* <Action.Open title="Open Folder" target={__dirname} />
|
|
118
|
+
* </ActionPanel>
|
|
119
|
+
* }
|
|
120
|
+
* />
|
|
121
|
+
* );
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
const Open: typeof OpenAction;
|
|
126
|
+
/**
|
|
127
|
+
* Action that opens a URL in the default browser.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* The main window is closed after the URL is opened in the browser.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
135
|
+
*
|
|
136
|
+
* export default function Command() {
|
|
137
|
+
* return (
|
|
138
|
+
* <Detail
|
|
139
|
+
* markdown="Join the gang!"
|
|
140
|
+
* actions={
|
|
141
|
+
* <ActionPanel>
|
|
142
|
+
* <Action.OpenInBrowser url="https://raycast.com/jobs" />
|
|
143
|
+
* </ActionPanel>
|
|
144
|
+
* }
|
|
145
|
+
* />
|
|
146
|
+
* );
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
const OpenInBrowser: typeof OpenInBrowserAction;
|
|
151
|
+
/**
|
|
152
|
+
* Action that opens a file or folder with a specific application.
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* The action opens a sub-menu with all applications that can open the file or folder.
|
|
156
|
+
* The main window is closed after the file is opened in the specified application.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
161
|
+
* import { homedir } from "os";
|
|
162
|
+
*
|
|
163
|
+
* const DESKTOP_DIR = `${homedir()}/Desktop`;
|
|
164
|
+
*
|
|
165
|
+
* export default function Command() {
|
|
166
|
+
* return (
|
|
167
|
+
* <Detail
|
|
168
|
+
* markdown="What do you want to use to open your desktop with?"
|
|
169
|
+
* actions={
|
|
170
|
+
* <ActionPanel>
|
|
171
|
+
* <Action.OpenWith path={DESKTOP_DIR} />
|
|
172
|
+
* </ActionPanel>
|
|
173
|
+
* }
|
|
174
|
+
* />
|
|
175
|
+
* );
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
const OpenWith: typeof OpenWithAction;
|
|
180
|
+
/**
|
|
181
|
+
* Action that pastes the content to the front-most applications.
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
* The main window is closed after the content is pasted to the front-most application.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
189
|
+
*
|
|
190
|
+
* export default function Command() {
|
|
191
|
+
* return (
|
|
192
|
+
* <Detail
|
|
193
|
+
* markdown="Let us know what you think about the Raycast API?"
|
|
194
|
+
* actions={
|
|
195
|
+
* <ActionPanel>
|
|
196
|
+
* <Action.Paste content="api@raycast.com" />
|
|
197
|
+
* </ActionPanel>
|
|
198
|
+
* }
|
|
199
|
+
* />
|
|
200
|
+
* );
|
|
201
|
+
* }
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
const Paste: typeof PasteAction;
|
|
205
|
+
/**
|
|
206
|
+
* Action that pushes a new view to the navigation stack.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
211
|
+
*
|
|
212
|
+
* function Ping() {
|
|
213
|
+
* return (
|
|
214
|
+
* <Detail
|
|
215
|
+
* markdown="Ping"
|
|
216
|
+
* actions={
|
|
217
|
+
* <ActionPanel>
|
|
218
|
+
* <Action.Push title="Push Pong" target={<Pong />} />
|
|
219
|
+
* </ActionPanel>
|
|
220
|
+
* }
|
|
221
|
+
* />
|
|
222
|
+
* );
|
|
223
|
+
* }
|
|
224
|
+
*
|
|
225
|
+
* function Pong() {
|
|
226
|
+
* return <Detail markdown="Pong" />;
|
|
227
|
+
* }
|
|
228
|
+
*
|
|
229
|
+
* export default function Command() {
|
|
230
|
+
* return <Ping />;
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
const Push: typeof PushAction;
|
|
235
|
+
/**
|
|
236
|
+
* Action that shows a file or folder in the Finder.
|
|
237
|
+
*
|
|
238
|
+
* @remarks
|
|
239
|
+
* The main window is closed after the file or folder is revealed in the Finder.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```typescript
|
|
243
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
244
|
+
* import { homedir } from "os";
|
|
245
|
+
*
|
|
246
|
+
* const DOWNLOADS_DIR = `${homedir()}/Downloads`;
|
|
247
|
+
*
|
|
248
|
+
* export default function Command() {
|
|
249
|
+
* return (
|
|
250
|
+
* <Detail
|
|
251
|
+
* markdown="Are your downloads pilling up again?"
|
|
252
|
+
* actions={
|
|
253
|
+
* <ActionPanel>
|
|
254
|
+
* <Action.ShowInFinder path={DOWNLOADS_DIR} />
|
|
255
|
+
* </ActionPanel>
|
|
256
|
+
* }
|
|
257
|
+
* />
|
|
258
|
+
* );
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
const ShowInFinder: typeof ShowInFinderAction;
|
|
263
|
+
/**
|
|
264
|
+
* Action that adds a submit handler for capturing form values.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
269
|
+
* import { useState } from "react";
|
|
270
|
+
*
|
|
271
|
+
* export default function Command() {
|
|
272
|
+
* const [name, setName] = useState<string>();
|
|
273
|
+
*
|
|
274
|
+
* return (
|
|
275
|
+
* <Form
|
|
276
|
+
* actions={
|
|
277
|
+
* <ActionPanel>
|
|
278
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
279
|
+
* </ActionPanel>
|
|
280
|
+
* }
|
|
281
|
+
* >
|
|
282
|
+
* <Form.TextField id="name" value={name} onChange={setName} />
|
|
283
|
+
* </Form>
|
|
284
|
+
* );
|
|
285
|
+
* }
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
const SubmitForm: typeof SubmitFormAction;
|
|
289
|
+
/**
|
|
290
|
+
* Action that moves a file or folder to the Trash.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
295
|
+
* import { homedir } from "os";
|
|
296
|
+
*
|
|
297
|
+
* const FILE = `${homedir()}/Downloads/get-rid-of-me.txt`;
|
|
298
|
+
*
|
|
299
|
+
* export default function Command() {
|
|
300
|
+
* return (
|
|
301
|
+
* <Detail
|
|
302
|
+
* markdown="Some spring cleaning?"
|
|
303
|
+
* actions={
|
|
304
|
+
* <ActionPanel>
|
|
305
|
+
* <Action.Trash paths={FILE} />
|
|
306
|
+
* </ActionPanel>
|
|
307
|
+
* }
|
|
308
|
+
* />
|
|
309
|
+
* );
|
|
310
|
+
* }
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
const Trash: typeof TrashAction;
|
|
314
|
+
/**
|
|
315
|
+
* Props of the {@link Action} React component.
|
|
316
|
+
*/
|
|
317
|
+
interface Props {
|
|
318
|
+
/**
|
|
319
|
+
* ID of the item.
|
|
320
|
+
*
|
|
321
|
+
* @remarks
|
|
322
|
+
* Make sure to assign each section or item a unique ID. If no ID is specified, a memoized auto-generated is used.
|
|
323
|
+
*/
|
|
324
|
+
id?: string;
|
|
325
|
+
/**
|
|
326
|
+
* The title displayed for the item.
|
|
327
|
+
*/
|
|
328
|
+
title: string;
|
|
329
|
+
/**
|
|
330
|
+
* The icon displayed for the action.
|
|
331
|
+
*/
|
|
332
|
+
icon?: Image.ImageLike;
|
|
333
|
+
/**
|
|
334
|
+
* The keyboard shortcut for the item.
|
|
335
|
+
*/
|
|
336
|
+
shortcut?: Keyboard.Shortcut;
|
|
337
|
+
/**
|
|
338
|
+
* Callback that is triggered when the item is selected.
|
|
339
|
+
*/
|
|
340
|
+
onAction?: () => void;
|
|
341
|
+
}
|
|
342
|
+
namespace CopyToClipboard {
|
|
343
|
+
/**
|
|
344
|
+
* Props of the {@link Action.CopyToClipboard} React component.
|
|
345
|
+
*/
|
|
346
|
+
type Props = CopyToClipboardActionProps;
|
|
347
|
+
}
|
|
348
|
+
namespace Open {
|
|
349
|
+
/**
|
|
350
|
+
* Props of the {@link Action.Open} React component.
|
|
351
|
+
*/
|
|
352
|
+
type Props = OpenActionProps;
|
|
353
|
+
}
|
|
354
|
+
namespace OpenInBrowser {
|
|
355
|
+
/**
|
|
356
|
+
* Props of the {@link Action.OpenInBrowser} React component.
|
|
357
|
+
*/
|
|
358
|
+
type Props = OpenInBrowserActionProps;
|
|
359
|
+
}
|
|
360
|
+
namespace OpenWith {
|
|
361
|
+
/**
|
|
362
|
+
* Props of the {@link Action.OpenWith} React component.
|
|
363
|
+
*/
|
|
364
|
+
type Props = OpenWithActionProps;
|
|
365
|
+
}
|
|
366
|
+
namespace Paste {
|
|
367
|
+
/**
|
|
368
|
+
* Props of the {@link Action.Paste} React component.
|
|
369
|
+
*/
|
|
370
|
+
type Props = PasteActionProps;
|
|
371
|
+
}
|
|
372
|
+
namespace Push {
|
|
373
|
+
/**
|
|
374
|
+
* Props of the {@link Action.Push} React component.
|
|
375
|
+
*/
|
|
376
|
+
type Props = PushActionProps;
|
|
377
|
+
}
|
|
378
|
+
namespace ShowInFinder {
|
|
379
|
+
/**
|
|
380
|
+
* Props of the {@link Action.ShowInFinder} React component.
|
|
381
|
+
*/
|
|
382
|
+
type Props = ShowInFinderActionProps;
|
|
383
|
+
}
|
|
384
|
+
namespace SubmitForm {
|
|
385
|
+
/**
|
|
386
|
+
* Props of the {@link Action.SubmitForm} React component.
|
|
387
|
+
*/
|
|
388
|
+
type Props<T> = SubmitFormActionProps<T>;
|
|
389
|
+
}
|
|
390
|
+
namespace Trash {
|
|
391
|
+
/**
|
|
392
|
+
* Props of the {@link Action.Trash} React component.
|
|
393
|
+
*/
|
|
394
|
+
type Props = TrashActionProps;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { Keyboard } from "../../app";
|
|
3
|
+
import { Image } from "../../ui";
|
|
4
|
+
/**
|
|
5
|
+
* See {@link Action.CopyToClipboard.Props}
|
|
6
|
+
*/
|
|
7
|
+
export interface CopyToClipboardActionProps {
|
|
8
|
+
/**
|
|
9
|
+
* The contents that will be written to the clipboard as string.
|
|
10
|
+
*/
|
|
11
|
+
content: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* An optional title for the action.
|
|
14
|
+
*/
|
|
15
|
+
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* A optional icon displayed for the item.
|
|
18
|
+
* @defaultValue {@link Icon.Clipboard}
|
|
19
|
+
*/
|
|
20
|
+
icon?: Image.ImageLike;
|
|
21
|
+
/**
|
|
22
|
+
* The keyboard shortcut for the action.
|
|
23
|
+
*/
|
|
24
|
+
shortcut?: Keyboard.Shortcut;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when the content was copied to clipboard.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This is handy when you want to act on the copied content, e.g. up-rank recently copied content.
|
|
30
|
+
*/
|
|
31
|
+
onCopy?: (content: string | number) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* See {@link Action.CopyToClipboard}
|
|
35
|
+
*/
|
|
36
|
+
export declare function CopyToClipboardAction(props: CopyToClipboardActionProps): ReactElement<CopyToClipboardActionProps>;
|
|
37
|
+
export declare namespace CopyToClipboardAction {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
}
|