v3 new release (#84)

swap to graphql
This commit is contained in:
github-actions[bot]
2022-07-11 13:48:02 -04:00
committed by GitHub
parent 20d2b4f98d
commit e4f3964f67
1492 changed files with 63799 additions and 63001 deletions

17
node_modules/nwsapi/package.json generated vendored
View File

@ -1,6 +1,6 @@
{
"name": "nwsapi",
"version": "2.2.0",
"version": "2.2.1",
"description": "Fast CSS Selectors API Engine",
"homepage": "http://javascript.nwbox.com/nwsapi/",
"main": "./src/nwsapi",
@ -18,9 +18,17 @@
}
],
"license": "MIT",
"author": "Diego Perini <diego.perini@gmail.com> (http://www.iport.it/)",
"author": {
"name": "Diego Perini",
"email": "diego.perini@gmail.com",
"web": "http://www.iport.it/"
},
"maintainers": [
"Diego Perini <diego.perini@gmail.com> (http://www.iport.it/)"
{
"name": "Diego Perini",
"email": "diego.perini@gmail.com",
"web": "http://www.iport.it/"
}
],
"bugs": {
"url": "http://github.com/dperini/nwsapi/issues"
@ -31,8 +39,5 @@
},
"scripts": {
"lint": "eslint ./src/nwsapi.js"
},
"directories": {
"test": "test"
}
}

189
node_modules/nwsapi/src/nwsapi.js generated vendored
View File

