@holoscript/core 2.0.0 → 2.0.2

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-3N67RLQP.cjs +1298 -0
  3. package/dist/chunk-3N67RLQP.cjs.map +1 -0
  4. package/dist/chunk-3X2EGU7Z.cjs +52 -0
  5. package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
  6. package/dist/chunk-4CV4JOE5.js +24 -0
  7. package/dist/chunk-4CV4JOE5.js.map +1 -0
  8. package/dist/chunk-4OHVW4XR.cjs +1027 -0
  9. package/dist/chunk-4OHVW4XR.cjs.map +1 -0
  10. package/dist/chunk-CZLDE2OZ.cjs +28 -0
  11. package/dist/chunk-CZLDE2OZ.cjs.map +1 -0
  12. package/{src/HoloScriptRuntime.ts → dist/chunk-EU6CZMGJ.js} +437 -794
  13. package/dist/chunk-EU6CZMGJ.js.map +1 -0
  14. package/dist/chunk-KWYIVRIH.js +344 -0
  15. package/dist/chunk-KWYIVRIH.js.map +1 -0
  16. package/dist/chunk-MCP6D4LT.js +1025 -0
  17. package/dist/chunk-MCP6D4LT.js.map +1 -0
  18. package/dist/chunk-SATNCODL.js +45 -0
  19. package/dist/chunk-SATNCODL.js.map +1 -0
  20. package/dist/chunk-VMZN4EVR.cjs +347 -0
  21. package/dist/chunk-VMZN4EVR.cjs.map +1 -0
  22. package/{src/HoloScriptDebugger.ts → dist/chunk-VYIDLUCV.js} +118 -257
  23. package/dist/chunk-VYIDLUCV.js.map +1 -0
  24. package/dist/chunk-WFI4T3XB.cjs +424 -0
  25. package/dist/chunk-WFI4T3XB.cjs.map +1 -0
  26. package/dist/debugger.cjs +20 -0
  27. package/dist/debugger.cjs.map +1 -0
  28. package/dist/debugger.d.cts +171 -0
  29. package/dist/debugger.d.ts +171 -0
  30. package/dist/debugger.js +7 -0
  31. package/dist/debugger.js.map +1 -0
  32. package/dist/index.cjs +6006 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +2482 -0
  35. package/dist/index.d.ts +2482 -0
  36. package/dist/index.js +5926 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/parser.cjs +14 -0
  39. package/dist/parser.cjs.map +1 -0
  40. package/dist/parser.d.cts +139 -0
  41. package/dist/parser.d.ts +139 -0
  42. package/dist/parser.js +5 -0
  43. package/dist/parser.js.map +1 -0
  44. package/dist/runtime.cjs +14 -0
  45. package/dist/runtime.cjs.map +1 -0
  46. package/dist/runtime.d.cts +180 -0
  47. package/dist/runtime.d.ts +180 -0
  48. package/dist/runtime.js +5 -0
  49. package/dist/runtime.js.map +1 -0
  50. package/dist/type-checker.cjs +17 -0
  51. package/dist/type-checker.cjs.map +1 -0
  52. package/dist/type-checker.d.cts +105 -0
  53. package/dist/type-checker.d.ts +105 -0
  54. package/dist/type-checker.js +4 -0
  55. package/dist/type-checker.js.map +1 -0
  56. package/dist/types-D6g4ACjP.d.cts +262 -0
  57. package/dist/types-D6g4ACjP.d.ts +262 -0
  58. package/package.json +11 -8
  59. package/src/HoloScript2DParser.js +0 -227
  60. package/src/HoloScript2DParser.ts +0 -261
  61. package/src/HoloScriptCodeParser.js +0 -1102
  62. package/src/HoloScriptCodeParser.ts +0 -1188
  63. package/src/HoloScriptDebugger.js +0 -458
  64. package/src/HoloScriptParser.js +0 -338
  65. package/src/HoloScriptParser.ts +0 -397
  66. package/src/HoloScriptPlusParser.js +0 -371
  67. package/src/HoloScriptPlusParser.ts +0 -543
  68. package/src/HoloScriptRuntime.js +0 -1399
  69. package/src/HoloScriptRuntime.test.js +0 -351
  70. package/src/HoloScriptRuntime.test.ts +0 -436
  71. package/src/HoloScriptTypeChecker.js +0 -356
  72. package/src/HoloScriptTypeChecker.ts +0 -475
  73. package/src/__tests__/GraphicsServices.test.js +0 -357
  74. package/src/__tests__/GraphicsServices.test.ts +0 -427
  75. package/src/__tests__/HoloScriptPlusParser.test.js +0 -317
  76. package/src/__tests__/HoloScriptPlusParser.test.ts +0 -392
  77. package/src/__tests__/integration.test.js +0 -336
  78. package/src/__tests__/integration.test.ts +0 -416
  79. package/src/__tests__/performance.bench.js +0 -218
  80. package/src/__tests__/performance.bench.ts +0 -262
  81. package/src/__tests__/type-checker.test.js +0 -60
  82. package/src/__tests__/type-checker.test.ts +0 -73
  83. package/src/index.js +0 -217
  84. package/src/index.ts +0 -426
  85. package/src/interop/Interoperability.js +0 -413
  86. package/src/interop/Interoperability.ts +0 -494
  87. package/src/logger.js +0 -42
  88. package/src/logger.ts +0 -57
  89. package/src/parser/EnhancedParser.js +0 -205
  90. package/src/parser/EnhancedParser.ts +0 -251
  91. package/src/parser/HoloScriptPlusParser.js +0 -928
  92. package/src/parser/HoloScriptPlusParser.ts +0 -1089
  93. package/src/runtime/HoloScriptPlusRuntime.js +0 -674
  94. package/src/runtime/HoloScriptPlusRuntime.ts +0 -861
  95. package/src/runtime/PerformanceTelemetry.js +0 -323
  96. package/src/runtime/PerformanceTelemetry.ts +0 -467
  97. package/src/runtime/RuntimeOptimization.js +0 -361
  98. package/src/runtime/RuntimeOptimization.ts +0 -416
  99. package/src/services/HololandGraphicsPipelineService.js +0 -506
  100. package/src/services/HololandGraphicsPipelineService.ts +0 -662
  101. package/src/services/PlatformPerformanceOptimizer.js +0 -356
  102. package/src/services/PlatformPerformanceOptimizer.ts +0 -503
  103. package/src/state/ReactiveState.js +0 -427
  104. package/src/state/ReactiveState.ts +0 -572
  105. package/src/tools/DeveloperExperience.js +0 -376
  106. package/src/tools/DeveloperExperience.ts +0 -438
  107. package/src/traits/AIDriverTrait.js +0 -322
  108. package/src/traits/AIDriverTrait.test.js +0 -329
  109. package/src/traits/AIDriverTrait.test.ts +0 -357
  110. package/src/traits/AIDriverTrait.ts +0 -474
  111. package/src/traits/LightingTrait.js +0 -313
  112. package/src/traits/LightingTrait.test.js +0 -410
  113. package/src/traits/LightingTrait.test.ts +0 -462
  114. package/src/traits/LightingTrait.ts +0 -505
  115. package/src/traits/MaterialTrait.js +0 -194
  116. package/src/traits/MaterialTrait.test.js +0 -286
  117. package/src/traits/MaterialTrait.test.ts +0 -329
  118. package/src/traits/MaterialTrait.ts +0 -324
  119. package/src/traits/RenderingTrait.js +0 -356
  120. package/src/traits/RenderingTrait.test.js +0 -363
  121. package/src/traits/RenderingTrait.test.ts +0 -427
  122. package/src/traits/RenderingTrait.ts +0 -555
  123. package/src/traits/VRTraitSystem.js +0 -740
  124. package/src/traits/VRTraitSystem.ts +0 -1040
  125. package/src/traits/VoiceInputTrait.js +0 -284
  126. package/src/traits/VoiceInputTrait.test.js +0 -226
  127. package/src/traits/VoiceInputTrait.test.ts +0 -252
  128. package/src/traits/VoiceInputTrait.ts +0 -401
  129. package/src/types/AdvancedTypeSystem.js +0 -226
  130. package/src/types/AdvancedTypeSystem.ts +0 -494
  131. package/src/types/HoloScriptPlus.d.ts +0 -853
  132. package/src/types.js +0 -6
  133. package/src/types.ts +0 -369
  134. package/tsconfig.json +0 -23
  135. package/tsup.config.d.ts +0 -2
  136. package/tsup.config.js +0 -18
  137. package/tsup.config.ts +0 -19
