update template

This commit is contained in:
2025-02-02 18:08:09 -06:00
parent f070c12273
commit a04e2bb9d1
575 changed files with 13430 additions and 55 deletions

View File

@@ -0,0 +1,16 @@
package webextension_polyfill.tabs;
typedef ConnectConnectInfoType = {
/**
Will be passed into onConnect for content scripts that are listening for the connection event.
Optional.
**/
@:optional
var name : String;
/**
Open a port to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab.
Optional.
**/
@:optional
var frameId : Float;
};

View File

@@ -0,0 +1,74 @@
package webextension_polyfill.tabs;
typedef CreateCreatePropertiesType = {
/**
The window to create the new tab in. Defaults to the $(topic:current-window)[current window].
Optional.
**/
@:optional
var windowId : Float;
/**
The position the tab should take in the window. The provided value will be clamped to between zero and the number of
tabs in the window.
Optional.
**/
@:optional
var index : Float;
/**
The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com',
not 'www.google.com'). Relative URLs will be relative to the current page within the extension.
Defaults to the New Tab Page.
Optional.
**/
@:optional
var url : String;
/**
Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see
$(ref:windows.update)). Defaults to <var>true</var>.
Optional.
**/
@:optional
var active : Bool;
/**
Whether the tab should be pinned. Defaults to <var>false</var>
Optional.
**/
@:optional
var pinned : Bool;
/**
The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab.
Optional.
**/
@:optional
var openerTabId : Float;
/**
The CookieStoreId for the tab that opened this tab.
Optional.
**/
@:optional
var cookieStoreId : String;
/**
Whether the document in the tab should be opened in reader mode.
Optional.
**/
@:optional
var openInReaderMode : Bool;
/**
Whether the tab is marked as 'discarded' when created.
Optional.
**/
@:optional
var discarded : Bool;
/**
The title used for display if the tab is created in discarded mode.
Optional.
**/
@:optional
var title : String;
/**
Whether the tab should be muted when created.
Optional.
**/
@:optional
var muted : Bool;
};

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.tabs;
typedef DuplicateDuplicatePropertiesType = {
/**
The position the new tab should take in the window. The provided value will be clamped to between zero and the number of
tabs in the window.
Optional.
**/
@:optional
var index : Float;
/**
Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see
$(ref:windows.update)). Defaults to <var>true</var>.
Optional.
**/
@:optional
var active : Bool;
};

View File

@@ -0,0 +1,23 @@
package webextension_polyfill.tabs;
typedef HighlightHighlightInfoType = {
/**
The window that contains the tabs.
Optional.
**/
@:optional
var windowId : Float;
/**
If true, the $(ref:windows.Window) returned will have a <var>tabs</var> property that contains a list of the $(ref:tabs.
Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>
favIconUrl</code> properties if the extension's manifest file includes the <code>"tabs"</code> permission. If false,
the $(ref:windows.Window) won't have the <var>tabs</var> property.
Optional.
**/
@:optional
var populate : Bool;
/**
One or more tab indices to highlight.
**/
var tabs : ts.AnyOf2<Float, Array<Float>>;
};

View File

@@ -0,0 +1,20 @@
package webextension_polyfill.tabs;
typedef MoveInSuccessionOptionsType = {
/**
Whether to move the tabs before (false) or after (true) tabId in the succession. Defaults to false.
Optional.
**/
@:optional
var append : Bool;
/**
Whether to link up the current predecessors or successor (depending on options.append)
of tabId to the other side of the chain after it is prepended or appended. If true,
one of the following happens: if options.append is false, the first tab in the array is set as the successor of any
current predecessors of tabId; if options.append is true, the current successor of tabId is set as the successor of the
last tab in the array. Defaults to false.
Optional.
**/
@:optional
var insert : Bool;
};

View File

@@ -0,0 +1,14 @@
package webextension_polyfill.tabs;
typedef MoveMovePropertiesType = {
/**
Defaults to the window the tab is currently in.
Optional.
**/
@:optional
var windowId : Float;
/**
The position to move the window to. -1 will place the tab at the end of the window.
**/
var index : Float;
};

