onejs-core 3.0.3 → 3.0.4

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 (110) hide show
  1. package/.gitattributes +2 -2
  2. package/.prettierrc +5 -5
  3. package/.vscode/settings.json +5 -5
  4. package/LICENSE +20 -20
  5. package/README.md +102 -102
  6. package/definitions/Assemblies/OneJS.Runtime.Ext.d.ts +6 -6
  7. package/definitions/Assemblies/OneJS.Runtime.d.ts +826 -826
  8. package/definitions/Assemblies/OneJS.Samples.d.ts +20 -20
  9. package/definitions/Assemblies/Unity.Mathematics.d.ts +9221 -9221
  10. package/definitions/Assemblies/UnityEditor.CoreModule.d.ts +32614 -32614
  11. package/definitions/Assemblies/UnityEngine.AIModule.d.ts +998 -998
  12. package/definitions/Assemblies/UnityEngine.AnimationModule.d.ts +3308 -3308
  13. package/definitions/Assemblies/UnityEngine.AssetBundleModule.d.ts +337 -337
  14. package/definitions/Assemblies/UnityEngine.AudioModule.d.ts +1154 -1154
  15. package/definitions/Assemblies/UnityEngine.CoreModule.d.ts +29587 -29587
  16. package/definitions/Assemblies/UnityEngine.PhysicsModule.d.ts +3137 -3137
  17. package/definitions/Assemblies/UnityEngine.TerrainModule.d.ts +1270 -1270
  18. package/definitions/Assemblies/UnityEngine.UIElementsModule.d.ts +32718 -32718
  19. package/definitions/Assemblies/UnityEngine.UnityAnalyticsCommonModule.d.ts +274 -274
  20. package/definitions/Assemblies/index.d.ts +16 -16
  21. package/definitions/Assemblies/mscorlib.d.ts +19416 -19416
  22. package/definitions/augments.d.ts +66 -66
  23. package/definitions/globals.d.ts +53 -53
  24. package/definitions/index.d.ts +11 -11
  25. package/definitions/jsx.d.ts +570 -570
  26. package/definitions/modules.d.ts +32 -32
  27. package/definitions/onejs.d.ts +171 -171
  28. package/definitions/preact.jsx.d.ts +6 -6
  29. package/definitions/proto-overrides.d.ts +41 -41
  30. package/definitions/puerts.d.ts +30 -30
  31. package/definitions/unity-engine.d.ts +22 -22
  32. package/dist/csharp/index.d.ts +3 -0
  33. package/dist/csharp/index.js +3 -0
  34. package/dist/dom/document.d.ts +30 -0
  35. package/dist/dom/document.js +89 -0
  36. package/dist/dom/dom-style.d.ts +9 -0
  37. package/dist/dom/dom-style.js +27 -0
  38. package/dist/dom/dom.d.ts +83 -0
  39. package/dist/dom/dom.js +313 -0
  40. package/dist/dom/index.d.ts +4 -0
  41. package/dist/dom/index.js +4 -0
  42. package/dist/dom/selector.d.ts +0 -0
  43. package/dist/dom/selector.js +0 -0
  44. package/dist/index.d.ts +25 -0
  45. package/dist/index.js +45 -0
  46. package/dist/math/index.d.ts +86 -0
  47. package/dist/math/index.js +361 -0
  48. package/dist/preloads/inject.d.ts +3 -0
  49. package/dist/preloads/inject.js +36 -0
  50. package/dist/styling/index.d.ts +10 -0
  51. package/dist/styling/index.js +28 -0
  52. package/dist/styling/utils/generateAlphabeticName.d.ts +1 -0
  53. package/dist/styling/utils/generateAlphabeticName.js +16 -0
  54. package/dist/styling/utils/generateComponentId.d.ts +1 -0
  55. package/dist/styling/utils/generateComponentId.js +5 -0
  56. package/dist/styling/utils/hash.d.ts +5 -0
  57. package/dist/styling/utils/hash.js +34 -0
  58. package/dist/utils/arrays.d.ts +1 -0
  59. package/dist/utils/arrays.js +10 -0
  60. package/dist/utils/color-palettes.d.ts +2 -0
  61. package/dist/utils/color-palettes.js +2 -0
  62. package/dist/utils/color-parser.d.ts +161 -0
  63. package/dist/utils/color-parser.js +241 -0
  64. package/dist/utils/float-parser.d.ts +7 -0
  65. package/dist/utils/float-parser.js +23 -0
  66. package/dist/utils/index.d.ts +12 -0
  67. package/dist/utils/index.js +15 -0
  68. package/dist/utils/responsive.d.ts +4 -0
  69. package/dist/utils/responsive.js +23 -0
  70. package/dist/utils/subscribe.d.ts +4 -0
  71. package/dist/utils/subscribe.js +10 -0
  72. package/dist/utils/system.d.ts +1 -0
  73. package/dist/utils/system.js +16 -0
  74. package/dist/utils/toJsArray.d.ts +1 -0
  75. package/dist/utils/toJsArray.js +10 -0
  76. package/dom/document.ts +115 -115
  77. package/dom/dom-style.ts +36 -36
  78. package/dom/dom.ts +376 -376
  79. package/dom/index.ts +3 -3
  80. package/index.ts +59 -59
  81. package/jsr.json +9 -9
  82. package/math/README.md +212 -212
  83. package/math/index.ts +487 -487
  84. package/package.json +33 -33
  85. package/preloads/inject.ts +43 -43
  86. package/scripts/esbuild/copy-assets.mjs +94 -94
  87. package/scripts/esbuild/decorator-fix.mjs +17 -17
  88. package/scripts/esbuild/import-transform.mjs +100 -100
  89. package/scripts/esbuild/index.mjs +3 -3
  90. package/scripts/esbuild/watch-output.mjs +38 -38
  91. package/scripts/postcss/cleanup-plugin.cjs +89 -89
  92. package/scripts/postcss/onejs-tw-config.cjs +252 -252
  93. package/scripts/postcss/optional-import-plugin.cjs +26 -26
  94. package/scripts/postcss/tailwind-logging-plugin.cjs +11 -11
  95. package/scripts/postcss/unwrap-is-plugin.cjs +16 -16
  96. package/scripts/postcss/uss-transform-plugin.cjs +92 -92
  97. package/scripts/switch.cjs +290 -290
  98. package/styling/index.tsx +32 -32
  99. package/styling/utils/generateAlphabeticName.ts +20 -20
  100. package/styling/utils/generateComponentId.ts +5 -5
  101. package/styling/utils/hash.ts +46 -46
  102. package/tsconfig.json +24 -24
  103. package/typings.d.ts +5 -5
  104. package/utils/arrays.ts +10 -10
  105. package/utils/color-palettes.ts +2 -2
  106. package/utils/color-parser.ts +248 -248
  107. package/utils/float-parser.ts +30 -30
  108. package/utils/index.ts +15 -15
  109. package/utils/subscribe.ts +16 -16
  110. package/utils/system.ts +16 -16
