onejs-core 3.0.3 → 3.0.5

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 (103) 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/bin/oj.js +252 -252
  7. package/definitions/Assemblies/OneJS.Runtime.Ext.d.ts +6 -6
  8. package/definitions/Assemblies/OneJS.Runtime.d.ts +826 -826
  9. package/definitions/Assemblies/OneJS.Samples.d.ts +20 -20
  10. package/definitions/Assemblies/Unity.Mathematics.d.ts +9221 -9221
  11. package/definitions/Assemblies/UnityEditor.CoreModule.d.ts +32614 -32614
  12. package/definitions/Assemblies/UnityEngine.AIModule.d.ts +998 -998
  13. package/definitions/Assemblies/UnityEngine.AnimationModule.d.ts +3308 -3308
  14. package/definitions/Assemblies/UnityEngine.AssetBundleModule.d.ts +337 -337
  15. package/definitions/Assemblies/UnityEngine.AudioModule.d.ts +1154 -1154
  16. package/definitions/Assemblies/UnityEngine.CoreModule.d.ts +29587 -29587
  17. package/definitions/Assemblies/UnityEngine.PhysicsModule.d.ts +3137 -3137
  18. package/definitions/Assemblies/UnityEngine.TerrainModule.d.ts +1270 -1270
  19. package/definitions/Assemblies/UnityEngine.UIElementsModule.d.ts +32718 -32718
  20. package/definitions/Assemblies/UnityEngine.UnityAnalyticsCommonModule.d.ts +274 -274
  21. package/definitions/Assemblies/index.d.ts +16 -16
  22. package/definitions/Assemblies/mscorlib.d.ts +19416 -19416
  23. package/definitions/augments.d.ts +66 -66
  24. package/definitions/globals.d.ts +53 -53
  25. package/definitions/index.d.ts +11 -11
  26. package/definitions/jsx.d.ts +570 -570
  27. package/definitions/modules.d.ts +32 -32
  28. package/definitions/onejs.d.ts +171 -171
  29. package/definitions/preact.jsx.d.ts +6 -6
  30. package/definitions/proto-overrides.d.ts +41 -41
  31. package/definitions/puerts.d.ts +30 -30
  32. package/definitions/unity-engine.d.ts +22 -22
  33. package/dist/dom/document.d.ts +30 -0
  34. package/dist/dom/document.js +89 -0
  35. package/dist/dom/dom-style.d.ts +9 -0
  36. package/dist/dom/dom-style.js +27 -0
  37. package/dist/dom/dom.d.ts +83 -0
  38. package/dist/dom/dom.js +313 -0
  39. package/dist/dom/index.d.ts +4 -0
  40. package/dist/dom/index.js +4 -0
  41. package/dist/index.d.ts +25 -0
  42. package/dist/index.js +45 -0
  43. package/dist/math/index.d.ts +86 -0
  44. package/dist/math/index.js +361 -0
  45. package/dist/preloads/inject.d.ts +3 -0
  46. package/dist/preloads/inject.js +36 -0
  47. package/dist/styling/index.d.ts +10 -0
  48. package/dist/styling/index.js +28 -0
  49. package/dist/styling/utils/generateAlphabeticName.d.ts +1 -0
  50. package/dist/styling/utils/generateAlphabeticName.js +16 -0
  51. package/dist/styling/utils/generateComponentId.d.ts +1 -0
  52. package/dist/styling/utils/generateComponentId.js +5 -0
  53. package/dist/styling/utils/hash.d.ts +5 -0
  54. package/dist/styling/utils/hash.js +34 -0
  55. package/dist/utils/arrays.d.ts +1 -0
  56. package/dist/utils/arrays.js +10 -0
  57. package/dist/utils/color-palettes.d.ts +2 -0
  58. package/dist/utils/color-palettes.js +2 -0
  59. package/dist/utils/color-parser.d.ts +161 -0
  60. package/dist/utils/color-parser.js +241 -0
  61. package/dist/utils/float-parser.d.ts +7 -0
  62. package/dist/utils/float-parser.js +23 -0
  63. package/dist/utils/index.d.ts +12 -0
  64. package/dist/utils/index.js +15 -0
  65. package/dist/utils/subscribe.d.ts +4 -0
  66. package/dist/utils/subscribe.js +10 -0
  67. package/dist/utils/system.d.ts +1 -0
  68. package/dist/utils/system.js +16 -0
  69. package/dom/document.ts +115 -115
  70. package/dom/dom-style.ts +36 -36
  71. package/dom/dom.ts +376 -376
  72. package/dom/index.ts +3 -3
  73. package/index.ts +59 -59
  74. package/jsr.json +9 -9
  75. package/math/README.md +212 -212
  76. package/math/index.ts +487 -487
  77. package/package.json +34 -33
  78. package/preloads/inject.ts +43 -43
  79. package/scripts/esbuild/copy-assets.mjs +94 -94
  80. package/scripts/esbuild/decorator-fix.mjs +17 -17
  81. package/scripts/esbuild/import-transform.mjs +100 -100
  82. package/scripts/esbuild/index.mjs +3 -3
  83. package/scripts/esbuild/watch-output.mjs +38 -38
  84. package/scripts/postcss/cleanup-plugin.cjs +89 -89
  85. package/scripts/postcss/onejs-tw-config.cjs +252 -252
  86. package/scripts/postcss/optional-import-plugin.cjs +26 -26
  87. package/scripts/postcss/tailwind-logging-plugin.cjs +11 -11
  88. package/scripts/postcss/unwrap-is-plugin.cjs +16 -16
  89. package/scripts/postcss/uss-transform-plugin.cjs +92 -92
  90. package/scripts/switch.cjs +321 -290
  91. package/styling/index.tsx +32 -32
  92. package/styling/utils/generateAlphabeticName.ts +20 -20
  93. package/styling/utils/generateComponentId.ts +5 -5
  94. package/styling/utils/hash.ts +46 -46
  95. package/tsconfig.json +24 -24
  96. package/typings.d.ts +5 -5
  97. package/utils/arrays.ts +10 -10
  98. package/utils/color-palettes.ts +2 -2
  99. package/utils/color-parser.ts +248 -248
  100. package/utils/float-parser.ts +30 -30
  101. package/utils/index.ts +15 -15
  102. package/utils/subscribe.ts +16 -16
  103. package/utils/system.ts +16 -16
