add firefox extension template

This commit is contained in:
2025-08-07 16:03:16 -05:00
parent 6cbb29fed1
commit 5df289ffcb
586 changed files with 13636 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package webextension_polyfill.sidebaraction;
typedef GetPanelDetailsType = {
/**
Specify the tab to get the panel from. If no tab nor window is specified, the global panel is returned.
Optional.
**/
@:optional
var tabId : Float;
/**
Specify the window to get the panel from. If no tab nor window is specified, the global panel is returned.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,16 @@
package webextension_polyfill.sidebaraction;
typedef GetTitleDetailsType = {
/**
Specify the tab to get the title from. If no tab nor window is specified, the global title is returned.
Optional.
**/
@:optional
var tabId : Float;
/**
Specify the window to get the title from. If no tab nor window is specified, the global title is returned.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.sidebaraction;
/**
Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element).
**/
typedef ImageDataType = {
/**
Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
**/
final data : js.lib.Uint8ClampedArray;
/**
Returns the actual dimensions of the data in the ImageData object, in pixels.
**/
final height : Float;
/**
Returns the actual dimensions of the data in the ImageData object, in pixels.
**/
final width : Float;
};

View File

@@ -0,0 +1,10 @@
package webextension_polyfill.sidebaraction;
typedef IsOpenDetailsType = {
/**
Specify the window to get the openness from.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,37 @@
package webextension_polyfill.sidebaraction;
typedef SetIconDetailsType = {
/**
Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set.
If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density.
If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>
scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported.
At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.
imageData = {'19': foo}'
Optional.
**/
@:optional
var imageData : ts.AnyOf2<ImageDataType, haxe.DynamicAccess<ImageDataType>>;
/**
Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set.
If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density.
If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>
scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported.
At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'
Optional.
**/
@:optional
var path : ts.AnyOf2<String, SetIconDetailsTypePathC2Type>;
/**
Sets the sidebar icon for the tab specified by tabId. Automatically resets when the tab is closed.
Optional.
**/
@:optional
var tabId : Float;
/**
Sets the sidebar icon for the window specified by windowId.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.sidebaraction;
typedef SetIconDetailsTypePathC2Type = { };

View File

@@ -0,0 +1,20 @@
package webextension_polyfill.sidebaraction;
typedef SetPanelDetailsType = {
/**
Sets the sidebar url for the tab specified by tabId. Automatically resets when the tab is closed.
Optional.
**/
@:optional
var tabId : Float;
/**
Sets the sidebar url for the window specified by windowId.
Optional.
**/
@:optional
var windowId : Float;
/**
The url to the html file to show in a sidebar. If set to the empty string (''), no sidebar is shown.
**/
var panel : Null<String>;
};

View File

@@ -0,0 +1,20 @@
package webextension_polyfill.sidebaraction;
typedef SetTitleDetailsType = {
/**
The string the sidebar action should display when moused over.
**/
var title : Null<String>;
/**
Sets the sidebar title for the tab specified by tabId. Automatically resets when the tab is closed.
Optional.
**/
@:optional
var tabId : Float;
/**
Sets the sidebar title for the window specified by windowId.
Optional.
**/
@:optional
var windowId : Float;
};

View File

@@ -0,0 +1,42 @@
package webextension_polyfill.sidebaraction;
typedef Static = {
/**
Sets the title of the sidebar action. This shows up in the tooltip.
**/
function setTitle(details:SetTitleDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the title of the sidebar action.
**/
function getTitle(details:GetTitleDetailsType):js.lib.Promise<String>;
/**
Sets the icon for the sidebar action. The icon can be specified either as the path to an image file or as the pixel data
from a canvas element, or as dictionary of either one of those. Either the <strong>path</strong> or the <strong>
imageData</strong> property must be specified.
**/
function setIcon(details:SetIconDetailsType):js.lib.Promise<ts.Undefined>;
/**
Sets the url to the html document to be opened in the sidebar when the user clicks on the sidebar action's icon.
**/
function setPanel(details:SetPanelDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the url to the html document set as the panel for this sidebar action.
**/
function getPanel(details:GetPanelDetailsType):js.lib.Promise<String>;
/**
Opens the extension sidebar in the active window.
**/
function open():js.lib.Promise<ts.Undefined>;
/**
Closes the extension sidebar in the active window if the sidebar belongs to the extension.
**/
function close():js.lib.Promise<ts.Undefined>;
/**
Toggles the extension sidebar in the active window.
**/
function toggle():Void;
/**
Checks whether the sidebar action is open.
**/
function isOpen(details:IsOpenDetailsType):js.lib.Promise<Bool>;
};