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,8 @@
package webextension_polyfill.pageaction;
typedef GetPopupDetailsType = {
/**
Specify the tab to get the popup from.
**/
var tabId : Float;
};

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.pageaction;
typedef GetTitleDetailsType = {
/**
Specify the tab to get the title from.
**/
var tabId : Float;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.pageaction;
/**
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,8 @@
package webextension_polyfill.pageaction;
typedef IsShownDetailsType = {
/**
Specify the tab to get the shownness from.
**/
var tabId : Float;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.pageaction;
/**
Information sent when a page action is clicked.
**/
typedef OnClickData = {
/**
An array of keyboard modifiers that were held while the menu item was clicked.
**/
var modifiers : Array<webextension_polyfill.action.OnClickDataModifiersItemEnum>;
/**
An integer value of button by which menu item was clicked.
Optional.
**/
@:optional
var button : Float;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.pageaction;
typedef OnClickDataModifiersItemEnum = webextension_polyfill.action.OnClickDataModifiersItemEnum;

View File

@@ -0,0 +1,29 @@
package webextension_polyfill.pageaction;
typedef SetIconDetailsType = {
/**
The id of the tab for which you want to modify the page action.
**/
var tabId : Float;
/**
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, haxe.DynamicAccess<String>>;
};

View File

@@ -0,0 +1,12 @@
package webextension_polyfill.pageaction;
typedef SetPopupDetailsType = {
/**
The id of the tab for which you want to modify the page action.
**/
var tabId : Float;
/**
The html file to show in a popup. If set to the empty string (''), no popup is shown.
**/
var popup : Null<String>;
};

View File

@@ -0,0 +1,12 @@
package webextension_polyfill.pageaction;
typedef SetTitleDetailsType = {
/**
The id of the tab for which you want to modify the page action.
**/
var tabId : Float;
/**
The tooltip string.
**/
var title : Null<String>;
};

View File

@@ -0,0 +1,46 @@
package webextension_polyfill.pageaction;
typedef Static = {
/**
Shows the page action. The page action is shown whenever the tab is selected.
**/
function show(tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Hides the page action.
**/
function hide(tabId:Float):js.lib.Promise<ts.Undefined>;
/**
Checks whether the page action is shown.
**/
function isShown(details:IsShownDetailsType):js.lib.Promise<Bool>;
/**
Sets the title of the page action. This is displayed in a tooltip over the page action.
**/
function setTitle(details:SetTitleDetailsType):Void;
/**
Gets the title of the page action.
**/
function getTitle(details:GetTitleDetailsType):js.lib.Promise<String>;
/**
Sets the icon for the page 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 <b>path</b> or the <b>imageData</b>
property must be specified.
**/
function setIcon(details:SetIconDetailsType):js.lib.Promise<ts.Undefined>;
/**
Sets the html document to be opened as a popup when the user clicks on the page action's icon.
**/
function setPopup(details:SetPopupDetailsType):js.lib.Promise<ts.Undefined>;
/**
Gets the html document set as the popup for this page action.
**/
function getPopup(details:GetPopupDetailsType):js.lib.Promise<String>;
/**
Opens the extension page action in the active window.
**/
function openPopup():js.lib.Promise<ts.Undefined>;
/**
Fired when a page action icon is clicked. This event will not fire if the page action has a popup.
**/
var onClicked : webextension_polyfill.events.Event<(tab:webextension_polyfill.tabs.Tab, info:Null<OnClickData>) -> Void>;
};