@ -5,9 +5,9 @@
* nwsapi.js - Fast CSS Selectors API Engine
*
* Author: Diego Perini <diego.perini at gmail com>
* Version: 2.2.0
* Version: 2.2.1
* Created: 20070722
* Release: 20191102
* Release: 20220622
*
* License:
* http://javascript.nwbox.com/nwsapi/MIT-LICENSE
@ -30,7 +30,7 @@
})(this, function Factory(global, Export) {
var version = 'nwsapi-2.2.0',
var version = 'nwsapi-2.2.1',
doc = global.document,
root = doc.documentElement,
@ -76,10 +76,10 @@
GROUPS = {
// pseudo-classes requiring parameters
linguistic: '(dir|lang)\\x28\\s?([-\\w]{2,})\\s?(?:\\x29|$)',
logicalsel: '(matches|not)\\x28\\s?([^()]*|[^\\x28]*\\x28[^\\x29]*\\x29)\\s?(?:\\x29|$)',
logicalsel: '(is|where|matches|not)\\x28\\s?([^()]*|[^\\x28]*\\x28[^\\x29]*\\x29)\\s?(?:\\x29|$)',
treestruct: '(nth(?:-last)?(?:-child|-of-type))(?:\\x28\\s?(even|odd|(?:[-+]?\\d*)(?:n\\s?[-+]?\\s?\\d*)?)\\s?(?:\\x29|$))',
// pseudo-classes not requiring parameters
locationpc: '(link|visited|target)\\b',
locationpc: '(any-link|link|visited|target)\\b',
useraction: '(hover|active|focus|focus-within)\\b',
structural: '(root|empty|(?:(?:first|last|only)(?:-child|-of-type)))\\b',
inputstate: '(enabled|disabled|read-only|read-write|placeholder-shown|default)\\b',
@ -327,7 +327,7 @@
method = {
'#': 'getElementById',
'*': 'getElementsByTagName',
'*': 'getElementsByTagNameNS',
'.': 'getElementsByClassName'
},
@ -383,18 +383,18 @@
var e, nodes, api = method['*'];
// DOCUMENT_NODE (9) & ELEMENT_NODE (1)
if (api in context) {
return slice.call(context[api](tag));
return slice.call(context[api]('*', tag));
} else {
tag = tag.toLowerCase();
// DOCUMENT_FRAGMENT_NODE (11)
if ((e = context.firstElementChild)) {
tag = tag.toLowerCase();
if (!(e.nextElementSibling || tag == '*' || e.nodeName.toLowerCase() == tag)) {
return slice.call(e[api](tag));
if (!(e.nextElementSibling || tag == '*' || e.localName == tag)) {
return slice.call(e[api]('*', tag));
} else {
nodes = [ ];
do {
if (tag == '*' || e.nodeName.toLowerCase() == tag) nodes[nodes.length] = e;
concatList(nodes, e[api](tag));
if (tag == '*' || e.localName == tag) nodes[nodes.length] = e;
concatList(nodes, e[api]('*', tag));
} while ((e = e.nextElementSibling));
}
} else nodes = none;
@ -492,7 +492,7 @@
parents.length = 0; parent = undefined;
return -1;
}
var e, i, j, k, l, name = element.nodeName;
var e, i, j, k, l, name = element.localName;
if (nodes[set] && nodes[set][name] && parent === element.parentElement) {
i = set; j = idx; l = len;
} else {
@ -507,7 +507,7 @@
nodes[i] || (nodes[i] = Object());
l = 0; nodes[i][name] = Array();
e = parent && parent.firstElementChild || element;
while (e) { if (e === element) j = l; if (e.nodeName == name) { nodes[i][name][l] = e; ++l; } e = e.nextElementSibling; }
while (e) { if (e === element) j = l; if (e.localName == name) { nodes[i][name][l] = e; ++l; } e = e.nextElementSibling; }
set = i; idx = j; len = l;
if (l < 2) return l;
} else {
@ -534,7 +534,7 @@
// contentType not in IE <= 11
'contentType' in doc ?
doc.contentType.indexOf('/html') > 0 :
doc.createElement('DiV').nodeName == 'DIV';
doc.createElement('DiV').localName == 'div';
},
// configure the engine to use special handling
@ -674,7 +674,7 @@
')+';
// the following global RE is used to return the
// deepest nodeName in selector strings and then
// deepest localName in selector strings and then
// use it to retrieve all possible matching nodes
// that will be filtered by compiled resolvers
reOptimizer = RegExp(
@ -750,7 +750,7 @@
break;
}
source = compileSelector(selector, macro, mode, callback, false);
source = compileSelector(selector, macro, mode, callback);
loop += mode || mode === null ? '{' + source + '}' : source;
@ -772,12 +772,11 @@
// build conditional code to check components of selector strings
compileSelector =
function(expression, source, mode, callback, not) {
function(expression, source, mode, callback) {
// N is the negation pseudo-class flag
// D is the default inverted negation flag
var a, b, n, f, i, l, name, nested, NS,
N = not ? '!' : '', D = not ? '' : '!',
var a, b, n, f, i, l, name, NS, N = '', D = '!',
compat, expr, match, result, status, symbol, test,
type, selector = expression, selector_string, vars;
@ -787,6 +786,10 @@
// isolate selector combinators/components and normalize whitespace
selector = selector.replace(STD.combinator, '$1');//.replace(STD.whitespace, ' ');
// javascript needs a label to break
// out of the while loops processing
selector_recursion_label:
while (selector) {
// get namespace prefix if present or get first char of selector
@ -819,11 +822,11 @@
break;
// tag name resolver
case (/[a-z]/i.test(symbol) ? symbol : undefined):
case (/[_a-z]/i.test(symbol) ? symbol : undefined):
match = selector.match(Patterns.tagName);
source = 'if(' + N + '(e.nodeName' +
source = 'if(' + N + '(e.localName' +
(Config.MIXEDCASE || hasMixedCaseTagNames(doc) ?
'.toLowerCase()=="' + match[1].toLowerCase() + '"' :
'=="' + match[1].toLowerCase() + '"' :
'=="' + match[1].toUpperCase() + '"') +
')){' + source + '}';
break;
@ -867,9 +870,9 @@
}
type = match[5] == 'i' || (HTML_DOCUMENT && HTML_TABLE[expr.toLowerCase()]) ? 'i' : '';
source = 'if(' + N + '(' +
(!match[2] ? (NS ? 's.hasAttributeNS(e,"' + name + '")' : 'e.hasAttribute("' + name + '")') :
!match[4] && ATTR_STD_OPS[match[2]] && match[2] != '~=' ? 'e.getAttribute("' + name + '")==""' :
'(/' + test.p1 + match[4] + test.p2 + '/' + type + ').test(e.getAttribute("' + name + '"))==' + test.p3) +
(!match[2] ? (NS ? 's.hasAttributeNS(e,"' + name + '")' : 'e.hasAttribute&&e.hasAttribute("' + name + '")') :
!match[4] && ATTR_STD_OPS[match[2]] && match[2] != '~=' ? 'e.getAttribute&&e.getAttribute("' + name + '")==""' :
'(/' + test.p1 + match[4] + test.p2 + '/' + type + ').test(e.getAttribute&&e.getAttribute("' + name + '"))==' + test.p3) +
')){' + source + '}';
break;
@ -936,15 +939,15 @@
// *** typed child-indexed pseudo-classes
// :only-of-type, :last-of-type, :first-of-type
case 'only-of-type':
source = 'o=e.nodeName;' +
'n=e;while((n=n.nextElementSibling)&&n.nodeName!=o);if(!n){' +
'n=e;while((n=n.previousElementSibling)&&n.nodeName!=o);}if(' + D + 'n){' + source + '}';
source = 'o=e.localName;' +
'n=e;while((n=n.nextElementSibling)&&n.localName!=o);if(!n){' +
'n=e;while((n=n.previousElementSibling)&&n.localName!=o);}if(' + D + 'n){' + source + '}';
break;
case 'last-of-type':
source = 'n=e;o=e.nodeName;while((n=n.nextElementSibling)&&n.nodeName!=o);if(' + D + 'n){' + source + '}';
source = 'n=e;o=e.localName;while((n=n.nextElementSibling)&&n.localName!=o);if(' + D + 'n){' + source + '}';
break;
case 'first-of-type':
source = 'n=e;o=e.nodeName;while((n=n.previousElementSibling)&&n.nodeName!=o);if(' + D + 'n){' + source + '}';
source = 'n=e;o=e.localName;while((n=n.previousElementSibling)&&n.localName!=o);if(' + D + 'n){' + source + '}';
break;
default:
emit('\'' + selector_string + '\'' + qsInvalid);
@ -969,8 +972,8 @@
break;
} else if (match[2] == '1') {
test = type ? 'next' : 'previous';
source = expr ? 'n=e;o=e.nodeName;' +
'while((n=n.' + test + 'ElementSibling)&&n.nodeName!=o);if(' + D + 'n){' + source + '}' :
source = expr ? 'n=e;o=e.localName;' +
'while((n=n.' + test + 'ElementSibling)&&n.localName!=o);if(' + D + 'n){' + source + '}' :
'if(' + N + '!e.' + test + 'ElementSibling){' + source + '}';
break;
} else if (match[2] == 'even' || match[2] == '2n0' || match[2] == '2n+0' || match[2] == '2n') {
@ -1004,34 +1007,19 @@
}
// *** logical combination pseudo-classes
// :matches( s1, [ s2, ... ]), :not( s1, [ s2, ... ])
// :is( s1, [ s2, ... ]), :not( s1, [ s2, ... ])
else if ((match = selector.match(Patterns.logicalsel))) {
match[1] = match[1].toLowerCase();
switch (match[1]) {
case 'is':
case 'where':
case 'matches':
if (not === true || nested === true) {
emit(':matches() pseudo-class cannot be nested');
}
nested = true;
expr = match[2].replace(REX.CommaGroup, ',').replace(REX.TrimSpaces, '');
// check nested compound selectors s1, s2
expr = match[2].match(REX.SplitGroup);
for (i = 0, l = expr.length; l > i; ++i) {
expr[i] = expr[i].replace(REX.TrimSpaces, '');
source = 'if(s.match("' + expr[i].replace(/\x22/g, '\\"') + '",e)){' + source + '}';
}
source = 'if(s.match("' + expr.replace(/\x22/g, '\\"') + '",e)){' + source + '}';
break;
case 'not':
if (not === true || nested === true) {
emit(':not() pseudo-class cannot be nested');
}
expr = match[2].replace(REX.CommaGroup, ',').replace(REX.TrimSpaces, '');
// check nested compound selectors s1, s2
expr = match[2].match(REX.SplitGroup);
for (i = 0, l = expr.length; l > i; ++i) {
expr[i] = expr[i].replace(REX.TrimSpaces, '');
source = compileSelector(expr[i], source, false, callback, true);
}
source = 'if(!s.match("' + expr.replace(/\x22/g, '\\"') + '",e)){' + source + '}';
break;
default:
emit('\'' + selector_string + '\'' + qsInvalid);
@ -1065,15 +1053,18 @@
}
// *** location pseudo-classes
// :link, :visited, :target
// :any-link, :link, :visited, :target
else if ((match = selector.match(Patterns.locationpc))) {
match[1] = match[1].toLowerCase();
switch (match[1]) {
case 'any-link':
source = 'if(' + N + '(/^a|area$/i.test(e.localName)&&e.hasAttribute("href")||e.visited)){' + source + '}';
break;
case 'link':
source = 'if(' + N + '(/^a|area|link$/i.test(e.nodeName)&&e.hasAttribute("href"))){' + source + '}';
source = 'if(' + N + '(/^a|area$/i.test(e.localName)&&e.hasAttribute("href"))){' + source + '}';
break;
case 'visited':
source = 'if(' + N + '(/^a|area|link$/i.test(e.nodeName)&&e.hasAttribute("href")&&e.visited)){' + source + '}';
source = 'if(' + N + '(/^a|area$/i.test(e.localName)&&e.hasAttribute("href")&&e.visited)){' + source + '}';
break;
case 'target':
source = 'if(' + N + '((s.doc.compareDocumentPosition(e)&16)&&s.doc.location.hash&&e.id==s.doc.location.hash.slice(1))){' + source + '}';
@ -1121,26 +1112,26 @@
match[1] = match[1].toLowerCase();
switch (match[1]) {
case 'enabled':
source = 'if(' + N + '(("form" in e||/^optgroup$/i.test(e.nodeName))&&"disabled" in e &&e.disabled===false' +
source = 'if(' + N + '(("form" in e||/^optgroup$/i.test(e.localName))&&"disabled" in e &&e.disabled===false' +
')){' + source + '}';
break;
case 'disabled':
// https://www.w3.org/TR/html5/forms.html#enabling-and-disabling-form-controls:-the-disabled-attribute
source = 'if(' + N + '(("form" in e||/^optgroup$/i.test(e.nodeName))&&"disabled" in e&&' +
source = 'if(' + N + '(("form" in e||/^optgroup$/i.test(e.localName))&&"disabled" in e&&' +
'(e.disabled===true||(n=s.ancestor("fieldset",e))&&(n=s.first("legend",n))&&!n.contains(e))' +
')){' + source + '}';
break;
case 'read-only':
source =
'if(' + N + '(' +
'(/^textarea$/i.test(e.nodeName)&&(e.readOnly||e.disabled))||' +
'(/^textarea$/i.test(e.localName)&&(e.readOnly||e.disabled))||' +
'("|password|text|".includes("|"+e.type+"|")&&e.readOnly)' +
')){' + source + '}';
break;
case 'read-write':
source =
'if(' + N + '(' +
'((/^textarea$/i.test(e.nodeName)&&!e.readOnly&&!e.disabled)||' +
'((/^textarea$/i.test(e.localName)&&!e.readOnly&&!e.disabled)||' +
'("|password|text|".includes("|"+e.type+"|")&&!e.readOnly&&!e.disabled))||' +
'(e.hasAttribute("contenteditable")||(s.doc.designMode=="on"))' +
')){' + source + '}';
@ -1148,7 +1139,7 @@
case 'placeholder-shown':
source =
'if(' + N + '(' +
'(/^input|textarea$/i.test(e.nodeName))&&e.hasAttribute("placeholder")&&' +
'(/^input|textarea$/i.test(e.localName))&&e.hasAttribute("placeholder")&&' +
'("|textarea|password|number|search|email|text|tel|url|".includes("|"+e.type+"|"))&&' +
'(!s.match(":focus",e))' +
')){' + source + '}';
@ -1166,7 +1157,7 @@
'}' +
'}' +
'if(' + N + '(e.form&&(e===n[x]&&"|image|submit|".includes("|"+e.type+"|"))||' +
'((/^option$/i.test(e.nodeName))&&e.defaultSelected)||' +
'((/^option$/i.test(e.localName))&&e.defaultSelected)||' +
'(("|radio|checkbox|".includes("|"+e.type+"|"))&&e.defaultChecked)' +
')){' + source + '}';
break;
@ -1182,50 +1173,50 @@
match[1] = match[1].toLowerCase();
switch (match[1]) {
case 'checked':
source = 'if(' + N + '(/^input$/i.test(e.nodeName)&&' +
source = 'if(' + N + '(/^input$/i.test(e.localName)&&' +
'("|radio|checkbox|".includes("|"+e.type+"|")&&e.checked)||' +
'(/^option$/i.test(e.nodeName)&&(e.selected||e.checked))' +
'(/^option$/i.test(e.localName)&&(e.selected||e.checked))' +
')){' + source + '}';
break;
case 'indeterminate':
source =
'if(' + N + '(/^progress$/i.test(e.nodeName)&&!e.hasAttribute("value"))||' +
'(/^input$/i.test(e.nodeName)&&("checkbox"==e.type&&e.indeterminate)||' +
'if(' + N + '(/^progress$/i.test(e.localName)&&!e.hasAttribute("value"))||' +
'(/^input$/i.test(e.localName)&&("checkbox"==e.type&&e.indeterminate)||' +
'("radio"==e.type&&e.name&&!s.first("input[name="+e.name+"]:checked",e.form))' +
')){' + source + '}';
break;
case 'required':
source =
'if(' + N +
'(/^input|select|textarea$/i.test(e.nodeName)&&e.required)' +
'(/^input|select|textarea$/i.test(e.localName)&&e.required)' +
'){' + source + '}';
break;
case 'optional':
source =
'if(' + N +
'(/^input|select|textarea$/i.test(e.nodeName)&&!e.required)' +
'(/^input|select|textarea$/i.test(e.localName)&&!e.required)' +
'){' + source + '}';
break;
case 'invalid':
source =
'if(' + N + '((' +
'(/^form$/i.test(e.nodeName)&&!e.noValidate)||' +
'(/^form$/i.test(e.localName)&&!e.noValidate)||' +
'(e.willValidate&&!e.formNoValidate))&&!e.checkValidity())||' +
'(/^fieldset$/i.test(e.nodeName)&&s.first(":invalid",e))' +
'(/^fieldset$/i.test(e.localName)&&s.first(":invalid",e))' +
'){' + source + '}';
break;
case 'valid':
source =
'if(' + N + '((' +
'(/^form$/i.test(e.nodeName)&&!e.noValidate)||' +
'(/^form$/i.test(e.localName)&&!e.noValidate)||' +
'(e.willValidate&&!e.formNoValidate))&&e.checkValidity())||' +
'(/^fieldset$/i.test(e.nodeName)&&s.first(":valid",e))' +
'(/^fieldset$/i.test(e.localName)&&s.first(":valid",e))' +
'){' + source + '}';
break;
case 'in-range':
source =
'if(' + N +
'(/^input$/i.test(e.nodeName))&&' +
'(/^input$/i.test(e.localName))&&' +
'(e.willValidate&&!e.formNoValidate)&&' +
'(!e.validity.rangeUnderflow&&!e.validity.rangeOverflow)&&' +
'("|date|datetime-local|month|number|range|time|week|".includes("|"+e.type+"|"))&&' +
@ -1235,7 +1226,7 @@
case 'out-of-range':
source =
'if(' + N +
'(/^input$/i.test(e.nodeName))&&' +
'(/^input$/i.test(e.localName))&&' +
'(e.willValidate&&!e.formNoValidate)&&' +
'(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&' +
'("|date|datetime-local|month|number|range|time|week|".includes("|"+e.type+"|"))&&' +
@ -1250,14 +1241,18 @@
// allow pseudo-elements starting with single colon (:)
// :after, :before, :first-letter, :first-line
// assert: e.type is in double-colon format, like ::after
else if ((match = selector.match(Patterns.pseudo_sng))) {
source = 'if(' + D + '(e.nodeType==1)){' + source + '}';
source = 'if(e.element&&e.type.toLowerCase()=="' +
':' + match[0].toLowerCase() + '"){e=e.element;' + source + '}';
}
// allow pseudo-elements starting with double colon (::)
// ::after, ::before, ::marker, ::placeholder, ::inactive-selection, ::selection, ::-webkit-<foo-bar>
// assert: e.type is in double-colon format, like ::after
else if ((match = selector.match(Patterns.pseudo_dbl))) {
source = 'if(' + D + '(e.nodeType==1)){' + source + '}';
source = 'if(e.element&&e.type.toLowerCase()=="' +
match[0].toLowerCase() + '"){e=e.element;' + source + '}';
}
else {
@ -1303,7 +1298,7 @@
default:
emit('\'' + selector_string + '\'' + qsInvalid);
break;
break selector_recursion_label;
}
// end of switch symbol
@ -1324,8 +1319,8 @@
// replace ':scope' pseudo-class with element references
makeref =
function(selectors, element) {
return selectors.replace(/:scope/i,
element.nodeName.toLowerCase() +
return selectors.replace(/:scope/ig,
element.localName +
(element.id ? '#' + element.id : '') +
(element.className ? '.' + element.classList[0] : ''));
},
@ -1537,28 +1532,29 @@
// prepare factory resolvers and closure collections
collect =
function(selectors, context, callback) {
var i, l, token, seen = { }, factory = [ ], htmlset = [ ], nodeset = [ ], results = [ ];
for (i = 0, l = selectors.length; l > i; ++i) {
if (!seen[selectors[i]] && (seen[selectors[i]] = true)) {
if ((token = selectors[i].match(reOptimizer)) && token[1] != ':') {
var i, l, seen = { }, token = ['', '*', '*'], optimized = selectors,
factory = [ ], htmlset = [ ], nodeset = [ ], results = [ ], type;
for (i = 0, l = selectors.length; l > i; ++i) {
if (!seen[selectors[i]] && (seen[selectors[i]] = true)) {
type = selectors[i].match(reOptimizer);
if (type && type[1] != ':' && (token = type)) {
token[1] || (token[1] = '*');
selectors[i] = optimize(selectors[i], token);
optimized[i] = optimize(optimized[i], token);
} else {
token = ['', '*', '*'];
}
nodeset[i] = token[1] + token[2];
htmlset[i] = compat[token[1]](context, token[2]);
factory[i] = compile(selectors[i], true, null);
if (factory[i]) {
factory[i](htmlset[i](), callback, context, results);
} else {
results = results.concat(htmlset[i]());
}
}
nodeset[i] = token[1] + token[2];
htmlset[i] = compat[token[1]](context, token[2]);
factory[i] = compile(optimized[i], true, null);
factory[i] ?
factory[i](htmlset[i](), callback, context, results) :
result.concat(htmlset[i]());
}
if (l > 1) {
@ -1574,6 +1570,7 @@
nodeset: nodeset,
results: results
};
},
// QSA placeholders to native references
@ -1632,7 +1629,7 @@
if (all) {
document.addEventListener('load', function(e) {
var c, d, r, s, t = e.target;
if (/iframe/i.test(t.nodeName)) {
if (/iframe/i.test(t.localName)) {
c = '(' + Export + ')(this, ' + Factory + ');'; d = t.contentDocument;
s = d.createElement('script'); s.textContent = c + 'NW.Dom.install()';
r = d.documentElement; r.removeChild(r.insertBefore(s, r.firstChild));