onejs-core 3.0.1 → 3.0.2

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/index.js CHANGED
@@ -36,7 +36,8 @@ export { emo } from "./styling/index";
36
36
  if (typeof globalThis.___document != "undefined") {
37
37
  // @ts-ignore
38
38
  globalThis.onejsDocument = new DocumentWrapper(globalThis.___document);
39
- if (!globalThis.ONEJS_WEBGL) {
39
+ // @ts-ignore
40
+ if (!globalThis.ONEJS_WEBGL && !globalThis.document) {
40
41
  // @ts-ignore
41
42
  globalThis.document = globalThis.onejsDocument;
42
43
  }
@@ -8,7 +8,7 @@ export function hashAndAddRuntimeUSS(style) {
8
8
  return compId;
9
9
  style = `.${compId} {${style}}`;
10
10
  style = flatten(style);
11
- document.addRuntimeUSS(style);
11
+ globalThis.___document.addRuntimeUSS(style);
12
12
  _pastCompIds.add(compId);
13
13
  return compId;
14
14
  }
package/index.ts CHANGED
@@ -50,7 +50,8 @@ declare global {
50
50
  if (typeof globalThis.___document != "undefined") {
51
51
  // @ts-ignore
52
52
  globalThis.onejsDocument = new DocumentWrapper(globalThis.___document)
53
- if (!globalThis.ONEJS_WEBGL) {
53
+ // @ts-ignore
54
+ if (!globalThis.ONEJS_WEBGL && !globalThis.document) {
54
55
  // @ts-ignore
55
56
  globalThis.document = globalThis.onejsDocument
56
57
  }
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": "3.0.1",
4
+ "version": "3.0.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Singtaa/onejs-core"
package/styling/index.tsx CHANGED
@@ -10,7 +10,7 @@ export function hashAndAddRuntimeUSS(style: string) {
10
10
  return compId
11
11
  style = `.${compId} {${style}}`
12
12
  style = flatten(style)
13
- document.addRuntimeUSS(style)
13
+ globalThis.___document.addRuntimeUSS(style)
14
14
  _pastCompIds.add(compId)
15
15
 
16
16
  return compId