onejs-core 0.3.33 → 0.3.35

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/dist/dom/dom.js CHANGED
@@ -2,7 +2,16 @@ import { DomStyleWrapper } from "./dom-style";
2
2
  export class DomWrapper {
3
3
  get _dom() { return this.#dom; }
4
4
  get ve() { return this.#dom.ve; }
5
- get childNodes() { return this.#dom.childNodes.map((child) => new DomWrapper(child)); }
5
+ get childNodes() {
6
+ if (!this.#dom.childNodes)
7
+ return [];
8
+ let arr = new Array(this.#dom.childNodes.Length);
9
+ var i = this.#dom.childNodes.Length;
10
+ while (i--) {
11
+ arr[i] = new DomWrapper(this.#dom.childNodes.get_Item(i));
12
+ }
13
+ return arr;
14
+ }
6
15
  get firstChild() {
7
16
  return this.#dom.firstChild ? new DomWrapper(this.#dom.firstChild) : null;
8
17
  }
package/dom/dom.ts CHANGED
@@ -4,7 +4,15 @@ import { DomStyleWrapper } from "./dom-style"
4
4
  export class DomWrapper {
5
5
  public get _dom(): CS.OneJS.Dom.Dom { return this.#dom }
6
6
  public get ve(): CS.UnityEngine.UIElements.VisualElement { return this.#dom.ve }
7
- public get childNodes(): DomWrapper[] { return (this.#dom.childNodes as any as CS.OneJS.Dom.Dom[]).map((child) => new DomWrapper(child)) }
7
+ public get childNodes(): DomWrapper[] {
8
+ if (!this.#dom.childNodes) return [];
9
+ let arr = new Array(this.#dom.childNodes.Length) as DomWrapper[];
10
+ var i = this.#dom.childNodes.Length;
11
+ while (i--) {
12
+ arr[i] = new DomWrapper(this.#dom.childNodes.get_Item(i));
13
+ }
14
+ return arr
15
+ }
8
16
  public get firstChild(): DomWrapper | null {
9
17
  return this.#dom.firstChild ? new DomWrapper(this.#dom.firstChild) : null;
10
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "onejs-core",
3
3
  "description": "The JS part of OneJS, a UI framework and Scripting Engine for Unity.",
4
- "version": "0.3.33",
4
+ "version": "0.3.35",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./typings.d.ts",
7
7
  "dependencies": {
@@ -16,6 +16,7 @@
16
16
  "rimraf": "^5.0.7",
17
17
  "tailwindcss": "^3.4.1",
18
18
  "tar": "^7.2.0",
19
- "tiny-glob": "^0.2.9"
19
+ "tiny-glob": "^0.2.9",
20
+ "xml2js": "^0.6.2"
20
21
  }
21
22
  }
@@ -54,7 +54,7 @@ async function Process(backend, outputDir) {
54
54
  await extractTgz(downloadedPath, outputDir)
55
55
 
56
56
  // Safe keep asmdef files
57
- const onejsDir = getOneJSUnityDir()
57
+ const onejsDir = await getOneJSUnityDir()
58
58
  const a = path.join(onejsDir, 'Puerts/Editor/com.tencent.puerts.core.Editor.asmdef')
59
59
  const b = path.join(upmDir, 'Editor/com.tencent.puerts.core.Editor.asmdef')
60
60
  const c = path.join(onejsDir, 'Puerts/Runtime/com.tencent.puerts.core.asmdef')
@@ -130,7 +130,7 @@ async function getOneJSUnityDir() {
130
130
 
131
131
  if (searchIndex !== -1) {
132
132
  oneJSPath = normalizedIncludePath.substring(0, searchIndex + 'Assets/OneJS'.length);
133
- oneJSPath = path.resolve(oneJSPath);
133
+ oneJSPath = path.resolve(projectDir, oneJSPath);
134
134
  return oneJSPath;
135
135
  }
136
136
  }