View File

@@ -0,0 +1,25 @@
package webextension_polyfill.tabs;
/**
Tab muted state and the reason for the last state change.
**/
typedef MutedInfo = {
/**
Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound).
Equivalent to whether the muted audio indicator is showing.
**/
var muted : Bool;
/**
The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed.
Optional.
**/
@:optional
var reason : MutedInfoReason;
/**
The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last
changed.
Optional.
**/
@:optional
var extensionId : String;
};

View File

@@ -0,0 +1,10 @@
package webextension_polyfill.tabs;
/**
An event that caused a muted state change.
"user": A user input action has set/overridden the muted state.
"capture": Tab capture started, forcing a muted state change.
"extension": An extension, identified by the extensionId field, set the muted state.
**/
typedef MutedInfoReason = String;

View File

@@ -0,0 +1,18 @@
package webextension_polyfill.tabs;
typedef OnActivatedActiveInfoType = {
/**
The ID of the tab that has become active.
**/
var tabId : Float;
/**
The ID of the tab that was previously active, if that tab is still open.
Optional.
**/
@:optional
var previousTabId : Float;
/**
The ID of the window the active tab changed inside of.
**/
var windowId : Float;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.tabs;
typedef OnAttachedAttachInfoType = {
var newWindowId : Float;
var newPosition : Float;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.tabs;
typedef OnDetachedDetachInfoType = {
var oldWindowId : Float;
var oldPosition : Float;
};

View File

@@ -0,0 +1,12 @@
package webextension_polyfill.tabs;
typedef OnHighlightedHighlightInfoType = {
/**
The window whose tabs changed.
**/
var windowId : Float;
/**
All highlighted tabs in the window.
**/
var tabIds : Array<Float>;
};

View File

@@ -0,0 +1,7 @@
package webextension_polyfill.tabs;
typedef OnMovedMoveInfoType = {
var windowId : Float;
var fromIndex : Float;
var toIndex : Float;
};

View File

@@ -0,0 +1,12 @@
package webextension_polyfill.tabs;
typedef OnRemovedRemoveInfoType = {
/**
The window whose tab is closed.
**/
var windowId : Float;
/**
True when the tab is being closed because its window is being closed.
**/
var isWindowClosing : Bool;
};

View File

@@ -0,0 +1,88 @@
package webextension_polyfill.tabs;
/**
Lists the changes to the state of the tab that was updated.
**/
typedef OnUpdatedChangeInfoType = {
/**
The tab's new attention state.
Optional.
**/
@:optional
var attention : Bool;
/**
The tab's new audible state.
Optional.
**/
@:optional
var audible : Bool;
/**
The tab's new autoDiscardable state.
Optional.
**/
@:optional
var autoDiscardable : Bool;
/**
True while the tab is not loaded with content.
Optional.
**/
@:optional
var discarded : Bool;
/**
The tab's new favicon URL. This property is only present if the extension's manifest includes the <code>"tabs"</code>
permission.
Optional.
**/
@:optional
var favIconUrl : String;
/**
The tab's new hidden state.
Optional.
**/
@:optional
var hidden : Bool;
/**
Whether the document in the tab can be rendered in reader mode.
Optional.
**/
@:optional
var isArticle : Bool;
/**
The tab's new muted state and the reason for the change.
Optional.
**/
@:optional
var mutedInfo : MutedInfo;
/**
The tab's new pinned state.
Optional.
**/
@:optional
var pinned : Bool;
/**
The tab's new sharing state for screen, microphone and camera.
Optional.
**/
@:optional
var sharingState : SharingState;
/**
The status of the tab. Can be either <em>loading</em> or <em>complete</em>.
Optional.
**/
@:optional
var status : String;
/**
The title of the tab if it has changed. This property is only present if the extension's manifest includes the <code>
"tabs"</code> permission.
Optional.
**/
@:optional
var title : String;
/**
The tab's URL if it has changed. This property is only present if the extension's manifest includes the <code>
"tabs"</code> permission.
Optional.
**/
@:optional
var url : String;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.tabs;
/**
Fired when a tab is updated.
**/
typedef OnUpdatedEvent = {
/**
Registers an event listener <em>callback</em> to an event.
**/
function addListener(callback:(tabId:Float, changeInfo:OnUpdatedChangeInfoType, tab:Tab) -> Void, ?filter:UpdateFilter):Void;
/**
Deregisters an event listener <em>callback</em> from an event.
**/
function removeListener(callback:(tabId:Float, changeInfo:OnUpdatedChangeInfoType, tab:Tab) -> Void):Void;
function hasListener(callback:(tabId:Float, changeInfo:OnUpdatedChangeInfoType, tab:Tab) -> Void):Bool;
function hasListeners():Bool;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.tabs;
typedef OnZoomChangeZoomChangeInfoType = {
var tabId : Float;
var oldZoomFactor : Float;
var newZoomFactor : Float;
var zoomSettings : ZoomSettings;
};

View File

@@ -0,0 +1,145 @@
package webextension_polyfill.tabs;
/**
Defines the page settings to be used when saving a page as a pdf file.
**/
typedef PageSettings = {
/**
The name of the file. May include optional .pdf extension.
Optional.
**/
@:optional
var toFileName : String;
/**
The page size unit: 0 = inches, 1 = millimeters. Default: 0.
Optional.
**/
@:optional
var paperSizeUnit : Float;
/**
The paper width in paper size units. Default: 8.5.
Optional.
**/
@:optional
var paperWidth : Float;
/**
The paper height in paper size units. Default: 11.0.
Optional.
**/
@:optional
var paperHeight : Float;
/**
The page content orientation: 0 = portrait, 1 = landscape. Default: 0.
Optional.
**/
@:optional
var orientation : Float;
/**
The page content scaling factor: 1.0 = 100% = normal size. Default: 1.0.
Optional.
**/
@:optional
var scaling : Float;
/**
Whether the page content should shrink to fit the page width (overrides scaling). Default: true.
Optional.
**/
@:optional
var shrinkToFit : Bool;
/**
Whether the page background colors should be shown. Default: false.
Optional.
**/
@:optional
var showBackgroundColors : Bool;
/**
Whether the page background images should be shown. Default: false.
Optional.
**/
@:optional
var showBackgroundImages : Bool;
/**
The spacing between the left header/footer and the left edge of the paper (inches). Default: 0.
Optional.
**/
@:optional
var edgeLeft : Float;
/**
The spacing between the right header/footer and the right edge of the paper (inches). Default: 0.
Optional.
**/
@:optional
var edgeRight : Float;
/**
The spacing between the top of the headers and the top edge of the paper (inches). Default: 0
Optional.
**/
@:optional
var edgeTop : Float;
/**
The spacing between the bottom of the footers and the bottom edge of the paper (inches). Default: 0.
Optional.
**/
@:optional
var edgeBottom : Float;
/**
The margin between the page content and the left edge of the paper (inches). Default: 0.5.
Optional.
**/
@:optional
var marginLeft : Float;
/**
The margin between the page content and the right edge of the paper (inches). Default: 0.5.
Optional.
**/
@:optional
var marginRight : Float;
/**
The margin between the page content and the top edge of the paper (inches). Default: 0.5.
Optional.
**/
@:optional
var marginTop : Float;
/**
The margin between the page content and the bottom edge of the paper (inches). Default: 0.5.
Optional.
**/
@:optional
var marginBottom : Float;
/**
The text for the page's left header. Default: '&T'.
Optional.
**/
@:optional
var headerLeft : String;
/**
The text for the page's center header. Default: ''.
Optional.
**/
@:optional
var headerCenter : String;
/**
The text for the page's right header. Default: '&U'.
Optional.
**/
@:optional
var headerRight : String;
/**
The text for the page's left footer. Default: '&PT'.
Optional.
**/
@:optional
var footerLeft : String;
/**
The text for the page's center footer. Default: ''.
Optional.
**/
@:optional
var footerCenter : String;
/**
The text for the page's right footer. Default: '&D'.
Optional.
**/
@:optional
var footerRight : String;
};

View File

@@ -0,0 +1,136 @@
package webextension_polyfill.tabs;
typedef QueryQueryInfoType = {
/**
Whether the tabs are active in their windows.
Optional.
**/
@:optional
var active : Bool;
/**
Whether the tabs are drawing attention.
Optional.
**/
@:optional
var attention : Bool;
/**
Whether the tabs are pinned.
Optional.
**/
@:optional
var pinned : Bool;
/**
Whether the tabs are audible.
Optional.
**/
@:optional
var audible : Bool;
/**
Whether the tabs can be discarded automatically by the browser when resources are low.
Optional.
**/
@:optional
var autoDiscardable : Bool;
/**
Whether the tabs are muted.
Optional.
**/
@:optional
var muted : Bool;
/**
Whether the tabs are highlighted. Works as an alias of active.
Optional.
**/
@:optional
var highlighted : Bool;
/**
Whether the tabs are in the $(topic:current-window)[current window].
Optional.
**/
@:optional
var currentWindow : Bool;
/**
Whether the tabs are in the last focused window.
Optional.
**/
@:optional
var lastFocusedWindow : Bool;
/**
Whether the tabs have completed loading.
Optional.
**/
@:optional
var status : TabStatus;
/**
True while the tabs are not loaded with content.
Optional.
**/
@:optional
var discarded : Bool;
/**
True while the tabs are hidden.
Optional.
**/
@:optional
var hidden : Bool;
/**
Match page titles against a pattern.
Optional.
**/
@:optional
var title : String;
/**
Match tabs against one or more $(topic:match_patterns)[URL patterns]. Note that fragment identifiers are not matched.
Optional.
**/
@:optional
var url : ts.AnyOf2<String, Array<String>>;
/**
The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the $(topic:current-window)[current window].
Optional.
**/
@:optional
var windowId : Float;
/**
The type of window the tabs are in.
Optional.
**/
@:optional
var windowType : WindowType;
/**
The position of the tabs within their windows.
Optional.
**/
@:optional
var index : Float;
/**
The CookieStoreId used for the tab.
Optional.
**/
@:optional
var cookieStoreId : ts.AnyOf2<String, Array<String>>;
/**
The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab.
Optional.
**/
@:optional
var openerTabId : Float;
/**
True for any screen sharing, or a string to specify type of screen sharing.
Optional.
**/
@:optional
var screen : ts.AnyOf2<Bool, String>;
/**
True if the tab is using the camera.
Optional.
**/
@:optional
var camera : Bool;
/**
True if the tab is using the microphone.
Optional.
**/
@:optional
var microphone : Bool;
};

View File

@@ -0,0 +1,10 @@
package webextension_polyfill.tabs;
typedef ReloadReloadPropertiesType = {
/**
Whether using any local cache. Default is false.
Optional.
**/
@:optional
var bypassCache : Bool;
};

View File

@@ -0,0 +1,11 @@
package webextension_polyfill.tabs;
typedef SendMessageOptionsType = {
/**
Send a message to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code>
instead of all frames in the tab.
Optional.
**/
@:optional
var frameId : Float;
};

View File

@@ -0,0 +1,22 @@
package webextension_polyfill.tabs;
/**
Tab sharing state for screen, microphone and camera.
**/
typedef SharingState = {
/**
If the tab is sharing the screen the value will be one of "Screen", "Window", or "Application",
or undefined if not screen sharing.
Optional.
**/
@:optional
var screen : String;
/**
True if the tab is using the camera.
**/
var camera : Bool;
/**
True if the tab is using the microphone.
**/
var microphone : Bool;
};

View File

@@ -0,0 +1,219 @@
package webextension_polyfill.tabs;
typedef Static = {
/**
Retrieves details about the specified tab.
**/
function get(tabId:Float):js.lib.Promise<Tab>;
/**
Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a
background page or popup view).
**/
function getCurrent():js.lib.Promise<Tab>;
/**
Connects to the content script(s) in the specified tab. The $(ref:runtime.onConnect)
event is fired in each content script running in the specified tab for the current extension. For more details,
see $(topic:messaging)[Content Script Messaging].
**/
function connect(tabId:Float, ?connectInfo:ConnectConnectInfoType):webextension_polyfill.runtime.Port;
/**
Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response
is sent back. The $(ref:runtime.onMessage) event is fired in each content script running in the specified tab for the
current extension.
**/
function sendMessage(tabId:Float, message:Dynamic, ?options:SendMessageOptionsType):js.lib.Promise<Dynamic>;
/**
Creates a new tab.
**/
function create(createProperties:CreateCreatePropertiesType):js.lib.Promise<Tab>;
/**
Duplicates a tab.
**/
function duplicate(tabId:Float, ?duplicateProperties:DuplicateDuplicatePropertiesType):js.lib.Promise<Tab>;
/**
Gets all tabs that have the specified properties, or all tabs if no properties are specified.
**/
function query(queryInfo:QueryQueryInfoType):js.lib.Promise<Array<Tab>>;
/**
Highlights the given tabs.
**/
function highlight(highlightInfo:HighlightHighlightInfoType):js.lib.Promise<webextension_polyfill.windows.Window>;
/**
Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified.
Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified.
**/
@:overload(function(updateProperties:UpdateUpdatePropertiesType):js.lib.Promise<Tab> { })
function update(tabId:Null<Float>, updateProperties:UpdateUpdatePropertiesType):js.lib.Promise<Tab>;
/**
Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and
from normal (window.type === "normal") windows.
**/
function move(tabIds:ts.AnyOf2<Float, Array<Float>>, moveProperties:MoveMovePropertiesType):js.lib.Promise<ts.AnyOf2<Tab, Array<Tab>>>;
/**
Reload a tab.
**/
function reload(?tabId:Float, ?reloadProperties:ReloadReloadPropertiesType):js.lib.Promise<ts.Undefined>;
/**
Warm up a tab
**/
function warmup(tabId:Float):Void;
/**
Closes one or more tabs.
**/
function remove(tabIds:ts.AnyOf2<Float, Array<Float>>):js.lib.Promise<ts.Undefined>;
/**
discards one or more tabs.
**/
function discard(tabIds:ts.AnyOf2<Float, Array<Float>>):js.lib.Promise<ts.Undefined>;
/**
Detects the primary language of the content in a tab.
**/
function detectLanguage(?tabId:Float):js.lib.Promise<String>;
/**
Toggles reader mode for the document in the tab.
**/
function toggleReaderMode(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Captures an area of a specified tab. You must have $(topic:declare_permissions)[&lt;all_urls&gt;]
permission to use this method.
**/
function captureTab(?tabId:Float, ?options:webextension_polyfill.extensiontypes.ImageDetails):js.lib.Promise<String>;
/**
Captures an area of the currently active tab in the specified window. You must have $(topic:declare_permissions)
[&lt;all_urls&gt;] permission to use this method.
**/
function captureVisibleTab(?windowId:Float, ?options:webextension_polyfill.extensiontypes.ImageDetails):js.lib.Promise<String>;
/**
Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection]
section of the content scripts doc.
Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection]
section of the content scripts doc.
**/
@:overload(function(details:webextension_polyfill.extensiontypes.InjectDetails):js.lib.Promise<Array<Dynamic>> { })
function executeScript(tabId:Null<Float>, details:webextension_polyfill.extensiontypes.InjectDetails):js.lib.Promise<Array<Dynamic>>;
/**
Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection]
section of the content scripts doc.
Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection]
section of the content scripts doc.
**/
@:overload(function(details:webextension_polyfill.extensiontypes.InjectDetails):js.lib.Promise<ts.Undefined> { })
function insertCSS(tabId:Null<Float>, details:webextension_polyfill.extensiontypes.InjectDetails):js.lib.Promise<ts.Undefined>;
/**
Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection]
section of the content scripts doc.
Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection]
section of the content scripts doc.
**/
@:overload(function(details:webextension_polyfill.extensiontypes.InjectDetails):js.lib.Promise<ts.Undefined> { })
function removeCSS(tabId:Null<Float>, details:webextension_polyfill.extensiontypes.InjectDetails):js.lib.Promise<ts.Undefined>;
/**
Zooms a specified tab.
Zooms a specified tab.
**/
@:overload(function(zoomFactor:Float):js.lib.Promise<ts.Undefined> { })
function setZoom(tabId:Null<Float>, zoomFactor:Float):js.lib.Promise<ts.Undefined>;
/**
Gets the current zoom factor of a specified tab.
**/
function getZoom(?tabId:Float):js.lib.Promise<Float>;
/**
Sets the zoom settings for a specified tab, which define how zoom changes are handled.
These settings are reset to defaults upon navigating the tab.
Sets the zoom settings for a specified tab, which define how zoom changes are handled.
These settings are reset to defaults upon navigating the tab.
**/
@:overload(function(zoomSettings:ZoomSettings):js.lib.Promise<ts.Undefined> { })
function setZoomSettings(tabId:Null<Float>, zoomSettings:ZoomSettings):js.lib.Promise<ts.Undefined>;
/**
Gets the current zoom settings of a specified tab.
**/
function getZoomSettings(?tabId:Float):js.lib.Promise<ZoomSettings>;
/**
Prints page in active tab.
**/
function print():Void;
/**
Shows print preview for page in active tab.
**/
function printPreview():js.lib.Promise<ts.Undefined>;
/**
Saves page in active tab as a PDF file.
**/
function saveAsPDF(pageSettings:PageSettings):js.lib.Promise<String>;
/**
Shows one or more tabs.
**/
function show(tabIds:ts.AnyOf2<Float, Array<Float>>):js.lib.Promise<ts.Undefined>;
/**
Hides one or more tabs. The <code>"tabHide"</code> permission is required to hide tabs. Not all tabs are hidable.
Returns an array of hidden tabs.
**/
function hide(tabIds:ts.AnyOf2<Float, Array<Float>>):js.lib.Promise<Array<Float>>;
/**
Removes an array of tabs from their lines of succession and prepends or appends them in a chain to another tab.
**/
function moveInSuccession(tabIds:Array<Float>, ?tabId:Float, ?options:MoveInSuccessionOptionsType):Void;
/**
Navigate to next page in tab's history, if available
**/
function goForward(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Navigate to previous page in tab's history, if available.
**/
function goBack(?tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired,
but you can listen to onUpdated events to be notified when a URL is set.
**/
var onCreated : webextension_polyfill.events.Event<(tab:Tab) -> Void>;
/**
Fired when a tab is updated.
**/
var onUpdated : OnUpdatedEvent;
/**
Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved.
Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved
between windows. For that, see $(ref:tabs.onDetached).
**/
var onMoved : webextension_polyfill.events.Event<(tabId:Float, moveInfo:OnMovedMoveInfoType) -> Void>;
/**
Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired,
but you can listen to onUpdated events to be notified when a URL is set.
**/
var onActivated : webextension_polyfill.events.Event<(activeInfo:OnActivatedActiveInfoType) -> Void>;
/**
Fired when the highlighted or selected tabs in a window changes.
**/
var onHighlighted : webextension_polyfill.events.Event<(highlightInfo:OnHighlightedHighlightInfoType) -> Void>;
/**
Fired when a tab is detached from a window, for example because it is being moved between windows.
**/
var onDetached : webextension_polyfill.events.Event<(tabId:Float, detachInfo:OnDetachedDetachInfoType) -> Void>;
/**
Fired when a tab is attached to a window, for example because it was moved between windows.
**/
var onAttached : webextension_polyfill.events.Event<(tabId:Float, attachInfo:OnAttachedAttachInfoType) -> Void>;
/**
Fired when a tab is closed.
**/
var onRemoved : webextension_polyfill.events.Event<(tabId:Float, removeInfo:OnRemovedRemoveInfoType) -> Void>;
/**
Fired when a tab is replaced with another tab due to prerendering or instant.
**/
var onReplaced : webextension_polyfill.events.Event<(addedTabId:Float, removedTabId:Float) -> Void>;
/**
Fired when a tab is zoomed.
**/
var onZoomChange : webextension_polyfill.events.Event<(ZoomChangeInfo:OnZoomChangeZoomChangeInfoType) -> Void>;
/**
An ID which represents the absence of a browser tab.
**/
var TAB_ID_NONE : Int;
};

View File

@@ -0,0 +1,169 @@
package webextension_polyfill.tabs;
typedef Tab = {
/**
The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID,
for example when querying foreign tabs using the $(ref:sessions) API, in which case a session ID may be present.
Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows.
Optional.
**/
@:optional
var id : Float;
/**
The zero-based index of the tab within its window.
**/
var index : Float;
/**
The ID of the window the tab is contained within.
Optional.
**/
@:optional
var windowId : Float;
/**
The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists.
Optional.
**/
@:optional
var openerTabId : Float;
/**
Whether the tab is highlighted. Works as an alias of active
**/
var highlighted : Bool;
/**
Whether the tab is active in its window. (Does not necessarily mean the window is focused.)
**/
var active : Bool;
/**
Whether the tab is pinned.
**/
var pinned : Bool;
/**
The last time the tab was accessed as the number of milliseconds since epoch.
Optional.
**/
@:optional
var lastAccessed : Float;
/**
Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted).
Equivalent to whether the speaker audio indicator is showing.
Optional.
**/
@:optional
var audible : Bool;
/**
Whether the tab can be discarded automatically by the browser when resources are low.
Optional.
**/
@:optional
var autoDiscardable : Bool;
/**
Current tab muted state and the reason for the last state change.
Optional.
**/
@:optional
var mutedInfo : MutedInfo;
/**
The URL the tab is displaying. This property is only present if the extension's manifest includes the <code>"tabs"</code>
permission.
Optional.
**/
@:optional
var url : String;
/**
The title of the tab. This property is only present if the extension's manifest includes the <code>"tabs"</code>
permission.
Optional.
**/
@:optional
var title : String;
/**
The URL of the tab's favicon. This property is only present if the extension's manifest includes the <code>"tabs"</code>
permission. It may also be an empty string if the tab is loading.
Optional.
**/
@:optional
var favIconUrl : String;
/**
Either <em>loading</em> or <em>complete</em>.
Optional.
**/
@:optional
var status : String;
/**
True while the tab is not loaded with content.
Optional.
**/
@:optional
var discarded : Bool;
/**
Whether the tab is in an incognito window.
**/
var incognito : Bool;
/**
The width of the tab in pixels.
Optional.
**/
@:optional
var width : Float;
/**
The height of the tab in pixels.
Optional.
**/
@:optional
var height : Float;
/**
True if the tab is hidden.
Optional.
**/
@:optional
var hidden : Bool;
/**
The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API.
Optional.
**/
@:optional
var sessionId : String;
/**
The CookieStoreId used for the tab.
Optional.
**/
@:optional
var cookieStoreId : String;
/**
Whether the document in the tab can be rendered in reader mode.
Optional.
**/
@:optional
var isArticle : Bool;
/**
Whether the document in the tab is being rendered in reader mode.
Optional.
**/
@:optional
var isInReaderMode : Bool;
/**
Current tab sharing state for screen, microphone and camera.
Optional.
**/
@:optional
var sharingState : SharingState;
/**
Whether the tab is drawing attention.
Optional.
**/
@:optional
var attention : Bool;
/**
The ID of this tab's successor, if any; $(ref:tabs.TAB_ID_NONE) otherwise.
Optional.
**/
@:optional
var successorTabId : Float;
/**
The URL the tab is navigating to, before it has committed. This property is only present if the extension's manifest
includes the "tabs" permission and there is a pending navigation.
Optional.
**/
@:optional
var pendingUrl : String;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.tabs;
/**
Whether the tabs have completed loading.
**/
typedef TabStatus = String;

View File

@@ -0,0 +1,30 @@
package webextension_polyfill.tabs;
/**
An object describing filters to apply to tabs.onUpdated events.
**/
typedef UpdateFilter = {
/**
A list of URLs or URL patterns. Events that cannot match any of the URLs will be filtered out.
Filtering with urls requires the <code>"tabs"</code> or <code>"activeTab"</code> permission.
Optional.
**/
@:optional
var urls : Array<String>;
/**
A list of property names. Events that do not match any of the names will be filtered out.
Optional.
**/
@:optional
var properties : Array<UpdatePropertyName>;
/**
Optional.
**/
@:optional
var tabId : Float;
/**
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.tabs;
/**
Event names supported in onUpdated.
**/
typedef UpdatePropertyName = String;

View File

@@ -0,0 +1,58 @@
package webextension_polyfill.tabs;
typedef UpdateUpdatePropertiesType = {
/**
A URL to navigate the tab to.
Optional.
**/
@:optional
var url : String;
/**
Whether the tab should be active. Does not affect whether the window is focused (see $(ref:windows.update)).
Optional.
**/
@:optional
var active : Bool;
/**
Whether the tab should be discarded automatically by the browser when resources are low.
Optional.
**/
@:optional
var autoDiscardable : Bool;
/**
Adds or removes the tab from the current selection.
Optional.
**/
@:optional
var highlighted : Bool;
/**
Whether the tab should be pinned.
Optional.
**/
@:optional
var pinned : Bool;
/**
Whether the tab should be muted.
Optional.
**/
@:optional
var muted : Bool;
/**
The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab.
Optional.
**/
@:optional
var openerTabId : Float;
/**
Whether the load should replace the current history entry for the tab.
Optional.
**/
@:optional
var loadReplace : Bool;
/**
The ID of this tab's successor. If specified, the successor tab must be in the same window as this tab.
Optional.
**/
@:optional
var successorTabId : Float;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.tabs;
/**
The type of window.
**/
typedef WindowType = String;

View File

@@ -0,0 +1,27 @@
package webextension_polyfill.tabs;
/**
Defines how zoom changes in a tab are handled and at what scope.
**/
typedef ZoomSettings = {
/**
Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to
<code>automatic</code>.
Optional.
**/
@:optional
var mode : ZoomSettingsMode;
/**
Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>
per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.
Optional.
**/
@:optional
var scope : ZoomSettingsScope;
/**
Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings.
Optional.
**/
@:optional
var defaultZoomFactor : Float;
};

View File

@@ -0,0 +1,15 @@
package webextension_polyfill.tabs;
/**
Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to
<code>automatic</code>.
"automatic": Zoom changes are handled automatically by the browser.
"manual": Overrides the automatic handling of zoom changes. The <code>onZoomChange</code> event will still be dispatched,
and it is the responsibility of the extension to listen for this event and manually scale the page.
This mode does not support <code>per-origin</code> zooming, and will thus ignore the <code>scope</code>
zoom setting and assume <code>per-tab</code>.
"disabled": Disables all zooming in the tab. The tab will revert to the default zoom level,
and all attempted zoom changes will be ignored.
**/
typedef ZoomSettingsMode = String;

View File

@@ -0,0 +1,15 @@
package webextension_polyfill.tabs;
/**
Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>
per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.
"per-origin": Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin
will be zoomed as well. Moreover, <code>per-origin</code> zoom changes are saved with the origin,
meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor.
The <code>per-origin</code> scope is only available in the <code>automatic</code> mode.
"per-tab": Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this
tab. Also, <code>per-tab</code> zoom changes are reset on navigation; navigating a tab will always load pages with their
<code>per-origin</code> zoom factors.
**/
typedef ZoomSettingsScope = String;