update template
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
/**
|
||||
Search parameters.
|
||||
**/
|
||||
typedef FindParamsType = {
|
||||
/**
|
||||
Tab to query. Defaults to the active tab.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var tabId : Float;
|
||||
/**
|
||||
Find only ranges with case sensitive match.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var caseSensitive : Bool;
|
||||
/**
|
||||
Find only ranges with diacritic sensitive match.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var matchDiacritics : Bool;
|
||||
/**
|
||||
Find only ranges that match entire word.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var entireWord : Bool;
|
||||
/**
|
||||
Return rectangle data which describes visual position of search results.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var includeRectData : Bool;
|
||||
/**
|
||||
Return range data which provides range data in a serializable form.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var includeRangeData : Bool;
|
||||
};
|
26
template/externs/webextension_polyfill/find/FindResult.hx
Normal file
26
template/externs/webextension_polyfill/find/FindResult.hx
Normal file
@@ -0,0 +1,26 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
typedef FindResult = {
|
||||
/**
|
||||
The number of results found.
|
||||
**/
|
||||
var count : Float;
|
||||
/**
|
||||
If includeRangeData was given in the options parameter, then this property will be included.
|
||||
It is provided as an array of RangeData objects, one for each match. Each RangeData object describes where in the DOM
|
||||
tree the match was found. This would enable, for example, an extension to get the text surrounding each match,
|
||||
so as to display context for the matches. The items correspond to the items given in rectData, so rangeData[i]
|
||||
describes the same match as rectData[i].
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var rangeData : Array<RangeData>;
|
||||
/**
|
||||
If includeRectData was given in the options parameter, then this property will be included.
|
||||
It is an array of RectData objects. It contains client rectangles for all the text matched in the search,
|
||||
relative to the top-left of the viewport. Extensions can use this to provide custom highlighting of the results.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var rectData : Array<RectData>;
|
||||
};
|
@@ -0,0 +1,25 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
/**
|
||||
highlightResults parameters
|
||||
**/
|
||||
typedef HighlightResultsParamsType = {
|
||||
/**
|
||||
Found range to be highlighted. Default highlights all ranges.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var rangeIndex : Float;
|
||||
/**
|
||||
Tab to highlight. Defaults to the active tab.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var tabId : Float;
|
||||
/**
|
||||
Don't scroll to highlighted item.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var noScroll : Bool;
|
||||
};
|
28
template/externs/webextension_polyfill/find/RangeData.hx
Normal file
28
template/externs/webextension_polyfill/find/RangeData.hx
Normal file
@@ -0,0 +1,28 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
typedef RangeData = {
|
||||
/**
|
||||
The index of the frame containing the match. 0 corresponds to the parent window. Note that the order of objects in the
|
||||
rangeData array will sequentially line up with the order of frame indexes: for example,
|
||||
framePos for the first sequence of rangeData objects will be 0, framePos for the next sequence will be 1, and so on.
|
||||
**/
|
||||
var framePos : Float;
|
||||
/**
|
||||
The ordinal position of the text node in which the match started.
|
||||
**/
|
||||
var startTextNodePos : Float;
|
||||
/**
|
||||
The ordinal position of the text node in which the match ended.
|
||||
**/
|
||||
var endTextNodePos : Float;
|
||||
/**
|
||||
The ordinal string position of the start of the matched word within start text node.
|
||||
If match word include in single text node, Extension can get match word between startOffset and endOffset string index
|
||||
in the single text node.
|
||||
**/
|
||||
var startOffset : Float;
|
||||
/**
|
||||
The ordinal string position of the end of the matched word within end text node.
|
||||
**/
|
||||
var endOffset : Float;
|
||||
};
|
14
template/externs/webextension_polyfill/find/RectData.hx
Normal file
14
template/externs/webextension_polyfill/find/RectData.hx
Normal file
@@ -0,0 +1,14 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
typedef RectData = {
|
||||
/**
|
||||
The index of the frame containing the match. 0 corresponds to the parent window. Note that the order of objects in the
|
||||
rangeData array will sequentially line up with the order of frame indexes: for example,
|
||||
framePos for the first sequence of rangeData objects will be 0, framePos for the next sequence will be 1, and so on.
|
||||
**/
|
||||
var rectsAndTexts : RectsAndTexts;
|
||||
/**
|
||||
The complete text of the match.
|
||||
**/
|
||||
var text : String;
|
||||
};
|
20
template/externs/webextension_polyfill/find/Rectangle.hx
Normal file
20
template/externs/webextension_polyfill/find/Rectangle.hx
Normal file
@@ -0,0 +1,20 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
typedef Rectangle = {
|
||||
/**
|
||||
Pixels from the top.
|
||||
**/
|
||||
var top : Float;
|
||||
/**
|
||||
Pixels from the left.
|
||||
**/
|
||||
var left : Float;
|
||||
/**
|
||||
Pixels from the bottom.
|
||||
**/
|
||||
var bottom : Float;
|
||||
/**
|
||||
Pixels from the right.
|
||||
**/
|
||||
var right : Float;
|
||||
};
|
13
template/externs/webextension_polyfill/find/RectsAndTexts.hx
Normal file
13
template/externs/webextension_polyfill/find/RectsAndTexts.hx
Normal file
@@ -0,0 +1,13 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
typedef RectsAndTexts = {
|
||||
/**
|
||||
Rectangles relative to the top-left of the viewport.
|
||||
**/
|
||||
var rectList : Array<Rectangle>;
|
||||
/**
|
||||
an array of strings, corresponding to the rectList array. The entry at textList[i]
|
||||
contains the part of the match bounded by the rectangle at rectList[i].
|
||||
**/
|
||||
var textList : Array<String>;
|
||||
};
|
16
template/externs/webextension_polyfill/find/Static.hx
Normal file
16
template/externs/webextension_polyfill/find/Static.hx
Normal file
@@ -0,0 +1,16 @@
|
||||
package webextension_polyfill.find;
|
||||
|
||||
typedef Static = {
|
||||
/**
|
||||
Search for text in document and store found ranges in array, in document order.
|
||||
**/
|
||||
function find(queryphrase:String, ?params:FindParamsType):js.lib.Promise<FindResult>;
|
||||
/**
|
||||
Highlight a range
|
||||
**/
|
||||
function highlightResults(?params:HighlightResultsParamsType):js.lib.Promise<ts.Undefined>;
|
||||
/**
|
||||
Remove all highlighting from previous searches.
|
||||
**/
|
||||
function removeHighlighting(?tabId:Float):js.lib.Promise<ts.Undefined>;
|
||||
};
|
Reference in New Issue
Block a user