@wxt-dev/browser 0.2.6 → 0.2.8
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/package.json +2 -2
- package/src/gen/index.d.ts +81 -12
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxt-dev/browser",
|
|
3
3
|
"description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"src"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/chrome": "0.2.
|
|
28
|
+
"@types/chrome": "0.2.8",
|
|
29
29
|
"@types/node": "^22",
|
|
30
30
|
"typescript": "^6.0.3",
|
|
31
31
|
"vitest": "^4.1.10"
|
package/src/gen/index.d.ts
CHANGED
|
@@ -396,6 +396,11 @@ export namespace Browser {
|
|
|
396
396
|
export namespace alarms {
|
|
397
397
|
type AlarmCreateInfo =
|
|
398
398
|
& {
|
|
399
|
+
/**
|
|
400
|
+
* Name of this alarm.
|
|
401
|
+
* @since Chrome 152
|
|
402
|
+
*/
|
|
403
|
+
name?: string | undefined;
|
|
399
404
|
/**
|
|
400
405
|
* Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers.
|
|
401
406
|
* @since Chrome 150
|
|
@@ -455,9 +460,18 @@ export namespace Browser {
|
|
|
455
460
|
* Can return its result via Promise in Manifest V3 or later since Chrome 111.
|
|
456
461
|
*/
|
|
457
462
|
function create(alarmInfo: AlarmCreateInfo): Promise<void>;
|
|
458
|
-
function create(name:
|
|
463
|
+
function create(name: undefined, alarmInfo: AlarmCreateInfo): Promise<void>;
|
|
464
|
+
function create<T extends AlarmCreateInfo>(
|
|
465
|
+
name: string,
|
|
466
|
+
alarmInfo: T & (T extends { name: string } ? never : unknown),
|
|
467
|
+
): Promise<void>;
|
|
459
468
|
function create(alarmInfo: AlarmCreateInfo, callback: () => void): void;
|
|
460
|
-
function create(name:
|
|
469
|
+
function create(name: undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void;
|
|
470
|
+
function create<T extends AlarmCreateInfo>(
|
|
471
|
+
name: string,
|
|
472
|
+
alarmInfo: T & (T extends { name: string } ? never : unknown),
|
|
473
|
+
callback: () => void,
|
|
474
|
+
): void;
|
|
461
475
|
|
|
462
476
|
/**
|
|
463
477
|
* Gets an array of all the alarms.
|
|
@@ -3076,10 +3090,13 @@ export namespace Browser {
|
|
|
3076
3090
|
/**
|
|
3077
3091
|
* Creates a pane within panel's sidebar.
|
|
3078
3092
|
* @param title Text that is displayed in sidebar caption.
|
|
3093
|
+
*
|
|
3094
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 152.
|
|
3079
3095
|
*/
|
|
3096
|
+
createSidebarPane(title: string): Promise<ExtensionSidebarPane>;
|
|
3080
3097
|
createSidebarPane(
|
|
3081
3098
|
title: string,
|
|
3082
|
-
callback
|
|
3099
|
+
callback: (
|
|
3083
3100
|
/** An ExtensionSidebarPane object for created sidebar pane. */
|
|
3084
3101
|
result: ExtensionSidebarPane,
|
|
3085
3102
|
) => void,
|
|
@@ -3093,10 +3110,13 @@ export namespace Browser {
|
|
|
3093
3110
|
/**
|
|
3094
3111
|
* Creates a pane within panel's sidebar.
|
|
3095
3112
|
* @param title Text that is displayed in sidebar caption.
|
|
3113
|
+
*
|
|
3114
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 152.
|
|
3096
3115
|
*/
|
|
3116
|
+
createSidebarPane(title: string): Promise<ExtensionSidebarPane>;
|
|
3097
3117
|
createSidebarPane(
|
|
3098
3118
|
title: string,
|
|
3099
|
-
callback
|
|
3119
|
+
callback: (
|
|
3100
3120
|
/** An ExtensionSidebarPane object for created sidebar pane. */
|
|
3101
3121
|
result: ExtensionSidebarPane,
|
|
3102
3122
|
) => void,
|
|
@@ -3116,19 +3136,23 @@ export namespace Browser {
|
|
|
3116
3136
|
* Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.
|
|
3117
3137
|
* @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch.
|
|
3118
3138
|
* @param rootTitle An optional title for the root of the expression tree.
|
|
3139
|
+
*
|
|
3140
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 152.
|
|
3119
3141
|
*/
|
|
3120
|
-
setExpression(expression: string,
|
|
3121
|
-
setExpression(expression: string, rootTitle: string | undefined, callback
|
|
3142
|
+
setExpression(expression: string, rootTitle?: string): Promise<void>;
|
|
3143
|
+
setExpression(expression: string, rootTitle: string | undefined, callback: () => void): void;
|
|
3122
3144
|
/**
|
|
3123
3145
|
* Sets a JSON-compliant object to be displayed in the sidebar pane.
|
|
3124
3146
|
* @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client).
|
|
3125
3147
|
* @param rootTitle An optional title for the root of the expression tree.
|
|
3148
|
+
*
|
|
3149
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 152.
|
|
3126
3150
|
*/
|
|
3127
|
-
setObject(jsonObject: { [key: string]: unknown },
|
|
3151
|
+
setObject(jsonObject: { [key: string]: unknown }, rootTitle?: string): Promise<void>;
|
|
3128
3152
|
setObject(
|
|
3129
3153
|
jsonObject: { [key: string]: unknown },
|
|
3130
3154
|
rootTitle: string | undefined,
|
|
3131
|
-
callback
|
|
3155
|
+
callback: () => void,
|
|
3132
3156
|
): void;
|
|
3133
3157
|
/**
|
|
3134
3158
|
* Sets an HTML page to be displayed in the sidebar pane.
|
|
@@ -3158,12 +3182,15 @@ export namespace Browser {
|
|
|
3158
3182
|
* @param title Title that is displayed next to the extension icon in the Developer Tools toolbar.
|
|
3159
3183
|
* @param iconPath Path of the panel's icon relative to the extension directory.
|
|
3160
3184
|
* @param pagePath Path of the panel's HTML page relative to the extension directory.
|
|
3185
|
+
*
|
|
3186
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 152.
|
|
3161
3187
|
*/
|
|
3188
|
+
function create(title: string, iconPath: string, pagePath: string): Promise<ExtensionPanel>;
|
|
3162
3189
|
function create(
|
|
3163
3190
|
title: string,
|
|
3164
3191
|
iconPath: string,
|
|
3165
3192
|
pagePath: string,
|
|
3166
|
-
callback
|
|
3193
|
+
callback: (
|
|
3167
3194
|
/** An ExtensionPanel object representing the created panel. */
|
|
3168
3195
|
panel: ExtensionPanel,
|
|
3169
3196
|
) => void,
|
|
@@ -3190,13 +3217,16 @@ export namespace Browser {
|
|
|
3190
3217
|
* @param url The URL of the resource to open.
|
|
3191
3218
|
* @param lineNumber Specifies the line number to scroll to when the resource is loaded.
|
|
3192
3219
|
* @param columnNumber Specifies the column number to scroll to when the resource is loaded.
|
|
3220
|
+
*
|
|
3221
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 152.
|
|
3193
3222
|
*/
|
|
3194
|
-
function openResource(url: string, lineNumber: number,
|
|
3223
|
+
function openResource(url: string, lineNumber: number, columnNumber?: number): Promise<void>;
|
|
3224
|
+
function openResource(url: string, lineNumber: number, callback: () => void): void;
|
|
3195
3225
|
function openResource(
|
|
3196
3226
|
url: string,
|
|
3197
3227
|
lineNumber: number,
|
|
3198
3228
|
columnNumber: number | undefined,
|
|
3199
|
-
callback
|
|
3229
|
+
callback: () => void,
|
|
3200
3230
|
): void;
|
|
3201
3231
|
|
|
3202
3232
|
/**
|
|
@@ -4744,6 +4774,25 @@ export namespace Browser {
|
|
|
4744
4774
|
*/
|
|
4745
4775
|
type CSSOrigin = "author" | "user";
|
|
4746
4776
|
|
|
4777
|
+
/**
|
|
4778
|
+
* Details of the CSS to remove. Either the code or the file property must be set, but both may not be set at the same time.
|
|
4779
|
+
* @since Chrome 87
|
|
4780
|
+
*/
|
|
4781
|
+
interface DeleteInjectionDetails {
|
|
4782
|
+
/** If allFrames is `true`, implies that the CSS should be removed from all frames of current page. By default, it's `false` and is only removed from the top frame. If `true` and `frameId` is set, then the code is removed from the selected frame and all of its child frames. */
|
|
4783
|
+
allFrames?: boolean;
|
|
4784
|
+
/** CSS code to remove. */
|
|
4785
|
+
code?: string;
|
|
4786
|
+
/** The origin of the CSS to remove. Defaults to `"author"`. */
|
|
4787
|
+
cssOrigin?: CSSOrigin;
|
|
4788
|
+
/** CSS file to remove. */
|
|
4789
|
+
file?: string;
|
|
4790
|
+
/** The frame from where the CSS should be removed. Defaults to 0 (the top-level frame). */
|
|
4791
|
+
frameId?: number;
|
|
4792
|
+
/** If matchAboutBlank is true, then the code is also removed from about:blank and about:srcdoc frames if your extension has access to its parent document. By default it is `false`. */
|
|
4793
|
+
matchAboutBlank?: boolean;
|
|
4794
|
+
}
|
|
4795
|
+
|
|
4747
4796
|
/**
|
|
4748
4797
|
* The document lifecycle of the frame.
|
|
4749
4798
|
* @since Chrome 106
|
|
@@ -11892,7 +11941,7 @@ export namespace Browser {
|
|
|
11892
11941
|
* MV2 only
|
|
11893
11942
|
* @param tabId The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
|
|
11894
11943
|
* @param details Details of the CSS text to insert. Either the code or the file property must be set, but both may not be set at the same time.
|
|
11895
|
-
* @deprecated since Chrome
|
|
11944
|
+
* @deprecated since Chrome 91. Replaced by {@link scripting.insertCSS} in Manifest V3.
|
|
11896
11945
|
*/
|
|
11897
11946
|
function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
|
|
11898
11947
|
function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
|
|
@@ -11903,6 +11952,26 @@ export namespace Browser {
|
|
|
11903
11952
|
callback: () => void,
|
|
11904
11953
|
): void;
|
|
11905
11954
|
|
|
11955
|
+
/**
|
|
11956
|
+
* Removes from a page CSS that was previously injected by a call to {@link tabs.insertCSS}.
|
|
11957
|
+
*
|
|
11958
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
|
11959
|
+
*
|
|
11960
|
+
* MV2 only
|
|
11961
|
+
* @param tabId The ID of the tab from which to remove the CSS; defaults to the active tab of the current window.
|
|
11962
|
+
* @param details Details of the CSS text to remove. Either the code or the file property must be set, but both may not be set at the same time.
|
|
11963
|
+
* @since Chrome 87
|
|
11964
|
+
* @deprecated since Chrome 91. Replaced by {@link scripting.removeCSS} in Manifest V3.
|
|
11965
|
+
*/
|
|
11966
|
+
function removeCSS(details: extensionTypes.DeleteInjectionDetails): Promise<void>;
|
|
11967
|
+
function removeCSS(tabId: number | undefined, details: extensionTypes.DeleteInjectionDetails): Promise<void>;
|
|
11968
|
+
function removeCSS(details: extensionTypes.DeleteInjectionDetails, callback: () => void): void;
|
|
11969
|
+
function removeCSS(
|
|
11970
|
+
tabId: number | undefined,
|
|
11971
|
+
details: extensionTypes.DeleteInjectionDetails,
|
|
11972
|
+
callback: () => void,
|
|
11973
|
+
): void;
|
|
11974
|
+
|
|
11906
11975
|
/**
|
|
11907
11976
|
* Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.
|
|
11908
11977
|
*
|