pseudo-dom 0.6.0 → 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 +432 -13
- package/browser/pseudo-dom.js +3364 -603
- 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 +20 -7
- 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 -23
- 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 +13 -0
- package/dist/services/ElementService.js +20 -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 +11 -6
- package/dist/services/HTMLCollectionService.js +25 -8
- 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 +26 -0
- package/dist/services/NodeService.js +42 -0
- 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,144 +1,144 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
4
|
-
require('core-js/modules/esnext.iterator.find.js')
|
|
5
|
-
require('core-js/modules/esnext.iterator.for-each.js')
|
|
6
|
-
Object.defineProperty(exports, '__esModule', {
|
|
7
|
-
value: true
|
|
8
|
-
})
|
|
9
|
-
/**
|
|
10
|
-
* @file Substitute for the DOM HTMLDocument Class.
|
|
11
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
12
|
-
* @version 1.0.0
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @type {PseudoHTMLElement}
|
|
17
|
-
*/
|
|
18
|
-
const HTMLElementService_1 = require('../services/HTMLElementService')
|
|
19
|
-
const NodeService_1 = require('../services/NodeService')
|
|
20
|
-
const DocumentFragmentService_1 = require('../services/DocumentFragmentService')
|
|
21
|
-
/**
|
|
22
|
-
* Simulate the behaviour of the HTMLDocument Class when there is no DOM available.
|
|
23
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
24
|
-
* @class
|
|
25
|
-
* @augments PseudoHTMLElement
|
|
26
|
-
* @property {PseudoHTMLElement} head - A reference to the Head child element
|
|
27
|
-
* @property {PseudoHTMLElement} body - A reference to the Body child element
|
|
28
|
-
* @property {function} createElement - Generate a new PseudoHTMLElement (which is not in the document until it is appended)
|
|
29
|
-
*/
|
|
30
|
-
class PseudoHTMLDocument extends HTMLElementService_1.HTMLElementService {
|
|
31
|
-
/**
|
|
32
|
-
* The root HTML element is acts as the parent to all HTML elements in the document.
|
|
33
|
-
* @constructor
|
|
34
|
-
*/
|
|
35
|
-
constructor () {
|
|
36
|
-
super()
|
|
37
|
-
const html = new HTMLElementService_1.HTMLElementService({
|
|
38
|
-
tagName: 'html'
|
|
39
|
-
})
|
|
40
|
-
this.appendChild(html)
|
|
41
|
-
/**
|
|
42
|
-
* Create document head element
|
|
43
|
-
* @type {PseudoHTMLElement}
|
|
44
|
-
*/
|
|
45
|
-
this.head = new HTMLElementService_1.HTMLElementService({
|
|
46
|
-
tagName: 'head'
|
|
47
|
-
})
|
|
48
|
-
html.appendChild(this.head)
|
|
49
|
-
/**
|
|
50
|
-
* Create document body element
|
|
51
|
-
* @type {PseudoHTMLElement}
|
|
52
|
-
*/
|
|
53
|
-
this.body = new HTMLElementService_1.HTMLElementService({
|
|
54
|
-
tagName: 'body'
|
|
55
|
-
})
|
|
56
|
-
html.appendChild(this.body)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get nodeName () {
|
|
60
|
-
return '#document'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get nodeType () {
|
|
64
|
-
return NodeService_1.NodeService.DOCUMENT_NODE
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// A document has no text of its own, and setting it does nothing
|
|
68
|
-
get textContent () {
|
|
69
|
-
return null
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
set textContent (text) {}
|
|
73
|
-
/**
|
|
74
|
-
* Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
|
|
75
|
-
* @param {string} tagName - Tag Name is a string representing the type of Dom element this represents
|
|
76
|
-
* @returns {PseudoHTMLElement}
|
|
77
|
-
*/
|
|
78
|
-
createElement (tagName = 'div') {
|
|
79
|
-
// Like the DOM, the new element is not added anywhere: it has no parent until it is appended
|
|
80
|
-
const element = new HTMLElementService_1.HTMLElementService({
|
|
81
|
-
tagName
|
|
82
|
-
})
|
|
83
|
-
element.ownerDocumentStore = this
|
|
84
|
-
return element
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Make a text node which belongs to this document.
|
|
89
|
-
* @param {string} [data=''] The text
|
|
90
|
-
* @returns {TextService}
|
|
91
|
-
*/
|
|
92
|
-
createTextNode (data = '') {
|
|
93
|
-
const text = new NodeService_1.TextService(data)
|
|
94
|
-
text.ownerDocumentStore = this
|
|
95
|
-
return text
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Make a comment which belongs to this document.
|
|
100
|
-
* @param {string} [data=''] The comment
|
|
101
|
-
* @returns {CommentService}
|
|
102
|
-
*/
|
|
103
|
-
createComment (data = '') {
|
|
104
|
-
const comment = new NodeService_1.CommentService(data)
|
|
105
|
-
comment.ownerDocumentStore = this
|
|
106
|
-
return comment
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
|
|
111
|
-
* then inserted in one go.
|
|
112
|
-
* @returns {DocumentFragmentService}
|
|
113
|
-
*/
|
|
114
|
-
createDocumentFragment () {
|
|
115
|
-
const fragment = new DocumentFragmentService_1.DocumentFragmentService()
|
|
116
|
-
fragment.ownerDocumentStore = this
|
|
117
|
-
return fragment
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Make a copy of this document. The copy has no parent or listeners, and a deep copy has copies of everything in the
|
|
122
|
-
* document (a shallow one is an empty document).
|
|
123
|
-
* @param {boolean} [deep=false] Copy everything in the document as well
|
|
124
|
-
* @returns {PseudoNode}
|
|
125
|
-
*/
|
|
126
|
-
cloneNode (deep = false) {
|
|
127
|
-
const copy = new PseudoHTMLDocument()
|
|
128
|
-
// The new document starts out with its own html, head and body, a copy has only what was copied from this one
|
|
129
|
-
while (copy.firstChild) {
|
|
130
|
-
copy.removeChild(copy.firstChild)
|
|
131
|
-
}
|
|
132
|
-
copy.head = null
|
|
133
|
-
copy.body = null
|
|
134
|
-
if (deep) {
|
|
135
|
-
Array.from(this.childNodes).forEach(child => copy.appendChild(child.cloneNode(true)))
|
|
136
|
-
const html = Array.from(copy.childNodes).find(child => child.tagName === 'html')
|
|
137
|
-
const inHtml = tagName => html ? Array.from(html.childNodes).find(child => child.tagName === tagName) || null : null
|
|
138
|
-
copy.head = inHtml('head')
|
|
139
|
-
copy.body = inHtml('body')
|
|
140
|
-
}
|
|
141
|
-
return copy
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.default = PseudoHTMLDocument
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
4
|
+
require('core-js/modules/esnext.iterator.find.js')
|
|
5
|
+
require('core-js/modules/esnext.iterator.for-each.js')
|
|
6
|
+
Object.defineProperty(exports, '__esModule', {
|
|
7
|
+
value: true
|
|
8
|
+
})
|
|
9
|
+
/**
|
|
10
|
+
* @file Substitute for the DOM HTMLDocument Class.
|
|
11
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
12
|
+
* @version 1.0.0
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {PseudoHTMLElement}
|
|
17
|
+
*/
|
|
18
|
+
const HTMLElementService_1 = require('../services/HTMLElementService')
|
|
19
|
+
const NodeService_1 = require('../services/NodeService')
|
|
20
|
+
const DocumentFragmentService_1 = require('../services/DocumentFragmentService')
|
|
21
|
+
/**
|
|
22
|
+
* Simulate the behaviour of the HTMLDocument Class when there is no DOM available.
|
|
23
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
24
|
+
* @class
|
|
25
|
+
* @augments PseudoHTMLElement
|
|
26
|
+
* @property {PseudoHTMLElement} head - A reference to the Head child element
|
|
27
|
+
* @property {PseudoHTMLElement} body - A reference to the Body child element
|
|
28
|
+
* @property {function} createElement - Generate a new PseudoHTMLElement (which is not in the document until it is appended)
|
|
29
|
+
*/
|
|
30
|
+
class PseudoHTMLDocument extends HTMLElementService_1.HTMLElementService {
|
|
31
|
+
/**
|
|
32
|
+
* The root HTML element is acts as the parent to all HTML elements in the document.
|
|
33
|
+
* @constructor
|
|
34
|
+
*/
|
|
35
|
+
constructor () {
|
|
36
|
+
super()
|
|
37
|
+
const html = new HTMLElementService_1.HTMLElementService({
|
|
38
|
+
tagName: 'html'
|
|
39
|
+
})
|
|
40
|
+
this.appendChild(html)
|
|
41
|
+
/**
|
|
42
|
+
* Create document head element
|
|
43
|
+
* @type {PseudoHTMLElement}
|
|
44
|
+
*/
|
|
45
|
+
this.head = new HTMLElementService_1.HTMLElementService({
|
|
46
|
+
tagName: 'head'
|
|
47
|
+
})
|
|
48
|
+
html.appendChild(this.head)
|
|
49
|
+
/**
|
|
50
|
+
* Create document body element
|
|
51
|
+
* @type {PseudoHTMLElement}
|
|
52
|
+
*/
|
|
53
|
+
this.body = new HTMLElementService_1.HTMLElementService({
|
|
54
|
+
tagName: 'body'
|
|
55
|
+
})
|
|
56
|
+
html.appendChild(this.body)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get nodeName () {
|
|
60
|
+
return '#document'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get nodeType () {
|
|
64
|
+
return NodeService_1.NodeService.DOCUMENT_NODE
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// A document has no text of its own, and setting it does nothing
|
|
68
|
+
get textContent () {
|
|
69
|
+
return null
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
set textContent (text) {}
|
|
73
|
+
/**
|
|
74
|
+
* Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
|
|
75
|
+
* @param {string} tagName - Tag Name is a string representing the type of Dom element this represents
|
|
76
|
+
* @returns {PseudoHTMLElement}
|
|
77
|
+
*/
|
|
78
|
+
createElement (tagName = 'div') {
|
|
79
|
+
// Like the DOM, the new element is not added anywhere: it has no parent until it is appended
|
|
80
|
+
const element = new HTMLElementService_1.HTMLElementService({
|
|
81
|
+
tagName
|
|
82
|
+
})
|
|
83
|
+
element.ownerDocumentStore = this
|
|
84
|
+
return element
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Make a text node which belongs to this document.
|
|
89
|
+
* @param {string} [data=''] The text
|
|
90
|
+
* @returns {TextService}
|
|
91
|
+
*/
|
|
92
|
+
createTextNode (data = '') {
|
|
93
|
+
const text = new NodeService_1.TextService(data)
|
|
94
|
+
text.ownerDocumentStore = this
|
|
95
|
+
return text
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Make a comment which belongs to this document.
|
|
100
|
+
* @param {string} [data=''] The comment
|
|
101
|
+
* @returns {CommentService}
|
|
102
|
+
*/
|
|
103
|
+
createComment (data = '') {
|
|
104
|
+
const comment = new NodeService_1.CommentService(data)
|
|
105
|
+
comment.ownerDocumentStore = this
|
|
106
|
+
return comment
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
|
|
111
|
+
* then inserted in one go.
|
|
112
|
+
* @returns {DocumentFragmentService}
|
|
113
|
+
*/
|
|
114
|
+
createDocumentFragment () {
|
|
115
|
+
const fragment = new DocumentFragmentService_1.DocumentFragmentService()
|
|
116
|
+
fragment.ownerDocumentStore = this
|
|
117
|
+
return fragment
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Make a copy of this document. The copy has no parent or listeners, and a deep copy has copies of everything in the
|
|
122
|
+
* document (a shallow one is an empty document).
|
|
123
|
+
* @param {boolean} [deep=false] Copy everything in the document as well
|
|
124
|
+
* @returns {PseudoNode}
|
|
125
|
+
*/
|
|
126
|
+
cloneNode (deep = false) {
|
|
127
|
+
const copy = new PseudoHTMLDocument()
|
|
128
|
+
// The new document starts out with its own html, head and body, a copy has only what was copied from this one
|
|
129
|
+
while (copy.firstChild) {
|
|
130
|
+
copy.removeChild(copy.firstChild)
|
|
131
|
+
}
|
|
132
|
+
copy.head = null
|
|
133
|
+
copy.body = null
|
|
134
|
+
if (deep) {
|
|
135
|
+
Array.from(this.childNodes).forEach(child => copy.appendChild(child.cloneNode(true)))
|
|
136
|
+
const html = Array.from(copy.childNodes).find(child => child.tagName === 'html')
|
|
137
|
+
const inHtml = tagName => html ? Array.from(html.childNodes).find(child => child.tagName === tagName) || null : null
|
|
138
|
+
copy.head = inHtml('head')
|
|
139
|
+
copy.body = inHtml('body')
|
|
140
|
+
}
|
|
141
|
+
return copy
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.default = PseudoHTMLDocument
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Substitute for the NodeList interface.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
5
|
-
*/
|
|
6
|
-
import { LinkedTreeList } from 'collect-your-stuff/dist/collections/linked-tree-list/LinkedTreeList';
|
|
7
|
-
/**
|
|
8
|
-
* A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
9
|
-
* the linkers that hold them.
|
|
10
|
-
* @class
|
|
11
|
-
* @augments LinkedTreeList
|
|
12
|
-
*/
|
|
13
|
-
export declare class PseudoNodeList extends LinkedTreeList {
|
|
14
|
-
/**
|
|
15
|
-
* Iterate over the nodes in this list.
|
|
16
|
-
* @returns {Iterator}
|
|
17
|
-
*/
|
|
18
|
-
[Symbol.iterator](): Iterator<any>;
|
|
19
|
-
/**
|
|
20
|
-
* Iterate over [index, node] pairs.
|
|
21
|
-
* @returns {Iterator}
|
|
22
|
-
*/
|
|
23
|
-
entries(): Iterator<[number, any]>;
|
|
24
|
-
/**
|
|
25
|
-
* Iterate over the indexes.
|
|
26
|
-
* @returns {Iterator}
|
|
27
|
-
*/
|
|
28
|
-
keys(): Iterator<number>;
|
|
29
|
-
/**
|
|
30
|
-
* Iterate over the nodes.
|
|
31
|
-
* @returns {Iterator}
|
|
32
|
-
*/
|
|
33
|
-
values(): Iterator<any>;
|
|
34
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file Substitute for the NodeList interface.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import { LinkedTreeList } from 'collect-your-stuff/dist/collections/linked-tree-list/LinkedTreeList';
|
|
7
|
+
/**
|
|
8
|
+
* A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
9
|
+
* the linkers that hold them.
|
|
10
|
+
* @class
|
|
11
|
+
* @augments LinkedTreeList
|
|
12
|
+
*/
|
|
13
|
+
export declare class PseudoNodeList extends LinkedTreeList {
|
|
14
|
+
/**
|
|
15
|
+
* Iterate over the nodes in this list.
|
|
16
|
+
* @returns {Iterator}
|
|
17
|
+
*/
|
|
18
|
+
[Symbol.iterator](): Iterator<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Iterate over [index, node] pairs.
|
|
21
|
+
* @returns {Iterator}
|
|
22
|
+
*/
|
|
23
|
+
entries(): Iterator<[number, any]>;
|
|
24
|
+
/**
|
|
25
|
+
* Iterate over the indexes.
|
|
26
|
+
* @returns {Iterator}
|
|
27
|
+
*/
|
|
28
|
+
keys(): Iterator<number>;
|
|
29
|
+
/**
|
|
30
|
+
* Iterate over the nodes.
|
|
31
|
+
* @returns {Iterator}
|
|
32
|
+
*/
|
|
33
|
+
values(): Iterator<any>;
|
|
34
|
+
}
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
4
|
-
require('core-js/modules/esnext.iterator.map.js')
|
|
5
|
-
Object.defineProperty(exports, '__esModule', {
|
|
6
|
-
value: true
|
|
7
|
-
})
|
|
8
|
-
exports.PseudoNodeList = void 0
|
|
9
|
-
/**
|
|
10
|
-
* @file Substitute for the NodeList interface.
|
|
11
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
12
|
-
* @version 1.0.0
|
|
13
|
-
*/
|
|
14
|
-
const LinkedTreeList_1 = require('collect-your-stuff/dist/collections/linked-tree-list/LinkedTreeList')
|
|
15
|
-
/**
|
|
16
|
-
* A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
17
|
-
* the linkers that hold them.
|
|
18
|
-
* @class
|
|
19
|
-
* @augments LinkedTreeList
|
|
20
|
-
*/
|
|
21
|
-
class PseudoNodeList extends LinkedTreeList_1.LinkedTreeList {
|
|
22
|
-
/**
|
|
23
|
-
* Iterate over the nodes in this list.
|
|
24
|
-
* @returns {Iterator}
|
|
25
|
-
*/
|
|
26
|
-
[Symbol.iterator] () {
|
|
27
|
-
// Walk the nodes of this list only (the linkers of a child list have no children of their own)
|
|
28
|
-
let current = this.first
|
|
29
|
-
return {
|
|
30
|
-
next: () => {
|
|
31
|
-
if (current === null) {
|
|
32
|
-
return {
|
|
33
|
-
done: true,
|
|
34
|
-
value: undefined
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const result = {
|
|
38
|
-
done: false,
|
|
39
|
-
value: current.data
|
|
40
|
-
}
|
|
41
|
-
current = current.next
|
|
42
|
-
return result
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Iterate over [index, node] pairs.
|
|
49
|
-
* @returns {Iterator}
|
|
50
|
-
*/
|
|
51
|
-
entries () {
|
|
52
|
-
return Array.from(this).map((node, index) => [index, node])[Symbol.iterator]()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Iterate over the indexes.
|
|
57
|
-
* @returns {Iterator}
|
|
58
|
-
*/
|
|
59
|
-
keys () {
|
|
60
|
-
return Array.from(this).map((node, index) => index)[Symbol.iterator]()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Iterate over the nodes.
|
|
65
|
-
* @returns {Iterator}
|
|
66
|
-
*/
|
|
67
|
-
values () {
|
|
68
|
-
return Array.from(this)[Symbol.iterator]()
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.PseudoNodeList = PseudoNodeList
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
4
|
+
require('core-js/modules/esnext.iterator.map.js')
|
|
5
|
+
Object.defineProperty(exports, '__esModule', {
|
|
6
|
+
value: true
|
|
7
|
+
})
|
|
8
|
+
exports.PseudoNodeList = void 0
|
|
9
|
+
/**
|
|
10
|
+
* @file Substitute for the NodeList interface.
|
|
11
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
12
|
+
* @version 1.0.0
|
|
13
|
+
*/
|
|
14
|
+
const LinkedTreeList_1 = require('collect-your-stuff/dist/collections/linked-tree-list/LinkedTreeList')
|
|
15
|
+
/**
|
|
16
|
+
* A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
17
|
+
* the linkers that hold them.
|
|
18
|
+
* @class
|
|
19
|
+
* @augments LinkedTreeList
|
|
20
|
+
*/
|
|
21
|
+
class PseudoNodeList extends LinkedTreeList_1.LinkedTreeList {
|
|
22
|
+
/**
|
|
23
|
+
* Iterate over the nodes in this list.
|
|
24
|
+
* @returns {Iterator}
|
|
25
|
+
*/
|
|
26
|
+
[Symbol.iterator] () {
|
|
27
|
+
// Walk the nodes of this list only (the linkers of a child list have no children of their own)
|
|
28
|
+
let current = this.first
|
|
29
|
+
return {
|
|
30
|
+
next: () => {
|
|
31
|
+
if (current === null) {
|
|
32
|
+
return {
|
|
33
|
+
done: true,
|
|
34
|
+
value: undefined
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const result = {
|
|
38
|
+
done: false,
|
|
39
|
+
value: current.data
|
|
40
|
+
}
|
|
41
|
+
current = current.next
|
|
42
|
+
return result
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Iterate over [index, node] pairs.
|
|
49
|
+
* @returns {Iterator}
|
|
50
|
+
*/
|
|
51
|
+
entries () {
|
|
52
|
+
return Array.from(this).map((node, index) => [index, node])[Symbol.iterator]()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Iterate over the indexes.
|
|
57
|
+
* @returns {Iterator}
|
|
58
|
+
*/
|
|
59
|
+
keys () {
|
|
60
|
+
return Array.from(this).map((node, index) => index)[Symbol.iterator]()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Iterate over the nodes.
|
|
65
|
+
* @returns {Iterator}
|
|
66
|
+
*/
|
|
67
|
+
values () {
|
|
68
|
+
return Array.from(this)[Symbol.iterator]()
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.PseudoNodeList = PseudoNodeList
|
package/dist/classes.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file All of the Pseudo Dom classes for replicating DOM structure.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
5
|
-
*/
|
|
6
|
-
import { EventService as PseudoEvent } from './services/EventService';
|
|
7
|
-
import PseudoEventTarget from './services/EventTargetService';
|
|
8
|
-
import { NodeService as PseudoNode } from './services/NodeService';
|
|
9
|
-
import { ElementService as PseudoElement } from './services/ElementService';
|
|
10
|
-
import { HTMLElementService as PseudoHTMLElement } from './services/HTMLElementService';
|
|
11
|
-
import PseudoHTMLDocument from './classes/PseudoHTMLDocument';
|
|
12
|
-
declare const _default: {
|
|
13
|
-
PseudoEvent: typeof PseudoEvent;
|
|
14
|
-
PseudoEventTarget: typeof PseudoEventTarget;
|
|
15
|
-
PseudoNode: typeof PseudoNode;
|
|
16
|
-
PseudoElement: typeof PseudoElement;
|
|
17
|
-
PseudoHTMLElement: typeof PseudoHTMLElement;
|
|
18
|
-
PseudoHTMLDocument: typeof PseudoHTMLDocument;
|
|
19
|
-
};
|
|
20
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @file All of the Pseudo Dom classes for replicating DOM structure.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import { EventService as PseudoEvent } from './services/EventService';
|
|
7
|
+
import PseudoEventTarget from './services/EventTargetService';
|
|
8
|
+
import { NodeService as PseudoNode } from './services/NodeService';
|
|
9
|
+
import { ElementService as PseudoElement } from './services/ElementService';
|
|
10
|
+
import { HTMLElementService as PseudoHTMLElement } from './services/HTMLElementService';
|
|
11
|
+
import PseudoHTMLDocument from './classes/PseudoHTMLDocument';
|
|
12
|
+
declare const _default: {
|
|
13
|
+
PseudoEvent: typeof PseudoEvent;
|
|
14
|
+
PseudoEventTarget: typeof PseudoEventTarget;
|
|
15
|
+
PseudoNode: typeof PseudoNode;
|
|
16
|
+
PseudoElement: typeof PseudoElement;
|
|
17
|
+
PseudoHTMLElement: typeof PseudoHTMLElement;
|
|
18
|
+
PseudoHTMLDocument: typeof PseudoHTMLDocument;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
package/dist/classes.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file All of the Pseudo Dom classes for replicating DOM structure.
|
|
5
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
6
|
-
* @version 1.0.0
|
|
7
|
-
*/
|
|
8
|
-
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
9
|
-
return mod && mod.__esModule
|
|
10
|
-
? mod
|
|
11
|
-
: {
|
|
12
|
-
default: mod
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(exports, '__esModule', {
|
|
16
|
-
value: true
|
|
17
|
-
})
|
|
18
|
-
const EventService_1 = require('./services/EventService')
|
|
19
|
-
const EventTargetService_1 = __importDefault(require('./services/EventTargetService'))
|
|
20
|
-
const NodeService_1 = require('./services/NodeService')
|
|
21
|
-
const ElementService_1 = require('./services/ElementService')
|
|
22
|
-
const HTMLElementService_1 = require('./services/HTMLElementService')
|
|
23
|
-
const PseudoHTMLDocument_1 = __importDefault(require('./classes/PseudoHTMLDocument'))
|
|
24
|
-
exports.default = {
|
|
25
|
-
PseudoEvent: EventService_1.EventService,
|
|
26
|
-
PseudoEventTarget: EventTargetService_1.default,
|
|
27
|
-
PseudoNode: NodeService_1.NodeService,
|
|
28
|
-
PseudoElement: ElementService_1.ElementService,
|
|
29
|
-
PseudoHTMLElement: HTMLElementService_1.HTMLElementService,
|
|
30
|
-
PseudoHTMLDocument: PseudoHTMLDocument_1.default
|
|
31
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file All of the Pseudo Dom classes for replicating DOM structure.
|
|
5
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
9
|
+
return mod && mod.__esModule
|
|
10
|
+
? mod
|
|
11
|
+
: {
|
|
12
|
+
default: mod
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(exports, '__esModule', {
|
|
16
|
+
value: true
|
|
17
|
+
})
|
|
18
|
+
const EventService_1 = require('./services/EventService')
|
|
19
|
+
const EventTargetService_1 = __importDefault(require('./services/EventTargetService'))
|
|
20
|
+
const NodeService_1 = require('./services/NodeService')
|
|
21
|
+
const ElementService_1 = require('./services/ElementService')
|
|
22
|
+
const HTMLElementService_1 = require('./services/HTMLElementService')
|
|
23
|
+
const PseudoHTMLDocument_1 = __importDefault(require('./classes/PseudoHTMLDocument'))
|
|
24
|
+
exports.default = {
|
|
25
|
+
PseudoEvent: EventService_1.EventService,
|
|
26
|
+
PseudoEventTarget: EventTargetService_1.default,
|
|
27
|
+
PseudoNode: NodeService_1.NodeService,
|
|
28
|
+
PseudoElement: ElementService_1.ElementService,
|
|
29
|
+
PseudoHTMLElement: HTMLElementService_1.HTMLElementService,
|
|
30
|
+
PseudoHTMLDocument: PseudoHTMLDocument_1.default
|
|
31
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { EventService } from '../services/EventService';
|
|
2
|
-
/**
|
|
3
|
-
* How the event is being created.
|
|
4
|
-
* @typedef {Object} CreateEventOptions
|
|
5
|
-
* @property {boolean} [browser=false] The browser is creating the event (for a user action, or for something like
|
|
6
|
-
* element.click()), so the standard options for the type of event apply where the init does not give its own
|
|
7
|
-
* @property {boolean} [trusted=false] The event comes from a real user action rather than from a script (isTrusted)
|
|
8
|
-
*/
|
|
9
|
-
export type CreateEventOptions = {
|
|
10
|
-
browser?: boolean;
|
|
11
|
-
trusted?: boolean;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
|
|
15
|
-
* By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
|
|
16
|
-
* the init says so, and the event is not trusted. With browser: true the event is created the way the browser creates
|
|
17
|
-
* it, using the standard options for its type (see eventDefaults), and trusted: true makes it look like it came from a
|
|
18
|
-
* real user action (isTrusted).
|
|
19
|
-
* @function createEvent
|
|
20
|
-
* @param {string} type The type of the event, such as click
|
|
21
|
-
* @param {Object} [init={}] The options for the event (bubbles, cancelable, composed and those of its kind of event)
|
|
22
|
-
* @param {CreateEventOptions} [options={}] Whether the browser is creating the event, and whether it is trusted
|
|
23
|
-
* @returns {EventService}
|
|
24
|
-
*/
|
|
25
|
-
export declare const createEvent: (type: string, init?: {
|
|
26
|
-
[option: string]: any;
|
|
27
|
-
}, { browser, trusted }?: CreateEventOptions) => EventService;
|
|
28
|
-
export default createEvent;
|
|
1
|
+
import { EventService } from '../services/EventService';
|
|
2
|
+
/**
|
|
3
|
+
* How the event is being created.
|
|
4
|
+
* @typedef {Object} CreateEventOptions
|
|
5
|
+
* @property {boolean} [browser=false] The browser is creating the event (for a user action, or for something like
|
|
6
|
+
* element.click()), so the standard options for the type of event apply where the init does not give its own
|
|
7
|
+
* @property {boolean} [trusted=false] The event comes from a real user action rather than from a script (isTrusted)
|
|
8
|
+
*/
|
|
9
|
+
export type CreateEventOptions = {
|
|
10
|
+
browser?: boolean;
|
|
11
|
+
trusted?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
|
|
15
|
+
* By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
|
|
16
|
+
* the init says so, and the event is not trusted. With browser: true the event is created the way the browser creates
|
|
17
|
+
* it, using the standard options for its type (see eventDefaults), and trusted: true makes it look like it came from a
|
|
18
|
+
* real user action (isTrusted).
|
|
19
|
+
* @function createEvent
|
|
20
|
+
* @param {string} type The type of the event, such as click
|
|
21
|
+
* @param {Object} [init={}] The options for the event (bubbles, cancelable, composed and those of its kind of event)
|
|
22
|
+
* @param {CreateEventOptions} [options={}] Whether the browser is creating the event, and whether it is trusted
|
|
23
|
+
* @returns {EventService}
|
|
24
|
+
*/
|
|
25
|
+
export declare const createEvent: (type: string, init?: {
|
|
26
|
+
[option: string]: any;
|
|
27
|
+
}, { browser, trusted }?: CreateEventOptions) => EventService;
|
|
28
|
+
export default createEvent;
|