@raycast/api 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/arm64/ray CHANGED
Binary file
package/bin/x86/ray CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "Build extensions for Raycast with React and Node.js.",
5
5
  "author": "Raycast Technologies Ltd.",
6
6
  "homepage": "https://developers.raycast.com",
@@ -8,7 +8,7 @@ import { Action } from "./actions";
8
8
  *
9
9
  * @remarks
10
10
  * Often items are context-aware, e.g. based on the selected list item. Actions can be grouped into semantic
11
- * section and can have keyboard shortcuts assigned.
11
+ * sections and can have keyboard shortcuts assigned.
12
12
  *
13
13
  * The first and second action become the primary and secondary action. They automatically get the default keyboard shortcuts assigned.
14
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
@@ -76,7 +76,7 @@ declare namespace ActionPanelSubmenu {
76
76
  *
77
77
  * @remarks
78
78
  * Often items are context-aware, e.g. based on the selected list item. Actions can be grouped into semantic
79
- * section and can have keyboard shortcuts assigned.
79
+ * sections and can have keyboard shortcuts assigned.
80
80
  *
81
81
  * The first and second action become the primary and secondary action. They automatically get the default keyboard shortcuts assigned.
82
82
  * 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
@@ -134,7 +134,7 @@ export declare namespace ActionPanel {
134
134
  * A group of visually separated items.
135
135
  *
136
136
  * @remarks
137
- * Use sections if the {@link ActionPanel} contains a lot of actions to help guide the user to related actions.
137
+ * Use sections when the {@link ActionPanel} contains a lot of actions to help guide the user to related actions.
138
138
  * For example, create a section for all copy actions.
139
139
  *
140
140
  * @example
@@ -3,6 +3,8 @@ import PropTypes from "prop-types";
3
3
  import { Keyboard } from "../../app";
4
4
  import { Image } from "../../ui";
5
5
  import { CopyToClipboardAction, CopyToClipboardActionProps } from "./CopyToClipboardAction";
6
+ import { CreateQuicklinkAction, CreateQuicklinkProps } from "./CreateQuicklinkAction";
7
+ import { CreateSnippetAction, CreateSnippetProps } from "./CreateSnippetAction";
6
8
  import { OpenAction, OpenActionProps } from "./OpenAction";
7
9
  import { OpenInBrowserAction, OpenInBrowserActionProps } from "./OpenInBrowserAction";
8
10
  import { OpenWithAction, OpenWithActionProps } from "./OpenWithAction";
@@ -311,6 +313,50 @@ export declare namespace Action {
311
313
  * ```
312
314
  */
313
315
  const Trash: typeof TrashAction;
316
+ /**
317
+ * Action that navigates to the the Create Snippet command with some or all of the fields prefilled.
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * import { ActionPanel, Detail, Action } from "@raycast/api";
322
+ *
323
+ * export default function Command() {
324
+ * return (
325
+ * <Detail
326
+ * markdown="Test out snippet creation"
327
+ * actions={
328
+ * <ActionPanel>
329
+ * <Action.CreateSnippet snippet={{ text: "DE75512108001245126199" }} />
330
+ * </ActionPanel>
331
+ * }
332
+ * />
333
+ * );
334
+ * }
335
+ * ```
336
+ */
337
+ const CreateSnippet: typeof CreateSnippetAction;
338
+ /**
339
+ * Action that navigates to the the Create Quicklink command with some or all of the fields prefilled.
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * import { ActionPanel, Detail, Action } from "@raycast/api";
344
+ *
345
+ * export default function Command() {
346
+ * return (
347
+ * <Detail
348
+ * markdown="Test out quicklink creation"
349
+ * actions={
350
+ * <ActionPanel>
351
+ * <Action.CreateQuicklink quicklink={{ link: "https://duckduckgo.com/?q={Query}" }} />
352
+ * </ActionPanel>
353
+ * }
354
+ * />
355
+ * );
356
+ * }
357
+ * ```
358
+ */
359
+ const CreateQuicklink: typeof CreateQuicklinkAction;
314
360
  /**
315
361
  * Props of the {@link Action} React component.
316
362
  */
@@ -339,6 +385,18 @@ export declare namespace Action {
339
385
  */
340
386
  onAction?: () => void;
341
387
  }
388
+ namespace CreateQuicklink {
389
+ /**
390
+ * Props of the {@link Action.CreateQuicklink} React component.
391
+ */
392
+ type Props = CreateQuicklinkProps;
393
+ }
394
+ namespace CreateSnippet {
395
+ /**
396
+ * Props of the {@link Action.CreateSnippet} React component.
397
+ */
398
+ type Props = CreateSnippetProps;
399
+ }
342
400
  namespace CopyToClipboard {
343
401
  /**
344
402
  * Props of the {@link Action.CopyToClipboard} React component.
@@ -11,6 +11,7 @@ export interface CopyToClipboardActionProps {
11
11
  content: string | number;
12
12
  /**
13
13
  * An optional title for the action.
14
+ * @defaultValue Copy to Clipboard
14
15
  */
15
16
  title?: string;
16
17
  /**
@@ -0,0 +1,42 @@
1
+ import { ReactElement } from "react";
2
+ import { Image } from "../../ui";
3
+ import { Application, Keyboard } from "../../app";
4
+ export interface Quicklink {
5
+ /**
6
+ * The URL or file path, optionally including placeholders such as in "https://google.com/search?q={Query}"
7
+ */
8
+ link: string;
9
+ /**
10
+ * The quicklink name
11
+ */
12
+ name?: string;
13
+ /**
14
+ * The application that the quicklink should be opened in.
15
+ */
16
+ application?: string | Application;
17
+ }
18
+ export interface CreateQuicklinkProps {
19
+ /**
20
+ * The {@link Quicklink} to create.
21
+ */
22
+ quicklink: Quicklink;
23
+ /**
24
+ * An optional title for the action.
25
+ */
26
+ title?: string;
27
+ /**
28
+ * A optional icon displayed for the item. See {@link ImageLike} for the supported formats and types.
29
+ */
30
+ icon?: Image.ImageLike;
31
+ /**
32
+ * The keyboard shortcut for the action.
33
+ */
34
+ shortcut?: Keyboard.Shortcut;
35
+ }
36
+ /**
37
+ * See {@link Action.CreateQuicklink}
38
+ */
39
+ export declare function CreateQuicklinkAction(props: CreateQuicklinkProps): ReactElement<CreateQuicklinkProps>;
40
+ export declare namespace CreateQuicklinkAction {
41
+ var displayName: string;
42
+ }
@@ -0,0 +1,40 @@
1
+ import { ReactElement } from "react";
2
+ import { Image } from "../../ui";
3
+ import { Keyboard } from "../../app";
4
+ interface Snippet {
5
+ /**
6
+ * The snippet contents.
7
+ */
8
+ text: string;
9
+ /**
10
+ * The snippet name.
11
+ */
12
+ name?: string;
13
+ /**
14
+ * The keyword to trigger the snippet.
15
+ */
16
+ keyword?: string;
17
+ }
18
+ export interface CreateSnippetProps {
19
+ snippet: Snippet;
20
+ /**
21
+ * An optional title for the action.
22
+ */
23
+ title?: string;
24
+ /**
25
+ * A optional icon displayed for the item. See {@link ImageLike} for the supported formats and types.
26
+ */
27
+ icon?: Image.ImageLike;
28
+ /**
29
+ * The keyboard shortcut for the action.
30
+ */
31
+ shortcut?: Keyboard.Shortcut;
32
+ }
33
+ /**
34
+ * See {@link Action.CreateQuicklink}
35
+ */
36
+ export declare function CreateSnippetAction(props: CreateSnippetProps): ReactElement<CreateSnippetProps>;
37
+ export declare namespace CreateSnippetAction {
38
+ var displayName: string;
39
+ }
40
+ export {};
@@ -11,6 +11,7 @@ export interface OpenInBrowserActionProps {
11
11
  url: string;
12
12
  /**
13
13
  * An optional title for the action.
14
+ * @defaultValue Open in Browser
14
15
  */
15
16
  title?: string;
16
17
  /**
@@ -11,6 +11,7 @@ export interface PasteActionProps {
11
11
  content: string | number;
12
12
  /**
13
13
  * An optional title for the action.
14
+ * @defaultValue Paste in Active app
14
15
  */
15
16
  title?: string;
16
17
  /**
@@ -8,6 +8,7 @@ import type { Form } from "../Form";
8
8
  export interface SubmitFormActionProps<Values> {
9
9
  /**
10
10
  * The title displayed for the item.
11
+ * @defaultValue Submit Form
11
12
  */
12
13
  title?: string;
13
14
  /**
@@ -53,7 +53,7 @@ export interface LocalStorageValues extends LocalStorage.Values {
53
53
  export interface KeyboardShortcut extends Keyboard.Shortcut {
54
54
  }
55
55
  /**
56
- * @deprecated Use `Keyboard.specialKeys` instead
56
+ * @deprecated
57
57
  */
58
58
  export declare const specialKeys: Record<string, string>;
59
59
  /**
@@ -3,3 +3,4 @@ export { apiCallbacks } from "./callbacks";
3
3
  export * from "./reconciler";
4
4
  export type { FormValueModel } from "./node-builders/forms";
5
5
  export { wrapImageIfNeeded } from "./node-builders/utils";
6
+ export { specialKeys } from "./node-builders/keyboard";
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,3 @@
1
- export {};
1
+ import { RaycastElement } from "./types";
2
+ export declare function appendActionPanelChildElement(actionPanelElement: RaycastElement, childElement: RaycastElement): void;
3
+ export declare function appendActionPanelSubmenuChildElement(actionPanelElement: RaycastElement, childElement: RaycastElement): void;
@@ -1 +1,2 @@
1
- export {};
1
+ import { RaycastElement } from "./types";
2
+ export declare function appendListChildElement(listElement: RaycastElement, childElement: RaycastElement): void;
@@ -3,7 +3,7 @@ import { Image } from "../image";
3
3
  * Creates and shows a confirmation Alert with the given options.
4
4
  *
5
5
  * @param options - The options used to create the Alert.
6
- * @returns A Promise that resolves to a boolean when the user takes an action.
6
+ * @returns A Promise that resolves to a boolean when the user triggers one of the actions.
7
7
  * It will be `true` for the primary Action, `false` for the dismiss Action.
8
8
  *
9
9
  * @example
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A HUD will automatically hide the main window and show a compact message at the bottom of the screen.
3
3
  *
4
- * @param title - The title that will be displayed for the HUD.
4
+ * @param title - The title that will be displayed in the HUD.
5
5
  * @returns A Promise that resolves when the HUD is shown.
6
6
  *
7
7
  * @example
@@ -29,14 +29,17 @@ import { Keyboard } from "../../app";
29
29
  * export default async () => {
30
30
  * const toast = await showToast({ style: Toast.Style.Animated, title: "Uploading image" });
31
31
  *
32
- * await setTimeout(1000);
33
- *
34
- * toast.style = ToastStyle.Success;
35
- * toast.title = "Uploaded image";
36
- *
37
- * await setTimeout(500);
32
+ * try {
33
+ * // upload the image
34
+ * await setTimeout(1000);
38
35
  *
39
- * await toast.hide()
36
+ * toast.style = Toast.Style.Success;
37
+ * toast.title = "Uploaded image";
38
+ * } catch (err) {
39
+ * toast.style = Toast.Style.Failure;
40
+ * toast.title = "Failed to upload image";
41
+ * toast.message = err.message;
42
+ * }
40
43
  * };
41
44
  * ```
42
45
  */
@@ -103,7 +103,8 @@ export declare namespace Image {
103
103
  dark: URL | Asset;
104
104
  };
105
105
  /**
106
- * Fallback {@link Image} source. Can be a local file resource, a built-in {@link Icon} or a single emoji.
106
+ * Fallback {@link Image} source. Can be a local file resource, a built-in {@link Icon}, a single emoji, or a theme-aware asset.
107
+ * Any specified `mask` or `tintColor` will also apply to the fallback image.
107
108
  *
108
109
  * @example
109
110
  * ```typescript