@@ -1,39 +1,39 @@
1
- export function outputWatcherPlugin(options = {}) {
2
- return {
3
- name: "onejs-watch-output",
4
- setup(build) {
5
- build.onStart(() => {
6
- // Clear the terminal
7
- process.stdout.write('\x1Bc');
8
- console.log("[esbuild] starting build...");
9
- });
10
-
11
- build.onEnd((result) => {
12
- console.log("[esbuild] watching...");
13
- });
14
- }
15
- }
16
- }
17
-
18
- /**
19
- * Keeping this one for backward-compatibility reasons. Please use `outputWatcherPlugin` instead.
20
- */
21
- export const watchOutputPlugin = {
22
- name: "onejs-watch-output",
23
- setup(build) {
24
- build.onStart(() => {
25
- // Clear the terminal
26
- process.stdout.write('\x1Bc');
27
- console.log("[esbuild] starting build...");
28
- });
29
-
30
- build.onEnd((result) => {
31
- // if (result.errors.length > 0) {
32
- // console.error("[esbuild] build failed");
33
- // } else {
34
- // console.log("[esbuild] build succeeded");
35
- // }
36
- console.log("[esbuild] watching...");
37
- });
38
- }
1
+ export function outputWatcherPlugin(options = {}) {
2
+ return {
3
+ name: "onejs-watch-output",
4
+ setup(build) {
5
+ build.onStart(() => {
6
+ // Clear the terminal
7
+ process.stdout.write('\x1Bc');
8
+ console.log("[esbuild] starting build...");
9
+ });
10
+
11
+ build.onEnd((result) => {
12
+ console.log("[esbuild] watching...");
13
+ });
14
+ }
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Keeping this one for backward-compatibility reasons. Please use `outputWatcherPlugin` instead.
20
+ */
21
+ export const watchOutputPlugin = {
22
+ name: "onejs-watch-output",
23
+ setup(build) {
24
+ build.onStart(() => {
25
+ // Clear the terminal
26
+ process.stdout.write('\x1Bc');
27
+ console.log("[esbuild] starting build...");
28
+ });
29
+
30
+ build.onEnd((result) => {
31
+ // if (result.errors.length > 0) {
32
+ // console.error("[esbuild] build failed");
33
+ // } else {
34
+ // console.log("[esbuild] build succeeded");
35
+ // }
36
+ console.log("[esbuild] watching...");
37
+ });
38
+ }
39
39
  }
@@ -1,90 +1,90 @@
1
- /**
2
- * postcss-cleanup-plugin
3
- *
4
- * A PostCSS plugin that removes unwanted CSS rules and declarations based on the `remove` array in options.
5
- *
6
- * Usage example:
7
- *
8
- * ```js
9
- * plugins: [
10
- * require('./postcss-cleanup-plugin')({
11
- * remove: [
12
- * ".someClass", // Remove rules containing this class
13
- * "line-height:", // Remove any line-height property
14
- * "display: grid" // Remove only display property if value is grid
15
- * ]
16
- * })
17
- * ]
18
- * ```
19
- *
20
- * How it works:
21
- * 1) Entries beginning with "." (e.g. ".foo") cause removal of entire rules containing that class.
22
- * 2) Entries ending with ":" but no value (e.g. "prop:") remove any declaration with the property "prop".
23
- * 3) Entries with both property and value (e.g. "prop: value") remove only those exact prop-value declarations.
24
- *
25
- */
26
- module.exports = (opts = {}) => {
27
- const removeEntries = opts.remove || [];
28
-
29
- // We'll gather them into 3 buckets:
30
- const classesToRemove = new Set();
31
- const propertiesToRemoveCompletely = new Set(); // e.g. "line-height:"
32
- const propertyValuePairsToRemove = []; // e.g. "display: grid"
33
-
34
- removeEntries.forEach(entry => {
35
- // 1) If entry starts with ".", assume it's a class to remove
36
- if (entry.startsWith('.')) {
37
- classesToRemove.add(entry.slice(1)); // remove leading dot
38
- return;
39
- }
40
-
41
- // 2) Otherwise, see if there's a ":" for a property
42
- const parts = entry.split(':').map(s => s.trim());
43
- if (parts.length === 2) {
44
- const [prop, value] = parts;
45
- // If there's no value after the colon => remove that property entirely
46
- if (!value) {
47
- propertiesToRemoveCompletely.add(prop);
48
- } else {
49
- propertyValuePairsToRemove.push({ prop, value });
50
- }
51
- }
52
- });
53
-
54
- return {
55
- postcssPlugin: 'postcss-cleanup-plugin',
56
- Once(root, { result }) {
57
- root.walkRules(rule => {
58
- // If ANY selector contains an unwanted class, remove the entire rule
59
- if (
60
- rule.selectors.some(sel =>
61
- [...classesToRemove].some(cls => sel.includes(`.${cls}`))
62
- )
63
- ) {
64
- rule.remove();
65
- return;
66
- }
67
-
68
- // Otherwise, remove targeted declarations
69
- rule.walkDecls(decl => {
70
- // If the property is in the "remove completely" set, drop it
71
- if (propertiesToRemoveCompletely.has(decl.prop)) {
72
- decl.remove();
73
- return;
74
- }
75
-
76
- // If it matches one of the prop-value pairs, drop it
77
- for (const { prop, value } of propertyValuePairsToRemove) {
78
- if (decl.prop === prop && decl.value === value) {
79
- decl.remove();
80
- return;
81
- }
82
- }
83
- });
84
- });
85
- }
86
- };
87
- };
88
-
89
- module.exports.postcss = true;
1
+ /**
2
+ * postcss-cleanup-plugin
3
+ *
4
+ * A PostCSS plugin that removes unwanted CSS rules and declarations based on the `remove` array in options.
5
+ *
6
+ * Usage example:
7
+ *
8
+ * ```js
9
+ * plugins: [
10
+ * require('./postcss-cleanup-plugin')({
11
+ * remove: [
12
+ * ".someClass", // Remove rules containing this class
13
+ * "line-height:", // Remove any line-height property
14
+ * "display: grid" // Remove only display property if value is grid
15
+ * ]
16
+ * })
17
+ * ]
18
+ * ```
19
+ *
20
+ * How it works:
21
+ * 1) Entries beginning with "." (e.g. ".foo") cause removal of entire rules containing that class.
22
+ * 2) Entries ending with ":" but no value (e.g. "prop:") remove any declaration with the property "prop".
23
+ * 3) Entries with both property and value (e.g. "prop: value") remove only those exact prop-value declarations.
24
+ *
25
+ */
26
+ module.exports = (opts = {}) => {
27
+ const removeEntries = opts.remove || [];
28
+
29
+ // We'll gather them into 3 buckets:
30
+ const classesToRemove = new Set();
31
+ const propertiesToRemoveCompletely = new Set(); // e.g. "line-height:"
32
+ const propertyValuePairsToRemove = []; // e.g. "display: grid"
33
+
34
+ removeEntries.forEach(entry => {
35
+ // 1) If entry starts with ".", assume it's a class to remove
36
+ if (entry.startsWith('.')) {
37
+ classesToRemove.add(entry.slice(1)); // remove leading dot
38
+ return;
39
+ }
40
+
41
+ // 2) Otherwise, see if there's a ":" for a property
42
+ const parts = entry.split(':').map(s => s.trim());
43
+ if (parts.length === 2) {
44
+ const [prop, value] = parts;
45
+ // If there's no value after the colon => remove that property entirely
46
+ if (!value) {
47
+ propertiesToRemoveCompletely.add(prop);
48
+ } else {
49
+ propertyValuePairsToRemove.push({ prop, value });
50
+ }
51
+ }
52
+ });
53
+
54
+ return {
55
+ postcssPlugin: 'postcss-cleanup-plugin',
56
+ Once(root, { result }) {
57
+ root.walkRules(rule => {
58
+ // If ANY selector contains an unwanted class, remove the entire rule
59
+ if (
60
+ rule.selectors.some(sel =>
61
+ [...classesToRemove].some(cls => sel.includes(`.${cls}`))
62
+ )
63
+ ) {
64
+ rule.remove();
65
+ return;
66
+ }
67
+
68
+ // Otherwise, remove targeted declarations
69
+ rule.walkDecls(decl => {
70
+ // If the property is in the "remove completely" set, drop it
71
+ if (propertiesToRemoveCompletely.has(decl.prop)) {
72
+ decl.remove();
73
+ return;
74
+ }
75
+
76
+ // If it matches one of the prop-value pairs, drop it
77
+ for (const { prop, value } of propertyValuePairsToRemove) {
78
+ if (decl.prop === prop && decl.value === value) {
79
+ decl.remove();
80
+ return;
81
+ }
82
+ }
83
+ });
84
+ });
85
+ }
86
+ };
87
+ };
88
+
89
+ module.exports.postcss = true;
90
90