@raycast/api 1.30.2 → 1.32.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/README.md +2 -2
- package/bin/arm64/ray +0 -0
- package/bin/ray +10 -4
- package/bin/x86/ray +0 -0
- package/package.json +2 -2
- package/types/index.d.ts +5192 -4098
- package/types/api/app/app.d.ts +0 -171
- package/types/api/app/clipboard.d.ts +0 -63
- package/types/api/app/index.d.ts +0 -4
- package/types/api/app/keyboard.d.ts +0 -56
- package/types/api/app/localStorage.d.ts +0 -117
- package/types/api/components/ActionPanel.d.ts +0 -261
- package/types/api/components/Detail.d.ts +0 -38
- package/types/api/components/Form.d.ts +0 -1016
- package/types/api/components/List.d.ts +0 -579
- package/types/api/components/actions/Action.d.ts +0 -458
- package/types/api/components/actions/CopyToClipboardAction.d.ts +0 -40
- package/types/api/components/actions/CreateQuicklinkAction.d.ts +0 -42
- package/types/api/components/actions/CreateSnippetAction.d.ts +0 -40
- package/types/api/components/actions/OpenAction.d.ts +0 -47
- package/types/api/components/actions/OpenInBrowserAction.d.ts +0 -43
- package/types/api/components/actions/OpenWithAction.d.ts +0 -40
- package/types/api/components/actions/PasteAction.d.ts +0 -40
- package/types/api/components/actions/PushAction.d.ts +0 -38
- package/types/api/components/actions/ShowInFinderAction.d.ts +0 -42
- package/types/api/components/actions/SubmitFormAction.d.ts +0 -35
- package/types/api/components/actions/TrashAction.d.ts +0 -43
- package/types/api/components/actions/index.d.ts +0 -1
- package/types/api/components/index.d.ts +0 -5
- package/types/api/components/propTypes.d.ts +0 -1
- package/types/api/components/types.d.ts +0 -30
- package/types/api/deprecated.d.ts +0 -415
- package/types/api/environment/environment.d.ts +0 -48
- package/types/api/environment/index.d.ts +0 -3
- package/types/api/environment/preferences.d.ts +0 -31
- package/types/api/environment/workspace.d.ts +0 -62
- package/types/api/hooks/index.d.ts +0 -1
- package/types/api/hooks/useNavigation.d.ts +0 -66
- package/types/api/index.d.ts +0 -6
- package/types/api/internal/comm/index.d.ts +0 -1
- package/types/api/internal/components/ErrorBoundary.d.ts +0 -1
- package/types/api/internal/components/Navigation.d.ts +0 -1
- package/types/api/internal/components/Root.d.ts +0 -1
- package/types/api/internal/components/index.d.ts +0 -3
- package/types/api/internal/devtools/actionPanel.d.ts +0 -1
- package/types/api/internal/devtools/index.d.ts +0 -2
- package/types/api/internal/devtools/react.d.ts +0 -1
- package/types/api/internal/hooks/index.d.ts +0 -1
- package/types/api/internal/hooks/useId.d.ts +0 -1
- package/types/api/internal/index.d.ts +0 -6
- package/types/api/internal/rendering/callbacks.d.ts +0 -1
- package/types/api/internal/rendering/index.d.ts +0 -6
- package/types/api/internal/rendering/logger.d.ts +0 -4
- package/types/api/internal/rendering/node-builders/actions.d.ts +0 -3
- package/types/api/internal/rendering/node-builders/detail.d.ts +0 -2
- package/types/api/internal/rendering/node-builders/forms.d.ts +0 -2
- package/types/api/internal/rendering/node-builders/keyboard.d.ts +0 -1
- package/types/api/internal/rendering/node-builders/list.d.ts +0 -4
- package/types/api/internal/rendering/node-builders/navigationStack.d.ts +0 -1
- package/types/api/internal/rendering/node-builders/root.d.ts +0 -1
- package/types/api/internal/rendering/node-builders/types.d.ts +0 -1
- package/types/api/internal/rendering/node-builders/utils.d.ts +0 -1
- package/types/api/internal/rendering/reconciler/index.d.ts +0 -1
- package/types/api/internal/rendering/reconciler/noHydratation.d.ts +0 -37
- package/types/api/internal/rendering/reconciler/noMutation.d.ts +0 -18
- package/types/api/internal/rendering/renderer.d.ts +0 -1
- package/types/api/internal/utils/ids.d.ts +0 -1
- package/types/api/internal/utils/index.d.ts +0 -3
- package/types/api/internal/utils/internal-children.d.ts +0 -26
- package/types/api/internal/utils/propTypes.d.ts +0 -3
- package/types/api/ui/color.d.ts +0 -115
- package/types/api/ui/errors.d.ts +0 -1
- package/types/api/ui/feedback/alert.d.ts +0 -97
- package/types/api/ui/feedback/hud.d.ts +0 -16
- package/types/api/ui/feedback/index.d.ts +0 -3
- package/types/api/ui/feedback/toast.d.ts +0 -174
- package/types/api/ui/icon.d.ts +0 -88
- package/types/api/ui/image.d.ts +0 -162
- package/types/api/ui/index.d.ts +0 -5
- package/types/core/message-types.d.ts +0 -17
- package/types/core/preferences.d.ts +0 -69
package/types/api/app/app.d.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { PathLike } from "fs";
|
|
3
|
-
/**
|
|
4
|
-
* Closes the main Raycast window.
|
|
5
|
-
*
|
|
6
|
-
* @param options - Can be used to clear the root search. Defaults to not clearing the root search after
|
|
7
|
-
* the window was closed.
|
|
8
|
-
* @returns A Promise that resolves when the main window is closed.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { closeMainWindow } from "@raycast/api";
|
|
13
|
-
* import { setTimeout } from "timers/promises";
|
|
14
|
-
*
|
|
15
|
-
* export default async () => {
|
|
16
|
-
* await setTimeout(1000);
|
|
17
|
-
* await closeMainWindow({ clearRootSearch: true });
|
|
18
|
-
* };
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function closeMainWindow(options?: {
|
|
22
|
-
clearRootSearch?: boolean;
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Pops the navigation stack back to root search.
|
|
26
|
-
*
|
|
27
|
-
* @param options - Can be used to clear the search bar. Defaults to clearing the search bar after popped to root.
|
|
28
|
-
* @returns A Promise that resolves when Raycast popped to root.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* import { Detail, popToRoot } from "@raycast/api";
|
|
33
|
-
* import { useEffect } from "react";
|
|
34
|
-
* import { setTimeout } from "timers";
|
|
35
|
-
*
|
|
36
|
-
* export default function Command() {
|
|
37
|
-
* useEffect(() => {
|
|
38
|
-
* setTimeout(() => {
|
|
39
|
-
* popToRoot({ clearSearchBar: true });
|
|
40
|
-
* }, 3000);
|
|
41
|
-
* }, []);
|
|
42
|
-
*
|
|
43
|
-
* return <Detail markdown="See you soon 👋" />;
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function popToRoot(options?: {
|
|
48
|
-
clearSearchBar?: boolean;
|
|
49
|
-
}): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Clear the text in the search bar.
|
|
52
|
-
*
|
|
53
|
-
* @param options - Can be used to force scrolling to the top. Defaults to scrolling to the top after the
|
|
54
|
-
* the search bar was cleared.
|
|
55
|
-
* @returns A Promise that resolves when the search bar is cleared.
|
|
56
|
-
*/
|
|
57
|
-
export declare function clearSearchBar(options?: {
|
|
58
|
-
forceScrollToTop?: boolean;
|
|
59
|
-
}): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Utils
|
|
62
|
-
*/
|
|
63
|
-
/**
|
|
64
|
-
* Shows a file or directory in the Finder.
|
|
65
|
-
*
|
|
66
|
-
* @param path - The path to show in the Finder.
|
|
67
|
-
* @returns A Promise that resolves when the item is revealed in the Finder.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* import { showInFinder } from "@raycast/api"
|
|
72
|
-
* import { homedir } from "os"
|
|
73
|
-
* import { join } from "path"
|
|
74
|
-
* showInFinder(join(homedir(), "Downloads"))
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function showInFinder(path: PathLike): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Moves a file or directory to the Trash.
|
|
80
|
-
*
|
|
81
|
-
* @param paths - The item or items to move to the trash.
|
|
82
|
-
* @returns A Promise that resolves when all files are moved to the trash.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* import { trash } from "@raycast/api";
|
|
87
|
-
* import { writeFile } from "fs/promises";
|
|
88
|
-
* import { homedir } from "os";
|
|
89
|
-
*
|
|
90
|
-
* export default async () => {
|
|
91
|
-
* const file = `${homedir()}/Desktop/yolo.txt`;
|
|
92
|
-
* await writeFile(file, "I will be deleted soon!");
|
|
93
|
-
* await trash(file);
|
|
94
|
-
* };
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
export declare function trash(path: PathLike | PathLike[]): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* An object that represents a locally installed application on the system.
|
|
100
|
-
*
|
|
101
|
-
* @remarks
|
|
102
|
-
* It can be used to open files or folders in a specific application. Use {@link getApplications} or
|
|
103
|
-
* {@link getDefaultApplication} to get applications that can open a specific file or folder.
|
|
104
|
-
*/
|
|
105
|
-
export interface Application {
|
|
106
|
-
/**
|
|
107
|
-
* The display name of the application.
|
|
108
|
-
*/
|
|
109
|
-
name: string;
|
|
110
|
-
/**
|
|
111
|
-
* The absolute path to the application bundle, e.g. `/Applications/Raycast.app`,
|
|
112
|
-
*/
|
|
113
|
-
path: string;
|
|
114
|
-
/**
|
|
115
|
-
* The bundle identifier of the application, e.g. `com.raycast.macos`.
|
|
116
|
-
*/
|
|
117
|
-
bundleId?: string;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Returns all applications that can open the file.
|
|
121
|
-
*
|
|
122
|
-
* @param path The path of the file or folder to get the applications for. If no path is specified, all installed applications are returned.
|
|
123
|
-
* @returns An array of {@link Application}.
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* import { getApplications } from "@raycast/api";
|
|
128
|
-
*
|
|
129
|
-
* export default async () => {
|
|
130
|
-
* const installedApplications = await getApplications();
|
|
131
|
-
* console.log("The following applications are installed on your Mac:");
|
|
132
|
-
* console.log(installedApplications.map((a) => a.name).join(", "));
|
|
133
|
-
* };
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
export declare function getApplications(path?: PathLike): Promise<Application[]>;
|
|
137
|
-
/**
|
|
138
|
-
* Returns the default application that the file would be opened with.
|
|
139
|
-
*
|
|
140
|
-
* @param path The path of the file or folder to get the default application for.
|
|
141
|
-
* @returns The default {@link Application} that would open the file. Throws an error if no application was found.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```typescript
|
|
145
|
-
* import { getDefaultApplication } from "@raycast/api";
|
|
146
|
-
*
|
|
147
|
-
* export default async () => {
|
|
148
|
-
* const defaultApplication = await getDefaultApplication(__filename);
|
|
149
|
-
* console.log(`Default application for JavaScript is: ${defaultApplication.name}`);
|
|
150
|
-
* };
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
export declare function getDefaultApplication(path: PathLike): Promise<Application>;
|
|
154
|
-
/**
|
|
155
|
-
* Opens a target with the default application or specified application.
|
|
156
|
-
*
|
|
157
|
-
* @param target The file, folder or URL to open.
|
|
158
|
-
* @param application The application name to use for opening the file. If no application is specified, the default application as determined by the system
|
|
159
|
-
* is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app.
|
|
160
|
-
* @returns A Promise that resolves when the target has been opened.
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```typescript
|
|
164
|
-
* import { open } from "@raycast/api";
|
|
165
|
-
*
|
|
166
|
-
* export default async () => {
|
|
167
|
-
* await open("https://www.raycast.com", "com.google.Chrome");
|
|
168
|
-
* };
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
export declare function open(target: string, application?: Application | string): Promise<void>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copies text to the clipboard.
|
|
3
|
-
*
|
|
4
|
-
* @param text - The text to copy to the clipboard.
|
|
5
|
-
* @returns A Promise that resolves when the text is copied to the clipboard.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { Clipboard } from "@raycast/api";
|
|
10
|
-
*
|
|
11
|
-
* export default async () => {
|
|
12
|
-
* await Clipboard.copy("https://raycast.com");
|
|
13
|
-
* };
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function copy(text: string): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Clears the current clipboard contents.
|
|
19
|
-
*
|
|
20
|
-
* @returns A Promise that resolves when the clipboard is cleared.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* import { Clipboard } from "@raycast/api";
|
|
25
|
-
*
|
|
26
|
-
* export default async () => {
|
|
27
|
-
* await Clipboard.clear();
|
|
28
|
-
* };
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function clear(): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Pastes text to the current selection of the frontmost application.
|
|
34
|
-
*
|
|
35
|
-
* @param text - The text to insert at the cursor.
|
|
36
|
-
* @returns A Promise that resolves when the text is pasted.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* import { Clipboard } from "@raycast/api";
|
|
41
|
-
*
|
|
42
|
-
* export default async () => {
|
|
43
|
-
* await Clipboard.paste("I really like Raycast's API");
|
|
44
|
-
* };
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function paste(text: string): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Reads the clipboard as plain text.
|
|
50
|
-
*
|
|
51
|
-
* @returns A promise that resolves when the clipboard content was read as plain text.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { Clipboard } from "@raycast/api";
|
|
56
|
-
*
|
|
57
|
-
* export default async () => {
|
|
58
|
-
* const text = await Clipboard.readText();
|
|
59
|
-
* console.log(text);
|
|
60
|
-
* };
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare function readText(): Promise<string | undefined>;
|
package/types/api/app/index.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A keyboard shortcut is defined by one or more modifier keys (command, control, etc.) and a single key equivalent (a character or special key).
|
|
3
|
-
* See {@link KeyModifier} and {@link KeyEquivalent} for supported values.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* import { ActionPanel, Detail, Action } from "@raycast/api";
|
|
8
|
-
*
|
|
9
|
-
* export default function Command() {
|
|
10
|
-
* return (
|
|
11
|
-
* <Detail markdown="Let's play some games 👾" actions={
|
|
12
|
-
* <ActionPanel title="Game controls">
|
|
13
|
-
* <Action
|
|
14
|
-
* title="Up"
|
|
15
|
-
* shortcut={{ modifiers: ["opt"], key: "arrowUp" }}
|
|
16
|
-
* onAction={() => console.log("Go up")}
|
|
17
|
-
* />
|
|
18
|
-
* <Action
|
|
19
|
-
* title="Down"
|
|
20
|
-
* shortcut={{ modifiers: ["opt"], key: "arrowDown" }}
|
|
21
|
-
* onAction={() => console.log("Go down")}
|
|
22
|
-
* />
|
|
23
|
-
* <Action
|
|
24
|
-
* title="Left"
|
|
25
|
-
* shortcut={{ modifiers: ["opt"], key: "arrowLeft" }}
|
|
26
|
-
* onAction={() => console.log("Go left")}
|
|
27
|
-
* />
|
|
28
|
-
* <Action
|
|
29
|
-
* title="Right"
|
|
30
|
-
* shortcut={{ modifiers: ["opt"], key: "arrowRight" }}
|
|
31
|
-
* onAction={() => console.log("Go right")}
|
|
32
|
-
* />
|
|
33
|
-
* </ActionPanel>}
|
|
34
|
-
* />
|
|
35
|
-
* );
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export interface Shortcut {
|
|
40
|
-
/**
|
|
41
|
-
* The modifier keys of the keyboard shortcut.
|
|
42
|
-
*/
|
|
43
|
-
modifiers: KeyModifier[];
|
|
44
|
-
/**
|
|
45
|
-
* The key of the keyboard shortcut.
|
|
46
|
-
*/
|
|
47
|
-
key: KeyEquivalent;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Modifier of a {@link Shortcut}
|
|
51
|
-
*/
|
|
52
|
-
export declare type KeyModifier = "cmd" | "ctrl" | "opt" | "shift";
|
|
53
|
-
/**
|
|
54
|
-
* KeyEquivalent of a {@link Shortcut}
|
|
55
|
-
*/
|
|
56
|
-
export declare 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";
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieve all stored values in the local storage of an extension.
|
|
3
|
-
*
|
|
4
|
-
* @returns A Promise that resolves with an object containing all {@link Values}.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { LocalStorage } from "@raycast/api";
|
|
9
|
-
*
|
|
10
|
-
* interface Values {
|
|
11
|
-
* todo: string;
|
|
12
|
-
* priority: number;
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* export default async () => {
|
|
16
|
-
* const items = await LocalStorage.allItems<Values>();
|
|
17
|
-
* console.log(`Local storage item count: ${Object.entries(items).length}`);
|
|
18
|
-
* };
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function allItems<T extends Values = Values>(): Promise<T>;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieve the stored value for the given key.
|
|
24
|
-
*
|
|
25
|
-
* @param key - The key you want to retrieve the value of.
|
|
26
|
-
* @returns A Promise that resolves with the stored value for the given key. If the key does not exist, `undefined` is returned.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* import { LocalStorage } from "@raycast/api";
|
|
31
|
-
*
|
|
32
|
-
* export default async () => {
|
|
33
|
-
* const item = await LocalStorage.getItem<string>("favorite-fruit");
|
|
34
|
-
* console.log(item);
|
|
35
|
-
* };
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare function getItem<T extends Value = Value>(key: string): Promise<T | undefined>;
|
|
39
|
-
/**
|
|
40
|
-
* Stores a value for the given key.
|
|
41
|
-
*
|
|
42
|
-
* @param key - The key you want to create or update the value of.
|
|
43
|
-
* @param value - The value you want to create or update for the given key.
|
|
44
|
-
* @returns A Promise that resolves when the value is stored.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* import { LocalStorage } from "@raycast/api";
|
|
49
|
-
*
|
|
50
|
-
* export default async () => {
|
|
51
|
-
* await LocalStorage.setItem("favorite-fruit", "cherry");
|
|
52
|
-
* };
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare function setItem(key: string, value: Value): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Removes the stored value for the given key.
|
|
58
|
-
*
|
|
59
|
-
* @param key - The key you want to remove the value of.
|
|
60
|
-
* @returns A Promise that resolves when the value is removed.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* import { LocalStorage } from "@raycast/api";
|
|
65
|
-
*
|
|
66
|
-
* export default async () => {
|
|
67
|
-
* await LocalStorage.removeItem("favorite-fruit");
|
|
68
|
-
* };
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export declare function removeItem(key: string): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Removes all stored values of an extension.
|
|
74
|
-
*
|
|
75
|
-
* @returns A Promise that resolves when all values are removed.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* import { LocalStorage } from "@raycast/api";
|
|
80
|
-
*
|
|
81
|
-
* export default async () => {
|
|
82
|
-
* await LocalStorage.clear();
|
|
83
|
-
* };
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare function clear(): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Supported storage value types.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```typescript
|
|
92
|
-
* import { LocalStorage } from "@raycast/api";
|
|
93
|
-
*
|
|
94
|
-
* export default async () => {
|
|
95
|
-
* // string
|
|
96
|
-
* await LocalStorage.setItem("favorite-fruit", "cherry");
|
|
97
|
-
*
|
|
98
|
-
* // number
|
|
99
|
-
* await LocalStorage.setItem("fruit-basket-count", 3);
|
|
100
|
-
*
|
|
101
|
-
* // boolean
|
|
102
|
-
* await LocalStorage.setItem("fruit-eaten-today", true);
|
|
103
|
-
* };
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export declare type Value = string | number | boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Values of local storage items.
|
|
109
|
-
*
|
|
110
|
-
* > For type-safe values, you can define your own interface. Use the keys of the local storage items as the property names.
|
|
111
|
-
*/
|
|
112
|
-
export interface Values {
|
|
113
|
-
/**
|
|
114
|
-
* The local storage value of a given key.
|
|
115
|
-
*/
|
|
116
|
-
[key: string]: any;
|
|
117
|
-
}
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
import { Keyboard } from "../app";
|
|
3
|
-
import { Image } from "../ui";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
import { Action } from "./actions";
|
|
6
|
-
/**
|
|
7
|
-
* Exposes a list of actions that can be performed by the user.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Often items are context-aware, e.g. based on the selected list item. Actions can be grouped into semantic
|
|
11
|
-
* sections and can have keyboard shortcuts assigned.
|
|
12
|
-
*
|
|
13
|
-
* The first and second action become the primary and secondary action. They automatically get the default keyboard shortcuts assigned.
|
|
14
|
-
* 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
|
|
15
|
-
* `⌘` `⇧` `↵` for the secondary.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { ActionPanel, Action, List } from "@raycast/api";
|
|
20
|
-
*
|
|
21
|
-
* export default function Command() {
|
|
22
|
-
* return (
|
|
23
|
-
* <List navigationTitle="Open Pull Requests">
|
|
24
|
-
* <List.Item
|
|
25
|
-
* title="Docs: Update API Reference"
|
|
26
|
-
* subtitle="#1"
|
|
27
|
-
* actions={
|
|
28
|
-
* <ActionPanel title="#1 in raycast/extensions">
|
|
29
|
-
* <Action.OpenInBrowser url="https://github.com/raycast/extensions/pull/1" />
|
|
30
|
-
* <Action.CopyToClipboard
|
|
31
|
-
* title="Copy Pull Request URL"
|
|
32
|
-
* content="https://github.com/raycast/extensions/pull/1"
|
|
33
|
-
* />
|
|
34
|
-
* </ActionPanel>
|
|
35
|
-
* }
|
|
36
|
-
* />
|
|
37
|
-
* </List>
|
|
38
|
-
* );
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function ActionPanel(props: ActionPanel.Props): ReactElement<ActionPanel.Props>;
|
|
43
|
-
export declare namespace ActionPanel {
|
|
44
|
-
var propTypes: {
|
|
45
|
-
title: PropTypes.Requireable<string>;
|
|
46
|
-
};
|
|
47
|
-
var displayName: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* See {@link ActionPanel.Section}
|
|
51
|
-
*/
|
|
52
|
-
declare function ActionPanelSection(props: ActionPanel.Section.Props): ReactElement<ActionPanel.Section.Props>;
|
|
53
|
-
declare namespace ActionPanelSection {
|
|
54
|
-
var propTypes: {
|
|
55
|
-
title: PropTypes.Requireable<string>;
|
|
56
|
-
};
|
|
57
|
-
var displayName: string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* See {@link ActionPanel.Submenu}
|
|
61
|
-
*/
|
|
62
|
-
declare function ActionPanelSubmenu(props: ActionPanel.Submenu.Props): ReactElement<Action.Props>;
|
|
63
|
-
declare namespace ActionPanelSubmenu {
|
|
64
|
-
var propTypes: {
|
|
65
|
-
id: PropTypes.Requireable<string>;
|
|
66
|
-
title: PropTypes.Validator<string>;
|
|
67
|
-
icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
|
|
68
|
-
fileIcon: PropTypes.Validator<string>;
|
|
69
|
-
}>> | PropTypes.InferProps<{
|
|
70
|
-
source: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
71
|
-
light: PropTypes.Validator<string>;
|
|
72
|
-
dark: PropTypes.Validator<string>;
|
|
73
|
-
}>>;
|
|
74
|
-
fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
75
|
-
light: PropTypes.Validator<string>;
|
|
76
|
-
dark: PropTypes.Validator<string>;
|
|
77
|
-
}>>;
|
|
78
|
-
mask: PropTypes.Requireable<Image.Mask>;
|
|
79
|
-
tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
80
|
-
light: PropTypes.Validator<string>;
|
|
81
|
-
dark: PropTypes.Validator<string>;
|
|
82
|
-
adjustContrast: PropTypes.Requireable<boolean>;
|
|
83
|
-
}>>;
|
|
84
|
-
}>>;
|
|
85
|
-
shortcut: PropTypes.Requireable<Required<PropTypes.InferProps<{
|
|
86
|
-
modifiers: PropTypes.Validator<string[]>;
|
|
87
|
-
key: PropTypes.Validator<string>;
|
|
88
|
-
}>>>;
|
|
89
|
-
};
|
|
90
|
-
var displayName: string;
|
|
91
|
-
}
|
|
92
|
-
export declare namespace ActionPanel {
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated Use `Action` instead.
|
|
95
|
-
*/
|
|
96
|
-
const Item: typeof Action;
|
|
97
|
-
/**
|
|
98
|
-
* A group of visually separated items.
|
|
99
|
-
*
|
|
100
|
-
* @remarks
|
|
101
|
-
* Use sections when the {@link ActionPanel} contains a lot of actions to help guide the user to related actions.
|
|
102
|
-
* For example, create a section for all copy actions.
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* import { ActionPanel, Action, List } from "@raycast/api";
|
|
107
|
-
*
|
|
108
|
-
* export default function Command() {
|
|
109
|
-
* return (
|
|
110
|
-
* <List navigationTitle="Open Pull Requests">
|
|
111
|
-
* <List.Item
|
|
112
|
-
* title="Docs: Update API Reference"
|
|
113
|
-
* subtitle="#1"
|
|
114
|
-
* actions={
|
|
115
|
-
* <ActionPanel title="#1 in raycast/extensions">
|
|
116
|
-
* <ActionPanel.Section title="Copy">
|
|
117
|
-
* <Action.CopyToClipboard title="Copy Pull Request Number" content="#1" />
|
|
118
|
-
* <Action.CopyToClipboard
|
|
119
|
-
* title="Copy Pull Request URL"
|
|
120
|
-
* content="https://github.com/raycast/extensions/pull/1"
|
|
121
|
-
* />
|
|
122
|
-
* <Action.CopyToClipboard title="Copy Pull Request Title" content="Docs: Update API Reference" />
|
|
123
|
-
* </ActionPanel.Section>
|
|
124
|
-
* <ActionPanel.Section title="Danger zone">
|
|
125
|
-
* <Action title="Close Pull Request" onAction={() => console.log("Close PR #1")} />
|
|
126
|
-
* </ActionPanel.Section>
|
|
127
|
-
* </ActionPanel>
|
|
128
|
-
* }
|
|
129
|
-
* />
|
|
130
|
-
* </List>
|
|
131
|
-
* );
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
const Section: typeof ActionPanelSection;
|
|
136
|
-
/**
|
|
137
|
-
* An action that replaces the current ActionPanel with its children when selected.
|
|
138
|
-
*
|
|
139
|
-
* @remarks
|
|
140
|
-
* 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
|
|
141
|
-
* or an assignee to a todo.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```typescript
|
|
145
|
-
* import { ActionPanel, Color, Icon, List, Action } from "@raycast/api";
|
|
146
|
-
*
|
|
147
|
-
* export default function Command() {
|
|
148
|
-
* return (
|
|
149
|
-
* <List navigationTitle="Open Pull Requests">
|
|
150
|
-
* <List.Item
|
|
151
|
-
* title="Docs: Update API Reference"
|
|
152
|
-
* subtitle="#1"
|
|
153
|
-
* actions={
|
|
154
|
-
* <ActionPanel title="#1 in raycast/extensions">
|
|
155
|
-
* <ActionPanel.Submenu title="Add Label">
|
|
156
|
-
* <Action
|
|
157
|
-
* icon={{ source: Icon.Circle, tintColor: Color.Red }}
|
|
158
|
-
* title="Bug"
|
|
159
|
-
* onAction={() => console.log("Add bug label")}
|
|
160
|
-
* />
|
|
161
|
-
* <Action
|
|
162
|
-
* icon={{ source: Icon.Circle, tintColor: Color.Yellow }}
|
|
163
|
-
* title="Enhancement"
|
|
164
|
-
* onAction={() => console.log("Add enhancement label")}
|
|
165
|
-
* />
|
|
166
|
-
* <Action
|
|
167
|
-
* icon={{ source: Icon.Circle, tintColor: Color.Blue }}
|
|
168
|
-
* title="Help Wanted"
|
|
169
|
-
* onAction={() => console.log("Add help wanted label")}
|
|
170
|
-
* />
|
|
171
|
-
* </ActionPanel.Submenu>
|
|
172
|
-
* </ActionPanel>
|
|
173
|
-
* }
|
|
174
|
-
* />
|
|
175
|
-
* </List>
|
|
176
|
-
* );
|
|
177
|
-
* }
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
const Submenu: typeof ActionPanelSubmenu;
|
|
181
|
-
/**
|
|
182
|
-
* Props of the {@link ActionPanel} React component.
|
|
183
|
-
*/
|
|
184
|
-
interface Props {
|
|
185
|
-
/**
|
|
186
|
-
* Sections or Actions. If {@link Action} elements are specified, a default section is automatically created.
|
|
187
|
-
*/
|
|
188
|
-
children?: ReactNode;
|
|
189
|
-
/**
|
|
190
|
-
* The title displayed at the top of the panel
|
|
191
|
-
*/
|
|
192
|
-
title?: string;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Supported children for the {@link ActionPanel} components.
|
|
196
|
-
*/
|
|
197
|
-
type Children = ReactElement<ActionPanel.Section.Props> | ReactElement<ActionPanel.Section.Props>[] | ActionPanel.Section.Children | null;
|
|
198
|
-
namespace Section {
|
|
199
|
-
/**
|
|
200
|
-
* Props of the {@link ActionPanel.Section} React component.
|
|
201
|
-
*/
|
|
202
|
-
interface Props {
|
|
203
|
-
/**
|
|
204
|
-
* The item elements of the section.
|
|
205
|
-
*/
|
|
206
|
-
children?: ReactNode;
|
|
207
|
-
/**
|
|
208
|
-
* Title displayed above the section
|
|
209
|
-
*/
|
|
210
|
-
title?: string;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Supported children for the {@link ActionPanel.Section} component.
|
|
214
|
-
*/
|
|
215
|
-
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;
|
|
216
|
-
}
|
|
217
|
-
namespace Submenu {
|
|
218
|
-
/**
|
|
219
|
-
* Props of the {@link ActionPanel.Submenu} React component.
|
|
220
|
-
*/
|
|
221
|
-
interface Props {
|
|
222
|
-
/**
|
|
223
|
-
* ID of the submenu.
|
|
224
|
-
* Make sure to assign each submenu a unique ID or a UUID will be auto-generated.
|
|
225
|
-
*/
|
|
226
|
-
id?: string;
|
|
227
|
-
/**
|
|
228
|
-
* The title displayed for submenu.
|
|
229
|
-
*/
|
|
230
|
-
title: string;
|
|
231
|
-
/**
|
|
232
|
-
* The icon displayed for the submenu.
|
|
233
|
-
*/
|
|
234
|
-
icon?: Image.ImageLike;
|
|
235
|
-
/**
|
|
236
|
-
* The keyboard shortcut for the submenu.
|
|
237
|
-
*/
|
|
238
|
-
shortcut?: Keyboard.Shortcut;
|
|
239
|
-
/**
|
|
240
|
-
* Items of the submenu.
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* ```typescript
|
|
244
|
-
* <ActionPanel.Submenu title="Submenu">
|
|
245
|
-
* <Action title="Just an action" />
|
|
246
|
-
* </ActionPanel.Submenu>
|
|
247
|
-
* ```
|
|
248
|
-
*
|
|
249
|
-
* @remarks
|
|
250
|
-
* If {@link Action} elements are specified, a default section is automatically created.\
|
|
251
|
-
* Use {@link ActionPanel.Submenu} as parent when specifying sub-menu's children to make code is more readable.
|
|
252
|
-
*/
|
|
253
|
-
children?: ReactNode;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Supported children for the {@link ActionPanel.Submenu} components.
|
|
257
|
-
*/
|
|
258
|
-
type Children = ActionPanel.Children;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
export {};
|