@types/chrome 0.1.17 → 0.1.18

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 +275 -230
  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: Wed, 01 Oct 2025 18:39:47 GMT
11
+ * Last updated: Thu, 02 Oct 2025 06:39:55 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
@@ -6276,96 +6276,86 @@ declare namespace chrome {
6276
6276
  * @platform ChromeOS only
6277
6277
  */
6278
6278
  export namespace input.ime {
6279
- /** See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent */
6279
+ /** See https://www.w3.org/TR/uievents/#events-KeyboardEvent */
6280
6280
  export interface KeyboardEvent {
6281
- /**
6282
- * Optional.
6283
- * Whether or not the SHIFT key is pressed.
6284
- */
6281
+ /** Whether or not the SHIFT key is pressed. */
6285
6282
  shiftKey?: boolean | undefined;
6286
- /**
6287
- * Optional.
6288
- * Whether or not the ALT key is pressed.
6289
- */
6283
+ /** Whether or not the ALT key is pressed. */
6290
6284
  altKey?: boolean | undefined;
6291
6285
  /**
6292
- * Optional.
6293
6286
  * Whether or not the ALTGR key is pressed.
6294
6287
  * @since Chrome 79
6295
6288
  */
6296
6289
  altgrKey?: boolean | undefined;
6297
6290
  /**
6298
- * Optional.
6299
- * The ID of the request. Use the requestId param from the onKeyEvent event instead.
6300
- * @deprecated since Chrome 79.
6291
+ * The ID of the request
6292
+ * @deprecated Use the `requestId` param from the `onKeyEvent` event instead.
6301
6293
  */
6302
6294
  requestId?: string | undefined;
6303
- /** Value of the key being pressed */
6295
+ /** Value of the key being pressed. */
6304
6296
  key: string;
6305
- /**
6306
- * Optional.
6307
- * Whether or not the CTRL key is pressed.
6308
- */
6297
+ /** Whether or not the CTRL key is pressed. */
6309
6298
  ctrlKey?: boolean | undefined;
6310
6299
  /** One of keyup or keydown. */
6311
- type: string;
6312
- /**
6313
- * Optional.
6314
- * The extension ID of the sender of this keyevent.
6315
- * @since Chrome 34
6316
- */
6300
+ type: `${KeyboardEventType}`;
6301
+ /** The extension ID of the sender of this keyevent. */
6317
6302
  extensionId?: string | undefined;
6318
- /**
6319
- * Optional.
6320
- * Value of the physical key being pressed. The value is not affected by current keyboard layout or modifier state.
6321
- * @since Chrome 26
6322
- */
6303
+ /** Value of the physical key being pressed. The value is not affected by current keyboard layout or modifier state. */
6323
6304
  code: string;
6324
- /**
6325
- * Optional.
6326
- * The deprecated HTML keyCode, which is system- and implementation-dependent numerical code signifying the unmodified identifier associated with the key pressed.
6327
- * @since Chrome 37
6328
- */
6305
+ /** The deprecated HTML keyCode, which is system- and implementation-dependent numerical code signifying the unmodified identifier associated with the key pressed. */
6329
6306
  keyCode?: number | undefined;
6330
- /**
6331
- * Optional.
6332
- * Whether or not the CAPS_LOCK is enabled.
6333
- * @since Chrome 29
6334
- */
6307
+ /** Whether or not the CAPS_LOCK is enabled. */
6335
6308
  capsLock?: boolean | undefined;
6336
6309
  }
6337
6310
 
6311
+ /** @since Chrome 44 */
6312
+ export enum KeyboardEventType {
6313
+ KEYUP = "keyup",
6314
+ KEYDOWN = "keydown",
6315
+ }
6316
+
6338
6317
  /**
6339
6318
  * The auto-capitalize type of the text field.
6340
6319
  * @since Chrome 69
6341
6320
  */
6342
- export type AutoCapitalizeType = "characters" | "words" | "sentences";
6321
+ export enum AutoCapitalizeType {
6322
+ CHARACTERS = "characters",
6323
+ WORDS = "words",
6324
+ SENTENCES = "sentences",
6325
+ }
6326
+
6327
+ /**
6328
+ * Type of value this text field edits, (Text, Number, URL, etc)
6329
+ * @since Chrome 44
6330
+ */
6331
+ export enum InputContextType {
6332
+ TEXT = "text",
6333
+ SEARCH = "search",
6334
+ TEL = "tel",
6335
+ URL = "url",
6336
+ EMAIL = "email",
6337
+ NUMBER = "number",
6338
+ PASSWORD = "password",
6339
+ NULL = "null",
6340
+ }
6341
+
6343
6342
  /** Describes an input Context */
6344
6343
  export interface InputContext {
6345
6344
  /** This is used to specify targets of text field operations. This ID becomes invalid as soon as onBlur is called. */
6346
6345
  contextID: number;
6347
6346
  /** Type of value this text field edits, (Text, Number, URL, etc) */
6348
- type: string;
6349
- /**
6350
- * Whether the text field wants auto-correct.
6351
- * @since Chrome 40
6352
- */
6347
+ type: `${InputContextType}`;
6348
+ /** Whether the text field wants auto-correct. */
6353
6349
  autoCorrect: boolean;
6354
- /**
6355
- * Whether the text field wants auto-complete.
6356
- * @since Chrome 40
6357
- */
6350
+ /** Whether the text field wants auto-complete. */
6358
6351
  autoComplete: boolean;
6359
- /**
6360
- * Whether the text field wants spell-check.
6361
- * @since Chrome 40
6362
- */
6352
+ /** Whether the text field wants spell-check. */
6363
6353
  spellCheck: boolean;
6364
6354
  /**
6365
6355
  * The auto-capitalize type of the text field.
6366
6356
  * @since Chrome 69
6367
6357
  */
6368
- autoCapitalize: AutoCapitalizeType;
6358
+ autoCapitalize: `${AutoCapitalizeType}`;
6369
6359
  /**
6370
6360
  * Whether text entered into the text field should be used to improve typing suggestions for the user.
6371
6361
  * @since Chrome 68
@@ -6373,18 +6363,15 @@ declare namespace chrome {
6373
6363
  shouldDoLearning: boolean;
6374
6364
  }
6375
6365
 
6376
- /**
6377
- * A menu item used by an input method to interact with the user from the language menu.
6378
- * @since Chrome 30
6379
- */
6366
+ /** A menu item used by an input method to interact with the user from the language menu. */
6380
6367
  export interface MenuItem {
6381
6368
  /** String that will be passed to callbacks referencing this MenuItem. */
6382
6369
  id: string;
6383
- /** Optional. Text displayed in the menu for this item. */
6370
+ /** Text displayed in the menu for this item. */
6384
6371
  label?: string | undefined;
6385
- /** Optional. The type of menu item. */
6386
- style?: string | undefined;
6387
- /** Optional. Indicates this item is visible. */
6372
+ /** The type of menu item. */
6373
+ style?: `${MenuItemStyle}` | undefined;
6374
+ /** Indicates this item is visible. */
6388
6375
  visible?: boolean | undefined;
6389
6376
  /** Indicates this item should be drawn with a check. */
6390
6377
  checked?: boolean | undefined;
@@ -6392,11 +6379,14 @@ declare namespace chrome {
6392
6379
  enabled?: boolean | undefined;
6393
6380
  }
6394
6381
 
6395
- export interface ImeParameters {
6396
- /** MenuItems to use. */
6397
- items: MenuItem[];
6398
- /** ID of the engine to use */
6399
- engineID: string;
6382
+ /**
6383
+ * The type of menu item. Radio buttons between separators are considered grouped.
6384
+ * @since Chrome 44
6385
+ */
6386
+ export enum MenuItemStyle {
6387
+ CHECK = "check",
6388
+ RADIO = "radio",
6389
+ SEPARATOR = "separator",
6400
6390
  }
6401
6391
 
6402
6392
  export interface CommitTextParameters {
@@ -6418,25 +6408,13 @@ declare namespace chrome {
6418
6408
  candidate: string;
6419
6409
  /** The candidate's id */
6420
6410
  id: number;
6421
- /**
6422
- * Optional.
6423
- * The id to add these candidates under
6424
- */
6411
+ /** The id to add these candidates under */
6425
6412
  parentId?: number | undefined;
6426
- /**
6427
- * Optional.
6428
- * Short string displayed to next to the candidate, often the shortcut key or index
6429
- */
6413
+ /** Short string displayed to next to the candidate, often the shortcut key or index */
6430
6414
  label?: string | undefined;
6431
- /**
6432
- * Optional.
6433
- * Additional text describing the candidate
6434
- */
6415
+ /** Additional text describing the candidate */
6435
6416
  annotation?: string | undefined;
6436
- /**
6437
- * Optional.
6438
- * The usage or detail description of word.
6439
- */
6417
+ /** The usage or detail description of word. */
6440
6418
  usage?: CandidateUsage | undefined;
6441
6419
  }
6442
6420
 
@@ -6453,7 +6431,7 @@ declare namespace chrome {
6453
6431
  /** Index of the character to end this segment after. */
6454
6432
  end: number;
6455
6433
  /** The type of the underline to modify this segment. */
6456
- style: string;
6434
+ style: `${UnderlineStyle}`;
6457
6435
  }
6458
6436
 
6459
6437
  export interface CompositionParameters {
@@ -6461,79 +6439,111 @@ declare namespace chrome {
6461
6439
  contextID: number;
6462
6440
  /** Text to set */
6463
6441
  text: string;
6464
- /** Optional. List of segments and their associated types. */
6442
+ /** List of segments and their associated types. */
6465
6443
  segments?: CompositionParameterSegment[] | undefined;
6466
6444
  /** Position in the text of the cursor. */
6467
6445
  cursor: number;
6468
- /** Optional. Position in the text that the selection starts at. */
6446
+ /** Position in the text that the selection starts at. */
6469
6447
  selectionStart?: number | undefined;
6470
- /** Optional. Position in the text that the selection ends at. */
6448
+ /** Position in the text that the selection ends at. */
6471
6449
  selectionEnd?: number | undefined;
6472
6450
  }
6473
6451
 
6474
- export interface MenuItemParameters {
6452
+ /** @since Chrome 88 */
6453
+ export interface MenuParameters {
6454
+ /** MenuItems to add or update. They will be added in the order they exist in the array. */
6475
6455
  items: MenuItem[];
6476
- engineId: string;
6456
+ /** ID of the engine to use. */
6457
+ engineID: string;
6458
+ }
6459
+
6460
+ /**
6461
+ * Which mouse buttons was clicked.
6462
+ * @since Chrome 44
6463
+ */
6464
+ export enum MouseButton {
6465
+ LEFT = "left",
6466
+ MIDDLE = "middle",
6467
+ RIGHT = "right",
6477
6468
  }
6478
6469
 
6479
- /** Type of the assistive window. */
6480
- export type AssistiveWindowType = "undo";
6470
+ /**
6471
+ * The screen type under which the IME is activated.
6472
+ * @since Chrome 44
6473
+ */
6474
+ export enum ScreenType {
6475
+ NORMAL = "normal",
6476
+ LOGIN = "login",
6477
+ LOCK = "lock",
6478
+ SECONDARY_LOGIN = "secondary-login",
6479
+ }
6481
6480
 
6482
- /** ID of a button in an assistive window. */
6483
- export type AssistiveWindowButton = "undo" | "addToDictionary";
6481
+ /**
6482
+ * The type of the underline to modify this segment.
6483
+ * @since Chrome 44
6484
+ */
6485
+ export enum UnderlineStyle {
6486
+ UNDERLINE = "underline",
6487
+ DOUBLE_UNDERLINE = "doubleUnderline",
6488
+ NO_UNDERLINE = "noUnderline",
6489
+ }
6484
6490
 
6485
- /** Properties of an assistive window. */
6491
+ /**
6492
+ * Where to display the candidate window. If set to 'cursor', the window follows the cursor. If set to 'composition', the window is locked to the beginning of the composition.
6493
+ * @since Chrome 44
6494
+ */
6495
+ export enum WindowPosition {
6496
+ CURSOR = "cursor",
6497
+ COMPOSITION = "composition",
6498
+ }
6499
+
6500
+ /** Type of assistive window. */
6501
+ export enum AssistiveWindowType {
6502
+ UNDO = "undo",
6503
+ }
6504
+
6505
+ /**
6506
+ * ID of a button in an assistive window.
6507
+ * @since Chrome 85
6508
+ */
6509
+ export enum AssistiveWindowButton {
6510
+ UNDO = "undo",
6511
+ ADD_TO_DICTIONARY = "addToDictionary",
6512
+ }
6513
+
6514
+ /**
6515
+ * Properties of the assistive window.
6516
+ * @since Chrome 85
6517
+ */
6486
6518
  export interface AssistiveWindowProperties {
6487
- type: AssistiveWindowType;
6519
+ type: `${AssistiveWindowType}`;
6520
+ /** Sets true to show AssistiveWindow, sets false to hide. */
6488
6521
  visible: boolean;
6522
+ /** Strings for ChromeVox to announce */
6489
6523
  announceString?: string | undefined;
6490
6524
  }
6491
6525
 
6492
6526
  export interface CandidateWindowParameterProperties {
6493
- /**
6494
- * Optional.
6495
- * True to show the cursor, false to hide it.
6496
- */
6527
+ /** True to show the cursor, false to hide it. */
6497
6528
  cursorVisible?: boolean | undefined;
6498
- /**
6499
- * Optional.
6500
- * True if the candidate window should be rendered vertical, false to make it horizontal.
6501
- */
6529
+ /** True if the candidate window should be rendered vertical, false to make it horizontal. */
6502
6530
  vertical?: boolean | undefined;
6503
- /**
6504
- * Optional.
6505
- * The number of candidates to display per page.
6506
- */
6531
+ /** The number of candidates to display per page. */
6507
6532
  pageSize?: number | undefined;
6508
- /**
6509
- * Optional.
6510
- * True to display the auxiliary text, false to hide it.
6511
- */
6533
+ /** True to display the auxiliary text, false to hide it. */
6512
6534
  auxiliaryTextVisible?: boolean | undefined;
6513
- /**
6514
- * Optional.
6515
- * Text that is shown at the bottom of the candidate window.
6516
- */
6535
+ /** Text that is shown at the bottom of the candidate window. */
6517
6536
  auxiliaryText?: string | undefined;
6518
- /**
6519
- * Optional.
6520
- * True to show the Candidate window, false to hide it.
6521
- */
6537
+ /** True to show the Candidate window, false to hide it. */
6522
6538
  visible?: boolean | undefined;
6539
+ /** Where to display the candidate window. */
6540
+ windowPosition?: `${WindowPosition}` | undefined;
6523
6541
  /**
6524
- * Optional.
6525
- * Where to display the candidate window.
6526
- * @since Chrome 28
6527
- */
6528
- windowPosition?: string | undefined;
6529
- /**
6530
- * Optional.
6531
6542
  * The index of the current chosen candidate out of total candidates.
6532
6543
  * @since Chrome 84
6533
6544
  */
6534
6545
  currentCandidateIndex?: number | undefined;
6535
6546
  /**
6536
- * Optional.
6537
6547
  * The total number of candidates for the candidate window.
6538
6548
  * @since Chrome 84
6539
6549
  */
@@ -6576,179 +6586,215 @@ declare namespace chrome {
6576
6586
  length: number;
6577
6587
  }
6578
6588
 
6589
+ export interface AssistiveWindowButtonHighlightedParameters {
6590
+ /** The text for the screenreader to announce. */
6591
+ announceString?: string | undefined;
6592
+ /** The ID of the button */
6593
+ buttonID: `${AssistiveWindowButton}`;
6594
+ /** ID of the context owning the assistive window. */
6595
+ contextID: number;
6596
+ /** Whether the button should be highlighted. */
6597
+ highlighted: boolean;
6598
+ /** The window type the button belongs to. */
6599
+ windowType: `${AssistiveWindowType}`;
6600
+ }
6601
+
6602
+ export interface AssistiveWindowPropertiesParameters {
6603
+ /** ID of the context owning the assistive window. */
6604
+ contextID: number;
6605
+ /** Properties of the assistive window. */
6606
+ properties: AssistiveWindowProperties;
6607
+ }
6608
+
6579
6609
  export interface SurroundingTextInfo {
6580
- /** The text around cursor. */
6610
+ /** The text around the cursor. This is only a subset of all text in the input field. */
6581
6611
  text: string;
6582
6612
  /** The ending position of the selection. This value indicates caret position if there is no selection. */
6583
6613
  focus: number;
6584
- /** The beginning position of the selection. This value indicates caret position if is no selection. */
6614
+ /**
6615
+ * The offset position of `text`. Since `text` only includes a subset of text around the cursor, offset indicates the absolute position of the first character of `text`.
6616
+ * @since Chrome 46
6617
+ */
6618
+ offset: number;
6619
+ /** The beginning position of the selection. This value indicates caret position if there is no selection. */
6585
6620
  anchor: number;
6586
6621
  }
6587
6622
 
6588
6623
  export interface AssistiveWindowButtonClickedDetails {
6589
6624
  /** The ID of the button clicked. */
6590
- buttonID: AssistiveWindowButton;
6625
+ buttonID: `${AssistiveWindowButton}`;
6591
6626
  /** The type of the assistive window. */
6592
- windowType: AssistiveWindowType;
6627
+ windowType: `${AssistiveWindowType}`;
6593
6628
  }
6594
6629
 
6595
- export interface BlurEvent extends chrome.events.Event<(contextID: number) => void> {}
6596
-
6597
- export interface AssistiveWindowButtonClickedEvent
6598
- extends chrome.events.Event<(details: AssistiveWindowButtonClickedDetails) => void>
6599
- {}
6600
-
6601
- export interface CandidateClickedEvent
6602
- extends chrome.events.Event<(engineID: string, candidateID: number, button: string) => void>
6603
- {}
6604
-
6605
- export interface KeyEventEvent
6606
- extends chrome.events.Event<(engineID: string, keyData: KeyboardEvent, requestId: string) => void>
6607
- {}
6608
-
6609
- export interface DeactivatedEvent extends chrome.events.Event<(engineID: string) => void> {}
6610
-
6611
- export interface InputContextUpdateEvent extends chrome.events.Event<(context: InputContext) => void> {}
6612
-
6613
- export interface ActivateEvent extends chrome.events.Event<(engineID: string, screen: string) => void> {}
6614
-
6615
- export interface FocusEvent extends chrome.events.Event<(context: InputContext) => void> {}
6616
-
6617
- export interface MenuItemActivatedEvent extends chrome.events.Event<(engineID: string, name: string) => void> {}
6618
-
6619
- export interface SurroundingTextChangedEvent
6620
- extends chrome.events.Event<(engineID: string, surroundingInfo: SurroundingTextInfo) => void>
6621
- {}
6622
-
6623
- export interface InputResetEvent extends chrome.events.Event<(engineID: string) => void> {}
6624
-
6625
6630
  /**
6626
6631
  * Adds the provided menu items to the language menu when this IME is active.
6632
+ *
6633
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6627
6634
  */
6628
- export function setMenuItems(parameters: ImeParameters, callback?: () => void): void;
6635
+ export function setMenuItems(parameters: MenuParameters): Promise<void>;
6636
+ export function setMenuItems(parameters: MenuParameters, callback: () => void): void;
6637
+
6629
6638
  /**
6630
6639
  * Commits the provided text to the current input.
6631
- * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.
6640
+ *
6641
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6632
6642
  */
6633
- export function commitText(parameters: CommitTextParameters, callback?: (success: boolean) => void): void;
6643
+ export function commitText(parameters: CommitTextParameters): Promise<boolean>;
6644
+ export function commitText(parameters: CommitTextParameters, callback: (success: boolean) => void): void;
6645
+
6634
6646
  /**
6635
6647
  * Sets the current candidate list. This fails if this extension doesn't own the active IME
6636
- * @param callback Called when the operation completes.
6648
+ *
6649
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6637
6650
  */
6638
- export function setCandidates(parameters: CandidatesParameters, callback?: (success: boolean) => void): void;
6651
+ export function setCandidates(parameters: CandidatesParameters): Promise<boolean>;
6652
+ export function setCandidates(parameters: CandidatesParameters, callback: (success: boolean) => void): void;
6653
+
6639
6654
  /**
6640
6655
  * Set the current composition. If this extension does not own the active IME, this fails.
6641
- * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.
6656
+ *
6657
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6642
6658
  */
6643
- export function setComposition(parameters: CompositionParameters, callback?: (success: boolean) => void): void;
6659
+ export function setComposition(parameters: CompositionParameters): Promise<boolean>;
6660
+ export function setComposition(parameters: CompositionParameters, callback: (success: boolean) => void): void;
6661
+
6644
6662
  /**
6645
6663
  * Updates the state of the MenuItems specified
6646
- * @param callback Called when the operation completes
6664
+ *
6665
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6647
6666
  */
6648
- export function updateMenuItems(parameters: MenuItemParameters, callback?: () => void): void;
6667
+ export function updateMenuItems(parameters: MenuParameters): Promise<void>;
6668
+ export function updateMenuItems(parameters: MenuParameters, callback: () => void): void;
6669
+
6649
6670
  /**
6650
6671
  * Shows/Hides an assistive window with the given properties.
6651
- * @param parameters
6652
- * @param callback Called when the operation completes.
6672
+ *
6673
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6653
6674
  */
6654
6675
  export function setAssistiveWindowProperties(
6655
- parameters: {
6656
- contextID: number;
6657
- properties: chrome.input.ime.AssistiveWindowProperties;
6658
- },
6659
- callback?: (success: boolean) => void,
6676
+ parameters: AssistiveWindowPropertiesParameters,
6677
+ ): Promise<boolean>;
6678
+ export function setAssistiveWindowProperties(
6679
+ parameters: AssistiveWindowPropertiesParameters,
6680
+ callback: (success: boolean) => void,
6660
6681
  ): void;
6682
+
6661
6683
  /**
6662
6684
  * Highlights/Unhighlights a button in an assistive window.
6663
- * @param parameters
6664
- * @param callback Called when the operation completes. On failure, chrome.runtime.lastError is set.
6685
+ *
6686
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6665
6687
  */
6666
6688
  export function setAssistiveWindowButtonHighlighted(
6667
- parameters: {
6668
- contextID: number;
6669
- buttonID: chrome.input.ime.AssistiveWindowButton;
6670
- windowType: chrome.input.ime.AssistiveWindowType;
6671
- announceString?: string | undefined;
6672
- highlighted: boolean;
6673
- },
6674
- callback?: () => void,
6689
+ parameters: AssistiveWindowButtonHighlightedParameters,
6690
+ ): Promise<void>;
6691
+ export function setAssistiveWindowButtonHighlighted(
6692
+ parameters: AssistiveWindowButtonHighlightedParameters,
6693
+ callback: () => void,
6675
6694
  ): void;
6695
+
6676
6696
  /**
6677
6697
  * Sets the properties of the candidate window. This fails if the extension doesn't own the active IME
6678
- * @param callback Called when the operation completes.
6698
+ *
6699
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6679
6700
  */
6701
+ export function setCandidateWindowProperties(parameters: CandidateWindowParameter): Promise<boolean>;
6680
6702
  export function setCandidateWindowProperties(
6681
6703
  parameters: CandidateWindowParameter,
6682
- callback?: (success: boolean) => void,
6704
+ callback: (success: boolean) => void,
6683
6705
  ): void;
6706
+
6684
6707
  /**
6685
6708
  * Clear the current composition. If this extension does not own the active IME, this fails.
6686
- * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.
6709
+ *
6710
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6687
6711
  */
6712
+ export function clearComposition(parameters: ClearCompositionParameters): Promise<boolean>;
6688
6713
  export function clearComposition(
6689
6714
  parameters: ClearCompositionParameters,
6690
- callback?: (success: boolean) => void,
6715
+ callback: (success: boolean) => void,
6691
6716
  ): void;
6717
+
6692
6718
  /**
6693
6719
  * Set the position of the cursor in the candidate window. This is a no-op if this extension does not own the active IME.
6694
- * @param callback Called when the operation completes
6720
+ *
6721
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6695
6722
  */
6696
6723
  export function setCursorPosition(
6697
6724
  parameters: CursorPositionParameters,
6698
- callback?: (success: boolean) => void,
6725
+ ): Promise<boolean>;
6726
+ export function setCursorPosition(
6727
+ parameters: CursorPositionParameters,
6728
+ callback: (success: boolean) => void,
6699
6729
  ): void;
6730
+
6700
6731
  /**
6701
6732
  * Sends the key events. This function is expected to be used by virtual keyboards. When key(s) on a virtual keyboard is pressed by a user, this function is used to propagate that event to the system.
6702
- * @since Chrome 33
6703
- * @param callback Called when the operation completes.
6704
- */
6705
- export function sendKeyEvents(parameters: SendKeyEventParameters, callback?: () => void): void;
6706
- /**
6707
- * Hides the input view window, which is popped up automatically by system. If the input view window is already hidden, this function will do nothing.
6708
- * @since Chrome 34
6733
+ *
6734
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6709
6735
  */
6736
+ export function sendKeyEvents(parameters: SendKeyEventParameters): Promise<void>;
6737
+ export function sendKeyEvents(parameters: SendKeyEventParameters, callback: () => void): void;
6738
+
6739
+ /** Hides the input view window, which is popped up automatically by system. If the input view window is already hidden, this function will do nothing. */
6710
6740
  export function hideInputView(): void;
6741
+
6711
6742
  /**
6712
6743
  * Deletes the text around the caret.
6713
- * @since Chrome 27
6744
+ *
6745
+ * Can return its result via Promise in Manifest V3 or later since Chrome 111.
6714
6746
  */
6715
- export function deleteSurroundingText(parameters: DeleteSurroundingTextParameters, callback?: () => void): void;
6747
+ export function deleteSurroundingText(parameters: DeleteSurroundingTextParameters): Promise<void>;
6748
+ export function deleteSurroundingText(parameters: DeleteSurroundingTextParameters, callback: () => void): void;
6749
+
6716
6750
  /**
6717
6751
  * Indicates that the key event received by onKeyEvent is handled. This should only be called if the onKeyEvent listener is asynchronous.
6718
- * @since Chrome 25
6719
6752
  * @param requestId Request id of the event that was handled. This should come from keyEvent.requestId
6720
6753
  * @param response True if the keystroke was handled, false if not
6721
6754
  */
6722
6755
  export function keyEventHandled(requestId: string, response: boolean): void;
6723
6756
 
6724
6757
  /** This event is sent when focus leaves a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */
6725
- export var onBlur: BlurEvent;
6726
- /** This event is sent when a button in an assistive window is clicked. */
6727
- export var onAssistiveWindowButtonClicked: AssistiveWindowButtonClickedEvent;
6728
- /** This event is sent if this extension owns the active IME. */
6729
- export var onCandidateClicked: CandidateClickedEvent;
6758
+ export const onBlur: events.Event<(contextID: number) => void>;
6759
+
6760
+ /**
6761
+ * This event is sent when a button in an assistive window is clicked.
6762
+ * @since Chrome 85
6763
+ */
6764
+ export const onAssistiveWindowButtonClicked: events.Event<
6765
+ (details: AssistiveWindowButtonClickedDetails) => void
6766
+ >;
6767
+
6730
6768
  /** This event is sent if this extension owns the active IME. */
6731
- export var onKeyEvent: KeyEventEvent;
6769
+ export const onCandidateClicked: events.Event<
6770
+ (engineID: string, candidateID: number, button: `${MouseButton}`) => void
6771
+ >;
6772
+
6773
+ /** Fired when a key event is sent from the operating system. The event will be sent to the extension if this extension owns the active IME. The listener function should return true if the event was handled false if it was not. If the event will be evaluated asynchronously, this function must return undefined and the IME must later call keyEventHandled() with the result. */
6774
+ export const onKeyEvent: events.Event<(engineID: string, keyData: KeyboardEvent, requestId: string) => void>;
6775
+
6732
6776
  /** This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events. */
6733
- export var onDeactivated: DeactivatedEvent;
6734
- /** This event is sent when the properties of the current InputContext change, such as the type. It is sent to all extensions that are listening to this event, and enabled by the user. */
6735
- export var onInputContextUpdate: InputContextUpdateEvent;
6777
+ export const onDeactivated: events.Event<(engineID: string) => void>;
6778
+
6779
+ /** This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user. */
6780
+ export const onInputContextUpdate: events.Event<(context: InputContext) => void>;
6781
+
6736
6782
  /** This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events. */
6737
- export var onActivate: ActivateEvent;
6738
- /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */
6739
- export var onFocus: FocusEvent;
6783
+ export const onActivate: events.Event<(engineID: string, screen: `${ScreenType}`) => void>;
6784
+
6785
+ // /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */
6786
+ export const onFocus: events.Event<(context: InputContext) => void>;
6787
+
6740
6788
  /** Called when the user selects a menu item */
6741
- export var onMenuItemActivated: MenuItemActivatedEvent;
6742
- /**
6743
- * Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction.
6744
- * @since Chrome 27
6745
- */
6746
- export var onSurroundingTextChanged: SurroundingTextChangedEvent;
6747
- /**
6748
- * This event is sent when chrome terminates ongoing text input session.
6749
- * @since Chrome 29
6750
- */
6751
- export var onReset: InputResetEvent;
6789
+ export const onMenuItemActivated: events.Event<(engineID: string, name: string) => void>;
6790
+
6791
+ /** Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction. */
6792
+ export const onSurroundingTextChanged: events.Event<
6793
+ (engineID: string, surroundingInfo: SurroundingTextInfo) => void
6794
+ >;
6795
+
6796
+ /** This event is sent when chrome terminates ongoing text input session. */
6797
+ export const onReset: events.Event<(engineID: string) => void>;
6752
6798
  }
6753
6799
 
6754
6800
  ////////////////////
@@ -10069,14 +10115,13 @@ declare namespace chrome {
10069
10115
  availableCapacity: number;
10070
10116
  }
10071
10117
 
10072
- /** Get physical memory information. */
10073
- export function getInfo(callback: (info: MemoryInfo) => void): void;
10074
-
10075
10118
  /**
10076
10119
  * Get physical memory information.
10077
- * @return The `getInfo` method provides its result via callback or returned as a `Promise` (MV3 only).
10120
+ *
10121
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
10078
10122
  */
10079
10123
  export function getInfo(): Promise<MemoryInfo>;
10124
+ export function getInfo(callback: (info: MemoryInfo) => void): void;
10080
10125
  }
10081
10126
 
10082
10127
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
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": "6611bcded842c02d684735a90b3b71391663330da30a91d85cffb859330dabea",
97
+ "typesPublisherContentHash": "29c78aebedd7b318174f7216589325a219bf672ea2647e846d05e9ab4bb3bf43",
98
98
  "typeScriptVersion": "5.2"
99
99
  }