@gjsify/dom-elements 0.34.0 → 0.36.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/lib/esm/node.js +1 -1
- package/lib/types/node.d.ts +12 -0
- package/package.json +7 -7
package/lib/esm/node.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{childNodesList as e,elementChildren as t,isConnected as n,nodeType as r,parentNode as i}from"./property-symbol.js";import{NodeType as a}from"./node-type.js";import{NodeList as o}from"./node-list.js";import{EventTarget as s}from"@gjsify/dom-events";let c,l,u,d,f;var p=class Node extends s{constructor(...e){super(...e),this.ELEMENT_NODE=a.ELEMENT_NODE,this.ATTRIBUTE_NODE=a.ATTRIBUTE_NODE,this.TEXT_NODE=a.TEXT_NODE,this.CDATA_SECTION_NODE=a.CDATA_SECTION_NODE,this.PROCESSING_INSTRUCTION_NODE=a.PROCESSING_INSTRUCTION_NODE,this.COMMENT_NODE=a.COMMENT_NODE,this.DOCUMENT_NODE=a.DOCUMENT_NODE,this.DOCUMENT_TYPE_NODE=a.DOCUMENT_TYPE_NODE,this.DOCUMENT_FRAGMENT_NODE=a.DOCUMENT_FRAGMENT_NODE,this[c]=a.ELEMENT_NODE,this[l]=null,this[u]=[],this[d]=[],this[f]=!1}static{this.ELEMENT_NODE=a.ELEMENT_NODE}static{this.ATTRIBUTE_NODE=a.ATTRIBUTE_NODE}static{this.TEXT_NODE=a.TEXT_NODE}static{this.CDATA_SECTION_NODE=a.CDATA_SECTION_NODE}static{this.PROCESSING_INSTRUCTION_NODE=a.PROCESSING_INSTRUCTION_NODE}static{this.COMMENT_NODE=a.COMMENT_NODE}static{this.DOCUMENT_NODE=a.DOCUMENT_NODE}static{this.DOCUMENT_TYPE_NODE=a.DOCUMENT_TYPE_NODE}static{this.DOCUMENT_FRAGMENT_NODE=a.DOCUMENT_FRAGMENT_NODE}static{this.DOCUMENT_POSITION_DISCONNECTED=1}static{this.DOCUMENT_POSITION_PRECEDING=2}static{this.DOCUMENT_POSITION_FOLLOWING=4}static{this.DOCUMENT_POSITION_CONTAINS=8}static{this.DOCUMENT_POSITION_CONTAINED_BY=16}static{this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32}get nodeType(){return this[r]}get nodeName(){return``}get parentNode(){return this[i]}get parentElement(){let e=this[i];return e&&e[r]===a.ELEMENT_NODE?e:null}get childNodes(){return new o(this[e])}get firstChild(){return this[e][0]??null}get lastChild(){let t=this[e];return t[t.length-1]??null}get previousSibling(){let t=this[i];if(!t)return null;let n=t[e],r=n.indexOf(this);return r>0?n[r-1]:null}get nextSibling(){let t=this[i];if(!t)return null;let n=t[e],r=n.indexOf(this);return r!==-1&&r<n.length-1?n[r+1]:null}get textContent(){return null}set textContent(e){}get nodeValue(){return null}set nodeValue(e){}get ownerDocument(){let e=this;for(;e[i];)e=e[i];let t=globalThis.document;return e===t?t:null}get isConnected(){return this[n]}hasChildNodes(){return this[e].length>0}contains(e){if(e===null)return!1;if(e===this)return!0;let t=e;for(;t;){if(t===this)return!0;t=t[i]}return!1}getRootNode(){let e=this;for(;e[i];)e=e[i];return e}appendChild(n){return n[i]&&n[i].removeChild(n),n[i]=this,this[e].push(n),n[r]===a.ELEMENT_NODE&&this[t].push(n),n}removeChild(n){let o=this[e],s=o.indexOf(n);if(s===-1)throw new DOMException(`Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.`,`NotFoundError`);if(o.splice(s,1),n[i]=null,n[r]===a.ELEMENT_NODE){let e=this[t].indexOf(n);e!==-1&&this[t].splice(e,1)}return n}insertBefore(n,o){if(o===null)return this.appendChild(n);let s=this[e],c=s.indexOf(o);if(c===-1)throw new DOMException(`Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`,`NotFoundError`);if(n[i]&&n[i].removeChild(n),n[i]=this,s.splice(c,0,n),n[r]===a.ELEMENT_NODE){let e=this[t],i=e.length;for(let t=c;t<s.length;t++)if(s[t][r]===a.ELEMENT_NODE&&s[t]!==n){i=e.indexOf(s[t]);break}e.splice(i,0,n)}return n}replaceChild(e,t){return this.insertBefore(e,t),this.removeChild(t),t}cloneNode(t=!1){let n=
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{childNodesList as e,elementChildren as t,isConnected as n,nodeType as r,parentNode as i}from"./property-symbol.js";import{NodeType as a}from"./node-type.js";import{NodeList as o}from"./node-list.js";import{EventTarget as s}from"@gjsify/dom-events";let c,l,u,d,f;var p=class Node extends s{constructor(...e){super(...e),this.ELEMENT_NODE=a.ELEMENT_NODE,this.ATTRIBUTE_NODE=a.ATTRIBUTE_NODE,this.TEXT_NODE=a.TEXT_NODE,this.CDATA_SECTION_NODE=a.CDATA_SECTION_NODE,this.PROCESSING_INSTRUCTION_NODE=a.PROCESSING_INSTRUCTION_NODE,this.COMMENT_NODE=a.COMMENT_NODE,this.DOCUMENT_NODE=a.DOCUMENT_NODE,this.DOCUMENT_TYPE_NODE=a.DOCUMENT_TYPE_NODE,this.DOCUMENT_FRAGMENT_NODE=a.DOCUMENT_FRAGMENT_NODE,this[c]=a.ELEMENT_NODE,this[l]=null,this[u]=[],this[d]=[],this[f]=!1}static{this.ELEMENT_NODE=a.ELEMENT_NODE}static{this.ATTRIBUTE_NODE=a.ATTRIBUTE_NODE}static{this.TEXT_NODE=a.TEXT_NODE}static{this.CDATA_SECTION_NODE=a.CDATA_SECTION_NODE}static{this.PROCESSING_INSTRUCTION_NODE=a.PROCESSING_INSTRUCTION_NODE}static{this.COMMENT_NODE=a.COMMENT_NODE}static{this.DOCUMENT_NODE=a.DOCUMENT_NODE}static{this.DOCUMENT_TYPE_NODE=a.DOCUMENT_TYPE_NODE}static{this.DOCUMENT_FRAGMENT_NODE=a.DOCUMENT_FRAGMENT_NODE}static{this.DOCUMENT_POSITION_DISCONNECTED=1}static{this.DOCUMENT_POSITION_PRECEDING=2}static{this.DOCUMENT_POSITION_FOLLOWING=4}static{this.DOCUMENT_POSITION_CONTAINS=8}static{this.DOCUMENT_POSITION_CONTAINED_BY=16}static{this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32}get nodeType(){return this[r]}get nodeName(){return``}get parentNode(){return this[i]}get parentElement(){let e=this[i];return e&&e[r]===a.ELEMENT_NODE?e:null}get childNodes(){return new o(this[e])}get firstChild(){return this[e][0]??null}get lastChild(){let t=this[e];return t[t.length-1]??null}get previousSibling(){let t=this[i];if(!t)return null;let n=t[e],r=n.indexOf(this);return r>0?n[r-1]:null}get nextSibling(){let t=this[i];if(!t)return null;let n=t[e],r=n.indexOf(this);return r!==-1&&r<n.length-1?n[r+1]:null}get textContent(){return null}set textContent(e){}get nodeValue(){return null}set nodeValue(e){}get ownerDocument(){let e=this;for(;e[i];)e=e[i];let t=globalThis.document;return e===t?t:null}get isConnected(){return this[n]}hasChildNodes(){return this[e].length>0}contains(e){if(e===null)return!1;if(e===this)return!0;let t=e;for(;t;){if(t===this)return!0;t=t[i]}return!1}getRootNode(){let e=this;for(;e[i];)e=e[i];return e}appendChild(n){return n[i]&&n[i].removeChild(n),n[i]=this,this[e].push(n),n[r]===a.ELEMENT_NODE&&this[t].push(n),n}removeChild(n){let o=this[e],s=o.indexOf(n);if(s===-1)throw new DOMException(`Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.`,`NotFoundError`);if(o.splice(s,1),n[i]=null,n[r]===a.ELEMENT_NODE){let e=this[t].indexOf(n);e!==-1&&this[t].splice(e,1)}return n}insertBefore(n,o){if(o===null)return this.appendChild(n);let s=this[e],c=s.indexOf(o);if(c===-1)throw new DOMException(`Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`,`NotFoundError`);if(n[i]&&n[i].removeChild(n),n[i]=this,s.splice(c,0,n),n[r]===a.ELEMENT_NODE){let e=this[t],i=e.length;for(let t=c;t<s.length;t++)if(s[t][r]===a.ELEMENT_NODE&&s[t]!==n){i=e.indexOf(s[t]);break}e.splice(i,0,n)}return n}replaceChild(e,t){return this.insertBefore(e,t),this.removeChild(t),t}_createCloneTarget(){return new this.constructor}cloneNode(t=!1){let n=this._createCloneTarget();if(n[r]=this[r],t)for(let t of this[e])n.appendChild(t.cloneNode(!0));return n}dispatchEvent(e){let t=super.dispatchEvent(e);if(e.bubbles&&!e.cancelBubble){let t=this[i];for(;t&&(Object.getPrototypeOf(Node.prototype).dispatchEvent.call(t,e),!e.cancelBubble);)t=t[i]}return t}get[(c=r,l=i,u=e,d=t,f=n,Symbol.toStringTag)](){return`Node`}};export{p as Node};
|
package/lib/types/node.d.ts
CHANGED
|
@@ -59,6 +59,18 @@ export declare class Node extends EventTarget {
|
|
|
59
59
|
removeChild(node: Node): Node;
|
|
60
60
|
insertBefore(newNode: Node, referenceNode: Node | null): Node;
|
|
61
61
|
replaceChild(newChild: Node, oldChild: Node): Node;
|
|
62
|
+
/**
|
|
63
|
+
* Produces the blank node that `cloneNode` then fills in.
|
|
64
|
+
*
|
|
65
|
+
* Default is `new this.constructor()`, which assumes the constructor takes
|
|
66
|
+
* no arguments. That does not hold for the framework bridges: a GTK-backed
|
|
67
|
+
* element is constructed FROM its widget (`new HTMLCanvasElement(glArea)`),
|
|
68
|
+
* so cloning one produced an instance whose widget was `undefined` and whose
|
|
69
|
+
* very first property read threw. Overriding this seam lets such an element
|
|
70
|
+
* decide what an unbacked copy of itself is — which for a canvas is a plain
|
|
71
|
+
* detached one, exactly as in a browser.
|
|
72
|
+
*/
|
|
73
|
+
protected _createCloneTarget(): Node;
|
|
62
74
|
cloneNode(deep?: boolean): Node;
|
|
63
75
|
/**
|
|
64
76
|
* Override dispatchEvent to support event bubbling through the DOM tree.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/dom-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "DOM element hierarchy (Node, Element, HTMLElement, HTMLImageElement) for GJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
"@girs/gdkpixbuf-2.0": "^4.1.0",
|
|
72
72
|
"@girs/gjs": "^4.1.0",
|
|
73
73
|
"@girs/glib-2.0": "^4.1.0",
|
|
74
|
-
"@gjsify/abort-controller": "^0.
|
|
75
|
-
"@gjsify/canvas2d-core": "^0.
|
|
76
|
-
"@gjsify/dom-events": "^0.
|
|
77
|
-
"@gjsify/fetch": "^0.
|
|
74
|
+
"@gjsify/abort-controller": "^0.36.0",
|
|
75
|
+
"@gjsify/canvas2d-core": "^0.36.0",
|
|
76
|
+
"@gjsify/dom-events": "^0.36.0",
|
|
77
|
+
"@gjsify/fetch": "^0.36.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@girs/gst-1.0": "^4.1.0",
|
|
81
|
-
"@gjsify/cli": "^0.
|
|
82
|
-
"@gjsify/unit": "^0.
|
|
81
|
+
"@gjsify/cli": "^0.36.0",
|
|
82
|
+
"@gjsify/unit": "^0.36.0",
|
|
83
83
|
"@types/node": "^25.9.2",
|
|
84
84
|
"typescript": "^6.0.3"
|
|
85
85
|
},
|