package/dom/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference path="../definitions/index.d.ts" />
2
- export { DocumentWrapper } from './document';
3
- export { DomWrapper } from './dom';
1
+ /// <reference path="../definitions/index.d.ts" />
2
+ export { DocumentWrapper } from './document';
3
+ export { DomWrapper } from './dom';
4
4
  export { DomStyleWrapper } from './dom-style';
package/index.ts CHANGED
@@ -1,60 +1,60 @@
1
- /// <reference path="./definitions/index.d.ts" />
2
- import { DocumentWrapper } from "./dom/document"
3
- import { DomWrapper } from "./dom/dom"
4
-
5
- /**
6
- * OneJS's own h function. Use this to quickly create elements in jsx-like syntax
7
- * @param type
8
- * @param props
9
- * @param children
10
- * @returns
11
- */
12
- export function h(type: any, props: any, ...children: any[]): any {
13
- const element = typeof type === "string" ? document.createElement(type) : type
14
-
15
- // Assign properties to the element
16
- for (const [key, value] of Object.entries(props || {})) {
17
- if (key.startsWith("on") && typeof value === "function") {
18
- element.addEventListener(key.substring(2).toLowerCase(), value)
19
- } else if (key === "style" && typeof value === "object") {
20
- Object.assign(element.style, value)
21
- } else {
22
- element.setAttribute(key, value)
23
- }
24
- }
25
-
26
- // Append children
27
- for (const child of children) {
28
- if (typeof child === "string") {
29
- element.appendChild(document.createTextNode(child))
30
- } else {
31
- element.appendChild(child)
32
- }
33
- }
34
-
35
- return element
36
- }
37
-
38
- export { emo } from "./styling/index"
39
-
40
- declare global {
41
- interface Document extends DocumentWrapper { }
42
- interface Element extends DomWrapper {
43
-
44
- }
45
- const newCsArray: <T>(type: { new(...args: any[]): T }, count: number) => CS.System.Array
46
- const toJsArray: <T>(csArr: CS.System.Array) => T[]
47
- const toCsArray: <T>(jsArr: T[], type: { new(...args: any[]): T }) => CS.System.Array
48
- }
49
-
50
- if (typeof globalThis.___document != "undefined") {
51
- // @ts-ignore
52
- globalThis.onejsDocument = new DocumentWrapper(globalThis.___document)
53
- // @ts-ignore
54
- if (!globalThis.ONEJS_WEBGL && !globalThis.document) {
55
- // @ts-ignore
56
- globalThis.document = globalThis.onejsDocument
57
- }
58
- }
59
-
1
+ /// <reference path="./definitions/index.d.ts" />
2
+ import { DocumentWrapper } from "./dom/document"
3
+ import { DomWrapper } from "./dom/dom"
4
+
5
+ /**
6
+ * OneJS's own h function. Use this to quickly create elements in jsx-like syntax
7
+ * @param type
8
+ * @param props
9
+ * @param children
10
+ * @returns
11
+ */
12
+ export function h(type: any, props: any, ...children: any[]): any {
13
+ const element = typeof type === "string" ? document.createElement(type) : type
14
+
15
+ // Assign properties to the element
16
+ for (const [key, value] of Object.entries(props || {})) {
17
+ if (key.startsWith("on") && typeof value === "function") {
18
+ element.addEventListener(key.substring(2).toLowerCase(), value)
19
+ } else if (key === "style" && typeof value === "object") {
20
+ Object.assign(element.style, value)
21
+ } else {
22
+ element.setAttribute(key, value)
23
+ }
24
+ }
25
+
26
+ // Append children
27
+ for (const child of children) {
28
+ if (typeof child === "string") {
29
+ element.appendChild(document.createTextNode(child))
30
+ } else {
31
+ element.appendChild(child)
32
+ }
33
+ }
34
+
35
+ return element
36
+ }
37
+
38
+ export { emo } from "./styling/index"
39
+
40
+ declare global {
41
+ interface Document extends DocumentWrapper { }
42
+ interface Element extends DomWrapper {
43
+
44
+ }
45
+ const newCsArray: <T>(type: { new(...args: any[]): T }, count: number) => CS.System.Array
46
+ const toJsArray: <T>(csArr: CS.System.Array) => T[]
47
+ const toCsArray: <T>(jsArr: T[], type: { new(...args: any[]): T }) => CS.System.Array
48
+ }
49
+
50
+ if (typeof globalThis.___document != "undefined") {
51
+ // @ts-ignore
52
+ globalThis.onejsDocument = new DocumentWrapper(globalThis.___document)
53
+ // @ts-ignore
54
+ if (!globalThis.ONEJS_WEBGL && !globalThis.document) {
55
+ // @ts-ignore
56
+ globalThis.document = globalThis.onejsDocument
57
+ }
58
+ }
59
+
60
60
  // puer.$extension(CS.UnityEngine.UIElements.VisualElement, CS.UnityEngine.UIElements.VisualElementExtensions)
