@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.
Files changed (81) hide show
  1. package/README.md +2 -2
  2. package/bin/arm64/ray +0 -0
  3. package/bin/ray +10 -4
  4. package/bin/x86/ray +0 -0
  5. package/package.json +2 -2
  6. package/types/index.d.ts +5192 -4098
  7. package/types/api/app/app.d.ts +0 -171
  8. package/types/api/app/clipboard.d.ts +0 -63
  9. package/types/api/app/index.d.ts +0 -4
  10. package/types/api/app/keyboard.d.ts +0 -56
  11. package/types/api/app/localStorage.d.ts +0 -117
  12. package/types/api/components/ActionPanel.d.ts +0 -261
  13. package/types/api/components/Detail.d.ts +0 -38
  14. package/types/api/components/Form.d.ts +0 -1016
  15. package/types/api/components/List.d.ts +0 -579
  16. package/types/api/components/actions/Action.d.ts +0 -458
  17. package/types/api/components/actions/CopyToClipboardAction.d.ts +0 -40
  18. package/types/api/components/actions/CreateQuicklinkAction.d.ts +0 -42
  19. package/types/api/components/actions/CreateSnippetAction.d.ts +0 -40
  20. package/types/api/components/actions/OpenAction.d.ts +0 -47
  21. package/types/api/components/actions/OpenInBrowserAction.d.ts +0 -43
  22. package/types/api/components/actions/OpenWithAction.d.ts +0 -40
  23. package/types/api/components/actions/PasteAction.d.ts +0 -40
  24. package/types/api/components/actions/PushAction.d.ts +0 -38
  25. package/types/api/components/actions/ShowInFinderAction.d.ts +0 -42
  26. package/types/api/components/actions/SubmitFormAction.d.ts +0 -35
  27. package/types/api/components/actions/TrashAction.d.ts +0 -43
  28. package/types/api/components/actions/index.d.ts +0 -1
  29. package/types/api/components/index.d.ts +0 -5
  30. package/types/api/components/propTypes.d.ts +0 -1
  31. package/types/api/components/types.d.ts +0 -30
  32. package/types/api/deprecated.d.ts +0 -415
  33. package/types/api/environment/environment.d.ts +0 -48
  34. package/types/api/environment/index.d.ts +0 -3
  35. package/types/api/environment/preferences.d.ts +0 -31
  36. package/types/api/environment/workspace.d.ts +0 -62
  37. package/types/api/hooks/index.d.ts +0 -1
  38. package/types/api/hooks/useNavigation.d.ts +0 -66
  39. package/types/api/index.d.ts +0 -6
  40. package/types/api/internal/comm/index.d.ts +0 -1
  41. package/types/api/internal/components/ErrorBoundary.d.ts +0 -1
  42. package/types/api/internal/components/Navigation.d.ts +0 -1
  43. package/types/api/internal/components/Root.d.ts +0 -1
  44. package/types/api/internal/components/index.d.ts +0 -3
  45. package/types/api/internal/devtools/actionPanel.d.ts +0 -1
  46. package/types/api/internal/devtools/index.d.ts +0 -2
  47. package/types/api/internal/devtools/react.d.ts +0 -1
  48. package/types/api/internal/hooks/index.d.ts +0 -1
  49. package/types/api/internal/hooks/useId.d.ts +0 -1
  50. package/types/api/internal/index.d.ts +0 -6
  51. package/types/api/internal/rendering/callbacks.d.ts +0 -1
  52. package/types/api/internal/rendering/index.d.ts +0 -6
  53. package/types/api/internal/rendering/logger.d.ts +0 -4
  54. package/types/api/internal/rendering/node-builders/actions.d.ts +0 -3
  55. package/types/api/internal/rendering/node-builders/detail.d.ts +0 -2
  56. package/types/api/internal/rendering/node-builders/forms.d.ts +0 -2
  57. package/types/api/internal/rendering/node-builders/keyboard.d.ts +0 -1
  58. package/types/api/internal/rendering/node-builders/list.d.ts +0 -4
  59. package/types/api/internal/rendering/node-builders/navigationStack.d.ts +0 -1
  60. package/types/api/internal/rendering/node-builders/root.d.ts +0 -1
  61. package/types/api/internal/rendering/node-builders/types.d.ts +0 -1
  62. package/types/api/internal/rendering/node-builders/utils.d.ts +0 -1
  63. package/types/api/internal/rendering/reconciler/index.d.ts +0 -1
  64. package/types/api/internal/rendering/reconciler/noHydratation.d.ts +0 -37
  65. package/types/api/internal/rendering/reconciler/noMutation.d.ts +0 -18
  66. package/types/api/internal/rendering/renderer.d.ts +0 -1
  67. package/types/api/internal/utils/ids.d.ts +0 -1
  68. package/types/api/internal/utils/index.d.ts +0 -3
  69. package/types/api/internal/utils/internal-children.d.ts +0 -26
  70. package/types/api/internal/utils/propTypes.d.ts +0 -3
  71. package/types/api/ui/color.d.ts +0 -115
  72. package/types/api/ui/errors.d.ts +0 -1
  73. package/types/api/ui/feedback/alert.d.ts +0 -97
  74. package/types/api/ui/feedback/hud.d.ts +0 -16
  75. package/types/api/ui/feedback/index.d.ts +0 -3
  76. package/types/api/ui/feedback/toast.d.ts +0 -174
  77. package/types/api/ui/icon.d.ts +0 -88
  78. package/types/api/ui/image.d.ts +0 -162
  79. package/types/api/ui/index.d.ts +0 -5
  80. package/types/core/message-types.d.ts +0 -17
  81. package/types/core/preferences.d.ts +0 -69
