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.
Files changed (122) hide show
  1. package/README.md +1495 -119
  2. package/browser/pseudo-dom.js +3539 -482
  3. package/browser/pseudo-dom.min.js +1 -1
  4. package/dist/classes/PseudoEventListener.d.ts +96 -96
  5. package/dist/classes/PseudoEventListener.js +151 -151
  6. package/dist/classes/PseudoHTMLDocument.d.ts +67 -67
  7. package/dist/classes/PseudoHTMLDocument.js +144 -144
  8. package/dist/classes/PseudoNodeList.d.ts +34 -34
  9. package/dist/classes/PseudoNodeList.js +71 -71
  10. package/dist/classes.d.ts +20 -20
  11. package/dist/classes.js +31 -31
  12. package/dist/factories/createEvent.d.ts +28 -28
  13. package/dist/factories/createEvent.js +56 -56
  14. package/dist/factories/cssSelectAdapter.d.ts +23 -0
  15. package/dist/factories/cssSelectAdapter.js +87 -0
  16. package/dist/factories/cssSelectAdapter.min.js +1 -0
  17. package/dist/factories/eventDefaults.d.ts +31 -31
  18. package/dist/factories/eventDefaults.js +105 -105
  19. package/dist/factories/generateDocument.d.ts +11 -11
  20. package/dist/factories/generateDocument.js +65 -65
  21. package/dist/factories/generateNode.d.ts +32 -32
  22. package/dist/factories/generateNode.js +85 -85
  23. package/dist/factories/generateNodeList.d.ts +9 -9
  24. package/dist/factories/generateNodeList.js +13 -13
  25. package/dist/factories/query.d.ts +33 -0
  26. package/dist/factories/query.js +66 -0
  27. package/dist/factories/query.min.js +1 -0
  28. package/dist/factories.d.ts +11 -11
  29. package/dist/factories.js +27 -27
  30. package/dist/functions/activeElement.d.ts +14 -14
  31. package/dist/functions/activeElement.js +33 -33
  32. package/dist/functions/getParentNodes.d.ts +11 -11
  33. package/dist/functions/getParentNodes.js +22 -22
  34. package/dist/functions/getParentNodesFromAttribute.d.ts +14 -14
  35. package/dist/functions/getParentNodesFromAttribute.js +29 -29
  36. package/dist/functions/modifierState.d.ts +29 -29
  37. package/dist/functions/modifierState.js +41 -41
  38. package/dist/functions.d.ts +5 -5
  39. package/dist/functions.js +23 -23
  40. package/dist/interfaces/PseudoAnimation.d.ts +3 -3
  41. package/dist/interfaces/PseudoAnimation.js +5 -5
  42. package/dist/interfaces/PseudoAttr.d.ts +11 -11
  43. package/dist/interfaces/PseudoAttr.js +5 -5
  44. package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -16
  45. package/dist/interfaces/PseudoDOMTokenList.js +5 -5
  46. package/dist/interfaces/PseudoDocument.d.ts +7 -0
  47. package/dist/interfaces/PseudoDocument.js +5 -5
  48. package/dist/interfaces/PseudoDocumentFragment.d.ts +3 -3
  49. package/dist/interfaces/PseudoDocumentFragment.js +5 -5
  50. package/dist/interfaces/PseudoElement.d.ts +48 -24
  51. package/dist/interfaces/PseudoElement.js +5 -5
  52. package/dist/interfaces/PseudoEvent.d.ts +79 -79
  53. package/dist/interfaces/PseudoEvent.js +10 -10
  54. package/dist/interfaces/PseudoEventTarget.d.ts +46 -46
  55. package/dist/interfaces/PseudoEventTarget.js +5 -5
  56. package/dist/interfaces/PseudoHTMLCollection.d.ts +23 -2
  57. package/dist/interfaces/PseudoHTMLCollection.js +5 -5
  58. package/dist/interfaces/PseudoHTMLElement.d.ts +22 -22
  59. package/dist/interfaces/PseudoHTMLElement.js +5 -5
  60. package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -3
  61. package/dist/interfaces/PseudoHTMLSlotElement.js +5 -5
  62. package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -11
  63. package/dist/interfaces/PseudoNamedNodeMap.js +5 -5
  64. package/dist/interfaces/PseudoNode.d.ts +179 -179
  65. package/dist/interfaces/PseudoNode.js +5 -5
  66. package/dist/interfaces/PseudoShadowRoot.d.ts +3 -3
  67. package/dist/interfaces/PseudoShadowRoot.js +5 -5
  68. package/dist/main.d.ts +63 -63
  69. package/dist/main.js +155 -155
  70. package/dist/services/AnimationService.d.ts +4 -4
  71. package/dist/services/AnimationService.js +16 -16
  72. package/dist/services/AttrService.d.ts +37 -37
  73. package/dist/services/AttrService.js +81 -81
  74. package/dist/services/CommentService.d.ts +1 -1
  75. package/dist/services/CommentService.js +13 -13
  76. package/dist/services/CustomEventService.d.ts +37 -37
  77. package/dist/services/CustomEventService.js +35 -35
  78. package/dist/services/DOMTokenListService.d.ts +33 -33
  79. package/dist/services/DOMTokenListService.js +117 -117
  80. package/dist/services/DocumentFragmentService.d.ts +13 -13
  81. package/dist/services/DocumentFragmentService.js +24 -24
  82. package/dist/services/DocumentService.d.ts +7 -0
  83. package/dist/services/DocumentService.js +23 -0
  84. package/dist/services/DocumentService.min.js +1 -1
  85. package/dist/services/ElementService.d.ts +77 -1
  86. package/dist/services/ElementService.js +143 -0
  87. package/dist/services/ElementService.min.js +1 -1
  88. package/dist/services/EventService.d.ts +120 -120
  89. package/dist/services/EventService.js +250 -250
  90. package/dist/services/EventTargetService.d.ts +84 -84
  91. package/dist/services/EventTargetService.js +232 -232
  92. package/dist/services/FocusEventService.d.ts +32 -32
  93. package/dist/services/FocusEventService.js +35 -35
  94. package/dist/services/HTMLCollectionService.d.ts +51 -0
  95. package/dist/services/HTMLCollectionService.js +85 -1
  96. package/dist/services/HTMLCollectionService.min.js +1 -1
  97. package/dist/services/HTMLElementService.d.ts +57 -57
  98. package/dist/services/HTMLElementService.js +163 -163
  99. package/dist/services/HTMLSlotElementService.d.ts +4 -4
  100. package/dist/services/HTMLSlotElementService.js +9 -9
  101. package/dist/services/InputEventService.d.ts +41 -41
  102. package/dist/services/InputEventService.js +47 -47
  103. package/dist/services/KeyboardEventService.d.ts +70 -70
  104. package/dist/services/KeyboardEventService.js +86 -86
  105. package/dist/services/MouseEventService.d.ts +80 -80
  106. package/dist/services/MouseEventService.js +108 -108
  107. package/dist/services/NamedNodeMapService.d.ts +23 -23
  108. package/dist/services/NamedNodeMapService.js +77 -77
  109. package/dist/services/NodeService.d.ts +75 -1
  110. package/dist/services/NodeService.js +145 -7
  111. package/dist/services/NodeService.min.js +1 -1
  112. package/dist/services/PointerEventService.d.ts +51 -51
  113. package/dist/services/PointerEventService.js +67 -67
  114. package/dist/services/ShadowRootService.d.ts +4 -4
  115. package/dist/services/ShadowRootService.js +9 -9
  116. package/dist/services/TextService.d.ts +1 -1
  117. package/dist/services/TextService.js +13 -13
  118. package/dist/services/UIEventService.d.ts +43 -43
  119. package/dist/services/UIEventService.js +42 -42
  120. package/dist/simulate.d.ts +32 -32
  121. package/dist/simulate.js +115 -115
  122. package/package.json +3 -2
