@raycast/api 1.30.1 → 1.31.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/types/index.d.ts DELETED
@@ -1,4098 +0,0 @@
1
- /// <reference types="node" />
2
- declare module "@raycast/api" {
3
- /// <reference types="node" />
4
-
5
- /**
6
- * Closes the main Raycast window.
7
- *
8
- * @param options - Can be used to clear the root search. Defaults to not clearing the root search after
9
- * the window was closed.
10
- * @returns A Promise that resolves when the main window is closed.
11
- *
12
- * @example
13
- * ```typescript
14
- *
15
- *
16
- *
17
- * export default async () => {
18
- * await setTimeout(1000);
19
- * await closeMainWindow({ clearRootSearch: true });
20
- * };
21
- * ```
22
- */
23
- export function closeMainWindow(options?: {
24
- clearRootSearch?: boolean;
25
- }): Promise<void>;
26
- /**
27
- * Pops the navigation stack back to root search.
28
- *
29
- * @param options - Can be used to clear the search bar. Defaults to clearing the search bar after popped to root.
30
- * @returns A Promise that resolves when Raycast popped to root.
31
- *
32
- * @example
33
- * ```typescript
34
- *
35
- *
36
- *
37
- *
38
- * export default function Command() {
39
- * useEffect(() => {
40
- * setTimeout(() => {
41
- * popToRoot({ clearSearchBar: true });
42
- * }, 3000);
43
- * }, []);
44
- *
45
- * return <Detail markdown="See you soon 👋" />;
46
- * }
47
- * ```
48
- */
49
- export function popToRoot(options?: {
50
- clearSearchBar?: boolean;
51
- }): Promise<void>;
52
- /**
53
- * Clear the text in the search bar.
54
- *
55
- * @param options - Can be used to force scrolling to the top. Defaults to scrolling to the top after the
56
- * the search bar was cleared.
57
- * @returns A Promise that resolves when the search bar is cleared.
58
- */
59
- export function clearSearchBar(options?: {
60
- forceScrollToTop?: boolean;
61
- }): Promise<void>;
62
- /**
63
- * Utils
64
- */
65
- /**
66
- * Shows a file or directory in the Finder.
67
- *
68
- * @param path - The path to show in the Finder.
69
- * @returns A Promise that resolves when the item is revealed in the Finder.
70
- *
71
- * @example
72
- * ```typescript
73
- * import { showInFinder } from "@raycast/api"
74
- * import { homedir } from "os"
75
- * import { join } from "path"
76
- * showInFinder(join(homedir(), "Downloads"))
77
- * ```
78
- */
79
- export function showInFinder(path: PathLike): Promise<void>;
80
- /**
81
- * Moves a file or directory to the Trash.
82
- *
83
- * @param paths - The item or items to move to the trash.
84
- * @returns A Promise that resolves when all files are moved to the trash.
85
- *
86
- * @example
87
- * ```typescript
88
- *
89
- *
90
- *
91
- *
92
- * export default async () => {
93
- * const file = `${homedir()}/Desktop/yolo.txt`;
94
- * await writeFile(file, "I will be deleted soon!");
95
- * await trash(file);
96
- * };
97
- * ```
98
- */
99
- export function trash(path: PathLike | PathLike[]): Promise<void>;
100
- /**
101
- * An object that represents a locally installed application on the system.
102
- *
103
- * @remarks
104
- * It can be used to open files or folders in a specific application. Use {@link getApplications} or
105
- * {@link getDefaultApplication} to get applications that can open a specific file or folder.
106
- */
107
- export interface Application {
108
- /**
109
- * The display name of the application.
110
- */
111
- name: string;
112
- /**
113
- * The absolute path to the application bundle, e.g. `/Applications/Raycast.app`,
114
- */
115
- path: string;
116
- /**
117
- * The bundle identifier of the application, e.g. `com.raycast.macos`.
118
- */
119
- bundleId?: string;
120
- }
121
- /**
122
- * Returns all applications that can open the file.
123
- *
124
- * @param path The path of the file or folder to get the applications for. If no path is specified, all installed applications are returned.
125
- * @returns An array of {@link Application}.
126
- *
127
- * @example
128
- * ```typescript
129
- *
130
- *
131
- * export default async () => {
132
- * const installedApplications = await getApplications();
133
- * console.log("The following applications are installed on your Mac:");
134
- * console.log(installedApplications.map((a) => a.name).join(", "));
135
- * };
136
- * ```
137
- */
138
- export function getApplications(path?: PathLike): Promise<Application[]>;
139
- /**
140
- * Returns the default application that the file would be opened with.
141
- *
142
- * @param path The path of the file or folder to get the default application for.
143
- * @returns The default {@link Application} that would open the file. Throws an error if no application was found.
144
- *
145
- * @example
146
- * ```typescript
147
- *
148
- *
149
- * export default async () => {
150
- * const defaultApplication = await getDefaultApplication(__filename);
151
- * console.log(`Default application for JavaScript is: ${defaultApplication.name}`);
152
- * };
153
- * ```
154
- */
155
- export function getDefaultApplication(path: PathLike): Promise<Application>;
156
- /**
157
- * Opens a target with the default application or specified application.
158
- *
159
- * @param target The file, folder or URL to open.
160
- * @param application The application name to use for opening the file. If no application is specified, the default application as determined by the system
161
- * is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app.
162
- * @returns A Promise that resolves when the target has been opened.
163
- *
164
- * @example
165
- * ```typescript
166
- *
167
- *
168
- * export default async () => {
169
- * await open("https://www.raycast.com", "com.google.Chrome");
170
- * };
171
- * ```
172
- */
173
- export function open(target: string, application?: Application | string): Promise<void>;
174
- /**
175
- * Copies text to the clipboard.
176
- *
177
- * @param text - The text to copy to the clipboard.
178
- * @returns A Promise that resolves when the text is copied to the clipboard.
179
- *
180
- * @example
181
- * ```typescript
182
- *
183
- *
184
- * export default async () => {
185
- * await Clipboard.copy("https://raycast.com");
186
- * };
187
- * ```
188
- */
189
- export function copy(text: string): Promise<void>;
190
- /**
191
- * Clears the current clipboard contents.
192
- *
193
- * @returns A Promise that resolves when the clipboard is cleared.
194
- *
195
- * @example
196
- * ```typescript
197
- *
198
- *
199
- * export default async () => {
200
- * await Clipboard.clear();
201
- * };
202
- * ```
203
- */
204
- export function clear(): Promise<void>;
205
- /**
206
- * Pastes text to the current selection of the frontmost application.
207
- *
208
- * @param text - The text to insert at the cursor.
209
- * @returns A Promise that resolves when the text is pasted.
210
- *
211
- * @example
212
- * ```typescript
213
- *
214
- *
215
- * export default async () => {
216
- * await Clipboard.paste("I really like Raycast's API");
217
- * };
218
- * ```
219
- */
220
- export function paste(text: string): Promise<void>;
221
- /**
222
- * A keyboard shortcut is defined by one or more modifier keys (command, control, etc.) and a single key equivalent (a character or special key).
223
- * See {@link KeyModifier} and {@link KeyEquivalent} for supported values.
224
- *
225
- * @example
226
- * ```typescript
227
- *
228
- *
229
- * export default function Command() {
230
- * return (
231
- * <Detail markdown="Let's play some games 👾" actions={
232
- * <ActionPanel title="Game controls">
233
- * <Action
234
- * title="Up"
235
- * shortcut={{ modifiers: ["opt"], key: "arrowUp" }}
236
- * onAction={() => console.log("Go up")}
237
- * />
238
- * <Action
239
- * title="Down"
240
- * shortcut={{ modifiers: ["opt"], key: "arrowDown" }}
241
- * onAction={() => console.log("Go down")}
242
- * />
243
- * <Action
244
- * title="Left"
245
- * shortcut={{ modifiers: ["opt"], key: "arrowLeft" }}
246
- * onAction={() => console.log("Go left")}
247
- * />
248
- * <Action
249
- * title="Right"
250
- * shortcut={{ modifiers: ["opt"], key: "arrowRight" }}
251
- * onAction={() => console.log("Go right")}
252
- * />
253
- * </ActionPanel>}
254
- * />
255
- * );
256
- * }
257
- * ```
258
- */
259
- export interface Shortcut {
260
- /**
261
- * The modifier keys of the keyboard shortcut.
262
- */
263
- modifiers: KeyModifier[];
264
- /**
265
- * The key of the keyboard shortcut.
266
- */
267
- key: KeyEquivalent;
268
- }
269
- /**
270
- * Modifier of a {@link Shortcut}
271
- */
272
- export type KeyModifier = "cmd" | "ctrl" | "opt" | "shift";
273
- /**
274
- * KeyEquivalent of a {@link Shortcut}
275
- */
276
- export type KeyEquivalent = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "." | "," | ";" | "=" | "+" | "-" | "[" | "]" | "{" | "}" | "«" | "»" | "(" | ")" | "/" | "\\" | "'" | "`" | "§" | "^" | "@" | "$" | "return" | "delete" | "deleteForward" | "tab" | "arrowUp" | "arrowDown" | "arrowLeft" | "arrowRight" | "pageUp" | "pageDown" | "home" | "end" | "space" | "escape" | "enter" | "backspace";
277
- /**
278
- * Retrieve all stored values in the local storage of an extension.
279
- *
280
- * @returns A Promise that resolves with an object containing all {@link Values}.
281
- *
282
- * @example
283
- * ```typescript
284
- *
285
- *
286
- * interface Values {
287
- * todo: string;
288
- * priority: number;
289
- * }
290
- *
291
- * export default async () => {
292
- * const items = await LocalStorage.allItems<Values>();
293
- * console.log(`Local storage item count: ${Object.entries(items).length}`);
294
- * };
295
- * ```
296
- */
297
- export function allItems<T extends Values = Values>(): Promise<T>;
298
- /**
299
- * Retrieve the stored value for the given key.
300
- *
301
- * @param key - The key you want to retrieve the value of.
302
- * @returns A Promise that resolves with the stored value for the given key. If the key does not exist, `undefined` is returned.
303
- *
304
- * @example
305
- * ```typescript
306
- *
307
- *
308
- * export default async () => {
309
- * const item = await LocalStorage.getItem<string>("favorite-fruit");
310
- * console.log(item);
311
- * };
312
- * ```
313
- */
314
- export function getItem<T extends Value = Value>(key: string): Promise<T | undefined>;
315
- /**
316
- * Stores a value for the given key.
317
- *
318
- * @param key - The key you want to create or update the value of.
319
- * @param value - The value you want to create or update for the given key.
320
- * @returns A Promise that resolves when the value is stored.
321
- *
322
- * @example
323
- * ```typescript
324
- *
325
- *
326
- * export default async () => {
327
- * await LocalStorage.setItem("favorite-fruit", "cherry");
328
- * };
329
- * ```
330
- */
331
- export function setItem(key: string, value: Value): Promise<void>;
332
- /**
333
- * Removes the stored value for the given key.
334
- *
335
- * @param key - The key you want to remove the value of.
336
- * @returns A Promise that resolves when the value is removed.
337
- *
338
- * @example
339
- * ```typescript
340
- *
341
- *
342
- * export default async () => {
343
- * await LocalStorage.removeItem("favorite-fruit");
344
- * };
345
- * ```
346
- */
347
- export function removeItem(key: string): Promise<void>;
348
- /**
349
- * Removes all stored values of an extension.
350
- *
351
- * @returns A Promise that resolves when all values are removed.
352
- *
353
- * @example
354
- * ```typescript
355
- *
356
- *
357
- * export default async () => {
358
- * await LocalStorage.clear();
359
- * };
360
- * ```
361
- */
362
- export function clear(): Promise<void>;
363
- /**
364
- * Supported storage value types.
365
- *
366
- * @example
367
- * ```typescript
368
- *
369
- *
370
- * export default async () => {
371
- * // string
372
- * await LocalStorage.setItem("favorite-fruit", "cherry");
373
- *
374
- * // number
375
- * await LocalStorage.setItem("fruit-basket-count", 3);
376
- *
377
- * // boolean
378
- * await LocalStorage.setItem("fruit-eaten-today", true);
379
- * };
380
- * ```
381
- */
382
- export type Value = string | number | boolean;
383
- /**
384
- * Values of local storage items.
385
- *
386
- * > For type-safe values, you can define your own interface. Use the keys of the local storage items as the property names.
387
- */
388
- export interface Values {
389
- /**
390
- * The local storage value of a given key.
391
- */
392
- [key: string]: any;
393
- }
394
-
395
-
396
-
397
-
398
-
399
- /**
400
- * Exposes a list of actions that can be performed by the user.
401
- *
402
- * @remarks
403
- * Often items are context-aware, e.g. based on the selected list item. Actions can be grouped into semantic
404
- * section and can have keyboard shortcuts assigned.
405
- *
406
- * The first and second action become the primary and secondary action. They automatically get the default keyboard shortcuts assigned.
407
- * In {@link List} and {@link Detail}, this is `↵` for the primary and `⌘` `↵` for the secondary action. In {@link Form} it's `⌘` `↵` for the primary and
408
- * `⌘` `⇧` `↵` for the secondary.
409
- *
410
- * @example
411
- * ```typescript
412
- *
413
- *
414
- * export default function Command() {
415
- * return (
416
- * <List navigationTitle="Open Pull Requests">
417
- * <List.Item
418
- * title="Docs: Update API Reference"
419
- * subtitle="#1"
420
- * actions={
421
- * <ActionPanel title="#1 in raycast/extensions">
422
- * <Action.OpenInBrowser url="https://github.com/raycast/extensions/pull/1" />
423
- * <Action.CopyToClipboard
424
- * title="Copy Pull Request URL"
425
- * content="https://github.com/raycast/extensions/pull/1"
426
- * />
427
- * </ActionPanel>
428
- * }
429
- * />
430
- * </List>
431
- * );
432
- * }
433
- * ```
434
- */
435
- export function ActionPanel(props: ActionPanel.Props): ReactElement<ActionPanel.Props>;
436
- export namespace ActionPanel {
437
- var propTypes: {
438
- title: PropTypes.Requireable<string>;
439
- };
440
- var displayName: string;
441
- }
442
- /**
443
- * See {@link ActionPanel.Section}
444
- */
445
- function ActionPanelSection(props: ActionPanel.Section.Props): ReactElement<ActionPanel.Section.Props>;
446
- namespace ActionPanelSection {
447
- var propTypes: {
448
- title: PropTypes.Requireable<string>;
449
- };
450
- var displayName: string;
451
- }
452
- /**
453
- * See {@link ActionPanel.Submenu}
454
- */
455
- function ActionPanelSubmenu(props: ActionPanel.Submenu.Props): ReactElement<Action.Props>;
456
- namespace ActionPanelSubmenu {
457
- var propTypes: {
458
- id: PropTypes.Requireable<string>;
459
- title: PropTypes.Validator<string>;
460
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
461
- fileIcon: PropTypes.Validator<string>;
462
- }>> | PropTypes.InferProps<{
463
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
464
- light: PropTypes.Validator<string>;
465
- dark: PropTypes.Validator<string>;
466
- }>>;
467
- /**
468
- * Exposes a list of actions that can be performed by the user.
469
- *
470
- * @remarks
471
- * Often items are context-aware, e.g. based on the selected list item. Actions can be grouped into semantic
472
- * section and can have keyboard shortcuts assigned.
473
- *
474
- * The first and second action become the primary and secondary action. They automatically get the default keyboard shortcuts assigned.
475
- * In {@link List} and {@link Detail}, this is `↵` for the primary and `⌘` `↵` for the secondary action. In {@link Form} it's `⌘` `↵` for the primary and
476
- * `⌘` `⇧` `↵` for the secondary.
477
- *
478
- * @example
479
- * ```typescript
480
- *
481
- *
482
- * export default function Command() {
483
- * return (
484
- * <List navigationTitle="Open Pull Requests">
485
- * <List.Item
486
- * title="Docs: Update API Reference"
487
- * subtitle="#1"
488
- * actions={
489
- * <ActionPanel title="#1 in raycast/extensions">
490
- * <Action.OpenInBrowser url="https://github.com/raycast/extensions/pull/1" />
491
- * <Action.CopyToClipboard
492
- * title="Copy Pull Request URL"
493
- * content="https://github.com/raycast/extensions/pull/1"
494
- * />
495
- * </ActionPanel>
496
- * }
497
- * />
498
- * </List>
499
- * );
500
- * }
501
- * ```
502
- */
503
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
504
- light: PropTypes.Validator<string>;
505
- dark: PropTypes.Validator<string>;
506
- }>>;
507
- mask: PropTypes.Requireable<Image.Mask>;
508
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
509
- light: PropTypes.Validator<string>;
510
- dark: PropTypes.Validator<string>;
511
- adjustContrast: PropTypes.Requireable<boolean>;
512
- }>>;
513
- }>>;
514
- shortcut: PropTypes.Requireable<Required<PropTypes.InferProps<{
515
- modifiers: PropTypes.Validator<string[]>;
516
- key: PropTypes.Validator<string>;
517
- }>>>;
518
- };
519
- var displayName: string;
520
- }
521
- export namespace ActionPanel {
522
- /**
523
- * @deprecated Use `Action` instead.
524
- */
525
- const Item: typeof Action;
526
- /**
527
- * A group of visually separated items.
528
- *
529
- * @remarks
530
- * Use sections if the {@link ActionPanel} contains a lot of actions to help guide the user to related actions.
531
- * For example, create a section for all copy actions.
532
- *
533
- * @example
534
- * ```typescript
535
- *
536
- *
537
- * export default function Command() {
538
- * return (
539
- * <List navigationTitle="Open Pull Requests">
540
- * <List.Item
541
- * title="Docs: Update API Reference"
542
- * subtitle="#1"
543
- * actions={
544
- * <ActionPanel title="#1 in raycast/extensions">
545
- * <ActionPanel.Section title="Copy">
546
- * <Action.CopyToClipboard title="Copy Pull Request Number" content="#1" />
547
- * <Action.CopyToClipboard
548
- * title="Copy Pull Request URL"
549
- * content="https://github.com/raycast/extensions/pull/1"
550
- * />
551
- * <Action.CopyToClipboard title="Copy Pull Request Title" content="Docs: Update API Reference" />
552
- * </ActionPanel.Section>
553
- * <ActionPanel.Section title="Danger zone">
554
- * <Action title="Close Pull Request" onAction={() => console.log("Close PR #1")} />
555
- * </ActionPanel.Section>
556
- * </ActionPanel>
557
- * }
558
- * />
559
- * </List>
560
- * );
561
- * }
562
- * ```
563
- */
564
- const Section: typeof ActionPanelSection;
565
- /**
566
- * An action that replaces the current ActionPanel with its children when selected.
567
- *
568
- * @remarks
569
- * This is handy when an action needs to select from a range of options. For example, to add a label to a GitHub pull request
570
- * or an assignee to a todo.
571
- *
572
- * @example
573
- * ```typescript
574
- *
575
- *
576
- * export default function Command() {
577
- * return (
578
- * <List navigationTitle="Open Pull Requests">
579
- * <List.Item
580
- * title="Docs: Update API Reference"
581
- * subtitle="#1"
582
- * actions={
583
- * <ActionPanel title="#1 in raycast/extensions">
584
- * <ActionPanel.Submenu title="Add Label">
585
- * <Action
586
- * icon={{ source: Icon.Circle, tintColor: Color.Red }}
587
- * title="Bug"
588
- * onAction={() => console.log("Add bug label")}
589
- * />
590
- * <Action
591
- * icon={{ source: Icon.Circle, tintColor: Color.Yellow }}
592
- * title="Enhancement"
593
- * onAction={() => console.log("Add enhancement label")}
594
- * />
595
- * <Action
596
- * icon={{ source: Icon.Circle, tintColor: Color.Blue }}
597
- * title="Help Wanted"
598
- * onAction={() => console.log("Add help wanted label")}
599
- * />
600
- * </ActionPanel.Submenu>
601
- * </ActionPanel>
602
- * }
603
- * />
604
- * </List>
605
- * );
606
- * }
607
- * ```
608
- */
609
- const Submenu: typeof ActionPanelSubmenu;
610
- /**
611
- * Props of the {@link ActionPanel} React component.
612
- */
613
- interface Props {
614
- /**
615
- * Sections or Actions. If {@link Action} elements are specified, a default section is automatically created.
616
- */
617
- children?: ReactNode;
618
- /**
619
- * The title displayed at the top of the panel
620
- */
621
- title?: string;
622
- }
623
- /**
624
- * Supported children for the {@link ActionPanel} components.
625
- */
626
- type Children = ReactElement<ActionPanel.Section.Props> | ReactElement<ActionPanel.Section.Props>[] | ActionPanel.Section.Children | null;
627
- namespace Section {
628
- /**
629
- * Props of the {@link ActionPanel.Section} React component.
630
- */
631
- interface Props {
632
- /**
633
- * The item elements of the section.
634
- */
635
- children?: ReactNode;
636
- /**
637
- * Title displayed above the section
638
- */
639
- title?: string;
640
- }
641
- /**
642
- * Supported children for the {@link ActionPanel.Section} component.
643
- */
644
- type Children = ReactElement<Action.Props> | ReactElement<Action.Props>[] | ReactElement<ActionPanel.Submenu.Props> | Array<ReactElement<ActionPanel.Submenu.Props>> | Array<ReactElement<ActionPanel.Submenu.Props> | ReactElement<Action.Props>> | null;
645
- }
646
- namespace Submenu {
647
- /**
648
- * Props of the {@link ActionPanel.Submenu} React component.
649
- */
650
- interface Props {
651
- /**
652
- * ID of the submenu.
653
- * Make sure to assign each submenu a unique ID or a UUID will be auto-generated.
654
- */
655
- id?: string;
656
- /**
657
- * The title displayed for submenu.
658
- */
659
- title: string;
660
- /**
661
- * The icon displayed for the submenu.
662
- */
663
- icon?: Image.ImageLike;
664
- /**
665
- * The keyboard shortcut for the submenu.
666
- */
667
- shortcut?: Keyboard.Shortcut;
668
- /**
669
- * Items of the submenu.
670
- *
671
- * @example
672
- * ```typescript
673
- * <ActionPanel.Submenu title="Submenu">
674
- * <Action title="Just an action" />
675
- * </ActionPanel.Submenu>
676
- * ```
677
- *
678
- * @remarks
679
- * If {@link Action} elements are specified, a default section is automatically created.\
680
- * Use {@link ActionPanel.Submenu} as parent when specifying sub-menu's children to make code is more readable.
681
- */
682
- children?: ReactNode;
683
- }
684
- /**
685
- * Supported children for the {@link ActionPanel.Submenu} components.
686
- */
687
- type Children = ActionPanel.Children;
688
- }
689
- }
690
- export {};
691
-
692
-
693
-
694
- /**
695
- * Renders a markdown (CommonMark) string.
696
- *
697
- * @remarks
698
- * Typically used as a standalone view or when navigating from a {@link List}.
699
- *
700
- * @example
701
- * ```typescript
702
- *
703
- *
704
- * export default function Command() {
705
- * return <Detail markdown="**Hello** _World_!" />;
706
- * }
707
- * ```
708
- */
709
- export function Detail(props: Detail.Props): ReactElement<Detail.Props>;
710
- export namespace Detail {
711
- var propTypes: {
712
- navigationTitle: PropTypes.Requireable<string>;
713
- isLoading: PropTypes.Requireable<boolean>;
714
- markdown: PropTypes.Requireable<string>;
715
- };
716
- var displayName: string;
717
- }
718
- export namespace Detail {
719
- /**
720
- * Props of the {@link Detail} React component.
721
- */
722
- interface Props extends ActionsInterface, NavigationChildInterface {
723
- /**
724
- * The CommonMark string to be rendered.
725
- */
726
- markdown?: string | null;
727
- /** @deprecated - Use the `markdown` prop instead */
728
- children?: ReactNode;
729
- }
730
- }
731
-
732
-
733
-
734
-
735
- /**
736
- * Shows a list of form items such as {@link Form.TextField}, {@link Form.Checkbox} or {@link Form.Dropdown}.
737
- */
738
- export function Form(props: Form.Props): ReactElement<Form.Props>;
739
- export namespace Form {
740
- var propTypes: {
741
- submitTitle: PropTypes.Requireable<string>;
742
- navigationTitle: PropTypes.Requireable<string>;
743
- isLoading: PropTypes.Requireable<boolean>;
744
- };
745
- var displayName: string;
746
- }
747
- /**
748
- * See {@link Form.TextField}
749
- */
750
- function FormTextField(props: Form.TextField.Props): ReactElement<Form.TextField.Props>;
751
- namespace FormTextField {
752
- var propTypes: {
753
- id: PropTypes.Validator<string>;
754
- title: PropTypes.Requireable<string>;
755
- storeValue: PropTypes.Requireable<boolean>;
756
- value: PropTypes.Requireable<string>;
757
- defaultValue: PropTypes.Requireable<string>;
758
- placeholder: PropTypes.Requireable<string>;
759
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
760
- };
761
- var displayName: string;
762
- }
763
- /**
764
- * See {@link Form.PasswordField}
765
- */
766
- function FormPasswordField(props: Form.PasswordField.Props): ReactElement<Form.PasswordField.Props>;
767
- namespace FormPasswordField {
768
- var propTypes: {
769
- id: PropTypes.Validator<string>;
770
- title: PropTypes.Requireable<string>;
771
- storeValue: PropTypes.Requireable<boolean>;
772
- value: PropTypes.Requireable<string>;
773
- defaultValue: PropTypes.Requireable<string>;
774
- placeholder: PropTypes.Requireable<string>;
775
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
776
- };
777
- var displayName: string;
778
- }
779
- /**
780
- * See {@link Form.TextArea}
781
- */
782
- function FormTextArea(props: Form.TextArea.Props): ReactElement<Form.TextArea.Props>;
783
- namespace FormTextArea {
784
- var propTypes: {
785
- id: PropTypes.Validator<string>;
786
- title: PropTypes.Requireable<string>;
787
- storeValue: PropTypes.Requireable<boolean>;
788
- value: PropTypes.Requireable<string>;
789
- defaultValue: PropTypes.Requireable<string>;
790
- placeholder: PropTypes.Requireable<string>;
791
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
792
- };
793
- var displayName: string;
794
- }
795
- /**
796
- * See {@link Form.Checkbox}
797
- */
798
- function FormCheckbox(props: Form.Checkbox.Props): ReactElement<Form.Checkbox.Props>;
799
- namespace FormCheckbox {
800
- var propTypes: {
801
- id: PropTypes.Validator<string>;
802
- title: PropTypes.Requireable<string>;
803
- storeValue: PropTypes.Requireable<boolean>;
804
- value: PropTypes.Requireable<boolean>;
805
- defaultValue: PropTypes.Requireable<boolean>;
806
- label: PropTypes.Requireable<string>;
807
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
808
- };
809
- var displayName: string;
810
- }
811
- /**
812
- * See {@link Form.DatePicker}
813
- */
814
- function FormDatePicker(props: Form.DatePicker.Props): ReactElement<Form.DatePicker.Props>;
815
- namespace FormDatePicker {
816
- var propTypes: {
817
- id: PropTypes.Validator<string>;
818
- title: PropTypes.Requireable<string>;
819
- storeValue: PropTypes.Requireable<boolean>;
820
- value: PropTypes.Requireable<Date>;
821
- defaultValue: PropTypes.Requireable<Date>;
822
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
823
- };
824
- var displayName: string;
825
- }
826
- /**
827
- * See {@link Form.Separator}
828
- */
829
- function FormSeparator(): ReactElement<Form.Separator.Props>;
830
- namespace FormSeparator {
831
- var displayName: string;
832
- }
833
- /**
834
- * See {@link Form.Description}
835
- */
836
- function FormDescription(props: Form.Description.Props): ReactElement<Form.Description.Props>;
837
- namespace FormDescription {
838
- var propTypes: {
839
- text: PropTypes.Requireable<string>;
840
- };
841
- var displayName: string;
842
- }
843
- /**
844
- * See {@link Form.Dropdown}
845
- */
846
- function FormDropdown(props: Form.Dropdown.Props): ReactElement<Form.Dropdown.Props>;
847
- namespace FormDropdown {
848
- var propTypes: {
849
- id: PropTypes.Validator<string>;
850
- title: PropTypes.Requireable<string>;
851
- storeValue: PropTypes.Requireable<boolean>;
852
- value: PropTypes.Requireable<string>;
853
- defaultValue: PropTypes.Requireable<string>;
854
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
855
- };
856
- var displayName: string;
857
- }
858
- /**
859
- * See {@link Form.Dropdown.Section}
860
- */
861
- function FormDropdownSection(props: Form.Dropdown.Section.Props): ReactElement<Form.Dropdown.Section.Props>;
862
- namespace FormDropdownSection {
863
- var propTypes: {
864
- title: PropTypes.Requireable<string>;
865
- };
866
- var displayName: string;
867
- }
868
- /**
869
- * See {@link Form.Dropdown.Item}
870
- */
871
- function FormDropdownItem(props: Form.Dropdown.Item.Props): ReactElement<Form.Dropdown.Item.Props>;
872
- namespace FormDropdownItem {
873
- var propTypes: {
874
- value: PropTypes.Requireable<string>;
875
- title: PropTypes.Validator<string>;
876
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
877
- fileIcon: PropTypes.Validator<string>;
878
- }>> | PropTypes.InferProps<{
879
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
880
- light: PropTypes.Validator<string>;
881
- dark: PropTypes.Validator<string>;
882
- }>>;
883
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
884
- light: PropTypes.Validator<string>;
885
- dark: PropTypes.Validator<string>;
886
- }>>;
887
- mask: PropTypes.Requireable<Image.Mask>;
888
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
889
- light: PropTypes.Validator<string>;
890
- dark: PropTypes.Validator<string>;
891
- adjustContrast: PropTypes.Requireable<boolean>;
892
- }>>;
893
- }>>;
894
- };
895
- var displayName: string;
896
- }
897
- /**
898
- * See {@link Form.TagPicker}
899
- */
900
- function FormTagPicker(props: Form.TagPicker.Props): ReactElement<Form.TagPicker.Props>;
901
- namespace FormTagPicker {
902
- var propTypes: {
903
- id: PropTypes.Validator<string>;
904
- title: PropTypes.Requireable<string>;
905
- storeValue: PropTypes.Requireable<boolean>;
906
- placeholder: PropTypes.Requireable<string>;
907
- value: PropTypes.Requireable<string[]>;
908
- defaultValue: PropTypes.Requireable<string[]>;
909
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
910
- };
911
- var displayName: string;
912
- }
913
- /**
914
- * See {@link Form.TagPicker.Item}
915
- */
916
- function FormTagPickerItem(props: Form.TagPicker.Item.Props): ReactElement<Form.TagPicker.Item.Props>;
917
- namespace FormTagPickerItem {
918
- var propTypes: {
919
- value: PropTypes.Validator<string>;
920
- title: PropTypes.Validator<string>;
921
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
922
- fileIcon: PropTypes.Validator<string>;
923
- }>> | PropTypes.InferProps<{
924
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
925
- light: PropTypes.Validator<string>;
926
- dark: PropTypes.Validator<string>;
927
- }>>;
928
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
929
- light: PropTypes.Validator<string>;
930
- dark: PropTypes.Validator<string>;
931
- }>>;
932
- mask: PropTypes.Requireable<Image.Mask>;
933
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
934
- light: PropTypes.Validator<string>;
935
- dark: PropTypes.Validator<string>;
936
- adjustContrast: PropTypes.Requireable<boolean>;
937
- }>>;
938
- }>>;
939
- };
940
- var displayName: string;
941
- }
942
- namespace FormDropdown {
943
- /**
944
- * Visually separated group of dropdown items.
945
- *
946
- * @remarks
947
- * Use sections to group related menu items together.
948
- *
949
- * @example
950
- * ```typescript
951
- *
952
- *
953
- * export default function Command() {
954
- * return (
955
- * <Form
956
- * actions={
957
- * <ActionPanel>
958
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
959
- * </ActionPanel>
960
- * }
961
- * >
962
- * <Form.Dropdown id="food" title="Favorite Food">
963
- * <Form.Dropdown.Section title="Fruits">
964
- * <Form.Dropdown.Item value="apple" title="Apple" icon="🍎" />
965
- * <Form.Dropdown.Item value="banana" title="Banana" icon="🍌" />
966
- * </Form.Dropdown.Section>
967
- * <Form.Dropdown.Section title="Vegetables">
968
- * <Form.Dropdown.Item value="broccoli" title="Broccoli" icon="🥦" />
969
- * <Form.Dropdown.Item value="carrot" title="Carrot" icon="🥕" />
970
- * </Form.Dropdown.Section>
971
- * </Form.Dropdown>
972
- * </Form>
973
- * );
974
- * }
975
- * ```
976
- */
977
- const Section: typeof FormDropdownSection;
978
- /**
979
- * A dropdown item in a {@link Form.Dropdown}
980
- *
981
- * @example
982
- * ```typescript
983
- *
984
- *
985
- * export default function Command() {
986
- * return (
987
- * <Form
988
- * actions={
989
- * <ActionPanel>
990
- * <Action.SubmitForm title="Submit Icon" onSubmit={(values) => console.log(values)} />
991
- * </ActionPanel>
992
- * }
993
- * >
994
- * <Form.Dropdown id="icon" title="Icon">
995
- * <Form.Dropdown.Item value="circle" title="Cirlce" icon={Icon.Circle} />
996
- * </Form.Dropdown>
997
- * </Form>
998
- * );
999
- * }
1000
- * ```
1001
- */
1002
- const Item: typeof FormDropdownItem;
1003
- }
1004
- namespace FormTagPicker {
1005
- /**
1006
- * A tag picker item in a {@link Form.TagPicker}.
1007
- *
1008
- * @example
1009
- * ```typescript
1010
- *
1011
- *
1012
- * export default function Command() {
1013
- * return (
1014
- * <Form
1015
- * actions={
1016
- * <ActionPanel>
1017
- * <Action.SubmitForm title="Submit Color" onSubmit={(values) => console.log(values)} />
1018
- * </ActionPanel>
1019
- * }
1020
- * >
1021
- * <Form.TagPicker id="color" title="Color">
1022
- * <Form.TagPicker.Item value="red" title="Red" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
1023
- * <Form.TagPicker.Item value="green" title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
1024
- * <Form.TagPicker.Item value="blue" title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
1025
- * </Form.TagPicker>
1026
- * </Form>
1027
- * );
1028
- * }
1029
- * ```
1030
- */
1031
- const Item: typeof FormTagPickerItem;
1032
- }
1033
- export namespace Form {
1034
- /**
1035
- * @deprecated Use `Form.Dropdown.Section` instead.
1036
- */
1037
- const DropdownSection: typeof FormDropdownSection;
1038
- /**
1039
- * @deprecated Use `Form.Dropdown.Item` instead.
1040
- */
1041
- const DropdownItem: typeof FormDropdownItem;
1042
- /**
1043
- * @deprecated Use `Form.TagPicker.Item` instead.
1044
- */
1045
- const TagPickerItem: typeof FormTagPickerItem;
1046
- /**
1047
- * A form item with a text field for input.
1048
- *
1049
- * @example
1050
- * Uncontrolled text field
1051
- *
1052
- * ```typescript
1053
- *
1054
- *
1055
- * export default function Command() {
1056
- * return (
1057
- * <Form
1058
- * actions={
1059
- * <ActionPanel>
1060
- * <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
1061
- * </ActionPanel>
1062
- * }
1063
- * >
1064
- * <Form.TextField id="name" defaultValue="Steve" />
1065
- * </Form>
1066
- * );
1067
- * }
1068
- * ```
1069
- *
1070
- * @example
1071
- * Controlled text field
1072
- *
1073
- * ```typescript
1074
- *
1075
- *
1076
- *
1077
- * export default function Command() {
1078
- * const [name, setName] = useState<string>();
1079
- *
1080
- * return (
1081
- * <Form
1082
- * actions={
1083
- * <ActionPanel>
1084
- * <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
1085
- * </ActionPanel>
1086
- * }
1087
- * >
1088
- * <Form.TextField id="name" value={name} onChange={setName} />
1089
- * </Form>
1090
- * );
1091
- * }
1092
- * ```
1093
- */
1094
- const TextField: typeof FormTextField;
1095
- /**
1096
- * A form item with a text area for input.
1097
- * The item supports multiline text entry.
1098
- *
1099
- * @example
1100
- * Uncontrolled text area
1101
- *
1102
- * ```typescript
1103
- *
1104
- *
1105
- * const DESCRIPTION =
1106
- * "We spend too much time staring at loading indicators. The Raycast team is dedicated to make everybody interact faster with their computers.";
1107
- *
1108
- * export default function Command() {
1109
- * return (
1110
- * <Form
1111
- * actions={
1112
- * <ActionPanel>
1113
- * <Action.SubmitForm title="Submit Description" onSubmit={(values) => console.log(values)} />
1114
- * </ActionPanel>
1115
- * }
1116
- * >
1117
- * <Form.TextArea id="description" defaultValue={DESCRIPTION} />
1118
- * </Form>
1119
- * );
1120
- * }
1121
- * ```
1122
- *
1123
- * @example
1124
- * Controlled text area
1125
- *
1126
- * ```typescript
1127
- *
1128
- *
1129
- *
1130
- * export default function Command() {
1131
- * const [description, setDescription] = useState<string>();
1132
- *
1133
- * return (
1134
- * <Form
1135
- * actions={
1136
- * <ActionPanel>
1137
- * <Action.SubmitForm title="Submit Description" onSubmit={(values) => console.log(values)} />
1138
- * </ActionPanel>
1139
- * }
1140
- * >
1141
- * <Form.TextArea id="description" value={description} onChange={setDescription} />
1142
- * </Form>
1143
- * );
1144
- * }
1145
- * ```
1146
- */
1147
- const TextArea: typeof FormTextArea;
1148
- /**
1149
- * A form item with a checkbox.
1150
- *
1151
- * @example
1152
- * Uncontrolled checkbox
1153
- *
1154
- * ```typescript
1155
- *
1156
- *
1157
- * export default function Command() {
1158
- * return (
1159
- * <Form
1160
- * actions={
1161
- * <ActionPanel>
1162
- * <Action.SubmitForm title="Submit Answer" onSubmit={(values) => console.log(values)} />
1163
- * </ActionPanel>
1164
- * }
1165
- * >
1166
- * <Form.Checkbox id="answer" label="Are you happy?" defaultValue={true} />
1167
- * </Form>
1168
- * );
1169
- * }
1170
- * ```
1171
- *
1172
- * @example
1173
- * Controlled checkbox
1174
- *
1175
- * ```typescript
1176
- *
1177
- *
1178
- *
1179
- * export default function Command() {
1180
- * const [checked, setChecked] = useState(true);
1181
- *
1182
- * return (
1183
- * <Form
1184
- * actions={
1185
- * <ActionPanel>
1186
- * <Action.SubmitForm title="Submit Answer" onSubmit={(values) => console.log(values)} />
1187
- * </ActionPanel>
1188
- * }
1189
- * >
1190
- * <Form.Checkbox id="answer" label="Do you like orange juice?" value={checked} onChange={setChecked} />
1191
- * </Form>
1192
- * );
1193
- * }
1194
- * ```
1195
- */
1196
- const Checkbox: typeof FormCheckbox;
1197
- /**
1198
- * A form item with a date picker.
1199
- *
1200
- * @example
1201
- * Uncontrolled date picker
1202
- *
1203
- * ```typescript
1204
- *
1205
- *
1206
- * export default function Command() {
1207
- * return (
1208
- * <Form
1209
- * actions={
1210
- * <ActionPanel>
1211
- * <Action.SubmitForm title="Submit Form" onSubmit={(values) => console.log(values)} />
1212
- * </ActionPanel>
1213
- * }
1214
- * >
1215
- * <Form.DatePicker id="dateOfBirth" title="Date of Birth" defaultValue={new Date(1955, 1, 24)} />
1216
- * </Form>
1217
- * );
1218
- * }
1219
- * ```
1220
- *
1221
- * @example
1222
- * Controlled date picker
1223
- *
1224
- * ```typescript
1225
- *
1226
- *
1227
- *
1228
- * export default function Command() {
1229
- * const [date, setDate] = useState<Date>();
1230
- *
1231
- * return (
1232
- * <Form
1233
- * actions={
1234
- * <ActionPanel>
1235
- * <Action.SubmitForm title="Submit Form" onSubmit={(values) => console.log(values)} />
1236
- * </ActionPanel>
1237
- * }
1238
- * >
1239
- * <Form.DatePicker id="launchDate" title="Launch Date" value={date} onChange={setDate} />
1240
- * </Form>
1241
- * );
1242
- * }
1243
- * ```
1244
- */
1245
- const DatePicker: typeof FormDatePicker;
1246
- /**
1247
- * A form item that shows a separator line.
1248
- * Use for grouping and visually separating form items.
1249
- *
1250
- * @example
1251
- * ```typescript
1252
- *
1253
- *
1254
- * export default function Command() {
1255
- * return (
1256
- * <Form
1257
- * actions={
1258
- * <ActionPanel>
1259
- * <Action.SubmitForm title="Submit Form" onSubmit={(values) => console.log(values)} />
1260
- * </ActionPanel>
1261
- * }
1262
- * >
1263
- * <Form.TextField id="textfield" />
1264
- * <Form.Separator />
1265
- * <Form.TextArea id="textarea" />
1266
- * </Form>
1267
- * );
1268
- * }
1269
- * ```
1270
- */
1271
- const Separator: typeof FormSeparator;
1272
- /**
1273
- * A form item with a dropdown menu.
1274
- *
1275
- * @example
1276
- * Uncontrolled dropdown
1277
- *
1278
- * ```typescript
1279
- *
1280
- *
1281
- * export default function Command() {
1282
- * return (
1283
- * <Form
1284
- * actions={
1285
- * <ActionPanel>
1286
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
1287
- * </ActionPanel>
1288
- * }
1289
- * >
1290
- * <Form.Dropdown id="emoji" title="Favorite Emoji" defaultValue="lol">
1291
- * <Form.Dropdown.Item value="poop" title="Pile of poop" icon="💩" />
1292
- * <Form.Dropdown.Item value="rocket" title="Rocket" icon="🚀" />
1293
- * <Form.Dropdown.Item value="lol" title="Rolling on the floor laughing face" icon="🤣" />
1294
- * </Form.Dropdown>
1295
- * </Form>
1296
- * );
1297
- * }
1298
- * ```
1299
- *
1300
- * @example
1301
- * Controlled dropdown
1302
- *
1303
- * ```typescript
1304
- *
1305
- *
1306
- *
1307
- * export default function Command() {
1308
- * const [programmingLanguage, setProgrammingLanguage] = useState<string>("typescript");
1309
- *
1310
- * return (
1311
- * <Form
1312
- * actions={
1313
- * <ActionPanel>
1314
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
1315
- * </ActionPanel>
1316
- * }
1317
- * >
1318
- * <Form.Dropdown
1319
- * id="dropdown"
1320
- * title="Favorite Language"
1321
- * value={programmingLanguage}
1322
- * onChange={setProgrammingLanguage}
1323
- * >
1324
- * <Form.Dropdown.Item value="cpp" title="C++" />
1325
- * <Form.Dropdown.Item value="javascript" title="JavaScript" />
1326
- * <Form.Dropdown.Item value="ruby" title="Ruby" />
1327
- * <Form.Dropdown.Item value="python" title="Python" />
1328
- * <Form.Dropdown.Item value="swift" title="Swift" />
1329
- * <Form.Dropdown.Item value="typescript" title="TypeScript" />
1330
- * </Form.Dropdown>
1331
- * </Form>
1332
- * );
1333
- * }
1334
- * ```
1335
- */
1336
- const Dropdown: typeof FormDropdown;
1337
- /**
1338
- * A form item with a tag picker that allows the user to select multiple items.
1339
- *
1340
- * @example
1341
- * Uncontrolled tag picker
1342
- *
1343
- * ```typescript
1344
- *
1345
- *
1346
- * export default function Command() {
1347
- * return (
1348
- * <Form
1349
- * actions={
1350
- * <ActionPanel>
1351
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
1352
- * </ActionPanel>
1353
- * }
1354
- * >
1355
- * <Form.TagPicker id="sports" title="Favorite Sports" defaultValue={["football"]}>
1356
- * <Form.TagPicker.Item value="basketball" title="Basketball" icon="🏀" />
1357
- * <Form.TagPicker.Item value="football" title="Football" icon="⚽️" />
1358
- * <Form.TagPicker.Item value="tennis" title="Tennis" icon="🎾" />
1359
- * </Form.TagPicker>
1360
- * </Form>
1361
- * );
1362
- * }
1363
- * ```
1364
- *
1365
- * @example
1366
- * Controlled tag picker
1367
- *
1368
- * ```typescript
1369
- *
1370
- *
1371
- *
1372
- * export default function Command() {
1373
- * const [countries, setCountries] = useState<string[]>(["ger", "ned", "pol"]);
1374
- *
1375
- * return (
1376
- * <Form
1377
- * actions={
1378
- * <ActionPanel>
1379
- * <Action.SubmitForm title="Submit Countries" onSubmit={(values) => console.log(values)} />
1380
- * </ActionPanel>
1381
- * }
1382
- * >
1383
- * <Form.TagPicker id="countries" title="Visited Countries" value={countries} onChange={setCountries}>
1384
- * <Form.TagPicker.Item value="ger" title="Germany" icon="🇩🇪" />
1385
- * <Form.TagPicker.Item value="ind" title="India" icon="🇮🇳" />
1386
- * <Form.TagPicker.Item value="ned" title="Netherlands" icon="🇳🇱" />
1387
- * <Form.TagPicker.Item value="nor" title="Norway" icon="🇳🇴" />
1388
- * <Form.TagPicker.Item value="pol" title="Poland" icon="🇵🇱" />
1389
- * <Form.TagPicker.Item value="rus" title="Russia" icon="🇷🇺" />
1390
- * <Form.TagPicker.Item value="sco" title="Scotland" icon="🏴󠁧󠁢󠁳󠁣󠁴󠁿" />
1391
- * </Form.TagPicker>
1392
- * </Form>
1393
- * );
1394
- * }
1395
- * ```
1396
- */
1397
- const TagPicker: typeof FormTagPicker;
1398
- /**
1399
- * A form item with a secure text field for password-entry in which the entered characters must be kept secret.
1400
- *
1401
- * @example
1402
- * Uncontrolled password field
1403
- *
1404
- * ```typescript
1405
- *
1406
- *
1407
- * export default function Command() {
1408
- * return (
1409
- * <Form
1410
- * actions={
1411
- * <ActionPanel>
1412
- * <Action.SubmitFormAction title="Submit Password" onSubmit={(values) => console.log(values)} />
1413
- * </ActionPanel>
1414
- * }
1415
- * >
1416
- * <Form.PasswordField id="password" title="Enter Password" />
1417
- * </Form>
1418
- * );
1419
- * }
1420
- * ```
1421
- *
1422
- * @example
1423
- * Controlled password field
1424
- *
1425
- * ```typescript
1426
- *
1427
- *
1428
- *
1429
- * export default function Command() {
1430
- * const [password, setPassword] = useState<string>();
1431
- *
1432
- * return (
1433
- * <Form
1434
- * actions={
1435
- * <ActionPanel>
1436
- * <Action.SubmitForm title="Submit Password" onSubmit={(values) => console.log(values)} />
1437
- * </ActionPanel>
1438
- * }
1439
- * >
1440
- * <Form.PasswordField id="password" value={password} onChange={setPassword} />
1441
- * </Form>
1442
- * );
1443
- * }
1444
- * ```
1445
- */
1446
- const PasswordField: typeof FormPasswordField;
1447
- /**
1448
- * A form item with a simple text label.
1449
- *
1450
- * @remark Do *not* use this component to show validation messages for other form fields.
1451
- *
1452
- * @example
1453
- * Label
1454
- *
1455
- * ```typescript
1456
- *
1457
- *
1458
- * export default function Command() {
1459
- * return (
1460
- * <Form
1461
- * actions={
1462
- * <ActionPanel>
1463
- * <Action.SubmitForm title="Submit" onSubmit={(values) => console.log(values)} />
1464
- * </ActionPanel>
1465
- * }
1466
- * >
1467
- * <Form.Description title="Import / Export" text="Exporting will back-up your preferences, quicklinks, snippets, floating notes, script-command folder paths, aliases, hotkeys, favorites and other data." />
1468
- * </Form>
1469
- * );
1470
- * }
1471
- * ```
1472
- */
1473
- const Description: typeof FormDescription;
1474
- /**
1475
- * Props of the {@link Form} React component.
1476
- *
1477
- * @category User Interface
1478
- * @subcategory Form
1479
- */
1480
- interface Props extends ActionsInterface, NavigationChildInterface {
1481
- /**
1482
- * The Form.Item elements of the form.
1483
- */
1484
- children?: ReactNode;
1485
- }
1486
- /**
1487
- * A possible form item value that will be used as an input for the submit callback of a form.
1488
- */
1489
- type Value = string | number | boolean | string[] | number[] | Date | null;
1490
- /**
1491
- * Values of items in the form.
1492
- *
1493
- * @remarks
1494
- * For type-safe form values, you can define your own interface. Use the ID's of the form items
1495
- * as the property names. See the example for more details.
1496
- *
1497
- * @example
1498
- * ```typescript
1499
- *
1500
- *
1501
- * interface Values {
1502
- * todo: string;
1503
- * due?: Date;
1504
- * }
1505
- *
1506
- * export default function Command() {
1507
- * function handleSubmit(values: Values) {
1508
- * console.log(values);
1509
- * }
1510
- *
1511
- * return (
1512
- * <Form
1513
- * actions={
1514
- * <ActionPanel>
1515
- * <Action.SubmitForm title="Submit" onSubmit={handleSubmit} />
1516
- * </ActionPanel>
1517
- * }
1518
- * >
1519
- * <Form.TextField id="todo" title="Todo" />
1520
- * <Form.DatePicker id="due" title="Due Date" />
1521
- * </Form>
1522
- * );
1523
- * };
1524
- * ```
1525
- */
1526
- interface Values {
1527
- /**
1528
- * The form value of a given item.
1529
- */
1530
- [item: string]: any;
1531
- }
1532
- /**
1533
- * Props of the Form.Item React component.
1534
- */
1535
- interface ItemProps<Value extends Form.Value> {
1536
- /**
1537
- * ID of the form item.
1538
- * Make sure to assign each form item a unique id.
1539
- */
1540
- id: string;
1541
- /**
1542
- * The title displayed on the left side of the item.
1543
- */
1544
- title?: string;
1545
- /**
1546
- * Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered.
1547
- */
1548
- storeValue?: boolean;
1549
- /**
1550
- * The current value of the item.
1551
- */
1552
- value?: Value;
1553
- /**
1554
- * The default value of the item.
1555
- * Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering.
1556
- * @important If you're using {@link Form.Item.Props.storeValue} and configured it as `true` then the stored value will be set.
1557
- * @important If you configure {@link Form.Item.Props.value} at the same time with {@link Form.Item.Props.defaultValue}, the `value` will be set instead of `defaultValue`.
1558
- */
1559
- defaultValue?: Value;
1560
- /**
1561
- * The callback which will be triggered on the {@link Form.Item.Props.value} change for the item.
1562
- */
1563
- onChange?: (newValue: Value) => void;
1564
- }
1565
- namespace TextField {
1566
- /**
1567
- * Props of the {@link Form.TextField} React component.
1568
- */
1569
- interface Props extends Form.ItemProps<string> {
1570
- /**
1571
- * Placeholder text shown in the text field.
1572
- */
1573
- placeholder?: string;
1574
- }
1575
- }
1576
- namespace TextArea {
1577
- /**
1578
- * Props of the {@link Form.TextArea} React component.
1579
- */
1580
- interface Props extends Form.ItemProps<string> {
1581
- /**
1582
- * Placeholder text shown in the text field.
1583
- */
1584
- placeholder?: string;
1585
- }
1586
- }
1587
- namespace Dropdown {
1588
- /**
1589
- * Props of the {@link Form.Dropdown} React component.
1590
- * The {@link Form.Dropdown.Props.value} here is ID ({@link Form.Dropdown.Item.Props.id}) of the default selected item.
1591
- */
1592
- interface Props extends Form.ItemProps<string> {
1593
- /**
1594
- * Sections or items. If {@link Form.Dropdown.Item} elements are specified, a default section is automatically created.
1595
- */
1596
- children?: ReactNode;
1597
- }
1598
- namespace Section {
1599
- /**
1600
- * Props of the {@link Form.Dropdown.Section} React component.
1601
- */
1602
- interface Props {
1603
- /**
1604
- * The item elements of the section.
1605
- */
1606
- children?: ReactNode;
1607
- /**
1608
- * Title displayed above the section
1609
- */
1610
- title?: string;
1611
- }
1612
- }
1613
- namespace Item {
1614
- /**
1615
- * Props of the {@link Form.Dropdown.Item} React component.
1616
- */
1617
- interface Props {
1618
- /**
1619
- * Value of the dropdown item.
1620
- * Make sure to assign each unique value for each item.
1621
- */
1622
- value: string;
1623
- /**
1624
- * The title displayed for the item.
1625
- */
1626
- title: string;
1627
- /**
1628
- * A optional icon displayed for the item.
1629
- */
1630
- icon?: Image.ImageLike;
1631
- }
1632
- }
1633
- }
1634
- namespace Checkbox {
1635
- /**
1636
- * Props of the {@link Form.Checkbox} React component.
1637
- */
1638
- interface Props extends Form.ItemProps<boolean> {
1639
- /**
1640
- * The label displayed on the right side of the checkbox.
1641
- */
1642
- label: string;
1643
- }
1644
- }
1645
- namespace DatePicker {
1646
- /**
1647
- * Props of the {@link Form.DatePicker} React component.
1648
- */
1649
- interface Props extends Form.ItemProps<Date> {
1650
- }
1651
- }
1652
- namespace Separator {
1653
- /**
1654
- * Props of the {@link Form.Separator} React component.
1655
- */
1656
- interface Props {
1657
- }
1658
- }
1659
- namespace TagPicker {
1660
- /**
1661
- * Props of the {@link Form.TagPicker} React component.
1662
- * The {@link Form.TagPicker.Props.value} here is the IDs ({@link Form.TagPicker.Item.Props.id}) of the default selected items.
1663
- */
1664
- interface Props extends Form.ItemProps<string[]> {
1665
- /**
1666
- * The list of tag picker's items.
1667
- */
1668
- children?: ReactNode;
1669
- /**
1670
- * Placeholder text shown in the token field.
1671
- */
1672
- placeholder?: string;
1673
- }
1674
- namespace Item {
1675
- /**
1676
- * Props of the {@link Form.TagPicker.Item} React component.
1677
- */
1678
- interface Props {
1679
- /**
1680
- * Value of the tag picker item.
1681
- * Make sure to assign unique value for each item.
1682
- */
1683
- value: string;
1684
- /**
1685
- * The display title of the token.
1686
- */
1687
- title: string;
1688
- /**
1689
- * An icon to show in the token.
1690
- */
1691
- icon?: Image.ImageLike;
1692
- }
1693
- }
1694
- }
1695
- namespace PasswordField {
1696
- /**
1697
- * Props of the {@link Form.PasswordField} React component.
1698
- */
1699
- interface Props extends Form.ItemProps<string> {
1700
- /**
1701
- * Placeholder text shown in the password field.
1702
- */
1703
- placeholder?: string;
1704
- }
1705
- }
1706
- namespace Description {
1707
- /**
1708
- * Props of the {@link Form.Description} React component.
1709
- */
1710
- interface Props {
1711
- /**
1712
- * The display title of the left side from the description item.
1713
- */
1714
- title?: string;
1715
- /**
1716
- * Text that will be displayed in the middle.
1717
- */
1718
- text: string;
1719
- }
1720
- }
1721
- }
1722
- export {};
1723
-
1724
-
1725
-
1726
-
1727
- /**
1728
- * Displays {@link List.Section} or {@link List.Item}.
1729
- *
1730
- * @remarks
1731
- * The list uses built-in filtering by indexing the title of list items and additionally keywords.
1732
- *
1733
- * @example
1734
- * ```typescript
1735
- *
1736
- *
1737
- * export default function Command() {
1738
- * return (
1739
- * <List navigationTitle="Search Beers" searchBarPlaceholder="Search your favorite beer">
1740
- * <List.Item title="Augustiner Helles" />
1741
- * <List.Item title="Camden Hells" />
1742
- * <List.Item title="Leffe Blonde" />
1743
- * <List.Item title="Sierra Nevada IPA" />
1744
- * </List>
1745
- * );
1746
- * }
1747
- * ```
1748
- */
1749
- export function List(props: List.Props): ReactElement<List.Props>;
1750
- export namespace List {
1751
- var propTypes: {
1752
- selectedItemId: PropTypes.Requireable<string>;
1753
- searchBarPlaceholder: PropTypes.Requireable<string>;
1754
- throttle: PropTypes.Requireable<boolean>;
1755
- onSearchTextChange: PropTypes.Requireable<(...args: any[]) => any>;
1756
- onSelectionChange: PropTypes.Requireable<(...args: any[]) => any>;
1757
- };
1758
- var displayName: string;
1759
- }
1760
- /**
1761
- * See {@link List.Section}
1762
- */
1763
- function ListSection(props: List.Section.Props): ReactElement<List.Section.Props>;
1764
- namespace ListSection {
1765
- var propTypes: {
1766
- id: PropTypes.Requireable<string>;
1767
- title: PropTypes.Requireable<string>;
1768
- subtitle: PropTypes.Requireable<string>;
1769
- };
1770
- var displayName: string;
1771
- }
1772
- /**
1773
- * See {@link List.Item}
1774
- */
1775
- function ListItem(props: List.Item.Props): ReactElement<List.Item.Props>;
1776
- namespace ListItem {
1777
- var propTypes: {
1778
- id: PropTypes.Requireable<string>;
1779
- title: PropTypes.Validator<string>;
1780
- subtitle: PropTypes.Requireable<string>;
1781
- accessoryTitle: PropTypes.Requireable<string>;
1782
- keywords: PropTypes.Requireable<string[]>;
1783
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
1784
- fileIcon: PropTypes.Validator<string>;
1785
- }>> | PropTypes.InferProps<{
1786
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
1787
- light: PropTypes.Validator<string>;
1788
- dark: PropTypes.Validator<string>;
1789
- }>>;
1790
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
1791
- /**
1792
- * Displays {@link List.Section} or {@link List.Item}.
1793
- *
1794
- * @remarks
1795
- * The list uses built-in filtering by indexing the title of list items and additionally keywords.
1796
- *
1797
- * @example
1798
- * ```typescript
1799
- *
1800
- *
1801
- * export default function Command() {
1802
- * return (
1803
- * <List navigationTitle="Search Beers" searchBarPlaceholder="Search your favorite beer">
1804
- * <List.Item title="Augustiner Helles" />
1805
- * <List.Item title="Camden Hells" />
1806
- * <List.Item title="Leffe Blonde" />
1807
- * <List.Item title="Sierra Nevada IPA" />
1808
- * </List>
1809
- * );
1810
- * }
1811
- * ```
1812
- */
1813
- light: PropTypes.Validator<string>;
1814
- dark: PropTypes.Validator<string>;
1815
- }>>;
1816
- /**
1817
- * Displays {@link List.Section} or {@link List.Item}.
1818
- *
1819
- * @remarks
1820
- * The list uses built-in filtering by indexing the title of list items and additionally keywords.
1821
- *
1822
- * @example
1823
- * ```typescript
1824
- *
1825
- *
1826
- * export default function Command() {
1827
- * return (
1828
- * <List navigationTitle="Search Beers" searchBarPlaceholder="Search your favorite beer">
1829
- * <List.Item title="Augustiner Helles" />
1830
- * <List.Item title="Camden Hells" />
1831
- * <List.Item title="Leffe Blonde" />
1832
- * <List.Item title="Sierra Nevada IPA" />
1833
- * </List>
1834
- * );
1835
- * }
1836
- * ```
1837
- */
1838
- mask: PropTypes.Requireable<Image.Mask>;
1839
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
1840
- light: PropTypes.Validator<string>;
1841
- dark: PropTypes.Validator<string>;
1842
- adjustContrast: PropTypes.Requireable<boolean>;
1843
- }>>;
1844
- }>>;
1845
- };
1846
- var displayName: string;
1847
- }
1848
- export namespace List {
1849
- /**
1850
- * A item in the {@link List}.
1851
- *
1852
- * @remarks
1853
- * This is one of the foundational UI components of Raycast. A list item represents a single entity. It can be a
1854
- * GitHub pull request, a file, or anything else. You most likely want to perform actions on this item, so make it clear
1855
- * to the user what this list item is about.
1856
- *
1857
- * @example
1858
- * ```typescript
1859
- *
1860
- *
1861
- * export default function Command() {
1862
- * return (
1863
- * <List>
1864
- * <List.Item icon={Icon.Star} title="Augustiner Helles" subtitle="0,5 Liter" accessoryTitle="Germany" />
1865
- * </List>
1866
- * );
1867
- * }
1868
- * ```
1869
- */
1870
- const Item: typeof ListItem;
1871
- /**
1872
- * A group of related {@link List.Item}.
1873
- *
1874
- * @remarks
1875
- * Sections are a great way to structure your list. For example, group GitHub issues with the same status and order them by priority.
1876
- * This way, users can quickly access what is most relevant.
1877
- *
1878
- * @example
1879
- * ```typescript
1880
- *
1881
- *
1882
- * export default function Command() {
1883
- * return (
1884
- * <List>
1885
- * <List.Section title="Lager">
1886
- * <List.Item title="Camden Hells" />
1887
- * </List.Section>
1888
- * <List.Section title="IPA">
1889
- * <List.Item title="Sierra Nevada IPA" />
1890
- * </List.Section>
1891
- * </List>
1892
- * );
1893
- * }
1894
- * ```
1895
- */
1896
- const Section: typeof ListSection;
1897
- /**
1898
- * Props of the {@link List} React component.
1899
- */
1900
- interface Props extends ActionsInterface, NavigationChildInterface {
1901
- /**
1902
- * List sections or items. If {@link List.Item} elements are specified, a default section is automatically created.
1903
- */
1904
- children?: ReactNode;
1905
- /**
1906
- * Callback triggered when the item selection in the list changes.
1907
- */
1908
- onSelectionChange?: (id?: string) => void;
1909
- /**
1910
- * Placeholder text that will be shown in the search bar.
1911
- *
1912
- * @defaultValue Search value...
1913
- */
1914
- searchBarPlaceholder?: string;
1915
- /**
1916
- * Selects the item with the specified id.
1917
- */
1918
- selectedItemId?: string;
1919
- /**
1920
- * Defines whether the {@link ListProps.onSearchTextChange} will be triggered on every keyboard press or with a delay for throttling the events.
1921
- * Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests).
1922
- * @defaultValue false
1923
- */
1924
- throttle?: boolean;
1925
- /**
1926
- * Callback triggered when the search bar text changes.
1927
- * Note that built-in list filtering will be disabled when this callback is set.
1928
- */
1929
- onSearchTextChange?: (text: string) => void;
1930
- }
1931
- namespace Item {
1932
- /**
1933
- * Props of the {@link List.Item} React component.
1934
- */
1935
- interface Props extends ActionsInterface {
1936
- /**
1937
- * ID of the item.
1938
- * Make sure to assign each item a unique ID or a UUID will be auto generated.
1939
- */
1940
- id?: string;
1941
- /**
1942
- * The main title displayed for that item.
1943
- */
1944
- title: string;
1945
- /**
1946
- * An optional subtitle displayed next to the main title.
1947
- */
1948
- subtitle?: string;
1949
- /**
1950
- * An additional title displayed for the item.
1951
- */
1952
- accessoryTitle?: string;
1953
- /**
1954
- * An optional property used for providing additional indexable strings for search.
1955
- * When filtering the list in Raycast through the search bar, the keywords will be searched in addition to the title.
1956
- */
1957
- keywords?: string[];
1958
- /**
1959
- * A optional icon displayed for the list item.
1960
- */
1961
- icon?: Image.ImageLike;
1962
- /**
1963
- * A optional icon displayed as accessory for the list item.
1964
- */
1965
- accessoryIcon?: Image.ImageLike;
1966
- /**
1967
- * An {@link ActionPanel} that will be updated for the selected list item.
1968
- */
1969
- actions?: ReactNode | null;
1970
- }
1971
- }
1972
- namespace Section {
1973
- /**
1974
- * Props of the {@link List.Section} React component.
1975
- */
1976
- interface Props {
1977
- /**
1978
- * The {@link List.Item} elements of the section.
1979
- */
1980
- children?: ReactNode;
1981
- /**
1982
- * ID of the section.
1983
- * Make sure to assign each section a unique ID or a UUID will be auto generated.
1984
- */
1985
- id?: string;
1986
- /**
1987
- * Title displayed above the section.
1988
- */
1989
- title?: string;
1990
- /**
1991
- * An optional subtitle displayed next to the title of the section.
1992
- */
1993
- subtitle?: string;
1994
- }
1995
- }
1996
- }
1997
- export {};
1998
-
1999
-
2000
-
2001
-
2002
-
2003
-
2004
-
2005
-
2006
-
2007
-
2008
-
2009
-
2010
-
2011
- /**
2012
- * A context-specific action that can be performed by the user.
2013
- *
2014
- * @remarks
2015
- * Assign keyboard shortcuts to items to make it easier for users to perform frequently used actions.
2016
- *
2017
- * @example
2018
- * ```typescript
2019
- *
2020
- *
2021
- * export default function Command() {
2022
- * return (
2023
- * <List navigationTitle="Open Pull Requests">
2024
- * <List.Item
2025
- * title="Docs: Update API Reference"
2026
- * subtitle="#1"
2027
- * actions={
2028
- * <ActionPanel title="#1 in raycast/extensions">
2029
- * <Action.OpenInBrowser url="https://github.com/raycast/extensions/pull/1" />
2030
- * <Action.CopyToClipboard title="Copy Pull Request Number" content="#1" />
2031
- * <Action title="Close Pull Request" onAction={() => console.log("Close PR #1")} />
2032
- * </ActionPanel>
2033
- * }
2034
- * />
2035
- * </List>
2036
- * );
2037
- * }
2038
- * ```
2039
- */
2040
- export function Action(props: Action.Props): ReactElement<Action.Props>;
2041
- export namespace Action {
2042
- var propTypes: {
2043
- id: PropTypes.Requireable<string>;
2044
- title: PropTypes.Validator<string>;
2045
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
2046
- fileIcon: PropTypes.Validator<string>;
2047
- }>> | PropTypes.InferProps<{
2048
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
2049
- light: PropTypes.Validator<string>;
2050
- dark: PropTypes.Validator<string>;
2051
- }>>;
2052
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
2053
- light: PropTypes.Validator<string>;
2054
- dark: PropTypes.Validator<string>;
2055
- }>>;
2056
- mask: PropTypes.Requireable<Image.Mask>;
2057
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
2058
- light: PropTypes.Validator<string>;
2059
- dark: PropTypes.Validator<string>;
2060
- adjustContrast: PropTypes.Requireable<boolean>;
2061
- }>>;
2062
- }>>;
2063
- shortcut: PropTypes.Requireable<Required<PropTypes.InferProps<{
2064
- modifiers: PropTypes.Validator<string[]>;
2065
- key: PropTypes.Validator<string>;
2066
- }>>>;
2067
- onAction: PropTypes.Requireable<(...args: any[]) => any>;
2068
- };
2069
- var displayName: string;
2070
- }
2071
- export namespace Action {
2072
- /**
2073
- * Action that copies the content to the clipboard.
2074
- *
2075
- * @remarks
2076
- * The main window is closed, and a HUD is shown after the content was copied to the clipboard.
2077
- *
2078
- * @example
2079
- * ```typescript
2080
- *
2081
- *
2082
- * export default function Command() {
2083
- * return (
2084
- * <Detail
2085
- * markdown="Press `⌘ + .` and share some love."
2086
- * actions={
2087
- * <ActionPanel>
2088
- * <Action.CopyToClipboard content="I ❤️ Raycast" shortcut={{ modifiers: ["cmd"], key: "." }} />
2089
- * </ActionPanel>
2090
- * }
2091
- * />
2092
- * );
2093
- * }
2094
- * ```
2095
- */
2096
- const CopyToClipboard: typeof CopyToClipboardAction;
2097
- /**
2098
- * An action to open a file or folder with a specific application, just as if you had double-clicked the
2099
- * file's icon.
2100
- *
2101
- * @remarks
2102
- * The main window is closed after the file is opened.
2103
- *
2104
- * @example
2105
- * ```typescript
2106
- *
2107
- *
2108
- * export default function Command() {
2109
- * return (
2110
- * <Detail
2111
- * markdown="Check out your extension code."
2112
- * actions={
2113
- * <ActionPanel>
2114
- * <Action.Open title="Open Folder" target={__dirname} />
2115
- * </ActionPanel>
2116
- * }
2117
- * />
2118
- * );
2119
- * }
2120
- * ```
2121
- */
2122
- const Open: typeof OpenAction;
2123
- /**
2124
- * Action that opens a URL in the default browser.
2125
- *
2126
- * @remarks
2127
- * The main window is closed after the URL is opened in the browser.
2128
- *
2129
- * @example
2130
- * ```typescript
2131
- *
2132
- *
2133
- * export default function Command() {
2134
- * return (
2135
- * <Detail
2136
- * markdown="Join the gang!"
2137
- * actions={
2138
- * <ActionPanel>
2139
- * <Action.OpenInBrowser url="https://raycast.com/jobs" />
2140
- * </ActionPanel>
2141
- * }
2142
- * />
2143
- * );
2144
- * }
2145
- * ```
2146
- */
2147
- const OpenInBrowser: typeof OpenInBrowserAction;
2148
- /**
2149
- * Action that opens a file or folder with a specific application.
2150
- *
2151
- * @remarks
2152
- * The action opens a sub-menu with all applications that can open the file or folder.
2153
- * The main window is closed after the file is opened in the specified application.
2154
- *
2155
- * @example
2156
- * ```typescript
2157
- *
2158
- *
2159
- *
2160
- * const DESKTOP_DIR = `${homedir()}/Desktop`;
2161
- *
2162
- * export default function Command() {
2163
- * return (
2164
- * <Detail
2165
- * markdown="What do you want to use to open your desktop with?"
2166
- * actions={
2167
- * <ActionPanel>
2168
- * <Action.OpenWith path={DESKTOP_DIR} />
2169
- * </ActionPanel>
2170
- * }
2171
- * />
2172
- * );
2173
- * }
2174
- * ```
2175
- */
2176
- const OpenWith: typeof OpenWithAction;
2177
- /**
2178
- * Action that pastes the content to the front-most applications.
2179
- *
2180
- * @remarks
2181
- * The main window is closed after the content is pasted to the front-most application.
2182
- *
2183
- * @example
2184
- * ```typescript
2185
- *
2186
- *
2187
- * export default function Command() {
2188
- * return (
2189
- * <Detail
2190
- * markdown="Let us know what you think about the Raycast API?"
2191
- * actions={
2192
- * <ActionPanel>
2193
- * <Action.Paste content="api@raycast.com" />
2194
- * </ActionPanel>
2195
- * }
2196
- * />
2197
- * );
2198
- * }
2199
- * ```
2200
- */
2201
- const Paste: typeof PasteAction;
2202
- /**
2203
- * Action that pushes a new view to the navigation stack.
2204
- *
2205
- * @example
2206
- * ```typescript
2207
- *
2208
- *
2209
- * function Ping() {
2210
- * return (
2211
- * <Detail
2212
- * markdown="Ping"
2213
- * actions={
2214
- * <ActionPanel>
2215
- * <Action.Push title="Push Pong" target={<Pong />} />
2216
- * </ActionPanel>
2217
- * }
2218
- * />
2219
- * );
2220
- * }
2221
- *
2222
- * function Pong() {
2223
- * return <Detail markdown="Pong" />;
2224
- * }
2225
- *
2226
- * export default function Command() {
2227
- * return <Ping />;
2228
- * }
2229
- * ```
2230
- */
2231
- const Push: typeof PushAction;
2232
- /**
2233
- * Action that shows a file or folder in the Finder.
2234
- *
2235
- * @remarks
2236
- * The main window is closed after the file or folder is revealed in the Finder.
2237
- *
2238
- * @example
2239
- * ```typescript
2240
- *
2241
- *
2242
- *
2243
- * const DOWNLOADS_DIR = `${homedir()}/Downloads`;
2244
- *
2245
- * export default function Command() {
2246
- * return (
2247
- * <Detail
2248
- * markdown="Are your downloads pilling up again?"
2249
- * actions={
2250
- * <ActionPanel>
2251
- * <Action.ShowInFinder path={DOWNLOADS_DIR} />
2252
- * </ActionPanel>
2253
- * }
2254
- * />
2255
- * );
2256
- * }
2257
- * ```
2258
- */
2259
- const ShowInFinder: typeof ShowInFinderAction;
2260
- /**
2261
- * Action that adds a submit handler for capturing form values.
2262
- *
2263
- * @example
2264
- * ```typescript
2265
- *
2266
- *
2267
- *
2268
- * export default function Command() {
2269
- * const [name, setName] = useState<string>();
2270
- *
2271
- * return (
2272
- * <Form
2273
- * actions={
2274
- * <ActionPanel>
2275
- * <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
2276
- * </ActionPanel>
2277
- * }
2278
- * >
2279
- * <Form.TextField id="name" value={name} onChange={setName} />
2280
- * </Form>
2281
- * );
2282
- * }
2283
- * ```
2284
- */
2285
- const SubmitForm: typeof SubmitFormAction;
2286
- /**
2287
- * Action that moves a file or folder to the Trash.
2288
- *
2289
- * @example
2290
- * ```typescript
2291
- *
2292
- *
2293
- *
2294
- * const FILE = `${homedir()}/Downloads/get-rid-of-me.txt`;
2295
- *
2296
- * export default function Command() {
2297
- * return (
2298
- * <Detail
2299
- * markdown="Some spring cleaning?"
2300
- * actions={
2301
- * <ActionPanel>
2302
- * <Action.Trash paths={FILE} />
2303
- * </ActionPanel>
2304
- * }
2305
- * />
2306
- * );
2307
- * }
2308
- * ```
2309
- */
2310
- const Trash: typeof TrashAction;
2311
- /**
2312
- * Props of the {@link Action} React component.
2313
- */
2314
- interface Props {
2315
- /**
2316
- * ID of the item.
2317
- *
2318
- * @remarks
2319
- * Make sure to assign each section or item a unique ID. If no ID is specified, a memoized auto-generated is used.
2320
- */
2321
- id?: string;
2322
- /**
2323
- * The title displayed for the item.
2324
- */
2325
- title: string;
2326
- /**
2327
- * The icon displayed for the action.
2328
- */
2329
- icon?: Image.ImageLike;
2330
- /**
2331
- * The keyboard shortcut for the item.
2332
- */
2333
- shortcut?: Keyboard.Shortcut;
2334
- /**
2335
- * Callback that is triggered when the item is selected.
2336
- */
2337
- onAction?: () => void;
2338
- }
2339
- namespace CopyToClipboard {
2340
- /**
2341
- * Props of the {@link Action.CopyToClipboard} React component.
2342
- */
2343
- type Props = CopyToClipboardActionProps;
2344
- }
2345
- namespace Open {
2346
- /**
2347
- * Props of the {@link Action.Open} React component.
2348
- */
2349
- type Props = OpenActionProps;
2350
- }
2351
- namespace OpenInBrowser {
2352
- /**
2353
- * Props of the {@link Action.OpenInBrowser} React component.
2354
- */
2355
- type Props = OpenInBrowserActionProps;
2356
- }
2357
- namespace OpenWith {
2358
- /**
2359
- * Props of the {@link Action.OpenWith} React component.
2360
- */
2361
- type Props = OpenWithActionProps;
2362
- }
2363
- namespace Paste {
2364
- /**
2365
- * Props of the {@link Action.Paste} React component.
2366
- */
2367
- type Props = PasteActionProps;
2368
- }
2369
- namespace Push {
2370
- /**
2371
- * Props of the {@link Action.Push} React component.
2372
- */
2373
- type Props = PushActionProps;
2374
- }
2375
- namespace ShowInFinder {
2376
- /**
2377
- * Props of the {@link Action.ShowInFinder} React component.
2378
- */
2379
- type Props = ShowInFinderActionProps;
2380
- }
2381
- namespace SubmitForm {
2382
- /**
2383
- * Props of the {@link Action.SubmitForm} React component.
2384
- */
2385
- type Props<T> = SubmitFormActionProps<T>;
2386
- }
2387
- namespace Trash {
2388
- /**
2389
- * Props of the {@link Action.Trash} React component.
2390
- */
2391
- type Props = TrashActionProps;
2392
- }
2393
- }
2394
-
2395
-
2396
-
2397
- /**
2398
- * See {@link Action.CopyToClipboard.Props}
2399
- */
2400
- export interface CopyToClipboardActionProps {
2401
- /**
2402
- * The contents that will be written to the clipboard as string.
2403
- */
2404
- content: string | number;
2405
- /**
2406
- * An optional title for the action.
2407
- */
2408
- title?: string;
2409
- /**
2410
- * A optional icon displayed for the item.
2411
- * @defaultValue {@link Icon.Clipboard}
2412
- */
2413
- icon?: Image.ImageLike;
2414
- /**
2415
- * The keyboard shortcut for the action.
2416
- */
2417
- shortcut?: Keyboard.Shortcut;
2418
- /**
2419
- * Callback when the content was copied to clipboard.
2420
- *
2421
- * @remarks
2422
- * This is handy when you want to act on the copied content, e.g. up-rank recently copied content.
2423
- */
2424
- onCopy?: (content: string | number) => void;
2425
- }
2426
- /**
2427
- * See {@link Action.CopyToClipboard}
2428
- */
2429
- export function CopyToClipboardAction(props: CopyToClipboardActionProps): ReactElement<CopyToClipboardActionProps>;
2430
- export namespace CopyToClipboardAction {
2431
- var displayName: string;
2432
- }
2433
-
2434
-
2435
-
2436
- /**
2437
- * See {@link Action.Open.Props}
2438
- */
2439
- export interface OpenActionProps {
2440
- /**
2441
- * The file, folder or URL to open.
2442
- */
2443
- target: string;
2444
- /**
2445
- * The application name to use for opening the file.
2446
- *
2447
- * @remarks
2448
- * If no application is specified, the default application as determined by the system is used to open the
2449
- * specified file. Note that you can use the application name, app identifier, or absolute path to the app.
2450
- */
2451
- application?: Application | string;
2452
- /**
2453
- * The title for the action.
2454
- */
2455
- title: string;
2456
- /**
2457
- * The icon displayed for the action.
2458
- * @defaultValue {@link Icon.Finder}
2459
- */
2460
- icon?: Image.ImageLike;
2461
- /**
2462
- * The keyboard shortcut for the action.
2463
- */
2464
- shortcut?: Keyboard.Shortcut;
2465
- /**
2466
- * Callback when the file or folder was opened.
2467
- *
2468
- * @remarks
2469
- * This is handy when you want to act on an opened file or folder, e.g. store a history of opened items.
2470
- */
2471
- onOpen?: (target: string) => void;
2472
- }
2473
- /**
2474
- * See {@link Action.Open}
2475
- */
2476
- export function OpenAction(props: OpenActionProps): ReactElement<OpenActionProps>;
2477
- export namespace OpenAction {
2478
- var displayName: string;
2479
- }
2480
-
2481
-
2482
-
2483
- /**
2484
- * See {@link Action.OpenInBrowser.Props}
2485
- */
2486
- export interface OpenInBrowserActionProps {
2487
- /**
2488
- * The URL to open.
2489
- */
2490
- url: string;
2491
- /**
2492
- * An optional title for the action.
2493
- */
2494
- title?: string;
2495
- /**
2496
- * The icon displayed for the action.
2497
- * @defaultValue {@link Icon.Globe}
2498
- */
2499
- icon?: Image.ImageLike;
2500
- /**
2501
- * The optional keyboard shortcut for the menu item
2502
- */
2503
- shortcut?: Keyboard.Shortcut;
2504
- /**
2505
- * Callback when the URL was opened in the browser.
2506
- *
2507
- * @remarks
2508
- * This is handy when you want to act on the opened link, e.g. store a history of visited links.
2509
- */
2510
- onOpen?: (url: string) => void;
2511
- }
2512
- /**
2513
- * See {@link Action.OpenInBrowser}
2514
- */
2515
- export function OpenInBrowserAction(props: OpenInBrowserActionProps): ReactElement<OpenInBrowserActionProps>;
2516
- export namespace OpenInBrowserAction {
2517
- var displayName: string;
2518
- }
2519
- export namespace OpenInBrowserAction {
2520
- type Props = OpenInBrowserActionProps;
2521
- }
2522
-
2523
-
2524
-
2525
- /**
2526
- * See {@link Action.OpenWith.Props}
2527
- */
2528
- export interface OpenWithActionProps {
2529
- /**
2530
- * The path to open.
2531
- */
2532
- path: string;
2533
- /**
2534
- * The title for the action.
2535
- * @defaultValue Open With
2536
- */
2537
- title?: string;
2538
- /**
2539
- * The icon displayed for the action.
2540
- * @defaultValue {@link Icon.Upload}
2541
- */
2542
- icon?: Image.ImageLike;
2543
- /**
2544
- * The keyboard shortcut for the action.
2545
- */
2546
- shortcut?: Keyboard.Shortcut;
2547
- /**
2548
- * Callback when the file or folder was opened.
2549
- *
2550
- * @remarks
2551
- * This is handy when you want to act on an opened file or folder, e.g. store a history of opened items.
2552
- */
2553
- onOpen?: (path: string) => void;
2554
- }
2555
- /**
2556
- * See {@link Action.OpenWith}
2557
- */
2558
- export function OpenWithAction(props: OpenWithActionProps): ReactElement<OpenWithActionProps>;
2559
- export namespace OpenWithAction {
2560
- var displayName: string;
2561
- }
2562
-
2563
-
2564
-
2565
- /**
2566
- * See {@link Action.Paste.Props}
2567
- */
2568
- export interface PasteActionProps {
2569
- /**
2570
- * The contents that will be written to the clipboard as string.
2571
- */
2572
- content: string | number;
2573
- /**
2574
- * An optional title for the action.
2575
- */
2576
- title?: string;
2577
- /**
2578
- * The icon displayed for the action.
2579
- * @defaultValue {@link Icon.Clipboard}
2580
- */
2581
- icon?: Image.ImageLike;
2582
- /**
2583
- * The keyboard shortcut for the action.
2584
- */
2585
- shortcut?: Keyboard.Shortcut;
2586
- /**
2587
- * Callback when the content was pasted into the front-most application.
2588
- *
2589
- * @remarks
2590
- * This is handy when you want to act on the pasted content, e.g. up-rank recently pasted content.
2591
- */
2592
- onPaste?: (content: string | number) => void;
2593
- }
2594
- /**
2595
- * See {@link Action.Paste.Props}
2596
- */
2597
- export function PasteAction(props: PasteActionProps): ReactElement<PasteActionProps>;
2598
- export namespace PasteAction {
2599
- var displayName: string;
2600
- }
2601
-
2602
-
2603
-
2604
- /**
2605
- * See {@link Action.Push.Props}
2606
- */
2607
- export interface PushActionProps {
2608
- /**
2609
- * The title displayed for the item.
2610
- */
2611
- title: string;
2612
- /**
2613
- * The target view that will be pushed to the navigation stack.
2614
- */
2615
- target: ReactNode;
2616
- /**
2617
- * The icon displayed for the action.
2618
- */
2619
- icon?: Image.ImageLike;
2620
- /**
2621
- * The keyboard shortcut for the action.
2622
- */
2623
- shortcut?: Keyboard.Shortcut;
2624
- /**
2625
- * Callback when the target view was pushed.
2626
- *
2627
- * @remarks
2628
- * This is handy when you want to act on the pushed target view, e.g. uprank a selected list item.
2629
- */
2630
- onPush?: () => void;
2631
- }
2632
- /**
2633
- * See {@link Action.Push.Props}
2634
- */
2635
- export function PushAction(props: PushActionProps): ReactElement<PushActionProps>;
2636
- export namespace PushAction {
2637
- var displayName: string;
2638
- }
2639
- /// <reference types="node" />
2640
-
2641
-
2642
-
2643
-
2644
- /**
2645
- * See {@link Action.ShowInFinder.Props}
2646
- */
2647
- export interface ShowInFinderActionProps {
2648
- /**
2649
- * The path to open.
2650
- */
2651
- path: PathLike;
2652
- /**
2653
- * An optional title for the action.
2654
- * @defaultValue Show in Finder
2655
- */
2656
- title?: string;
2657
- /**
2658
- * A optional icon displayed for the item.
2659
- * @defaultValue {@link Icon.Finder}
2660
- */
2661
- icon?: Image.ImageLike;
2662
- /**
2663
- * The keyboard shortcut for the action.
2664
- */
2665
- shortcut?: Keyboard.Shortcut;
2666
- /**
2667
- * Callback when the file or folder was shown in the Finder.
2668
- *
2669
- * @remarks
2670
- * This is handy when you want to act on revealed files or folders, e.g. up-rank recently opened items.
2671
- */
2672
- onShow?: (path: PathLike) => void;
2673
- }
2674
- /**
2675
- * See {@link Action.ShowInFinder.Props}
2676
- */
2677
- export function ShowInFinderAction(props: ShowInFinderActionProps): ReactElement<ShowInFinderActionProps>;
2678
- export namespace ShowInFinderAction {
2679
- var displayName: string;
2680
- }
2681
-
2682
-
2683
-
2684
-
2685
- /**
2686
- * See {@link Action.SubmitForm.Props}
2687
- */
2688
- export interface SubmitFormActionProps<Values> {
2689
- /**
2690
- * The title displayed for the item.
2691
- */
2692
- title?: string;
2693
- /**
2694
- * The icon displayed for the action.
2695
- */
2696
- icon?: Image.ImageLike;
2697
- /**
2698
- * The keyboard shortcut for the action.
2699
- */
2700
- shortcut?: Keyboard.Shortcut;
2701
- /**
2702
- * Callback that is triggered when the submit was submitted.
2703
- * Use the handler to perform custom validation logic and call other Raycast API methods.
2704
- * The handler receives a the values object containing the user input.
2705
- */
2706
- onSubmit?: (input: Values) => void;
2707
- }
2708
- /**
2709
- * See {@link Action.SubmitForm.Props}
2710
- */
2711
- export function SubmitFormAction<Values extends Form.Values = Form.Values>(props: SubmitFormActionProps<Values>): ReactElement<SubmitFormActionProps<Values>>;
2712
- export namespace SubmitFormAction {
2713
- var displayName: string;
2714
- }
2715
- /// <reference types="node" />
2716
-
2717
-
2718
-
2719
-
2720
- /**
2721
- * See {@link Action.Trash.Props}
2722
- */
2723
- export interface TrashActionProps {
2724
- /**
2725
- * The item or items to move to the trash.
2726
- */
2727
- paths: PathLike | PathLike[];
2728
- /**
2729
- * An optional title for the action.
2730
- * @defaultValue Move to Trash
2731
- */
2732
- title?: string;
2733
- /**
2734
- * A optional icon displayed for the action.
2735
- * @defaultValue {@link Icon.Trash}
2736
- */
2737
- icon?: Image.ImageLike;
2738
- /**
2739
- * The optional keyboard shortcut for the action.
2740
- */
2741
- shortcut?: Keyboard.Shortcut;
2742
- /**
2743
- * Callback when all items were moved to the trash.
2744
- *
2745
- * @remarks
2746
- * This is handy when you want to act on a trashed item, e.g. update a list.
2747
- * The callback returns the same `paths` as passed originally.
2748
- */
2749
- onTrash?: (paths: PathLike | PathLike[]) => void;
2750
- }
2751
- /**
2752
- * See {@link Action.Trash}
2753
- */
2754
- export function TrashAction(props: TrashActionProps): ReactElement<TrashActionProps>;
2755
- export namespace TrashAction {
2756
- var displayName: string;
2757
- }
2758
-
2759
- /**
2760
- * Views that can be embedded in a navigation stack, show a navigation title and support a loading bar.
2761
- * @category User Interface
2762
- */
2763
- export interface NavigationChildInterface {
2764
- /**
2765
- *
2766
- * The main title for that view displayed in Raycast
2767
- *
2768
- * @defaultValue Command title
2769
- */
2770
- navigationTitle?: string;
2771
- /**
2772
- * Indicates whether a loading bar should be shown or hidden below the search bar
2773
- *
2774
- * @defaultValue false
2775
- */
2776
- isLoading?: boolean;
2777
- }
2778
- /**
2779
- * Components that support an Action Panel.
2780
- * @category User Interface
2781
- */
2782
- export interface ActionsInterface {
2783
- /**
2784
- * A reference to an {@link ActionPanel}.
2785
- */
2786
- actions?: ReactNode;
2787
- }
2788
-
2789
-
2790
-
2791
-
2792
-
2793
- /*********************************
2794
- * Deprecated on v1.28.0
2795
- *********************************/
2796
- /**
2797
- * @deprecated Use `Clipboard.copy` instead
2798
- */
2799
- export const copyTextToClipboard: typeof Clipboard.copy;
2800
- /**
2801
- * @deprecated Use `Clipboard.clear` instead
2802
- */
2803
- export const clearClipboard: typeof Clipboard.clear;
2804
- /**
2805
- * @deprecated Use `Clipboard.paste` instead
2806
- */
2807
- export const pasteText: typeof Clipboard.paste;
2808
- /**
2809
- * @deprecated Use `LocalStorage.allItems` instead
2810
- */
2811
- export const allLocalStorageItems: typeof LocalStorage.allItems;
2812
- /**
2813
- * @deprecated Use `LocalStorage.getItem` instead
2814
- */
2815
- export const getLocalStorageItem: typeof LocalStorage.getItem;
2816
- /**
2817
- * @deprecated Use `LocalStorage.setItem` instead
2818
- */
2819
- export const setLocalStorageItem: typeof LocalStorage.setItem;
2820
- /**
2821
- * @deprecated Use `LocalStorage.removeItem` instead
2822
- */
2823
- export const removeLocalStorageItem: typeof LocalStorage.removeItem;
2824
- /**
2825
- * @deprecated Use `LocalStorage.clear` instead
2826
- */
2827
- export const clearLocalStorage: typeof LocalStorage.clear;
2828
- /**
2829
- * @deprecated Use `LocalStorage.Value` instead
2830
- */
2831
- export type LocalStorageValue = LocalStorage.Value;
2832
- /**
2833
- * @deprecated Use `LocalStorage.Values` instead
2834
- */
2835
- export interface LocalStorageValues extends LocalStorage.Values {
2836
- }
2837
- /**
2838
- * @deprecated Use `Keyboard.Shortcut` instead
2839
- */
2840
- export interface KeyboardShortcut extends Keyboard.Shortcut {
2841
- }
2842
- /**
2843
- * @deprecated Use `Keyboard.specialKeys` instead
2844
- */
2845
- export const specialKeys: Record<string, string>;
2846
- /**
2847
- * @deprecated Use `Keyboard.KeyModifier` instead
2848
- */
2849
- export type KeyModifier = Keyboard.KeyModifier;
2850
- /**
2851
- * @deprecated Use `Keyboard.KeyEquivalent` instead
2852
- */
2853
- export type KeyEquivalent = Keyboard.KeyEquivalent;
2854
- /**
2855
- * @deprecated Use `getPreferenceValues()` instead.
2856
- */
2857
- export type Preferences = _Preferences;
2858
- /**
2859
- * @deprecated Use `getPreferenceValues()` instead.
2860
- */
2861
- export interface Preference extends _Preference {
2862
- }
2863
- /**
2864
- * @deprecated Use `getPreferenceValues()` instead.
2865
- */
2866
- export const preferences: _Preferences;
2867
- /**
2868
- * @deprecated Use `Action.CopyToClipboard` instead.
2869
- */
2870
- export const CopyToClipboardAction: typeof import("./components/actions/CopyToClipboardAction").CopyToClipboardAction;
2871
- /**
2872
- * @deprecated Use `Action.CopyToClipboard.Props` instead.
2873
- */
2874
- export interface CopyToClipboardActionProps extends Action.CopyToClipboard.Props {
2875
- }
2876
- /**
2877
- * @deprecated Use `Action.Open` instead.
2878
- */
2879
- export const OpenAction: typeof import("./components/actions/OpenAction").OpenAction;
2880
- /**
2881
- * @deprecated Use `Action.Open.Props` instead.
2882
- */
2883
- export interface OpenActionProps extends Action.Open.Props {
2884
- }
2885
- /**
2886
- * @deprecated Use `Action.OpenInBrowserIn` instead.
2887
- */
2888
- export const OpenInBrowserAction: typeof import("./components/actions/OpenInBrowserAction").OpenInBrowserAction;
2889
- /**
2890
- * @deprecated Use `Action.OpenInBrowser.Props` instead.
2891
- */
2892
- export interface OpenInBrowserActionProps extends Action.OpenInBrowser.Props {
2893
- }
2894
- /**
2895
- * @deprecated Use `Action.OpenWith` instead.
2896
- */
2897
- export const OpenWithAction: typeof import("./components/actions/OpenWithAction").OpenWithAction;
2898
- /**
2899
- * @deprecated Use `Action.OpenWith.Props` instead.
2900
- */
2901
- export interface OpenWithActionProps extends Action.OpenWith.Props {
2902
- }
2903
- /**
2904
- * @deprecated Use `Action.Paste` instead.
2905
- */
2906
- export const PasteAction: typeof import("./components/actions/PasteAction").PasteAction;
2907
- /**
2908
- * @deprecated Use `Action.Paste.Props` instead.
2909
- */
2910
- export interface PasteActionProps extends Action.Paste.Props {
2911
- }
2912
- /**
2913
- * @deprecated Use `Action.Push` instead.
2914
- */
2915
- export const PushAction: typeof import("./components/actions/PushAction").PushAction;
2916
- /**
2917
- * @deprecated Use `Action.Push.Props` instead.
2918
- */
2919
- export interface PushActionProps extends Action.Push.Props {
2920
- }
2921
- /**
2922
- * @deprecated Use `Action.ShowInFinder` instead.
2923
- */
2924
- export const ShowInFinderAction: typeof import("./components/actions/ShowInFinderAction").ShowInFinderAction;
2925
- /**
2926
- * @deprecated Use `Action.ShowInFinder.Props` instead.
2927
- */
2928
- export interface ShowInFinderActionProps extends Action.ShowInFinder.Props {
2929
- }
2930
- /**
2931
- * @deprecated Use `Action.SubmitForm` instead.
2932
- */
2933
- export const SubmitFormAction: typeof import("./components/actions/SubmitFormAction").SubmitFormAction;
2934
- /**
2935
- * @deprecated Use `Action.SunmitForm.Props` instead.
2936
- */
2937
- export interface SubmitFormActionProps<T> extends Action.SubmitForm.Props<T> {
2938
- }
2939
- /**
2940
- * @deprecated Use `Action.Trash` instead.
2941
- */
2942
- export const TrashAction: typeof import("./components/actions/TrashAction").TrashAction;
2943
- /**
2944
- * @deprecated Use `Action.Trash.Props` instead.
2945
- */
2946
- export interface TrashActionProps extends Action.Trash.Props {
2947
- }
2948
- /**
2949
- * @deprecated Use `ActionPanel.Props` instead.
2950
- */
2951
- export interface ActionPanelProps extends ActionPanel.Props {
2952
- }
2953
- /**
2954
- * @deprecated Use `ActionPanel.Children` instead.
2955
- */
2956
- export type ActionPanelChildren = ActionPanel.Children;
2957
- /**
2958
- * @deprecated Use `Action` instead.
2959
- */
2960
- export const ActionPanelItem: typeof Action;
2961
- /**
2962
- * @deprecated Use `Action.Props` instead.
2963
- */
2964
- export interface ActionPanelItemProps extends Action.Props {
2965
- }
2966
- /**
2967
- * @deprecated Use `ActionPanel.Submenu` instead.
2968
- */
2969
- export const ActionPanelSubmenu: typeof ActionPanel.Submenu;
2970
- /**
2971
- * @deprecated Use `ActionPanel.Submenu.Props` instead.
2972
- */
2973
- export interface ActionPanelSubmenuProps extends ActionPanel.Submenu.Props {
2974
- }
2975
- /**
2976
- * @deprecated Use `ActionPanel.Section` instead.
2977
- */
2978
- export const ActionPanelSection: typeof ActionPanel.Section;
2979
- /**
2980
- * @deprecated Use `ActionPanel.Section.Props` instead.
2981
- */
2982
- export interface ActionPanelSectionProps extends ActionPanel.Section.Props {
2983
- }
2984
- /**
2985
- * @deprecated Use `ActionPanel.Section.Children` instead.
2986
- */
2987
- export type ActionPanelSectionChildren = ActionPanel.Section.Children;
2988
- /**
2989
- * @deprecated Use `Detail.Props` instead.
2990
- */
2991
- export interface DetailProps extends Detail.Props {
2992
- }
2993
- /**
2994
- * @deprecated Use `Form.Value` instead.
2995
- */
2996
- export type FormValue = Form.Value;
2997
- /**
2998
- * @deprecated Use `Form.Values` instead.
2999
- */
3000
- export interface FormValues extends Form.Values {
3001
- }
3002
- /**
3003
- * @deprecated Use `Form.Props` instead.
3004
- */
3005
- export interface FormProps extends Form.Props {
3006
- }
3007
- /**
3008
- * @deprecated Use `Form.ItemProps` instead.
3009
- */
3010
- export interface FormItemProps<Value extends Form.Value> extends Form.ItemProps<Value> {
3011
- }
3012
- /**
3013
- * @deprecated Use `Form.Dropdown.Section` instead.
3014
- */
3015
- export const FormDropdownSection: typeof Form.Dropdown.Section;
3016
- /**
3017
- * @deprecated Use `Form.Dropdown.Section.Props` instead.
3018
- */
3019
- export interface FormDropdownSectionProps extends Form.Dropdown.Section.Props {
3020
- }
3021
- /**
3022
- * @deprecated Use `Form.Dropdown.Item` instead.
3023
- */
3024
- export const FormDropdownItem: typeof Form.Dropdown.Item;
3025
- /**
3026
- * @deprecated Use `Form.Dropdown.Item.Props` instead.
3027
- */
3028
- export interface FormDropdownItemProps extends Form.Dropdown.Item.Props {
3029
- }
3030
- /**
3031
- * @deprecated Use `Form.TagPicker.Item` instead.
3032
- */
3033
- export const FormTagPickerItem: typeof Form.TagPicker.Item;
3034
- /**
3035
- * @deprecated Use `Form.TagPicker.Item.Props` instead.
3036
- */
3037
- export interface FormTagPickerItemProps extends Form.TagPicker.Item.Props {
3038
- }
3039
- /**
3040
- * @deprecated Use `Form.TextField` instead.
3041
- */
3042
- export const FormTextField: typeof Form.TextField;
3043
- /**
3044
- * @deprecated Use `Form.TextField.Props` instead.
3045
- */
3046
- export interface FormTextFieldProps extends Form.TextField.Props {
3047
- }
3048
- /**
3049
- * @deprecated Use `Form.TextArea` instead.
3050
- */
3051
- export const FormTextArea: typeof Form.TextArea;
3052
- /**
3053
- * @deprecated Use `Form.TextArea.Props` instead.
3054
- */
3055
- export interface FormTextAreaProps extends Form.TextArea.Props {
3056
- }
3057
- /**
3058
- * @deprecated Use `Form.Checkbox` instead.
3059
- */
3060
- export const FormCheckbox: typeof Form.Checkbox;
3061
- /**
3062
- * @deprecated Use `Form.Checkbox.Props` instead.
3063
- */
3064
- export interface FormCheckboxProps extends Form.Checkbox.Props {
3065
- }
3066
- /**
3067
- * @deprecated Use `Form.DatePicker` instead.
3068
- */
3069
- export const FormDatePicker: typeof Form.DatePicker;
3070
- /**
3071
- * @deprecated Use `Form.DatePicker.Props` instead.
3072
- */
3073
- export interface FormDatePickerProps extends Form.DatePicker.Props {
3074
- }
3075
- /**
3076
- * @deprecated Use `Form.Separator` instead.
3077
- */
3078
- export const FormSeparator: typeof Form.Separator;
3079
- /**
3080
- * @deprecated Use `Form.Separator.Props` instead.
3081
- */
3082
- export interface FormSeparatorProps extends Form.Separator.Props {
3083
- }
3084
- /**
3085
- * @deprecated Use `Form.Dropdown` instead.
3086
- */
3087
- export const FormDropdown: typeof Form.Dropdown;
3088
- /**
3089
- * @deprecated Use `Form.Dropdown.Props` instead.
3090
- */
3091
- export interface FormDropdownProps extends Form.Dropdown.Props {
3092
- }
3093
- /**
3094
- * @deprecated Use `Form.TagPicker` instead.
3095
- */
3096
- export const FormTagPicker: typeof Form.TagPicker;
3097
- /**
3098
- * @deprecated Use `Form.TagPicker.Props` instead.
3099
- */
3100
- export interface FormTagPickerProps extends Form.TagPicker.Props {
3101
- }
3102
- /**
3103
- * @deprecated Use `List.Props` instead.
3104
- */
3105
- export interface ListProps extends List.Props {
3106
- }
3107
- /**
3108
- * @deprecated Use `List.Section` instead.
3109
- */
3110
- export const ListSection: typeof List.Section;
3111
- /**
3112
- * @deprecated Use `List.Section.Props` instead.
3113
- */
3114
- export interface ListSectionProps extends List.Section.Props {
3115
- }
3116
- /**
3117
- * @deprecated Use `List.item` instead.
3118
- */
3119
- export const ListItem: typeof List.Item;
3120
- /**
3121
- * @deprecated Use `List.Item.Props` instead.
3122
- */
3123
- export interface ListItemProps extends List.Item.Props {
3124
- }
3125
- /**
3126
- * @deprecated Add `nanoid` as a dependency and use it instead.
3127
- */
3128
- export const randomId: typeof _randomId;
3129
- /**
3130
- * @deprecated
3131
- */
3132
- export const useId: typeof _useId;
3133
- /**
3134
- * @deprecated
3135
- */
3136
- export const useActionPanel: typeof _useActionPanel;
3137
- /**
3138
- * @deprecated
3139
- */
3140
- export interface ActionPanelState extends _ActionPanelState {
3141
- }
3142
- /**
3143
- * @deprecated Use `Alert.Options` instead
3144
- */
3145
- export interface AlertOptions extends Alert.Options {
3146
- }
3147
- /**
3148
- * @deprecated Use `Alert.ActionOptions` instead
3149
- */
3150
- export interface AlertActionOptions extends Alert.ActionOptions {
3151
- }
3152
- /**
3153
- * @deprecated Use `Alert.ActionStyle` instead
3154
- */
3155
- export const AlertActionStyle: typeof Alert.ActionStyle;
3156
- /**
3157
- * @deprecated Use `Toast.Options` instead
3158
- */
3159
- export interface ToastOptions extends _Toast.Options {
3160
- }
3161
- /**
3162
- * @deprecated Use `Toast.ActionOptions` instead
3163
- */
3164
- export interface ToastActionOptions extends _Toast.ActionOptions {
3165
- }
3166
- /**
3167
- * @deprecated Use `Toast.Style` instead
3168
- */
3169
- export const ToastStyle: typeof _Toast.Style;
3170
- /**
3171
- * @deprecated Use `Image.ImageLike` instead
3172
- */
3173
- export type ImageLike = Image.ImageLike;
3174
- /**
3175
- * @deprecated Use `Image.Source` instead
3176
- */
3177
- export type ImageSource = Image.Source;
3178
- /**
3179
- * @deprecated Use `Image.Mask` instead
3180
- */
3181
- export type ImageMask = Image.Mask;
3182
- /**
3183
- * @deprecated Use `Image.Mask` instead
3184
- */
3185
- export const ImageMask: typeof Image.Mask;
3186
- /**
3187
- * @deprecated Use `Color.Dynamic` instead
3188
- */
3189
- export type DynamicColor = Color.Dynamic;
3190
- /**
3191
- * @deprecated Use `Color.ColorLike` instead
3192
- */
3193
- export type ColorLike = Color.ColorLike;
3194
- /**
3195
- * @deprecated Use `export default function Command() { ... }` instead
3196
- */
3197
- export const render: typeof _render;
3198
- /**
3199
- * Holds data about the environment the command is running in. Use the global {@link environment} object to retrieve values.
3200
- */
3201
- export interface Environment {
3202
- /**
3203
- * The version of the main Raycast app
3204
- */
3205
- raycastVersion: string;
3206
- /**
3207
- * The name of the extension, as specified in package.json
3208
- */
3209
- extensionName: string;
3210
- /**
3211
- * The name of the launched command, as specified in package.json
3212
- */
3213
- commandName: string;
3214
- /**
3215
- * The absolute path to the assets directory of the extension.
3216
- *
3217
- * @remarks
3218
- * This directory is used internally to load icons, images, and other bundled assets.
3219
- */
3220
- assetsPath: string;
3221
- /**
3222
- * The absolute path for the support directory of an extension. Use it to read and write files related to your extension or command.
3223
- */
3224
- supportPath: string;
3225
- /**
3226
- * Indicates whether the command is a development command (vs. an installed command from the Store).
3227
- */
3228
- isDevelopment: boolean;
3229
- }
3230
- /**
3231
- * Contains environment values such as the Raycast version, extension info, and paths.
3232
- *
3233
- * @example
3234
- * ```typescript
3235
- *
3236
- *
3237
- * console.log(`Raycast version: ${environment.raycastVersion}`);
3238
- * console.log(`Extension name: ${environment.extensionName}`);
3239
- * console.log(`Command name: ${environment.commandName}`);
3240
- * console.log(`Assets path: ${environment.assetsPath}`);
3241
- * console.log(`Support path: ${environment.supportPath}`);
3242
- * console.log(`Is development mode: ${environment.isDevelopment}`);
3243
- * ```
3244
- */
3245
- export const environment: Environment;
3246
- /**
3247
- * Values of preference items.
3248
- */
3249
- export interface PreferenceValues {
3250
- [name: string]: any;
3251
- }
3252
- /**
3253
- * A function to access the preference values that have been passed to the command.
3254
- *
3255
- * @returns An object with the preference names as property key and the typed value as property value.
3256
- *
3257
- * @remarks
3258
- * Each preference name is mapped to its value and the defined default values are used as fallback values.
3259
- *
3260
- * @example
3261
- * ```typescript
3262
- *
3263
- *
3264
- * interface Preferences {
3265
- * name: string;
3266
- * bodyWeight?: string;
3267
- * bodyHeight?: string;
3268
- * }
3269
- *
3270
- * export default async () => {
3271
- * const preferences = getPreferenceValues<Preferences>();
3272
- * console.log(preferences);
3273
- * };
3274
- * ```
3275
- */
3276
- export function getPreferenceValues<Values extends PreferenceValues = PreferenceValues>(): Values;
3277
- /**
3278
- * Gets the selected text of the frontmost application.
3279
- *
3280
- * @throws An error when no text is selected in the frontmost application.
3281
- * @returns A Promise that resolves with the selected text.
3282
- *
3283
- * @example
3284
- * ```typescript
3285
- *
3286
- *
3287
- * export default async () => {
3288
- * try {
3289
- * const selectedText = await getSelectedText();
3290
- * const transformedText = selectedText.toUpperCase();
3291
- * await Clipboard.paste(transformedText);
3292
- * } catch (error) {
3293
- * await showToast({
3294
- * style: Toast.Style.Failure,
3295
- * title: "Cannot transform text",
3296
- * message: String(error)
3297
- * });
3298
- * }
3299
- * };
3300
- * ```
3301
- */
3302
- export function getSelectedText(): Promise<string>;
3303
- /**
3304
- * Holds data about a File System item. Use the {@link getSelectedFinderItems} method to retrieve values.
3305
- */
3306
- export interface FileSystemItem {
3307
- /**
3308
- * The path to the item
3309
- */
3310
- path: string;
3311
- }
3312
- /**
3313
- * Gets the selected items from Finder.
3314
- *
3315
- * @throws An error when Finder is not the frontmost application.
3316
- * @returns A Promise that resolves with the selected file system items.
3317
- *
3318
- * @example
3319
- * ```typescript
3320
- *
3321
- *
3322
- * export default async () => {
3323
- * try {
3324
- * const selectedItems = await getSelectedFinderItems();
3325
- * if (selectedItems.length) {
3326
- * await Clipboard.paste(selectedItems[0].path);
3327
- * }
3328
- * } catch (error) {
3329
- * await showToast({
3330
- * style: Toast.Style.Failure,
3331
- * title: "Cannot copy file path",
3332
- * message: String(error)
3333
- * });
3334
- * }
3335
- * };
3336
- * ```
3337
- */
3338
- export function getSelectedFinderItems(): Promise<FileSystemItem[]>;
3339
-
3340
- /**
3341
- * Return type of the {@link useNavigation} hook to perform push and pop actions.
3342
- */
3343
- export interface Navigation {
3344
- /**
3345
- * Push a new view component to the navigation stack.
3346
- *
3347
- * @param component - The React component to push to the navigation stack.
3348
- */
3349
- push: (component: ReactNode) => void;
3350
- /**
3351
- * Pop current view component from the navigation stack.
3352
- */
3353
- pop: () => void;
3354
- }
3355
- /**
3356
- * A hook that lets you push and pop view components in the navigation stack.
3357
- *
3358
- * @remarks
3359
- * You most likely won't use this hook too often. To push a new component, use the {@link PushAction}.
3360
- * When a user presses `ESC`, we automatically push to the previous component.
3361
- *
3362
- * @returns A {@link Navigation} object with {@link Navigation.push} and {@link Navigation.pop} functions.
3363
- * Use the functions to alter the navigation stack.
3364
- *
3365
- * @example
3366
- * ```typescript
3367
- *
3368
- *
3369
- * function Ping() {
3370
- * const { push } = useNavigation();
3371
- *
3372
- * return (
3373
- * <Detail
3374
- * markdown="Ping"
3375
- * actions={
3376
- * <ActionPanel>
3377
- * <Action title="Push" onAction={() => push(<Pong />)} />
3378
- * </ActionPanel>
3379
- * }
3380
- * />
3381
- * );
3382
- * }
3383
- *
3384
- * function Pong() {
3385
- * const { pop } = useNavigation();
3386
- *
3387
- * return (
3388
- * <Detail
3389
- * markdown="Pong"
3390
- * actions={
3391
- * <ActionPanel>
3392
- * <Action title="Pop" onAction={pop} />
3393
- * </ActionPanel>
3394
- * }
3395
- * />
3396
- * );
3397
- * }
3398
- *
3399
- * export default function Command() {
3400
- * return <Ping />;
3401
- * }
3402
- * ```
3403
- */
3404
- export function useNavigation(): Navigation;
3405
- /// <reference types="react" />
3406
-
3407
- const Portal: import("react").MemoExoticComponent<({ name: _providedName, hostName, handleOnMount, handleOnUnmount, children, }: PortalProps) => any>;
3408
- export default Portal;
3409
-
3410
-
3411
- const PortalHost: React.MemoExoticComponent<({ name }: PortalHostProps) => JSX.Element>;
3412
- export default PortalHost;
3413
-
3414
-
3415
- const PortalProvider: React.MemoExoticComponent<({ children }: PortalProviderProps) => JSX.Element>;
3416
- export default PortalProvider;
3417
- /// <reference types="react" />
3418
-
3419
-
3420
- export const PortalStateContext: import("react").Context<Record<string, PortalType[]>>;
3421
- export const PortalDispatchContext: import("react").Context<import("react").Dispatch<ActionTypes>>;
3422
-
3423
- export const usePortal: (hostName?: string) => {
3424
- registerHost: () => void;
3425
- deregisterHost: () => void;
3426
- addPortal: (name: string, node: ReactNode) => void;
3427
- updatePortal: (name: string, node: ReactNode) => void;
3428
- removePortal: (name: string) => void;
3429
- };
3430
- export const usePortalState: (hostName: string) => import("../types").PortalType[];
3431
- enum ACTIONS {
3432
- REGISTER_HOST = 0,
3433
- DEREGISTER_HOST = 1,
3434
- ADD_PORTAL = 2,
3435
- UPDATE_PORTAL = 3,
3436
- REMOVE_PORTAL = 4
3437
- }
3438
- const INITIAL_STATE: {};
3439
- export { ACTIONS, INITIAL_STATE };
3440
-
3441
-
3442
- export const reducer: (state: Record<string, Array<PortalType>>, action: ActionTypes) => Record<string, PortalType[]>;
3443
- interface PrintOptions {
3444
- component?: string;
3445
- method?: string;
3446
- params?: Record<string, any> | string | number | boolean;
3447
- }
3448
- type Print = (options: PrintOptions) => void;
3449
- const enableLogging: () => void;
3450
- let print: Print;
3451
- export { print, enableLogging };
3452
- /**
3453
- * The standard colors. Use those colors for consistency.
3454
- *
3455
- * @remarks
3456
- * The colors automatically adapt to the Raycast theme (light or dark).
3457
- *
3458
- * @example
3459
- * ```typescript
3460
- *
3461
- *
3462
- * export default function Command() {
3463
- * return (
3464
- * <List>
3465
- * <List.Item title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
3466
- * <List.Item title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
3467
- * <List.Item title="Brown" icon={{ source: Icon.Circle, tintColor: Color.Brown }} />
3468
- * <List.Item title="Magenta" icon={{ source: Icon.Circle, tintColor: Color.Magenta }} />
3469
- * <List.Item title="Orange" icon={{ source: Icon.Circle, tintColor: Color.Orange }} />
3470
- * <List.Item title="Purple" icon={{ source: Icon.Circle, tintColor: Color.Purple }} />
3471
- * <List.Item title="Red" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
3472
- * <List.Item title="Yellow" icon={{ source: Icon.Circle, tintColor: Color.Yellow }} />
3473
- * <List.Item title="PrimaryText" icon={{ source: Icon.Circle, tintColor: Color.PrimaryText }} />
3474
- * <List.Item title="SecondaryText" icon={{ source: Icon.Circle, tintColor: Color.SecondaryText }} />
3475
- * </List>
3476
- * );
3477
- * };
3478
- * ```
3479
- */
3480
- export enum Color {
3481
- Blue = "raycast-blue",
3482
- Brown = "raycast-brown",
3483
- Green = "raycast-green",
3484
- Magenta = "raycast-magenta",
3485
- Orange = "raycast-orange",
3486
- Purple = "raycast-purple",
3487
- Red = "raycast-red",
3488
- Yellow = "raycast-yellow",
3489
- PrimaryText = "raycast-primary-text",
3490
- SecondaryText = "raycast-secondary-text"
3491
- }
3492
- export namespace Color {
3493
- /**
3494
- * Union type for the supported color types.
3495
- *
3496
- * {@link Color.Raw} will be dynamically adjusted to achieve high contrast with the Raycast user interface.
3497
- *
3498
- * @example
3499
- * ```typescript
3500
- *
3501
- *
3502
- * export default function Command() {
3503
- * return (
3504
- * <List>
3505
- * <List.Item title="Built-in color" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
3506
- * <List.Item title="HEX" icon={{ source: Icon.Circle, tintColor: "#FF0000" }} />
3507
- * <List.Item title="Short HEX" icon={{ source: Icon.Circle, tintColor: "#F00" }} />
3508
- * <List.Item title="RGBA" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0)" }} />
3509
- * <List.Item title="RGBA Percentage" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0, 1.0)" }} />
3510
- * <List.Item title="HSL" icon={{ source: Icon.Circle, tintColor: "hsla(200, 20%, 33%, 0.2)" }} />
3511
- * <List.Item title="Keywords" icon={{ source: Icon.Circle, tintColor: "red" }} />
3512
- * </List>
3513
- * );
3514
- * };
3515
- * ```
3516
- */
3517
- type ColorLike = Color | Color.Dynamic | Color.Raw;
3518
- /**
3519
- * A dynamic color applies different colors depending on the active Raycast theme.
3520
- *
3521
- * @example
3522
- * ```typescript
3523
- *
3524
- *
3525
- * export default function Command() {
3526
- * return (
3527
- * <List>
3528
- * <List.Item title="Dynamic Tint Color" icon={{ source: Icon.Circle, tintColor: { light: "#FF01FF", dark: "#FFFF50", adjustContrast: true } }} />
3529
- * <List.Item title="Dynamic Tint Color" icon={{ source: Icon.Circle, tintColor: { light: "#FF01FF", dark: "#FFFF50" } }} />
3530
- * </List>
3531
- * );
3532
- * };
3533
- * ```
3534
- */
3535
- interface Dynamic {
3536
- /**
3537
- * The color which is used in light theme.
3538
- */
3539
- light: Color.Raw;
3540
- /**
3541
- * The color which is used in dark theme.
3542
- */
3543
- dark: Color.Raw;
3544
- /**
3545
- * Enables dynamic contrast adjustment for light and dark theme color.
3546
- *
3547
- * @remarks
3548
- * Colors different to the built-in {@link Color} can be dynamically adjusted to achieve high contrast with the
3549
- * Raycast user interface. This makes it easy to guarantee a good look and feel when you aren't in control of the
3550
- * color, e.g. get it via a network request.
3551
- *
3552
- * @defaultValue false
3553
- */
3554
- adjustContrast?: boolean;
3555
- }
3556
- /**
3557
- * You can use any of the following color formats:
3558
- * - HEX, e.g `#FF0000`
3559
- * - Short HEX, e.g. `#F00`
3560
- * - RGBA, e.g. `rgb(255, 0, 0)`
3561
- * - RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
3562
- * - HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
3563
- * - Keywords, e.g. `red`
3564
- */
3565
- type Raw = string;
3566
- }
3567
-
3568
- /**
3569
- * Creates and shows a confirmation Alert with the given options.
3570
- *
3571
- * @param options - The options used to create the Alert.
3572
- * @returns A Promise that resolves to a boolean when the user takes an action.
3573
- * It will be `true` for the primary Action, `false` for the dismiss Action.
3574
- *
3575
- * @example
3576
- * ```typescript
3577
- *
3578
- *
3579
- * export default async () => {
3580
- * if (await confirmAlert({ title: "Are you sure?" })) {
3581
- * // do something
3582
- * }
3583
- * };
3584
- * ```
3585
- */
3586
- export function confirmAlert(options: Alert.Options): Promise<boolean>;
3587
- export namespace Alert {
3588
- /**
3589
- * The options to create an {@link Alert}.
3590
- *
3591
- * @example
3592
- * ```typescript
3593
- *
3594
- *
3595
- * export default async () => {
3596
- * const options: Alert.Options = {
3597
- * title: "Finished cooking",
3598
- * message: "Delicious pasta for lunch",
3599
- * primaryAction: {
3600
- * title: 'Do something',
3601
- * onAction: () => {
3602
- * // while you can register a handler for an action, it's more elegant
3603
- * // to use the `if (await confirmAlert(...)) { ... }` pattern
3604
- * console.log("The alert action has been triggered")
3605
- * }
3606
- * }
3607
- * };
3608
- * await confirmAlert(options);
3609
- * };
3610
- * ```
3611
- */
3612
- interface Options {
3613
- /**
3614
- * The icon of an alert to illustrate the action. Displayed on the top.
3615
- */
3616
- icon?: Image.ImageLike;
3617
- /**
3618
- * The title of an alert. Displayed below the icon.
3619
- */
3620
- title: string;
3621
- /**
3622
- * An additional message for an Alert. Useful to show more information, e.g. a confirmation message for a destructive action.
3623
- */
3624
- message?: string;
3625
- /**
3626
- * The primary Action the user can take.
3627
- */
3628
- primaryAction?: ActionOptions;
3629
- /**
3630
- * The Action to dismiss the alert. There usually shouldn't be any side effects when the user takes this action.
3631
- */
3632
- dismissAction?: ActionOptions;
3633
- }
3634
- /**
3635
- * The options to create an {@link Alert} Action.
3636
- */
3637
- interface ActionOptions {
3638
- /**
3639
- * The title of the action.
3640
- */
3641
- title: string;
3642
- /**
3643
- * The style of the action.
3644
- */
3645
- style?: ActionStyle;
3646
- /**
3647
- * A callback called when the action is triggered.
3648
- */
3649
- onAction?: () => void;
3650
- }
3651
- /**
3652
- * Defines the visual style of an Action of the Alert.
3653
- *
3654
- * @remarks
3655
- * Use {@link Alert.ActionStyle.Default} for confirmations of a positive action.
3656
- * Use {@link Alert.ActionStyle.Destructive} for confirmations of a destructive action (eg. deleting a file).
3657
- */
3658
- enum ActionStyle {
3659
- Default = "DEFAULT",
3660
- Cancel = "CANCEL",
3661
- Destructive = "DESTRUCTIVE"
3662
- }
3663
- }
3664
- /**
3665
- * A HUD will automatically hide the main window and show a compact message at the bottom of the screen.
3666
- *
3667
- * @param title - The title that will be displayed for the HUD.
3668
- * @returns A Promise that resolves when the HUD is shown.
3669
- *
3670
- * @example
3671
- * ```typescript
3672
- *
3673
- *
3674
- * export default async () => {
3675
- * await showHUD("Hey there 👋");
3676
- * };
3677
- * ```
3678
- */
3679
- export function showHUD(title: string): Promise<void>;
3680
-
3681
- /**
3682
- * Creates and shows a Toast with the given {@link Toast.Options}.
3683
- *
3684
- * @param options - The options to customize the Toast.
3685
- * @returns A Promise that resolves with the shown Toast. The Toast can be used to change or hide it.
3686
- *
3687
- * @example
3688
- * ```typescript
3689
- *
3690
- *
3691
- * export default async () => {
3692
- * const success = false;
3693
- *
3694
- * if (success) {
3695
- * await showToast({ title: "Dinner is ready", message: "Pizza margherita" });
3696
- * } else {
3697
- * await showToast({ style: Toast.Style.Failure, title: "Dinner isn't ready", message: "Pizza dropped on the floor" });
3698
- * }
3699
- * };
3700
- * ```
3701
- *
3702
- * When showing an animated Toast, you can later on update it:
3703
- * @example
3704
- * ```typescript
3705
- *
3706
- *
3707
- *
3708
- * export default async () => {
3709
- * const toast = await showToast({ style: Toast.Style.Animated, title: "Uploading image" });
3710
- *
3711
- * await setTimeout(1000);
3712
- *
3713
- * toast.style = ToastStyle.Success;
3714
- * toast.title = "Uploaded image";
3715
- *
3716
- * await setTimeout(500);
3717
- *
3718
- * await toast.hide()
3719
- * };
3720
- * ```
3721
- */
3722
- export function showToast(options: Toast.Options): Promise<Toast>;
3723
- export function showToast(style: Toast.Style, title: string, message?: string): Promise<Toast>;
3724
- /**
3725
- * A Toast with a certain style, title, and message.
3726
- *
3727
- * @example
3728
- * ```typescript
3729
- *
3730
- *
3731
- *
3732
- * export default async () => {
3733
- * const toast = await showToast({ style: Toast.Style.Animated, title: "Uploading image" });
3734
- *
3735
- * await setTimeout(1000);
3736
- *
3737
- * toast.style = Toast.Style.Success;
3738
- * toast.title = "Uploaded image";
3739
- * };
3740
- * ```
3741
- */
3742
- export class Toast {
3743
- private options;
3744
- private id;
3745
- private callbacks;
3746
- constructor(props: Toast.Options);
3747
- get style(): Toast.Style;
3748
- set style(style: Toast.Style);
3749
- get title(): string;
3750
- set title(title: string);
3751
- get message(): string | undefined;
3752
- set message(message: string | undefined);
3753
- get primaryAction(): Toast.ActionOptions | undefined;
3754
- set primaryAction(action: Toast.ActionOptions | undefined);
3755
- get secondaryAction(): Toast.ActionOptions | undefined;
3756
- set secondaryAction(action: Toast.ActionOptions | undefined);
3757
- /**
3758
- * Shows the Toast.
3759
- *
3760
- * @returns A Promise that resolves when the toast is shown.
3761
- */
3762
- show(): Promise<void>;
3763
- /**
3764
- * Hides the Toast.
3765
- *
3766
- * @returns A Promise that resolves when toast is hidden.
3767
- */
3768
- hide(): Promise<void>;
3769
- private update;
3770
- }
3771
- export namespace Toast {
3772
- /**
3773
- * The options to create a {@link Toast}.
3774
- *
3775
- * @example
3776
- * ```typescript
3777
- *
3778
- *
3779
- * export default async () => {
3780
- * const options: Toast.Options = {
3781
- * style: Toast.Style.Success,
3782
- * title: "Finished cooking",
3783
- * message: "Delicious pasta for lunch",
3784
- * primaryAction: {
3785
- * title: 'Do something',
3786
- * onAction: () => {
3787
- * console.log("The toast action has been triggered")
3788
- * }
3789
- * }
3790
- * };
3791
- * await showToast(options);
3792
- * };
3793
- * ```
3794
- */
3795
- interface Options {
3796
- /**
3797
- * The title of a Toast. Displayed on the top.
3798
- */
3799
- title: string;
3800
- /**
3801
- * An additional message for the Toast. Useful to show more information, e.g. an identifier of a newly created asset.
3802
- */
3803
- message?: string;
3804
- /**
3805
- * The style of a Toast.
3806
- */
3807
- style?: Style;
3808
- /**
3809
- * The primary Action the user can take when hovering on the Toast.
3810
- */
3811
- primaryAction?: ActionOptions;
3812
- /**
3813
- * The secondary Action the user can take when hovering on the Toast.
3814
- */
3815
- secondaryAction?: ActionOptions;
3816
- }
3817
- /**
3818
- * The options to create a {@link Toast} Action.
3819
- */
3820
- interface ActionOptions {
3821
- /**
3822
- * The title of the action.
3823
- */
3824
- title: string;
3825
- /**
3826
- * The keyboard shortcut for the action.
3827
- */
3828
- shortcut?: Keyboard.Shortcut;
3829
- /**
3830
- * A callback called when the action is triggered.
3831
- */
3832
- onAction: () => void;
3833
- }
3834
- /**
3835
- * Defines the visual style of the Toast.
3836
- *
3837
- * @remarks
3838
- * Use {@link Toast.Style.Success} for confirmations and {@link Toast.Style.Failure} for displaying errors.
3839
- * Use {@link Toast.Style.Animated} when your Toast should be shown until a process is completed.
3840
- * You can hide it later by using {@link Toast.hide} or update the properties of an existing Toast.
3841
- */
3842
- enum Style {
3843
- Success = "SUCCESS",
3844
- Failure = "FAILURE",
3845
- Animated = "ANIMATED"
3846
- }
3847
- }
3848
- /**
3849
- * List of built-in icons that can be used for actions or list items.
3850
- *
3851
- * @example
3852
- * ```typescript
3853
- *
3854
- *
3855
- * export default function Command() {
3856
- * return (
3857
- * <List>
3858
- * <List.Item title="Icon" icon={Icon.Circle} />
3859
- * </List>
3860
- * );
3861
- * };
3862
- * ```
3863
- */
3864
- export enum Icon {
3865
- ArrowClockwise = "arrow-clockwise-16",
3866
- ArrowRight = "arrow-right-16",
3867
- Binoculars = "binoculars-16",
3868
- Bubble = "bubble-left-16",
3869
- Calendar = "calendar-16",
3870
- Checkmark = "checkmark-circle-16",
3871
- ChevronDown = "chevron-down-16",
3872
- ChevronUp = "chevron-up-16",
3873
- Circle = "circle-16",
3874
- Clipboard = "doc-on-clipboard-16",
3875
- Clock = "clock-16",
3876
- Desktop = "desktopcomputer-16",
3877
- Document = "doc-16",
3878
- Dot = "dot-16",
3879
- Download = "square-and-arrow-down-16",
3880
- Envelope = "envelope-16",
3881
- ExclamationMark = "exclamation-mark-triangle-16",
3882
- Eye = "eye-16",
3883
- EyeSlash = "eye-slash-16",
3884
- Finder = "finder-16",
3885
- Gear = "gearshape-16",
3886
- Globe = "globe-16",
3887
- Hammer = "hammer-16",
3888
- LevelMeter = "level-meter-16",
3889
- Link = "link-16",
3890
- List = "main-list-view-16",
3891
- MagnifyingGlass = "magnifyingglass-16",
3892
- MemoryChip = "memorychip-16",
3893
- Message = "message-16",
3894
- Pencil = "pencil-16",
3895
- Person = "person-crop-circle-16",
3896
- Phone = "phone-16",
3897
- Pin = "pin-16",
3898
- Plus = "plus-16",
3899
- Sidebar = "sidebar-right-16",
3900
- SpeakerArrowDown = "speaker-arrow-down-16",
3901
- SpeakerArrowUp = "speaker-arrow-up-16",
3902
- SpeakerSlash = "speaker-slash-16",
3903
- Star = "star-16",
3904
- Text = "text-alignleft-16",
3905
- TextDocument = "doc-plaintext-16",
3906
- QuestionMark = "questionmark-circle-16",
3907
- Terminal = "terminal-16",
3908
- Trash = "trash-16",
3909
- Upload = "square-and-arrow-up-16",
3910
- Video = "video-16",
3911
- Window = "macwindow-16",
3912
- XmarkCircle = "xmark-circle-16"
3913
- }
3914
- /**
3915
- * An icon as it's used in the Finder.
3916
- *
3917
- * @example
3918
- * ```typescript
3919
- *
3920
- *
3921
- * export default function Command() {
3922
- * return (
3923
- * <List>
3924
- * <List.Item title="File icon" icon={{ fileIcon: __filename }} />
3925
- * </List>
3926
- * );
3927
- * };
3928
- * ```
3929
- */
3930
- export interface FileIcon {
3931
- /**
3932
- * The path to a file or folder to get its icon from.
3933
- */
3934
- fileIcon: string;
3935
- }
3936
-
3937
-
3938
- /**
3939
- * Display different types of images, including network images or bundled assets.
3940
- *
3941
- * @example
3942
- * ```typescript
3943
- * // Built-in icon
3944
- * const icon = Icon.Eye
3945
- *
3946
- * // Built-in icon with tint color
3947
- * const tintedIcon = { source: Icon.Bubble, tintColor: Color.Red }
3948
- *
3949
- * // Bundled asset with circular mask
3950
- * const avatar = { source: "avatar.png", mask: Image.Mask.Circle }
3951
- *
3952
- * // Theme-aware icon
3953
- * const icon = { source: { light: "icon-light.png", dark: "icon-dark.png" }}
3954
- * ```
3955
- *
3956
- * @remark
3957
- * Apply image transforms to the source, such as a `mask` or a `tintColor`.
3958
- */
3959
- export interface Image {
3960
- /**
3961
- * The {@link Image.Source} of the image.
3962
- */
3963
- source: Image.Source;
3964
- /**
3965
- * {@link Image.Fallback} image, in case `source` can't be loaded.
3966
- */
3967
- fallback?: Image.Fallback;
3968
- /**
3969
- * A {@link Image.Mask} to apply to the image.
3970
- */
3971
- mask?: Image.Mask;
3972
- /**
3973
- * A {@link Color.ColorLike} to tint all the non-transparent pixels of the image.
3974
- */
3975
- tintColor?: Color.ColorLike;
3976
- }
3977
- export namespace Image {
3978
- /**
3979
- * Image is a string representing a URL.
3980
- */
3981
- type URL = string;
3982
- /**
3983
- * Image is a string denoting an asset from the `assets/` folder.
3984
- */
3985
- type Asset = string;
3986
- /**
3987
- * Union type for the supported image types.
3988
- *
3989
- * @example
3990
- * ```typescript
3991
- *
3992
- *
3993
- * export default function Command() {
3994
- * return (
3995
- * <List>
3996
- * <List.Item title="String" icon="https://raycast.com/uploads/avatar.png" />
3997
- * <List.Item title="Icon" icon={Icon.Circle} />
3998
- * <List.Item title="FileIcon" icon={{ fileIcon: __filename }} />
3999
- * <List.Item title="Image" icon={{ source: "https://raycast.com/uploads/avatar.png", mask: Image.Mask.Circle }} />
4000
- * </List>
4001
- * );
4002
- * };
4003
- * ```
4004
- */
4005
- type ImageLike = URL | Asset | Icon | FileIcon | Image;
4006
- /**
4007
- * The source of an {@link Image}. Can be either a remote URL, a local file resource, a built-in {@link Icon} or
4008
- * a single emoji.
4009
- *
4010
- * @remarks
4011
- * For consistency, it's best to use the built-in {@link Icon} in lists, the Action Panel, and other places. If a
4012
- * specific icon isn't built-in, you can reference custom ones from the `assets` folder of the extension by file name,
4013
- * e.g. `my-icon.png`. Alternatively, you can reference an absolute HTTPS URL that points to an image or use an emoji.
4014
- * You can also specify different remote or local assets for light and dark theme.
4015
- *
4016
- * @example
4017
- * ```typescript
4018
- *
4019
- *
4020
- * export default function Command() {
4021
- * return (
4022
- * <List>
4023
- * <List.Item title="String" icon={{ source: "https://raycast.com/uploads/avatar.png" }} />
4024
- * <List.Item title="Icon" icon={{ source: Icon.Circle }} />
4025
- * <List.Item
4026
- * title="Theme"
4027
- * icon={{
4028
- * source: { light: "https://raycast.com/uploads/avatar.png", dark: "https://raycast.com/uploads/avatar.png" },
4029
- * }}
4030
- * />
4031
- * </List>
4032
- * );
4033
- * };
4034
- * ```
4035
- */
4036
- type Source = URL | Asset | Icon | {
4037
- light: URL | Asset;
4038
- dark: URL | Asset;
4039
- };
4040
- /**
4041
- * Fallback {@link Image} source. Can be a local file resource, a built-in {@link Icon} or a single emoji.
4042
- *
4043
- * @example
4044
- * ```typescript
4045
- *
4046
- *
4047
- * export default function Command() {
4048
- * return (
4049
- * <List>
4050
- * <List.Item title="String" icon={{ source: "https://raycast.com/uploads/avatar.png", fallback: Icon.Circle }} />
4051
- * <List.Item title="Icon" icon={{ source: Icon.Circle }} />
4052
- * <List.Item
4053
- * title="Theme"
4054
- * icon={{
4055
- * source: { light: "https://raycast.com/uploads/avatar.png", dark: "https://raycast.com/uploads/avatar.png" },
4056
- * }}
4057
- * />
4058
- * </List>
4059
- * );
4060
- * };
4061
- * ```
4062
- */
4063
- type Fallback = Asset | Icon | {
4064
- light: Asset;
4065
- dark: Asset;
4066
- };
4067
- /**
4068
- * Available masks that can be used to change the shape of an image.
4069
- *
4070
- * @remarks
4071
- * Can be handy to shape avatars or other items in a list.
4072
- *
4073
- * @example
4074
- * ```typescript
4075
- *
4076
- *
4077
- * export default function Command() {
4078
- * return (
4079
- * <List>
4080
- * <List.Item title="Icon" icon={{ source: "https://raycast.com/uploads/avatar.png", mask: Image.Mask.Circle }} />
4081
- * </List>
4082
- * );
4083
- * };
4084
- * ```
4085
- */
4086
- enum Mask {
4087
- /**
4088
- * Masks an image with a circle. Good to use for avatars.
4089
- */
4090
- Circle = "circle",
4091
- /**
4092
- * Masks an image with a rounded rectangle.
4093
- */
4094
- RoundedRectangle = "roundedRectangle"
4095
- }
4096
- }
4097
-
4098
- }