@@ -1,313 +0,0 @@
1
- /**
2
- * @holoscript/core Lighting Trait
3
- *
4
- * Enables dynamic lighting with support for multiple light types,
5
- * shadows, and global illumination
6
- */
7
- /**
8
- * LightingTrait - Manages dynamic lighting and illumination
9
- */
10
- export class LightingTrait {
11
- constructor(config) {
12
- this.lights = new Map();
13
- this.lightIdCounter = 0;
14
- this.globalIllumination = {
15
- enabled: true,
16
- intensity: 1.0,
17
- skyColor: { r: 0.5, g: 0.7, b: 1.0 },
18
- skyIntensity: 1.0,
19
- groundColor: { r: 0.4, g: 0.4, b: 0.4 },
20
- groundIntensity: 0.5,
21
- probes: true,
22
- indirectDiffuse: 1.0,
23
- indirectSpecular: 1.0,
24
- aoIntensity: 1.0,
25
- screenSpaceAO: true,
26
- ...config,
27
- };
28
- }
29
- /**
30
- * Add a light to the scene
31
- */
32
- addLight(light) {
33
- const id = light.name || `light_${this.lightIdCounter++}`;
34
- this.lights.set(id, light);
35
- return id;
36
- }
37
- /**
38
- * Get light by ID
39
- */
40
- getLight(id) {
41
- return this.lights.get(id);
42
- }
43
- /**
44
- * Get all lights
45
- */
46
- getLights() {
47
- return Array.from(this.lights.values());
48
- }
49
- /**
50
- * Get lights by type
51
- */
52
- getLightsByType(type) {
53
- return Array.from(this.lights.values()).filter(l => l.type === type);
54
- }
55
- /**
56
- * Update light properties
57
- */
58
- updateLight(id, updates) {
59
- const light = this.lights.get(id);
60
- if (!light)
61
- return false;
62
- this.lights.set(id, { ...light, ...updates });
63
- return true;
64
- }
65
- /**
66
- * Remove light
67
- */
68
- removeLight(id) {
69
- return this.lights.delete(id);
70
- }
71
- /**
72
- * Clear all lights
73
- */
74
- clearLights() {
75
- this.lights.clear();
76
- }
77
- /**
78
- * Get global illumination config
79
- */
80
- getGlobalIllumination() {
81
- return { ...this.globalIllumination };
82
- }
83
- /**
84
- * Update global illumination
85
- */
86
- updateGlobalIllumination(updates) {
87
- this.globalIllumination = {
88
- ...this.globalIllumination,
89
- ...updates,
90
- };
91
- }
92
- /**
93
- * Enable/disable GI
94
- */
95
- setGIEnabled(enabled) {
96
- this.globalIllumination.enabled = enabled;
97
- }
98
- /**
99
- * Set ambient light colors (skybox mode)
100
- */
101
- setAmbientLight(skyColor, groundColor, intensity = 1.0) {
102
- this.globalIllumination.skyColor = skyColor;
103
- this.globalIllumination.groundColor = groundColor;
104
- this.globalIllumination.skyIntensity = intensity;
105
- this.globalIllumination.groundIntensity = intensity * 0.5;
106
- }
107
- /**
108
- * Enable/disable screen-space ambient occlusion
109
- */
110
- setScreenSpaceAO(enabled, intensity = 1.0) {
111
- this.globalIllumination.screenSpaceAO = enabled;
112
- this.globalIllumination.aoIntensity = intensity;
113
- }
114
- /**
115
- * Create directional light (sun)
116
- */
117
- createDirectionalLight(direction, color, intensity = 1.0, castShadows = true) {
118
- const light = {
119
- type: 'directional',
120
- name: `sun_${this.lightIdCounter}`,
121
- direction,
122
- color,
123
- intensity,
124
- shadow: castShadows
125
- ? {
126
- type: 'soft',
127
- resolution: 2048,
128
- cascades: 4,
129
- softness: 1.0,
130
- }
131
- : undefined,
132
- volumetric: true,
133
- priority: 100,
134
- };
135
- return this.addLight(light);
136
- }
137
- /**
138
- * Create point light
139
- */
140
- createPointLight(position, color, intensity, range, castShadows = false) {
141
- const light = {
142
- type: 'point',
143
- name: `point_${this.lightIdCounter}`,
144
- position,
145
- color,
146
- intensity,
147
- range,
148
- shadow: castShadows
149
- ? {
150
- type: 'soft',
151
- resolution: 512,
152
- softness: 0.5,
153
- }
154
- : undefined,
155
- priority: 50,
156
- };
157
- return this.addLight(light);
158
- }
159
- /**
160
- * Create spot light
161
- */
162
- createSpotLight(position, direction, color, intensity, range, spotAngle = 45, castShadows = true) {
163
- const light = {
164
- type: 'spot',
165
- name: `spot_${this.lightIdCounter}`,
166
- position,
167
- direction,
168
- color,
169
- intensity,
170
- range,
171
- spotAngle,
172
- innerSpotAngle: spotAngle * 0.5,
173
- shadow: castShadows
174
- ? {
175
- type: 'soft',
176
- resolution: 1024,
177
- softness: 0.8,
178
- }
179
- : undefined,
180
- priority: 75,
181
- };
182
- return this.addLight(light);
183
- }
184
- /**
185
- * Create area light for soft lighting
186
- */
187
- createAreaLight(position, color, intensity, width, height) {
188
- const light = {
189
- type: 'area',
190
- name: `area_${this.lightIdCounter}`,
191
- position,
192
- color,
193
- intensity,
194
- range: Math.max(width, height) * 2,
195
- priority: 25,
196
- };
197
- return this.addLight(light);
198
- }
199
- /**
200
- * Get shadow-casting lights
201
- */
202
- getShadowCastingLights() {
203
- return Array.from(this.lights.values()).filter(l => l.shadow && l.shadow.type !== 'none');
204
- }
205
- /**
206
- * Get light count by type
207
- */
208
- getLightCount() {
209
- const counts = {
210
- directional: 0,
211
- point: 0,
212
- spot: 0,
213
- area: 0,
214
- probe: 0,
215
- };
216
- for (const light of this.lights.values()) {
217
- counts[light.type]++;
218
- }
219
- return counts;
220
- }
221
- /**
222
- * Estimate light impact for performance optimization
223
- */
224
- getPerformanceImpact() {
225
- const totalLights = this.lights.size;
226
- const shadowCasters = this.getShadowCastingLights().length;
227
- let estimatedGPUCost = 'low';
228
- if (totalLights > 16 || shadowCasters > 4) {
229
- estimatedGPUCost = 'high';
230
- }
231
- else if (totalLights > 8 || shadowCasters > 2) {
232
- estimatedGPUCost = 'medium';
233
- }
234
- return {
235
- totalLights,
236
- shadowCasters,
237
- estimatedGPUCost,
238
- };
239
- }
240
- /**
241
- * Get scene complexity info
242
- */
243
- getSceneInfo() {
244
- const counts = this.getLightCount();
245
- const impact = this.getPerformanceImpact();
246
- return `Lighting: ${counts.directional} dir, ${counts.point} point, ${counts.spot} spot | ` +
247
- `Shadows: ${impact.shadowCasters} | GPU: ${impact.estimatedGPUCost}`;
248
- }
249
- /**
250
- * Dispose and cleanup
251
- */
252
- dispose() {
253
- this.lights.clear();
254
- }
255
- }
256
- /**
257
- * HoloScript+ @lighting trait factory
258
- */
259
- export function createLightingTrait(config) {
260
- return new LightingTrait(config);
261
- }
262
- /**
263
- * Preset lighting configurations
264
- */
265
- export const LIGHTING_PRESETS = {
266
- /** Neutral studio lighting */
267
- studio: () => ({
268
- enabled: true,
269
- intensity: 1.0,
270
- skyColor: { r: 0.5, g: 0.5, b: 0.5 },
271
- skyIntensity: 0.5,
272
- groundColor: { r: 0.3, g: 0.3, b: 0.3 },
273
- groundIntensity: 0.3,
274
- }),
275
- /** Bright outdoor lighting */
276
- outdoor: () => ({
277
- enabled: true,
278
- intensity: 1.2,
279
- skyColor: { r: 0.7, g: 0.85, b: 1.0 },
280
- skyIntensity: 1.0,
281
- groundColor: { r: 0.4, g: 0.4, b: 0.35 },
282
- groundIntensity: 0.6,
283
- indirectDiffuse: 1.2,
284
- }),
285
- /** Dim interior lighting */
286
- interior: () => ({
287
- enabled: true,
288
- intensity: 0.6,
289
- skyColor: { r: 0.3, g: 0.3, b: 0.35 },
290
- skyIntensity: 0.4,
291
- groundColor: { r: 0.2, g: 0.2, b: 0.2 },
292
- groundIntensity: 0.2,
293
- }),
294
- /** Night scene */
295
- night: () => ({
296
- enabled: true,
297
- intensity: 0.3,
298
- skyColor: { r: 0.01, g: 0.01, b: 0.02 },
299
- skyIntensity: 0.1,
300
- groundColor: { r: 0.02, g: 0.02, b: 0.02 },
301
- groundIntensity: 0.05,
302
- screenSpaceAO: false,
303
- }),
304
- /** Sunset/golden hour */
305
- sunset: () => ({
306
- enabled: true,
307
- intensity: 1.1,
308
- skyColor: { r: 1.0, g: 0.7, b: 0.3 },
309
- skyIntensity: 1.0,
310
- groundColor: { r: 0.6, g: 0.4, b: 0.2 },
311
- groundIntensity: 0.8,
312
- }),
313
- };