onejs-core 0.3.18 → 0.3.24

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.
Files changed (26) hide show
  1. package/definitions/Assemblies/OneJS.Runtime.d.ts +761 -0
  2. package/definitions/Assemblies/OneJS.Samples.d.ts +0 -0
  3. package/definitions/Assemblies/Unity.Mathematics.d.ts +9221 -0
  4. package/definitions/Assemblies/UnityEditor.CoreModule.d.ts +32614 -0
  5. package/definitions/Assemblies/UnityEngine.AIModule.d.ts +998 -0
  6. package/definitions/Assemblies/UnityEngine.AnimationModule.d.ts +3308 -0
  7. package/definitions/Assemblies/UnityEngine.AssetBundleModule.d.ts +337 -0
  8. package/definitions/Assemblies/UnityEngine.AudioModule.d.ts +1154 -0
  9. package/definitions/Assemblies/UnityEngine.CoreModule.d.ts +29587 -0
  10. package/definitions/Assemblies/UnityEngine.IMGUIModule.d.ts +0 -0
  11. package/definitions/Assemblies/UnityEngine.PhysicsModule.d.ts +3137 -0
  12. package/definitions/Assemblies/UnityEngine.TerrainModule.d.ts +1270 -0
  13. package/definitions/Assemblies/UnityEngine.TextRenderingModule.d.ts +0 -0
  14. package/definitions/Assemblies/UnityEngine.UIElementsModule.d.ts +32521 -0
  15. package/definitions/Assemblies/UnityEngine.UnityAnalyticsCommonModule.d.ts +274 -0
  16. package/definitions/Assemblies/index.d.ts +16 -0
  17. package/definitions/Assemblies/mscorlib.d.ts +19416 -0
  18. package/definitions/app.d.ts +0 -55247
  19. package/definitions/index.d.ts +3 -1
  20. package/definitions/unity-editor.d.ts +0 -0
  21. package/dist/styling/index.js +4 -0
  22. package/package.json +1 -1
  23. package/scripts/esbuild/copy-assets.mjs +4 -1
  24. package/scripts/onejs-tw-config.cjs +2 -1
  25. package/styling/index.tsx +5 -0
  26. package/tsconfig.json +1 -1
@@ -1,3 +1,4 @@
1
+ /// <reference path="./Assemblies/index.d.ts" />
1
2
  /// <reference path="./app.d.ts" />
2
3
  /// <reference path="./augments.d.ts" />
3
4
  /// <reference path="./globals.d.ts" />
@@ -7,4 +8,5 @@
7
8
  /// <reference path="./preact.jsx.d.ts" />
8
9
  /// <reference path="./proto-overrides.d.ts" />
9
10
  /// <reference path="./puerts.d.ts" />
10
- /// <reference path="./unity-engine.d.ts" />
11
+ /// <reference path="./unity-engine.d.ts" />
12
+ /// <reference path="./unity-editor.d.ts" />
File without changes
@@ -1,10 +1,14 @@
1
1
  import flatten from "css-flatten";
2
2
  import generateComponentId from "./utils/generateComponentId";
3
+ const _pastCompIds = new Set();
3
4
  export function hashAndAddRuntimeUSS(style) {
4
5
  let compId = generateComponentId(style);
6
+ if (_pastCompIds.has(compId))
7
+ return compId;
5
8
  style = `.${compId} {${style}}`;
6
9
  style = flatten(style);
7
10
  document.addRuntimeUSS(style);
11
+ _pastCompIds.add(compId);
8
12
  return compId;
9
13
  }
10
14
  /**
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.18",
4
+ "version": "0.3.24",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./typings.d.ts",
7
7
  "dependencies": {
@@ -11,7 +11,10 @@ function getPackagesWithAssets() {
11
11
  const packages = fs.readdirSync(nodeModulesPath);
12
12
  // console.log("There are " + packages.length + " packages in node_modules");
13
13
  for (const packageName of packages) {
14
- const pkgJsonPath = path.join(nodeModulesPath, packageName, 'package.json');
14
+ const packagePath = path.join(nodeModulesPath, packageName);
15
+ if (!fs.statSync(packagePath).isDirectory())
16
+ continue;
17
+ const pkgJsonPath = path.join(packagePath, 'package.json');
15
18
 
16
19
  try {
17
20
  const pkgJsonContent = fs.readFileSync(pkgJsonPath, 'utf8');
@@ -151,13 +151,14 @@ exports.plugins = [
151
151
 
152
152
  // USS cannot support dynamic custom properties within rgb()
153
153
  // which is what is used by Tailwind for opacity scales
154
+ // Ref: https://tailwindcss.com/docs/configuration#core-plugins
154
155
  exports.corePlugins = [
155
156
  "alignContent", "alignItems", "alignSelf",
156
157
  "justifyContent",
157
158
  "backgroundColor", "backgroundImage", "backgroundPosition", "backgroundRepeat", "backgroundSize",
158
159
  "borderColor", "borderRadius", "borderWidth",
159
160
  "colors", "textColor", "cursor",
160
- "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink",
161
+ "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap",
161
162
  "fontFamily", "fontSize", "fontStyle",
162
163
  "width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight",
163
164
  "margin", "padding",
package/styling/index.tsx CHANGED
@@ -1,11 +1,16 @@
1
1
  import flatten from "css-flatten"
2
2
  import generateComponentId from "./utils/generateComponentId"
3
3
 
4
+ const _pastCompIds = new Set<string>()
5
+
4
6
  export function hashAndAddRuntimeUSS(style: string) {
5
7
  let compId = generateComponentId(style)
8
+ if (_pastCompIds.has(compId))
9
+ return compId
6
10
  style = `.${compId} {${style}}`
7
11
  style = flatten(style)
8
12
  document.addRuntimeUSS(style)
13
+ _pastCompIds.add(compId)
9
14
 
10
15
  return compId
11
16
  }
package/tsconfig.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "skipLibCheck": false,
12
12
  "forceConsistentCasingInFileNames": true,
13
13
  "declaration": true,
14
- "typeRoots": [ "./definitions" ],
14
+ "typeRoots": [ "./definitions/**/*" ],
15
15
  },
16
16
  "include": [
17
17
  "./**/*"