onejs-core 3.0.1 → 3.0.3

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/dom/document.ts +115 -115
  33. package/dom/dom-style.ts +36 -36
  34. package/dom/dom.ts +376 -376
  35. package/dom/index.ts +3 -3
  36. package/index.ts +59 -58
  37. package/jsr.json +9 -9
  38. package/math/README.md +212 -212
  39. package/math/index.ts +487 -487
  40. package/package.json +33 -33
  41. package/preloads/inject.ts +43 -43
  42. package/scripts/esbuild/copy-assets.mjs +94 -94
  43. package/scripts/esbuild/decorator-fix.mjs +17 -17
  44. package/scripts/esbuild/import-transform.mjs +100 -100
  45. package/scripts/esbuild/index.mjs +3 -3
  46. package/scripts/esbuild/watch-output.mjs +38 -38
  47. package/scripts/postcss/cleanup-plugin.cjs +89 -89
  48. package/scripts/postcss/onejs-tw-config.cjs +252 -252
  49. package/scripts/postcss/optional-import-plugin.cjs +26 -26
  50. package/scripts/postcss/tailwind-logging-plugin.cjs +11 -11
  51. package/scripts/postcss/unwrap-is-plugin.cjs +16 -16
  52. package/scripts/postcss/uss-transform-plugin.cjs +92 -92
  53. package/scripts/switch.cjs +290 -290
  54. package/styling/index.tsx +32 -32
  55. package/styling/utils/generateAlphabeticName.ts +20 -20
  56. package/styling/utils/generateComponentId.ts +5 -5
  57. package/styling/utils/hash.ts +46 -46
  58. package/tsconfig.json +24 -24
  59. package/typings.d.ts +5 -5
  60. package/utils/arrays.ts +10 -10
  61. package/utils/color-palettes.ts +2 -2
  62. package/utils/color-parser.ts +248 -248
  63. package/utils/float-parser.ts +30 -30
  64. package/utils/index.ts +15 -15
  65. package/utils/subscribe.ts +16 -16
  66. package/utils/system.ts +16 -16
  67. package/dist/csharp/index.d.ts +0 -3
  68. package/dist/csharp/index.js +0 -3
  69. package/dist/dom/document.d.ts +0 -30
  70. package/dist/dom/document.js +0 -89
  71. package/dist/dom/dom-style.d.ts +0 -9
  72. package/dist/dom/dom-style.js +0 -27
  73. package/dist/dom/dom.d.ts +0 -83
  74. package/dist/dom/dom.js +0 -313
  75. package/dist/dom/index.d.ts +0 -4
  76. package/dist/dom/index.js +0 -4
  77. package/dist/dom/selector.d.ts +0 -0
  78. package/dist/dom/selector.js +0 -0
  79. package/dist/index.d.ts +0 -25
  80. package/dist/index.js +0 -44
  81. package/dist/math/index.d.ts +0 -86
  82. package/dist/math/index.js +0 -361
  83. package/dist/preloads/inject.d.ts +0 -3
  84. package/dist/preloads/inject.js +0 -36
  85. package/dist/styling/index.d.ts +0 -10
  86. package/dist/styling/index.js +0 -28
  87. package/dist/styling/utils/generateAlphabeticName.d.ts +0 -1
  88. package/dist/styling/utils/generateAlphabeticName.js +0 -16
  89. package/dist/styling/utils/generateComponentId.d.ts +0 -1
  90. package/dist/styling/utils/generateComponentId.js +0 -5
  91. package/dist/styling/utils/hash.d.ts +0 -5
  92. package/dist/styling/utils/hash.js +0 -34
  93. package/dist/utils/arrays.d.ts +0 -1
  94. package/dist/utils/arrays.js +0 -10
  95. package/dist/utils/color-palettes.d.ts +0 -2
  96. package/dist/utils/color-palettes.js +0 -2
  97. package/dist/utils/color-parser.d.ts +0 -161
  98. package/dist/utils/color-parser.js +0 -241
  99. package/dist/utils/float-parser.d.ts +0 -7
  100. package/dist/utils/float-parser.js +0 -23
  101. package/dist/utils/index.d.ts +0 -12
  102. package/dist/utils/index.js +0 -15
  103. package/dist/utils/responsive.d.ts +0 -4
  104. package/dist/utils/responsive.js +0 -23
  105. package/dist/utils/subscribe.d.ts +0 -4
  106. package/dist/utils/subscribe.js +0 -10
  107. package/dist/utils/system.d.ts +0 -1
  108. package/dist/utils/system.js +0 -16
  109. package/dist/utils/toJsArray.d.ts +0 -1
  110. package/dist/utils/toJsArray.js +0 -10
