@raycast/api 1.44.0 → 1.45.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.
Files changed (3) hide show
  1. package/api.d.ts +84 -33
  2. package/package.json +1 -1
  3. package/types/index.d.ts +84 -33
package/api.d.ts CHANGED
@@ -550,13 +550,8 @@ declare interface Arguments {
550
550
  [item: string]: any;
551
551
  }
552
552
 
553
- /**
554
- * An interface describing top-level props for arguments
555
- */
553
+ /** @deprecated Use {@Link LaunchProps} directly */
556
554
  export declare interface ArgumentsLaunchProps {
557
- /**
558
- * Use these values to populate the initial state for your command.
559
- */
560
555
  arguments?: Arguments;
561
556
  }
562
557
 
@@ -857,7 +852,6 @@ export declare function closeMainWindow(options?: {
857
852
  * <List>
858
853
  * <List.Item title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
859
854
  * <List.Item title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
860
- * <List.Item title="Brown" icon={{ source: Icon.Circle, tintColor: Color.Brown }} />
861
855
  * <List.Item title="Magenta" icon={{ source: Icon.Circle, tintColor: Color.Magenta }} />
862
856
  * <List.Item title="Orange" icon={{ source: Icon.Circle, tintColor: Color.Orange }} />
863
857
  * <List.Item title="Purple" icon={{ source: Icon.Circle, tintColor: Color.Purple }} />
@@ -872,7 +866,6 @@ export declare function closeMainWindow(options?: {
872
866
  */
873
867
  export declare enum Color {
874
868
  Blue = "raycast-blue",
875
- Brown = "raycast-brown",
876
869
  Green = "raycast-green",
877
870
  Magenta = "raycast-magenta",
878
871
  Orange = "raycast-orange",
@@ -957,6 +950,12 @@ export declare namespace Color {
957
950
  * - Keywords, e.g. `red`
958
951
  */
959
952
  export type Raw = string;
953
+ /** The standard colors. Use those colors for consistency.
954
+ *
955
+ * @remarks
956
+ * The colors automatically adapt to the Raycast theme (light or dark).
957
+ */
958
+ const Brown: Color.Dynamic;
960
959
  }
961
960
 
962
961
  /**
@@ -1887,6 +1886,12 @@ declare interface DropdownMembers_2 {
1887
1886
  * See {@link Form.Dropdown.Props}
1888
1887
  */
1889
1888
  declare interface DropdownProps extends FormItemProps_2<string>, SearchBarInterface {
1889
+ /**
1890
+ * Placeholder text that will be shown in the dropdown search field.
1891
+ *
1892
+ * @defaultValue `"Search..."`
1893
+ */
1894
+ placeholder?: string;
1890
1895
  /**
1891
1896
  * Sections or items. If {@link Form.Dropdown.Item} elements are specified, a default section is automatically created.
1892
1897
  */
@@ -2049,7 +2054,7 @@ export declare interface Environment {
2049
2054
  */
2050
2055
  launchType: LaunchType;
2051
2056
  /**
2052
- * Any custom context values passed from a programmatic command launch via `launchCommand`.
2057
+ * @deprecated Use the top-level prop `launchContext` instead.
2053
2058
  */
2054
2059
  launchContext?: LaunchContext;
2055
2060
  }
@@ -3060,14 +3065,8 @@ declare interface FormItemRef {
3060
3065
  reset: () => void;
3061
3066
  }
3062
3067
 
3063
- /**
3064
- * An interface describing top-level props for Form drafts
3065
- */
3068
+ /** @deprecated Use {@Link LaunchProps} directly */
3066
3069
  export declare interface FormLaunchProps {
3067
- /**
3068
- * When a user enters the command via a draft, this object will contain the user inputs that were saved as a draft.
3069
- * Use its values to populate the initial state for your Form.
3070
- */
3071
3070
  draftValues?: Form.Values;
3072
3071
  }
3073
3072
 
@@ -3760,7 +3759,7 @@ export declare function getApplications(path?: PathLike): Promise<Application[]>
3760
3759
  * Returns the default application that the file would be opened with.
3761
3760
  *
3762
3761
  * @param path - The path of the file or folder to get the default application for.
3763
- * @returns The default {@link Application} that would open the file. Throws an error if no application was found.
3762
+ * @returns A Promise that resolves with the default {@link Application} that would open the file. If no application was found, the promise will be rejected.
3764
3763
  *
3765
3764
  * @example
3766
3765
  * ```typescript
@@ -3777,7 +3776,7 @@ export declare function getDefaultApplication(path: PathLike): Promise<Applicati
3777
3776
  /**
3778
3777
  * Returns the frontmost application.
3779
3778
  *
3780
- * @returns The frontmost {@link Application}. Throws an error if no application was found.
3779
+ * @returns A Promise that resolves with the frontmost {@link Application}. If no application was found, the promise will be rejected.
3781
3780
  *
3782
3781
  * @example
3783
3782
  * ```typescript
@@ -3825,8 +3824,7 @@ export declare function getPreferenceValues<Values extends PreferenceValues = Pr
3825
3824
  /**
3826
3825
  * Gets the selected items from Finder.
3827
3826
  *
3828
- * @throws An error when Finder is not the frontmost application.
3829
- * @returns A Promise that resolves with the selected file system items.
3827
+ * @returns A Promise that resolves with the selected file system items. If Finder is not the frontmost application, the promise will be rejected.
3830
3828
  *
3831
3829
  * @example
3832
3830
  * ```typescript
@@ -3853,8 +3851,7 @@ export declare function getSelectedFinderItems(): Promise<FileSystemItem[]>;
3853
3851
  /**
3854
3852
  * Gets the selected text of the frontmost application.
3855
3853
  *
3856
- * @throws An error when no text is selected in the frontmost application.
3857
- * @returns A Promise that resolves with the selected text.
3854
+ * @returns A Promise that resolves with the selected text. If no text is selected in the frontmost application, the promise will be rejected.
3858
3855
  *
3859
3856
  * @example
3860
3857
  * ```typescript
@@ -4886,14 +4883,34 @@ declare const Item_3: FunctionComponent<ItemProps_3>;
4886
4883
 
4887
4884
  declare type ItemAccessory = ({
4888
4885
  /**
4889
- * An optional text that will be used as the label.
4886
+ * An optional text that will be used as the label, optionally colored.
4887
+ * Color changes the text color to the provided color.
4888
+ * Defaults to {@link Color.SecondaryText}.
4890
4889
  */
4891
- text?: string | undefined | null;
4890
+ text?: string | undefined | null | {
4891
+ value: string | undefined | null;
4892
+ color?: Color;
4893
+ };
4894
+ } | {
4895
+ /**
4896
+ * An optional Date that will be used as the label, optionally colored. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.).
4897
+ * Color changes the text color to the provided color.
4898
+ * Defaults to {@link Color.SecondaryText}.
4899
+ */
4900
+ date?: Date | undefined | null | {
4901
+ value: Date | undefined | null;
4902
+ color?: Color;
4903
+ };
4892
4904
  } | {
4893
4905
  /**
4894
- * An optional Date that will be used as the label. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.).
4906
+ * A string or Date that will be used as the label, optionally colored. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.).
4907
+ * Color changes the text color to the provided color and sets a transparent background with the same color.
4908
+ * Defaults to {@link Color.SecondaryText}.
4895
4909
  */
4896
- date?: Date | undefined | null;
4910
+ tag: string | Date | undefined | null | {
4911
+ value: string | Date | undefined | null;
4912
+ color?: Color;
4913
+ };
4897
4914
  }) & {
4898
4915
  /**
4899
4916
  * An optional {@link Image.ImageLike} that will be used as the icon.
@@ -4970,14 +4987,14 @@ declare interface ItemProps extends ActionsInterface {
4970
4987
  */
4971
4988
  title: string | {
4972
4989
  value: string;
4973
- tooltip: string;
4990
+ tooltip?: string | null;
4974
4991
  };
4975
4992
  /**
4976
4993
  * An optional subtitle displayed next to the main title, optionally with a tooltip.
4977
4994
  */
4978
4995
  subtitle?: string | {
4979
- value: string | undefined | null;
4980
- tooltip: string;
4996
+ value?: string | null;
4997
+ tooltip?: string | null;
4981
4998
  };
4982
4999
  /**
4983
5000
  * An optional property used for providing additional indexable strings for search.
@@ -5075,7 +5092,7 @@ declare interface ItemProps_3 {
5075
5092
  */
5076
5093
  title: string;
5077
5094
  /**
5078
- * The subtitle displayed for this item in a slightly dimmed text color.
5095
+ * The subtitle displayed for this item.
5079
5096
  */
5080
5097
  subtitle?: string;
5081
5098
  /**
@@ -5187,8 +5204,12 @@ declare interface LabelProps {
5187
5204
  icon?: Image.ImageLike | undefined | null;
5188
5205
  /**
5189
5206
  * The text value of the item.
5207
+ * Specifying `color` will display the text in the provided color. Defaults to {@link Color.SecondaryText}.
5190
5208
  */
5191
- text?: string;
5209
+ text?: string | {
5210
+ value: string;
5211
+ color?: Color | null;
5212
+ };
5192
5213
  }
5193
5214
 
5194
5215
  /**
@@ -5229,7 +5250,37 @@ declare interface LaunchContext {
5229
5250
  /**
5230
5251
  * The top-level props that a Command receives on launch
5231
5252
  */
5232
- export declare type LaunchProps = ArgumentsLaunchProps | FormLaunchProps;
5253
+ export declare type LaunchProps<T extends {
5254
+ arguments?: Arguments;
5255
+ draftValues?: Form.Values;
5256
+ launchContext?: LaunchContext;
5257
+ } = {
5258
+ arguments: Arguments;
5259
+ draftValues: Form.Values;
5260
+ launchContext?: LaunchContext;
5261
+ }> = {
5262
+ /**
5263
+ * The type of launch for the command (user initiated or background).
5264
+ */
5265
+ launchType: LaunchType;
5266
+ /**
5267
+ * Use these values to populate the initial state for your command.
5268
+ */
5269
+ arguments: T["arguments"];
5270
+ /**
5271
+ * When a user enters the command via a draft, this object will contain the user inputs that were saved as a draft.
5272
+ * Use its values to populate the initial state for your Form.
5273
+ */
5274
+ draftValues?: T["draftValues"];
5275
+ /**
5276
+ * When the command is launched programmatically via `launchCommand`, this object contains the value passed to `context`.
5277
+ */
5278
+ launchContext?: T["launchContext"];
5279
+ /**
5280
+ * When the command is launched as a fallback command, this string contains the text of the root search.
5281
+ */
5282
+ fallbackText?: string;
5283
+ };
5233
5284
 
5234
5285
  export declare enum LaunchType {
5235
5286
  /**
@@ -7189,7 +7240,7 @@ export declare const SubmitFormAction: {
7189
7240
  /**
7190
7241
  * @deprecated Use {@link Action.SunmitForm.Props} instead.
7191
7242
  */
7192
- export declare interface SubmitFormActionProps<T> extends Action.SubmitForm.Props<T> {
7243
+ export declare interface SubmitFormActionProps<T extends Form.Values> extends Action.SubmitForm.Props<T> {
7193
7244
  }
7194
7245
 
7195
7246
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.44.0",
3
+ "version": "1.45.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",
package/types/index.d.ts CHANGED
@@ -550,13 +550,8 @@ declare interface Arguments {
550
550
  [item: string]: any;
551
551
  }
552
552
 
553
- /**
554
- * An interface describing top-level props for arguments
555
- */
553
+ /** @deprecated Use {@Link LaunchProps} directly */
556
554
  export declare interface ArgumentsLaunchProps {
557
- /**
558
- * Use these values to populate the initial state for your command.
559
- */
560
555
  arguments?: Arguments;
561
556
  }
562
557
 
@@ -857,7 +852,6 @@ export declare function closeMainWindow(options?: {
857
852
  * <List>
858
853
  * <List.Item title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
859
854
  * <List.Item title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
860
- * <List.Item title="Brown" icon={{ source: Icon.Circle, tintColor: Color.Brown }} />
861
855
  * <List.Item title="Magenta" icon={{ source: Icon.Circle, tintColor: Color.Magenta }} />
862
856
  * <List.Item title="Orange" icon={{ source: Icon.Circle, tintColor: Color.Orange }} />
863
857
  * <List.Item title="Purple" icon={{ source: Icon.Circle, tintColor: Color.Purple }} />
@@ -872,7 +866,6 @@ export declare function closeMainWindow(options?: {
872
866
  */
873
867
  export declare enum Color {
874
868
  Blue = "raycast-blue",
875
- Brown = "raycast-brown",
876
869
  Green = "raycast-green",
877
870
  Magenta = "raycast-magenta",
878
871
  Orange = "raycast-orange",
@@ -957,6 +950,12 @@ export declare namespace Color {
957
950
  * - Keywords, e.g. `red`
958
951
  */
959
952
  export type Raw = string;
953
+ /** The standard colors. Use those colors for consistency.
954
+ *
955
+ * @remarks
956
+ * The colors automatically adapt to the Raycast theme (light or dark).
957
+ */
958
+ const Brown: Color.Dynamic;
960
959
  }
961
960
 
962
961
  /**
@@ -1887,6 +1886,12 @@ declare interface DropdownMembers_2 {
1887
1886
  * See {@link Form.Dropdown.Props}
1888
1887
  */
1889
1888
  declare interface DropdownProps extends FormItemProps_2<string>, SearchBarInterface {
1889
+ /**
1890
+ * Placeholder text that will be shown in the dropdown search field.
1891
+ *
1892
+ * @defaultValue `"Search..."`
1893
+ */
1894
+ placeholder?: string;
1890
1895
  /**
1891
1896
  * Sections or items. If {@link Form.Dropdown.Item} elements are specified, a default section is automatically created.
1892
1897
  */
@@ -2049,7 +2054,7 @@ export declare interface Environment {
2049
2054
  */
2050
2055
  launchType: LaunchType;
2051
2056
  /**
2052
- * Any custom context values passed from a programmatic command launch via `launchCommand`.
2057
+ * @deprecated Use the top-level prop `launchContext` instead.
2053
2058
  */
2054
2059
  launchContext?: LaunchContext;
2055
2060
  }
@@ -3060,14 +3065,8 @@ declare interface FormItemRef {
3060
3065
  reset: () => void;
3061
3066
  }
3062
3067
 
3063
- /**
3064
- * An interface describing top-level props for Form drafts
3065
- */
3068
+ /** @deprecated Use {@Link LaunchProps} directly */
3066
3069
  export declare interface FormLaunchProps {
3067
- /**
3068
- * When a user enters the command via a draft, this object will contain the user inputs that were saved as a draft.
3069
- * Use its values to populate the initial state for your Form.
3070
- */
3071
3070
  draftValues?: Form.Values;
3072
3071
  }
3073
3072
 
@@ -3760,7 +3759,7 @@ export declare function getApplications(path?: PathLike): Promise<Application[]>
3760
3759
  * Returns the default application that the file would be opened with.
3761
3760
  *
3762
3761
  * @param path - The path of the file or folder to get the default application for.
3763
- * @returns The default {@link Application} that would open the file. Throws an error if no application was found.
3762
+ * @returns A Promise that resolves with the default {@link Application} that would open the file. If no application was found, the promise will be rejected.
3764
3763
  *
3765
3764
  * @example
3766
3765
  * ```typescript
@@ -3777,7 +3776,7 @@ export declare function getDefaultApplication(path: PathLike): Promise<Applicati
3777
3776
  /**
3778
3777
  * Returns the frontmost application.
3779
3778
  *
3780
- * @returns The frontmost {@link Application}. Throws an error if no application was found.
3779
+ * @returns A Promise that resolves with the frontmost {@link Application}. If no application was found, the promise will be rejected.
3781
3780
  *
3782
3781
  * @example
3783
3782
  * ```typescript
@@ -3825,8 +3824,7 @@ export declare function getPreferenceValues<Values extends PreferenceValues = Pr
3825
3824
  /**
3826
3825
  * Gets the selected items from Finder.
3827
3826
  *
3828
- * @throws An error when Finder is not the frontmost application.
3829
- * @returns A Promise that resolves with the selected file system items.
3827
+ * @returns A Promise that resolves with the selected file system items. If Finder is not the frontmost application, the promise will be rejected.
3830
3828
  *
3831
3829
  * @example
3832
3830
  * ```typescript
@@ -3853,8 +3851,7 @@ export declare function getSelectedFinderItems(): Promise<FileSystemItem[]>;
3853
3851
  /**
3854
3852
  * Gets the selected text of the frontmost application.
3855
3853
  *
3856
- * @throws An error when no text is selected in the frontmost application.
3857
- * @returns A Promise that resolves with the selected text.
3854
+ * @returns A Promise that resolves with the selected text. If no text is selected in the frontmost application, the promise will be rejected.
3858
3855
  *
3859
3856
  * @example
3860
3857
  * ```typescript
@@ -4886,14 +4883,34 @@ declare const Item_3: FunctionComponent<ItemProps_3>;
4886
4883
 
4887
4884
  declare type ItemAccessory = ({
4888
4885
  /**
4889
- * An optional text that will be used as the label.
4886
+ * An optional text that will be used as the label, optionally colored.
4887
+ * Color changes the text color to the provided color.
4888
+ * Defaults to {@link Color.SecondaryText}.
4890
4889
  */
4891
- text?: string | undefined | null;
4890
+ text?: string | undefined | null | {
4891
+ value: string | undefined | null;
4892
+ color?: Color;
4893
+ };
4894
+ } | {
4895
+ /**
4896
+ * An optional Date that will be used as the label, optionally colored. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.).
4897
+ * Color changes the text color to the provided color.
4898
+ * Defaults to {@link Color.SecondaryText}.
4899
+ */
4900
+ date?: Date | undefined | null | {
4901
+ value: Date | undefined | null;
4902
+ color?: Color;
4903
+ };
4892
4904
  } | {
4893
4905
  /**
4894
- * An optional Date that will be used as the label. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.).
4906
+ * A string or Date that will be used as the label, optionally colored. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.).
4907
+ * Color changes the text color to the provided color and sets a transparent background with the same color.
4908
+ * Defaults to {@link Color.SecondaryText}.
4895
4909
  */
4896
- date?: Date | undefined | null;
4910
+ tag: string | Date | undefined | null | {
4911
+ value: string | Date | undefined | null;
4912
+ color?: Color;
4913
+ };
4897
4914
  }) & {
4898
4915
  /**
4899
4916
  * An optional {@link Image.ImageLike} that will be used as the icon.
@@ -4970,14 +4987,14 @@ declare interface ItemProps extends ActionsInterface {
4970
4987
  */
4971
4988
  title: string | {
4972
4989
  value: string;
4973
- tooltip: string;
4990
+ tooltip?: string | null;
4974
4991
  };
4975
4992
  /**
4976
4993
  * An optional subtitle displayed next to the main title, optionally with a tooltip.
4977
4994
  */
4978
4995
  subtitle?: string | {
4979
- value: string | undefined | null;
4980
- tooltip: string;
4996
+ value?: string | null;
4997
+ tooltip?: string | null;
4981
4998
  };
4982
4999
  /**
4983
5000
  * An optional property used for providing additional indexable strings for search.
@@ -5075,7 +5092,7 @@ declare interface ItemProps_3 {
5075
5092
  */
5076
5093
  title: string;
5077
5094
  /**
5078
- * The subtitle displayed for this item in a slightly dimmed text color.
5095
+ * The subtitle displayed for this item.
5079
5096
  */
5080
5097
  subtitle?: string;
5081
5098
  /**
@@ -5187,8 +5204,12 @@ declare interface LabelProps {
5187
5204
  icon?: Image.ImageLike | undefined | null;
5188
5205
  /**
5189
5206
  * The text value of the item.
5207
+ * Specifying `color` will display the text in the provided color. Defaults to {@link Color.SecondaryText}.
5190
5208
  */
5191
- text?: string;
5209
+ text?: string | {
5210
+ value: string;
5211
+ color?: Color | null;
5212
+ };
5192
5213
  }
5193
5214
 
5194
5215
  /**
@@ -5229,7 +5250,37 @@ declare interface LaunchContext {
5229
5250
  /**
5230
5251
  * The top-level props that a Command receives on launch
5231
5252
  */
5232
- export declare type LaunchProps = ArgumentsLaunchProps | FormLaunchProps;
5253
+ export declare type LaunchProps<T extends {
5254
+ arguments?: Arguments;
5255
+ draftValues?: Form.Values;
5256
+ launchContext?: LaunchContext;
5257
+ } = {
5258
+ arguments: Arguments;
5259
+ draftValues: Form.Values;
5260
+ launchContext?: LaunchContext;
5261
+ }> = {
5262
+ /**
5263
+ * The type of launch for the command (user initiated or background).
5264
+ */
5265
+ launchType: LaunchType;
5266
+ /**
5267
+ * Use these values to populate the initial state for your command.
5268
+ */
5269
+ arguments: T["arguments"];
5270
+ /**
5271
+ * When a user enters the command via a draft, this object will contain the user inputs that were saved as a draft.
5272
+ * Use its values to populate the initial state for your Form.
5273
+ */
5274
+ draftValues?: T["draftValues"];
5275
+ /**
5276
+ * When the command is launched programmatically via `launchCommand`, this object contains the value passed to `context`.
5277
+ */
5278
+ launchContext?: T["launchContext"];
5279
+ /**
5280
+ * When the command is launched as a fallback command, this string contains the text of the root search.
5281
+ */
5282
+ fallbackText?: string;
5283
+ };
5233
5284
 
5234
5285
  export declare enum LaunchType {
5235
5286
  /**
@@ -7189,7 +7240,7 @@ export declare const SubmitFormAction: {
7189
7240
  /**
7190
7241
  * @deprecated Use {@link Action.SunmitForm.Props} instead.
7191
7242
  */
7192
- export declare interface SubmitFormActionProps<T> extends Action.SubmitForm.Props<T> {
7243
+ export declare interface SubmitFormActionProps<T extends Form.Values> extends Action.SubmitForm.Props<T> {
7193
7244
  }
7194
7245
 
7195
7246
  /**