onejs-core 0.3.45 → 0.3.46

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.
@@ -284,6 +284,7 @@ declare namespace CS {
284
284
  {
285
285
  protected [__keep_incompatibility]: never;
286
286
  public get veStyle(): UnityEngine.UIElements.IStyle;
287
+ public getProperty ($key: string) : any
287
288
  public setProperty ($key: string, $value: any) : void
288
289
  public SetAlignContent ($value: UnityEngine.UIElements.Align) : void
289
290
  public SetAlignItems ($value: UnityEngine.UIElements.Align) : void
@@ -5,7 +5,10 @@ interface ElementCreationOptions {
5
5
  export declare class DocumentWrapper {
6
6
  #private;
7
7
  get _doc(): CS.OneJS.Dom.Document;
8
- get body(): DomWrapper;
8
+ /**
9
+ * The body/root element of the document. Will be null for Editor documents.
10
+ */
11
+ get body(): DomWrapper | null;
9
12
  constructor(doc: CS.OneJS.Dom.Document);
10
13
  addRuntimeUSS(uss: string): void;
11
14
  clearRuntimeStyleSheets(): void;
@@ -3,11 +3,13 @@ export class DocumentWrapper {
3
3
  get _doc() { return this.#doc; }
4
4
  #doc;
5
5
  #body;
6
+ /**
7
+ * The body/root element of the document. Will be null for Editor documents.
8
+ */
6
9
  get body() { return this.#body; }
7
10
  constructor(doc) {
8
11
  this.#doc = doc;
9
- if (doc.body)
10
- this.#body = new DomWrapper(doc.body);
12
+ this.#body = doc.body ? new DomWrapper(doc.body) : null;
11
13
  }
12
14
  addRuntimeUSS(uss) {
13
15
  this.#doc.addRuntimeUSS(uss);
@@ -1,6 +1,7 @@
1
1
  export declare class DomStyleWrapper implements CS.OneJS.Dom.DomStyle {
2
2
  _domStyle: CS.OneJS.Dom.DomStyle;
3
3
  constructor(domStyle: CS.OneJS.Dom.DomStyle);
4
+ getProperty(name: string): any;
4
5
  setProperty(name: string, value: any): void;
5
6
  }
6
7
  export interface DomStyleWrapper extends CS.OneJS.Dom.DomStyle {
@@ -8,10 +8,13 @@ export class DomStyleWrapper {
8
8
  return true;
9
9
  },
10
10
  get(target, prop) {
11
- return target[prop];
11
+ return target.getProperty(prop);
12
12
  }
13
13
  });
14
14
  }
15
+ getProperty(name) {
16
+ return this._domStyle.getProperty(name);
17
+ }
15
18
  setProperty(name, value) {
16
19
  this._domStyle.setProperty(name, value);
17
20
  }
package/dist/index.js CHANGED
@@ -37,10 +37,3 @@ if (typeof ___document != "undefined") {
37
37
  // @ts-ignore
38
38
  globalThis.document = new DocumentWrapper(___document);
39
39
  }
40
- // @ts-ignore
41
- CS.OneJS.EngineHost.prototype.sub = function (a, b, c) {
42
- let unsubscribe = c ? this.subscribe(a, b, c) : this.subscribe(a, b);
43
- return () => {
44
- unsubscribe.Invoke();
45
- };
46
- };
package/dom/dom-style.ts CHANGED
@@ -12,11 +12,15 @@ export class DomStyleWrapper implements CS.OneJS.Dom.DomStyle {
12
12
  return true;
13
13
  },
14
14
  get(target, prop) {
15
- return target[prop];
15
+ return target.getProperty(prop as string);
16
16
  }
17
17
  })
18
18
  }
19
19
 
20
+ getProperty(name: string) {
21
+ return this._domStyle.getProperty(name)
22
+ }
23
+
20
24
  setProperty(name: string, value: any) {
21
25
  this._domStyle.setProperty(name, value)
22
26
  }
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.45",
4
+ "version": "0.3.46",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./typings.d.ts",
7
7
  "dependencies": {