@types/chrome 0.0.316 → 0.0.318

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. chrome/README.md +1 -1
  2. chrome/index.d.ts +98 -73
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 22 Apr 2025 15:36:51 GMT
11
+ * Last updated: Thu, 01 May 2025 18:02:33 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -12226,131 +12226,111 @@ declare namespace chrome {
12226
12226
  */
12227
12227
  export namespace tabGroups {
12228
12228
  /** An ID that represents the absence of a group. */
12229
- export var TAB_GROUP_ID_NONE: -1;
12229
+ export const TAB_GROUP_ID_NONE: -1;
12230
12230
 
12231
- export type ColorEnum = "grey" | "blue" | "red" | "yellow" | "green" | "pink" | "purple" | "cyan" | "orange";
12231
+ /** The group's color. */
12232
+ export enum Color {
12233
+ BLUE = "blue",
12234
+ CYAN = "cyan",
12235
+ GREEN = "green",
12236
+ GREY = "grey",
12237
+ ORANGE = "orange",
12238
+ PINK = "pink",
12239
+ PURPLE = "purple",
12240
+ RED = "red",
12241
+ YELLOW = "yellow",
12242
+ }
12232
12243
 
12233
12244
  export interface TabGroup {
12234
12245
  /** Whether the group is collapsed. A collapsed group is one whose tabs are hidden. */
12235
12246
  collapsed: boolean;
12236
12247
  /** The group's color. */
12237
- color: ColorEnum;
12248
+ color: `${Color}`;
12238
12249
  /** The ID of the group. Group IDs are unique within a browser session. */
12239
12250
  id: number;
12240
- /** Optional. The title of the group. */
12241
- title?: string | undefined;
12251
+ /** The title of the group. */
12252
+ title?: string;
12242
12253
  /** The ID of the window that contains the group. */
12243
12254
  windowId: number;
12244
12255
  }
12245
12256
 
12246
12257
  export interface MoveProperties {
12247
- /** The position to move the group to. Use -1 to place the group at the end of the window. */
12258
+ /** The position to move the group to. Use `-1` to place the group at the end of the window. */
12248
12259
  index: number;
12249
- /** Optional. The window to move the group to. Defaults to the window the group is currently in. Note that groups can only be moved to and from windows with chrome.windows.WindowType type "normal". */
12250
- windowId?: number | undefined;
12260
+ /** The window to move the group to. Defaults to the window the group is currently in. Note that groups can only be moved to and from windows with {@link windows.windowTypeEnum windows.windowType} type `"normal"`. */
12261
+ windowId?: number;
12251
12262
  }
12252
12263
 
12253
12264
  export interface QueryInfo {
12254
- /** Optional. Whether the groups are collapsed. */
12255
- collapsed?: boolean | undefined;
12256
- /** Optional. The color of the groups. */
12257
- color?: ColorEnum | undefined;
12258
- /** Optional. Match group titles against a pattern. */
12259
- title?: string | undefined;
12260
- /** Optional. The ID of the window that contains the group. */
12261
- windowId?: number | undefined;
12265
+ /** Whether the groups are collapsed. */
12266
+ collapsed?: boolean;
12267
+ /** The color of the groups. */
12268
+ color?: `${Color}`;
12269
+ /** Match group titles against a pattern. */
12270
+ title?: string;
12271
+ /** The ID of the parent window, or {@link windows.WINDOW_ID_CURRENT} for the current window. */
12272
+ windowId?: number;
12262
12273
  }
12263
12274
 
12264
12275
  export interface UpdateProperties {
12265
- /** Optional. Whether the group should be collapsed. */
12266
- collapsed?: boolean | undefined;
12267
- /** Optional. The color of the group. */
12268
- color?: ColorEnum | undefined;
12269
- /** Optional. The title of the group. */
12270
- title?: string | undefined;
12276
+ /** Whether the group should be collapsed. */
12277
+ collapsed?: boolean;
12278
+ /** The color of the group. */
12279
+ color?: `${Color}`;
12280
+ /** The title of the group. */
12281
+ title?: string;
12271
12282
  }
12272
12283
 
12273
12284
  /**
12274
12285
  * Retrieves details about the specified group.
12275
- * @param groupId The ID of the tab group.
12276
- * @param callback Called with the retrieved tab group.
12277
- */
12278
- export function get(groupId: number, callback: (group: TabGroup) => void): void;
12279
-
12280
- /**
12281
- * Retrieves details about the specified group.
12282
- * @param groupId The ID of the tab group.
12283
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
12286
+ *
12287
+ * Can return its result via Promise since Chrome 90.
12284
12288
  */
12285
12289
  export function get(groupId: number): Promise<TabGroup>;
12290
+ export function get(groupId: number, callback: (group: TabGroup) => void): void;
12286
12291
 
12287
12292
  /**
12288
12293
  * Moves the group and all its tabs within its window, or to a new window.
12289
12294
  * @param groupId The ID of the group to move.
12290
- * @param moveProperties Information on how to move the group.
12291
- * @return The `move` method provides its result via callback or returned as a `Promise` (MV3 only).
12292
- */
12293
- export function move(groupId: number, moveProperties: MoveProperties): Promise<TabGroup>;
12294
-
12295
- /**
12296
- * Moves the group and all its tabs within its window, or to a new window.
12297
- * @param groupId The ID of the group to move.
12298
- * @param moveProperties Information on how to move the group.
12299
- * @param callback Optional.
12295
+ *
12296
+ * Can return its result via Promise since Chrome 90.
12300
12297
  */
12298
+ export function move(groupId: number, moveProperties: MoveProperties): Promise<TabGroup | undefined>;
12301
12299
  export function move(
12302
12300
  groupId: number,
12303
12301
  moveProperties: MoveProperties,
12304
- callback: (group: TabGroup) => void,
12302
+ callback: (group?: TabGroup) => void,
12305
12303
  ): void;
12306
12304
 
12307
12305
  /**
12308
12306
  * Gets all groups that have the specified properties, or all groups if no properties are specified.
12309
- * @param queryInfo Object with search parameters.
12310
- * @param callback Called with retrieved tab groups.
12311
- */
12312
- export function query(queryInfo: QueryInfo, callback: (result: TabGroup[]) => void): void;
12313
-
12314
- /**
12315
- * Gets all groups that have the specified properties, or all groups if no properties are specified.
12316
- * @param queryInfo Object with search parameters.
12317
- * @return The `query` method provides its result via callback or returned as a `Promise` (MV3 only).
12307
+ *
12308
+ * Can return its result via Promise since Chrome 90.
12318
12309
  */
12319
12310
  export function query(queryInfo: QueryInfo): Promise<TabGroup[]>;
12311
+ export function query(queryInfo: QueryInfo, callback: (result: TabGroup[]) => void): void;
12320
12312
 
12321
12313
  /**
12322
- * Modifies the properties of a group. Properties that are not specified in updateProperties are not modified.
12323
- * @param groupId The ID of the group to modify.
12324
- * @param updateProperties Information on how to update the group.
12325
- * @return The `update` method provides its result via callback or returned as a `Promise` (MV3 only).
12326
- */
12327
- export function update(groupId: number, updateProperties: UpdateProperties): Promise<TabGroup>;
12328
-
12329
- /**
12330
- * Modifies the properties of a group. Properties that are not specified in updateProperties are not modified.
12314
+ * Modifies the properties of a group. Properties that are not specified in `updateProperties` are not modified.
12331
12315
  * @param groupId The ID of the group to modify.
12332
- * @param updateProperties Information on how to update the group.
12333
- * @param callback Optional.
12316
+ *
12317
+ * Can return its result via Promise since Chrome 90.
12334
12318
  */
12319
+ export function update(groupId: number, updateProperties: UpdateProperties): Promise<TabGroup | undefined>;
12335
12320
  export function update(
12336
12321
  groupId: number,
12337
12322
  updateProperties: UpdateProperties,
12338
- callback: (group: TabGroup) => void,
12323
+ callback: (group?: TabGroup) => void,
12339
12324
  ): void;
12340
12325
 
12341
- export interface TabGroupCreatedEvent extends chrome.events.Event<(group: TabGroup) => void> {}
12342
- export interface TabGroupMovedEvent extends chrome.events.Event<(group: TabGroup) => void> {}
12343
- export interface TabGroupRemovedEvent extends chrome.events.Event<(group: TabGroup) => void> {}
12344
- export interface TabGroupUpdated extends chrome.events.Event<(group: TabGroup) => void> {}
12345
-
12346
12326
  /** Fired when a group is created. */
12347
- export var onCreated: TabGroupCreatedEvent;
12327
+ export const onCreated: events.Event<(group: TabGroup) => void>;
12348
12328
  /** Fired when a group is moved within a window. Move events are still fired for the individual tabs within the group, as well as for the group itself. This event is not fired when a group is moved between windows; instead, it will be removed from one window and created in another. */
12349
- export var onMoved: TabGroupMovedEvent;
12350
- /** Fired when a group is closed, either directly by the user or automatically because it contained zero. */
12351
- export var onRemoved: TabGroupRemovedEvent;
12329
+ export const onMoved: events.Event<(group: TabGroup) => void>;
12330
+ /** Fired when a group is closed, either directly by the user or automatically because it contained zero tabs. */
12331
+ export const onRemoved: events.Event<(group: TabGroup) => void>;
12352
12332
  /** Fired when a group is updated. */
12353
- export var onUpdated: TabGroupUpdated;
12333
+ export const onUpdated: events.Event<(group: TabGroup) => void>;
12354
12334
  }
12355
12335
 
12356
12336
  ////////////////////
@@ -14860,6 +14840,18 @@ declare namespace chrome {
14860
14840
  */
14861
14841
  export type ExecutionWorld = "MAIN" | "USER_SCRIPT";
14862
14842
 
14843
+ /** @since Chrome 135 */
14844
+ export interface InjectionResult {
14845
+ /** The document associated with the injection. */
14846
+ documentId: string;
14847
+ /** The error, if any. `error` and `result` are mutually exclusive. */
14848
+ error?: string;
14849
+ /** The frame associated with the injection. */
14850
+ frameId: number;
14851
+ /** The result of the script execution. */
14852
+ result: any;
14853
+ }
14854
+
14863
14855
  export interface WorldProperties {
14864
14856
  /** Specifies the world csp. The default is the `ISOLATED` world csp. */
14865
14857
  csp?: string;
@@ -14876,6 +14868,18 @@ declare namespace chrome {
14876
14868
  ids?: string[];
14877
14869
  }
14878
14870
 
14871
+ /** @since Chrome 135 */
14872
+ export interface InjectionTarget {
14873
+ /** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified. */
14874
+ allFrames?: boolean;
14875
+ /** The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set. */
14876
+ documentIds?: string[];
14877
+ /** The IDs of specific frames to inject into. */
14878
+ frameIds?: number[];
14879
+ /** The ID of the tab into which to inject. */
14880
+ tabId: number;
14881
+ }
14882
+
14879
14883
  export interface RegisteredUserScript {
14880
14884
  /** If true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
14881
14885
  allFrames?: boolean;
@@ -14902,6 +14906,20 @@ declare namespace chrome {
14902
14906
  worldId?: string;
14903
14907
  }
14904
14908
 
14909
+ /** @since Chrome 135 */
14910
+ export interface UserScriptInjection {
14911
+ /** Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. */
14912
+ injectImmediately?: boolean;
14913
+ /** The list of ScriptSource objects defining sources of scripts to be injected into the target. */
14914
+ js: ScriptSource[];
14915
+ /** Details specifying the target into which to inject the script. */
14916
+ target: InjectionTarget;
14917
+ /** The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. */
14918
+ world?: ExecutionWorld;
14919
+ /** Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved. */
14920
+ worldId?: string;
14921
+ }
14922
+
14905
14923
  /**
14906
14924
  * Properties for a script source.
14907
14925
  */
@@ -14954,6 +14972,13 @@ declare namespace chrome {
14954
14972
  export function getWorldConfigurations(): Promise<WorldProperties[]>;
14955
14973
  export function getWorldConfigurations(callback: (worlds: WorldProperties[]) => void): void;
14956
14974
 
14975
+ /**
14976
+ * Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
14977
+ * @since Chrome 135
14978
+ */
14979
+ export function execute(injection: UserScriptInjection): Promise<InjectionResult[]>;
14980
+ export function execute(injection: UserScriptInjection, callback: (result: InjectionResult[]) => void): void;
14981
+
14957
14982
  /**
14958
14983
  * Registers one or more user scripts for this extension.
14959
14984
  *
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.316",
3
+ "version": "0.0.318",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "ef2848ec857a2961c7b3f4fac265c8c66f7f87ed4ee074e89fa66558db476a76",
97
+ "typesPublisherContentHash": "39dd572dde0a000c6672487393ec0207178f22f69917ac341a5a2843835d7130",
98
98
  "typeScriptVersion": "5.1"
99
99
  }