@raycast/api 1.46.1 → 1.47.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/api.d.ts CHANGED
@@ -770,6 +770,24 @@ export declare namespace Clipboard {
770
770
  * ```
771
771
  */
772
772
  export function paste(content: string | number | Content): Promise<void>;
773
+ /**
774
+ * Reads the clipboard content as plain text, file name, or HTML.
775
+ *
776
+ * @returns A Promise that resolves when the clipboard content was read.
777
+ *
778
+ * @example
779
+ * ```typescript
780
+ * import { Clipboard } from "@raycast/api";
781
+ *
782
+ * export default async () => {
783
+ * const { text, file, html } = await Clipboard.read();
784
+ * console.log(text);
785
+ * console.log(file);
786
+ * console.log(html);
787
+ * };
788
+ * ```
789
+ */
790
+ export function read(): Promise<ReadContent>;
773
791
  /**
774
792
  * Reads the clipboard as plain text.
775
793
  *
@@ -786,6 +804,25 @@ export declare namespace Clipboard {
786
804
  * ```
787
805
  */
788
806
  export function readText(): Promise<string | undefined>;
807
+ /**
808
+ * Type of the content read from the {@link Clipboard}.
809
+ *
810
+ * @example
811
+ * ```typescript
812
+ * import { Clipboard } from "@raycast/api";
813
+ *
814
+ * const content: Clipboard.ReadContent = {
815
+ * text: "filename.pdf",
816
+ * file: "/path/to/filename.pdf",
817
+ * html: "<a href='/path/to/filename.pdf'>filename.pdf</p>",
818
+ * }
819
+ * ```
820
+ */
821
+ export type ReadContent = {
822
+ text: string;
823
+ file?: string;
824
+ html?: string;
825
+ };
789
826
  /**
790
827
  * Type of the content copied and pasted to and from the {@link Clipboard}.
791
828
  *
@@ -4944,7 +4981,7 @@ declare type ItemAccessory = ({
4944
4981
  */
4945
4982
  tag: string | Date | undefined | null | {
4946
4983
  value: string | Date | undefined | null;
4947
- color?: Color;
4984
+ color?: Color.ColorLike;
4948
4985
  };
4949
4986
  }) & {
4950
4987
  /**
@@ -5248,7 +5285,7 @@ declare interface LabelProps {
5248
5285
  }
5249
5286
 
5250
5287
  /**
5251
- * Launches another command of the same extension.
5288
+ * Launches another command of the same extension. If the command does not exist, or if it's not enabled, an error will be thrown.
5252
5289
  * Use this method if your command needs to open another command based on user interaction,
5253
5290
  * or when an immediate background refresh should be triggered, for example when a command needs to update an associated menu-bar command.
5254
5291
  *
@@ -5259,6 +5296,8 @@ declare interface LabelProps {
5259
5296
  * `context`: arbitrary object for custom data that should be passed to the command and accessible as `environment.launchContext`; the object must be JSON serializable (Dates and Buffers supported)
5260
5297
  * @returns A Promise that resolves when the command has been launched. (Note that this does not indicate that the launched command has finished executing.)
5261
5298
  *
5299
+ * @throws {@link Error} if the command does not exist or is not enabled.
5300
+ *
5262
5301
  * @example
5263
5302
  * ```typescript
5264
5303
  * import { launchCommand, LaunchType } from "@raycast/api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.46.1",
3
+ "version": "1.47.0",
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
@@ -766,6 +766,24 @@ export declare namespace Clipboard {
766
766
  * ```
767
767
  */
768
768
  export function paste(content: string | number | Content): Promise<void>;
769
+ /**
770
+ * Reads the clipboard content as plain text, file name, or HTML.
771
+ *
772
+ * @returns A Promise that resolves when the clipboard content was read.
773
+ *
774
+ * @example
775
+ * ```typescript
776
+ * import { Clipboard } from "@raycast/api";
777
+ *
778
+ * export default async () => {
779
+ * const { text, file, html } = await Clipboard.read();
780
+ * console.log(text);
781
+ * console.log(file);
782
+ * console.log(html);
783
+ * };
784
+ * ```
785
+ */
786
+ export function read(): Promise<ReadContent>;
769
787
  /**
770
788
  * Reads the clipboard as plain text.
771
789
  *
@@ -782,6 +800,25 @@ export declare namespace Clipboard {
782
800
  * ```
783
801
  */
784
802
  export function readText(): Promise<string | undefined>;
803
+ /**
804
+ * Type of the content read from the {@link Clipboard}.
805
+ *
806
+ * @example
807
+ * ```typescript
808
+ * import { Clipboard } from "@raycast/api";
809
+ *
810
+ * const content: Clipboard.ReadContent = {
811
+ * text: "filename.pdf",
812
+ * file: "/path/to/filename.pdf",
813
+ * html: "<a href='/path/to/filename.pdf'>filename.pdf</p>",
814
+ * }
815
+ * ```
816
+ */
817
+ export type ReadContent = {
818
+ text: string;
819
+ file?: string;
820
+ html?: string;
821
+ };
785
822
  /**
786
823
  * Type of the content copied and pasted to and from the {@link Clipboard}.
787
824
  *
@@ -4940,7 +4977,7 @@ declare type ItemAccessory = ({
4940
4977
  */
4941
4978
  tag: string | Date | undefined | null | {
4942
4979
  value: string | Date | undefined | null;
4943
- color?: Color;
4980
+ color?: Color.ColorLike;
4944
4981
  };
4945
4982
  }) & {
4946
4983
  /**
@@ -5244,7 +5281,7 @@ declare interface LabelProps {
5244
5281
  }
5245
5282
 
5246
5283
  /**
5247
- * Launches another command of the same extension.
5284
+ * Launches another command of the same extension. If the command does not exist, or if it's not enabled, an error will be thrown.
5248
5285
  * Use this method if your command needs to open another command based on user interaction,
5249
5286
  * or when an immediate background refresh should be triggered, for example when a command needs to update an associated menu-bar command.
5250
5287
  *
@@ -5255,6 +5292,8 @@ declare interface LabelProps {
5255
5292
  * `context`: arbitrary object for custom data that should be passed to the command and accessible as `environment.launchContext`; the object must be JSON serializable (Dates and Buffers supported)
5256
5293
  * @returns A Promise that resolves when the command has been launched. (Note that this does not indicate that the launched command has finished executing.)
5257
5294
  *
5295
+ * @throws {@link Error} if the command does not exist or is not enabled.
5296
+ *
5258
5297
  * @example
5259
5298
  * ```typescript
5260
5299
  * import { launchCommand, LaunchType } from "@raycast/api";