@raycast/api 1.77.3 → 1.78.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 (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +129 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.77.3",
3
+ "version": "1.78.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
@@ -2381,6 +2381,10 @@ export declare interface Environment {
2381
2381
  * The version of the main Raycast app
2382
2382
  */
2383
2383
  raycastVersion: string;
2384
+ /**
2385
+ * The name of the extension owner (if any) or author, as specified in package.json
2386
+ */
2387
+ ownerOrAuthorName: string;
2384
2388
  /**
2385
2389
  * The name of the extension, as specified in package.json
2386
2390
  */
@@ -2462,7 +2466,6 @@ export declare interface Environment {
2462
2466
  * console.log(`Is development mode: ${environment.isDevelopment}`);
2463
2467
  * console.log(`Raycast appearance: ${environment.appearance}`);
2464
2468
  * console.log(`Raycast launchType: ${environment.launchType}`);
2465
- * console.log(`Raycast launchContext: ${environment.launchContext}`);
2466
2469
  * ```
2467
2470
  */
2468
2471
  export declare const environment: Environment;
@@ -5372,7 +5375,7 @@ declare type InterExtensionLaunchOptions = {
5372
5375
  type: LaunchType;
5373
5376
  /** Optional object for the argument properties and values as defined in the extension's manifest, for example: `{ "argument1": "value1" }` */
5374
5377
  arguments?: Arguments | null;
5375
- /** 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) */
5378
+ /** Arbitrary object for custom data that should be passed to the command and accessible as {@link LaunchProps}; the object must be JSON serializable (Dates and Buffers supported) */
5376
5379
  context?: LaunchContext | null;
5377
5380
  /** Optional string to send as fallback text to the command */
5378
5381
  fallbackText?: string | null;
@@ -5388,7 +5391,7 @@ declare type IntraExtensionLaunchOptions = {
5388
5391
  type: LaunchType;
5389
5392
  /** Optional object for the argument properties and values as defined in the extension's manifest, for example: `{ "argument1": "value1" }` */
5390
5393
  arguments?: Arguments | null;
5391
- /** 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) */
5394
+ /** Arbitrary object for custom data that should be passed to the command and accessible as {@link LaunchProps}; the object must be JSON serializable (Dates and Buffers supported) */
5392
5395
  context?: LaunchContext | null;
5393
5396
  /** Optional string to send as fallback text to the command */
5394
5397
  fallbackText?: string | null;
@@ -7217,7 +7220,7 @@ declare interface LabelProps {
7217
7220
  * Called when the user scrolls to the bottom of the view and there are more items to load.
7218
7221
  * When this is called, the command should update the list of items to include the next page.
7219
7222
  */
7220
- onLoadMore: (page: number) => void;
7223
+ onLoadMore: () => void;
7221
7224
  };
7222
7225
  }
7223
7226
 
@@ -8554,4 +8557,126 @@ declare interface LabelProps {
8554
8557
  /** @deprecated Use `useAI` from `@raycast/utils` */
8555
8558
  export declare const useUnstableAI: () => any;
8556
8559
 
8560
+ export declare namespace WindowManagement {
8561
+ /**
8562
+ * The type of a {@link Desktop}.
8563
+ */
8564
+ export enum DesktopType {
8565
+ /** The default Desktop type. It can contain any number of {@link Window} */
8566
+ User = "User",
8567
+ /** A Desktop made of a single fullscreen window */
8568
+ FullScreen = "FullScreen"
8569
+ }
8570
+ /**
8571
+ * A Window from an {@link Application} on a {@link Desktop}.
8572
+ */
8573
+ export type Window = {
8574
+ id: string;
8575
+ application?: Application;
8576
+ bounds: {
8577
+ position: {
8578
+ x: number;
8579
+ y: number;
8580
+ };
8581
+ size: {
8582
+ width: number;
8583
+ height: number;
8584
+ };
8585
+ } | "fullscreen";
8586
+ desktopId: string;
8587
+ fullScreenSettable: boolean;
8588
+ resizable: boolean;
8589
+ positionable: boolean;
8590
+ active: boolean;
8591
+ };
8592
+ /**
8593
+ * A Desktop represents a virtual desktop on a Screen.
8594
+ */
8595
+ export type Desktop = {
8596
+ size: {
8597
+ width: number;
8598
+ height: number;
8599
+ };
8600
+ id: string;
8601
+ screenId: string;
8602
+ active: boolean;
8603
+ type: DesktopType;
8604
+ };
8605
+ /**
8606
+ * Gets the list of {@link Desktop}s available across all screens.
8607
+ *
8608
+ * @returns A Promise that resolves with the desktops.
8609
+ *
8610
+ * @example
8611
+ * ```typescript
8612
+ * import { getDesktops, showToast } from "@raycast/api";
8613
+ *
8614
+ * export default async function Command() {
8615
+ * const desktops = await getDesktops();
8616
+ * const screens = Set(desktops.map((desktop) => desktop.screenId));
8617
+ * showToast({title: `Found ${desktops.length} desktops on ${screens.size} screens.`});
8618
+ * }
8619
+ * ```
8620
+ */
8621
+ export function getDesktops(): Promise<Desktop[]>;
8622
+
8623
+ /**
8624
+ * Gets the list of {@link Window}s on the active {@link Desktop}.
8625
+ *
8626
+ * @returns A Promise that resolves with an array of Windows.
8627
+ *
8628
+ * @example
8629
+ * ```typescript
8630
+ * import { getWindowsOnActiveDesktop, setWindowBounds, showToast } from "@raycast/api";
8631
+ *
8632
+ * export default async function Command() {
8633
+ * const windows = await getWindowsOnActiveDesktop();
8634
+ * const chrome = windows.find((x) => x.application?.bundleId === "com.google.Chrome");
8635
+ * if (!chrome) {
8636
+ * showToast({ title: "Couldn't find chrome", style: Toast.Style.Failure });
8637
+ * return;
8638
+ * }
8639
+ * setWindowBounds({ id: chrome.id, bounds: { position: { x: 100 } } })
8640
+ * }
8641
+ * ```
8642
+ */
8643
+ export function getWindowsOnActiveDesktop(): Promise<Window[]>;
8644
+ /**
8645
+ * Move a {@link Window} or make it fullscreen.
8646
+ *
8647
+ * @returns A Promise that resolves with the window was moved. If the move isn't possible (for example trying to make a window fullscreen that doesn't support it), the promise will be rejected.
8648
+ *
8649
+ * @example
8650
+ * ```typescript
8651
+ * import { getActiveWindow, setWindowBounds, showToast } from "@raycast/api";
8652
+ *
8653
+ * export default async function Command() {
8654
+ * try {
8655
+ * const window = await getActiveWindow();
8656
+ * setWindowBounds({ id: window.id, bounds: { position: { x: 100 } } })
8657
+ * } catch (error) {
8658
+ * showToast({ title: "Could not move window", message: error.message, style: Toast.Style.Failure });
8659
+ * }
8660
+ * }
8661
+ * ```
8662
+ */
8663
+ export function setWindowBounds(options: {
8664
+ id: string;
8665
+ } & ({
8666
+ bounds: {
8667
+ position?: {
8668
+ x?: number;
8669
+ y?: number;
8670
+ };
8671
+ size?: {
8672
+ width?: number;
8673
+ height?: number;
8674
+ };
8675
+ };
8676
+ desktopId?: string;
8677
+ } | {
8678
+ bounds: "fullscreen";
8679
+ })): Promise<void>;
8680
+ }
8681
+
8557
8682
  export { }