onejs-core 0.3.24 → 0.3.25
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/definitions/augments.d.ts +22 -16
- package/dist/dom/document.d.ts +3 -1
- package/dist/dom/document.js +11 -0
- package/dom/document.ts +14 -2
- package/package.json +1 -1
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
interface Document {
|
|
3
|
-
addRuntimeUSS(uss: string): void
|
|
4
|
-
clearRuntimeStyleSheets(): void
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
3
|
+
// interface ElementCreationOptions {
|
|
4
|
+
// is?: string
|
|
5
|
+
// }
|
|
9
6
|
|
|
10
|
-
interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
// interface Document {
|
|
8
|
+
// addRuntimeUSS(uss: string): void
|
|
9
|
+
// clearRuntimeStyleSheets(): void
|
|
10
|
+
|
|
11
|
+
// createElement(tagName: string, options?: ElementCreationOptions): Element
|
|
12
|
+
// createElementNS(ns: string, tagName: string, options?: ElementCreationOptions): Element
|
|
13
|
+
// createTextNode(text: string): Element
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
// interface Element {
|
|
17
|
+
// classname: string
|
|
18
|
+
// nodeType: number
|
|
19
|
+
// ve: CS.UnityEngine.UIElements.VisualElement
|
|
20
|
+
// }
|
|
15
21
|
|
|
16
22
|
interface HTMLElement {
|
|
17
23
|
style: CS.OneJS.Dom.DomStyle
|
|
@@ -25,21 +31,21 @@ declare global {
|
|
|
25
31
|
const requestAnimationFrame: (callback: (time: number) => void) => number
|
|
26
32
|
const cancelAnimationFrame: (id: number) => void
|
|
27
33
|
|
|
28
|
-
const console: {
|
|
34
|
+
const console: {
|
|
29
35
|
log: (...args: any[]) => void
|
|
30
36
|
error: (...args: any[]) => void
|
|
31
37
|
warn: (...args: any[]) => void
|
|
32
38
|
info: (...args: any[]) => void
|
|
33
39
|
debug: (...args: any[]) => void
|
|
34
|
-
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
interface Event {
|
|
37
43
|
type: string
|
|
38
|
-
|
|
39
|
-
interface Text {
|
|
44
|
+
}
|
|
45
|
+
interface Text {
|
|
40
46
|
data: string
|
|
41
47
|
nodeType: number
|
|
42
|
-
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
export { }
|
package/dist/dom/document.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ export declare class DocumentWrapper {
|
|
|
9
9
|
addRuntimeUSS(uss: string): void;
|
|
10
10
|
clearRuntimeStyleSheets(): void;
|
|
11
11
|
createElement(tagName: string, options?: ElementCreationOptions): DomWrapper;
|
|
12
|
-
createElementNS(ns: string, tagName: string, options
|
|
12
|
+
createElementNS(ns: string, tagName: string, options?: ElementCreationOptions): DomWrapper;
|
|
13
13
|
createTextNode(text: string): DomWrapper;
|
|
14
|
+
getElementById(id: string): DomWrapper;
|
|
15
|
+
querySelectorAll(selector: string): DomWrapper[];
|
|
14
16
|
}
|
|
15
17
|
export {};
|
package/dist/dom/document.js
CHANGED
|
@@ -22,4 +22,15 @@ export class DocumentWrapper {
|
|
|
22
22
|
createTextNode(text) {
|
|
23
23
|
return new DomWrapper(this.#doc.createTextNode(text));
|
|
24
24
|
}
|
|
25
|
+
getElementById(id) {
|
|
26
|
+
return new DomWrapper(this.#doc.getElementById(id));
|
|
27
|
+
}
|
|
28
|
+
querySelectorAll(selector) {
|
|
29
|
+
let doms = this.#doc.querySelectorAll(selector);
|
|
30
|
+
let res = [];
|
|
31
|
+
for (let i = 0; i < doms.Length; i++) {
|
|
32
|
+
res.push(new DomWrapper(doms.get_Item(i)));
|
|
33
|
+
}
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
25
36
|
}
|
package/dom/document.ts
CHANGED
|
@@ -27,12 +27,24 @@ export class DocumentWrapper {
|
|
|
27
27
|
return new DomWrapper(this.#doc.createElement(tagName))
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
createElementNS(ns: string, tagName: string, options
|
|
30
|
+
createElementNS(ns: string, tagName: string, options?: ElementCreationOptions): DomWrapper {
|
|
31
31
|
return new DomWrapper(this.#doc.createElement(tagName))
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
createTextNode(text: string): DomWrapper {
|
|
36
35
|
return new DomWrapper(this.#doc.createTextNode(text))
|
|
37
36
|
}
|
|
37
|
+
|
|
38
|
+
getElementById(id: string): DomWrapper {
|
|
39
|
+
return new DomWrapper(this.#doc.getElementById(id))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
querySelectorAll(selector: string): DomWrapper[] {
|
|
43
|
+
let doms = this.#doc.querySelectorAll(selector)
|
|
44
|
+
let res = []
|
|
45
|
+
for (let i = 0; i < doms.Length; i++) {
|
|
46
|
+
res.push(new DomWrapper(doms.get_Item(i)))
|
|
47
|
+
}
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
38
50
|
}
|
package/package.json
CHANGED