@@ -1,92 +1,92 @@
1
- module.exports = () => {
2
- const screenBreakpoints = {
3
- 'sm': 640,
4
- 'md': 768,
5
- 'lg': 1024,
6
- 'xl': 1280,
7
- 'xxl': 1536,
8
- }
9
- return {
10
- postcssPlugin: 'uss-transform',
11
- Once(root, { result }) {
12
- root.walkRules((rule) => {
13
- // Transform class selectors
14
- rule.selectors = rule.selectors.map(selector =>
15
- selector.replace(/(\\\.|\\#|\\%|\\:|\\\/|\\\[|\\\]|\\\(|\\\)|\\2c|\\&|\\>|\\<|\\\*|\\')/g, match => {
16
- switch (match) {
17
- case '\\.': return '_d_'
18
- case '\\#': return '_n_'
19
- case '\\%': return '_p_'
20
- case '\\:': return '_c_'
21
- case '\\/': return '_s_'
22
- case '\\[': return '_lb_'
23
- case '\\]': return '_rb_'
24
- case '\\(': return '_lp_'
25
- case '\\)': return '_rp_'
26
- case '\\2c': return '_cm_'
27
- case '\\&': return '_amp_'
28
- case '\\>': return '_gt_'
29
- case '\\<': return '_lt_'
30
- case '\\*': return '_ast_'
31
- case '\\\'': return '_sq_'
32
- default: return match
33
- }
34
- })
35
- )
36
- })
37
-
38
- // RGB to RGBA conversion
39
- root.walkDecls(decl => {
40
- if (decl.value.includes('rgb(')) {
41
- decl.value = decl.value.replace(/rgb\((.*?) \/\s*(.*?)\)/g, 'rgba($1 $2)')
42
- }
43
- })
44
-
45
- // Handle hexadecimal colors with alpha value to RGBA conversion
46
- root.walkDecls(decl => {
47
- decl.value = decl.value.replace(/#([A-Fa-f0-9]{8})/g, (match, hex) => {
48
- const r = parseInt(hex.slice(0, 2), 16)
49
- const g = parseInt(hex.slice(2, 4), 16)
50
- const b = parseInt(hex.slice(4, 6), 16)
51
- const a = parseInt(hex.slice(6, 8), 16) / 255
52
- return `rgba(${r}, ${g}, ${b}, ${a})`
53
- })
54
- })
55
-
56
- // Media queries transformation
57
- root.walkAtRules('media', atRule => {
58
- // Extract the min-width value from the media query
59
- const minWidthMatch = atRule.params.match(/min-width:\s*(\d+)px/)
60
- if (minWidthMatch) {
61
- const minWidthValue = parseInt(minWidthMatch[1], 10)
62
-
63
- // Determine the correct breakpoint
64
- let appliedBreakpointName = null
65
- Object.entries(screenBreakpoints).forEach(([name, value]) => {
66
- if (minWidthValue >= value) {
67
- appliedBreakpointName = name
68
- }
69
- })
70
-
71
- if (appliedBreakpointName) {
72
- const className = `.onejs-media-${appliedBreakpointName}`
73
-
74
- // Prepend the class to each rule inside this media query
75
- atRule.walkRules(rule => {
76
- rule.selectors = rule.selectors.map(selector =>
77
- selector.startsWith(".root")
78
- ? selector.replace(/^\.root/, `.root${className}`)
79
- : `${className} ${selector}`
80
- )
81
- })
82
-
83
- // Remove the @media rule by replacing it with its contents
84
- atRule.replaceWith(atRule.nodes)
85
- }
86
- }
87
- })
88
- }
89
- }
90
- }
91
-
92
- module.exports.postcss = true
1
+ module.exports = () => {
2
+ const screenBreakpoints = {
3
+ 'sm': 640,
4
+ 'md': 768,
5
+ 'lg': 1024,
6
+ 'xl': 1280,
7
+ 'xxl': 1536,
8
+ }
9
+ return {
10
+ postcssPlugin: 'uss-transform',
11
+ Once(root, { result }) {
12
+ root.walkRules((rule) => {
13
+ // Transform class selectors
14
+ rule.selectors = rule.selectors.map(selector =>
15
+ selector.replace(/(\\\.|\\#|\\%|\\:|\\\/|\\\[|\\\]|\\\(|\\\)|\\2c|\\&|\\>|\\<|\\\*|\\')/g, match => {
16
+ switch (match) {
17
+ case '\\.': return '_d_'
18
+ case '\\#': return '_n_'
19
+ case '\\%': return '_p_'
20
+ case '\\:': return '_c_'
21
+ case '\\/': return '_s_'
22
+ case '\\[': return '_lb_'
23
+ case '\\]': return '_rb_'
24
+ case '\\(': return '_lp_'
25
+ case '\\)': return '_rp_'
26
+ case '\\2c': return '_cm_'
27
+ case '\\&': return '_amp_'
28
+ case '\\>': return '_gt_'
29
+ case '\\<': return '_lt_'
30
+ case '\\*': return '_ast_'
31
+ case '\\\'': return '_sq_'
32
+ default: return match
33
+ }
34
+ })
35
+ )
36
+ })
37
+
38
+ // RGB to RGBA conversion
39
+ root.walkDecls(decl => {
40
+ if (decl.value.includes('rgb(')) {
41
+ decl.value = decl.value.replace(/rgb\((.*?) \/\s*(.*?)\)/g, 'rgba($1 $2)')
42
+ }
43
+ })
44
+
45
+ // Handle hexadecimal colors with alpha value to RGBA conversion
46
+ root.walkDecls(decl => {
47
+ decl.value = decl.value.replace(/#([A-Fa-f0-9]{8})/g, (match, hex) => {
48
+ const r = parseInt(hex.slice(0, 2), 16)
49
+ const g = parseInt(hex.slice(2, 4), 16)
50
+ const b = parseInt(hex.slice(4, 6), 16)
51
+ const a = parseInt(hex.slice(6, 8), 16) / 255
52
+ return `rgba(${r}, ${g}, ${b}, ${a})`
53
+ })
54
+ })
55
+
56
+ // Media queries transformation
57
+ root.walkAtRules('media', atRule => {
58
+ // Extract the min-width value from the media query
59
+ const minWidthMatch = atRule.params.match(/min-width:\s*(\d+)px/)
60
+ if (minWidthMatch) {
61
+ const minWidthValue = parseInt(minWidthMatch[1], 10)
62
+
63
+ // Determine the correct breakpoint
64
+ let appliedBreakpointName = null
65
+ Object.entries(screenBreakpoints).forEach(([name, value]) => {
66
+ if (minWidthValue >= value) {
67
+ appliedBreakpointName = name
68
+ }
69
+ })
70
+
71
+ if (appliedBreakpointName) {
72
+ const className = `.onejs-media-${appliedBreakpointName}`
73
+
74
+ // Prepend the class to each rule inside this media query
75
+ atRule.walkRules(rule => {
76
+ rule.selectors = rule.selectors.map(selector =>
77
+ selector.startsWith(".root")
78
+ ? selector.replace(/^\.root/, `.root${className}`)
79
+ : `${className} ${selector}`
80
+ )
81
+ })
82
+
83
+ // Remove the @media rule by replacing it with its contents
84
+ atRule.replaceWith(atRule.nodes)
85
+ }
86
+ }
87
+ })
88
+ }
89
+ }
90
+ }
91
+
92
+ module.exports.postcss = true