pseudo-dom 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1495 -119
- package/browser/pseudo-dom.js +3539 -482
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/classes/PseudoEventListener.d.ts +96 -96
- package/dist/classes/PseudoEventListener.js +151 -151
- package/dist/classes/PseudoHTMLDocument.d.ts +67 -67
- package/dist/classes/PseudoHTMLDocument.js +144 -144
- package/dist/classes/PseudoNodeList.d.ts +34 -34
- package/dist/classes/PseudoNodeList.js +71 -71
- package/dist/classes.d.ts +20 -20
- package/dist/classes.js +31 -31
- package/dist/factories/createEvent.d.ts +28 -28
- package/dist/factories/createEvent.js +56 -56
- package/dist/factories/cssSelectAdapter.d.ts +23 -0
- package/dist/factories/cssSelectAdapter.js +87 -0
- package/dist/factories/cssSelectAdapter.min.js +1 -0
- package/dist/factories/eventDefaults.d.ts +31 -31
- package/dist/factories/eventDefaults.js +105 -105
- package/dist/factories/generateDocument.d.ts +11 -11
- package/dist/factories/generateDocument.js +65 -65
- package/dist/factories/generateNode.d.ts +32 -32
- package/dist/factories/generateNode.js +85 -85
- package/dist/factories/generateNodeList.d.ts +9 -9
- package/dist/factories/generateNodeList.js +13 -13
- package/dist/factories/query.d.ts +33 -0
- package/dist/factories/query.js +66 -0
- package/dist/factories/query.min.js +1 -0
- package/dist/factories.d.ts +11 -11
- package/dist/factories.js +27 -27
- package/dist/functions/activeElement.d.ts +14 -14
- package/dist/functions/activeElement.js +33 -33
- package/dist/functions/getParentNodes.d.ts +11 -11
- package/dist/functions/getParentNodes.js +22 -22
- package/dist/functions/getParentNodesFromAttribute.d.ts +14 -14
- package/dist/functions/getParentNodesFromAttribute.js +29 -29
- package/dist/functions/modifierState.d.ts +29 -29
- package/dist/functions/modifierState.js +41 -41
- package/dist/functions.d.ts +5 -5
- package/dist/functions.js +23 -23
- package/dist/interfaces/PseudoAnimation.d.ts +3 -3
- package/dist/interfaces/PseudoAnimation.js +5 -5
- package/dist/interfaces/PseudoAttr.d.ts +11 -11
- package/dist/interfaces/PseudoAttr.js +5 -5
- package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -16
- package/dist/interfaces/PseudoDOMTokenList.js +5 -5
- package/dist/interfaces/PseudoDocument.d.ts +7 -0
- package/dist/interfaces/PseudoDocument.js +5 -5
- package/dist/interfaces/PseudoDocumentFragment.d.ts +3 -3
- package/dist/interfaces/PseudoDocumentFragment.js +5 -5
- package/dist/interfaces/PseudoElement.d.ts +48 -24
- package/dist/interfaces/PseudoElement.js +5 -5
- package/dist/interfaces/PseudoEvent.d.ts +79 -79
- package/dist/interfaces/PseudoEvent.js +10 -10
- package/dist/interfaces/PseudoEventTarget.d.ts +46 -46
- package/dist/interfaces/PseudoEventTarget.js +5 -5
- package/dist/interfaces/PseudoHTMLCollection.d.ts +23 -2
- package/dist/interfaces/PseudoHTMLCollection.js +5 -5
- package/dist/interfaces/PseudoHTMLElement.d.ts +22 -22
- package/dist/interfaces/PseudoHTMLElement.js +5 -5
- package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -3
- package/dist/interfaces/PseudoHTMLSlotElement.js +5 -5
- package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -11
- package/dist/interfaces/PseudoNamedNodeMap.js +5 -5
- package/dist/interfaces/PseudoNode.d.ts +179 -179
- package/dist/interfaces/PseudoNode.js +5 -5
- package/dist/interfaces/PseudoShadowRoot.d.ts +3 -3
- package/dist/interfaces/PseudoShadowRoot.js +5 -5
- package/dist/main.d.ts +63 -63
- package/dist/main.js +155 -155
- package/dist/services/AnimationService.d.ts +4 -4
- package/dist/services/AnimationService.js +16 -16
- package/dist/services/AttrService.d.ts +37 -37
- package/dist/services/AttrService.js +81 -81
- package/dist/services/CommentService.d.ts +1 -1
- package/dist/services/CommentService.js +13 -13
- package/dist/services/CustomEventService.d.ts +37 -37
- package/dist/services/CustomEventService.js +35 -35
- package/dist/services/DOMTokenListService.d.ts +33 -33
- package/dist/services/DOMTokenListService.js +117 -117
- package/dist/services/DocumentFragmentService.d.ts +13 -13
- package/dist/services/DocumentFragmentService.js +24 -24
- package/dist/services/DocumentService.d.ts +7 -0
- package/dist/services/DocumentService.js +23 -0
- package/dist/services/DocumentService.min.js +1 -1
- package/dist/services/ElementService.d.ts +77 -1
- package/dist/services/ElementService.js +143 -0
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/EventService.d.ts +120 -120
- package/dist/services/EventService.js +250 -250
- package/dist/services/EventTargetService.d.ts +84 -84
- package/dist/services/EventTargetService.js +232 -232
- package/dist/services/FocusEventService.d.ts +32 -32
- package/dist/services/FocusEventService.js +35 -35
- package/dist/services/HTMLCollectionService.d.ts +51 -0
- package/dist/services/HTMLCollectionService.js +85 -1
- package/dist/services/HTMLCollectionService.min.js +1 -1
- package/dist/services/HTMLElementService.d.ts +57 -57
- package/dist/services/HTMLElementService.js +163 -163
- package/dist/services/HTMLSlotElementService.d.ts +4 -4
- package/dist/services/HTMLSlotElementService.js +9 -9
- package/dist/services/InputEventService.d.ts +41 -41
- package/dist/services/InputEventService.js +47 -47
- package/dist/services/KeyboardEventService.d.ts +70 -70
- package/dist/services/KeyboardEventService.js +86 -86
- package/dist/services/MouseEventService.d.ts +80 -80
- package/dist/services/MouseEventService.js +108 -108
- package/dist/services/NamedNodeMapService.d.ts +23 -23
- package/dist/services/NamedNodeMapService.js +77 -77
- package/dist/services/NodeService.d.ts +75 -1
- package/dist/services/NodeService.js +145 -7
- package/dist/services/NodeService.min.js +1 -1
- package/dist/services/PointerEventService.d.ts +51 -51
- package/dist/services/PointerEventService.js +67 -67
- package/dist/services/ShadowRootService.d.ts +4 -4
- package/dist/services/ShadowRootService.js +9 -9
- package/dist/services/TextService.d.ts +1 -1
- package/dist/services/TextService.js +13 -13
- package/dist/services/UIEventService.d.ts +43 -43
- package/dist/services/UIEventService.js +42 -42
- package/dist/simulate.d.ts +32 -32
- package/dist/simulate.js +115 -115
- package/package.json +3 -2
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
require('core-js/modules/esnext.weak-map.delete-all.js')
|
|
4
|
-
Object.defineProperty(exports, '__esModule', {
|
|
5
|
-
value: true
|
|
6
|
-
})
|
|
7
|
-
exports.setActiveElement = exports.getActiveElement = void 0
|
|
8
|
-
/**
|
|
9
|
-
* The element which has the focus, kept for each tree (the root node of the tree it is in), like document.activeElement.
|
|
10
|
-
*/
|
|
11
|
-
const focused = new WeakMap()
|
|
12
|
-
/**
|
|
13
|
-
* Find the element which has the focus in a tree.
|
|
14
|
-
* @function getActiveElement
|
|
15
|
-
* @param {Object} root The root node of the tree
|
|
16
|
-
* @returns {Object|null}
|
|
17
|
-
*/
|
|
18
|
-
const getActiveElement = root => focused.get(root) || null
|
|
19
|
-
exports.getActiveElement = getActiveElement
|
|
20
|
-
/**
|
|
21
|
-
* Remember the element which has the focus in a tree.
|
|
22
|
-
* @function setActiveElement
|
|
23
|
-
* @param {Object} root The root node of the tree
|
|
24
|
-
* @param {Object|null} element The element which now has the focus, or null when nothing has it
|
|
25
|
-
*/
|
|
26
|
-
const setActiveElement = (root, element) => {
|
|
27
|
-
if (element === null) {
|
|
28
|
-
focused.delete(root)
|
|
29
|
-
} else {
|
|
30
|
-
focused.set(root, element)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.setActiveElement = setActiveElement
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.weak-map.delete-all.js')
|
|
4
|
+
Object.defineProperty(exports, '__esModule', {
|
|
5
|
+
value: true
|
|
6
|
+
})
|
|
7
|
+
exports.setActiveElement = exports.getActiveElement = void 0
|
|
8
|
+
/**
|
|
9
|
+
* The element which has the focus, kept for each tree (the root node of the tree it is in), like document.activeElement.
|
|
10
|
+
*/
|
|
11
|
+
const focused = new WeakMap()
|
|
12
|
+
/**
|
|
13
|
+
* Find the element which has the focus in a tree.
|
|
14
|
+
* @function getActiveElement
|
|
15
|
+
* @param {Object} root The root node of the tree
|
|
16
|
+
* @returns {Object|null}
|
|
17
|
+
*/
|
|
18
|
+
const getActiveElement = root => focused.get(root) || null
|
|
19
|
+
exports.getActiveElement = getActiveElement
|
|
20
|
+
/**
|
|
21
|
+
* Remember the element which has the focus in a tree.
|
|
22
|
+
* @function setActiveElement
|
|
23
|
+
* @param {Object} root The root node of the tree
|
|
24
|
+
* @param {Object|null} element The element which now has the focus, or null when nothing has it
|
|
25
|
+
*/
|
|
26
|
+
const setActiveElement = (root, element) => {
|
|
27
|
+
if (element === null) {
|
|
28
|
+
focused.delete(root)
|
|
29
|
+
} else {
|
|
30
|
+
focused.set(root, element)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.setActiveElement = setActiveElement
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PseudoNode } from '../interfaces/PseudoNode';
|
|
2
|
-
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
3
|
-
/**
|
|
4
|
-
* Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
5
|
-
* order in which an event travels down through them). A node which has no parent has no ancestors.
|
|
6
|
-
* @function getParentNodes
|
|
7
|
-
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the ancestors of
|
|
8
|
-
* @returns {Array<PseudoNode>}
|
|
9
|
-
*/
|
|
10
|
-
declare const getParentNodes: (node: PseudoEventTarget | PseudoNode | any) => Array<PseudoNode>;
|
|
11
|
-
export default getParentNodes;
|
|
1
|
+
import { PseudoNode } from '../interfaces/PseudoNode';
|
|
2
|
+
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
3
|
+
/**
|
|
4
|
+
* Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
5
|
+
* order in which an event travels down through them). A node which has no parent has no ancestors.
|
|
6
|
+
* @function getParentNodes
|
|
7
|
+
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the ancestors of
|
|
8
|
+
* @returns {Array<PseudoNode>}
|
|
9
|
+
*/
|
|
10
|
+
declare const getParentNodes: (node: PseudoEventTarget | PseudoNode | any) => Array<PseudoNode>;
|
|
11
|
+
export default getParentNodes;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
/**
|
|
7
|
-
* Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
8
|
-
* order in which an event travels down through them). A node which has no parent has no ancestors.
|
|
9
|
-
* @function getParentNodes
|
|
10
|
-
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the ancestors of
|
|
11
|
-
* @returns {Array<PseudoNode>}
|
|
12
|
-
*/
|
|
13
|
-
const getParentNodes = node => {
|
|
14
|
-
const parents = []
|
|
15
|
-
let current = node && node.parentNode ? node.parentNode : null
|
|
16
|
-
while (current) {
|
|
17
|
-
parents.unshift(current)
|
|
18
|
-
current = current.parentNode
|
|
19
|
-
}
|
|
20
|
-
return parents
|
|
21
|
-
}
|
|
22
|
-
exports.default = getParentNodes
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
/**
|
|
7
|
+
* Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
8
|
+
* order in which an event travels down through them). A node which has no parent has no ancestors.
|
|
9
|
+
* @function getParentNodes
|
|
10
|
+
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the ancestors of
|
|
11
|
+
* @returns {Array<PseudoNode>}
|
|
12
|
+
*/
|
|
13
|
+
const getParentNodes = node => {
|
|
14
|
+
const parents = []
|
|
15
|
+
let current = node && node.parentNode ? node.parentNode : null
|
|
16
|
+
while (current) {
|
|
17
|
+
parents.unshift(current)
|
|
18
|
+
current = current.parentNode
|
|
19
|
+
}
|
|
20
|
+
return parents
|
|
21
|
+
}
|
|
22
|
+
exports.default = getParentNodes
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { PseudoNode } from '../interfaces/PseudoNode';
|
|
2
|
-
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
3
|
-
/**
|
|
4
|
-
* A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
5
|
-
* This function will check all the parents starting from node, and scan the attributes
|
|
6
|
-
* property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.
|
|
7
|
-
* @function getParentNodesFromAttribute
|
|
8
|
-
* @param {string} attr The property to compare on each ancestor (a missing property counts as false)
|
|
9
|
-
* @param {boolean|number|string} value The value the property must have
|
|
10
|
-
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the matching ancestors of
|
|
11
|
-
* @returns {Array.<PseudoNode>}
|
|
12
|
-
*/
|
|
13
|
-
declare const getParentNodesFromAttribute: (attr: string, value: boolean | number | string, node: PseudoEventTarget | PseudoNode | any) => Array<PseudoNode>;
|
|
14
|
-
export default getParentNodesFromAttribute;
|
|
1
|
+
import { PseudoNode } from '../interfaces/PseudoNode';
|
|
2
|
+
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
3
|
+
/**
|
|
4
|
+
* A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
5
|
+
* This function will check all the parents starting from node, and scan the attributes
|
|
6
|
+
* property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.
|
|
7
|
+
* @function getParentNodesFromAttribute
|
|
8
|
+
* @param {string} attr The property to compare on each ancestor (a missing property counts as false)
|
|
9
|
+
* @param {boolean|number|string} value The value the property must have
|
|
10
|
+
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the matching ancestors of
|
|
11
|
+
* @returns {Array.<PseudoNode>}
|
|
12
|
+
*/
|
|
13
|
+
declare const getParentNodesFromAttribute: (attr: string, value: boolean | number | string, node: PseudoEventTarget | PseudoNode | any) => Array<PseudoNode>;
|
|
14
|
+
export default getParentNodesFromAttribute;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
4
|
-
require('core-js/modules/esnext.iterator.filter.js')
|
|
5
|
-
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
6
|
-
return mod && mod.__esModule
|
|
7
|
-
? mod
|
|
8
|
-
: {
|
|
9
|
-
default: mod
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(exports, '__esModule', {
|
|
13
|
-
value: true
|
|
14
|
-
})
|
|
15
|
-
const getParentNodes_1 = __importDefault(require('./getParentNodes'))
|
|
16
|
-
/**
|
|
17
|
-
* A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
18
|
-
* This function will check all the parents starting from node, and scan the attributes
|
|
19
|
-
* property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.
|
|
20
|
-
* @function getParentNodesFromAttribute
|
|
21
|
-
* @param {string} attr The property to compare on each ancestor (a missing property counts as false)
|
|
22
|
-
* @param {boolean|number|string} value The value the property must have
|
|
23
|
-
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the matching ancestors of
|
|
24
|
-
* @returns {Array.<PseudoNode>}
|
|
25
|
-
*/
|
|
26
|
-
const getParentNodesFromAttribute = (attr, value, node) => {
|
|
27
|
-
return (0, getParentNodes_1.default)(node).filter(parent => (parent[attr] || false) === value)
|
|
28
|
-
}
|
|
29
|
-
exports.default = getParentNodesFromAttribute
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
4
|
+
require('core-js/modules/esnext.iterator.filter.js')
|
|
5
|
+
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
6
|
+
return mod && mod.__esModule
|
|
7
|
+
? mod
|
|
8
|
+
: {
|
|
9
|
+
default: mod
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(exports, '__esModule', {
|
|
13
|
+
value: true
|
|
14
|
+
})
|
|
15
|
+
const getParentNodes_1 = __importDefault(require('./getParentNodes'))
|
|
16
|
+
/**
|
|
17
|
+
* A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
18
|
+
* This function will check all the parents starting from node, and scan the attributes
|
|
19
|
+
* property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.
|
|
20
|
+
* @function getParentNodesFromAttribute
|
|
21
|
+
* @param {string} attr The property to compare on each ancestor (a missing property counts as false)
|
|
22
|
+
* @param {boolean|number|string} value The value the property must have
|
|
23
|
+
* @param {PseudoEventTarget|PseudoNode|*} node The node to find the matching ancestors of
|
|
24
|
+
* @returns {Array.<PseudoNode>}
|
|
25
|
+
*/
|
|
26
|
+
const getParentNodesFromAttribute = (attr, value, node) => {
|
|
27
|
+
return (0, getParentNodes_1.default)(node).filter(parent => (parent[attr] || false) === value)
|
|
28
|
+
}
|
|
29
|
+
exports.default = getParentNodesFromAttribute
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The modifier keys which were held down when a mouse or keyboard event happened.
|
|
3
|
-
* @typedef {Object} ModifierKeys
|
|
4
|
-
* @property {boolean} ctrlKey
|
|
5
|
-
* @property {boolean} shiftKey
|
|
6
|
-
* @property {boolean} altKey
|
|
7
|
-
* @property {boolean} metaKey
|
|
8
|
-
*/
|
|
9
|
-
export type ModifierKeys = {
|
|
10
|
-
ctrlKey: boolean;
|
|
11
|
-
shiftKey: boolean;
|
|
12
|
-
altKey: boolean;
|
|
13
|
-
metaKey: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Pick the modifier keys out of the init object of an event.
|
|
17
|
-
* @function modifierKeys
|
|
18
|
-
* @param {Object} [init={}] The init of an event
|
|
19
|
-
* @returns {ModifierKeys}
|
|
20
|
-
*/
|
|
21
|
-
export declare const modifierKeys: (init?: any) => ModifierKeys;
|
|
22
|
-
/**
|
|
23
|
-
* Answer getModifierState for a set of held modifier keys.
|
|
24
|
-
* @function modifierState
|
|
25
|
-
* @param {ModifierKeys} keys The modifier keys which were held down
|
|
26
|
-
* @param {string} key The name of the modifier (Control, Shift, Alt or Meta)
|
|
27
|
-
* @returns {boolean}
|
|
28
|
-
*/
|
|
29
|
-
export declare const modifierState: (keys: ModifierKeys, key: string) => boolean;
|
|
1
|
+
/**
|
|
2
|
+
* The modifier keys which were held down when a mouse or keyboard event happened.
|
|
3
|
+
* @typedef {Object} ModifierKeys
|
|
4
|
+
* @property {boolean} ctrlKey
|
|
5
|
+
* @property {boolean} shiftKey
|
|
6
|
+
* @property {boolean} altKey
|
|
7
|
+
* @property {boolean} metaKey
|
|
8
|
+
*/
|
|
9
|
+
export type ModifierKeys = {
|
|
10
|
+
ctrlKey: boolean;
|
|
11
|
+
shiftKey: boolean;
|
|
12
|
+
altKey: boolean;
|
|
13
|
+
metaKey: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Pick the modifier keys out of the init object of an event.
|
|
17
|
+
* @function modifierKeys
|
|
18
|
+
* @param {Object} [init={}] The init of an event
|
|
19
|
+
* @returns {ModifierKeys}
|
|
20
|
+
*/
|
|
21
|
+
export declare const modifierKeys: (init?: any) => ModifierKeys;
|
|
22
|
+
/**
|
|
23
|
+
* Answer getModifierState for a set of held modifier keys.
|
|
24
|
+
* @function modifierState
|
|
25
|
+
* @param {ModifierKeys} keys The modifier keys which were held down
|
|
26
|
+
* @param {string} key The name of the modifier (Control, Shift, Alt or Meta)
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
export declare const modifierState: (keys: ModifierKeys, key: string) => boolean;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.modifierState = exports.modifierKeys = void 0
|
|
7
|
-
/**
|
|
8
|
-
* Pick the modifier keys out of the init object of an event.
|
|
9
|
-
* @function modifierKeys
|
|
10
|
-
* @param {Object} [init={}] The init of an event
|
|
11
|
-
* @returns {ModifierKeys}
|
|
12
|
-
*/
|
|
13
|
-
const modifierKeys = (init = {}) => ({
|
|
14
|
-
ctrlKey: !!init.ctrlKey,
|
|
15
|
-
shiftKey: !!init.shiftKey,
|
|
16
|
-
altKey: !!init.altKey,
|
|
17
|
-
metaKey: !!init.metaKey
|
|
18
|
-
})
|
|
19
|
-
exports.modifierKeys = modifierKeys
|
|
20
|
-
/**
|
|
21
|
-
* Answer getModifierState for a set of held modifier keys.
|
|
22
|
-
* @function modifierState
|
|
23
|
-
* @param {ModifierKeys} keys The modifier keys which were held down
|
|
24
|
-
* @param {string} key The name of the modifier (Control, Shift, Alt or Meta)
|
|
25
|
-
* @returns {boolean}
|
|
26
|
-
*/
|
|
27
|
-
const modifierState = (keys, key) => {
|
|
28
|
-
switch (key) {
|
|
29
|
-
case 'Control':
|
|
30
|
-
return keys.ctrlKey
|
|
31
|
-
case 'Shift':
|
|
32
|
-
return keys.shiftKey
|
|
33
|
-
case 'Alt':
|
|
34
|
-
return keys.altKey
|
|
35
|
-
case 'Meta':
|
|
36
|
-
return keys.metaKey
|
|
37
|
-
default:
|
|
38
|
-
return false
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.modifierState = modifierState
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.modifierState = exports.modifierKeys = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Pick the modifier keys out of the init object of an event.
|
|
9
|
+
* @function modifierKeys
|
|
10
|
+
* @param {Object} [init={}] The init of an event
|
|
11
|
+
* @returns {ModifierKeys}
|
|
12
|
+
*/
|
|
13
|
+
const modifierKeys = (init = {}) => ({
|
|
14
|
+
ctrlKey: !!init.ctrlKey,
|
|
15
|
+
shiftKey: !!init.shiftKey,
|
|
16
|
+
altKey: !!init.altKey,
|
|
17
|
+
metaKey: !!init.metaKey
|
|
18
|
+
})
|
|
19
|
+
exports.modifierKeys = modifierKeys
|
|
20
|
+
/**
|
|
21
|
+
* Answer getModifierState for a set of held modifier keys.
|
|
22
|
+
* @function modifierState
|
|
23
|
+
* @param {ModifierKeys} keys The modifier keys which were held down
|
|
24
|
+
* @param {string} key The name of the modifier (Control, Shift, Alt or Meta)
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
const modifierState = (keys, key) => {
|
|
28
|
+
switch (key) {
|
|
29
|
+
case 'Control':
|
|
30
|
+
return keys.ctrlKey
|
|
31
|
+
case 'Shift':
|
|
32
|
+
return keys.shiftKey
|
|
33
|
+
case 'Alt':
|
|
34
|
+
return keys.altKey
|
|
35
|
+
case 'Meta':
|
|
36
|
+
return keys.metaKey
|
|
37
|
+
default:
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.modifierState = modifierState
|
package/dist/functions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
getParentNodes: (node: import("./interfaces/PseudoEventTarget").PseudoEventTarget | import("./interfaces/PseudoNode").PseudoNode | any) => Array<import("./interfaces/PseudoNode").PseudoNode>;
|
|
3
|
-
getParentNodesFromAttribute: (attr: string, value: boolean | number | string, node: import("./interfaces/PseudoEventTarget").PseudoEventTarget | import("./interfaces/PseudoNode").PseudoNode | any) => Array<import("./interfaces/PseudoNode").PseudoNode>;
|
|
4
|
-
};
|
|
5
|
-
export default _default;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
getParentNodes: (node: import("./interfaces/PseudoEventTarget").PseudoEventTarget | import("./interfaces/PseudoNode").PseudoNode | any) => Array<import("./interfaces/PseudoNode").PseudoNode>;
|
|
3
|
+
getParentNodesFromAttribute: (attr: string, value: boolean | number | string, node: import("./interfaces/PseudoEventTarget").PseudoEventTarget | import("./interfaces/PseudoNode").PseudoNode | any) => Array<import("./interfaces/PseudoNode").PseudoNode>;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
package/dist/functions.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
-
return mod && mod.__esModule
|
|
5
|
-
? mod
|
|
6
|
-
: {
|
|
7
|
-
default: mod
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(exports, '__esModule', {
|
|
11
|
-
value: true
|
|
12
|
-
})
|
|
13
|
-
/**
|
|
14
|
-
* @file Helper functions for managing interactions with DOM classes
|
|
15
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
16
|
-
* @version 1.0.0
|
|
17
|
-
*/
|
|
18
|
-
const getParentNodes_1 = __importDefault(require('./functions/getParentNodes'))
|
|
19
|
-
const getParentNodesFromAttribute_1 = __importDefault(require('./functions/getParentNodesFromAttribute'))
|
|
20
|
-
exports.default = {
|
|
21
|
-
getParentNodes: getParentNodes_1.default,
|
|
22
|
-
getParentNodesFromAttribute: getParentNodesFromAttribute_1.default
|
|
23
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule
|
|
5
|
+
? mod
|
|
6
|
+
: {
|
|
7
|
+
default: mod
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(exports, '__esModule', {
|
|
11
|
+
value: true
|
|
12
|
+
})
|
|
13
|
+
/**
|
|
14
|
+
* @file Helper functions for managing interactions with DOM classes
|
|
15
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
const getParentNodes_1 = __importDefault(require('./functions/getParentNodes'))
|
|
19
|
+
const getParentNodesFromAttribute_1 = __importDefault(require('./functions/getParentNodesFromAttribute'))
|
|
20
|
+
exports.default = {
|
|
21
|
+
getParentNodes: getParentNodes_1.default,
|
|
22
|
+
getParentNodesFromAttribute: getParentNodesFromAttribute_1.default
|
|
23
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PseudoEventTarget } from './PseudoEventTarget';
|
|
2
|
-
export interface PseudoAnimation extends PseudoEventTarget {
|
|
3
|
-
}
|
|
1
|
+
import { PseudoEventTarget } from './PseudoEventTarget';
|
|
2
|
+
export interface PseudoAnimation extends PseudoEventTarget {
|
|
3
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PseudoNode } from './PseudoNode';
|
|
2
|
-
import { PseudoElement } from './PseudoElement';
|
|
3
|
-
export interface PseudoAttr extends PseudoNode {
|
|
4
|
-
get localName(): string;
|
|
5
|
-
get name(): string;
|
|
6
|
-
get namespaceURI(): string;
|
|
7
|
-
get ownerElement(): PseudoElement | null;
|
|
8
|
-
get prefix(): string | null;
|
|
9
|
-
get value(): string;
|
|
10
|
-
set value(value: string);
|
|
11
|
-
}
|
|
1
|
+
import { PseudoNode } from './PseudoNode';
|
|
2
|
+
import { PseudoElement } from './PseudoElement';
|
|
3
|
+
export interface PseudoAttr extends PseudoNode {
|
|
4
|
+
get localName(): string;
|
|
5
|
+
get name(): string;
|
|
6
|
+
get namespaceURI(): string;
|
|
7
|
+
get ownerElement(): PseudoElement | null;
|
|
8
|
+
get prefix(): string | null;
|
|
9
|
+
get value(): string;
|
|
10
|
+
set value(value: string);
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export interface PseudoDOMTokenList {
|
|
2
|
-
get length(): number;
|
|
3
|
-
get value(): string;
|
|
4
|
-
set value(value: string);
|
|
5
|
-
item(index: number): string | null;
|
|
6
|
-
contains(token: string): boolean;
|
|
7
|
-
add(...tokens: string[]): void;
|
|
8
|
-
remove(...tokens: string[]): void;
|
|
9
|
-
replace(oldToken: string, newToken: string): boolean;
|
|
10
|
-
supports(token: string): boolean;
|
|
11
|
-
toggle(token: string, force: boolean): boolean;
|
|
12
|
-
entries(): Iterator<any>;
|
|
13
|
-
forEach(callback: Function, thisArg: any): void;
|
|
14
|
-
keys(): Iterator<any>;
|
|
15
|
-
values(): Iterator<any>;
|
|
16
|
-
}
|
|
1
|
+
export interface PseudoDOMTokenList {
|
|
2
|
+
get length(): number;
|
|
3
|
+
get value(): string;
|
|
4
|
+
set value(value: string);
|
|
5
|
+
item(index: number): string | null;
|
|
6
|
+
contains(token: string): boolean;
|
|
7
|
+
add(...tokens: string[]): void;
|
|
8
|
+
remove(...tokens: string[]): void;
|
|
9
|
+
replace(oldToken: string, newToken: string): boolean;
|
|
10
|
+
supports(token: string): boolean;
|
|
11
|
+
toggle(token: string, force: boolean): boolean;
|
|
12
|
+
entries(): Iterator<any>;
|
|
13
|
+
forEach(callback: Function, thisArg: any): void;
|
|
14
|
+
keys(): Iterator<any>;
|
|
15
|
+
values(): Iterator<any>;
|
|
16
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { PseudoNode } from './PseudoNode';
|
|
2
|
+
import { PseudoElement } from './PseudoElement';
|
|
2
3
|
export interface PseudoDocument extends PseudoNode {
|
|
4
|
+
/**
|
|
5
|
+
* The first element, in tree order, whose id matches the given value, or null when there is none.
|
|
6
|
+
* @param {string} id
|
|
7
|
+
* @returns {PseudoElement|null}
|
|
8
|
+
*/
|
|
9
|
+
getElementById(id: string): PseudoElement | null;
|
|
3
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PseudoNode } from './PseudoNode';
|
|
2
|
-
export interface PseudoDocumentFragment extends PseudoNode {
|
|
3
|
-
}
|
|
1
|
+
import { PseudoNode } from './PseudoNode';
|
|
2
|
+
export interface PseudoDocumentFragment extends PseudoNode {
|
|
3
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|