This commit is contained in:
eric sciple 2020-01-24 12:20:47 -05:00
parent a004f0ae58
commit fc725ba36b
7280 changed files with 19 additions and 1796407 deletions

22
node_modules/nwsapi/LICENSE generated vendored
View file

@ -1,22 +0,0 @@
Copyright (c) 2007-2019 Diego Perini (http://www.iport.it/)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

132
node_modules/nwsapi/README.md generated vendored
View file

@ -1,132 +0,0 @@
# [NWSAPI](http://dperini.github.io/nwsapi/)
Fast CSS Selectors API Engine
![](https://img.shields.io/npm/v/nwsapi.svg?colorB=orange&style=flat) ![](https://img.shields.io/github/tag/dperini/nwsapi.svg?style=flat) ![](https://img.shields.io/npm/dw/nwsapi.svg?style=flat) ![](https://img.shields.io/github/issues/dperini/nwsapi.svg?style=flat)
NWSAPI is the development progress of [NWMATCHER](https://github.com/dperini/nwmatcher) aiming at [Selectors Level 4](https://www.w3.org/TR/selectors-4/) conformance. It has been completely reworked to be easily extended and maintained. It is a right-to-left selector parser and compiler written in pure Javascript with no external dependencies. It was initially thought as a cross browser library to improve event delegation and web page scraping in various frameworks but it has become a popular replacement of the native CSS selection and matching functionality in newer browsers and headless environments.
It uses [regular expressions](https://en.wikipedia.org/wiki/Regular_expression) to parse CSS selector strings and [metaprogramming](https://en.wikipedia.org/wiki/Metaprogramming) to transforms these selector strings into Javascript function resolvers. This process is executed only once for each selector string allowing memoization of the function resolvers and achieving unmatched performances.
## Installation
To include NWSAPI in a standard web page:
```html
<script type="text/javascript" src="nwsapi.js"></script>
```
To include NWSAPI in a standard web page and automatically replace the native QSA:
```html
<script type="text/javascript" src="nwsapi.js" onload="NW.Dom.install()"></script>
```
To use NWSAPI with Node.js:
```
$ npm install nwsapi
```
NWSAPI currently supports browsers (as a global, `NW.Dom`) and headless environments (as a CommonJS module).
## Supported Selectors
Here is a list of all the CSS2/CSS3/CSS4 [Supported selectors](https://github.com/dperini/nwsapi/wiki/CSS-supported-selectors).
## Features and Compliance
You can read more about NWSAPI [features and compliance](https://github.com/dperini/nwsapi/wiki/Features-and-compliance) on the wiki.
## API
### DOM Selection
#### `ancestor( selector, context, callback )`
Returns a reference to the nearest ancestor element matching `selector`, starting at `context`. Returns `null` if no element is found. If `callback` is provided, it is invoked for the matched element.
#### `first( selector, context, callback )`
Returns a reference to the first element matching `selector`, starting at `context`. Returns `null` if no element matches. If `callback` is provided, it is invoked for the matched element.
#### `match( selector, element, callback )`
Returns `true` if `element` matches `selector`, starting at `context`; returns `false` otherwise. If `callback` is provided, it is invoked for the matched element.
#### `select( selector, context, callback )`
Returns an array of all the elements matching `selector`, starting at `context`; returns empty `Array` otherwise. If `callback` is provided, it is invoked for each matching element.
### DOM Helpers
#### `byId( id, from )`
Returns a reference to the first element with ID `id`, optionally filtered to descendants of the element `from`.
#### `byTag( tag, from )`
Returns an array of elements having the specified tag name `tag`, optionally filtered to descendants of the element `from`.
#### `byClass( class, from )`
Returns an array of elements having the specified class name `class`, optionally filtered to descendants of the element `from`.
### Engine Configuration
#### `configure( options )`
The following is the list of currently available configuration options, their default values and descriptions, they are boolean flags that can be set to `true` or `false`:
* `IDS_DUPES`: true - true to allow using multiple elements having the same id, false to disallow
* `LIVECACHE`: true - true for caching both results and resolvers, false for caching only resolvers
* `MIXEDCASE`: true - true to match tag names case insensitive, false to match using case sensitive
* `LOGERRORS`: true - true to print errors and warnings to the console, false to mute both of them
### Examples on extending the basic functionalities
#### `configure( { <configuration-flag>: [ true | false ] } )`
Disable logging errors/warnings to console, disallow duplicate ids. Example:
```js
NW.Dom.configure( { LOGERRORS: false, IDS_DUPES: false } );
```
NOTE: NW.Dom.configure() without parameters return the current configuration.
#### `registerCombinator( symbol, resolver )`
Registers a new symbol and its matching resolver in the combinators table. Example:
```js
NW.Dom.registerCombinator( '^', 'e.parentElement' );
```
#### `registerOperator( symbol, resolver )`
Registers a new symbol and its matching resolver in the attribute operators table. Example:
```js
NW.Dom.registerOperator( '!=', { p1: '^', p2: '$', p3: 'false' } );
```
#### `registerSelector( name, rexp, func )`
Registers a new selector, the matching RE and the resolver function, in the selectors table. Example:
```js
NW.Dom.registerSelector('Controls', /^\:(control)(.*)/i,
(function(global) {
return function(match, source, mode, callback) {
var status = true;
source = 'if(/^(button|input|select|textarea)/i.test(e.nodeName)){' + source + '}';
return { 'source': source, 'status': status };
};
})(this));
```

72
node_modules/nwsapi/package.json generated vendored
View file

@ -1,72 +0,0 @@
{
"_args": [
[
"nwsapi@2.1.4",
"/Users/eric/repos/actions/setup-node"
]
],
"_development": true,
"_from": "nwsapi@2.1.4",
"_id": "nwsapi@2.1.4",
"_inBundle": false,
"_integrity": "sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw==",
"_location": "/nwsapi",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "nwsapi@2.1.4",
"name": "nwsapi",
"escapedName": "nwsapi",
"rawSpec": "2.1.4",
"saveSpec": null,
"fetchSpec": "2.1.4"
},
"_requiredBy": [
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz",
"_spec": "2.1.4",
"_where": "/Users/eric/repos/actions/setup-node",
"author": {
"name": "Diego Perini",
"email": "diego.perini@gmail.com",
"url": "http://www.iport.it/"
},
"bugs": {
"url": "http://github.com/dperini/nwsapi/issues"
},
"description": "Fast CSS Selectors API Engine",
"homepage": "http://javascript.nwbox.com/nwsapi/",
"keywords": [
"css",
"css3",
"css4",
"matcher",
"selector"
],
"license": "MIT",
"licenses": [
{
"type": "MIT",
"url": "http://javascript.nwbox.com/nwsapi/MIT-LICENSE"
}
],
"main": "./src/nwsapi",
"maintainers": [
{
"name": "Diego Perini",
"email": "diego.perini@gmail.com",
"url": "http://www.iport.it/"
}
],
"name": "nwsapi",
"repository": {
"type": "git",
"url": "git://github.com/dperini/nwsapi.git"
},
"scripts": {
"lint": "eslint ./src/nwsapi.js"
},
"version": "2.1.4"
}

View file

@ -1,135 +0,0 @@
/*
* Copyright (C) 2007-2017 Diego Perini
* All rights reserved.
*
* this is just a small example to show
* how an extension for NWMatcher could be
* adapted to handle special jQuery selectors
*
* Child Selectors
* :even, :odd, :eq, :lt, :gt, :first, :last, :nth
*
* Pseudo Selectors
* :has, :button, :header, :input, :checkbox, :radio, :file, :image
* :password, :reset, :submit, :text, :hidden, :visible, :parent
*
*/
// for structural pseudo-classes extensions
NW.Dom.registerSelector(
'jquery:child',
/^\:((?:(nth|eq|lt|gt)\(([^()]*)\))|(?:even|odd|first|last))(.*)/i,
(function(global) {
return function(match, source, mode, callback) {
var status = true,
macro = mode ? NW.Dom.S_BODY : NW.Dom.M_BODY;
macro = macro.replace('@', typeof callback == 'function' ? (mode ? NW.Dom.S_TEST : NW.Dom.M_TEST) : '');
switch (match[1].toLowerCase()) {
case 'odd':
source = source.replace(macro, 'if((n=n^1)==0){' + macro + '}');
break;
case 'even':
source = source.replace(macro, 'if((n=n^1)==1){' + macro + '}');
break;
case 'first':
source = 'n=s.root.getElementsByTagName(e.nodeName);if(n.length&&n[0]===e){' + source + '}';
break;
case 'last':
source = 'n=s.root.getElementsByTagName(e.nodeName);if(n.length&&n[n.length-1]===e){' + source + '}';
break;
default:
switch (match[2].toLowerCase()) {
case 'nth':
source = 'n=s.root.getElementsByTagName(e.nodeName);if(n.length&&n[' + match[3] + ']===e){' + source + '}';
break;
case 'eq':
source = source.replace(macro, 'if(x++==' + match[3] + '){' + macro + '}');
break;
case 'lt':
source = source.replace(macro, 'if(x++<' + match[3] + '){' + macro + '}');
break;
case 'gt':
source = source.replace(macro, 'if(x++>' + match[3] + '){' + macro + '}');
break;
default:
status = false;
break;
}
break;
}
// compiler will add this to "source"
return {
'source': source,
'status': status,
'modvar': 'x=0'
};
};
})(this));
// for element pseudo-classes extensions
NW.Dom.registerSelector(
'jquery:pseudo',
/^\:(has|checkbox|file|image|password|radio|reset|submit|text|button|input|header|hidden|visible|parent)(?:\(\s*(["']*)?([^'"()]*)\2\s*\))?(.*)/i,
(function(global) {
return function(match, source, mode, callback) {
var status = true,
macro = mode ? NW.Dom.S_BODY : NW.Dom.M_BODY;
macro = macro.replace('@', typeof callback == 'function' ? (mode ? NW.Dom.S_TEST : NW.Dom.M_TEST) : '');
switch(match[1].toLowerCase()) {
case 'has':
source = source.replace(macro, 'if(e.getElementsByTagName("' + match[3].replace(/^\s|\s$/g, '') + '")[0]){' + macro + '}');
break;
case 'checkbox':
case 'file':
case 'image':
case 'password':
case 'radio':
case 'reset':
case 'submit':
case 'text':
// :checkbox, :file, :image, :password, :radio, :reset, :submit, :text
source = 'if(/^' + match[1] + '$/i.test(e.type)){' + source + '}';
break;
case 'button':
source = 'if(/^button$/i.test(e.nodeName)){' + source + '}';
break;
case 'input':
source = 'if(/^(?:button|input|select|textarea)$/i.test(e.nodeName)){' + source + '}';
break;
case 'header':
source = 'if(/^h[1-6]$/i.test(e.nodeName)){' + source + '}';
break;
case 'hidden':
source = 'if(!e.offsetWidth&&!e.offsetHeight){' + source + '}';
break;
case 'visible':
source = 'if(e.offsetWidth||e.offsetHeight){' + source + '}';
break;
case 'parent':
source = 'if(e.firstChild){' + source + '}';
break;
default:
status = false;
break;
}
// compiler will add this to "source"
return {
'source': source,
'status': status
};
};
})(this));

View file

@ -1,90 +0,0 @@
/*
* Element Traversal methods from Juriy Zaytsev (kangax)
* used to emulate Prototype up/down/previous/next methods
*/
(function(D){
// TODO: all of this needs tests
var match = D.match, select = D.select, root = document.documentElement,
// Use the Element Traversal API if available.
nextElement = 'nextElementSibling',
previousElement = 'previousElementSibling',
parentElement = 'parentElement';
// Fall back to the DOM Level 1 API.
if (!(nextElement in root)) nextElement = 'nextSibling';
if (!(previousElement in root)) previousElement = 'previousSibling';
if (!(parentElement in root)) parentElement = 'parentNode';
function walkElements(property, element, expr) {
var i = 0, isIndex = typeof expr == 'number';
if (typeof expr == 'undefined') {
isIndex = true;
expr = 0;
}
while ((element = element[property])) {
if (element.nodeType != 1) continue;
if (isIndex) {
++i;
if (i == expr) return element;
} else if (match(element, expr)) {
return element;
}
}
return null;
}
/**
* @method up
* @param {HTMLElement} element element to walk from
* @param {String | Number} expr CSS expression or an index
* @return {HTMLElement | null}
*/
function up(element, expr) {
return walkElements(parentElement, element, expr);
}
/**
* @method next
* @param {HTMLElement} element element to walk from
* @param {String | Number} expr CSS expression or an index
* @return {HTMLElement | null}
*/
function next(element, expr) {
return walkElements(nextElement, element, expr);
}
/**
* @method previous
* @param {HTMLElement} element element to walk from
* @param {String | Number} expr CSS expression or an index
* @return {HTMLElement | null}
*/
function previous(element, expr) {
return walkElements(previousElement, element, expr);
}
/**
* @method down
* @param {HTMLElement} element element to walk from
* @param {String | Number} expr CSS expression or an index
* @return {HTMLElement | null}
*/
function down(element, expr) {
var isIndex = typeof expr == 'number', descendants, index, descendant;
if (expr === null) {
element = element.firstChild;
while (element && element.nodeType != 1) element = element[nextElement];
return element;
}
if (!isIndex && match(element, expr) || isIndex && expr === 0) return element;
descendants = select('*', element);
if (isIndex) return descendants[expr] || null;
index = 0;
while ((descendant = descendants[index]) && !match(descendant, expr)) { ++index; }
return descendant || null;
}
D.up = up;
D.down = down;
D.next = next;
D.previous = previous;
})(NW.Dom);

1817
node_modules/nwsapi/src/nwsapi.js generated vendored

File diff suppressed because it is too large Load diff