pseudo-dom 0.6.0 → 0.8.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 +686 -241
- package/browser/pseudo-dom.js +3576 -735
- 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 +17 -43
- package/dist/classes/PseudoHTMLDocument.js +24 -94
- package/dist/classes/PseudoHTMLDocument.min.js +1 -1
- package/dist/classes/PseudoNodeList.d.ts +34 -34
- package/dist/classes/PseudoNodeList.js +71 -71
- 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/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/functions/activeElement.d.ts +14 -14
- package/dist/functions/activeElement.js +33 -33
- package/dist/functions/getElementById.d.ts +13 -0
- package/dist/functions/getElementById.js +33 -0
- package/dist/functions/getElementById.min.js +1 -0
- 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/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 +32 -0
- package/dist/interfaces/PseudoDocument.js +5 -5
- package/dist/interfaces/PseudoDocumentFragment.d.ts +7 -0
- package/dist/interfaces/PseudoDocumentFragment.js +5 -5
- package/dist/interfaces/PseudoElement.d.ts +702 -689
- 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 +8 -0
- package/dist/services/DocumentFragmentService.js +18 -0
- package/dist/services/DocumentFragmentService.min.js +1 -1
- package/dist/services/DocumentService.d.ts +35 -1
- package/dist/services/DocumentService.js +72 -0
- package/dist/services/DocumentService.min.js +1 -1
- package/dist/services/ElementService.d.ts +191 -178
- package/dist/services/ElementService.js +426 -406
- 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 +54 -49
- package/dist/services/HTMLCollectionService.js +92 -75
- 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 +297 -271
- package/dist/services/NodeService.js +721 -679
- 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 +4 -3
- package/dist/classes.d.ts +0 -20
- package/dist/classes.js +0 -31
- package/dist/classes.min.js +0 -1
- package/dist/factories/generateNode.d.ts +0 -32
- package/dist/factories/generateNode.js +0 -85
- package/dist/factories/generateNode.min.js +0 -1
- package/dist/factories.d.ts +0 -11
- package/dist/factories.js +0 -27
- package/dist/factories.min.js +0 -1
- package/dist/functions.d.ts +0 -5
- package/dist/functions.js +0 -23
- package/dist/functions.min.js +0 -1
|
@@ -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.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}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
|
+
"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
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.UIEventService = void 0
|
|
7
|
-
/**
|
|
8
|
-
* @file Substitute for the DOM UIEvent Class.
|
|
9
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
-
* @version 1.0.0
|
|
11
|
-
*/
|
|
12
|
-
const EventService_1 = require('./EventService')
|
|
13
|
-
/**
|
|
14
|
-
* Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
|
|
15
|
-
* interface (the mouse, the keyboard, focus and input).
|
|
16
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
17
|
-
* @class
|
|
18
|
-
* @augments EventService
|
|
19
|
-
* @property {number} detail
|
|
20
|
-
* @property {*} view
|
|
21
|
-
*/
|
|
22
|
-
class UIEventService extends EventService_1.EventService {
|
|
23
|
-
/**
|
|
24
|
-
* @param {string} [typeArg=''] The type of the event
|
|
25
|
-
* @param {UIEventInit} [init={}] The options for the event
|
|
26
|
-
* @constructor
|
|
27
|
-
*/
|
|
28
|
-
constructor (typeArg = '', init = {}) {
|
|
29
|
-
super(typeArg, init)
|
|
30
|
-
this.uiDetail = init.detail || 0
|
|
31
|
-
this.uiView = init.view || null
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get detail () {
|
|
35
|
-
return this.uiDetail
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get view () {
|
|
39
|
-
return this.uiView
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.UIEventService = UIEventService
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.UIEventService = void 0
|
|
7
|
+
/**
|
|
8
|
+
* @file Substitute for the DOM UIEvent Class.
|
|
9
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
const EventService_1 = require('./EventService')
|
|
13
|
+
/**
|
|
14
|
+
* Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
|
|
15
|
+
* interface (the mouse, the keyboard, focus and input).
|
|
16
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
17
|
+
* @class
|
|
18
|
+
* @augments EventService
|
|
19
|
+
* @property {number} detail
|
|
20
|
+
* @property {*} view
|
|
21
|
+
*/
|
|
22
|
+
class UIEventService extends EventService_1.EventService {
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} [typeArg=''] The type of the event
|
|
25
|
+
* @param {UIEventInit} [init={}] The options for the event
|
|
26
|
+
* @constructor
|
|
27
|
+
*/
|
|
28
|
+
constructor (typeArg = '', init = {}) {
|
|
29
|
+
super(typeArg, init)
|
|
30
|
+
this.uiDetail = init.detail || 0
|
|
31
|
+
this.uiView = init.view || null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get detail () {
|
|
35
|
+
return this.uiDetail
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get view () {
|
|
39
|
+
return this.uiView
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.UIEventService = UIEventService
|
package/dist/simulate.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Click an element the way a user does: pointerdown and mousedown, then the focus moves to the nearest element which
|
|
3
|
-
* can have it (or is taken away from the one which had it) unless mousedown was cancelled, then pointerup, mouseup
|
|
4
|
-
* and finally click. Every event is trusted and has the options the browser gives it. A disabled element gets nothing.
|
|
5
|
-
* @function click
|
|
6
|
-
* @param {*} element The element to click
|
|
7
|
-
* @param {Object} [init={}] Options for the events (for example clientX, clientY, shiftKey)
|
|
8
|
-
* @returns {boolean} False when the click was cancelled (or the element is disabled), so its default action did not happen
|
|
9
|
-
*/
|
|
10
|
-
export declare const click: (element: any, init?: {
|
|
11
|
-
[option: string]: any;
|
|
12
|
-
}) => boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Press and release a key on an element (the element which has the focus, or one given): keydown and then keyup.
|
|
15
|
-
* @function keyPress
|
|
16
|
-
* @param {*} element The element which gets the key
|
|
17
|
-
* @param {string} key The value of the key, such as a or Enter
|
|
18
|
-
* @param {Object} [init={}] Options for the events (for example code, shiftKey)
|
|
19
|
-
* @returns {boolean} False when keydown was cancelled, so its default action did not happen
|
|
20
|
-
*/
|
|
21
|
-
export declare const keyPress: (element: any, key: string, init?: {
|
|
22
|
-
[option: string]: any;
|
|
23
|
-
}) => boolean;
|
|
24
|
-
declare const _default: {
|
|
25
|
-
click: (element: any, init?: {
|
|
26
|
-
[option: string]: any;
|
|
27
|
-
}) => boolean;
|
|
28
|
-
keyPress: (element: any, key: string, init?: {
|
|
29
|
-
[option: string]: any;
|
|
30
|
-
}) => boolean;
|
|
31
|
-
};
|
|
32
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* Click an element the way a user does: pointerdown and mousedown, then the focus moves to the nearest element which
|
|
3
|
+
* can have it (or is taken away from the one which had it) unless mousedown was cancelled, then pointerup, mouseup
|
|
4
|
+
* and finally click. Every event is trusted and has the options the browser gives it. A disabled element gets nothing.
|
|
5
|
+
* @function click
|
|
6
|
+
* @param {*} element The element to click
|
|
7
|
+
* @param {Object} [init={}] Options for the events (for example clientX, clientY, shiftKey)
|
|
8
|
+
* @returns {boolean} False when the click was cancelled (or the element is disabled), so its default action did not happen
|
|
9
|
+
*/
|
|
10
|
+
export declare const click: (element: any, init?: {
|
|
11
|
+
[option: string]: any;
|
|
12
|
+
}) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Press and release a key on an element (the element which has the focus, or one given): keydown and then keyup.
|
|
15
|
+
* @function keyPress
|
|
16
|
+
* @param {*} element The element which gets the key
|
|
17
|
+
* @param {string} key The value of the key, such as a or Enter
|
|
18
|
+
* @param {Object} [init={}] Options for the events (for example code, shiftKey)
|
|
19
|
+
* @returns {boolean} False when keydown was cancelled, so its default action did not happen
|
|
20
|
+
*/
|
|
21
|
+
export declare const keyPress: (element: any, key: string, init?: {
|
|
22
|
+
[option: string]: any;
|
|
23
|
+
}) => boolean;
|
|
24
|
+
declare const _default: {
|
|
25
|
+
click: (element: any, init?: {
|
|
26
|
+
[option: string]: any;
|
|
27
|
+
}) => boolean;
|
|
28
|
+
keyPress: (element: any, key: string, init?: {
|
|
29
|
+
[option: string]: any;
|
|
30
|
+
}) => boolean;
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|