package/jsr.json CHANGED
@@ -1,10 +1,10 @@
1
- {
2
- "name": "@onejs/core",
3
- "version": "0.1.20",
4
- "exports": {
5
- ".": "./index.ts",
6
- "./utils": "./index.ts",
7
- "./uss-transform-plugin.cjs": "./uss-transform-plugin.cjs",
8
- "./onejs-tw-config.cjs": "./onejs-tw-config.cjs"
9
- }
1
+ {
2
+ "name": "@onejs/core",
3
+ "version": "0.1.20",
4
+ "exports": {
5
+ ".": "./index.ts",
6
+ "./utils": "./index.ts",
7
+ "./uss-transform-plugin.cjs": "./uss-transform-plugin.cjs",
8
+ "./onejs-tw-config.cjs": "./onejs-tw-config.cjs"
9
+ }
10
10
  }
package/math/README.md CHANGED
@@ -1,212 +1,212 @@
1
- # OneJS Math Utilities
2
-
3
- Convenience functions for working with vectors, quaternions, matrices, etc.
4
-
5
- ## Usage Example
6
-
7
- ```typescript
8
- import { vec3, quat, mul, add } from 'onejs-core/math';
9
-
10
- // Create a position vector
11
- const position = vec3(1, 2, 3);
12
-
13
- // Create a rotation
14
- const rotation = quat(0, 0, 0, 1);
15
-
16
- // Apply rotation to direction vector
17
- const direction = vec3(0, 0, 1);
18
- const rotatedDirection = mul(rotation, direction);
19
-
20
- // Move in the rotated direction
21
- const newPosition = add(position, rotatedDirection);
22
- ```
23
-
24
- ## Table of Contents
25
- - [Vector Creation](#vector-creation)
26
- - [Quaternion Creation](#quaternion-creation)
27
- - [Matrix Operations](#matrix-operations)
28
- - [Array Utilities](#array-utilities)
29
- - [Math Operations](#math-operations)
30
- - [Vector Operations](#vector-operations)
31
-
32
- ## Vector Creation
33
-
34
- Create Unity vectors with simplified syntax.
35
-
36
- ```typescript
37
- // Create Vector2
38
- vec2(x: number, y: number): Vector2
39
-
40
- // Create Vector2Int
41
- vec2i(x: number, y: number): Vector2Int
42
-
43
- // Create Vector3
44
- vec3(x: number, y: number, z: number): Vector3
45
-
46
- // Create Vector3Int
47
- vec3i(x: number, y: number, z: number): Vector3Int
48
-
49
- // Create Vector4
50
- vec4(x: number, y: number, z: number, w: number): Vector4
51
- ```
52
-
53
- ## Quaternion Creation
54
-
55
- Create and manipulate Unity quaternions.
56
-
57
- ```typescript
58
- // Create identity quaternion (no args) or specific quaternion (with args)
59
- quat(): Quaternion
60
- quat(x: number, y: number, z: number, w: number): Quaternion
61
-
62
- // Create quaternion from Euler angles (in degrees)
63
- euler(x: number, y: number, z: number): Quaternion
64
- ```
65
-
66
- ## Matrix Operations
67
-
68
- Create and manipulate 4x4 matrices.
69
-
70
- ```typescript
71
- // Create identity matrix (no args) or from vectors/array
72
- mat4x4(): Matrix4x4
73
- mat4x4(a: Vector4, b: Vector4, c: Vector4, d: Vector4): Matrix4x4
74
- mat4x4(a: number[][]): Matrix4x4
75
-
76
- // Create TRS matrix (translation, rotation, scale)
77
- trs(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4x4
78
- ```
79
-
80
- ## Array Utilities
81
-
82
- Create C# arrays from JavaScript values.
83
-
84
- ```typescript
85
- // Create array of floats
86
- floatArray(...items: number[]): CSArray
87
-
88
- // Create array of Vector2
89
- vec2Array(...items: number[][]): CSArray
90
-
91
- // Create array of Vector2Int
92
- vec2iArray(...items: number[][]): CSArray
93
-
94
- // Create array of Vector3
95
- vec3Array(...items: number[][]): CSArray
96
-
97
- // Create array of Vector3Int
98
- vec3iArray(...items: number[][]): CSArray
99
-
100
- // Create array of Vector4
101
- vec4Array(...items: number[][]): CSArray
102
- ```
103
-
104
- ## Math Operations
105
-
106
- Vector math operations with overloaded support for different types.
107
-
108
- ### Addition
109
- ```typescript
110
- add(a: Vector2, b: Vector2): Vector2
111
- add(a: Vector3, b: Vector3): Vector3
112
- add(a: Vector2Int, b: Vector2Int): Vector2Int
113
- add(a: Vector3Int, b: Vector3Int): Vector3Int
114
- add(a: Vector4, b: Vector4): Vector4
115
- ```
116
-
117
- ### Subtraction
118
- ```typescript
119
- sub(a: Vector2, b: Vector2): Vector2
120
- sub(a: Vector3, b: Vector3): Vector3
121
- sub(a: Vector2Int, b: Vector2Int): Vector2Int
122
- sub(a: Vector3Int, b: Vector3Int): Vector3Int
123
- sub(a: Vector4, b: Vector4): Vector4
124
- ```
125
-
126
- ### Negation
127
- ```typescript
128
- neg(a: Vector2): Vector2
129
- neg(a: Vector3): Vector3
130
- neg(a: Vector2Int): Vector2Int
131
- neg(a: Vector3Int): Vector3Int
132
- neg(a: Vector4): Vector4
133
- ```
134
-
135
- ### Multiplication
136
- ```typescript
137
- // Vector-scalar multiplication
138
- mul(a: Vector2|Vector3|Vector2Int|Vector3Int|Vector4, b: number): same as a
139
- mul(a: number, b: Vector2|Vector3|Vector2Int|Vector3Int|Vector4): same as b
140
-
141
- // Quaternion multiplication
142
- mul(a: Quaternion, b: Quaternion): Quaternion
143
- mul(a: Quaternion, b: Vector3): Quaternion
144
-
145
- // Matrix multiplication
146
- mul(a: Matrix4x4, b: Matrix4x4): Matrix4x4
147
- mul(a: Matrix4x4, b: Vector3): Quaternion
148
- ```
149
-
150
- ### Division
151
- ```typescript
152
- div(a: Vector2, b: number): Vector2
153
- div(a: Vector3, b: number): Vector3
154
- div(a: Vector2Int, b: number): Vector2Int
155
- div(a: Vector3Int, b: number): Vector3Int
156
- ```
157
-
158
- ### Equality
159
- ```typescript
160
- eq(a: Vector2, b: Vector2): boolean
161
- eq(a: Vector3, b: Vector3): boolean
162
- eq(a: Vector2Int, b: Vector2Int): boolean
163
- eq(a: Vector3Int, b: Vector3Int): boolean
164
- eq(a: Quaternion, b: Quaternion): boolean
165
- ```
166
-
167
- ## Vector Operations
168
-
169
- ### Dot Product
170
- ```typescript
171
- dot(a: Vector2, b: Vector2): number
172
- dot(a: Vector3, b: Vector3): number
173
- dot(a: Vector4, b: Vector4): number
174
- dot(a: Quaternion, b: Quaternion): number
175
- ```
176
-
177
- ### Clamping
178
- ```typescript
179
- // Clamp between min and max
180
- clamp(a: Vector2|Vector3|Vector2Int|Vector3Int|Vector4,
181
- min: same as a,
182
- max: same as a): same as a
183
-
184
- // Clamp between 0 and 1
185
- clamp01(a: Vector2|Vector3|Vector4): same as a
186
- ```
187
-
188
- ### Distance
189
- ```typescript
190
- distance(a: Vector2, b: Vector2): number
191
- distance(a: Vector3, b: Vector3): number
192
- distance(a: Vector2Int, b: Vector2Int): number
193
- distance(a: Vector3Int, b: Vector3Int): number
194
- distance(a: Vector4, b: Vector4): number
195
- ```
196
-
197
- ### Normalization
198
- ```typescript
199
- normalize(a: Vector2): Vector2
200
- normalize(a: Vector3): Vector3
201
- normalize(a: Vector4): Vector4
202
- ```
203
-
204
- ### Linear Interpolation
205
- ```typescript
206
- lerp(a: number, b: number, t: number): number
207
- lerp(a: Vector2, b: Vector2, t: number): Vector2
208
- lerp(a: Vector3, b: Vector3, t: number): Vector3
209
- lerp(a: Vector4, b: Vector4, t: number): Vector4
210
- lerp(a: Quaternion, b: Quaternion, t: number): Quaternion
211
- lerp(a: Color, b: Color, t: number): Color
212
- ```
1
+ # OneJS Math Utilities
2
+
3
+ Convenience functions for working with vectors, quaternions, matrices, etc.
4
+
5
+ ## Usage Example
6
+
7
+ ```typescript
8
+ import { vec3, quat, mul, add } from 'onejs-core/math';
9
+
10
+ // Create a position vector
11
+ const position = vec3(1, 2, 3);
12
+
13
+ // Create a rotation
14
+ const rotation = quat(0, 0, 0, 1);
15
+
16
+ // Apply rotation to direction vector
17
+ const direction = vec3(0, 0, 1);
18
+ const rotatedDirection = mul(rotation, direction);
19
+
20
+ // Move in the rotated direction
21
+ const newPosition = add(position, rotatedDirection);
22
+ ```
23
+
24
+ ## Table of Contents
25
+ - [Vector Creation](#vector-creation)
26
+ - [Quaternion Creation](#quaternion-creation)
27
+ - [Matrix Operations](#matrix-operations)
28
+ - [Array Utilities](#array-utilities)
29
+ - [Math Operations](#math-operations)
30
+ - [Vector Operations](#vector-operations)
31
+
32
+ ## Vector Creation
33
+
34
+ Create Unity vectors with simplified syntax.
35
+
36
+ ```typescript
37
+ // Create Vector2
38
+ vec2(x: number, y: number): Vector2
39
+
40
+ // Create Vector2Int
41
+ vec2i(x: number, y: number): Vector2Int
42
+
43
+ // Create Vector3
44
+ vec3(x: number, y: number, z: number): Vector3
45
+
46
+ // Create Vector3Int
47
+ vec3i(x: number, y: number, z: number): Vector3Int
48
+
49
+ // Create Vector4
50
+ vec4(x: number, y: number, z: number, w: number): Vector4
51
+ ```
52
+
53
+ ## Quaternion Creation
54
+
55
+ Create and manipulate Unity quaternions.
56
+
57
+ ```typescript
58
+ // Create identity quaternion (no args) or specific quaternion (with args)
59
+ quat(): Quaternion
60
+ quat(x: number, y: number, z: number, w: number): Quaternion
61
+
62
+ // Create quaternion from Euler angles (in degrees)
63
+ euler(x: number, y: number, z: number): Quaternion
64
+ ```
65
+
66
+ ## Matrix Operations
67
+
68
+ Create and manipulate 4x4 matrices.
69
+
70
+ ```typescript
71
+ // Create identity matrix (no args) or from vectors/array
72
+ mat4x4(): Matrix4x4
73
+ mat4x4(a: Vector4, b: Vector4, c: Vector4, d: Vector4): Matrix4x4
74
+ mat4x4(a: number[][]): Matrix4x4
75
+
76
+ // Create TRS matrix (translation, rotation, scale)
77
+ trs(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4x4
78
+ ```
79
+
80
+ ## Array Utilities
81
+
82
+ Create C# arrays from JavaScript values.
83
+
84
+ ```typescript
85
+ // Create array of floats
86
+ floatArray(...items: number[]): CSArray
87
+
88
+ // Create array of Vector2
89
+ vec2Array(...items: number[][]): CSArray
90
+
91
+ // Create array of Vector2Int
92
+ vec2iArray(...items: number[][]): CSArray
93
+
94
+ // Create array of Vector3
95
+ vec3Array(...items: number[][]): CSArray
96
+
97
+ // Create array of Vector3Int
98
+ vec3iArray(...items: number[][]): CSArray
99
+
100
+ // Create array of Vector4
101
+ vec4Array(...items: number[][]): CSArray
102
+ ```
103
+
104
+ ## Math Operations
105
+
106
+ Vector math operations with overloaded support for different types.
107
+
108
+ ### Addition
109
+ ```typescript
110
+ add(a: Vector2, b: Vector2): Vector2
111
+ add(a: Vector3, b: Vector3): Vector3
112
+ add(a: Vector2Int, b: Vector2Int): Vector2Int
113
+ add(a: Vector3Int, b: Vector3Int): Vector3Int
114
+ add(a: Vector4, b: Vector4): Vector4
115
+ ```
116
+
117
+ ### Subtraction
118
+ ```typescript
119
+ sub(a: Vector2, b: Vector2): Vector2
120
+ sub(a: Vector3, b: Vector3): Vector3
121
+ sub(a: Vector2Int, b: Vector2Int): Vector2Int
122
+ sub(a: Vector3Int, b: Vector3Int): Vector3Int
123
+ sub(a: Vector4, b: Vector4): Vector4
124
+ ```
125
+
126
+ ### Negation
127
+ ```typescript
128
+ neg(a: Vector2): Vector2
129
+ neg(a: Vector3): Vector3
130
+ neg(a: Vector2Int): Vector2Int
131
+ neg(a: Vector3Int): Vector3Int
132
+ neg(a: Vector4): Vector4
133
+ ```
134
+
135
+ ### Multiplication
136
+ ```typescript
137
+ // Vector-scalar multiplication
138
+ mul(a: Vector2|Vector3|Vector2Int|Vector3Int|Vector4, b: number): same as a
139
+ mul(a: number, b: Vector2|Vector3|Vector2Int|Vector3Int|Vector4): same as b
140
+
141
+ // Quaternion multiplication
142
+ mul(a: Quaternion, b: Quaternion): Quaternion
143
+ mul(a: Quaternion, b: Vector3): Quaternion
144
+
145
+ // Matrix multiplication
146
+ mul(a: Matrix4x4, b: Matrix4x4): Matrix4x4
147
+ mul(a: Matrix4x4, b: Vector3): Quaternion
148
+ ```
149
+
150
+ ### Division
151
+ ```typescript
152
+ div(a: Vector2, b: number): Vector2
153
+ div(a: Vector3, b: number): Vector3
154
+ div(a: Vector2Int, b: number): Vector2Int
155
+ div(a: Vector3Int, b: number): Vector3Int
156
+ ```
157
+
158
+ ### Equality
159
+ ```typescript
160
+ eq(a: Vector2, b: Vector2): boolean
161
+ eq(a: Vector3, b: Vector3): boolean
162
+ eq(a: Vector2Int, b: Vector2Int): boolean
163
+ eq(a: Vector3Int, b: Vector3Int): boolean
164
+ eq(a: Quaternion, b: Quaternion): boolean
165
+ ```
166
+
167
+ ## Vector Operations
168
+
169
+ ### Dot Product
170
+ ```typescript
171
+ dot(a: Vector2, b: Vector2): number
172
+ dot(a: Vector3, b: Vector3): number
173
+ dot(a: Vector4, b: Vector4): number
174
+ dot(a: Quaternion, b: Quaternion): number
175
+ ```
176
+
177
+ ### Clamping
178
+ ```typescript
179
+ // Clamp between min and max
180
+ clamp(a: Vector2|Vector3|Vector2Int|Vector3Int|Vector4,
181
+ min: same as a,
182
+ max: same as a): same as a
183
+
184
+ // Clamp between 0 and 1
185
+ clamp01(a: Vector2|Vector3|Vector4): same as a
186
+ ```
187
+
188
+ ### Distance
189
+ ```typescript
190
+ distance(a: Vector2, b: Vector2): number
191
+ distance(a: Vector3, b: Vector3): number
192
+ distance(a: Vector2Int, b: Vector2Int): number
193
+ distance(a: Vector3Int, b: Vector3Int): number
194
+ distance(a: Vector4, b: Vector4): number
195
+ ```
196
+
197
+ ### Normalization
198
+ ```typescript
199
+ normalize(a: Vector2): Vector2
200
+ normalize(a: Vector3): Vector3
201
+ normalize(a: Vector4): Vector4
202
+ ```
203
+
204
+ ### Linear Interpolation
205
+ ```typescript
206
+ lerp(a: number, b: number, t: number): number
207
+ lerp(a: Vector2, b: Vector2, t: number): Vector2
208
+ lerp(a: Vector3, b: Vector3, t: number): Vector3
209
+ lerp(a: Vector4, b: Vector4, t: number): Vector4
210
+ lerp(a: Quaternion, b: Quaternion, t: number): Quaternion
211
+ lerp(a: Color, b: Color, t: number): Color
212
+ ```