@@ -1,48 +0,0 @@
1
- /**
2
- * Holds data about the environment the command is running in. Use the global {@link environment} object to retrieve values.
3
- */
4
- export interface Environment {
5
- /**
6
- * The version of the main Raycast app
7
- */
8
- raycastVersion: string;
9
- /**
10
- * The name of the extension, as specified in package.json
11
- */
12
- extensionName: string;
13
- /**
14
- * The name of the launched command, as specified in package.json
15
- */
16
- commandName: string;
17
- /**
18
- * The absolute path to the assets directory of the extension.
19
- *
20
- * @remarks
21
- * This directory is used internally to load icons, images, and other bundled assets.
22
- */
23
- assetsPath: string;
24
- /**
25
- * The absolute path for the support directory of an extension. Use it to read and write files related to your extension or command.
26
- */
27
- supportPath: string;
28
- /**
29
- * Indicates whether the command is a development command (vs. an installed command from the Store).
30
- */
31
- isDevelopment: boolean;
32
- }
33
- /**
34
- * Contains environment values such as the Raycast version, extension info, and paths.
35
- *
36
- * @example
37
- * ```typescript
38
- * import { environment } from "@raycast/api";
39
- *
40
- * console.log(`Raycast version: ${environment.raycastVersion}`);
41
- * console.log(`Extension name: ${environment.extensionName}`);
42
- * console.log(`Command name: ${environment.commandName}`);
43
- * console.log(`Assets path: ${environment.assetsPath}`);
44
- * console.log(`Support path: ${environment.supportPath}`);
45
- * console.log(`Is development mode: ${environment.isDevelopment}`);
46
- * ```
47
- */
48
- export declare const environment: Environment;
@@ -1,3 +0,0 @@
1
- export * from "./environment";
2
- export * from "./preferences";
3
- export * from "./workspace";
@@ -1,31 +0,0 @@
1
- /**
2
- * Values of preference items.
3
- */
4
- export interface PreferenceValues {
5
- [name: string]: any;
6
- }
7
- /**
8
- * A function to access the preference values that have been passed to the command.
9
- *
10
- * @returns An object with the preference names as property key and the typed value as property value.
11
- *
12
- * @remarks
13
- * Each preference name is mapped to its value and the defined default values are used as fallback values.
14
- *
15
- * @example
16
- * ```typescript
17
- * import { getPreferenceValues } from "@raycast/api";
18
- *
19
- * interface Preferences {
20
- * name: string;
21
- * bodyWeight?: string;
22
- * bodyHeight?: string;
23
- * }
24
- *
25
- * export default async () => {
26
- * const preferences = getPreferenceValues<Preferences>();
27
- * console.log(preferences);
28
- * };
29
- * ```
30
- */
31
- export declare function getPreferenceValues<Values extends PreferenceValues = PreferenceValues>(): Values;
@@ -1,62 +0,0 @@
1
- /**
2
- * Gets the selected text of the frontmost application.
3
- *
4
- * @throws An error when no text is selected in the frontmost application.
5
- * @returns A Promise that resolves with the selected text.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { getSelectedText, Clipboard, showToast, Toast } from "@raycast/api";
10
- *
11
- * export default async () => {
12
- * try {
13
- * const selectedText = await getSelectedText();
14
- * const transformedText = selectedText.toUpperCase();
15
- * await Clipboard.paste(transformedText);
16
- * } catch (error) {
17
- * await showToast({
18
- * style: Toast.Style.Failure,
19
- * title: "Cannot transform text",
20
- * message: String(error)
21
- * });
22
- * }
23
- * };
24
- * ```
25
- */
26
- export declare function getSelectedText(): Promise<string>;
27
- /**
28
- * Holds data about a File System item. Use the {@link getSelectedFinderItems} method to retrieve values.
29
- */
30
- export interface FileSystemItem {
31
- /**
32
- * The path to the item
33
- */
34
- path: string;
35
- }
36
- /**
37
- * Gets the selected items from Finder.
38
- *
39
- * @throws An error when Finder is not the frontmost application.
40
- * @returns A Promise that resolves with the selected file system items.
41
- *
42
- * @example
43
- * ```typescript
44
- * import { getSelectedFinderItems, Clipboard, showToast, Toast } from "@raycast/api";
45
- *
46
- * export default async () => {
47
- * try {
48
- * const selectedItems = await getSelectedFinderItems();
49
- * if (selectedItems.length) {
50
- * await Clipboard.paste(selectedItems[0].path);
51
- * }
52
- * } catch (error) {
53
- * await showToast({
54
- * style: Toast.Style.Failure,
55
- * title: "Cannot copy file path",
56
- * message: String(error)
57
- * });
58
- * }
59
- * };
60
- * ```
61
- */
62
- export declare function getSelectedFinderItems(): Promise<FileSystemItem[]>;
@@ -1 +0,0 @@
1
- export * from "./useNavigation";
@@ -1,66 +0,0 @@
1
- import { ReactNode } from "react";
2
- /**
3
- * Return type of the {@link useNavigation} hook to perform push and pop actions.
4
- */
5
- export interface Navigation {
6
- /**
7
- * Push a new view component to the navigation stack.
8
- *
9
- * @param component - The React component to push to the navigation stack.
10
- */
11
- push: (component: ReactNode) => void;
12
- /**
13
- * Pop current view component from the navigation stack.
14
- */
15
- pop: () => void;
16
- }
17
- /**
18
- * A hook that lets you push and pop view components in the navigation stack.
19
- *
20
- * @remarks
21
- * You most likely won't use this hook too often. To push a new component, use the {@link PushAction}.
22
- * When a user presses `ESC`, we automatically push to the previous component.
23
- *
24
- * @returns A {@link Navigation} object with {@link Navigation.push} and {@link Navigation.pop} functions.
25
- * Use the functions to alter the navigation stack.
26
- *
27
- * @example
28
- * ```typescript
29
- * import { ActionPanel, Detail, useNavigation, Action } from "@raycast/api";
30
- *
31
- * function Ping() {
32
- * const { push } = useNavigation();
33
- *
34
- * return (
35
- * <Detail
36
- * markdown="Ping"
37
- * actions={
38
- * <ActionPanel>
39
- * <Action title="Push" onAction={() => push(<Pong />)} />
40
- * </ActionPanel>
41
- * }
42
- * />
43
- * );
44
- * }
45
- *
46
- * function Pong() {
47
- * const { pop } = useNavigation();
48
- *
49
- * return (
50
- * <Detail
51
- * markdown="Pong"
52
- * actions={
53
- * <ActionPanel>
54
- * <Action title="Pop" onAction={pop} />
55
- * </ActionPanel>
56
- * }
57
- * />
58
- * );
59
- * }
60
- *
61
- * export default function Command() {
62
- * return <Ping />;
63
- * }
64
- * ```
65
- */
66
- export declare function useNavigation(): Navigation;
@@ -1,6 +0,0 @@
1
- export * from "./app";
2
- export * from "./components";
3
- export * from "./environment";
4
- export * from "./hooks";
5
- export * from "./ui";
6
- export * from "./deprecated";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export * from "./ErrorBoundary";
2
- export * from "./Navigation";
3
- export * from "./Root";
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * from "./react";
2
- export * from "./actionPanel";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export * from "./useId";
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export * from "./comm";
2
- export * from "./components";
3
- export * from "./devtools";
4
- export * from "./hooks";
5
- export * from "./rendering";
6
- export * from "./utils";
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export * from "./renderer";
2
- export { apiCallbacks } from "./callbacks";
3
- export * from "./reconciler";
4
- export type { FormValueModel } from "./node-builders/forms";
5
- export { wrapImageIfNeeded } from "./node-builders/utils";
6
- export { specialKeys } from "./node-builders/keyboard";
@@ -1,4 +0,0 @@
1
- export declare function reactRenderDebugLog(...params: unknown[]): void;
2
- export declare function reconcilerDebugLog(...params: unknown[]): void;
3
- export declare function benchmarkingStart(label?: string): void;
4
- export declare function benchmarkingStop(label?: string): void;
@@ -1,3 +0,0 @@
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,2 +0,0 @@
1
- import { RaycastElement } from "./types";
2
- export declare function appendDetailChildElement(detailElement: RaycastElement, childElement: RaycastElement): void;
@@ -1,2 +0,0 @@
1
- import { RaycastElement } from "./types";
2
- export declare function appendFormChildElement(formElement: RaycastElement, childElement: RaycastElement): void;
@@ -1,4 +0,0 @@
1
- import { RaycastElement } from "./types";
2
- export declare function appendListChildElement(listElement: RaycastElement, childElement: RaycastElement): void;
3
- export declare function appendListDropdownChildElement(listElement: RaycastElement, childElement: RaycastElement): void;
4
- export declare function appendListItemChildElement(listItemElement: RaycastElement, childElement: RaycastElement): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const AllPropsFromChildren: PropsFromChildren[];
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,37 +0,0 @@
1
- declare function shim(): any;
2
- export declare const supportsHydration = false;
3
- export declare const canHydrateInstance: typeof shim;
4
- export declare const canHydrateTextInstance: typeof shim;
5
- export declare const canHydrateSuspenseInstance: typeof shim;
6
- export declare const isSuspenseInstancePending: typeof shim;
7
- export declare const isSuspenseInstanceFallback: typeof shim;
8
- export declare const registerSuspenseInstanceRetry: typeof shim;
9
- export declare const getNextHydratableSibling: typeof shim;
10
- export declare const getFirstHydratableChild: typeof shim;
11
- export declare const getFirstHydratableChildWithinContainer: typeof shim;
12
- export declare const getFirstHydratableChildWithinSuspenseInstance: typeof shim;
13
- export declare const hydrateInstance: typeof shim;
14
- export declare const hydrateTextInstance: typeof shim;
15
- export declare const hydrateSuspenseInstance: typeof shim;
16
- export declare const getNextHydratableInstanceAfterSuspenseInstance: typeof shim;
17
- export declare const commitHydratedContainer: typeof shim;
18
- export declare const commitHydratedSuspenseInstance: typeof shim;
19
- export declare const clearSuspenseBoundary: typeof shim;
20
- export declare const clearSuspenseBoundaryFromContainer: typeof shim;
21
- export declare const shouldDeleteUnhydratedTailInstances: typeof shim;
22
- export declare const didNotMatchHydratedContainerTextInstance: typeof shim;
23
- export declare const didNotMatchHydratedTextInstance: typeof shim;
24
- export declare const didNotHydrateInstanceWithinContainer: typeof shim;
25
- export declare const didNotHydrateInstanceWithinSuspenseInstance: typeof shim;
26
- export declare const didNotHydrateInstance: typeof shim;
27
- export declare const didNotFindHydratableInstanceWithinContainer: typeof shim;
28
- export declare const didNotFindHydratableTextInstanceWithinContainer: typeof shim;
29
- export declare const didNotFindHydratableSuspenseInstanceWithinContainer: typeof shim;
30
- export declare const didNotFindHydratableInstanceWithinSuspenseInstance: typeof shim;
31
- export declare const didNotFindHydratableTextInstanceWithinSuspenseInstance: typeof shim;
32
- export declare const didNotFindHydratableSuspenseInstanceWithinSuspenseInstance: typeof shim;
33
- export declare const didNotFindHydratableInstance: typeof shim;
34
- export declare const didNotFindHydratableTextInstance: typeof shim;
35
- export declare const didNotFindHydratableSuspenseInstance: typeof shim;
36
- export declare const errorHydratingContainer: typeof shim;
37
- export {};
@@ -1,18 +0,0 @@
1
- declare function shim(): any;
2
- export declare const supportsMutation = false;
3
- export declare const appendChild: typeof shim;
4
- export declare const appendChildToContainer: typeof shim;
5
- export declare const commitTextUpdate: typeof shim;
6
- export declare const commitMount: typeof shim;
7
- export declare const commitUpdate: typeof shim;
8
- export declare const insertBefore: typeof shim;
9
- export declare const insertInContainerBefore: typeof shim;
10
- export declare const removeChild: typeof shim;
11
- export declare const removeChildFromContainer: typeof shim;
12
- export declare const resetTextContent: typeof shim;
13
- export declare const hideInstance: typeof shim;
14
- export declare const hideTextInstance: typeof shim;
15
- export declare const unhideInstance: typeof shim;
16
- export declare const unhideTextInstance: typeof shim;
17
- export declare const clearContainer: typeof shim;
18
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export * from "./ids";
2
- export * from "./internal-children";
3
- export * from "./propTypes";
@@ -1,26 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { RaycastElement } from "../rendering/node-builders/types";
3
- /**
4
- * Users are expected to pass some components as props.
5
- * However, because internally we take that prop and pass it as a child (to go throught the react reconciler),
6
- * it means that a user could also pass the component as a child instead of using the prop.
7
- *
8
- * To circumvent this, in development mode we wrap the components passed as a prop with an `internal` flag context;
9
- *
10
- * Components that can be "internal" must listen to this context and pass it as a prop so that during
11
- * reconciliation, if the flag is falsy the component is not added to the render tree and a warning is printed.
12
- */
13
- export declare const InternalChildContext: import("react").Context<boolean>;
14
- /**
15
- * Method to wrap a component prop with the internal dev flag
16
- * @see {@link InternalChildContext}
17
- */
18
- export declare function propToInternalChild(prop?: ReactNode): {};
19
- /**
20
- * Check if the child has the internal flag set.
21
- * Output a warning otherwise.
22
- */
23
- export declare function internalChildInvariant(child: RaycastElement, warning: string): boolean;
24
- export declare type MaybeInternalComponent<T> = T & {
25
- internal?: boolean;
26
- };
@@ -1,3 +0,0 @@
1
- declare function getPropType(propValue: unknown): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "array";
2
- declare function getPreciseType(propValue: unknown): string;
3
- export { getPropType, getPreciseType };
@@ -1,115 +0,0 @@
1
- /**
2
- * The standard colors. Use those colors for consistency.
3
- *
4
- * @remarks
5
- * The colors automatically adapt to the Raycast theme (light or dark).
6
- *
7
- * @example
8
- * ```typescript
9
- * import { Color, Icon, List } from "@raycast/api";
10
- *
11
- * export default function Command() {
12
- * return (
13
- * <List>
14
- * <List.Item title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
15
- * <List.Item title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
16
- * <List.Item title="Brown" icon={{ source: Icon.Circle, tintColor: Color.Brown }} />
17
- * <List.Item title="Magenta" icon={{ source: Icon.Circle, tintColor: Color.Magenta }} />
18
- * <List.Item title="Orange" icon={{ source: Icon.Circle, tintColor: Color.Orange }} />
19
- * <List.Item title="Purple" icon={{ source: Icon.Circle, tintColor: Color.Purple }} />
20
- * <List.Item title="Red" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
21
- * <List.Item title="Yellow" icon={{ source: Icon.Circle, tintColor: Color.Yellow }} />
22
- * <List.Item title="PrimaryText" icon={{ source: Icon.Circle, tintColor: Color.PrimaryText }} />
23
- * <List.Item title="SecondaryText" icon={{ source: Icon.Circle, tintColor: Color.SecondaryText }} />
24
- * </List>
25
- * );
26
- * };
27
- * ```
28
- */
29
- export declare enum Color {
30
- Blue = "raycast-blue",
31
- Brown = "raycast-brown",
32
- Green = "raycast-green",
33
- Magenta = "raycast-magenta",
34
- Orange = "raycast-orange",
35
- Purple = "raycast-purple",
36
- Red = "raycast-red",
37
- Yellow = "raycast-yellow",
38
- PrimaryText = "raycast-primary-text",
39
- SecondaryText = "raycast-secondary-text"
40
- }
41
- export declare namespace Color {
42
- /**
43
- * Union type for the supported color types.
44
- *
45
- * {@link Color.Raw} will be dynamically adjusted to achieve high contrast with the Raycast user interface.
46
- *
47
- * @example
48
- * ```typescript
49
- * import { Color, Icon, List } from "@raycast/api";
50
- *
51
- * export default function Command() {
52
- * return (
53
- * <List>
54
- * <List.Item title="Built-in color" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
55
- * <List.Item title="HEX" icon={{ source: Icon.Circle, tintColor: "#FF0000" }} />
56
- * <List.Item title="Short HEX" icon={{ source: Icon.Circle, tintColor: "#F00" }} />
57
- * <List.Item title="RGBA" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0)" }} />
58
- * <List.Item title="RGBA Percentage" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0, 1.0)" }} />
59
- * <List.Item title="HSL" icon={{ source: Icon.Circle, tintColor: "hsla(200, 20%, 33%, 0.2)" }} />
60
- * <List.Item title="Keywords" icon={{ source: Icon.Circle, tintColor: "red" }} />
61
- * </List>
62
- * );
63
- * };
64
- * ```
65
- */
66
- type ColorLike = Color | Color.Dynamic | Color.Raw;
67
- /**
68
- * A dynamic color applies different colors depending on the active Raycast theme.
69
- *
70
- * @example
71
- * ```typescript
72
- * import { Color, Icon, List } from "@raycast/api";
73
- *
74
- * export default function Command() {
75
- * return (
76
- * <List>
77
- * <List.Item title="Dynamic Tint Color" icon={{ source: Icon.Circle, tintColor: { light: "#FF01FF", dark: "#FFFF50", adjustContrast: true } }} />
78
- * <List.Item title="Dynamic Tint Color" icon={{ source: Icon.Circle, tintColor: { light: "#FF01FF", dark: "#FFFF50" } }} />
79
- * </List>
80
- * );
81
- * };
82
- * ```
83
- */
84
- interface Dynamic {
85
- /**
86
- * The color which is used in light theme.
87
- */
88
- light: Color.Raw;
89
- /**
90
- * The color which is used in dark theme.
91
- */
92
- dark: Color.Raw;
93
- /**
94
- * Enables dynamic contrast adjustment for light and dark theme color.
95
- *
96
- * @remarks
97
- * Colors different to the built-in {@link Color} can be dynamically adjusted to achieve high contrast with the
98
- * Raycast user interface. This makes it easy to guarantee a good look and feel when you aren't in control of the
99
- * color, e.g. get it via a network request.
100
- *
101
- * @defaultValue false
102
- */
103
- adjustContrast?: boolean;
104
- }
105
- /**
106
- * You can use any of the following color formats:
107
- * - HEX, e.g `#FF0000`
108
- * - Short HEX, e.g. `#F00`
109
- * - RGBA, e.g. `rgb(255, 0, 0)`
110
- * - RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
111
- * - HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
112
- * - Keywords, e.g. `red`
113
- */
114
- type Raw = string;
115
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,97 +0,0 @@
1
- import { Image } from "../image";
2
- /**
3
- * Creates and shows a confirmation Alert with the given options.
4
- *
5
- * @param options - The options used to create the Alert.
6
- * @returns A Promise that resolves to a boolean when the user triggers one of the actions.
7
- * It will be `true` for the primary Action, `false` for the dismiss Action.
8
- *
9
- * @example
10
- * ```typescript
11
- * import { confirmAlert } from "@raycast/api";
12
- *
13
- * export default async () => {
14
- * if (await confirmAlert({ title: "Are you sure?" })) {
15
- * // do something
16
- * }
17
- * };
18
- * ```
19
- */
20
- export declare function confirmAlert(options: Alert.Options): Promise<boolean>;
21
- export declare namespace Alert {
22
- /**
23
- * The options to create an {@link Alert}.
24
- *
25
- * @example
26
- * ```typescript
27
- * import { confimrAlert, Alert } from "@raycast/api";
28
- *
29
- * export default async () => {
30
- * const options: Alert.Options = {
31
- * title: "Finished cooking",
32
- * message: "Delicious pasta for lunch",
33
- * primaryAction: {
34
- * title: 'Do something',
35
- * onAction: () => {
36
- * // while you can register a handler for an action, it's more elegant
37
- * // to use the `if (await confirmAlert(...)) { ... }` pattern
38
- * console.log("The alert action has been triggered")
39
- * }
40
- * }
41
- * };
42
- * await confirmAlert(options);
43
- * };
44
- * ```
45
- */
46
- interface Options {
47
- /**
48
- * The icon of an alert to illustrate the action. Displayed on the top.
49
- */
50
- icon?: Image.ImageLike;
51
- /**
52
- * The title of an alert. Displayed below the icon.
53
- */
54
- title: string;
55
- /**
56
- * An additional message for an Alert. Useful to show more information, e.g. a confirmation message for a destructive action.
57
- */
58
- message?: string;
59
- /**
60
- * The primary Action the user can take.
61
- */
62
- primaryAction?: ActionOptions;
63
- /**
64
- * The Action to dismiss the alert. There usually shouldn't be any side effects when the user takes this action.
65
- */
66
- dismissAction?: ActionOptions;
67
- }
68
- /**
69
- * The options to create an {@link Alert} Action.
70
- */
71
- interface ActionOptions {
72
- /**
73
- * The title of the action.
74
- */
75
- title: string;
76
- /**
77
- * The style of the action.
78
- */
79
- style?: ActionStyle;
80
- /**
81
- * A callback called when the action is triggered.
82
- */
83
- onAction?: () => void;
84
- }
85
- /**
86
- * Defines the visual style of an Action of the Alert.
87
- *
88
- * @remarks
89
- * Use {@link Alert.ActionStyle.Default} for confirmations of a positive action.
90
- * Use {@link Alert.ActionStyle.Destructive} for confirmations of a destructive action (eg. deleting a file).
91
- */
92
- enum ActionStyle {
93
- Default = "DEFAULT",
94
- Cancel = "CANCEL",
95
- Destructive = "DESTRUCTIVE"
96
- }
97
- }