@holoscript/core 2.0.1 → 2.1.0
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.
- package/dist/chunk-2XXE34KS.js +344 -0
- package/dist/chunk-2XXE34KS.js.map +1 -0
- package/dist/chunk-3X2EGU7Z.cjs +52 -0
- package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
- package/dist/chunk-AFFVFO4D.js +1689 -0
- package/dist/chunk-AFFVFO4D.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/{src/HoloScriptDebugger.ts → dist/chunk-DOY73HDH.js} +118 -257
- package/dist/chunk-DOY73HDH.js.map +1 -0
- package/dist/chunk-JEQ2X3Z6.cjs +12 -0
- package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
- package/dist/chunk-L6VLNVKP.cjs +1691 -0
- package/dist/chunk-L6VLNVKP.cjs.map +1 -0
- package/dist/chunk-MFNO57XL.cjs +347 -0
- package/dist/chunk-MFNO57XL.cjs.map +1 -0
- package/dist/chunk-R75MREOS.cjs +424 -0
- package/dist/chunk-R75MREOS.cjs.map +1 -0
- package/dist/chunk-SATNCODL.js +45 -0
- package/dist/chunk-SATNCODL.js.map +1 -0
- package/dist/chunk-T57ZL7KR.cjs +1281 -0
- package/dist/chunk-T57ZL7KR.cjs.map +1 -0
- package/dist/chunk-U72GEJZT.js +1279 -0
- package/dist/chunk-U72GEJZT.js.map +1 -0
- package/dist/debugger.cjs +20 -0
- package/dist/debugger.cjs.map +1 -0
- package/dist/debugger.d.cts +171 -0
- package/dist/debugger.d.ts +171 -0
- package/dist/debugger.js +7 -0
- package/dist/debugger.js.map +1 -0
- package/dist/index.cjs +6803 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4093 -0
- package/dist/index.d.ts +4093 -0
- package/dist/index.js +6715 -0
- package/dist/index.js.map +1 -0
- package/dist/parser.cjs +14 -0
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +172 -0
- package/dist/parser.d.ts +172 -0
- package/dist/parser.js +5 -0
- package/dist/parser.js.map +1 -0
- package/dist/runtime.cjs +14 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +200 -0
- package/dist/runtime.d.ts +200 -0
- package/dist/runtime.js +5 -0
- package/dist/runtime.js.map +1 -0
- package/dist/type-checker.cjs +17 -0
- package/dist/type-checker.cjs.map +1 -0
- package/dist/type-checker.d.cts +105 -0
- package/dist/type-checker.d.ts +105 -0
- package/dist/type-checker.js +4 -0
- package/dist/type-checker.js.map +1 -0
- package/dist/types-4h8cbtF_.d.cts +329 -0
- package/dist/types-4h8cbtF_.d.ts +329 -0
- package/package.json +17 -13
- package/src/HoloScript2DParser.js +0 -227
- package/src/HoloScript2DParser.ts +0 -261
- package/src/HoloScriptCodeParser.js +0 -1102
- package/src/HoloScriptCodeParser.ts +0 -1188
- package/src/HoloScriptDebugger.js +0 -458
- package/src/HoloScriptParser.js +0 -338
- package/src/HoloScriptParser.ts +0 -397
- package/src/HoloScriptPlusParser.js +0 -371
- package/src/HoloScriptPlusParser.ts +0 -543
- package/src/HoloScriptRuntime.js +0 -1399
- package/src/HoloScriptRuntime.test.js +0 -351
- package/src/HoloScriptRuntime.test.ts +0 -436
- package/src/HoloScriptRuntime.ts +0 -1653
- package/src/HoloScriptTypeChecker.js +0 -356
- package/src/HoloScriptTypeChecker.ts +0 -475
- package/src/__tests__/GraphicsServices.test.js +0 -357
- package/src/__tests__/GraphicsServices.test.ts +0 -427
- package/src/__tests__/HoloScriptPlusParser.test.js +0 -317
- package/src/__tests__/HoloScriptPlusParser.test.ts +0 -392
- package/src/__tests__/integration.test.js +0 -336
- package/src/__tests__/integration.test.ts +0 -416
- package/src/__tests__/performance.bench.js +0 -218
- package/src/__tests__/performance.bench.ts +0 -262
- package/src/__tests__/type-checker.test.js +0 -60
- package/src/__tests__/type-checker.test.ts +0 -73
- package/src/index.js +0 -217
- package/src/index.ts +0 -426
- package/src/interop/Interoperability.js +0 -413
- package/src/interop/Interoperability.ts +0 -494
- package/src/logger.js +0 -42
- package/src/logger.ts +0 -57
- package/src/parser/EnhancedParser.js +0 -205
- package/src/parser/EnhancedParser.ts +0 -251
- package/src/parser/HoloScriptPlusParser.js +0 -928
- package/src/parser/HoloScriptPlusParser.ts +0 -1089
- package/src/runtime/HoloScriptPlusRuntime.js +0 -674
- package/src/runtime/HoloScriptPlusRuntime.ts +0 -861
- package/src/runtime/PerformanceTelemetry.js +0 -323
- package/src/runtime/PerformanceTelemetry.ts +0 -467
- package/src/runtime/RuntimeOptimization.js +0 -361
- package/src/runtime/RuntimeOptimization.ts +0 -416
- package/src/services/HololandGraphicsPipelineService.js +0 -506
- package/src/services/HololandGraphicsPipelineService.ts +0 -662
- package/src/services/PlatformPerformanceOptimizer.js +0 -356
- package/src/services/PlatformPerformanceOptimizer.ts +0 -503
- package/src/state/ReactiveState.js +0 -427
- package/src/state/ReactiveState.ts +0 -572
- package/src/tools/DeveloperExperience.js +0 -376
- package/src/tools/DeveloperExperience.ts +0 -438
- package/src/traits/AIDriverTrait.js +0 -322
- package/src/traits/AIDriverTrait.test.js +0 -329
- package/src/traits/AIDriverTrait.test.ts +0 -357
- package/src/traits/AIDriverTrait.ts +0 -474
- package/src/traits/LightingTrait.js +0 -313
- package/src/traits/LightingTrait.test.js +0 -410
- package/src/traits/LightingTrait.test.ts +0 -462
- package/src/traits/LightingTrait.ts +0 -505
- package/src/traits/MaterialTrait.js +0 -194
- package/src/traits/MaterialTrait.test.js +0 -286
- package/src/traits/MaterialTrait.test.ts +0 -329
- package/src/traits/MaterialTrait.ts +0 -324
- package/src/traits/RenderingTrait.js +0 -356
- package/src/traits/RenderingTrait.test.js +0 -363
- package/src/traits/RenderingTrait.test.ts +0 -427
- package/src/traits/RenderingTrait.ts +0 -555
- package/src/traits/VRTraitSystem.js +0 -740
- package/src/traits/VRTraitSystem.ts +0 -1040
- package/src/traits/VoiceInputTrait.js +0 -284
- package/src/traits/VoiceInputTrait.test.js +0 -226
- package/src/traits/VoiceInputTrait.test.ts +0 -252
- package/src/traits/VoiceInputTrait.ts +0 -401
- package/src/types/AdvancedTypeSystem.js +0 -226
- package/src/types/AdvancedTypeSystem.ts +0 -494
- package/src/types/HoloScriptPlus.d.ts +0 -853
- package/src/types.js +0 -6
- package/src/types.ts +0 -369
- package/tsconfig.json +0 -23
- package/tsup.config.d.ts +0 -2
- package/tsup.config.js +0 -18
- package/tsup.config.ts +0 -19
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @holoscript/core Types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for HoloScript AST and runtime
|
|
5
|
+
*/
|
|
6
|
+
interface SpatialPosition {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
}
|
|
11
|
+
interface Position2D {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
interface Size2D {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
type HologramShape = 'orb' | 'cube' | 'cylinder' | 'pyramid' | 'sphere' | 'function' | 'gate' | 'stream' | 'server' | 'database' | 'fetch';
|
|
20
|
+
interface HologramProperties {
|
|
21
|
+
shape: HologramShape;
|
|
22
|
+
color: string;
|
|
23
|
+
size: number;
|
|
24
|
+
glow: boolean;
|
|
25
|
+
interactive: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface VoiceCommand {
|
|
28
|
+
command: string;
|
|
29
|
+
confidence: number;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
spatialContext?: SpatialPosition;
|
|
32
|
+
}
|
|
33
|
+
type GestureType = 'pinch' | 'swipe' | 'rotate' | 'grab' | 'release';
|
|
34
|
+
type HandType = 'left' | 'right';
|
|
35
|
+
interface GestureData {
|
|
36
|
+
type: GestureType;
|
|
37
|
+
position: SpatialPosition;
|
|
38
|
+
direction?: SpatialPosition;
|
|
39
|
+
magnitude: number;
|
|
40
|
+
hand: HandType;
|
|
41
|
+
}
|
|
42
|
+
interface Animation {
|
|
43
|
+
target: string;
|
|
44
|
+
property: string;
|
|
45
|
+
from: number;
|
|
46
|
+
to: number;
|
|
47
|
+
duration: number;
|
|
48
|
+
startTime: number;
|
|
49
|
+
easing: string;
|
|
50
|
+
loop?: boolean;
|
|
51
|
+
yoyo?: boolean;
|
|
52
|
+
}
|
|
53
|
+
type HoloScriptValue = string | number | boolean | null | undefined | HoloScriptValue[] | {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
} | ASTNode | Function | SpatialPosition | HologramProperties | Animation;
|
|
56
|
+
interface ASTNode {
|
|
57
|
+
type: string;
|
|
58
|
+
position?: SpatialPosition;
|
|
59
|
+
hologram?: HologramProperties;
|
|
60
|
+
/** Source line number (1-indexed) */
|
|
61
|
+
line?: number;
|
|
62
|
+
/** Source column number (0-indexed) */
|
|
63
|
+
column?: number;
|
|
64
|
+
/** HS+ Directives */
|
|
65
|
+
directives?: HSPlusDirective[];
|
|
66
|
+
}
|
|
67
|
+
type VRTraitName = 'grabbable' | 'throwable' | 'pointable' | 'hoverable' | 'scalable' | 'rotatable' | 'stackable' | 'snappable' | 'breakable';
|
|
68
|
+
type LifecycleHook = 'on_mount' | 'on_unmount' | 'on_update' | 'on_data_update';
|
|
69
|
+
type VRLifecycleHook = 'on_grab' | 'on_release' | 'on_hover_enter' | 'on_hover_exit' | 'on_point_enter' | 'on_point_exit' | 'on_collision' | 'on_trigger_enter' | 'on_trigger_exit' | 'on_click' | 'on_double_click';
|
|
70
|
+
type ControllerHook = 'on_controller_button' | 'on_trigger_hold' | 'on_trigger_release' | 'on_grip_hold' | 'on_grip_release';
|
|
71
|
+
type HSPlusDirective = {
|
|
72
|
+
type: 'state';
|
|
73
|
+
body: Record<string, HoloScriptValue>;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'for';
|
|
76
|
+
variable: string;
|
|
77
|
+
iterable: string;
|
|
78
|
+
body: ASTNode[];
|
|
79
|
+
} | {
|
|
80
|
+
type: 'if';
|
|
81
|
+
condition: string;
|
|
82
|
+
body: ASTNode[];
|
|
83
|
+
else?: ASTNode[];
|
|
84
|
+
} | {
|
|
85
|
+
type: 'import';
|
|
86
|
+
path: string;
|
|
87
|
+
alias: string;
|
|
88
|
+
} | {
|
|
89
|
+
type: 'lifecycle';
|
|
90
|
+
hook: LifecycleHook | VRLifecycleHook | ControllerHook;
|
|
91
|
+
params?: string[];
|
|
92
|
+
body: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'trait';
|
|
95
|
+
name: VRTraitName;
|
|
96
|
+
config: Record<string, HoloScriptValue>;
|
|
97
|
+
};
|
|
98
|
+
interface OrbNode extends ASTNode {
|
|
99
|
+
type: 'orb';
|
|
100
|
+
name: string;
|
|
101
|
+
properties: Record<string, HoloScriptValue>;
|
|
102
|
+
methods: MethodNode[];
|
|
103
|
+
}
|
|
104
|
+
interface MethodNode extends ASTNode {
|
|
105
|
+
type: 'method';
|
|
106
|
+
name: string;
|
|
107
|
+
parameters: ParameterNode[];
|
|
108
|
+
body: ASTNode[];
|
|
109
|
+
returnType?: string;
|
|
110
|
+
}
|
|
111
|
+
interface ParameterNode extends ASTNode {
|
|
112
|
+
type: 'parameter';
|
|
113
|
+
name: string;
|
|
114
|
+
dataType: string;
|
|
115
|
+
defaultValue?: HoloScriptValue;
|
|
116
|
+
}
|
|
117
|
+
interface ConnectionNode extends ASTNode {
|
|
118
|
+
type: 'connection';
|
|
119
|
+
from: string;
|
|
120
|
+
to: string;
|
|
121
|
+
dataType: string;
|
|
122
|
+
bidirectional: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface GateNode extends ASTNode {
|
|
125
|
+
type: 'gate';
|
|
126
|
+
condition: string;
|
|
127
|
+
truePath: ASTNode[];
|
|
128
|
+
falsePath: ASTNode[];
|
|
129
|
+
}
|
|
130
|
+
interface StreamNode extends ASTNode {
|
|
131
|
+
type: 'stream';
|
|
132
|
+
name: string;
|
|
133
|
+
source: string;
|
|
134
|
+
transformations: TransformationNode[];
|
|
135
|
+
}
|
|
136
|
+
interface TransformationNode extends ASTNode {
|
|
137
|
+
type: 'transformation';
|
|
138
|
+
operation: string;
|
|
139
|
+
parameters: Record<string, HoloScriptValue>;
|
|
140
|
+
}
|
|
141
|
+
interface GenericASTNode extends ASTNode {
|
|
142
|
+
[key: string]: HoloScriptValue | unknown;
|
|
143
|
+
}
|
|
144
|
+
interface ForLoopNode extends ASTNode {
|
|
145
|
+
type: 'for-loop';
|
|
146
|
+
init: string;
|
|
147
|
+
condition: string;
|
|
148
|
+
update: string;
|
|
149
|
+
body: ASTNode[];
|
|
150
|
+
}
|
|
151
|
+
interface WhileLoopNode extends ASTNode {
|
|
152
|
+
type: 'while-loop';
|
|
153
|
+
condition: string;
|
|
154
|
+
body: ASTNode[];
|
|
155
|
+
}
|
|
156
|
+
interface ForEachLoopNode extends ASTNode {
|
|
157
|
+
type: 'foreach-loop';
|
|
158
|
+
variable: string;
|
|
159
|
+
collection: string;
|
|
160
|
+
body: ASTNode[];
|
|
161
|
+
}
|
|
162
|
+
interface TemplateNode extends ASTNode {
|
|
163
|
+
type: 'template';
|
|
164
|
+
name: string;
|
|
165
|
+
parameters: string[];
|
|
166
|
+
body: ASTNode[];
|
|
167
|
+
}
|
|
168
|
+
interface ImportNode extends ASTNode {
|
|
169
|
+
type: 'import';
|
|
170
|
+
imports: string[];
|
|
171
|
+
defaultImport?: string;
|
|
172
|
+
modulePath: string;
|
|
173
|
+
}
|
|
174
|
+
type ImportLoader = (path: string) => Promise<string>;
|
|
175
|
+
interface ExportNode extends ASTNode {
|
|
176
|
+
type: 'export';
|
|
177
|
+
exports?: string[];
|
|
178
|
+
declaration?: ASTNode;
|
|
179
|
+
}
|
|
180
|
+
interface VariableDeclarationNode extends ASTNode {
|
|
181
|
+
type: 'variable-declaration';
|
|
182
|
+
kind: 'const' | 'let' | 'var';
|
|
183
|
+
name: string;
|
|
184
|
+
dataType?: string;
|
|
185
|
+
value?: HoloScriptValue;
|
|
186
|
+
isExpression?: boolean;
|
|
187
|
+
}
|
|
188
|
+
type UIElementType = 'canvas' | 'button' | 'textinput' | 'panel' | 'text' | 'image' | 'list' | 'modal' | 'slider' | 'toggle' | 'dropdown' | 'flex-container' | 'grid-container' | 'scroll-view' | 'tab-view' | 'dashboard' | 'card' | 'metric' | 'row' | 'col';
|
|
189
|
+
interface UI2DNode {
|
|
190
|
+
type: '2d-element';
|
|
191
|
+
elementType: UIElementType;
|
|
192
|
+
name: string;
|
|
193
|
+
properties: Record<string, HoloScriptValue>;
|
|
194
|
+
children?: UI2DNode[];
|
|
195
|
+
events?: Record<string, string>;
|
|
196
|
+
}
|
|
197
|
+
interface UIStyle {
|
|
198
|
+
backgroundColor?: string;
|
|
199
|
+
color?: string;
|
|
200
|
+
fontSize?: number;
|
|
201
|
+
fontFamily?: string;
|
|
202
|
+
borderColor?: string;
|
|
203
|
+
borderWidth?: number;
|
|
204
|
+
borderRadius?: number;
|
|
205
|
+
padding?: number;
|
|
206
|
+
margin?: number;
|
|
207
|
+
}
|
|
208
|
+
interface RuntimeContext {
|
|
209
|
+
variables: Map<string, HoloScriptValue>;
|
|
210
|
+
functions: Map<string, MethodNode>;
|
|
211
|
+
exports: Map<string, HoloScriptValue>;
|
|
212
|
+
connections: ConnectionNode[];
|
|
213
|
+
spatialMemory: Map<string, SpatialPosition>;
|
|
214
|
+
hologramState: Map<string, HologramProperties>;
|
|
215
|
+
executionStack: ASTNode[];
|
|
216
|
+
mode?: 'public' | 'secure';
|
|
217
|
+
currentScale: number;
|
|
218
|
+
scaleMagnitude: string;
|
|
219
|
+
focusHistory: string[];
|
|
220
|
+
environment: Record<string, HoloScriptValue>;
|
|
221
|
+
templates: Map<string, TemplateNode>;
|
|
222
|
+
state: ReactiveState;
|
|
223
|
+
}
|
|
224
|
+
interface ReactiveState {
|
|
225
|
+
get(key: string): HoloScriptValue;
|
|
226
|
+
set(key: string, value: HoloScriptValue): void;
|
|
227
|
+
subscribe(callback: (state: Record<string, HoloScriptValue>) => void): () => void;
|
|
228
|
+
getSnapshot(): Record<string, HoloScriptValue>;
|
|
229
|
+
update(updates: Record<string, HoloScriptValue>): void;
|
|
230
|
+
}
|
|
231
|
+
interface ExecutionResult {
|
|
232
|
+
success: boolean;
|
|
233
|
+
output?: HoloScriptValue;
|
|
234
|
+
hologram?: HologramProperties;
|
|
235
|
+
spatialPosition?: SpatialPosition;
|
|
236
|
+
error?: string;
|
|
237
|
+
executionTime?: number;
|
|
238
|
+
learningSignals?: Record<string, HoloScriptValue>;
|
|
239
|
+
}
|
|
240
|
+
interface ParticleSystem {
|
|
241
|
+
particles: SpatialPosition[];
|
|
242
|
+
color: string;
|
|
243
|
+
lifetime: number;
|
|
244
|
+
speed: number;
|
|
245
|
+
}
|
|
246
|
+
interface SecurityConfig {
|
|
247
|
+
maxCommandLength: number;
|
|
248
|
+
maxTokens: number;
|
|
249
|
+
maxHologramsPerUser: number;
|
|
250
|
+
suspiciousKeywords: string[];
|
|
251
|
+
allowedShapes: string[];
|
|
252
|
+
allowedUIElements: string[];
|
|
253
|
+
}
|
|
254
|
+
interface RuntimeSecurityLimits {
|
|
255
|
+
maxExecutionDepth: number;
|
|
256
|
+
maxTotalNodes: number;
|
|
257
|
+
maxExecutionTimeMs: number;
|
|
258
|
+
maxParticlesPerSystem: number;
|
|
259
|
+
}
|
|
260
|
+
interface Vector3 {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
z: number;
|
|
264
|
+
}
|
|
265
|
+
interface Vector2 {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
}
|
|
269
|
+
interface Color {
|
|
270
|
+
r: number;
|
|
271
|
+
g: number;
|
|
272
|
+
b: number;
|
|
273
|
+
a?: number;
|
|
274
|
+
}
|
|
275
|
+
interface Duration {
|
|
276
|
+
milliseconds: number;
|
|
277
|
+
}
|
|
278
|
+
interface Transform {
|
|
279
|
+
position: Vector3;
|
|
280
|
+
rotation: Vector3;
|
|
281
|
+
scale: Vector3;
|
|
282
|
+
}
|
|
283
|
+
type VRHand = 'left' | 'right' | 'both';
|
|
284
|
+
interface ThrowVelocity {
|
|
285
|
+
magnitude: number;
|
|
286
|
+
direction: Vector3;
|
|
287
|
+
spin?: Vector3;
|
|
288
|
+
}
|
|
289
|
+
interface CollisionEvent {
|
|
290
|
+
object1: string;
|
|
291
|
+
object2: string;
|
|
292
|
+
position: Vector3;
|
|
293
|
+
normal: Vector3;
|
|
294
|
+
force: number;
|
|
295
|
+
timestamp: number;
|
|
296
|
+
}
|
|
297
|
+
interface GrabbableTrait {
|
|
298
|
+
snapToHand: boolean;
|
|
299
|
+
grip_type: 'palm' | 'pinch' | 'full';
|
|
300
|
+
haptic_feedback: boolean;
|
|
301
|
+
}
|
|
302
|
+
interface ThrowableTrait {
|
|
303
|
+
velocityMultiplier: number;
|
|
304
|
+
enableSpin: boolean;
|
|
305
|
+
gravityScale: number;
|
|
306
|
+
}
|
|
307
|
+
interface PointableTrait {
|
|
308
|
+
maxPointDistance: number;
|
|
309
|
+
interactionRadius: number;
|
|
310
|
+
hapticFeedback: boolean;
|
|
311
|
+
}
|
|
312
|
+
interface HoverableTrait {
|
|
313
|
+
hoverDistance: number;
|
|
314
|
+
hoverColor: Color;
|
|
315
|
+
hoverScale: number;
|
|
316
|
+
enableHighlight: boolean;
|
|
317
|
+
}
|
|
318
|
+
interface ScalableTrait {
|
|
319
|
+
minScale: number;
|
|
320
|
+
maxScale: number;
|
|
321
|
+
scaleSpeed: number;
|
|
322
|
+
}
|
|
323
|
+
interface RotatableTrait {
|
|
324
|
+
rotationSpeed: number;
|
|
325
|
+
freeRotation: boolean;
|
|
326
|
+
snapAngles?: number[];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export type { ASTNode as A, ExecutionResult as B, ConnectionNode as C, Duration as D, ExportNode as E, ForLoopNode as F, GestureData as G, HologramShape as H, ImportNode as I, HoloScriptValue as J, ParticleSystem as K, SecurityConfig as L, MethodNode as M, RuntimeSecurityLimits as N, OrbNode as O, Position2D as P, Animation as Q, RotatableTrait as R, SpatialPosition as S, TransformationNode as T, UI2DNode as U, VoiceCommand as V, WhileLoopNode as W, Size2D as a, HologramProperties as b, GestureType as c, HandType as d, ParameterNode as e, GateNode as f, StreamNode as g, GenericASTNode as h, Vector3 as i, Vector2 as j, Color as k, Transform as l, VRHand as m, ThrowVelocity as n, CollisionEvent as o, GrabbableTrait as p, ThrowableTrait as q, PointableTrait as r, HoverableTrait as s, ScalableTrait as t, ForEachLoopNode as u, ImportLoader as v, VariableDeclarationNode as w, UIElementType as x, UIStyle as y, RuntimeContext as z };
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @holoscript/core Types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for HoloScript AST and runtime
|
|
5
|
+
*/
|
|
6
|
+
interface SpatialPosition {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
}
|
|
11
|
+
interface Position2D {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
interface Size2D {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
type HologramShape = 'orb' | 'cube' | 'cylinder' | 'pyramid' | 'sphere' | 'function' | 'gate' | 'stream' | 'server' | 'database' | 'fetch';
|
|
20
|
+
interface HologramProperties {
|
|
21
|
+
shape: HologramShape;
|
|
22
|
+
color: string;
|
|
23
|
+
size: number;
|
|
24
|
+
glow: boolean;
|
|
25
|
+
interactive: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface VoiceCommand {
|
|
28
|
+
command: string;
|
|
29
|
+
confidence: number;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
spatialContext?: SpatialPosition;
|
|
32
|
+
}
|
|
33
|
+
type GestureType = 'pinch' | 'swipe' | 'rotate' | 'grab' | 'release';
|
|
34
|
+
type HandType = 'left' | 'right';
|
|
35
|
+
interface GestureData {
|
|
36
|
+
type: GestureType;
|
|
37
|
+
position: SpatialPosition;
|
|
38
|
+
direction?: SpatialPosition;
|
|
39
|
+
magnitude: number;
|
|
40
|
+
hand: HandType;
|
|
41
|
+
}
|
|
42
|
+
interface Animation {
|
|
43
|
+
target: string;
|
|
44
|
+
property: string;
|
|
45
|
+
from: number;
|
|
46
|
+
to: number;
|
|
47
|
+
duration: number;
|
|
48
|
+
startTime: number;
|
|
49
|
+
easing: string;
|
|
50
|
+
loop?: boolean;
|
|
51
|
+
yoyo?: boolean;
|
|
52
|
+
}
|
|
53
|
+
type HoloScriptValue = string | number | boolean | null | undefined | HoloScriptValue[] | {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
} | ASTNode | Function | SpatialPosition | HologramProperties | Animation;
|
|
56
|
+
interface ASTNode {
|
|
57
|
+
type: string;
|
|
58
|
+
position?: SpatialPosition;
|
|
59
|
+
hologram?: HologramProperties;
|
|
60
|
+
/** Source line number (1-indexed) */
|
|
61
|
+
line?: number;
|
|
62
|
+
/** Source column number (0-indexed) */
|
|
63
|
+
column?: number;
|
|
64
|
+
/** HS+ Directives */
|
|
65
|
+
directives?: HSPlusDirective[];
|
|
66
|
+
}
|
|
67
|
+
type VRTraitName = 'grabbable' | 'throwable' | 'pointable' | 'hoverable' | 'scalable' | 'rotatable' | 'stackable' | 'snappable' | 'breakable';
|
|
68
|
+
type LifecycleHook = 'on_mount' | 'on_unmount' | 'on_update' | 'on_data_update';
|
|
69
|
+
type VRLifecycleHook = 'on_grab' | 'on_release' | 'on_hover_enter' | 'on_hover_exit' | 'on_point_enter' | 'on_point_exit' | 'on_collision' | 'on_trigger_enter' | 'on_trigger_exit' | 'on_click' | 'on_double_click';
|
|
70
|
+
type ControllerHook = 'on_controller_button' | 'on_trigger_hold' | 'on_trigger_release' | 'on_grip_hold' | 'on_grip_release';
|
|
71
|
+
type HSPlusDirective = {
|
|
72
|
+
type: 'state';
|
|
73
|
+
body: Record<string, HoloScriptValue>;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'for';
|
|
76
|
+
variable: string;
|
|
77
|
+
iterable: string;
|
|
78
|
+
body: ASTNode[];
|
|
79
|
+
} | {
|
|
80
|
+
type: 'if';
|
|
81
|
+
condition: string;
|
|
82
|
+
body: ASTNode[];
|
|
83
|
+
else?: ASTNode[];
|
|
84
|
+
} | {
|
|
85
|
+
type: 'import';
|
|
86
|
+
path: string;
|
|
87
|
+
alias: string;
|
|
88
|
+
} | {
|
|
89
|
+
type: 'lifecycle';
|
|
90
|
+
hook: LifecycleHook | VRLifecycleHook | ControllerHook;
|
|
91
|
+
params?: string[];
|
|
92
|
+
body: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'trait';
|
|
95
|
+
name: VRTraitName;
|
|
96
|
+
config: Record<string, HoloScriptValue>;
|
|
97
|
+
};
|
|
98
|
+
interface OrbNode extends ASTNode {
|
|
99
|
+
type: 'orb';
|
|
100
|
+
name: string;
|
|
101
|
+
properties: Record<string, HoloScriptValue>;
|
|
102
|
+
methods: MethodNode[];
|
|
103
|
+
}
|
|
104
|
+
interface MethodNode extends ASTNode {
|
|
105
|
+
type: 'method';
|
|
106
|
+
name: string;
|
|
107
|
+
parameters: ParameterNode[];
|
|
108
|
+
body: ASTNode[];
|
|
109
|
+
returnType?: string;
|
|
110
|
+
}
|
|
111
|
+
interface ParameterNode extends ASTNode {
|
|
112
|
+
type: 'parameter';
|
|
113
|
+
name: string;
|
|
114
|
+
dataType: string;
|
|
115
|
+
defaultValue?: HoloScriptValue;
|
|
116
|
+
}
|
|
117
|
+
interface ConnectionNode extends ASTNode {
|
|
118
|
+
type: 'connection';
|
|
119
|
+
from: string;
|
|
120
|
+
to: string;
|
|
121
|
+
dataType: string;
|
|
122
|
+
bidirectional: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface GateNode extends ASTNode {
|
|
125
|
+
type: 'gate';
|
|
126
|
+
condition: string;
|
|
127
|
+
truePath: ASTNode[];
|
|
128
|
+
falsePath: ASTNode[];
|
|
129
|
+
}
|
|
130
|
+
interface StreamNode extends ASTNode {
|
|
131
|
+
type: 'stream';
|
|
132
|
+
name: string;
|
|
133
|
+
source: string;
|
|
134
|
+
transformations: TransformationNode[];
|
|
135
|
+
}
|
|
136
|
+
interface TransformationNode extends ASTNode {
|
|
137
|
+
type: 'transformation';
|
|
138
|
+
operation: string;
|
|
139
|
+
parameters: Record<string, HoloScriptValue>;
|
|
140
|
+
}
|
|
141
|
+
interface GenericASTNode extends ASTNode {
|
|
142
|
+
[key: string]: HoloScriptValue | unknown;
|
|
143
|
+
}
|
|
144
|
+
interface ForLoopNode extends ASTNode {
|
|
145
|
+
type: 'for-loop';
|
|
146
|
+
init: string;
|
|
147
|
+
condition: string;
|
|
148
|
+
update: string;
|
|
149
|
+
body: ASTNode[];
|
|
150
|
+
}
|
|
151
|
+
interface WhileLoopNode extends ASTNode {
|
|
152
|
+
type: 'while-loop';
|
|
153
|
+
condition: string;
|
|
154
|
+
body: ASTNode[];
|
|
155
|
+
}
|
|
156
|
+
interface ForEachLoopNode extends ASTNode {
|
|
157
|
+
type: 'foreach-loop';
|
|
158
|
+
variable: string;
|
|
159
|
+
collection: string;
|
|
160
|
+
body: ASTNode[];
|
|
161
|
+
}
|
|
162
|
+
interface TemplateNode extends ASTNode {
|
|
163
|
+
type: 'template';
|
|
164
|
+
name: string;
|
|
165
|
+
parameters: string[];
|
|
166
|
+
body: ASTNode[];
|
|
167
|
+
}
|
|
168
|
+
interface ImportNode extends ASTNode {
|
|
169
|
+
type: 'import';
|
|
170
|
+
imports: string[];
|
|
171
|
+
defaultImport?: string;
|
|
172
|
+
modulePath: string;
|
|
173
|
+
}
|
|
174
|
+
type ImportLoader = (path: string) => Promise<string>;
|
|
175
|
+
interface ExportNode extends ASTNode {
|
|
176
|
+
type: 'export';
|
|
177
|
+
exports?: string[];
|
|
178
|
+
declaration?: ASTNode;
|
|
179
|
+
}
|
|
180
|
+
interface VariableDeclarationNode extends ASTNode {
|
|
181
|
+
type: 'variable-declaration';
|
|
182
|
+
kind: 'const' | 'let' | 'var';
|
|
183
|
+
name: string;
|
|
184
|
+
dataType?: string;
|
|
185
|
+
value?: HoloScriptValue;
|
|
186
|
+
isExpression?: boolean;
|
|
187
|
+
}
|
|
188
|
+
type UIElementType = 'canvas' | 'button' | 'textinput' | 'panel' | 'text' | 'image' | 'list' | 'modal' | 'slider' | 'toggle' | 'dropdown' | 'flex-container' | 'grid-container' | 'scroll-view' | 'tab-view' | 'dashboard' | 'card' | 'metric' | 'row' | 'col';
|
|
189
|
+
interface UI2DNode {
|
|
190
|
+
type: '2d-element';
|
|
191
|
+
elementType: UIElementType;
|
|
192
|
+
name: string;
|
|
193
|
+
properties: Record<string, HoloScriptValue>;
|
|
194
|
+
children?: UI2DNode[];
|
|
195
|
+
events?: Record<string, string>;
|
|
196
|
+
}
|
|
197
|
+
interface UIStyle {
|
|
198
|
+
backgroundColor?: string;
|
|
199
|
+
color?: string;
|
|
200
|
+
fontSize?: number;
|
|
201
|
+
fontFamily?: string;
|
|
202
|
+
borderColor?: string;
|
|
203
|
+
borderWidth?: number;
|
|
204
|
+
borderRadius?: number;
|
|
205
|
+
padding?: number;
|
|
206
|
+
margin?: number;
|
|
207
|
+
}
|
|
208
|
+
interface RuntimeContext {
|
|
209
|
+
variables: Map<string, HoloScriptValue>;
|
|
210
|
+
functions: Map<string, MethodNode>;
|
|
211
|
+
exports: Map<string, HoloScriptValue>;
|
|
212
|
+
connections: ConnectionNode[];
|
|
213
|
+
spatialMemory: Map<string, SpatialPosition>;
|
|
214
|
+
hologramState: Map<string, HologramProperties>;
|
|
215
|
+
executionStack: ASTNode[];
|
|
216
|
+
mode?: 'public' | 'secure';
|
|
217
|
+
currentScale: number;
|
|
218
|
+
scaleMagnitude: string;
|
|
219
|
+
focusHistory: string[];
|
|
220
|
+
environment: Record<string, HoloScriptValue>;
|
|
221
|
+
templates: Map<string, TemplateNode>;
|
|
222
|
+
state: ReactiveState;
|
|
223
|
+
}
|
|
224
|
+
interface ReactiveState {
|
|
225
|
+
get(key: string): HoloScriptValue;
|
|
226
|
+
set(key: string, value: HoloScriptValue): void;
|
|
227
|
+
subscribe(callback: (state: Record<string, HoloScriptValue>) => void): () => void;
|
|
228
|
+
getSnapshot(): Record<string, HoloScriptValue>;
|
|
229
|
+
update(updates: Record<string, HoloScriptValue>): void;
|
|
230
|
+
}
|
|
231
|
+
interface ExecutionResult {
|
|
232
|
+
success: boolean;
|
|
233
|
+
output?: HoloScriptValue;
|
|
234
|
+
hologram?: HologramProperties;
|
|
235
|
+
spatialPosition?: SpatialPosition;
|
|
236
|
+
error?: string;
|
|
237
|
+
executionTime?: number;
|
|
238
|
+
learningSignals?: Record<string, HoloScriptValue>;
|
|
239
|
+
}
|
|
240
|
+
interface ParticleSystem {
|
|
241
|
+
particles: SpatialPosition[];
|
|
242
|
+
color: string;
|
|
243
|
+
lifetime: number;
|
|
244
|
+
speed: number;
|
|
245
|
+
}
|
|
246
|
+
interface SecurityConfig {
|
|
247
|
+
maxCommandLength: number;
|
|
248
|
+
maxTokens: number;
|
|
249
|
+
maxHologramsPerUser: number;
|
|
250
|
+
suspiciousKeywords: string[];
|
|
251
|
+
allowedShapes: string[];
|
|
252
|
+
allowedUIElements: string[];
|
|
253
|
+
}
|
|
254
|
+
interface RuntimeSecurityLimits {
|
|
255
|
+
maxExecutionDepth: number;
|
|
256
|
+
maxTotalNodes: number;
|
|
257
|
+
maxExecutionTimeMs: number;
|
|
258
|
+
maxParticlesPerSystem: number;
|
|
259
|
+
}
|
|
260
|
+
interface Vector3 {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
z: number;
|
|
264
|
+
}
|
|
265
|
+
interface Vector2 {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
}
|
|
269
|
+
interface Color {
|
|
270
|
+
r: number;
|
|
271
|
+
g: number;
|
|
272
|
+
b: number;
|
|
273
|
+
a?: number;
|
|
274
|
+
}
|
|
275
|
+
interface Duration {
|
|
276
|
+
milliseconds: number;
|
|
277
|
+
}
|
|
278
|
+
interface Transform {
|
|
279
|
+
position: Vector3;
|
|
280
|
+
rotation: Vector3;
|
|
281
|
+
scale: Vector3;
|
|
282
|
+
}
|
|
283
|
+
type VRHand = 'left' | 'right' | 'both';
|
|
284
|
+
interface ThrowVelocity {
|
|
285
|
+
magnitude: number;
|
|
286
|
+
direction: Vector3;
|
|
287
|
+
spin?: Vector3;
|
|
288
|
+
}
|
|
289
|
+
interface CollisionEvent {
|
|
290
|
+
object1: string;
|
|
291
|
+
object2: string;
|
|
292
|
+
position: Vector3;
|
|
293
|
+
normal: Vector3;
|
|
294
|
+
force: number;
|
|
295
|
+
timestamp: number;
|
|
296
|
+
}
|
|
297
|
+
interface GrabbableTrait {
|
|
298
|
+
snapToHand: boolean;
|
|
299
|
+
grip_type: 'palm' | 'pinch' | 'full';
|
|
300
|
+
haptic_feedback: boolean;
|
|
301
|
+
}
|
|
302
|
+
interface ThrowableTrait {
|
|
303
|
+
velocityMultiplier: number;
|
|
304
|
+
enableSpin: boolean;
|
|
305
|
+
gravityScale: number;
|
|
306
|
+
}
|
|
307
|
+
interface PointableTrait {
|
|
308
|
+
maxPointDistance: number;
|
|
309
|
+
interactionRadius: number;
|
|
310
|
+
hapticFeedback: boolean;
|
|
311
|
+
}
|
|
312
|
+
interface HoverableTrait {
|
|
313
|
+
hoverDistance: number;
|
|
314
|
+
hoverColor: Color;
|
|
315
|
+
hoverScale: number;
|
|
316
|
+
enableHighlight: boolean;
|
|
317
|
+
}
|
|
318
|
+
interface ScalableTrait {
|
|
319
|
+
minScale: number;
|
|
320
|
+
maxScale: number;
|
|
321
|
+
scaleSpeed: number;
|
|
322
|
+
}
|
|
323
|
+
interface RotatableTrait {
|
|
324
|
+
rotationSpeed: number;
|
|
325
|
+
freeRotation: boolean;
|
|
326
|
+
snapAngles?: number[];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export type { ASTNode as A, ExecutionResult as B, ConnectionNode as C, Duration as D, ExportNode as E, ForLoopNode as F, GestureData as G, HologramShape as H, ImportNode as I, HoloScriptValue as J, ParticleSystem as K, SecurityConfig as L, MethodNode as M, RuntimeSecurityLimits as N, OrbNode as O, Position2D as P, Animation as Q, RotatableTrait as R, SpatialPosition as S, TransformationNode as T, UI2DNode as U, VoiceCommand as V, WhileLoopNode as W, Size2D as a, HologramProperties as b, GestureType as c, HandType as d, ParameterNode as e, GateNode as f, StreamNode as g, GenericASTNode as h, Vector3 as i, Vector2 as j, Color as k, Transform as l, VRHand as m, ThrowVelocity as n, CollisionEvent as o, GrabbableTrait as p, ThrowableTrait as q, PointableTrait as r, HoverableTrait as s, ScalableTrait as t, ForEachLoopNode as u, ImportLoader as v, VariableDeclarationNode as w, UIElementType as x, UIStyle as y, RuntimeContext as z };
|