@holoscript/core 2.0.1 → 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
package/src/index.ts DELETED
@@ -1,426 +0,0 @@
1
- /**
2
- * @holoscript/core
3
- *
4
- * HoloScript+ - VR language with declarative syntax, state management, and VR interactions.
5
- * Enhanced version of HoloScript with:
6
- * - VR interaction traits (@grabbable, @throwable, @hoverable, etc.)
7
- * - Reactive state management (@state { ... })
8
- * - Control flow (@for, @if directives)
9
- * - TypeScript companion imports
10
- * - Expression interpolation ${...}
11
- *
12
- * Fully backward compatible with original HoloScript syntax.
13
- *
14
- * @example
15
- * ```typescript
16
- * import { HoloScriptPlusParser, HoloScriptPlusRuntime } from '@holoscript/core';
17
- *
18
- * const parser = new HoloScriptPlusParser();
19
- * const result = parser.parse(`
20
- * orb#myOrb {
21
- * position: [0, 0, 0]
22
- * @grabbable(snap_to_hand: true)
23
- * @throwable(bounce: true)
24
- * }
25
- * `);
26
- *
27
- * const runtime = new HoloScriptPlusRuntime(result.ast);
28
- * await runtime.mount(document.body);
29
- * ```
30
- *
31
- * @packageDocumentation
32
- */
33
-
34
- // Import for use in utility functions
35
- import { HoloScriptParser } from './HoloScriptParser';
36
- import { HoloScriptRuntime } from './HoloScriptRuntime';
37
-
38
- // Parser
39
- export { HoloScriptParser } from './HoloScriptParser';
40
- export { HoloScript2DParser } from './HoloScript2DParser';
41
- export { HoloScriptCodeParser, type ParseResult, type ParseError } from './HoloScriptCodeParser';
42
-
43
- // HoloScript+ Parser (NEW)
44
- export { HoloScriptPlusParser, createParser, parse as parseHoloScriptPlus } from './parser/HoloScriptPlusParser';
45
-
46
- // HoloScript+ Enhanced Parser with Trait Annotations (NEW - Phase 3)
47
- export {
48
- HoloScriptPlusParser as HoloScriptTraitAnnotationParser,
49
- type MaterialTraitAnnotation,
50
- type LightingTraitAnnotation,
51
- type RenderingTraitAnnotation,
52
- type GraphicsConfiguration,
53
- } from './HoloScriptPlusParser';
54
-
55
- // Runtime
56
- export { HoloScriptRuntime } from './HoloScriptRuntime';
57
-
58
- // HoloScript+ Runtime (NEW)
59
- export { HoloScriptPlusRuntimeImpl } from './runtime/HoloScriptPlusRuntime';
60
-
61
- // HoloScript+ State Management (NEW)
62
- export { ReactiveState, createState, reactive, effect, computed, bind } from './state/ReactiveState';
63
-
64
- // HoloScript+ VR Traits (NEW)
65
- export { VRTraitRegistry } from './traits/VRTraitSystem';
66
-
67
- // HoloScript+ Voice Input Trait (NEW - Phase 1)
68
- export {
69
- VoiceInputTrait,
70
- createVoiceInputTrait,
71
- type VoiceInputConfig,
72
- type VoiceInputMode,
73
- type VoiceRecognitionResult,
74
- type VoiceInputEvent,
75
- } from './traits/VoiceInputTrait';
76
-
77
- // HoloScript+ AI Driver NPC Trait (NEW - Phase 1)
78
- export {
79
- AIDriverTrait,
80
- createAIDriverTrait,
81
- BehaviorTreeRunner,
82
- GOAPPlanner,
83
- type AIDriverConfig,
84
- type DecisionMode,
85
- type BehaviorNode,
86
- type NPCContext,
87
- type NPCGoal,
88
- type BehaviorState,
89
- } from './traits/AIDriverTrait';
90
-
91
- // HoloScript+ Material Trait (NEW - Phase 2: Graphics)
92
- export {
93
- MaterialTrait,
94
- createMaterialTrait,
95
- MATERIAL_PRESETS,
96
- type MaterialType,
97
- type TextureChannel,
98
- type TextureMap,
99
- type PBRMaterial,
100
- type MaterialConfig,
101
- } from './traits/MaterialTrait';
102
-
103
- // HoloScript+ Lighting Trait (NEW - Phase 2: Graphics)
104
- export {
105
- LightingTrait,
106
- createLightingTrait,
107
- LIGHTING_PRESETS,
108
- type LightType,
109
- type ShadowType,
110
- type ShadowConfig,
111
- type LightSource,
112
- type GlobalIlluminationConfig,
113
- } from './traits/LightingTrait';
114
-
115
- // HoloScript+ Rendering Trait (NEW - Phase 2: Graphics)
116
- export {
117
- RenderingTrait,
118
- createRenderingTrait,
119
- type CullingMode,
120
- type LodStrategy,
121
- type GPUResourceTier,
122
- type LODLevel,
123
- type CullingConfig,
124
- type BatchingConfig,
125
- type TextureOptimization,
126
- type ShaderOptimization,
127
- type RenderingOptimization,
128
- } from './traits/RenderingTrait';
129
-
130
- // Performance Telemetry (NEW - Phase 1)
131
- export {
132
- PerformanceTelemetry,
133
- getPerformanceTelemetry,
134
- type Metric,
135
- type MetricType,
136
- type SeverityLevel,
137
- type PerformanceBudget,
138
- type FrameTiming,
139
- type MemorySnapshot,
140
- type AnalyticsExporter,
141
- } from './runtime/PerformanceTelemetry';
142
-
143
- // Hololand Graphics Pipeline Service (NEW - Phase 4)
144
- export {
145
- HololandGraphicsPipelineService,
146
- type MaterialAsset,
147
- type TextureAsset,
148
- type ShaderProgram,
149
- type PlatformConfig,
150
- type GPUMemoryEstimate,
151
- type PerformanceMetrics,
152
- } from './services/HololandGraphicsPipelineService';
153
-
154
- // Platform Performance Optimizer (NEW - Phase 5)
155
- export {
156
- PlatformPerformanceOptimizer,
157
- type DeviceInfo,
158
- type PerformanceProfile,
159
- type AdaptiveQualitySettings,
160
- type BenchmarkResult,
161
- type DeviceCapabilities,
162
- type CompressionFormat,
163
- type PerformanceRecommendation,
164
- } from './services/PlatformPerformanceOptimizer';
165
-
166
- // Type Checker
167
- export {
168
- HoloScriptTypeChecker,
169
- createTypeChecker,
170
- type TypeCheckResult,
171
- type TypeInfo,
172
- type TypeDiagnostic,
173
- } from './HoloScriptTypeChecker';
174
-
175
- // Debugger
176
- export {
177
- HoloScriptDebugger,
178
- createDebugger,
179
- type Breakpoint,
180
- type StackFrame,
181
- type DebugState,
182
- type DebugEvent,
183
- type StepMode,
184
- } from './HoloScriptDebugger';
185
-
186
- // Logger
187
- export {
188
- logger,
189
- setHoloScriptLogger,
190
- enableConsoleLogging,
191
- resetLogger,
192
- NoOpLogger,
193
- ConsoleLogger,
194
- type HoloScriptLogger,
195
- } from './logger';
196
-
197
- // Types
198
- export type {
199
- // Spatial
200
- SpatialPosition,
201
- Position2D,
202
- Size2D,
203
-
204
- // Hologram
205
- HologramShape,
206
- HologramProperties,
207
-
208
- // Input
209
- VoiceCommand,
210
- GestureType,
211
- HandType,
212
- GestureData,
213
-
214
- // AST Nodes
215
- ASTNode,
216
- OrbNode,
217
- MethodNode,
218
- ParameterNode,
219
- ConnectionNode,
220
- GateNode,
221
- StreamNode,
222
- TransformationNode,
223
- GenericASTNode,
224
-
225
- // VR Types
226
- Vector3,
227
- Vector2,
228
- Color,
229
- Duration,
230
- Transform,
231
- VRHand,
232
- ThrowVelocity,
233
- CollisionEvent,
234
-
235
- // VR Traits
236
- GrabbableTrait,
237
- ThrowableTrait,
238
- PointableTrait,
239
- HoverableTrait,
240
- ScalableTrait,
241
- RotatableTrait,
242
-
243
- // Phase 2: Loop Nodes
244
- ForLoopNode,
245
- WhileLoopNode,
246
- ForEachLoopNode,
247
-
248
- // Phase 2: Module Nodes
249
- ImportNode,
250
- ExportNode,
251
- ImportLoader,
252
-
253
- // Phase 2: Variable Nodes
254
- VariableDeclarationNode,
255
-
256
- // 2D UI
257
- UIElementType,
258
- UI2DNode,
259
- UIStyle,
260
-
261
- // Runtime
262
- RuntimeContext,
263
- ExecutionResult,
264
- ParticleSystem,
265
-
266
- // Config
267
- SecurityConfig,
268
- RuntimeSecurityLimits,
269
- } from './types';
270
-
271
- // Version
272
- export const HOLOSCRIPT_VERSION = '1.0.0-alpha.1';
273
-
274
- // Supported Platforms
275
- export const HOLOSCRIPT_SUPPORTED_PLATFORMS = [
276
- 'WebXR',
277
- 'Oculus Quest',
278
- 'HTC Vive',
279
- 'Valve Index',
280
- 'Apple Vision Pro',
281
- 'Windows Mixed Reality',
282
- ] as const;
283
-
284
- // Voice Commands Reference
285
- export const HOLOSCRIPT_VOICE_COMMANDS = [
286
- // 3D VR Commands
287
- 'create orb [name]',
288
- 'summon function [name]',
289
- 'connect [from] to [to]',
290
- 'execute [function]',
291
- 'debug program',
292
- 'visualize [data]',
293
- 'gate [condition]',
294
- 'stream [source] through [transformations]',
295
- // 2D UI Commands
296
- 'create button [name]',
297
- 'add textinput [name]',
298
- 'create panel [name]',
299
- 'add slider [name]',
300
- ] as const;
301
-
302
- // Gesture Reference
303
- export const HOLOSCRIPT_GESTURES = [
304
- 'pinch - create object',
305
- 'swipe - connect objects',
306
- 'rotate - modify properties',
307
- 'grab - select object',
308
- 'spread - expand view',
309
- 'fist - execute action',
310
- ] as const;
311
-
312
- // Demo Scripts
313
- export const HOLOSCRIPT_DEMO_SCRIPTS = {
314
- helloWorld: `orb greeting {
315
- message: "Hello, HoloScript World!"
316
- color: "#00ffff"
317
- glow: true
318
- }
319
-
320
- function displayGreeting() {
321
- show greeting
322
- }`,
323
-
324
- aiAgent: `orb agentCore {
325
- personality: "helpful"
326
- capabilities: ["conversation", "problem_solving", "learning"]
327
- energy: 100
328
- }
329
-
330
- function processQuery(query: string): string {
331
- analyze query
332
- generate response
333
- return response
334
- }`,
335
-
336
- neuralNetwork: `orb inputLayer { neurons: 784 }
337
- orb hiddenLayer { neurons: 128 }
338
- orb outputLayer { neurons: 10 }
339
-
340
- connect inputLayer to hiddenLayer as "weights"
341
- connect hiddenLayer to outputLayer as "weights"
342
-
343
- function trainNetwork(data: array): object {
344
- forward_pass data
345
- calculate_loss
346
- backward_pass
347
- update_weights
348
- return metrics
349
- }`,
350
-
351
- loginForm: `button loginBtn {
352
- text: "Login"
353
- x: 100
354
- y: 150
355
- width: 200
356
- height: 40
357
- onClick: handleLogin
358
- }
359
-
360
- textinput usernameInput {
361
- placeholder: "Username"
362
- x: 100
363
- y: 50
364
- width: 200
365
- height: 36
366
- }
367
-
368
- textinput passwordInput {
369
- placeholder: "Password"
370
- x: 100
371
- y: 100
372
- width: 200
373
- height: 36
374
- }`,
375
-
376
- dashboard: `panel sidebar {
377
- x: 0
378
- y: 0
379
- width: 200
380
- height: 600
381
- backgroundColor: "#2c3e50"
382
- }
383
-
384
- text title {
385
- content: "Dashboard"
386
- x: 220
387
- y: 20
388
- fontSize: 24
389
- color: "#34495e"
390
- }
391
-
392
- button refreshBtn {
393
- text: "Refresh Data"
394
- x: 220
395
- y: 60
396
- onClick: refreshData
397
- }`,
398
- } as const;
399
-
400
- // Utility Functions
401
-
402
- /**
403
- * Create a pre-configured HoloScript environment
404
- */
405
- export function createHoloScriptEnvironment() {
406
- return {
407
- parser: new HoloScriptParser(),
408
- runtime: new HoloScriptRuntime(),
409
- version: HOLOSCRIPT_VERSION,
410
- };
411
- }
412
-
413
- /**
414
- * Check if the current environment supports VR/XR
415
- */
416
- export function isHoloScriptSupported(): boolean {
417
- if (typeof globalThis === 'undefined') return false;
418
- const win = globalThis as { window?: { navigator?: { xr?: unknown; getVRDisplays?: unknown }; webkitGetUserMedia?: unknown } };
419
- if (!win.window) return false;
420
-
421
- return !!(
422
- win.window.navigator?.xr ||
423
- win.window.navigator?.getVRDisplays ||
424
- win.window.webkitGetUserMedia
425
- );
426
- }