@raycast/api 1.27.1 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/bin/arm64/ray +0 -0
  2. package/bin/x86/ray +0 -0
  3. package/package.json +2 -2
  4. package/types/api/app/app.d.ts +171 -0
  5. package/types/api/app/clipboard.d.ts +47 -0
  6. package/types/api/app/index.d.ts +4 -0
  7. package/types/api/app/keyboard.d.ts +56 -0
  8. package/types/api/app/localStorage.d.ts +117 -0
  9. package/types/api/components/ActionPanel.d.ts +297 -0
  10. package/types/api/components/Detail.d.ts +40 -0
  11. package/types/api/components/Form.d.ts +992 -0
  12. package/types/api/components/List.d.ts +275 -0
  13. package/types/api/components/actions/Action.d.ts +396 -0
  14. package/types/api/components/actions/CopyToClipboardAction.d.ts +39 -0
  15. package/types/api/components/actions/OpenAction.d.ts +47 -0
  16. package/types/api/components/actions/OpenInBrowserAction.d.ts +42 -0
  17. package/types/api/components/actions/OpenWithAction.d.ts +40 -0
  18. package/types/api/components/actions/PasteAction.d.ts +39 -0
  19. package/types/api/components/actions/PushAction.d.ts +38 -0
  20. package/types/api/components/actions/ShowInFinderAction.d.ts +42 -0
  21. package/types/api/components/actions/SubmitFormAction.d.ts +34 -0
  22. package/types/api/components/actions/TrashAction.d.ts +43 -0
  23. package/types/api/components/actions/index.d.ts +1 -0
  24. package/types/api/components/index.d.ts +5 -0
  25. package/types/api/components/propTypes.d.ts +1 -0
  26. package/types/api/components/types.d.ts +30 -0
  27. package/types/api/deprecated.d.ts +410 -0
  28. package/types/api/environment/environment.d.ts +48 -0
  29. package/types/api/environment/index.d.ts +3 -0
  30. package/types/api/environment/preferences.d.ts +31 -0
  31. package/types/api/environment/workspace.d.ts +62 -0
  32. package/types/api/hooks/index.d.ts +1 -0
  33. package/types/api/hooks/useNavigation.d.ts +66 -0
  34. package/types/api/index.d.ts +6 -0
  35. package/types/api/internal/comm/index.d.ts +1 -0
  36. package/types/api/internal/components/ErrorBoundary.d.ts +1 -0
  37. package/types/api/internal/components/Navigation.d.ts +1 -0
  38. package/types/api/internal/components/Root.d.ts +1 -0
  39. package/types/api/internal/components/index.d.ts +4 -0
  40. package/types/api/internal/components/portal/components/portal/Portal.d.ts +4 -0
  41. package/types/api/internal/components/portal/components/portal/index.d.ts +1 -0
  42. package/types/api/internal/components/portal/components/portalHost/PortalHost.d.ts +4 -0
  43. package/types/api/internal/components/portal/components/portalHost/index.d.ts +1 -0
  44. package/types/api/internal/components/portal/components/portalProvider/PortalProvider.d.ts +4 -0
  45. package/types/api/internal/components/portal/components/portalProvider/index.d.ts +1 -0
  46. package/types/api/internal/components/portal/contexts/index.d.ts +1 -0
  47. package/types/api/internal/components/portal/contexts/portal.d.ts +5 -0
  48. package/types/api/internal/components/portal/hooks/index.d.ts +2 -0
  49. package/types/api/internal/components/portal/hooks/usePortal.d.ts +8 -0
  50. package/types/api/internal/components/portal/hooks/usePortalState.d.ts +1 -0
  51. package/types/api/internal/components/portal/index.d.ts +5 -0
  52. package/types/api/internal/components/portal/state/constants.d.ts +9 -0
  53. package/types/api/internal/components/portal/state/index.d.ts +3 -0
  54. package/types/api/internal/components/portal/state/reducer.d.ts +3 -0
  55. package/types/api/internal/components/portal/utilities/logger.d.ts +9 -0
  56. package/types/api/internal/devtools/index.d.ts +1 -0
  57. package/types/api/internal/devtools/react.d.ts +1 -0
  58. package/types/api/internal/hooks/index.d.ts +2 -0
  59. package/types/api/internal/hooks/useActionPanel.d.ts +1 -0
  60. package/types/api/internal/hooks/useId.d.ts +1 -0
  61. package/types/api/internal/index.d.ts +6 -0
  62. package/types/api/internal/rendering/callbacks.d.ts +1 -0
  63. package/types/api/internal/rendering/index.d.ts +5 -0
  64. package/types/api/internal/rendering/node-builders/actions.d.ts +1 -0
  65. package/types/api/internal/rendering/node-builders/detail.d.ts +1 -0
  66. package/types/api/internal/rendering/node-builders/forms.d.ts +1 -0
  67. package/types/api/internal/rendering/node-builders/keyboard.d.ts +1 -0
  68. package/types/api/internal/rendering/node-builders/list.d.ts +1 -0
  69. package/types/api/internal/rendering/node-builders/navigationStack.d.ts +1 -0
  70. package/types/api/internal/rendering/node-builders/root.d.ts +1 -0
  71. package/types/api/internal/rendering/node-builders/types.d.ts +1 -0
  72. package/types/api/internal/rendering/node-builders/utils.d.ts +1 -0
  73. package/types/api/internal/rendering/reconciler.d.ts +1 -0
  74. package/types/api/internal/rendering/renderer.d.ts +1 -0
  75. package/types/api/internal/utils/ids.d.ts +1 -0
  76. package/types/api/internal/utils/index.d.ts +1 -0
  77. package/types/api/ui/color.d.ts +115 -0
  78. package/types/api/ui/errors.d.ts +1 -0
  79. package/types/api/ui/feedback/alert.d.ts +97 -0
  80. package/types/api/ui/feedback/hud.d.ts +16 -0
  81. package/types/api/ui/feedback/index.d.ts +3 -0
  82. package/types/api/ui/feedback/toast.d.ts +171 -0
  83. package/types/api/ui/icon.d.ts +88 -0
  84. package/types/api/ui/image.d.ts +161 -0
  85. package/types/api/ui/index.d.ts +5 -0
  86. package/types/core/message-types.d.ts +17 -0
  87. package/types/core/preferences.d.ts +69 -0
  88. package/types/index.d.ts +2777 -2536
