@holoscript/std 7.0.0 → 7.0.1

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 (132) hide show
  1. package/README.md +8 -0
  2. package/dist/chunk-DGUM43GV.js +11 -0
  3. package/dist/{chunk-PFX2JM4X.js → chunk-FAMOLKH3.js} +2 -1
  4. package/dist/{chunk-PFX2JM4X.js.map → chunk-FAMOLKH3.js.map} +1 -1
  5. package/dist/{chunk-DZHAVOCH.js → chunk-SOKH6FJ7.js} +31 -6
  6. package/dist/chunk-SOKH6FJ7.js.map +1 -0
  7. package/dist/collections.cjs +1 -0
  8. package/dist/collections.cjs.map +1 -1
  9. package/dist/collections.js +2 -2
  10. package/dist/fs/fs.d.ts.map +1 -1
  11. package/dist/fs/index.cjs +221 -8510
  12. package/dist/fs/index.cjs.map +1 -1
  13. package/dist/fs/index.js +832 -118
  14. package/dist/fs/index.js.map +1 -1
  15. package/dist/fs/sandbox.d.ts +49 -0
  16. package/dist/fs/sandbox.d.ts.map +1 -0
  17. package/dist/index.cjs +3494 -12672
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +0 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +17 -7
  22. package/dist/index.js.map +1 -1
  23. package/dist/math.cjs +18 -3
  24. package/dist/math.cjs.map +1 -1
  25. package/dist/math.js +2 -2
  26. package/dist/string.js +1 -1
  27. package/dist/time.js +1 -1
  28. package/dist/traits/EconomicPrimitives.js +1 -1
  29. package/dist/traits/EconomicTraits.js +1 -1
  30. package/dist/types.d.ts.map +1 -1
  31. package/package.json +19 -9
  32. package/dist/__tests__/EconomicPrimitives.test.d.ts +0 -2
  33. package/dist/__tests__/EconomicPrimitives.test.d.ts.map +0 -1
  34. package/dist/__tests__/EconomicTraits.test.d.ts +0 -2
  35. package/dist/__tests__/EconomicTraits.test.d.ts.map +0 -1
  36. package/dist/__tests__/SimulationLabPrimitives.test.d.ts +0 -2
  37. package/dist/__tests__/SimulationLabPrimitives.test.d.ts.map +0 -1
  38. package/dist/__tests__/collections.test.d.ts +0 -2
  39. package/dist/__tests__/collections.test.d.ts.map +0 -1
  40. package/dist/__tests__/events.test.d.ts +0 -2
  41. package/dist/__tests__/events.test.d.ts.map +0 -1
  42. package/dist/__tests__/index.test.d.ts +0 -2
  43. package/dist/__tests__/index.test.d.ts.map +0 -1
  44. package/dist/__tests__/materials.test.d.ts +0 -2
  45. package/dist/__tests__/materials.test.d.ts.map +0 -1
  46. package/dist/__tests__/math.test.d.ts +0 -2
  47. package/dist/__tests__/math.test.d.ts.map +0 -1
  48. package/dist/__tests__/physics.test.d.ts +0 -2
  49. package/dist/__tests__/physics.test.d.ts.map +0 -1
  50. package/dist/__tests__/spatial.test.d.ts +0 -2
  51. package/dist/__tests__/spatial.test.d.ts.map +0 -1
  52. package/dist/__tests__/standard-library-fundamentals.test.d.ts +0 -2
  53. package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +0 -1
  54. package/dist/__tests__/string-and-time-utilities.test.d.ts +0 -2
  55. package/dist/__tests__/string-and-time-utilities.test.d.ts.map +0 -1
  56. package/dist/__tests__/string-decoupled.test.d.ts +0 -2
  57. package/dist/__tests__/string-decoupled.test.d.ts.map +0 -1
  58. package/dist/__tests__/string.test.d.ts +0 -2
  59. package/dist/__tests__/string.test.d.ts.map +0 -1
  60. package/dist/__tests__/time.test.d.ts +0 -2
  61. package/dist/__tests__/time.test.d.ts.map +0 -1
  62. package/dist/chunk-DZHAVOCH.js.map +0 -1
  63. package/dist/chunk-PR4QN5HX.js +0 -43
  64. package/dist/chunk-XBA4ARST.js +0 -9313
  65. package/dist/chunk-XBA4ARST.js.map +0 -1
  66. package/dist/fs/__tests__/file-watch-system.test.d.ts +0 -2
  67. package/dist/fs/__tests__/file-watch-system.test.d.ts.map +0 -1
  68. package/dist/fs/__tests__/path-utilities.test.d.ts +0 -2
  69. package/dist/fs/__tests__/path-utilities.test.d.ts.map +0 -1
  70. package/dist/fs/__tests__/path.test.d.ts +0 -2
  71. package/dist/fs/__tests__/path.test.d.ts.map +0 -1
  72. package/dist/string.basic.test.d.ts +0 -5
  73. package/dist/string.basic.test.d.ts.map +0 -1
  74. package/dist/string.test.d.ts +0 -5
  75. package/dist/string.test.d.ts.map +0 -1
  76. package/dist/traits/__tests__/ARTraits.test.d.ts +0 -2
  77. package/dist/traits/__tests__/ARTraits.test.d.ts.map +0 -1
  78. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +0 -2
  79. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +0 -1
  80. package/dist/traits/__tests__/EconomicTraits.test.d.ts +0 -2
  81. package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +0 -1
  82. package/error-utf8.log +0 -6
  83. package/error.log +0 -0
  84. package/src/__tests__/EconomicPrimitives.test.ts +0 -690
  85. package/src/__tests__/EconomicTraits.test.ts +0 -425
  86. package/src/__tests__/SimulationLabPrimitives.test.ts +0 -415
  87. package/src/__tests__/collections.test.ts +0 -182
  88. package/src/__tests__/events.test.ts +0 -135
  89. package/src/__tests__/index.test.ts +0 -14
  90. package/src/__tests__/materials.test.ts +0 -84
  91. package/src/__tests__/math.test.ts +0 -246
  92. package/src/__tests__/physics.test.ts +0 -83
  93. package/src/__tests__/spatial.test.ts +0 -333
  94. package/src/__tests__/standard-library-fundamentals.test.ts +0 -1318
  95. package/src/__tests__/string-and-time-utilities.test.ts +0 -1070
  96. package/src/__tests__/string-decoupled.test.ts +0 -13
  97. package/src/__tests__/string.test.ts +0 -164
  98. package/src/__tests__/time.test.ts +0 -110
  99. package/src/collections.ts +0 -850
  100. package/src/events.ts +0 -88
  101. package/src/fs/__tests__/file-watch-system.test.ts +0 -675
  102. package/src/fs/__tests__/path-utilities.test.ts +0 -375
  103. package/src/fs/__tests__/path.test.ts +0 -287
  104. package/src/fs/fs.ts +0 -692
  105. package/src/fs/index.ts +0 -194
  106. package/src/fs/path.ts +0 -310
  107. package/src/fs/watch.ts +0 -413
  108. package/src/index.ts +0 -476
  109. package/src/materials.ts +0 -109
  110. package/src/math.ts +0 -674
  111. package/src/physics.ts +0 -141
  112. package/src/spatial.ts +0 -320
  113. package/src/string.basic.test.ts +0 -14
  114. package/src/string.test.ts +0 -335
  115. package/src/string.ts +0 -531
  116. package/src/time.ts +0 -621
  117. package/src/traits/ARTraits.ts +0 -103
  118. package/src/traits/EconomicPrimitives.ts +0 -755
  119. package/src/traits/EconomicTraits.ts +0 -552
  120. package/src/traits/IoTTraits.ts +0 -102
  121. package/src/traits/SimulationLabPrimitives.ts +0 -650
  122. package/src/traits/SimulationLabTraits.ts +0 -191
  123. package/src/traits/VRRTraits.ts +0 -326
  124. package/src/traits/__tests__/ARTraits.test.ts +0 -8
  125. package/src/traits/__tests__/EconomicPrimitives.test.ts +0 -14
  126. package/src/traits/__tests__/EconomicTraits.test.ts +0 -16
  127. package/src/types.ts +0 -418
  128. package/std_error.log +0 -5
  129. package/tsconfig.json +0 -18
  130. package/tsup.config.ts +0 -20
  131. package/vitest.config.ts +0 -10
  132. /package/dist/{chunk-PR4QN5HX.js.map → chunk-DGUM43GV.js.map} +0 -0