@@ -2,6 +2,7 @@
2
2
 
3
3
  require('core-js/modules/esnext.iterator.constructor.js')
4
4
  require('core-js/modules/esnext.iterator.every.js')
5
+ require('core-js/modules/esnext.iterator.filter.js')
5
6
  require('core-js/modules/esnext.iterator.for-each.js')
6
7
  const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
7
8
  return mod && mod.__esModule
@@ -22,6 +23,8 @@ exports.CommentService = exports.TextService = exports.NodeService = void 0
22
23
  const generateNodeList_1 = __importDefault(require('../factories/generateNodeList'))
23
24
  const TreeLinker_1 = require('collect-your-stuff/dist/collections/linked-tree-list/TreeLinker')
24
25
  const EventTargetService_1 = __importDefault(require('./EventTargetService'))
26
+ const HTMLCollectionService_1 = require('./HTMLCollectionService')
27
+ const query_1 = require('../factories/query')
25
28
  /**
26
29
  * Simulate the behaviour of the Node Class when there is no DOM available.
27
30
  * @author Joshua Heagle <joshuaheagle@gmail.com>
@@ -42,7 +45,7 @@ class NodeService extends EventTargetService_1.default {
42
45
  this.ownerDocumentStore = null
43
46
  this.nodeId = NodeService.nextNodeId++
44
47
  this.nodeNameValue = ''
45
- this.children = (0, generateNodeList_1.default)()
48
+ this.childList = (0, generateNodeList_1.default)()
46
49
  this.parent = null
47
50
  this.listLinker = null
48
51
  }
@@ -52,11 +55,11 @@ class NodeService extends EventTargetService_1.default {
52
55
  }
53
56
 
54
57
  get childNodes () {
55
- return this.children
58
+ return this.childList
56
59
  }
57
60
 
58
61
  get firstChild () {
59
- return this.children.first ? this.children.first.data : null
62
+ return this.childList.first ? this.childList.first.data : null
60
63
  }
61
64
 
62
65
  get isConnected () {
@@ -65,7 +68,7 @@ class NodeService extends EventTargetService_1.default {
65
68
  }
66
69
 
67
70
  get lastChild () {
68
- return this.children.last ? this.children.last.data : null
71
+ return this.childList.last ? this.childList.last.data : null
69
72
  }
70
73
 
71
74
  get nextSibling () {
@@ -178,6 +181,141 @@ class NodeService extends EventTargetService_1.default {
178
181
  return this.nodeName === other.nodeName && this.nodeValue === other.nodeValue
179
182
  }
180
183
 
184
+ /**
185
+ * Add nodes (strings become text nodes) as the last children of this node, in the order given.
186
+ * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
187
+ * @throws {Error} When this kind of node cannot have children
188
+ */
189
+ append (...nodes) {
190
+ nodes.forEach(node => this.appendChild(this.toChildNode(node)))
191
+ }
192
+
193
+ /**
194
+ * Add nodes (strings become text nodes) as the first children of this node, in the order given.
195
+ * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
196
+ * @throws {Error} When this kind of node cannot have children
197
+ */
198
+ prepend (...nodes) {
199
+ const reference = this.firstChild
200
+ nodes.forEach(node => this.insertBefore(this.toChildNode(node), reference))
201
+ }
202
+
203
+ /**
204
+ * Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
205
+ * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
206
+ * @throws {Error} When this kind of node cannot have children
207
+ */
208
+ replaceChildren (...nodes) {
209
+ while (this.firstChild) {
210
+ this.removeChild(this.firstChild)
211
+ }
212
+ this.append(...nodes)
213
+ }
214
+
215
+ /**
216
+ * Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
217
+ * no parent.
218
+ * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
219
+ */
220
+ before (...nodes) {
221
+ const parent = this.parentNode
222
+ if (!parent) {
223
+ return
224
+ }
225
+ nodes.forEach(node => parent.insertBefore(this.toChildNode(node), this))
226
+ }
227
+
228
+ /**
229
+ * Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
230
+ * parent.
231
+ * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
232
+ */
233
+ after (...nodes) {
234
+ const parent = this.parentNode
235
+ if (!parent) {
236
+ return
237
+ }
238
+ const reference = this.nextSibling
239
+ nodes.forEach(node => parent.insertBefore(this.toChildNode(node), reference))
240
+ }
241
+
242
+ /**
243
+ * Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
244
+ * when this node has no parent.
245
+ * @param {...(PseudoNode|string)} nodes The nodes (or text) to put in this node's place
246
+ */
247
+ replaceWith (...nodes) {
248
+ const parent = this.parentNode
249
+ if (!parent) {
250
+ return
251
+ }
252
+ nodes.forEach(node => parent.insertBefore(this.toChildNode(node), this))
253
+ parent.removeChild(this)
254
+ }
255
+
256
+ /**
257
+ * Remove this node from its parent. Does nothing when it has no parent.
258
+ */
259
+ remove () {
260
+ if (this.parentNode) {
261
+ this.parentNode.removeChild(this)
262
+ }
263
+ }
264
+
265
+ /**
266
+ * Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
267
+ * becomes a text node belonging to this node's document, anything else is returned as it is.
268
+ * @param {PseudoNode|string} value The value to add
269
+ * @returns {PseudoNode}
270
+ */
271
+ toChildNode (value) {
272
+ if (typeof value !== 'string') {
273
+ return value
274
+ }
275
+ const text = new TextService(value)
276
+ text.ownerDocumentStore = this.ownerDocument
277
+ return text
278
+ }
279
+
280
+ /**
281
+ * Every element below this node with the given tag name (or every element when tagName is *), live.
282
+ * @param {string} tagName
283
+ * @returns {PseudoHTMLCollection}
284
+ */
285
+ getElementsByTagName (tagName) {
286
+ const matchesTag = tagName === '*' ? () => true : element => element.tagName === tagName
287
+ return new HTMLCollectionService_1.HTMLCollectionService(this, matchesTag, true)
288
+ }
289
+
290
+ /**
291
+ * Every element below this node which has all of the given (space separated) classes, live.
292
+ * @param {string} className
293
+ * @returns {PseudoHTMLCollection}
294
+ */
295
+ getElementsByClassName (className) {
296
+ const names = className.trim().split(/\s+/).filter(Boolean)
297
+ return new HTMLCollectionService_1.HTMLCollectionService(this, element => names.every(name => element.classList.contains(name)), true)
298
+ }
299
+
300
+ /**
301
+ * The first element below this node which matches the CSS selector, in tree order, or null when there is none.
302
+ * @param {string} selectors A CSS selector
303
+ * @returns {PseudoElement|null}
304
+ */
305
+ querySelector (selectors) {
306
+ return (0, query_1.querySelector)(selectors, this)
307
+ }
308
+
309
+ /**
310
+ * Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
311
+ * collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
312
+ * @param {string} selectors A CSS selector
313
+ * @returns {Array<PseudoElement>}
314
+ */
315
+ querySelectorAll (selectors) {
316
+ return (0, query_1.querySelectorAll)(selectors, this)
317
+ }
318
+
181
319
  /**
182
320
  * Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
183
321
  * (for example elements applying default events) can do so.
@@ -266,7 +404,7 @@ class NodeService extends EventTargetService_1.default {
266
404
  }
267
405
 
268
406
  hasChildNodes () {
269
- return this.children.length > 0
407
+ return this.childList.length > 0
270
408
  }
271
409
 
272
410
  /**
@@ -305,7 +443,7 @@ class NodeService extends EventTargetService_1.default {
305
443
  const linker = new TreeLinker_1.TreeLinker({
306
444
  data: newNode
307
445
  })
308
- this.children.insertBefore(referenceNode ? referenceNode.listLinker : null, linker)
446
+ this.childList.insertBefore(referenceNode ? referenceNode.listLinker : null, linker)
309
447
  const inserted = newNode
310
448
  inserted.parent = this
311
449
  inserted.listLinker = linker
@@ -383,7 +521,7 @@ class NodeService extends EventTargetService_1.default {
383
521
  throw new Error('The node to be removed is not a child of this node.')
384
522
  }
385
523
  const removed = childElement
386
- this.children.remove(removed.listLinker)
524
+ this.childList.remove(removed.listLinker)
387
525
  removed.parent = null
388
526
  removed.listLinker = null
389
527
  return childElement
@@ -1 +1 @@
1
- "use strict";require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.every.js"),require("core-js/modules/esnext.iterator.for-each.js");var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommentService=exports.TextService=exports.NodeService=void 0;const generateNodeList_1=__importDefault(require("../factories/generateNodeList")),TreeLinker_1=require("collect-your-stuff/dist/collections/linked-tree-list/TreeLinker"),EventTargetService_1=__importDefault(require("./EventTargetService"));class NodeService extends EventTargetService_1.default{constructor(){super(),this.nodeValueStore=null,this.ownerDocumentStore=null,this.nodeId=NodeService.nextNodeId++,this.nodeNameValue="",this.children=(0,generateNodeList_1.default)(),this.parent=null,this.listLinker=null}get baseURI(){return window.location||"/"}get childNodes(){return this.children}get firstChild(){return this.children.first?this.children.first.data:null}get isConnected(){return this.getRootNode().nodeType===NodeService.DOCUMENT_NODE}get lastChild(){return this.children.last?this.children.last.data:null}get nextSibling(){return this.listLinker&&this.listLinker.next?this.listLinker.next.data:null}get nodeName(){return this.nodeNameValue||""}get nodeType(){return NodeService.DEFAULT_NODE}get nodeValue(){return this.nodeValueStore}set nodeValue(e){this.nodeValueStore=e}get ownerDocument(){if(this.nodeType===NodeService.DOCUMENT_NODE)return null;const e=this.getRootNode();return e.nodeType===NodeService.DOCUMENT_NODE?e:this.ownerDocumentStore}get parentNode(){return this.parent}get parentElement(){return this.parent&&this.parent.nodeType===NodeService.ELEMENT_NODE?this.parent:null}get previousSibling(){return this.listLinker&&this.listLinker.prev?this.listLinker.prev.data:null}get textContent(){if(this.nodeType===NodeService.DOCUMENT_NODE||this.nodeType===NodeService.DOCUMENT_TYPE_NODE)return null;let e="";return Array.from(this.childNodes).forEach(t=>{t.nodeType===NodeService.TEXT_NODE?e+=t.nodeValue:t.nodeType!==NodeService.COMMENT_NODE&&(e+=t.textContent)}),e}set textContent(e){if(this.nodeType!==NodeService.DOCUMENT_NODE&&this.nodeType!==NodeService.DOCUMENT_TYPE_NODE){for(;this.firstChild;)this.removeChild(this.firstChild);if(null!=e&&""!==String(e)){const t=new TextService(String(e));t.ownerDocumentStore=this.ownerDocument,this.appendChild(t)}}}appendChild(e){return this.insertBefore(e,null)}get acceptsChildren(){return!0}cloneShallow(){const e=new this.constructor;return e.nodeValue=this.nodeValue,e.ownerDocumentStore=this.ownerDocumentStore,e}equalsShallow(e){return this.nodeName===e.nodeName&&this.nodeValue===e.nodeValue}childInserted(e){}cloneNode(e=!1){const t=this.cloneShallow();return e&&Array.from(this.childNodes).forEach(e=>t.appendChild(e.cloneNode(!0))),t}compareDocumentPosition(e){if(e===this)return 0;const t=e=>{const t=[];for(let r=e;r;r=r.parentNode)t.unshift(r);return t},r=t(this),n=t(e);if(r[0]!==n[0]){const t=e.nodeId<this.nodeId?NodeService.DOCUMENT_POSITION_PRECEDING:NodeService.DOCUMENT_POSITION_FOLLOWING;return NodeService.DOCUMENT_POSITION_DISCONNECTED|NodeService.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t}if(n.length<r.length&&n.every((e,t)=>r[t]===e))return NodeService.DOCUMENT_POSITION_CONTAINS|NodeService.DOCUMENT_POSITION_PRECEDING;if(r.length<n.length&&r.every((e,t)=>n[t]===e))return NodeService.DOCUMENT_POSITION_CONTAINED_BY|NodeService.DOCUMENT_POSITION_FOLLOWING;let i=0;for(;r[i]===n[i];)++i;for(let e=r[i].nextSibling;e;e=e.nextSibling)if(e===n[i])return NodeService.DOCUMENT_POSITION_FOLLOWING;return NodeService.DOCUMENT_POSITION_PRECEDING}contains(e){let t=e;for(;t;){if(t===this)return!0;t=t.parentNode}return!1}getRootNode(e={composed:!1}){return this.parent?this.parent.getRootNode(e):this}hasChildNodes(){return this.children.length>0}insertBefore(e,t=null){if(!this.acceptsChildren)throw new Error("This kind of node cannot have children.");if(null!==t&&t.parentNode!==this)throw new Error("The node before which the new node is to be inserted is not a child of this node.");if(e===t)return e;if("function"==typeof e.contains&&e.contains(this))throw new Error("The new node cannot be inserted into itself or one of its own descendants.");if(e.nodeType===NodeService.DOCUMENT_FRAGMENT_NODE){for(;e.firstChild;)this.insertBefore(e.firstChild,t);return e}e.parentNode&&e.parentNode.removeChild(e);const r=new TreeLinker_1.TreeLinker({data:e});this.children.insertBefore(t?t.listLinker:null,r);const n=e;return n.parent=this,n.listLinker=r,this.childInserted(n),e}isDefaultNamespace(e){return null===e}isEqualNode(e){if(!e||e.nodeType!==this.nodeType||!this.equalsShallow(e))return!1;const t=Array.from(this.childNodes),r=Array.from(e.childNodes);return t.length===r.length&&t.every((e,t)=>e.isEqualNode(r[t]))}isSameNode(e){return this===e}lookupPrefix(e){return null}lookupNamespaceURI(e){return null}normalize(){let e=this.firstChild;for(;e;)if(e.nodeType===NodeService.TEXT_NODE){let t=e.nodeValue,r=e.nextSibling;for(;r&&r.nodeType===NodeService.TEXT_NODE;){t+=r.nodeValue;const e=r.nextSibling;this.removeChild(r),r=e}e.nodeValue=t,""===t&&this.removeChild(e),e=r}else e.normalize(),e=e.nextSibling}removeChild(e){if(!e||e.parentNode!==this)throw new Error("The node to be removed is not a child of this node.");const t=e;return this.children.remove(t.listLinker),t.parent=null,t.listLinker=null,e}replaceChild(e,t){if(!t||t.parentNode!==this)throw new Error("The node to be replaced is not a child of this node.");if(e===t)return t;let r=t.nextSibling;return r===e&&(r=e.nextSibling),this.removeChild(t),this.insertBefore(e,r),t}}exports.NodeService=NodeService,NodeService.DEFAULT_NODE=0,NodeService.ELEMENT_NODE=1,NodeService.ATTRIBUTE_NODE=2,NodeService.TEXT_NODE=3,NodeService.CDATA_SECTION_NODE=4,NodeService.ENTITY_REFERENCE_NODE=5,NodeService.ENTITY_NODE=6,NodeService.PROCESSING_INSTRUCTION_NODE=7,NodeService.COMMENT_NODE=8,NodeService.DOCUMENT_NODE=9,NodeService.DOCUMENT_TYPE_NODE=10,NodeService.DOCUMENT_FRAGMENT_NODE=11,NodeService.NOTATION_NODE=12,NodeService.DOCUMENT_POSITION_DISCONNECTED=1,NodeService.DOCUMENT_POSITION_PRECEDING=2,NodeService.DOCUMENT_POSITION_FOLLOWING=4,NodeService.DOCUMENT_POSITION_CONTAINS=8,NodeService.DOCUMENT_POSITION_CONTAINED_BY=16,NodeService.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,NodeService.nextNodeId=1;class TextService extends NodeService{constructor(e=""){super(),this.nodeValue=String(e)}get acceptsChildren(){return!1}get nodeName(){return"#text"}get nodeType(){return NodeService.TEXT_NODE}get data(){return this.nodeValue}set data(e){this.nodeValue=String(e)}get length(){return this.data.length}get textContent(){return this.data}set textContent(e){this.data=null===e?"":String(e)}get wholeText(){let e=this;for(;e.previousSibling&&e.previousSibling.nodeType===NodeService.TEXT_NODE;)e=e.previousSibling;let t="";for(let r=e;r&&r.nodeType===NodeService.TEXT_NODE;r=r.nextSibling)t+=r.nodeValue;return t}splitText(e){if(e<0||e>this.length)throw new Error("The offset is beyond the end of the text.");const t=new TextService(this.data.slice(e));return t.ownerDocumentStore=this.ownerDocumentStore,this.data=this.data.slice(0,e),this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling),t}cloneShallow(){const e=new TextService(this.data);return e.ownerDocumentStore=this.ownerDocumentStore,e}}exports.TextService=TextService;class CommentService extends NodeService{constructor(e=""){super(),this.nodeValue=String(e)}get acceptsChildren(){return!1}get nodeName(){return"#comment"}get nodeType(){return NodeService.COMMENT_NODE}get data(){return this.nodeValue}set data(e){this.nodeValue=String(e)}get length(){return this.data.length}get textContent(){return this.data}set textContent(e){this.data=null===e?"":String(e)}cloneShallow(){const e=new CommentService(this.data);return e.ownerDocumentStore=this.ownerDocumentStore,e}}exports.CommentService=CommentService;
1
+ "use strict";require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.every.js"),require("core-js/modules/esnext.iterator.filter.js"),require("core-js/modules/esnext.iterator.for-each.js");var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommentService=exports.TextService=exports.NodeService=void 0;const generateNodeList_1=__importDefault(require("../factories/generateNodeList")),TreeLinker_1=require("collect-your-stuff/dist/collections/linked-tree-list/TreeLinker"),EventTargetService_1=__importDefault(require("./EventTargetService")),HTMLCollectionService_1=require("./HTMLCollectionService"),query_1=require("../factories/query");class NodeService extends EventTargetService_1.default{constructor(){super(),this.nodeValueStore=null,this.ownerDocumentStore=null,this.nodeId=NodeService.nextNodeId++,this.nodeNameValue="",this.childList=(0,generateNodeList_1.default)(),this.parent=null,this.listLinker=null}get baseURI(){return window.location||"/"}get childNodes(){return this.childList}get firstChild(){return this.childList.first?this.childList.first.data:null}get isConnected(){return this.getRootNode().nodeType===NodeService.DOCUMENT_NODE}get lastChild(){return this.childList.last?this.childList.last.data:null}get nextSibling(){return this.listLinker&&this.listLinker.next?this.listLinker.next.data:null}get nodeName(){return this.nodeNameValue||""}get nodeType(){return NodeService.DEFAULT_NODE}get nodeValue(){return this.nodeValueStore}set nodeValue(e){this.nodeValueStore=e}get ownerDocument(){if(this.nodeType===NodeService.DOCUMENT_NODE)return null;const e=this.getRootNode();return e.nodeType===NodeService.DOCUMENT_NODE?e:this.ownerDocumentStore}get parentNode(){return this.parent}get parentElement(){return this.parent&&this.parent.nodeType===NodeService.ELEMENT_NODE?this.parent:null}get previousSibling(){return this.listLinker&&this.listLinker.prev?this.listLinker.prev.data:null}get textContent(){if(this.nodeType===NodeService.DOCUMENT_NODE||this.nodeType===NodeService.DOCUMENT_TYPE_NODE)return null;let e="";return Array.from(this.childNodes).forEach(t=>{t.nodeType===NodeService.TEXT_NODE?e+=t.nodeValue:t.nodeType!==NodeService.COMMENT_NODE&&(e+=t.textContent)}),e}set textContent(e){if(this.nodeType!==NodeService.DOCUMENT_NODE&&this.nodeType!==NodeService.DOCUMENT_TYPE_NODE){for(;this.firstChild;)this.removeChild(this.firstChild);if(null!=e&&""!==String(e)){const t=new TextService(String(e));t.ownerDocumentStore=this.ownerDocument,this.appendChild(t)}}}appendChild(e){return this.insertBefore(e,null)}get acceptsChildren(){return!0}cloneShallow(){const e=new this.constructor;return e.nodeValue=this.nodeValue,e.ownerDocumentStore=this.ownerDocumentStore,e}equalsShallow(e){return this.nodeName===e.nodeName&&this.nodeValue===e.nodeValue}append(...e){e.forEach(e=>this.appendChild(this.toChildNode(e)))}prepend(...e){const t=this.firstChild;e.forEach(e=>this.insertBefore(this.toChildNode(e),t))}replaceChildren(...e){for(;this.firstChild;)this.removeChild(this.firstChild);this.append(...e)}before(...e){const t=this.parentNode;t&&e.forEach(e=>t.insertBefore(this.toChildNode(e),this))}after(...e){const t=this.parentNode;if(!t)return;const r=this.nextSibling;e.forEach(e=>t.insertBefore(this.toChildNode(e),r))}replaceWith(...e){const t=this.parentNode;t&&(e.forEach(e=>t.insertBefore(this.toChildNode(e),this)),t.removeChild(this))}remove(){this.parentNode&&this.parentNode.removeChild(this)}toChildNode(e){if("string"!=typeof e)return e;const t=new TextService(e);return t.ownerDocumentStore=this.ownerDocument,t}getElementsByTagName(e){const t="*"===e?()=>!0:t=>t.tagName===e;return new HTMLCollectionService_1.HTMLCollectionService(this,t,!0)}getElementsByClassName(e){const t=e.trim().split(/\s+/).filter(Boolean);return new HTMLCollectionService_1.HTMLCollectionService(this,e=>t.every(t=>e.classList.contains(t)),!0)}querySelector(e){return(0,query_1.querySelector)(e,this)}querySelectorAll(e){return(0,query_1.querySelectorAll)(e,this)}childInserted(e){}cloneNode(e=!1){const t=this.cloneShallow();return e&&Array.from(this.childNodes).forEach(e=>t.appendChild(e.cloneNode(!0))),t}compareDocumentPosition(e){if(e===this)return 0;const t=e=>{const t=[];for(let r=e;r;r=r.parentNode)t.unshift(r);return t},r=t(this),i=t(e);if(r[0]!==i[0]){const t=e.nodeId<this.nodeId?NodeService.DOCUMENT_POSITION_PRECEDING:NodeService.DOCUMENT_POSITION_FOLLOWING;return NodeService.DOCUMENT_POSITION_DISCONNECTED|NodeService.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t}if(i.length<r.length&&i.every((e,t)=>r[t]===e))return NodeService.DOCUMENT_POSITION_CONTAINS|NodeService.DOCUMENT_POSITION_PRECEDING;if(r.length<i.length&&r.every((e,t)=>i[t]===e))return NodeService.DOCUMENT_POSITION_CONTAINED_BY|NodeService.DOCUMENT_POSITION_FOLLOWING;let n=0;for(;r[n]===i[n];)++n;for(let e=r[n].nextSibling;e;e=e.nextSibling)if(e===i[n])return NodeService.DOCUMENT_POSITION_FOLLOWING;return NodeService.DOCUMENT_POSITION_PRECEDING}contains(e){let t=e;for(;t;){if(t===this)return!0;t=t.parentNode}return!1}getRootNode(e={composed:!1}){return this.parent?this.parent.getRootNode(e):this}hasChildNodes(){return this.childList.length>0}insertBefore(e,t=null){if(!this.acceptsChildren)throw new Error("This kind of node cannot have children.");if(null!==t&&t.parentNode!==this)throw new Error("The node before which the new node is to be inserted is not a child of this node.");if(e===t)return e;if("function"==typeof e.contains&&e.contains(this))throw new Error("The new node cannot be inserted into itself or one of its own descendants.");if(e.nodeType===NodeService.DOCUMENT_FRAGMENT_NODE){for(;e.firstChild;)this.insertBefore(e.firstChild,t);return e}e.parentNode&&e.parentNode.removeChild(e);const r=new TreeLinker_1.TreeLinker({data:e});this.childList.insertBefore(t?t.listLinker:null,r);const i=e;return i.parent=this,i.listLinker=r,this.childInserted(i),e}isDefaultNamespace(e){return null===e}isEqualNode(e){if(!e||e.nodeType!==this.nodeType||!this.equalsShallow(e))return!1;const t=Array.from(this.childNodes),r=Array.from(e.childNodes);return t.length===r.length&&t.every((e,t)=>e.isEqualNode(r[t]))}isSameNode(e){return this===e}lookupPrefix(e){return null}lookupNamespaceURI(e){return null}normalize(){let e=this.firstChild;for(;e;)if(e.nodeType===NodeService.TEXT_NODE){let t=e.nodeValue,r=e.nextSibling;for(;r&&r.nodeType===NodeService.TEXT_NODE;){t+=r.nodeValue;const e=r.nextSibling;this.removeChild(r),r=e}e.nodeValue=t,""===t&&this.removeChild(e),e=r}else e.normalize(),e=e.nextSibling}removeChild(e){if(!e||e.parentNode!==this)throw new Error("The node to be removed is not a child of this node.");const t=e;return this.childList.remove(t.listLinker),t.parent=null,t.listLinker=null,e}replaceChild(e,t){if(!t||t.parentNode!==this)throw new Error("The node to be replaced is not a child of this node.");if(e===t)return t;let r=t.nextSibling;return r===e&&(r=e.nextSibling),this.removeChild(t),this.insertBefore(e,r),t}}exports.NodeService=NodeService,NodeService.DEFAULT_NODE=0,NodeService.ELEMENT_NODE=1,NodeService.ATTRIBUTE_NODE=2,NodeService.TEXT_NODE=3,NodeService.CDATA_SECTION_NODE=4,NodeService.ENTITY_REFERENCE_NODE=5,NodeService.ENTITY_NODE=6,NodeService.PROCESSING_INSTRUCTION_NODE=7,NodeService.COMMENT_NODE=8,NodeService.DOCUMENT_NODE=9,NodeService.DOCUMENT_TYPE_NODE=10,NodeService.DOCUMENT_FRAGMENT_NODE=11,NodeService.NOTATION_NODE=12,NodeService.DOCUMENT_POSITION_DISCONNECTED=1,NodeService.DOCUMENT_POSITION_PRECEDING=2,NodeService.DOCUMENT_POSITION_FOLLOWING=4,NodeService.DOCUMENT_POSITION_CONTAINS=8,NodeService.DOCUMENT_POSITION_CONTAINED_BY=16,NodeService.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,NodeService.nextNodeId=1;class TextService extends NodeService{constructor(e=""){super(),this.nodeValue=String(e)}get acceptsChildren(){return!1}get nodeName(){return"#text"}get nodeType(){return NodeService.TEXT_NODE}get data(){return this.nodeValue}set data(e){this.nodeValue=String(e)}get length(){return this.data.length}get textContent(){return this.data}set textContent(e){this.data=null===e?"":String(e)}get wholeText(){let e=this;for(;e.previousSibling&&e.previousSibling.nodeType===NodeService.TEXT_NODE;)e=e.previousSibling;let t="";for(let r=e;r&&r.nodeType===NodeService.TEXT_NODE;r=r.nextSibling)t+=r.nodeValue;return t}splitText(e){if(e<0||e>this.length)throw new Error("The offset is beyond the end of the text.");const t=new TextService(this.data.slice(e));return t.ownerDocumentStore=this.ownerDocumentStore,this.data=this.data.slice(0,e),this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling),t}cloneShallow(){const e=new TextService(this.data);return e.ownerDocumentStore=this.ownerDocumentStore,e}}exports.TextService=TextService;class CommentService extends NodeService{constructor(e=""){super(),this.nodeValue=String(e)}get acceptsChildren(){return!1}get nodeName(){return"#comment"}get nodeType(){return NodeService.COMMENT_NODE}get data(){return this.nodeValue}set data(e){this.nodeValue=String(e)}get length(){return this.data.length}get textContent(){return this.data}set textContent(e){this.data=null===e?"":String(e)}cloneShallow(){const e=new CommentService(this.data);return e.ownerDocumentStore=this.ownerDocumentStore,e}}exports.CommentService=CommentService;
@@ -1,51 +1,51 @@
1
- /**
2
- * @file Substitute for the DOM PointerEvent Class.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- */
6
- import { MouseEventInit, MouseEventService } from './MouseEventService';
7
- /**
8
- * The options for creating a pointer event, on top of the ones every mouse event has.
9
- * @typedef {Object} PointerEventInit
10
- * @property {number} [pointerId=0]
11
- * @property {number} [width=1]
12
- * @property {number} [height=1]
13
- * @property {number} [pressure=0]
14
- * @property {string} [pointerType=''] mouse, pen or touch
15
- * @property {boolean} [isPrimary=false]
16
- */
17
- export type PointerEventInit = MouseEventInit & {
18
- pointerId?: number;
19
- width?: number;
20
- height?: number;
21
- pressure?: number;
22
- pointerType?: string;
23
- isPrimary?: boolean;
24
- };
25
- /**
26
- * Simulate the behaviour of the PointerEvent Class when there is no DOM available.
27
- * @author Joshua Heagle <joshuaheagle@gmail.com>
28
- * @class
29
- * @augments MouseEventService
30
- * @property {number} pointerId
31
- * @property {number} width
32
- * @property {number} height
33
- * @property {number} pressure
34
- * @property {string} pointerType
35
- * @property {boolean} isPrimary
36
- */
37
- export declare class PointerEventService extends MouseEventService {
38
- private readonly pointer;
39
- /**
40
- * @param {string} [typeArg=''] The type of the event
41
- * @param {PointerEventInit} [init={}] The options for the event
42
- * @constructor
43
- */
44
- constructor(typeArg?: string, init?: PointerEventInit);
45
- get pointerId(): number;
46
- get width(): number;
47
- get height(): number;
48
- get pressure(): number;
49
- get pointerType(): string;
50
- get isPrimary(): boolean;
51
- }
1
+ /**
2
+ * @file Substitute for the DOM PointerEvent Class.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.0.0
5
+ */
6
+ import { MouseEventInit, MouseEventService } from './MouseEventService';
7
+ /**
8
+ * The options for creating a pointer event, on top of the ones every mouse event has.
9
+ * @typedef {Object} PointerEventInit
10
+ * @property {number} [pointerId=0]
11
+ * @property {number} [width=1]
12
+ * @property {number} [height=1]
13
+ * @property {number} [pressure=0]
14
+ * @property {string} [pointerType=''] mouse, pen or touch
15
+ * @property {boolean} [isPrimary=false]
16
+ */
17
+ export type PointerEventInit = MouseEventInit & {
18
+ pointerId?: number;
19
+ width?: number;
20
+ height?: number;
21
+ pressure?: number;
22
+ pointerType?: string;
23
+ isPrimary?: boolean;
24
+ };
25
+ /**
26
+ * Simulate the behaviour of the PointerEvent Class when there is no DOM available.
27
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
28
+ * @class
29
+ * @augments MouseEventService
30
+ * @property {number} pointerId
31
+ * @property {number} width
32
+ * @property {number} height
33
+ * @property {number} pressure
34
+ * @property {string} pointerType
35
+ * @property {boolean} isPrimary
36
+ */
37
+ export declare class PointerEventService extends MouseEventService {
38
+ private readonly pointer;
39
+ /**
40
+ * @param {string} [typeArg=''] The type of the event
41
+ * @param {PointerEventInit} [init={}] The options for the event
42
+ * @constructor
43
+ */
44
+ constructor(typeArg?: string, init?: PointerEventInit);
45
+ get pointerId(): number;
46
+ get width(): number;
47
+ get height(): number;
48
+ get pressure(): number;
49
+ get pointerType(): string;
50
+ get isPrimary(): boolean;
51
+ }
@@ -1,67 +1,67 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.PointerEventService = void 0
7
- /**
8
- * @file Substitute for the DOM PointerEvent Class.
9
- * @author Joshua Heagle <joshuaheagle@gmail.com>
10
- * @version 1.0.0
11
- */
12
- const MouseEventService_1 = require('./MouseEventService')
13
- /**
14
- * Simulate the behaviour of the PointerEvent Class when there is no DOM available.
15
- * @author Joshua Heagle <joshuaheagle@gmail.com>
16
- * @class
17
- * @augments MouseEventService
18
- * @property {number} pointerId
19
- * @property {number} width
20
- * @property {number} height
21
- * @property {number} pressure
22
- * @property {string} pointerType
23
- * @property {boolean} isPrimary
24
- */
25
- class PointerEventService extends MouseEventService_1.MouseEventService {
26
- /**
27
- * @param {string} [typeArg=''] The type of the event
28
- * @param {PointerEventInit} [init={}] The options for the event
29
- * @constructor
30
- */
31
- constructor (typeArg = '', init = {}) {
32
- super(typeArg, init)
33
- this.pointer = {
34
- pointerId: init.pointerId || 0,
35
- width: typeof init.width === 'number' ? init.width : 1,
36
- height: typeof init.height === 'number' ? init.height : 1,
37
- pressure: init.pressure || 0,
38
- pointerType: init.pointerType || '',
39
- isPrimary: !!init.isPrimary
40
- }
41
- }
42
-
43
- get pointerId () {
44
- return this.pointer.pointerId
45
- }
46
-
47
- get width () {
48
- return this.pointer.width
49
- }
50
-
51
- get height () {
52
- return this.pointer.height
53
- }
54
-
55
- get pressure () {
56
- return this.pointer.pressure
57
- }
58
-
59
- get pointerType () {
60
- return this.pointer.pointerType
61
- }
62
-
63
- get isPrimary () {
64
- return this.pointer.isPrimary
65
- }
66
- }
67
- exports.PointerEventService = PointerEventService
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.PointerEventService = void 0
7
+ /**
8
+ * @file Substitute for the DOM PointerEvent Class.
9
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
10
+ * @version 1.0.0
11
+ */
12
+ const MouseEventService_1 = require('./MouseEventService')
13
+ /**
14
+ * Simulate the behaviour of the PointerEvent Class when there is no DOM available.
15
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
16
+ * @class
17
+ * @augments MouseEventService
18
+ * @property {number} pointerId
19
+ * @property {number} width
20
+ * @property {number} height
21
+ * @property {number} pressure
22
+ * @property {string} pointerType
23
+ * @property {boolean} isPrimary
24
+ */
25
+ class PointerEventService extends MouseEventService_1.MouseEventService {
26
+ /**
27
+ * @param {string} [typeArg=''] The type of the event
28
+ * @param {PointerEventInit} [init={}] The options for the event
29
+ * @constructor
30
+ */
31
+ constructor (typeArg = '', init = {}) {
32
+ super(typeArg, init)
33
+ this.pointer = {
34
+ pointerId: init.pointerId || 0,
35
+ width: typeof init.width === 'number' ? init.width : 1,
36
+ height: typeof init.height === 'number' ? init.height : 1,
37
+ pressure: init.pressure || 0,
38
+ pointerType: init.pointerType || '',
39
+ isPrimary: !!init.isPrimary
40
+ }
41
+ }
42
+
43
+ get pointerId () {
44
+ return this.pointer.pointerId
45
+ }
46
+
47
+ get width () {
48
+ return this.pointer.width
49
+ }
50
+
51
+ get height () {
52
+ return this.pointer.height
53
+ }
54
+
55
+ get pressure () {
56
+ return this.pointer.pressure
57
+ }
58
+
59
+ get pointerType () {
60
+ return this.pointer.pointerType
61
+ }
62
+
63
+ get isPrimary () {
64
+ return this.pointer.isPrimary
65
+ }
66
+ }
67
+ exports.PointerEventService = PointerEventService
@@ -1,4 +1,4 @@
1
- import { DocumentFragmentService } from './DocumentFragmentService';
2
- import { PseudoShadowRoot } from '../interfaces/PseudoShadowRoot';
3
- export declare class ShadowRootService extends DocumentFragmentService implements PseudoShadowRoot {
4
- }
1
+ import { DocumentFragmentService } from './DocumentFragmentService';
2
+ import { PseudoShadowRoot } from '../interfaces/PseudoShadowRoot';
3
+ export declare class ShadowRootService extends DocumentFragmentService implements PseudoShadowRoot {
4
+ }
@@ -1,9 +1,9 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.ShadowRootService = void 0
7
- const DocumentFragmentService_1 = require('./DocumentFragmentService')
8
- class ShadowRootService extends DocumentFragmentService_1.DocumentFragmentService {}
9
- exports.ShadowRootService = ShadowRootService
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.ShadowRootService = void 0
7
+ const DocumentFragmentService_1 = require('./DocumentFragmentService')
8
+ class ShadowRootService extends DocumentFragmentService_1.DocumentFragmentService {}
9
+ exports.ShadowRootService = ShadowRootService
@@ -1 +1 @@
1
- export { TextService } from './NodeService';
1
+ export { TextService } from './NodeService';
@@ -1,13 +1,13 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.TextService = void 0
7
- const NodeService_1 = require('./NodeService')
8
- Object.defineProperty(exports, 'TextService', {
9
- enumerable: true,
10
- get: function () {
11
- return NodeService_1.TextService
12
- }
13
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.TextService = void 0
7
+ const NodeService_1 = require('./NodeService')
8
+ Object.defineProperty(exports, 'TextService', {
9
+ enumerable: true,
10
+ get: function () {
11
+ return NodeService_1.TextService
12
+ }
13
+ })
@@ -1,43 +1,43 @@
1
- /**
2
- * @file Substitute for the DOM UIEvent Class.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- */
6
- import { EventService } from './EventService';
7
- /**
8
- * The options for creating an event, on top of the ones every event has.
9
- * @typedef {Object} UIEventInit
10
- * @property {boolean} [bubbles=false]
11
- * @property {boolean} [cancelable=false]
12
- * @property {boolean} [composed=false]
13
- * @property {number} [detail=0] Details about the event, such as how many times the mouse was clicked
14
- * @property {*} [view=null] The window the event happened in
15
- */
16
- export type UIEventInit = {
17
- bubbles?: boolean;
18
- cancelable?: boolean;
19
- composed?: boolean;
20
- detail?: number;
21
- view?: any;
22
- };
23
- /**
24
- * Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
25
- * interface (the mouse, the keyboard, focus and input).
26
- * @author Joshua Heagle <joshuaheagle@gmail.com>
27
- * @class
28
- * @augments EventService
29
- * @property {number} detail
30
- * @property {*} view
31
- */
32
- export declare class UIEventService extends EventService {
33
- private readonly uiDetail;
34
- private readonly uiView;
35
- /**
36
- * @param {string} [typeArg=''] The type of the event
37
- * @param {UIEventInit} [init={}] The options for the event
38
- * @constructor
39
- */
40
- constructor(typeArg?: string, init?: UIEventInit);
41
- get detail(): number;
42
- get view(): any;
43
- }
1
+ /**
2
+ * @file Substitute for the DOM UIEvent Class.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.0.0
5
+ */
6
+ import { EventService } from './EventService';
7
+ /**
8
+ * The options for creating an event, on top of the ones every event has.
9
+ * @typedef {Object} UIEventInit
10
+ * @property {boolean} [bubbles=false]
11
+ * @property {boolean} [cancelable=false]
12
+ * @property {boolean} [composed=false]
13
+ * @property {number} [detail=0] Details about the event, such as how many times the mouse was clicked
14
+ * @property {*} [view=null] The window the event happened in
15
+ */
16
+ export type UIEventInit = {
17
+ bubbles?: boolean;
18
+ cancelable?: boolean;
19
+ composed?: boolean;
20
+ detail?: number;
21
+ view?: any;
22
+ };
23
+ /**
24
+ * Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
25
+ * interface (the mouse, the keyboard, focus and input).
26
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
27
+ * @class
28
+ * @augments EventService
29
+ * @property {number} detail
30
+ * @property {*} view
31
+ */
32
+ export declare class UIEventService extends EventService {
33
+ private readonly uiDetail;
34
+ private readonly uiView;
35
+ /**
36
+ * @param {string} [typeArg=''] The type of the event
37
+ * @param {UIEventInit} [init={}] The options for the event
38
+ * @constructor
39
+ */
40
+ constructor(typeArg?: string, init?: UIEventInit);
41
+ get detail(): number;
42
+ get view(): any;
43
+ }