@@ -0,0 +1,297 @@
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
+ * section 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
+ /**
75
+ * Exposes a list of actions that can be performed by the user.
76
+ *
77
+ * @remarks
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.
80
+ *
81
+ * The first and second action become the primary and secondary action. They automatically get the default keyboard shortcuts assigned.
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
83
+ * `⌘` `⇧` `↵` for the secondary.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * import { ActionPanel, Action, List } from "@raycast/api";
88
+ *
89
+ * export default function Command() {
90
+ * return (
91
+ * <List navigationTitle="Open Pull Requests">
92
+ * <List.Item
93
+ * title="Docs: Update API Reference"
94
+ * subtitle="#1"
95
+ * actions={
96
+ * <ActionPanel title="#1 in raycast/extensions">
97
+ * <Action.OpenInBrowser url="https://github.com/raycast/extensions/pull/1" />
98
+ * <Action.CopyToClipboard
99
+ * title="Copy Pull Request URL"
100
+ * content="https://github.com/raycast/extensions/pull/1"
101
+ * />
102
+ * </ActionPanel>
103
+ * }
104
+ * />
105
+ * </List>
106
+ * );
107
+ * }
108
+ * ```
109
+ */
110
+ fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
111
+ light: PropTypes.Validator<string>;
112
+ dark: PropTypes.Validator<string>;
113
+ }>>;
114
+ mask: PropTypes.Requireable<Image.Mask>;
115
+ tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
116
+ light: PropTypes.Validator<string>;
117
+ dark: PropTypes.Validator<string>;
118
+ adjustContrast: PropTypes.Requireable<boolean>;
119
+ }>>;
120
+ }>>;
121
+ shortcut: PropTypes.Requireable<Required<PropTypes.InferProps<{
122
+ modifiers: PropTypes.Validator<string[]>;
123
+ key: PropTypes.Validator<string>;
124
+ }>>>;
125
+ };
126
+ var displayName: string;
127
+ }
128
+ export declare namespace ActionPanel {
129
+ /**
130
+ * @deprecated Use `Action` instead.
131
+ */
132
+ const Item: typeof Action;
133
+ /**
134
+ * A group of visually separated items.
135
+ *
136
+ * @remarks
137
+ * Use sections if the {@link ActionPanel} contains a lot of actions to help guide the user to related actions.
138
+ * For example, create a section for all copy actions.
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * import { ActionPanel, Action, List } from "@raycast/api";
143
+ *
144
+ * export default function Command() {
145
+ * return (
146
+ * <List navigationTitle="Open Pull Requests">
147
+ * <List.Item
148
+ * title="Docs: Update API Reference"
149
+ * subtitle="#1"
150
+ * actions={
151
+ * <ActionPanel title="#1 in raycast/extensions">
152
+ * <ActionPanel.Section title="Copy">
153
+ * <Action.CopyToClipboard title="Copy Pull Request Number" content="#1" />
154
+ * <Action.CopyToClipboard
155
+ * title="Copy Pull Request URL"
156
+ * content="https://github.com/raycast/extensions/pull/1"
157
+ * />
158
+ * <Action.CopyToClipboard title="Copy Pull Request Title" content="Docs: Update API Reference" />
159
+ * </ActionPanel.Section>
160
+ * <ActionPanel.Section title="Danger zone">
161
+ * <Action title="Close Pull Request" onAction={() => console.log("Close PR #1")} />
162
+ * </ActionPanel.Section>
163
+ * </ActionPanel>
164
+ * }
165
+ * />
166
+ * </List>
167
+ * );
168
+ * }
169
+ * ```
170
+ */
171
+ const Section: typeof ActionPanelSection;
172
+ /**
173
+ * An action that replaces the current ActionPanel with its children when selected.
174
+ *
175
+ * @remarks
176
+ * 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
177
+ * or an assignee to a todo.
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * import { ActionPanel, Color, Icon, List, Action } from "@raycast/api";
182
+ *
183
+ * export default function Command() {
184
+ * return (
185
+ * <List navigationTitle="Open Pull Requests">
186
+ * <List.Item
187
+ * title="Docs: Update API Reference"
188
+ * subtitle="#1"
189
+ * actions={
190
+ * <ActionPanel title="#1 in raycast/extensions">
191
+ * <ActionPanel.Submenu title="Add Label">
192
+ * <Action
193
+ * icon={{ source: Icon.Circle, tintColor: Color.Red }}
194
+ * title="Bug"
195
+ * onAction={() => console.log("Add bug label")}
196
+ * />
197
+ * <Action
198
+ * icon={{ source: Icon.Circle, tintColor: Color.Yellow }}
199
+ * title="Enhancement"
200
+ * onAction={() => console.log("Add enhancement label")}
201
+ * />
202
+ * <Action
203
+ * icon={{ source: Icon.Circle, tintColor: Color.Blue }}
204
+ * title="Help Wanted"
205
+ * onAction={() => console.log("Add help wanted label")}
206
+ * />
207
+ * </ActionPanel.Submenu>
208
+ * </ActionPanel>
209
+ * }
210
+ * />
211
+ * </List>
212
+ * );
213
+ * }
214
+ * ```
215
+ */
216
+ const Submenu: typeof ActionPanelSubmenu;
217
+ /**
218
+ * Props of the {@link ActionPanel} React component.
219
+ */
220
+ interface Props {
221
+ /**
222
+ * Sections or Actions. If {@link Action} elements are specified, a default section is automatically created.
223
+ */
224
+ children?: ReactNode;
225
+ /**
226
+ * The title displayed at the top of the panel
227
+ */
228
+ title?: string;
229
+ }
230
+ /**
231
+ * Supported children for the {@link ActionPanel} components.
232
+ */
233
+ type Children = ReactElement<ActionPanel.Section.Props> | ReactElement<ActionPanel.Section.Props>[] | ActionPanel.Section.Children | null;
234
+ namespace Section {
235
+ /**
236
+ * Props of the {@link ActionPanel.Section} React component.
237
+ */
238
+ interface Props {
239
+ /**
240
+ * The item elements of the section.
241
+ */
242
+ children?: ReactNode;
243
+ /**
244
+ * Title displayed above the section
245
+ */
246
+ title?: string;
247
+ }
248
+ /**
249
+ * Supported children for the {@link ActionPanel.Section} component.
250
+ */
251
+ 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;
252
+ }
253
+ namespace Submenu {
254
+ /**
255
+ * Props of the {@link ActionPanel.Submenu} React component.
256
+ */
257
+ interface Props {
258
+ /**
259
+ * ID of the submenu.
260
+ * Make sure to assign each submenu a unique ID or a UUID will be auto-generated.
261
+ */
262
+ id?: string;
263
+ /**
264
+ * The title displayed for submenu.
265
+ */
266
+ title: string;
267
+ /**
268
+ * The icon displayed for the submenu.
269
+ */
270
+ icon?: Image.ImageLike;
271
+ /**
272
+ * The keyboard shortcut for the submenu.
273
+ */
274
+ shortcut?: Keyboard.Shortcut;
275
+ /**
276
+ * Items of the submenu.
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * <ActionPanel.Submenu title="Submenu">
281
+ * <Action title="Just an action" />
282
+ * </ActionPanel.Submenu>
283
+ * ```
284
+ *
285
+ * @remarks
286
+ * If {@link Action} elements are specified, a default section is automatically created.\
287
+ * Use {@link ActionPanel.Submenu} as parent when specifying sub-menu's children to make code is more readable.
288
+ */
289
+ children?: ReactNode;
290
+ }
291
+ /**
292
+ * Supported children for the {@link ActionPanel.Submenu} components.
293
+ */
294
+ type Children = ActionPanel.Children;
295
+ }
296
+ }
297
+ export {};
@@ -0,0 +1,40 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ import { ActionsInterface, NavigationChildInterface } from "./types";
3
+ import PropTypes from "prop-types";
4
+ /**
5
+ * Renders a markdown (CommonMark) string.
6
+ *
7
+ * @remarks
8
+ * Typically used as a standalone view or when navigating from a {@link List}.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { Detail } from "@raycast/api";
13
+ *
14
+ * export default function Command() {
15
+ * return <Detail markdown="**Hello** _World_!" />;
16
+ * }
17
+ * ```
18
+ */
19
+ export declare function Detail(props: Detail.Props): ReactElement<Detail.Props>;
20
+ export declare namespace Detail {
21
+ var propTypes: {
22
+ navigationTitle: PropTypes.Requireable<string>;
23
+ isLoading: PropTypes.Requireable<boolean>;
24
+ markdown: PropTypes.Requireable<string>;
25
+ };
26
+ var displayName: string;
27
+ }
28
+ export declare namespace Detail {
29
+ /**
30
+ * Props of the {@link Detail} React component.
31
+ */
32
+ interface Props extends ActionsInterface, NavigationChildInterface {
33
+ /**
34
+ * The CommonMark string to be rendered.
35
+ */
36
+ markdown?: string | null;
37
+ /** @deprecated - Use the `markdown` prop instead */
38
+ children?: ReactNode;
39
+ }
40
+ }