package/src/types.ts DELETED
@@ -1,418 +0,0 @@
1
- /**
2
- * Core Types for HoloScript
3
- *
4
- * Fundamental spatial and graphical types used throughout the language.
5
- */
6
-
7
- // =============================================================================
8
- // VECTOR TYPES
9
- // =============================================================================
10
-
11
- /**
12
- * 2D Vector
13
- */
14
- export interface Vec2 {
15
- x: number;
16
- y: number;
17
- }
18
-
19
- /**
20
- * 3D Vector - The fundamental spatial type
21
- */
22
- export interface Vec3 {
23
- x: number;
24
- y: number;
25
- z: number;
26
- }
27
-
28
- /**
29
- * 4D Vector
30
- */
31
- export interface Vec4 {
32
- x: number;
33
- y: number;
34
- z: number;
35
- w: number;
36
- }
37
-
38
- // Array representations
39
- export type Vec2Array = [number, number];
40
- export type Vec3Array = [number, number, number];
41
- export type Vec4Array = [number, number, number, number];
42
-
43
- // =============================================================================
44
- // QUATERNION
45
- // =============================================================================
46
-
47
- /**
48
- * Quaternion for rotation representation
49
- */
50
- export interface Quat {
51
- x: number;
52
- y: number;
53
- z: number;
54
- w: number;
55
- }
56
-
57
- export type QuatArray = [number, number, number, number];
58
-
59
- // =============================================================================
60
- // TRANSFORM
61
- // =============================================================================
62
-
63
- /**
64
- * Complete 3D transform
65
- */
66
- export interface Transform {
67
- position: Vec3;
68
- rotation: Quat;
69
- scale: Vec3;
70
- }
71
-
72
- /**
73
- * Euler angles (in degrees)
74
- */
75
- export interface EulerAngles {
76
- x: number; // pitch
77
- y: number; // yaw
78
- z: number; // roll
79
- }
80
-
81
- // =============================================================================
82
- // COLOR
83
- // =============================================================================
84
-
85
- /**
86
- * RGB Color (0-1 range)
87
- */
88
- export interface ColorRGB {
89
- r: number;
90
- g: number;
91
- b: number;
92
- }
93
-
94
- /**
95
- * RGBA Color (0-1 range)
96
- */
97
- export interface ColorRGBA extends ColorRGB {
98
- a: number;
99
- }
100
-
101
- /**
102
- * HSL Color
103
- */
104
- export interface ColorHSL {
105
- h: number; // 0-360
106
- s: number; // 0-1
107
- l: number; // 0-1
108
- }
109
-
110
- /**
111
- * Color can be represented multiple ways
112
- */
113
- export type Color = string | ColorRGB | ColorRGBA | ColorHSL | number;
114
-
115
- // =============================================================================
116
- // BOUNDS
117
- // =============================================================================
118
-
119
- /**
120
- * Axis-Aligned Bounding Box
121
- */
122
- export interface AABB {
123
- min: Vec3;
124
- max: Vec3;
125
- }
126
-
127
- /**
128
- * Bounding Sphere
129
- */
130
- export interface BoundingSphere {
131
- center: Vec3;
132
- radius: number;
133
- }
134
-
135
- // =============================================================================
136
- // RAY
137
- // =============================================================================
138
-
139
- /**
140
- * Ray for raycasting
141
- */
142
- export interface Ray {
143
- origin: Vec3;
144
- direction: Vec3;
145
- }
146
-
147
- /**
148
- * Raycast hit result
149
- */
150
- export interface RaycastHit {
151
- point: Vec3;
152
- normal: Vec3;
153
- distance: number;
154
- objectId?: string;
155
- }
156
-
157
- // =============================================================================
158
- // UTILITY TYPES
159
- // =============================================================================
160
-
161
- /**
162
- * Nullable type helper
163
- */
164
- export type Nullable<T> = T | null;
165
-
166
- /**
167
- * Optional type helper
168
- */
169
- export type Optional<T> = T | undefined;
170
-
171
- /**
172
- * Deep partial type
173
- */
174
- export type DeepPartial<T> = {
175
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
176
- };
177
-
178
- // =============================================================================
179
- // FACTORY FUNCTIONS
180
- // =============================================================================
181
-
182
- /**
183
- * Create a Vec2
184
- */
185
- export function vec2(x: number = 0, y: number = 0): Vec2 {
186
- const v = [x, y] as unknown as Vec2;
187
- Object.defineProperty(v, 'x', { value: x, writable: true, enumerable: false, configurable: true });
188
- Object.defineProperty(v, 'y', { value: y, writable: true, enumerable: false, configurable: true });
189
- return v;
190
- }
191
-
192
- /**
193
- * Create a Vec3
194
- */
195
- export function vec3(x: number = 0, y: number = 0, z: number = 0): Vec3 {
196
- const v = [x, y, z] as unknown as Vec3;
197
- Object.defineProperty(v, 'x', { value: x, writable: true, enumerable: false, configurable: true });
198
- Object.defineProperty(v, 'y', { value: y, writable: true, enumerable: false, configurable: true });
199
- Object.defineProperty(v, 'z', { value: z, writable: true, enumerable: false, configurable: true });
200
- return v;
201
- }
202
-
203
- /**
204
- * Create a Vec4
205
- */
206
- export function vec4(x: number = 0, y: number = 0, z: number = 0, w: number = 0): Vec4 {
207
- return { x, y, z, w };
208
- }
209
-
210
- /**
211
- * Create a Quaternion (identity by default)
212
- */
213
- export function quat(x: number = 0, y: number = 0, z: number = 0, w: number = 1): Quat {
214
- return { x, y, z, w };
215
- }
216
-
217
- /**
218
- * Create a Transform
219
- */
220
- export function transform(
221
- position: Vec3 = vec3(),
222
- rotation: Quat = quat(),
223
- scale: Vec3 = vec3(1, 1, 1)
224
- ): Transform {
225
- return { position, rotation, scale };
226
- }
227
-
228
- /**
229
- * Create an RGB color
230
- */
231
- export function rgb(r: number, g: number, b: number): ColorRGB {
232
- return { r, g, b };
233
- }
234
-
235
- /**
236
- * Create an RGBA color
237
- */
238
- export function rgba(r: number, g: number, b: number, a: number = 1): ColorRGBA {
239
- return { r, g, b, a };
240
- }
241
-
242
- /**
243
- * Create an HSL color
244
- */
245
- export function hsl(h: number, s: number, l: number): ColorHSL {
246
- return { h, s, l };
247
- }
248
-
249
- /**
250
- * Create an AABB
251
- */
252
- export function aabb(min: Vec3 = vec3(), max: Vec3 = vec3()): AABB {
253
- return { min, max };
254
- }
255
-
256
- /**
257
- * Create a Ray
258
- */
259
- export function ray(origin: Vec3, direction: Vec3): Ray {
260
- return { origin, direction };
261
- }
262
-
263
- // =============================================================================
264
- // CONVERSION UTILITIES
265
- // =============================================================================
266
-
267
- /**
268
- * Convert Vec3 to array
269
- */
270
- export function vec3ToArray(v: Vec3): Vec3Array {
271
- return [v.x, v.y, v.z];
272
- }
273
-
274
- /**
275
- * Convert array to Vec3
276
- */
277
- export function arrayToVec3(arr: Vec3Array | number[]): Vec3 {
278
- return vec3(arr[0] || 0, arr[1] || 0, arr[2] || 0);
279
- }
280
-
281
- /**
282
- * Convert Quat to array
283
- */
284
- export function quatToArray(q: Quat): QuatArray {
285
- return [q.x, q.y, q.z, q.w];
286
- }
287
-
288
- /**
289
- * Convert array to Quat
290
- */
291
- export function arrayToQuat(arr: QuatArray | number[]): Quat {
292
- return { x: arr[0] || 0, y: arr[1] || 0, z: arr[2] || 0, w: arr[3] ?? 1 };
293
- }
294
-
295
- /**
296
- * Parse color from various formats
297
- */
298
- export function parseColor(color: Color): ColorRGBA {
299
- if (typeof color === 'string') {
300
- // Hex color
301
- if (color.startsWith('#')) {
302
- const hex = color.slice(1);
303
- if (hex.length === 3) {
304
- return {
305
- r: parseInt(hex[0] + hex[0], 16) / 255,
306
- g: parseInt(hex[1] + hex[1], 16) / 255,
307
- b: parseInt(hex[2] + hex[2], 16) / 255,
308
- a: 1,
309
- };
310
- } else if (hex.length === 6) {
311
- return {
312
- r: parseInt(hex.slice(0, 2), 16) / 255,
313
- g: parseInt(hex.slice(2, 4), 16) / 255,
314
- b: parseInt(hex.slice(4, 6), 16) / 255,
315
- a: 1,
316
- };
317
- } else if (hex.length === 8) {
318
- return {
319
- r: parseInt(hex.slice(0, 2), 16) / 255,
320
- g: parseInt(hex.slice(2, 4), 16) / 255,
321
- b: parseInt(hex.slice(4, 6), 16) / 255,
322
- a: parseInt(hex.slice(6, 8), 16) / 255,
323
- };
324
- }
325
- }
326
- // Named colors (basic support)
327
- const namedColors: Record<string, ColorRGBA> = {
328
- white: { r: 1, g: 1, b: 1, a: 1 },
329
- black: { r: 0, g: 0, b: 0, a: 1 },
330
- red: { r: 1, g: 0, b: 0, a: 1 },
331
- green: { r: 0, g: 1, b: 0, a: 1 },
332
- blue: { r: 0, g: 0, b: 1, a: 1 },
333
- yellow: { r: 1, g: 1, b: 0, a: 1 },
334
- cyan: { r: 0, g: 1, b: 1, a: 1 },
335
- magenta: { r: 1, g: 0, b: 1, a: 1 },
336
- };
337
- return namedColors[color.toLowerCase()] || { r: 1, g: 1, b: 1, a: 1 };
338
- }
339
-
340
- if (typeof color === 'number') {
341
- // Integer color (0xRRGGBB)
342
- return {
343
- r: ((color >> 16) & 0xff) / 255,
344
- g: ((color >> 8) & 0xff) / 255,
345
- b: (color & 0xff) / 255,
346
- a: 1,
347
- };
348
- }
349
-
350
- if ('h' in color) {
351
- // HSL to RGB conversion
352
- const { h, s, l } = color;
353
- const c = (1 - Math.abs(2 * l - 1)) * s;
354
- const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
355
- const m = l - c / 2;
356
- let r = 0,
357
- g = 0,
358
- b = 0;
359
-
360
- if (h < 60) {
361
- r = c;
362
- g = x;
363
- } else if (h < 120) {
364
- r = x;
365
- g = c;
366
- } else if (h < 180) {
367
- g = c;
368
- b = x;
369
- } else if (h < 240) {
370
- g = x;
371
- b = c;
372
- } else if (h < 300) {
373
- r = x;
374
- b = c;
375
- } else {
376
- r = c;
377
- b = x;
378
- }
379
-
380
- return { r: r + m, g: g + m, b: b + m, a: 1 };
381
- }
382
-
383
- if ('a' in color) {
384
- return color;
385
- }
386
-
387
- return { ...color, a: 1 };
388
- }
389
-
390
- /**
391
- * Color to hex string
392
- */
393
- export function colorToHex(color: ColorRGB | ColorRGBA): string {
394
- const r = Math.round(color.r * 255)
395
- .toString(16)
396
- .padStart(2, '0');
397
- const g = Math.round(color.g * 255)
398
- .toString(16)
399
- .padStart(2, '0');
400
- const b = Math.round(color.b * 255)
401
- .toString(16)
402
- .padStart(2, '0');
403
- return `#${r}${g}${b}`;
404
- }
405
-
406
- // =============================================================================
407
- // TRAIT DEFINITIONS
408
- // =============================================================================
409
-
410
- export interface TraitDefinition {
411
- name: string;
412
- description?: string;
413
- type?: string;
414
- params?: Record<string, any>;
415
- parameters?: Record<string, any>;
416
- validator?: (params: Record<string, any>) => boolean;
417
- validation?: any;
418
- }
package/std_error.log DELETED
@@ -1,5 +0,0 @@
1
- npm warn Unknown project config "shamefully-hoist". This will stop working in the next major version of npm.
2
- npm warn Unknown project config "strict-peer-dependencies". This will stop working in the next major version of npm.
3
- src/__tests__/SimulationLabPrimitives.test.ts(345,12): error TS18048: 'trait.params' is possibly 'undefined'.
4
- src/__tests__/SimulationLabPrimitives.test.ts(346,12): error TS18048: 'trait.params' is possibly 'undefined'.
5
- src/physics.ts(11,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './spatial.js'?
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "lib": ["ES2022", "DOM"],
7
- "outDir": "./dist",
8
- "rootDir": "./src",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true
15
- },
16
- "include": ["src/**/*"],
17
- "exclude": ["node_modules", "dist"]
18
- }
package/tsup.config.ts DELETED
@@ -1,20 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig({
4
- entry: [
5
- 'src/index.ts',
6
- 'src/math.ts',
7
- 'src/collections.ts',
8
- 'src/string.ts',
9
- 'src/time.ts',
10
- 'src/traits/EconomicPrimitives.ts',
11
- 'src/traits/EconomicTraits.ts',
12
- // Merged from @holoscript/fs (2026-04-29) — exposed via the ./fs subpath.
13
- 'src/fs/index.ts',
14
- ],
15
- format: ['esm', 'cjs'],
16
- dts: false,
17
- clean: true,
18
- sourcemap: true,
19
- external: ['chokidar', 'glob'],
20
- });
package/vitest.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- include: ['src/**/*.test.ts'],
8
- exclude: ['**/dist/**', '**/node_modules/**'],
9
- },
10
- });