@raycast/api 1.26.1 → 1.27.1
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 +0 -0
- package/bin/x86/ray +0 -0
- package/package.json +2 -2
- package/types/index.d.ts +530 -96
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.
|
|
3
|
+
"version": "1.27.1",
|
|
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",
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
"bin": {
|
|
14
14
|
"ray": "./bin/ray"
|
|
15
15
|
}
|
|
16
|
-
}
|
|
16
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -172,6 +172,26 @@ export function getApplications(path?: PathLike): Promise<Application[]>;
|
|
|
172
172
|
* @category Utilities
|
|
173
173
|
*/
|
|
174
174
|
export function getDefaultApplication(path: PathLike): Promise<Application>;
|
|
175
|
+
/**
|
|
176
|
+
* Opens a target with the default application or specified application.
|
|
177
|
+
*
|
|
178
|
+
* @param target The file, folder or URL to open.
|
|
179
|
+
* @param application The application name to use for opening the file. If no application is specified, the default application as determined by the system
|
|
180
|
+
* is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app.
|
|
181
|
+
* @returns A promise that resolves when the target has been opened.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
*
|
|
186
|
+
*
|
|
187
|
+
* export default async () => {
|
|
188
|
+
* await open("https://www.raycast.com", "com.google.Chrome");
|
|
189
|
+
* };
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @category Utilities
|
|
193
|
+
*/
|
|
194
|
+
export function open(target: string, application?: Application | string): Promise<void>;
|
|
175
195
|
/**
|
|
176
196
|
* Copies text to the clipboard.
|
|
177
197
|
*
|
|
@@ -225,30 +245,6 @@ export function clearClipboard(): Promise<void>;
|
|
|
225
245
|
* @category Clipboard
|
|
226
246
|
*/
|
|
227
247
|
export function pasteText(text: string): Promise<void>;
|
|
228
|
-
/**
|
|
229
|
-
* Gets the selected text of the frontmost application.
|
|
230
|
-
*
|
|
231
|
-
* @throws An error when no text is selected in the frontmost application.
|
|
232
|
-
* @returns Returns a promise that resolves with the selected text.
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* ```typescript
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* export default async () => {
|
|
239
|
-
* try {
|
|
240
|
-
* const selectedText = await getSelectedText();
|
|
241
|
-
* const transformedText = selectedText.toUpperCase();
|
|
242
|
-
* await pasteText(transformedText);
|
|
243
|
-
* } catch (error) {
|
|
244
|
-
* await showToast(ToastStyle.Failure, "Cannot transform text", String(error));
|
|
245
|
-
* }
|
|
246
|
-
* };
|
|
247
|
-
* ```
|
|
248
|
-
*
|
|
249
|
-
* @category Clipboard
|
|
250
|
-
*/
|
|
251
|
-
export function getSelectedText(): Promise<string>;
|
|
252
248
|
/**
|
|
253
249
|
* A keyboard shortcut is defined by one or more modifier keys (command, control, etc.) and a single key equivalent (a character or special key).
|
|
254
250
|
* See {@link KeyModifier} and {@link KeyEquivalent} for supported values.
|
|
@@ -861,10 +857,12 @@ global {
|
|
|
861
857
|
interface IntrinsicElements {
|
|
862
858
|
"ray-form": FormProps;
|
|
863
859
|
"ray-form-textfield": FormTextFieldProps;
|
|
860
|
+
"ray-form-passwordfield": FormPasswordFieldProps;
|
|
864
861
|
"ray-form-textarea": FormTextAreaProps;
|
|
865
862
|
"ray-form-checkbox": FormCheckboxProps;
|
|
866
863
|
"ray-form-datepicker": FormDatePickerProps;
|
|
867
864
|
"ray-form-separator": FormSeparatorProps;
|
|
865
|
+
"ray-form-description": FormDescriptionProps;
|
|
868
866
|
"ray-form-dropdown": FormDropdownProps;
|
|
869
867
|
"ray-form-tagpicker": FormTagPickerProps;
|
|
870
868
|
"ray-form-tagpicker-item": FormTagPickerItemProps;
|
|
@@ -931,12 +929,12 @@ export interface FormValues {
|
|
|
931
929
|
*/
|
|
932
930
|
export interface FormProps extends ActionsInterface, NavigationChildInterface {
|
|
933
931
|
/**
|
|
934
|
-
* The
|
|
932
|
+
* The Form.Item elements of the form.
|
|
935
933
|
*/
|
|
936
934
|
children?: ReactElement<FormItemProps<FormValue>> | Array<ReactElement<FormItemProps<FormValue>>> | null;
|
|
937
935
|
}
|
|
938
936
|
/**
|
|
939
|
-
* Shows a list of form items such as {@link
|
|
937
|
+
* Shows a list of form items such as {@link Form.TextField}, {@link Form.Checkbox} or {@link Form.Dropdown}.
|
|
940
938
|
*
|
|
941
939
|
* @category User Interface
|
|
942
940
|
* @subcategory Form
|
|
@@ -951,9 +949,11 @@ export namespace Form {
|
|
|
951
949
|
var displayName: string;
|
|
952
950
|
var TextField: typeof FormTextField;
|
|
953
951
|
var TextArea: typeof FormTextArea;
|
|
952
|
+
var PasswordField: typeof FormPasswordField;
|
|
954
953
|
var Checkbox: typeof FormCheckbox;
|
|
955
954
|
var DatePicker: typeof FormDatePicker;
|
|
956
955
|
var Separator: typeof FormSeparator;
|
|
956
|
+
var Description: typeof FormDescription;
|
|
957
957
|
var Dropdown: typeof FormDropdown;
|
|
958
958
|
var DropdownSection: typeof FormDropdownSection;
|
|
959
959
|
var DropdownItem: typeof FormDropdownItem;
|
|
@@ -961,7 +961,7 @@ export namespace Form {
|
|
|
961
961
|
var TagPickerItem: typeof FormTagPickerItem;
|
|
962
962
|
}
|
|
963
963
|
/**
|
|
964
|
-
* Props of the
|
|
964
|
+
* Props of the Form.Item React component.
|
|
965
965
|
*
|
|
966
966
|
* @category User Interface
|
|
967
967
|
* @subcategory Form
|
|
@@ -1019,7 +1019,13 @@ export interface FormTextFieldProps extends FormItemProps<string> {
|
|
|
1019
1019
|
*
|
|
1020
1020
|
* export default function Command() {
|
|
1021
1021
|
* return (
|
|
1022
|
-
* <Form
|
|
1022
|
+
* <Form
|
|
1023
|
+
* actions={
|
|
1024
|
+
* <ActionPanel>
|
|
1025
|
+
* <SubmitFormAction title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
1026
|
+
* </ActionPanel>
|
|
1027
|
+
* }
|
|
1028
|
+
* >
|
|
1023
1029
|
* <Form.TextField id="name" defaultValue="Steve" />
|
|
1024
1030
|
* </Form>
|
|
1025
1031
|
* );
|
|
@@ -1034,11 +1040,17 @@ export interface FormTextFieldProps extends FormItemProps<string> {
|
|
|
1034
1040
|
*
|
|
1035
1041
|
*
|
|
1036
1042
|
* export default function Command() {
|
|
1037
|
-
* const [
|
|
1043
|
+
* const [name, setName] = useState<string>();
|
|
1038
1044
|
*
|
|
1039
1045
|
* return (
|
|
1040
|
-
* <Form
|
|
1041
|
-
*
|
|
1046
|
+
* <Form
|
|
1047
|
+
* actions={
|
|
1048
|
+
* <ActionPanel>
|
|
1049
|
+
* <SubmitFormAction title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
1050
|
+
* </ActionPanel>
|
|
1051
|
+
* }
|
|
1052
|
+
* >
|
|
1053
|
+
* <Form.TextField id="name" value={name} onChange={setName} />
|
|
1042
1054
|
* </Form>
|
|
1043
1055
|
* );
|
|
1044
1056
|
* }
|
|
@@ -1060,6 +1072,82 @@ export namespace FormTextField {
|
|
|
1060
1072
|
};
|
|
1061
1073
|
var displayName: string;
|
|
1062
1074
|
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Props of the {@link Form.PasswordField} React component.
|
|
1077
|
+
*
|
|
1078
|
+
* @category User Interface
|
|
1079
|
+
* @subcategory Form
|
|
1080
|
+
*/
|
|
1081
|
+
export interface FormPasswordFieldProps extends FormItemProps<string> {
|
|
1082
|
+
/**
|
|
1083
|
+
* Placeholder text shown in the password field.
|
|
1084
|
+
*/
|
|
1085
|
+
placeholder?: string;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* A form item with a secure text field for password-entry in which the entered characters must be kept secret.
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* Uncontrolled password field
|
|
1092
|
+
*
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
*
|
|
1095
|
+
*
|
|
1096
|
+
* export default function Command() {
|
|
1097
|
+
* return (
|
|
1098
|
+
* <Form
|
|
1099
|
+
* actions={
|
|
1100
|
+
* <ActionPanel>
|
|
1101
|
+
* <SubmitFormAction title="Submit Password" onSubmit={(values) => console.log(values)} />
|
|
1102
|
+
* </ActionPanel>
|
|
1103
|
+
* }
|
|
1104
|
+
* >
|
|
1105
|
+
* <Form.PasswordField id="password" title="Enter Password" />
|
|
1106
|
+
* </Form>
|
|
1107
|
+
* );
|
|
1108
|
+
* }
|
|
1109
|
+
* ```
|
|
1110
|
+
*
|
|
1111
|
+
* @example
|
|
1112
|
+
* Controlled password field
|
|
1113
|
+
*
|
|
1114
|
+
* ```typescript
|
|
1115
|
+
*
|
|
1116
|
+
*
|
|
1117
|
+
*
|
|
1118
|
+
* export default function Command() {
|
|
1119
|
+
* const [password, setPassword] = useState<string>();
|
|
1120
|
+
*
|
|
1121
|
+
* return (
|
|
1122
|
+
* <Form
|
|
1123
|
+
* actions={
|
|
1124
|
+
* <ActionPanel>
|
|
1125
|
+
* <SubmitFormAction title="Submit Password" onSubmit={(values) => console.log(values)} />
|
|
1126
|
+
* </ActionPanel>
|
|
1127
|
+
* }
|
|
1128
|
+
* >
|
|
1129
|
+
* <Form.PasswordField id="password" value={password} onChange={setPassword} />
|
|
1130
|
+
* </Form>
|
|
1131
|
+
* );
|
|
1132
|
+
* }
|
|
1133
|
+
* ```
|
|
1134
|
+
*
|
|
1135
|
+
* @category User Interface
|
|
1136
|
+
* @subcategory Form
|
|
1137
|
+
*/
|
|
1138
|
+
export function FormPasswordField(props: FormPasswordFieldProps): ReactElement<FormPasswordFieldProps>;
|
|
1139
|
+
export namespace FormPasswordField {
|
|
1140
|
+
var propTypes: {
|
|
1141
|
+
id: PropTypes.Validator<string>;
|
|
1142
|
+
title: PropTypes.Requireable<string>;
|
|
1143
|
+
storeValue: PropTypes.Requireable<boolean>;
|
|
1144
|
+
value: PropTypes.Requireable<string>;
|
|
1145
|
+
defaultValue: PropTypes.Requireable<string>;
|
|
1146
|
+
placeholder: PropTypes.Requireable<string>;
|
|
1147
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
1148
|
+
};
|
|
1149
|
+
var displayName: string;
|
|
1150
|
+
}
|
|
1063
1151
|
/**
|
|
1064
1152
|
* Props of the {@link Form.TextArea} React component.
|
|
1065
1153
|
*
|
|
@@ -1083,11 +1171,17 @@ export interface FormTextAreaProps extends FormItemProps<string> {
|
|
|
1083
1171
|
*
|
|
1084
1172
|
*
|
|
1085
1173
|
* const DESCRIPTION =
|
|
1086
|
-
* "We spend too much time
|
|
1174
|
+
* "We spend too much time staring at loading indicators. The Raycast team is dedicated to make everybody interact faster with their computers.";
|
|
1087
1175
|
*
|
|
1088
1176
|
* export default function Command() {
|
|
1089
1177
|
* return (
|
|
1090
|
-
* <Form
|
|
1178
|
+
* <Form
|
|
1179
|
+
* actions={
|
|
1180
|
+
* <ActionPanel>
|
|
1181
|
+
* <SubmitFormAction title="Submit Description" onSubmit={(values) => console.log(values)} />
|
|
1182
|
+
* </ActionPanel>
|
|
1183
|
+
* }
|
|
1184
|
+
* >
|
|
1091
1185
|
* <Form.TextArea id="description" defaultValue={DESCRIPTION} />
|
|
1092
1186
|
* </Form>
|
|
1093
1187
|
* );
|
|
@@ -1102,11 +1196,17 @@ export interface FormTextAreaProps extends FormItemProps<string> {
|
|
|
1102
1196
|
*
|
|
1103
1197
|
*
|
|
1104
1198
|
* export default function Command() {
|
|
1105
|
-
* const [
|
|
1199
|
+
* const [description, setDescription] = useState<string>();
|
|
1106
1200
|
*
|
|
1107
1201
|
* return (
|
|
1108
|
-
* <Form
|
|
1109
|
-
*
|
|
1202
|
+
* <Form
|
|
1203
|
+
* actions={
|
|
1204
|
+
* <ActionPanel>
|
|
1205
|
+
* <SubmitFormAction title="Submit Description" onSubmit={(values) => console.log(values)} />
|
|
1206
|
+
* </ActionPanel>
|
|
1207
|
+
* }
|
|
1208
|
+
* >
|
|
1209
|
+
* <Form.TextArea id="description" value={description} onChange={setDescription} />
|
|
1110
1210
|
* </Form>
|
|
1111
1211
|
* );
|
|
1112
1212
|
* }
|
|
@@ -1151,8 +1251,14 @@ export interface FormCheckboxProps extends FormItemProps<boolean> {
|
|
|
1151
1251
|
*
|
|
1152
1252
|
* export default function Command() {
|
|
1153
1253
|
* return (
|
|
1154
|
-
* <Form
|
|
1155
|
-
*
|
|
1254
|
+
* <Form
|
|
1255
|
+
* actions={
|
|
1256
|
+
* <ActionPanel>
|
|
1257
|
+
* <SubmitFormAction title="Submit Answer" onSubmit={(values) => console.log(values)} />
|
|
1258
|
+
* </ActionPanel>
|
|
1259
|
+
* }
|
|
1260
|
+
* >
|
|
1261
|
+
* <Form.Checkbox id="answer" label="Are you happy?" defaultValue={true} />
|
|
1156
1262
|
* </Form>
|
|
1157
1263
|
* );
|
|
1158
1264
|
* }
|
|
@@ -1169,8 +1275,14 @@ export interface FormCheckboxProps extends FormItemProps<boolean> {
|
|
|
1169
1275
|
* const [checked, setChecked] = useState(true);
|
|
1170
1276
|
*
|
|
1171
1277
|
* return (
|
|
1172
|
-
* <Form
|
|
1173
|
-
*
|
|
1278
|
+
* <Form
|
|
1279
|
+
* actions={
|
|
1280
|
+
* <ActionPanel>
|
|
1281
|
+
* <SubmitFormAction title="Submit Answer" onSubmit={(values) => console.log(values)} />
|
|
1282
|
+
* </ActionPanel>
|
|
1283
|
+
* }
|
|
1284
|
+
* >
|
|
1285
|
+
* <Form.Checkbox id="answer" label="Do you like orange juice?" value={checked} onChange={setChecked} />
|
|
1174
1286
|
* </Form>
|
|
1175
1287
|
* );
|
|
1176
1288
|
* }
|
|
@@ -1211,7 +1323,13 @@ export interface FormDatePickerProps extends FormItemProps<Date> {
|
|
|
1211
1323
|
*
|
|
1212
1324
|
* export default function Command() {
|
|
1213
1325
|
* return (
|
|
1214
|
-
* <Form
|
|
1326
|
+
* <Form
|
|
1327
|
+
* actions={
|
|
1328
|
+
* <ActionPanel>
|
|
1329
|
+
* <SubmitFormAction title="Submit Form" onSubmit={(values) => console.log(values)} />
|
|
1330
|
+
* </ActionPanel>
|
|
1331
|
+
* }
|
|
1332
|
+
* >
|
|
1215
1333
|
* <Form.DatePicker id="dateOfBirth" title="Date of Birth" defaultValue={new Date(1955, 1, 24)} />
|
|
1216
1334
|
* </Form>
|
|
1217
1335
|
* );
|
|
@@ -1229,7 +1347,13 @@ export interface FormDatePickerProps extends FormItemProps<Date> {
|
|
|
1229
1347
|
* const [date, setDate] = useState<Date>();
|
|
1230
1348
|
*
|
|
1231
1349
|
* return (
|
|
1232
|
-
* <Form
|
|
1350
|
+
* <Form
|
|
1351
|
+
* actions={
|
|
1352
|
+
* <ActionPanel>
|
|
1353
|
+
* <SubmitFormAction title="Submit Form" onSubmit={(values) => console.log(values)} />
|
|
1354
|
+
* </ActionPanel>
|
|
1355
|
+
* }
|
|
1356
|
+
* >
|
|
1233
1357
|
* <Form.DatePicker id="launchDate" title="Launch Date" value={date} onChange={setDate} />
|
|
1234
1358
|
* </Form>
|
|
1235
1359
|
* );
|
|
@@ -1269,7 +1393,13 @@ export interface FormSeparatorProps {
|
|
|
1269
1393
|
*
|
|
1270
1394
|
* export default function Command() {
|
|
1271
1395
|
* return (
|
|
1272
|
-
* <Form
|
|
1396
|
+
* <Form
|
|
1397
|
+
* actions={
|
|
1398
|
+
* <ActionPanel>
|
|
1399
|
+
* <SubmitFormAction title="Submit Form" onSubmit={(values) => console.log(values)} />
|
|
1400
|
+
* </ActionPanel>
|
|
1401
|
+
* }
|
|
1402
|
+
* >
|
|
1273
1403
|
* <Form.TextField id="textfield" />
|
|
1274
1404
|
* <Form.Separator />
|
|
1275
1405
|
* <Form.TextArea id="textarea" />
|
|
@@ -1297,6 +1427,58 @@ export interface FormDropdownProps extends FormItemProps<string> {
|
|
|
1297
1427
|
*/
|
|
1298
1428
|
children?: ReactElement<FormDropdownSectionProps> | Array<ReactElement<FormDropdownSectionProps>> | ReactElement<FormDropdownItemProps> | Array<ReactElement<FormDropdownItemProps>> | null;
|
|
1299
1429
|
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Props of the {@link Form.Label} React component.
|
|
1432
|
+
*
|
|
1433
|
+
* @category User Interface
|
|
1434
|
+
* @subcategory Form
|
|
1435
|
+
*/
|
|
1436
|
+
export interface FormDescriptionProps {
|
|
1437
|
+
/**
|
|
1438
|
+
* The display title of the left side from the description item.
|
|
1439
|
+
*/
|
|
1440
|
+
title?: string;
|
|
1441
|
+
/**
|
|
1442
|
+
* Text that will be displayed in the middle.
|
|
1443
|
+
*/
|
|
1444
|
+
text: string;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* A form item with a simple text label.
|
|
1448
|
+
*
|
|
1449
|
+
* @remark Do *not* use this component to show validation messages for other form fields.
|
|
1450
|
+
*
|
|
1451
|
+
* @example
|
|
1452
|
+
* Label
|
|
1453
|
+
*
|
|
1454
|
+
* ```typescript
|
|
1455
|
+
*
|
|
1456
|
+
*
|
|
1457
|
+
* export default function Command() {
|
|
1458
|
+
* return (
|
|
1459
|
+
* <Form
|
|
1460
|
+
* actions={
|
|
1461
|
+
* <ActionPanel>
|
|
1462
|
+
* <SubmitFormAction title="Submit" onSubmit={(values) => console.log(values)} />
|
|
1463
|
+
* </ActionPanel>
|
|
1464
|
+
* }
|
|
1465
|
+
* >
|
|
1466
|
+
* <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." />
|
|
1467
|
+
* </Form>
|
|
1468
|
+
* );
|
|
1469
|
+
* }
|
|
1470
|
+
* ```
|
|
1471
|
+
*
|
|
1472
|
+
* @category User Interface
|
|
1473
|
+
* @subcategory Form
|
|
1474
|
+
*/
|
|
1475
|
+
export function FormDescription(props: FormDescriptionProps): ReactElement<FormDescriptionProps>;
|
|
1476
|
+
export namespace FormDescription {
|
|
1477
|
+
var propTypes: {
|
|
1478
|
+
text: PropTypes.Requireable<string>;
|
|
1479
|
+
};
|
|
1480
|
+
var displayName: string;
|
|
1481
|
+
}
|
|
1300
1482
|
/**
|
|
1301
1483
|
* A form item with a dropdown menu.
|
|
1302
1484
|
*
|
|
@@ -1308,7 +1490,13 @@ export interface FormDropdownProps extends FormItemProps<string> {
|
|
|
1308
1490
|
*
|
|
1309
1491
|
* export default function Command() {
|
|
1310
1492
|
* return (
|
|
1311
|
-
* <Form
|
|
1493
|
+
* <Form
|
|
1494
|
+
* actions={
|
|
1495
|
+
* <ActionPanel>
|
|
1496
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1497
|
+
* </ActionPanel>
|
|
1498
|
+
* }
|
|
1499
|
+
* >
|
|
1312
1500
|
* <Form.Dropdown id="emoji" title="Favorite Emoji" defaultValue="lol">
|
|
1313
1501
|
* <Form.Dropdown.Item value="poop" title="Pile of poop" icon="💩" />
|
|
1314
1502
|
* <Form.Dropdown.Item value="rocket" title="Rocket" icon="🚀" />
|
|
@@ -1330,7 +1518,13 @@ export interface FormDropdownProps extends FormItemProps<string> {
|
|
|
1330
1518
|
* const [programmingLanguage, setProgrammingLanguage] = useState<string>("typescript");
|
|
1331
1519
|
*
|
|
1332
1520
|
* return (
|
|
1333
|
-
* <Form
|
|
1521
|
+
* <Form
|
|
1522
|
+
* actions={
|
|
1523
|
+
* <ActionPanel>
|
|
1524
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1525
|
+
* </ActionPanel>
|
|
1526
|
+
* }
|
|
1527
|
+
* >
|
|
1334
1528
|
* <Form.Dropdown
|
|
1335
1529
|
* id="dropdown"
|
|
1336
1530
|
* title="Favorite Language"
|
|
@@ -1395,7 +1589,13 @@ export interface FormDropdownSectionProps {
|
|
|
1395
1589
|
*
|
|
1396
1590
|
* export default function Command() {
|
|
1397
1591
|
* return (
|
|
1398
|
-
* <Form
|
|
1592
|
+
* <Form
|
|
1593
|
+
* actions={
|
|
1594
|
+
* <ActionPanel>
|
|
1595
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1596
|
+
* </ActionPanel>
|
|
1597
|
+
* }
|
|
1598
|
+
* >
|
|
1399
1599
|
* <Form.Dropdown id="food" title="Favorite Food">
|
|
1400
1600
|
* <Form.Dropdown.Section title="Fruits">
|
|
1401
1601
|
* <Form.Dropdown.Item value="apple" title="Apple" icon="🍎" />
|
|
@@ -1452,7 +1652,13 @@ export interface FormDropdownItemProps {
|
|
|
1452
1652
|
*
|
|
1453
1653
|
* export default function Command() {
|
|
1454
1654
|
* return (
|
|
1455
|
-
* <Form
|
|
1655
|
+
* <Form
|
|
1656
|
+
* actions={
|
|
1657
|
+
* <ActionPanel>
|
|
1658
|
+
* <SubmitFormAction title="Submit Icon" onSubmit={(values) => console.log(values)} />
|
|
1659
|
+
* </ActionPanel>
|
|
1660
|
+
* }
|
|
1661
|
+
* >
|
|
1456
1662
|
* <Form.Dropdown id="icon" title="Icon">
|
|
1457
1663
|
* <Form.Dropdown.Item value="circle" title="Cirlce" icon={Icon.Circle} />
|
|
1458
1664
|
* </Form.Dropdown>
|
|
@@ -1513,7 +1719,13 @@ export interface FormTagPickerProps extends FormItemProps<string[]> {
|
|
|
1513
1719
|
*
|
|
1514
1720
|
* export default function Command() {
|
|
1515
1721
|
* return (
|
|
1516
|
-
* <Form
|
|
1722
|
+
* <Form
|
|
1723
|
+
* actions={
|
|
1724
|
+
* <ActionPanel>
|
|
1725
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1726
|
+
* </ActionPanel>
|
|
1727
|
+
* }
|
|
1728
|
+
* >
|
|
1517
1729
|
* <Form.TagPicker id="sports" title="Favorite Sports" defaultValue={["football"]}>
|
|
1518
1730
|
* <Form.TagPicker.Item value="basketball" title="Basketball" icon="🏀" />
|
|
1519
1731
|
* <Form.TagPicker.Item value="football" title="Football" icon="⚽️" />
|
|
@@ -1535,7 +1747,13 @@ export interface FormTagPickerProps extends FormItemProps<string[]> {
|
|
|
1535
1747
|
* const [countries, setCountries] = useState<string[]>(["ger", "ned", "pol"]);
|
|
1536
1748
|
*
|
|
1537
1749
|
* return (
|
|
1538
|
-
* <Form
|
|
1750
|
+
* <Form
|
|
1751
|
+
* actions={
|
|
1752
|
+
* <ActionPanel>
|
|
1753
|
+
* <SubmitFormAction title="Submit Countries" onSubmit={(values) => console.log(values)} />
|
|
1754
|
+
* </ActionPanel>
|
|
1755
|
+
* }
|
|
1756
|
+
* >
|
|
1539
1757
|
* <Form.TagPicker id="countries" title="Visited Countries" value={countries} onChange={setCountries}>
|
|
1540
1758
|
* <Form.TagPicker.Item value="ger" title="Germany" icon="🇩🇪" />
|
|
1541
1759
|
* <Form.TagPicker.Item value="ind" title="India" icon="🇮🇳" />
|
|
@@ -1597,9 +1815,17 @@ export interface FormTagPickerItemProps {
|
|
|
1597
1815
|
*
|
|
1598
1816
|
* export default function Command() {
|
|
1599
1817
|
* return (
|
|
1600
|
-
* <Form
|
|
1818
|
+
* <Form
|
|
1819
|
+
* actions={
|
|
1820
|
+
* <ActionPanel>
|
|
1821
|
+
* <SubmitFormAction title="Submit Color" onSubmit={(values) => console.log(values)} />
|
|
1822
|
+
* </ActionPanel>
|
|
1823
|
+
* }
|
|
1824
|
+
* >
|
|
1601
1825
|
* <Form.TagPicker id="color" title="Color">
|
|
1602
|
-
* <Form.TagPicker.Item value="
|
|
1826
|
+
* <Form.TagPicker.Item value="red" title="Red" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
|
|
1827
|
+
* <Form.TagPicker.Item value="green" title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
|
|
1828
|
+
* <Form.TagPicker.Item value="blue" title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
|
|
1603
1829
|
* </Form.TagPicker>
|
|
1604
1830
|
* </Form>
|
|
1605
1831
|
* );
|
|
@@ -2665,7 +2891,7 @@ export interface Preference {
|
|
|
2665
2891
|
/**
|
|
2666
2892
|
* The type of the preference.
|
|
2667
2893
|
*/
|
|
2668
|
-
type: "
|
|
2894
|
+
type: "appPicker" | "checkbox" | "dropdown" | "password" | "textfield";
|
|
2669
2895
|
/**
|
|
2670
2896
|
* Specifies if the preference is required.
|
|
2671
2897
|
*
|
|
@@ -2698,6 +2924,7 @@ export interface Preference {
|
|
|
2698
2924
|
/**
|
|
2699
2925
|
* The default value of the preference if there is no `value` specified.
|
|
2700
2926
|
* For dropdowns, this references the `value` property of an object in the data array.
|
|
2927
|
+
* For app pickers, this references an application name, bundleId or path."
|
|
2701
2928
|
*/
|
|
2702
2929
|
default?: unknown;
|
|
2703
2930
|
/**
|
|
@@ -2756,6 +2983,66 @@ export interface PreferenceValues {
|
|
|
2756
2983
|
* @category Preferences
|
|
2757
2984
|
*/
|
|
2758
2985
|
export function getPreferenceValues<Values extends PreferenceValues = PreferenceValues>(): Values;
|
|
2986
|
+
/**
|
|
2987
|
+
* Gets the selected text of the frontmost application.
|
|
2988
|
+
*
|
|
2989
|
+
* @throws An error when no text is selected in the frontmost application.
|
|
2990
|
+
* @returns Returns a promise that resolves with the selected text.
|
|
2991
|
+
*
|
|
2992
|
+
* @example
|
|
2993
|
+
* ```typescript
|
|
2994
|
+
*
|
|
2995
|
+
*
|
|
2996
|
+
* export default async () => {
|
|
2997
|
+
* try {
|
|
2998
|
+
* const selectedText = await getSelectedText();
|
|
2999
|
+
* const transformedText = selectedText.toUpperCase();
|
|
3000
|
+
* await pasteText(transformedText);
|
|
3001
|
+
* } catch (error) {
|
|
3002
|
+
* await showToast(ToastStyle.Failure, "Cannot transform text", String(error));
|
|
3003
|
+
* }
|
|
3004
|
+
* };
|
|
3005
|
+
* ```
|
|
3006
|
+
*
|
|
3007
|
+
* @category Environment
|
|
3008
|
+
*/
|
|
3009
|
+
export function getSelectedText(): Promise<string>;
|
|
3010
|
+
/**
|
|
3011
|
+
* Holds data about a File System item. Use the {@link getSelectedFinderItems} method to retrieve values.
|
|
3012
|
+
*
|
|
3013
|
+
* @category Environment
|
|
3014
|
+
*/
|
|
3015
|
+
export interface FileSystemItem {
|
|
3016
|
+
/**
|
|
3017
|
+
* The path to the item
|
|
3018
|
+
*/
|
|
3019
|
+
path: string;
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Gets the selected items from Finder.
|
|
3023
|
+
*
|
|
3024
|
+
* @throws An error when Finder is not the frontmost application.
|
|
3025
|
+
* @returns Returns a promise that resolves with the selected file system items.
|
|
3026
|
+
*
|
|
3027
|
+
* @example
|
|
3028
|
+
* ```typescript
|
|
3029
|
+
*
|
|
3030
|
+
*
|
|
3031
|
+
* export default async () => {
|
|
3032
|
+
* try {
|
|
3033
|
+
* const selectedItems = await getSelectedFinderItems();
|
|
3034
|
+
* if (selectedItems.length) {
|
|
3035
|
+
* await pasteText(selectedItems[0].path);
|
|
3036
|
+
* }
|
|
3037
|
+
* } catch (error) {
|
|
3038
|
+
* await showToast(ToastStyle.Failure, "Cannot copy file path", String(error));
|
|
3039
|
+
* }
|
|
3040
|
+
* };
|
|
3041
|
+
* ```
|
|
3042
|
+
*
|
|
3043
|
+
* @category Environment
|
|
3044
|
+
*/
|
|
3045
|
+
export function getSelectedFinderItems(): Promise<FileSystemItem[]>;
|
|
2759
3046
|
|
|
2760
3047
|
|
|
2761
3048
|
/**
|
|
@@ -2897,6 +3184,150 @@ export function useNavigation(): Navigation;
|
|
|
2897
3184
|
* @subcategory Rendering
|
|
2898
3185
|
*/
|
|
2899
3186
|
export function render(nodeToRender: ReactNode): void;
|
|
3187
|
+
|
|
3188
|
+
/**
|
|
3189
|
+
* Creates and shows a confirmation Alert with the given options.
|
|
3190
|
+
*
|
|
3191
|
+
* @param options - The options used to create the Alert.
|
|
3192
|
+
* @returns A promise that resolves to a boolean when the user takes an action.
|
|
3193
|
+
* It will be `true` for the primary Action, `false` for the dismiss Action.
|
|
3194
|
+
*
|
|
3195
|
+
* @example
|
|
3196
|
+
* ```typescript
|
|
3197
|
+
*
|
|
3198
|
+
*
|
|
3199
|
+
* export default async () => {
|
|
3200
|
+
* if (await confirmAlert({ title: "Are you sure?" })) {
|
|
3201
|
+
* // do something
|
|
3202
|
+
* }
|
|
3203
|
+
* };
|
|
3204
|
+
* ```
|
|
3205
|
+
*
|
|
3206
|
+
* @category User Interface
|
|
3207
|
+
* @subcategory Alert
|
|
3208
|
+
*/
|
|
3209
|
+
export function confirmAlert(options: AlertOptions): Promise<boolean>;
|
|
3210
|
+
/**
|
|
3211
|
+
* The options to create an {@link Alert}.
|
|
3212
|
+
*
|
|
3213
|
+
* @example
|
|
3214
|
+
* ```typescript
|
|
3215
|
+
*
|
|
3216
|
+
*
|
|
3217
|
+
* export default async () => {
|
|
3218
|
+
* const options: AlertOptions = {
|
|
3219
|
+
* title: "Finished cooking",
|
|
3220
|
+
* message: "Delicious pasta for lunch",
|
|
3221
|
+
* primaryAction: {
|
|
3222
|
+
* title: 'Do something',
|
|
3223
|
+
* onAction: () => {
|
|
3224
|
+
* // while you can register a handler for an action, it's more elegant
|
|
3225
|
+
* // to use the `if (await confirmAlert(...)) { ... }` pattern
|
|
3226
|
+
* console.log("The alert action has been triggered")
|
|
3227
|
+
* }
|
|
3228
|
+
* }
|
|
3229
|
+
* };
|
|
3230
|
+
* await confirmAlert(options);
|
|
3231
|
+
* };
|
|
3232
|
+
* ```
|
|
3233
|
+
*
|
|
3234
|
+
* @category User Interface
|
|
3235
|
+
* @subcategory Alert
|
|
3236
|
+
*/
|
|
3237
|
+
export interface AlertOptions {
|
|
3238
|
+
/**
|
|
3239
|
+
* The icon of an alert to illustrate the action. Displayed on the top.
|
|
3240
|
+
*/
|
|
3241
|
+
icon?: ImageLike;
|
|
3242
|
+
/**
|
|
3243
|
+
* The title of an alert. Displayed below the icon.
|
|
3244
|
+
*/
|
|
3245
|
+
title: string;
|
|
3246
|
+
/**
|
|
3247
|
+
* An additional message for an Alert. Useful to show more information, e.g. a confirmation message for a destructive action.
|
|
3248
|
+
*/
|
|
3249
|
+
message?: string;
|
|
3250
|
+
/**
|
|
3251
|
+
* The primary Action the user can take.
|
|
3252
|
+
*/
|
|
3253
|
+
primaryAction?: AlertActionOptions;
|
|
3254
|
+
/**
|
|
3255
|
+
* The Action to dismiss the alert. There usually shouldn't be any side effects when the user takes this action.
|
|
3256
|
+
*/
|
|
3257
|
+
dismissAction?: AlertActionOptions;
|
|
3258
|
+
}
|
|
3259
|
+
/**
|
|
3260
|
+
* The options to create an {@link Alert} Action.
|
|
3261
|
+
*
|
|
3262
|
+
* @category User Interface
|
|
3263
|
+
* @subcategory Alert
|
|
3264
|
+
*/
|
|
3265
|
+
export interface AlertActionOptions {
|
|
3266
|
+
/**
|
|
3267
|
+
* The title of the action.
|
|
3268
|
+
*/
|
|
3269
|
+
title: string;
|
|
3270
|
+
/**
|
|
3271
|
+
* The style of the action.
|
|
3272
|
+
*/
|
|
3273
|
+
style?: AlertActionStyle;
|
|
3274
|
+
/**
|
|
3275
|
+
* A callback called when the action is triggered.
|
|
3276
|
+
*/
|
|
3277
|
+
onAction?: () => void;
|
|
3278
|
+
}
|
|
3279
|
+
/**
|
|
3280
|
+
* Defines the visual style of an Action of the Alert.
|
|
3281
|
+
*
|
|
3282
|
+
* @remarks
|
|
3283
|
+
* Use {@link AlertActionStyle.Default} for confirmations of a positive action.
|
|
3284
|
+
* Use {@link AlertActionStyle.Destructive} for confirmations of a destructive action (eg. deleting a file).
|
|
3285
|
+
*
|
|
3286
|
+
* @category User Interface
|
|
3287
|
+
* @subcategory Alert
|
|
3288
|
+
*/
|
|
3289
|
+
export enum AlertActionStyle {
|
|
3290
|
+
Default = "DEFAULT",
|
|
3291
|
+
Cancel = "CANCEL",
|
|
3292
|
+
Destructive = "DESTRUCTIVE"
|
|
3293
|
+
}
|
|
3294
|
+
/**
|
|
3295
|
+
* Union type for the supported color types.
|
|
3296
|
+
*
|
|
3297
|
+
* @remark
|
|
3298
|
+
* Besides the {@link Color}, you can use any of the following color formats:
|
|
3299
|
+
* - HEX, e.g `#FF0000`
|
|
3300
|
+
* - Short HEX, e.g. `#F00`
|
|
3301
|
+
* - RGBA, e.g. `rgb(255, 0, 0)`
|
|
3302
|
+
* - RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
|
|
3303
|
+
* - HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
|
|
3304
|
+
* - Keywords, e.g. `red`
|
|
3305
|
+
*
|
|
3306
|
+
* Colors different to the built-in ones (see {@link Color}) will be dynamically adjusted to fit the contrast.
|
|
3307
|
+
*
|
|
3308
|
+
* @example
|
|
3309
|
+
* ```typescript
|
|
3310
|
+
*
|
|
3311
|
+
*
|
|
3312
|
+
* export default function Command() {
|
|
3313
|
+
* return (
|
|
3314
|
+
* <List>
|
|
3315
|
+
* <List.Item title="Built-in color" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
|
|
3316
|
+
* <List.Item title="HEX" icon={{ source: Icon.Circle, tintColor: "#FF0000" }} />
|
|
3317
|
+
* <List.Item title="Short HEX" icon={{ source: Icon.Circle, tintColor: "#F00" }} />
|
|
3318
|
+
* <List.Item title="RGBA" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0)" }} />
|
|
3319
|
+
* <List.Item title="RGBA Percentage" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0, 1.0)" }} />
|
|
3320
|
+
* <List.Item title="HSL" icon={{ source: Icon.Circle, tintColor: "hsla(200, 20%, 33%, 0.2)" }} />
|
|
3321
|
+
* <List.Item title="Keywords" icon={{ source: Icon.Circle, tintColor: "red" }} />
|
|
3322
|
+
* </List>
|
|
3323
|
+
* );
|
|
3324
|
+
* };
|
|
3325
|
+
* ```
|
|
3326
|
+
*
|
|
3327
|
+
* @category User Interface
|
|
3328
|
+
* @subcategory Colors
|
|
3329
|
+
*/
|
|
3330
|
+
export type ColorLike = Color | DynamicColor | string;
|
|
2900
3331
|
/**
|
|
2901
3332
|
* The standard colors. Use this colors for consistency.
|
|
2902
3333
|
*
|
|
@@ -2960,7 +3391,7 @@ export enum Color {
|
|
|
2960
3391
|
* @category User Interface
|
|
2961
3392
|
* @subcategory Colors
|
|
2962
3393
|
*/
|
|
2963
|
-
interface DynamicColor {
|
|
3394
|
+
export interface DynamicColor {
|
|
2964
3395
|
/**
|
|
2965
3396
|
* The color which is used in light theme.
|
|
2966
3397
|
*
|
|
@@ -2988,44 +3419,6 @@ interface DynamicColor {
|
|
|
2988
3419
|
*/
|
|
2989
3420
|
adjustContrast?: boolean;
|
|
2990
3421
|
}
|
|
2991
|
-
/**
|
|
2992
|
-
* Union type for the supported color types.
|
|
2993
|
-
*
|
|
2994
|
-
* @remark
|
|
2995
|
-
* Besides the {@link Color}, you can use any of the following color formats:
|
|
2996
|
-
* - HEX, e.g `#FF0000`
|
|
2997
|
-
* - Short HEX, e.g. `#F00`
|
|
2998
|
-
* - RGBA, e.g. `rgb(255, 0, 0)`
|
|
2999
|
-
* - RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
|
|
3000
|
-
* - HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
|
|
3001
|
-
* - Keywords, e.g. `red`
|
|
3002
|
-
*
|
|
3003
|
-
* Colors different to the built-in ones (see {@link Color}) will be dynamically adjusted to fit the contrast.
|
|
3004
|
-
*
|
|
3005
|
-
* @example
|
|
3006
|
-
* ```typescript
|
|
3007
|
-
*
|
|
3008
|
-
*
|
|
3009
|
-
* export default function Command() {
|
|
3010
|
-
* return (
|
|
3011
|
-
* <List>
|
|
3012
|
-
* <List.Item title="Built-in color" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
|
|
3013
|
-
* <List.Item title="HEX" icon={{ source: Icon.Circle, tintColor: "#FF0000" }} />
|
|
3014
|
-
* <List.Item title="Short HEX" icon={{ source: Icon.Circle, tintColor: "#F00" }} />
|
|
3015
|
-
* <List.Item title="RGBA" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0)" }} />
|
|
3016
|
-
* <List.Item title="RGBA Percentage" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0, 1.0)" }} />
|
|
3017
|
-
* <List.Item title="HSL" icon={{ source: Icon.Circle, tintColor: "hsla(200, 20%, 33%, 0.2)" }} />
|
|
3018
|
-
* <List.Item title="Keywords" icon={{ source: Icon.Circle, tintColor: "red" }} />
|
|
3019
|
-
* </List>
|
|
3020
|
-
* );
|
|
3021
|
-
* };
|
|
3022
|
-
* ```
|
|
3023
|
-
*
|
|
3024
|
-
* @category User Interface
|
|
3025
|
-
* @subcategory Colors
|
|
3026
|
-
*/
|
|
3027
|
-
export type ColorLike = DynamicColor | Color | string;
|
|
3028
|
-
export {};
|
|
3029
3422
|
/**
|
|
3030
3423
|
* List of built-in icons that can be used for actions or list items.
|
|
3031
3424
|
*
|
|
@@ -3116,7 +3509,7 @@ export enum Icon {
|
|
|
3116
3509
|
*/
|
|
3117
3510
|
export interface FileIcon {
|
|
3118
3511
|
/**
|
|
3119
|
-
* The path to a file or folder to get
|
|
3512
|
+
* The path to a file or folder to get its icon from.
|
|
3120
3513
|
*/
|
|
3121
3514
|
fileIcon: string;
|
|
3122
3515
|
}
|
|
@@ -3252,6 +3645,7 @@ export enum ImageMask {
|
|
|
3252
3645
|
*/
|
|
3253
3646
|
RoundedRectangle = "roundedRectangle"
|
|
3254
3647
|
}
|
|
3648
|
+
|
|
3255
3649
|
/**
|
|
3256
3650
|
* A Toast with a certain style, title, and message.
|
|
3257
3651
|
*
|
|
@@ -3279,17 +3673,23 @@ export enum ImageMask {
|
|
|
3279
3673
|
*/
|
|
3280
3674
|
export class Toast {
|
|
3281
3675
|
private options;
|
|
3282
|
-
|
|
3676
|
+
private id;
|
|
3677
|
+
private callbacks;
|
|
3678
|
+
constructor(props: ToastOptions);
|
|
3283
3679
|
get style(): ToastStyle;
|
|
3284
3680
|
set style(style: ToastStyle);
|
|
3285
3681
|
get title(): string;
|
|
3286
3682
|
set title(title: string);
|
|
3287
3683
|
get message(): string | undefined;
|
|
3288
3684
|
set message(message: string | undefined);
|
|
3685
|
+
get primaryAction(): ToastActionOptions | undefined;
|
|
3686
|
+
set primaryAction(action: ToastActionOptions | undefined);
|
|
3687
|
+
get secondaryAction(): ToastActionOptions | undefined;
|
|
3688
|
+
set secondaryAction(action: ToastActionOptions | undefined);
|
|
3289
3689
|
/**
|
|
3290
3690
|
* Shows the Toast.
|
|
3291
3691
|
*
|
|
3292
|
-
* @returns A promise that resolves when toast is shown.
|
|
3692
|
+
* @returns A promise that resolves when the toast is shown.
|
|
3293
3693
|
*/
|
|
3294
3694
|
show(): Promise<void>;
|
|
3295
3695
|
/**
|
|
@@ -3312,6 +3712,12 @@ export class Toast {
|
|
|
3312
3712
|
* style: ToastStyle.Success,
|
|
3313
3713
|
* title: "Finished cooking",
|
|
3314
3714
|
* message: "Delicious pasta for lunch",
|
|
3715
|
+
* primaryAction: {
|
|
3716
|
+
* title: 'Do something',
|
|
3717
|
+
* onAction: () => {
|
|
3718
|
+
* console.log("The toast action has been triggered")
|
|
3719
|
+
* }
|
|
3720
|
+
* }
|
|
3315
3721
|
* };
|
|
3316
3722
|
* const toast = new Toast(options);
|
|
3317
3723
|
* await toast.show();
|
|
@@ -3331,9 +3737,37 @@ export interface ToastOptions {
|
|
|
3331
3737
|
*/
|
|
3332
3738
|
title: string;
|
|
3333
3739
|
/**
|
|
3334
|
-
* An additional message for the toast. Useful to show more information, e.g. an identifier of a newly
|
|
3740
|
+
* An additional message for the toast. Useful to show more information, e.g. an identifier of a newly created asset.
|
|
3335
3741
|
*/
|
|
3336
3742
|
message?: string;
|
|
3743
|
+
/**
|
|
3744
|
+
* The primary Action the user can take when hovering on the Toast.
|
|
3745
|
+
*/
|
|
3746
|
+
primaryAction?: ToastActionOptions;
|
|
3747
|
+
/**
|
|
3748
|
+
* The secondary Action the user can take when hovering on the Toast.
|
|
3749
|
+
*/
|
|
3750
|
+
secondaryAction?: ToastActionOptions;
|
|
3751
|
+
}
|
|
3752
|
+
/**
|
|
3753
|
+
* The options to create a {@link Toast} Action.
|
|
3754
|
+
*
|
|
3755
|
+
* @category User Interface
|
|
3756
|
+
* @subcategory Toast
|
|
3757
|
+
*/
|
|
3758
|
+
export interface ToastActionOptions {
|
|
3759
|
+
/**
|
|
3760
|
+
* The title of the action.
|
|
3761
|
+
*/
|
|
3762
|
+
title: string;
|
|
3763
|
+
/**
|
|
3764
|
+
* The keyboard shortcut for the action.
|
|
3765
|
+
*/
|
|
3766
|
+
shortcut?: KeyboardShortcut;
|
|
3767
|
+
/**
|
|
3768
|
+
* A callback called when the action is triggered.
|
|
3769
|
+
*/
|
|
3770
|
+
onAction: () => void;
|
|
3337
3771
|
}
|
|
3338
3772
|
/**
|
|
3339
3773
|
* Defines the visual style of the Toast.
|
|
@@ -3352,7 +3786,7 @@ export enum ToastStyle {
|
|
|
3352
3786
|
Animated = "ANIMATED"
|
|
3353
3787
|
}
|
|
3354
3788
|
/**
|
|
3355
|
-
* Creates and shows a Toast with the
|
|
3789
|
+
* Creates and shows a Toast with the given style, title, and message.
|
|
3356
3790
|
*
|
|
3357
3791
|
* @param style - The visual style of the Toast.
|
|
3358
3792
|
* @param title - The title that will be displayed in the Toast.
|