@raycast/api 1.25.7 → 1.27.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 +0 -0
- package/bin/x86/ray +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +375 -94
package/bin/arm64/ray
CHANGED
|
Binary file
|
package/bin/x86/ray
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -225,30 +225,6 @@ export function clearClipboard(): Promise<void>;
|
|
|
225
225
|
* @category Clipboard
|
|
226
226
|
*/
|
|
227
227
|
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
228
|
/**
|
|
253
229
|
* 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
230
|
* See {@link KeyModifier} and {@link KeyEquivalent} for supported values.
|
|
@@ -931,12 +907,12 @@ export interface FormValues {
|
|
|
931
907
|
*/
|
|
932
908
|
export interface FormProps extends ActionsInterface, NavigationChildInterface {
|
|
933
909
|
/**
|
|
934
|
-
* The
|
|
910
|
+
* The Form.Item elements of the form.
|
|
935
911
|
*/
|
|
936
912
|
children?: ReactElement<FormItemProps<FormValue>> | Array<ReactElement<FormItemProps<FormValue>>> | null;
|
|
937
913
|
}
|
|
938
914
|
/**
|
|
939
|
-
* Shows a list of form items such as {@link
|
|
915
|
+
* Shows a list of form items such as {@link Form.TextField}, {@link Form.Checkbox} or {@link Form.Dropdown}.
|
|
940
916
|
*
|
|
941
917
|
* @category User Interface
|
|
942
918
|
* @subcategory Form
|
|
@@ -961,7 +937,7 @@ export namespace Form {
|
|
|
961
937
|
var TagPickerItem: typeof FormTagPickerItem;
|
|
962
938
|
}
|
|
963
939
|
/**
|
|
964
|
-
* Props of the
|
|
940
|
+
* Props of the Form.Item React component.
|
|
965
941
|
*
|
|
966
942
|
* @category User Interface
|
|
967
943
|
* @subcategory Form
|
|
@@ -1019,7 +995,13 @@ export interface FormTextFieldProps extends FormItemProps<string> {
|
|
|
1019
995
|
*
|
|
1020
996
|
* export default function Command() {
|
|
1021
997
|
* return (
|
|
1022
|
-
* <Form
|
|
998
|
+
* <Form
|
|
999
|
+
* actions={
|
|
1000
|
+
* <ActionPanel>
|
|
1001
|
+
* <SubmitFormAction title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
1002
|
+
* </ActionPanel>
|
|
1003
|
+
* }
|
|
1004
|
+
* >
|
|
1023
1005
|
* <Form.TextField id="name" defaultValue="Steve" />
|
|
1024
1006
|
* </Form>
|
|
1025
1007
|
* );
|
|
@@ -1034,11 +1016,17 @@ export interface FormTextFieldProps extends FormItemProps<string> {
|
|
|
1034
1016
|
*
|
|
1035
1017
|
*
|
|
1036
1018
|
* export default function Command() {
|
|
1037
|
-
* const [
|
|
1019
|
+
* const [name, setName] = useState<string>();
|
|
1038
1020
|
*
|
|
1039
1021
|
* return (
|
|
1040
|
-
* <Form
|
|
1041
|
-
*
|
|
1022
|
+
* <Form
|
|
1023
|
+
* actions={
|
|
1024
|
+
* <ActionPanel>
|
|
1025
|
+
* <SubmitFormAction title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
1026
|
+
* </ActionPanel>
|
|
1027
|
+
* }
|
|
1028
|
+
* >
|
|
1029
|
+
* <Form.TextField id="name" value={name} onChange={setName} />
|
|
1042
1030
|
* </Form>
|
|
1043
1031
|
* );
|
|
1044
1032
|
* }
|
|
@@ -1087,7 +1075,13 @@ export interface FormTextAreaProps extends FormItemProps<string> {
|
|
|
1087
1075
|
*
|
|
1088
1076
|
* export default function Command() {
|
|
1089
1077
|
* return (
|
|
1090
|
-
* <Form
|
|
1078
|
+
* <Form
|
|
1079
|
+
* actions={
|
|
1080
|
+
* <ActionPanel>
|
|
1081
|
+
* <SubmitFormAction title="Submit Description" onSubmit={(values) => console.log(values)} />
|
|
1082
|
+
* </ActionPanel>
|
|
1083
|
+
* }
|
|
1084
|
+
* >
|
|
1091
1085
|
* <Form.TextArea id="description" defaultValue={DESCRIPTION} />
|
|
1092
1086
|
* </Form>
|
|
1093
1087
|
* );
|
|
@@ -1102,11 +1096,17 @@ export interface FormTextAreaProps extends FormItemProps<string> {
|
|
|
1102
1096
|
*
|
|
1103
1097
|
*
|
|
1104
1098
|
* export default function Command() {
|
|
1105
|
-
* const [
|
|
1099
|
+
* const [description, setDescription] = useState<string>();
|
|
1106
1100
|
*
|
|
1107
1101
|
* return (
|
|
1108
|
-
* <Form
|
|
1109
|
-
*
|
|
1102
|
+
* <Form
|
|
1103
|
+
* actions={
|
|
1104
|
+
* <ActionPanel>
|
|
1105
|
+
* <SubmitFormAction title="Submit Description" onSubmit={(values) => console.log(values)} />
|
|
1106
|
+
* </ActionPanel>
|
|
1107
|
+
* }
|
|
1108
|
+
* >
|
|
1109
|
+
* <Form.TextArea id="description" value={description} onChange={setDescription} />
|
|
1110
1110
|
* </Form>
|
|
1111
1111
|
* );
|
|
1112
1112
|
* }
|
|
@@ -1151,8 +1151,14 @@ export interface FormCheckboxProps extends FormItemProps<boolean> {
|
|
|
1151
1151
|
*
|
|
1152
1152
|
* export default function Command() {
|
|
1153
1153
|
* return (
|
|
1154
|
-
* <Form
|
|
1155
|
-
*
|
|
1154
|
+
* <Form
|
|
1155
|
+
* actions={
|
|
1156
|
+
* <ActionPanel>
|
|
1157
|
+
* <SubmitFormAction title="Submit Answer" onSubmit={(values) => console.log(values)} />
|
|
1158
|
+
* </ActionPanel>
|
|
1159
|
+
* }
|
|
1160
|
+
* >
|
|
1161
|
+
* <Form.Checkbox id="answer" label="Are you happy?" defaultValue={true} />
|
|
1156
1162
|
* </Form>
|
|
1157
1163
|
* );
|
|
1158
1164
|
* }
|
|
@@ -1169,8 +1175,14 @@ export interface FormCheckboxProps extends FormItemProps<boolean> {
|
|
|
1169
1175
|
* const [checked, setChecked] = useState(true);
|
|
1170
1176
|
*
|
|
1171
1177
|
* return (
|
|
1172
|
-
* <Form
|
|
1173
|
-
*
|
|
1178
|
+
* <Form
|
|
1179
|
+
* actions={
|
|
1180
|
+
* <ActionPanel>
|
|
1181
|
+
* <SubmitFormAction title="Submit Answer" onSubmit={(values) => console.log(values)} />
|
|
1182
|
+
* </ActionPanel>
|
|
1183
|
+
* }
|
|
1184
|
+
* >
|
|
1185
|
+
* <Form.Checkbox id="answer" label="Do you like orange juice?" value={checked} onChange={setChecked} />
|
|
1174
1186
|
* </Form>
|
|
1175
1187
|
* );
|
|
1176
1188
|
* }
|
|
@@ -1211,7 +1223,13 @@ export interface FormDatePickerProps extends FormItemProps<Date> {
|
|
|
1211
1223
|
*
|
|
1212
1224
|
* export default function Command() {
|
|
1213
1225
|
* return (
|
|
1214
|
-
* <Form
|
|
1226
|
+
* <Form
|
|
1227
|
+
* actions={
|
|
1228
|
+
* <ActionPanel>
|
|
1229
|
+
* <SubmitFormAction title="Submit Form" onSubmit={(values) => console.log(values)} />
|
|
1230
|
+
* </ActionPanel>
|
|
1231
|
+
* }
|
|
1232
|
+
* >
|
|
1215
1233
|
* <Form.DatePicker id="dateOfBirth" title="Date of Birth" defaultValue={new Date(1955, 1, 24)} />
|
|
1216
1234
|
* </Form>
|
|
1217
1235
|
* );
|
|
@@ -1229,7 +1247,13 @@ export interface FormDatePickerProps extends FormItemProps<Date> {
|
|
|
1229
1247
|
* const [date, setDate] = useState<Date>();
|
|
1230
1248
|
*
|
|
1231
1249
|
* return (
|
|
1232
|
-
* <Form
|
|
1250
|
+
* <Form
|
|
1251
|
+
* actions={
|
|
1252
|
+
* <ActionPanel>
|
|
1253
|
+
* <SubmitFormAction title="Submit Form" onSubmit={(values) => console.log(values)} />
|
|
1254
|
+
* </ActionPanel>
|
|
1255
|
+
* }
|
|
1256
|
+
* >
|
|
1233
1257
|
* <Form.DatePicker id="launchDate" title="Launch Date" value={date} onChange={setDate} />
|
|
1234
1258
|
* </Form>
|
|
1235
1259
|
* );
|
|
@@ -1269,7 +1293,13 @@ export interface FormSeparatorProps {
|
|
|
1269
1293
|
*
|
|
1270
1294
|
* export default function Command() {
|
|
1271
1295
|
* return (
|
|
1272
|
-
* <Form
|
|
1296
|
+
* <Form
|
|
1297
|
+
* actions={
|
|
1298
|
+
* <ActionPanel>
|
|
1299
|
+
* <SubmitFormAction title="Submit Form" onSubmit={(values) => console.log(values)} />
|
|
1300
|
+
* </ActionPanel>
|
|
1301
|
+
* }
|
|
1302
|
+
* >
|
|
1273
1303
|
* <Form.TextField id="textfield" />
|
|
1274
1304
|
* <Form.Separator />
|
|
1275
1305
|
* <Form.TextArea id="textarea" />
|
|
@@ -1308,7 +1338,13 @@ export interface FormDropdownProps extends FormItemProps<string> {
|
|
|
1308
1338
|
*
|
|
1309
1339
|
* export default function Command() {
|
|
1310
1340
|
* return (
|
|
1311
|
-
* <Form
|
|
1341
|
+
* <Form
|
|
1342
|
+
* actions={
|
|
1343
|
+
* <ActionPanel>
|
|
1344
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1345
|
+
* </ActionPanel>
|
|
1346
|
+
* }
|
|
1347
|
+
* >
|
|
1312
1348
|
* <Form.Dropdown id="emoji" title="Favorite Emoji" defaultValue="lol">
|
|
1313
1349
|
* <Form.Dropdown.Item value="poop" title="Pile of poop" icon="💩" />
|
|
1314
1350
|
* <Form.Dropdown.Item value="rocket" title="Rocket" icon="🚀" />
|
|
@@ -1330,7 +1366,13 @@ export interface FormDropdownProps extends FormItemProps<string> {
|
|
|
1330
1366
|
* const [programmingLanguage, setProgrammingLanguage] = useState<string>("typescript");
|
|
1331
1367
|
*
|
|
1332
1368
|
* return (
|
|
1333
|
-
* <Form
|
|
1369
|
+
* <Form
|
|
1370
|
+
* actions={
|
|
1371
|
+
* <ActionPanel>
|
|
1372
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1373
|
+
* </ActionPanel>
|
|
1374
|
+
* }
|
|
1375
|
+
* >
|
|
1334
1376
|
* <Form.Dropdown
|
|
1335
1377
|
* id="dropdown"
|
|
1336
1378
|
* title="Favorite Language"
|
|
@@ -1395,7 +1437,13 @@ export interface FormDropdownSectionProps {
|
|
|
1395
1437
|
*
|
|
1396
1438
|
* export default function Command() {
|
|
1397
1439
|
* return (
|
|
1398
|
-
* <Form
|
|
1440
|
+
* <Form
|
|
1441
|
+
* actions={
|
|
1442
|
+
* <ActionPanel>
|
|
1443
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1444
|
+
* </ActionPanel>
|
|
1445
|
+
* }
|
|
1446
|
+
* >
|
|
1399
1447
|
* <Form.Dropdown id="food" title="Favorite Food">
|
|
1400
1448
|
* <Form.Dropdown.Section title="Fruits">
|
|
1401
1449
|
* <Form.Dropdown.Item value="apple" title="Apple" icon="🍎" />
|
|
@@ -1452,7 +1500,13 @@ export interface FormDropdownItemProps {
|
|
|
1452
1500
|
*
|
|
1453
1501
|
* export default function Command() {
|
|
1454
1502
|
* return (
|
|
1455
|
-
* <Form
|
|
1503
|
+
* <Form
|
|
1504
|
+
* actions={
|
|
1505
|
+
* <ActionPanel>
|
|
1506
|
+
* <SubmitFormAction title="Submit Icon" onSubmit={(values) => console.log(values)} />
|
|
1507
|
+
* </ActionPanel>
|
|
1508
|
+
* }
|
|
1509
|
+
* >
|
|
1456
1510
|
* <Form.Dropdown id="icon" title="Icon">
|
|
1457
1511
|
* <Form.Dropdown.Item value="circle" title="Cirlce" icon={Icon.Circle} />
|
|
1458
1512
|
* </Form.Dropdown>
|
|
@@ -1513,7 +1567,13 @@ export interface FormTagPickerProps extends FormItemProps<string[]> {
|
|
|
1513
1567
|
*
|
|
1514
1568
|
* export default function Command() {
|
|
1515
1569
|
* return (
|
|
1516
|
-
* <Form
|
|
1570
|
+
* <Form
|
|
1571
|
+
* actions={
|
|
1572
|
+
* <ActionPanel>
|
|
1573
|
+
* <SubmitFormAction title="Submit Favorite" onSubmit={(values) => console.log(values)} />
|
|
1574
|
+
* </ActionPanel>
|
|
1575
|
+
* }
|
|
1576
|
+
* >
|
|
1517
1577
|
* <Form.TagPicker id="sports" title="Favorite Sports" defaultValue={["football"]}>
|
|
1518
1578
|
* <Form.TagPicker.Item value="basketball" title="Basketball" icon="🏀" />
|
|
1519
1579
|
* <Form.TagPicker.Item value="football" title="Football" icon="⚽️" />
|
|
@@ -1535,7 +1595,13 @@ export interface FormTagPickerProps extends FormItemProps<string[]> {
|
|
|
1535
1595
|
* const [countries, setCountries] = useState<string[]>(["ger", "ned", "pol"]);
|
|
1536
1596
|
*
|
|
1537
1597
|
* return (
|
|
1538
|
-
* <Form
|
|
1598
|
+
* <Form
|
|
1599
|
+
* actions={
|
|
1600
|
+
* <ActionPanel>
|
|
1601
|
+
* <SubmitFormAction title="Submit Countries" onSubmit={(values) => console.log(values)} />
|
|
1602
|
+
* </ActionPanel>
|
|
1603
|
+
* }
|
|
1604
|
+
* >
|
|
1539
1605
|
* <Form.TagPicker id="countries" title="Visited Countries" value={countries} onChange={setCountries}>
|
|
1540
1606
|
* <Form.TagPicker.Item value="ger" title="Germany" icon="🇩🇪" />
|
|
1541
1607
|
* <Form.TagPicker.Item value="ind" title="India" icon="🇮🇳" />
|
|
@@ -1597,9 +1663,17 @@ export interface FormTagPickerItemProps {
|
|
|
1597
1663
|
*
|
|
1598
1664
|
* export default function Command() {
|
|
1599
1665
|
* return (
|
|
1600
|
-
* <Form
|
|
1666
|
+
* <Form
|
|
1667
|
+
* actions={
|
|
1668
|
+
* <ActionPanel>
|
|
1669
|
+
* <SubmitFormAction title="Submit Color" onSubmit={(values) => console.log(values)} />
|
|
1670
|
+
* </ActionPanel>
|
|
1671
|
+
* }
|
|
1672
|
+
* >
|
|
1601
1673
|
* <Form.TagPicker id="color" title="Color">
|
|
1602
|
-
* <Form.TagPicker.Item value="
|
|
1674
|
+
* <Form.TagPicker.Item value="red" title="Red" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
|
|
1675
|
+
* <Form.TagPicker.Item value="green" title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
|
|
1676
|
+
* <Form.TagPicker.Item value="blue" title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
|
|
1603
1677
|
* </Form.TagPicker>
|
|
1604
1678
|
* </Form>
|
|
1605
1679
|
* );
|
|
@@ -2756,6 +2830,66 @@ export interface PreferenceValues {
|
|
|
2756
2830
|
* @category Preferences
|
|
2757
2831
|
*/
|
|
2758
2832
|
export function getPreferenceValues<Values extends PreferenceValues = PreferenceValues>(): Values;
|
|
2833
|
+
/**
|
|
2834
|
+
* Gets the selected text of the frontmost application.
|
|
2835
|
+
*
|
|
2836
|
+
* @throws An error when no text is selected in the frontmost application.
|
|
2837
|
+
* @returns Returns a promise that resolves with the selected text.
|
|
2838
|
+
*
|
|
2839
|
+
* @example
|
|
2840
|
+
* ```typescript
|
|
2841
|
+
*
|
|
2842
|
+
*
|
|
2843
|
+
* export default async () => {
|
|
2844
|
+
* try {
|
|
2845
|
+
* const selectedText = await getSelectedText();
|
|
2846
|
+
* const transformedText = selectedText.toUpperCase();
|
|
2847
|
+
* await pasteText(transformedText);
|
|
2848
|
+
* } catch (error) {
|
|
2849
|
+
* await showToast(ToastStyle.Failure, "Cannot transform text", String(error));
|
|
2850
|
+
* }
|
|
2851
|
+
* };
|
|
2852
|
+
* ```
|
|
2853
|
+
*
|
|
2854
|
+
* @category Environment
|
|
2855
|
+
*/
|
|
2856
|
+
export function getSelectedText(): Promise<string>;
|
|
2857
|
+
/**
|
|
2858
|
+
* Holds data about a File System item. Use the {@link getSelectedFinderItems} method to retrieve values.
|
|
2859
|
+
*
|
|
2860
|
+
* @category Environment
|
|
2861
|
+
*/
|
|
2862
|
+
export interface FileSystemItem {
|
|
2863
|
+
/**
|
|
2864
|
+
* The path to the item
|
|
2865
|
+
*/
|
|
2866
|
+
path: string;
|
|
2867
|
+
}
|
|
2868
|
+
/**
|
|
2869
|
+
* Gets the selected items from Finder.
|
|
2870
|
+
*
|
|
2871
|
+
* @throws An error when Finder is not the frontmost application.
|
|
2872
|
+
* @returns Returns a promise that resolves with the selected file system items.
|
|
2873
|
+
*
|
|
2874
|
+
* @example
|
|
2875
|
+
* ```typescript
|
|
2876
|
+
*
|
|
2877
|
+
*
|
|
2878
|
+
* export default async () => {
|
|
2879
|
+
* try {
|
|
2880
|
+
* const selectedItems = await getSelectedFinderItems();
|
|
2881
|
+
* if (selectedItems.length) {
|
|
2882
|
+
* await pasteText(selectedItems[0].path);
|
|
2883
|
+
* }
|
|
2884
|
+
* } catch (error) {
|
|
2885
|
+
* await showToast(ToastStyle.Failure, "Cannot copy file path", String(error));
|
|
2886
|
+
* }
|
|
2887
|
+
* };
|
|
2888
|
+
* ```
|
|
2889
|
+
*
|
|
2890
|
+
* @category Environment
|
|
2891
|
+
*/
|
|
2892
|
+
export function getSelectedFinderItems(): Promise<FileSystemItem[]>;
|
|
2759
2893
|
|
|
2760
2894
|
|
|
2761
2895
|
/**
|
|
@@ -2897,6 +3031,150 @@ export function useNavigation(): Navigation;
|
|
|
2897
3031
|
* @subcategory Rendering
|
|
2898
3032
|
*/
|
|
2899
3033
|
export function render(nodeToRender: ReactNode): void;
|
|
3034
|
+
|
|
3035
|
+
/**
|
|
3036
|
+
* Creates and shows a confirmation Alert with the given options.
|
|
3037
|
+
*
|
|
3038
|
+
* @param options - The options used to create the Alert.
|
|
3039
|
+
* @returns A promise that resolves to a boolean when the user takes an action.
|
|
3040
|
+
* It will be `true` for the primary Action, `false` for the dismiss Action.
|
|
3041
|
+
*
|
|
3042
|
+
* @example
|
|
3043
|
+
* ```typescript
|
|
3044
|
+
*
|
|
3045
|
+
*
|
|
3046
|
+
* export default async () => {
|
|
3047
|
+
* if (await confirmAlert({ title: "Are you sure?" })) {
|
|
3048
|
+
* // do something
|
|
3049
|
+
* }
|
|
3050
|
+
* };
|
|
3051
|
+
* ```
|
|
3052
|
+
*
|
|
3053
|
+
* @category User Interface
|
|
3054
|
+
* @subcategory Alert
|
|
3055
|
+
*/
|
|
3056
|
+
export function confirmAlert(options: AlertOptions): Promise<boolean>;
|
|
3057
|
+
/**
|
|
3058
|
+
* The options to create an {@link Alert}.
|
|
3059
|
+
*
|
|
3060
|
+
* @example
|
|
3061
|
+
* ```typescript
|
|
3062
|
+
*
|
|
3063
|
+
*
|
|
3064
|
+
* export default async () => {
|
|
3065
|
+
* const options: AlertOptions = {
|
|
3066
|
+
* title: "Finished cooking",
|
|
3067
|
+
* message: "Delicious pasta for lunch",
|
|
3068
|
+
* primaryAction: {
|
|
3069
|
+
* title: 'Do something',
|
|
3070
|
+
* onAction: () => {
|
|
3071
|
+
* // while you can register a handler for an action, it's more elegant
|
|
3072
|
+
* // to use the `if (await confirmAlert(...)) { ... }` pattern
|
|
3073
|
+
* console.log("The alert action has been triggered")
|
|
3074
|
+
* }
|
|
3075
|
+
* }
|
|
3076
|
+
* };
|
|
3077
|
+
* await confirmAlert(options);
|
|
3078
|
+
* };
|
|
3079
|
+
* ```
|
|
3080
|
+
*
|
|
3081
|
+
* @category User Interface
|
|
3082
|
+
* @subcategory Alert
|
|
3083
|
+
*/
|
|
3084
|
+
export interface AlertOptions {
|
|
3085
|
+
/**
|
|
3086
|
+
* The icon of an alert to illustrate the action. Displayed on the top.
|
|
3087
|
+
*/
|
|
3088
|
+
icon?: ImageLike;
|
|
3089
|
+
/**
|
|
3090
|
+
* The title of an alert. Displayed below the icon.
|
|
3091
|
+
*/
|
|
3092
|
+
title: string;
|
|
3093
|
+
/**
|
|
3094
|
+
* An additional message for an Alert. Useful to show more information, e.g. a confirmation message for a destructive action.
|
|
3095
|
+
*/
|
|
3096
|
+
message?: string;
|
|
3097
|
+
/**
|
|
3098
|
+
* The primary Action the user can take.
|
|
3099
|
+
*/
|
|
3100
|
+
primaryAction?: AlertActionOptions;
|
|
3101
|
+
/**
|
|
3102
|
+
* The Action to dismiss the alert. There usually shouldn't be any side effects when the user takes this action.
|
|
3103
|
+
*/
|
|
3104
|
+
dismissAction?: AlertActionOptions;
|
|
3105
|
+
}
|
|
3106
|
+
/**
|
|
3107
|
+
* The options to create an {@link Alert} Action.
|
|
3108
|
+
*
|
|
3109
|
+
* @category User Interface
|
|
3110
|
+
* @subcategory Alert
|
|
3111
|
+
*/
|
|
3112
|
+
export interface AlertActionOptions {
|
|
3113
|
+
/**
|
|
3114
|
+
* The title of the action.
|
|
3115
|
+
*/
|
|
3116
|
+
title: string;
|
|
3117
|
+
/**
|
|
3118
|
+
* The style of the action.
|
|
3119
|
+
*/
|
|
3120
|
+
style?: AlertActionStyle;
|
|
3121
|
+
/**
|
|
3122
|
+
* A callback called when the action is triggered.
|
|
3123
|
+
*/
|
|
3124
|
+
onAction?: () => void;
|
|
3125
|
+
}
|
|
3126
|
+
/**
|
|
3127
|
+
* Defines the visual style of an Action of the Alert.
|
|
3128
|
+
*
|
|
3129
|
+
* @remarks
|
|
3130
|
+
* Use {@link AlertActionStyle.Default} for confirmations of a positive action.
|
|
3131
|
+
* Use {@link AlertActionStyle.Destructive} for confirmations of a destructive action (eg. deleting a file).
|
|
3132
|
+
*
|
|
3133
|
+
* @category User Interface
|
|
3134
|
+
* @subcategory Alert
|
|
3135
|
+
*/
|
|
3136
|
+
export enum AlertActionStyle {
|
|
3137
|
+
Default = "DEFAULT",
|
|
3138
|
+
Cancel = "CANCEL",
|
|
3139
|
+
Destructive = "DESTRUCTIVE"
|
|
3140
|
+
}
|
|
3141
|
+
/**
|
|
3142
|
+
* Union type for the supported color types.
|
|
3143
|
+
*
|
|
3144
|
+
* @remark
|
|
3145
|
+
* Besides the {@link Color}, you can use any of the following color formats:
|
|
3146
|
+
* - HEX, e.g `#FF0000`
|
|
3147
|
+
* - Short HEX, e.g. `#F00`
|
|
3148
|
+
* - RGBA, e.g. `rgb(255, 0, 0)`
|
|
3149
|
+
* - RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
|
|
3150
|
+
* - HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
|
|
3151
|
+
* - Keywords, e.g. `red`
|
|
3152
|
+
*
|
|
3153
|
+
* Colors different to the built-in ones (see {@link Color}) will be dynamically adjusted to fit the contrast.
|
|
3154
|
+
*
|
|
3155
|
+
* @example
|
|
3156
|
+
* ```typescript
|
|
3157
|
+
*
|
|
3158
|
+
*
|
|
3159
|
+
* export default function Command() {
|
|
3160
|
+
* return (
|
|
3161
|
+
* <List>
|
|
3162
|
+
* <List.Item title="Built-in color" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
|
|
3163
|
+
* <List.Item title="HEX" icon={{ source: Icon.Circle, tintColor: "#FF0000" }} />
|
|
3164
|
+
* <List.Item title="Short HEX" icon={{ source: Icon.Circle, tintColor: "#F00" }} />
|
|
3165
|
+
* <List.Item title="RGBA" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0)" }} />
|
|
3166
|
+
* <List.Item title="RGBA Percentage" icon={{ source: Icon.Circle, tintColor: "rgb(255, 0, 0, 1.0)" }} />
|
|
3167
|
+
* <List.Item title="HSL" icon={{ source: Icon.Circle, tintColor: "hsla(200, 20%, 33%, 0.2)" }} />
|
|
3168
|
+
* <List.Item title="Keywords" icon={{ source: Icon.Circle, tintColor: "red" }} />
|
|
3169
|
+
* </List>
|
|
3170
|
+
* );
|
|
3171
|
+
* };
|
|
3172
|
+
* ```
|
|
3173
|
+
*
|
|
3174
|
+
* @category User Interface
|
|
3175
|
+
* @subcategory Colors
|
|
3176
|
+
*/
|
|
3177
|
+
export type ColorLike = Color | DynamicColor | string;
|
|
2900
3178
|
/**
|
|
2901
3179
|
* The standard colors. Use this colors for consistency.
|
|
2902
3180
|
*
|
|
@@ -2960,7 +3238,7 @@ export enum Color {
|
|
|
2960
3238
|
* @category User Interface
|
|
2961
3239
|
* @subcategory Colors
|
|
2962
3240
|
*/
|
|
2963
|
-
interface DynamicColor {
|
|
3241
|
+
export interface DynamicColor {
|
|
2964
3242
|
/**
|
|
2965
3243
|
* The color which is used in light theme.
|
|
2966
3244
|
*
|
|
@@ -2988,44 +3266,6 @@ interface DynamicColor {
|
|
|
2988
3266
|
*/
|
|
2989
3267
|
adjustContrast?: boolean;
|
|
2990
3268
|
}
|
|
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
3269
|
/**
|
|
3030
3270
|
* List of built-in icons that can be used for actions or list items.
|
|
3031
3271
|
*
|
|
@@ -3116,7 +3356,7 @@ export enum Icon {
|
|
|
3116
3356
|
*/
|
|
3117
3357
|
export interface FileIcon {
|
|
3118
3358
|
/**
|
|
3119
|
-
* The path to a file or folder to get
|
|
3359
|
+
* The path to a file or folder to get its icon from.
|
|
3120
3360
|
*/
|
|
3121
3361
|
fileIcon: string;
|
|
3122
3362
|
}
|
|
@@ -3252,6 +3492,7 @@ export enum ImageMask {
|
|
|
3252
3492
|
*/
|
|
3253
3493
|
RoundedRectangle = "roundedRectangle"
|
|
3254
3494
|
}
|
|
3495
|
+
|
|
3255
3496
|
/**
|
|
3256
3497
|
* A Toast with a certain style, title, and message.
|
|
3257
3498
|
*
|
|
@@ -3279,17 +3520,23 @@ export enum ImageMask {
|
|
|
3279
3520
|
*/
|
|
3280
3521
|
export class Toast {
|
|
3281
3522
|
private options;
|
|
3282
|
-
|
|
3523
|
+
private id;
|
|
3524
|
+
private callbacks;
|
|
3525
|
+
constructor(props: ToastOptions);
|
|
3283
3526
|
get style(): ToastStyle;
|
|
3284
3527
|
set style(style: ToastStyle);
|
|
3285
3528
|
get title(): string;
|
|
3286
3529
|
set title(title: string);
|
|
3287
3530
|
get message(): string | undefined;
|
|
3288
3531
|
set message(message: string | undefined);
|
|
3532
|
+
get primaryAction(): ToastActionOptions | undefined;
|
|
3533
|
+
set primaryAction(action: ToastActionOptions | undefined);
|
|
3534
|
+
get secondaryAction(): ToastActionOptions | undefined;
|
|
3535
|
+
set secondaryAction(action: ToastActionOptions | undefined);
|
|
3289
3536
|
/**
|
|
3290
3537
|
* Shows the Toast.
|
|
3291
3538
|
*
|
|
3292
|
-
* @returns A promise that resolves when toast is shown.
|
|
3539
|
+
* @returns A promise that resolves when the toast is shown.
|
|
3293
3540
|
*/
|
|
3294
3541
|
show(): Promise<void>;
|
|
3295
3542
|
/**
|
|
@@ -3312,6 +3559,12 @@ export class Toast {
|
|
|
3312
3559
|
* style: ToastStyle.Success,
|
|
3313
3560
|
* title: "Finished cooking",
|
|
3314
3561
|
* message: "Delicious pasta for lunch",
|
|
3562
|
+
* primaryAction: {
|
|
3563
|
+
* title: 'Do something',
|
|
3564
|
+
* onAction: () => {
|
|
3565
|
+
* console.log("The toast action has been triggered")
|
|
3566
|
+
* }
|
|
3567
|
+
* }
|
|
3315
3568
|
* };
|
|
3316
3569
|
* const toast = new Toast(options);
|
|
3317
3570
|
* await toast.show();
|
|
@@ -3331,9 +3584,37 @@ export interface ToastOptions {
|
|
|
3331
3584
|
*/
|
|
3332
3585
|
title: string;
|
|
3333
3586
|
/**
|
|
3334
|
-
* An additional message for the toast. Useful to show more information, e.g. an identifier of a newly
|
|
3587
|
+
* An additional message for the toast. Useful to show more information, e.g. an identifier of a newly created asset.
|
|
3335
3588
|
*/
|
|
3336
3589
|
message?: string;
|
|
3590
|
+
/**
|
|
3591
|
+
* The primary Action the user can take when hovering on the Toast.
|
|
3592
|
+
*/
|
|
3593
|
+
primaryAction?: ToastActionOptions;
|
|
3594
|
+
/**
|
|
3595
|
+
* The secondary Action the user can take when hovering on the Toast.
|
|
3596
|
+
*/
|
|
3597
|
+
secondaryAction?: ToastActionOptions;
|
|
3598
|
+
}
|
|
3599
|
+
/**
|
|
3600
|
+
* The options to create a {@link Toast} Action.
|
|
3601
|
+
*
|
|
3602
|
+
* @category User Interface
|
|
3603
|
+
* @subcategory Toast
|
|
3604
|
+
*/
|
|
3605
|
+
export interface ToastActionOptions {
|
|
3606
|
+
/**
|
|
3607
|
+
* The title of the action.
|
|
3608
|
+
*/
|
|
3609
|
+
title: string;
|
|
3610
|
+
/**
|
|
3611
|
+
* The keyboard shortcut for the action.
|
|
3612
|
+
*/
|
|
3613
|
+
shortcut?: KeyboardShortcut;
|
|
3614
|
+
/**
|
|
3615
|
+
* A callback called when the action is triggered.
|
|
3616
|
+
*/
|
|
3617
|
+
onAction: () => void;
|
|
3337
3618
|
}
|
|
3338
3619
|
/**
|
|
3339
3620
|
* Defines the visual style of the Toast.
|
|
@@ -3352,7 +3633,7 @@ export enum ToastStyle {
|
|
|
3352
3633
|
Animated = "ANIMATED"
|
|
3353
3634
|
}
|
|
3354
3635
|
/**
|
|
3355
|
-
* Creates and shows a Toast with the
|
|
3636
|
+
* Creates and shows a Toast with the given style, title, and message.
|
|
3356
3637
|
*
|
|
3357
3638
|
* @param style - The visual style of the Toast.
|
|
3358
3639
|
* @param title - The title that will be displayed in the Toast.
|