@kayelaa/canvas 0.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.
@@ -0,0 +1,2267 @@
1
+ /**
2
+ * @fileoverview High-level 2D Canvas Engine (DOM-like, named entities/scenes)
3
+ */
4
+ type Listener<T extends any[] = any[]> = (...args: T) => void;
5
+ /**
6
+ * Generic event emitter with typed events and methods similar to Node.js EventEmitter.
7
+ *
8
+ * @template Events - Record mapping event names to argument tuples
9
+ *
10
+ * @example
11
+ * const emitter = new LeaEventEmitter<{
12
+ * update: [number];
13
+ * error: [Error];
14
+ * }>();
15
+ *
16
+ * emitter.on('update', (delta) => console.log(delta));
17
+ * emitter.emit('update', 0.016);
18
+ */
19
+ declare class LeaEventEmitter<Events extends Record<string, any[]>> {
20
+ #private;
21
+ constructor();
22
+ /**
23
+ * Registers a listener for the specified event.
24
+ *
25
+ * @template K - Event name
26
+ * @param event - The name of the event
27
+ * @param listener - The callback to invoke when the event is emitted
28
+ * @returns This emitter for chaining
29
+ */
30
+ on<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
31
+ /**
32
+ * Registers a one-time listener for the specified event.
33
+ *
34
+ * The listener is automatically removed after the first invocation.
35
+ *
36
+ * @template K - Event name
37
+ * @param event - The name of the event
38
+ * @param listener - The callback to invoke once
39
+ * @returns This emitter for chaining
40
+ */
41
+ once<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
42
+ /**
43
+ * Removes a listener for the specified event.
44
+ *
45
+ * @template K - Event name
46
+ * @param event - The name of the event
47
+ * @param listener - The callback to remove
48
+ * @returns This emitter for chaining
49
+ */
50
+ off<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void): this;
51
+ /**
52
+ * Emits an event, invoking all registered listeners with the provided arguments.
53
+ *
54
+ * If the event is `"error"` and no listeners are registered, the first argument (the error)
55
+ * will be thrown.
56
+ *
57
+ * @template K - Event name
58
+ * @param event - The name of the event to emit
59
+ * @param args - Arguments to pass to listeners
60
+ * @returns `true` if any listeners were invoked, `false` otherwise
61
+ */
62
+ emit<K extends keyof Events>(event: K, ...args: Events[K]): boolean;
63
+ /**
64
+ * Removes all listeners for the specified event, or all listeners if no event is provided.
65
+ *
66
+ * @template K - Event name
67
+ * @param event - Optional event name to clear listeners for
68
+ * @returns This emitter for chaining
69
+ */
70
+ removeAllListeners<K extends keyof Events>(event?: K): this;
71
+ /**
72
+ * Returns the number of listeners registered for the specified event.
73
+ *
74
+ * @template K - Event name
75
+ * @param event - The event to count listeners for
76
+ * @returns The number of registered listeners
77
+ */
78
+ listenerCount<K extends keyof Events>(event: K): number;
79
+ }
80
+ /**
81
+ * Canvas-based renderer that manages a 2D drawing context and emits a `"draw"` event each frame.
82
+ *
83
+ * Handles resolution scaling (viewport vs camera), automatic clearing, and RAF loop.
84
+ *
85
+ * @extends LeaEventEmitter<{ draw: [CanvasRenderingContext2D] }>
86
+ *
87
+ * @example
88
+ * const renderer = new LeaRendererII(canvas, { viewportWidth: 800, viewportHeight: 600 });
89
+ * renderer.on("draw", (ctx) => {
90
+ * ctx.fillStyle = "black";
91
+ * ctx.fillRect(0, 0, renderer.viewportWidth, renderer.viewportHeight);
92
+ * });
93
+ * renderer.start();
94
+ */
95
+ declare class LeaRendererII extends LeaEventEmitter<{
96
+ draw: [CanvasRenderingContext2D];
97
+ }> {
98
+ #private;
99
+ /**
100
+ * The target canvas element.
101
+ */
102
+ canvas: HTMLCanvasElement;
103
+ /**
104
+ * The 2D rendering context.
105
+ */
106
+ ctx: CanvasRenderingContext2D;
107
+ /**
108
+ * Whether the renderer is currently running (RAF loop active).
109
+ */
110
+ running: boolean;
111
+ private _rafId;
112
+ private _fps;
113
+ private _frameCount;
114
+ private _fpsTimer;
115
+ private _lastFrameTime;
116
+ constructor(canvas: HTMLCanvasElement, { viewportWidth, viewportHeight, cameraWidth, cameraHeight, }?: {
117
+ viewportWidth?: number;
118
+ viewportHeight?: number;
119
+ cameraWidth?: number;
120
+ cameraHeight?: number;
121
+ });
122
+ automatic: boolean;
123
+ retransform(): void;
124
+ /**
125
+ * The logical viewport width (game coordinate space).
126
+ */
127
+ get viewportWidth(): number;
128
+ set viewportWidth(v: number);
129
+ get width(): number;
130
+ get height(): number;
131
+ /**
132
+ * Center X of the viewport (viewportWidth / 2).
133
+ */
134
+ get centerX(): number;
135
+ /**
136
+ * Center Y of the viewport (viewportHeight / 2).
137
+ */
138
+ get centerY(): number;
139
+ get left(): number;
140
+ get top(): number;
141
+ get right(): number;
142
+ get bottom(): number;
143
+ /**
144
+ * The logical viewport height (game coordinate space).
145
+ */
146
+ get viewportHeight(): number;
147
+ set viewportHeight(v: number);
148
+ /**
149
+ * The camera/pixel resolution width (canvas backing resolution).
150
+ */
151
+ get cameraWidth(): number;
152
+ set cameraWidth(v: number);
153
+ /**
154
+ * The camera/pixel resolution height (canvas backing resolution).
155
+ */
156
+ get cameraHeight(): number;
157
+ set cameraHeight(v: number);
158
+ /**
159
+ * Update canvas resolution to match camera
160
+ * Units remain the same
161
+ */
162
+ updateCanvasResolution(): void;
163
+ /**
164
+ * Apply viewport → canvas transform
165
+ * Scale computed dynamically each frame
166
+ */
167
+ applyTransform(): void;
168
+ /**
169
+ * Current measured FPS (updated every second).
170
+ */
171
+ get FPS(): number;
172
+ private _loop;
173
+ update(): void;
174
+ /**
175
+ * Starts the RAF loop and begins emitting `"draw"` events.
176
+ *
177
+ * @throws If called in a non-browser environment or RAF is unavailable
178
+ */
179
+ start(): void;
180
+ /**
181
+ * Stops the RAF loop and halts drawing.
182
+ *
183
+ * @throws If called in a non-browser environment or RAF is unavailable
184
+ */
185
+ stop(): void;
186
+ }
187
+ /**
188
+ * Fixed or variable timestep ticker that emits a `"tick"` event with delta time (seconds).
189
+ *
190
+ * Supports RAF mode (`tickInterval = Infinity`) or fixed interval.
191
+ *
192
+ * @extends LeaEventEmitter<{ tick: [number]; error: [unknown] }>
193
+ *
194
+ * @example
195
+ * const ticker = new LeaTickerII(1000 / 60); // 60 Hz
196
+ * ticker.on("tick", (delta) => {
197
+ * // update game state
198
+ * });
199
+ * ticker.start();
200
+ */
201
+ declare class LeaTickerII extends LeaEventEmitter<{
202
+ tick: [number];
203
+ error: [unknown];
204
+ }> {
205
+ #private;
206
+ setNow(now: number): void;
207
+ /**
208
+ * @type {NodeJS.Timeout}
209
+ */
210
+ private __intervalId;
211
+ private __lastTime;
212
+ /**
213
+ * @param tickInterval Interval in ms
214
+ */
215
+ constructor(tickInterval?: number);
216
+ /**
217
+ * Speed multiplier for delta time (for slow-motion / fast-forward).
218
+ */
219
+ speedHackDT: number;
220
+ /**
221
+ * Whether the ticker is using requestAnimationFrame (RAF) mode.
222
+ */
223
+ get isRaf(): boolean;
224
+ /**
225
+ * Tick interval in milliseconds.
226
+ * - Finite number = fixed timestep
227
+ * - `Infinity` = RAF / variable timestep
228
+ */
229
+ get tickInterval(): number;
230
+ set tickInterval(s: number);
231
+ /**
232
+ * Current time in milliseconds (monotonic).
233
+ */
234
+ now(): number;
235
+ private __tick;
236
+ /**
237
+ *
238
+ * @param {number} ms
239
+ * @returns
240
+ */
241
+ createTimeout(ms: number): LeaTimeout;
242
+ createTween(config: ConstructorParameters<typeof DeltaTweenII>[0], callback?: (change: number) => void): DeltaTweenII;
243
+ /**
244
+ * Starts the ticker loop.
245
+ */
246
+ start(): void;
247
+ /**
248
+ * Stops the ticker loop.
249
+ */
250
+ stop(): void;
251
+ /**
252
+ *
253
+ * @param {number} ms
254
+ * @param {number} offset
255
+ * @returns {number}
256
+ */
257
+ getSineMod(ms: number, offset?: number): number;
258
+ }
259
+ type LeaEntitySerializerEach<T extends Record<string, any>, K extends keyof T = keyof T> = [
260
+ K,
261
+ {
262
+ mapExport?: (value: T[K]) => any;
263
+ mapImport?: (value: any) => T[K];
264
+ }
265
+ ];
266
+ type LeaEntitySerializer<T extends Record<string, any>> = {
267
+ [K in keyof T]: LeaEntitySerializerEach<T, K>;
268
+ }[keyof T][];
269
+ type LeaEntitySerializerArray<T extends Record<string, any>> = {
270
+ [K in keyof T]: LeaEntitySerializerEach<T, K>;
271
+ }[keyof T][];
272
+ type OrderedLeaEntitySerializer<T extends Record<string, any>, FirstKeys extends (keyof T)[]> = [
273
+ ...{
274
+ [I in keyof FirstKeys]: LeaEntitySerializerEach<T, FirstKeys[I]>;
275
+ },
276
+ ...LeaEntitySerializerArray<T>
277
+ ];
278
+ declare namespace LeaSerializers {
279
+ function booleanExport(a: boolean): 0 | 1;
280
+ function booleanImport(a: 0 | 1): boolean;
281
+ function vec2Export(vec: Vector2): string;
282
+ function vec2Import(str: string): Vector2;
283
+ const booleanMap: {
284
+ mapExport: typeof booleanExport;
285
+ mapImport: typeof booleanImport;
286
+ };
287
+ function createRounder(maxDecimals: number): (num: number) => number;
288
+ function createLowPrecision(base?: number): {
289
+ mapExport(num: number): number;
290
+ mapImport(num: number): number;
291
+ };
292
+ function lightWeightRounder(n: number): number;
293
+ function createPercent(exportedMax?: number): {
294
+ mapExport(n: number): number;
295
+ mapImport(n: number): number;
296
+ };
297
+ function createLookup<T extends Record<string, any>>(record: T): {
298
+ mapExport: (key: string) => any;
299
+ mapImport: (value: any) => any;
300
+ };
301
+ function radToDeg(rad: number): number;
302
+ function degToRad(deg: number): number;
303
+ const angleRadToDeg: {
304
+ mapExport: typeof radToDeg;
305
+ mapImport: typeof degToRad;
306
+ };
307
+ function createLowPrecisionRadToDeg(base?: number): {
308
+ mapExport(n: number): number;
309
+ mapImport(n: number): number;
310
+ };
311
+ }
312
+ /**
313
+ * Abstract base class for all entities in a LEA scene.
314
+ *
315
+ * Provides event emission (`update`, `draw`, `error`), position, name, and z-order.
316
+ *
317
+ * @extends LeaEventEmitter<{ update: [number]; draw: [CanvasRenderingContext2D]; error: [unknown] }>
318
+ */
319
+ declare abstract class LeaEntityII extends LeaEventEmitter<{
320
+ update: [number];
321
+ error: [unknown];
322
+ draw: [CanvasRenderingContext2D];
323
+ }> {
324
+ /**
325
+ * Unique name of the entity (used for lookup and serialization).
326
+ */
327
+ name: string;
328
+ /**
329
+ * @type {number}
330
+ */
331
+ scaleRotate: number;
332
+ /**
333
+ * @type {number}
334
+ */
335
+ scale: number;
336
+ /**
337
+ * @param {string} name
338
+ * @param {number} [x]
339
+ * @param {number} [y]
340
+ */
341
+ constructor(name: string, x?: number, y?: number);
342
+ arraySerializeMap?: LeaEntitySerializer<any>;
343
+ autoTranslate: boolean;
344
+ /**
345
+ * Z-order for draw sorting (higher = drawn later / on top).
346
+ */
347
+ z: number;
348
+ private ___pos;
349
+ /**
350
+ * @type {(keyof this)[]}
351
+ */
352
+ nonSerializableProperties: (keyof this)[];
353
+ /**
354
+ * @type {(keyof this)[]}
355
+ */
356
+ forceSerializableProperties: (keyof this)[];
357
+ /**
358
+ * Current position (center point).
359
+ */
360
+ get pos(): Vector2;
361
+ /**
362
+ * X coordinate (center).
363
+ */
364
+ get x(): number;
365
+ /**
366
+ * Y coordinate (center).
367
+ */
368
+ get y(): number;
369
+ set x(s: number);
370
+ set y(s: number);
371
+ /**
372
+ * Update entity.
373
+ */
374
+ handleUpdate(delta: number): void;
375
+ /**
376
+ * Called once per tick with delta time (seconds).
377
+ *
378
+ * @param delta - Time since last tick in seconds
379
+ */
380
+ abstract update(_delta: number): void;
381
+ /**
382
+ * Draw entity.
383
+ */
384
+ handleDraw(ctx: CanvasRenderingContext2D): void;
385
+ /**
386
+ * Called once per frame to draw the entity.
387
+ *
388
+ * The context is already translated to the entity's position if `autoTranslate` is true.
389
+ *
390
+ * @param ctx - The 2D rendering context
391
+ */
392
+ abstract draw?(ctx: CanvasRenderingContext2D): void;
393
+ /**
394
+ * Serializes the entity to a plain object (for save/load).
395
+ *
396
+ * Excludes internal properties and respects `nonSerializableProperties`.
397
+ *
398
+ * @returns Serializable data
399
+ */
400
+ serialize(): any;
401
+ /**
402
+ * Converts a world position to local space relative to this entity.
403
+ *
404
+ * @param worldVec - World position
405
+ * @returns Local position
406
+ */
407
+ toLocal(worldVec: Vector2): Vector2;
408
+ /**
409
+ * Converts a local position to world space.
410
+ *
411
+ * @param localVec - Local position
412
+ * @returns World position
413
+ */
414
+ toWorld(localVec: Vector2): Vector2;
415
+ deserializeArray(snapshot: any[]): any;
416
+ static deserializeArray(map: LeaEntityII["arraySerializeMap"], snapshot: any[]): any;
417
+ }
418
+ /**
419
+ * Container for a collection of entities, handling update/draw loops and z-order sorting.
420
+ *
421
+ * @extends LeaEventEmitter<{ update: [number]; draw: [CanvasRenderingContext2D] }>
422
+ */
423
+ declare class LeaSceneII extends LeaEventEmitter<{
424
+ update: [number];
425
+ draw: [CanvasRenderingContext2D];
426
+ }> {
427
+ /**
428
+ * Unique name of the scene.
429
+ */
430
+ name: string;
431
+ /**
432
+ * Map of entities by name.
433
+ */
434
+ entities: Map<string, LeaEntityII>;
435
+ /**
436
+ * Whether updates and drawing are paused.
437
+ */
438
+ paused: boolean;
439
+ constructor(name: string);
440
+ /**
441
+ * Updates all non-paused entities in the scene.
442
+ *
443
+ * @param delta - Time since last update in seconds
444
+ */
445
+ handleUpdate(delta: number): void;
446
+ /**
447
+ * Draws all entities in z-order (higher z = drawn later).
448
+ *
449
+ * @param ctx - The 2D rendering context
450
+ */
451
+ handleDraw(ctx: CanvasRenderingContext2D): void;
452
+ /**
453
+ * Adds an entity to the scene.
454
+ *
455
+ * @param entity - The entity to add
456
+ * @throws If the entity has no name
457
+ */
458
+ addEntity(entity: any): void;
459
+ /**
460
+ * Removes an entity from the scene by name.
461
+ *
462
+ * @param entity - The entity to remove
463
+ */
464
+ removeEntity(entity: any): void;
465
+ /**
466
+ * Retrieves an entity by name.
467
+ *
468
+ * @param name - The name of the entity
469
+ * @returns The entity, or undefined if not found
470
+ */
471
+ getEntity(name: string): LeaEntityII;
472
+ }
473
+ /**
474
+ * Top-level game manager that owns scenes and a shared ticker.
475
+ *
476
+ * Coordinates updates across all scenes and provides viewport utilities.
477
+ */
478
+ declare class LeaGameII {
479
+ /**
480
+ * Map of scenes by name.
481
+ */
482
+ scenes: Map<string, LeaSceneII>;
483
+ /**
484
+ * The shared ticker driving updates.
485
+ */
486
+ ticker: LeaTickerII;
487
+ /**
488
+ * Center X of the viewport (width / 2).
489
+ */
490
+ get centerX(): number;
491
+ /**
492
+ * Center Y of the viewport (height / 2).
493
+ */
494
+ get centerY(): number;
495
+ get left(): number;
496
+ get top(): number;
497
+ get right(): number;
498
+ get bottom(): number;
499
+ /**
500
+ * Logical viewport width.
501
+ */
502
+ width: number;
503
+ /**
504
+ * Logical viewport height.
505
+ */
506
+ height: number;
507
+ /**
508
+ * @param {number} width
509
+ * @param {number} height
510
+ * @param {number} tickInterval
511
+ */
512
+ constructor(width: number, height: number, tickInterval?: number);
513
+ /**
514
+ * Adds a scene to the game.
515
+ *
516
+ * @param scene - The scene to add
517
+ * @throws If the scene has no name
518
+ */
519
+ addScene(scene: LeaSceneII): void;
520
+ /**
521
+ * Removes a scene from the game.
522
+ *
523
+ * @param scene - The scene to remove
524
+ */
525
+ removeScene(scene: LeaSceneII): void;
526
+ /**
527
+ * Current time in milliseconds (from ticker).
528
+ */
529
+ now(): number;
530
+ /**
531
+ * Starts the ticker loop (begins emitting "tick" events).
532
+ */
533
+ start(): void;
534
+ /**
535
+ * Stops the ticker loop.
536
+ */
537
+ stop(): void;
538
+ }
539
+ /**
540
+ * @fileoverview Basic math & easing utilities
541
+ */
542
+ declare const LeaUtilsII: {
543
+ /**
544
+ * Linear interpolation
545
+ *
546
+ * @param {number} a Start value
547
+ * @param {number} b End value
548
+ * @param {number} t Progress (0–1)
549
+ * @returns {number}
550
+ */
551
+ lerp(a: number, b: number, t: number): number;
552
+ /**
553
+ * Clamp a value between min and max
554
+ *
555
+ * @param {number} v
556
+ * @param {number} min
557
+ * @param {number} max
558
+ * @returns {number}
559
+ */
560
+ clamp(v: number, min: number, max: number): number;
561
+ /**
562
+ * Clamp a value between 0 and 1
563
+ *
564
+ * @param {number} v
565
+ * @returns {number}
566
+ */
567
+ clamp01(v: number): number;
568
+ /**
569
+ * Linear easing
570
+ *
571
+ * @param {number} t
572
+ * @returns {number}
573
+ */
574
+ easeLinear(t: number): number;
575
+ /**
576
+ * Quadratic ease-in
577
+ *
578
+ * @param {number} t
579
+ * @returns {number}
580
+ */
581
+ easeInQuad(t: number): number;
582
+ /**
583
+ * Quadratic ease-out
584
+ *
585
+ * @param {number} t
586
+ * @returns {number}
587
+ */
588
+ easeOutQuad(t: number): number;
589
+ /**
590
+ * Quadratic ease-in-out
591
+ *
592
+ * @param {number} t
593
+ * @returns {number}
594
+ */
595
+ easeInOutQuad(t: number): number;
596
+ /**
597
+ * Sine ease-in
598
+ *
599
+ * @param {number} t
600
+ * @returns {number}
601
+ */
602
+ easeInSine(t: number): number;
603
+ /**
604
+ * Sine ease-out
605
+ *
606
+ * @param {number} t
607
+ * @returns {number}
608
+ */
609
+ easeOutSine(t: number): number;
610
+ /**
611
+ * Sine ease-in-out
612
+ *
613
+ * @param {number} t
614
+ * @returns {number}
615
+ */
616
+ easeInOutSine(t: number): number;
617
+ /**
618
+ * Expo ease-in
619
+ *
620
+ * @param {number} t
621
+ * @returns {number}
622
+ */
623
+ easeInExpo(t: number): number;
624
+ /**
625
+ * Expo ease-out
626
+ *
627
+ * @param {number} t
628
+ * @returns {number}
629
+ */
630
+ easeOutExpo(t: number): number;
631
+ /**
632
+ * Expo ease-in-out
633
+ *
634
+ * @param {number} t
635
+ * @returns {number}
636
+ */
637
+ easeInOutExpo(t: number): number;
638
+ /**
639
+ * Smoothstep easing
640
+ *
641
+ * @param {number} t
642
+ * @returns {number}
643
+ */
644
+ smoothstep(t: number): number;
645
+ /**
646
+ *
647
+ * @param {number} a
648
+ * @param {number} b
649
+ */
650
+ randomLerp(a: number, b: number): number;
651
+ /**
652
+ *
653
+ * @param {number} a
654
+ * @param {number} b
655
+ * @returns
656
+ */
657
+ randomInt(a: number, b: number): number;
658
+ /**
659
+ * @template T
660
+ * @param {T[]} arr
661
+ * @returns {T}
662
+ */
663
+ randomArrayValue<T>(arr: T[]): T;
664
+ /**
665
+ * Create a real cubic-bezier easing function
666
+ * (same behavior as CSS cubic-bezier)
667
+ *
668
+ * @param {number} x1
669
+ * @param {number} y1
670
+ * @param {number} x2
671
+ * @param {number} y2
672
+ * @returns {(t:number)=>number}
673
+ */
674
+ createBezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
675
+ /**
676
+ *
677
+ * @param {...number} values
678
+ * @returns
679
+ */
680
+ lengthSquared(...values: number[]): number;
681
+ /**
682
+ * Normalize an angle in radians to [0, 2π)
683
+ * @param {number} rad
684
+ * @returns {number}
685
+ */
686
+ normalizeRad(rad: number): number;
687
+ /**
688
+ * Convert a Y-down canvas angle to standard mathematical radian coordinates (Y-up)
689
+ * @param {number} rad
690
+ * @returns {number}
691
+ */
692
+ angleInvertY(rad: number): number;
693
+ /**
694
+ * Convert degrees to radians, flipping Y-axis for canvas (top-left origin)
695
+ * @param {number} deg
696
+ * @returns {number}
697
+ */
698
+ degToRadFlipY(deg: number): number;
699
+ /**
700
+ * Determines the **minimal angular rotation direction** along a unit circle
701
+ * Returns 1 if clockwise is the shorter path, -1 if counter-clockwise is shorter
702
+ * @param {number} fromRad - starting angle in radians
703
+ * @param {number} toRad - target angle in radians
704
+ * @returns {1 | -1}
705
+ */
706
+ minimalAngularDirection(fromRad: number, toRad: number): 1 | -1;
707
+ };
708
+ /**
709
+ * @fileoverview Delta-based tween for a single numeric change
710
+ */
711
+ declare class DeltaTweenII extends LeaEventEmitter<{
712
+ delta: number[];
713
+ finish: void[];
714
+ }> {
715
+ constructor({ delta, ms, easing, }: {
716
+ delta: number;
717
+ ms: number;
718
+ easing?: (t: number) => number;
719
+ });
720
+ delta: number;
721
+ duration: number;
722
+ elapsed: number;
723
+ lastValue: number;
724
+ finished: boolean;
725
+ easing: (t: number) => number;
726
+ /**
727
+ * Advance tween by delta time
728
+ */
729
+ update(delta: number): void;
730
+ }
731
+ /**
732
+ * Rectangular entity with centered position, width, height, and basic AABB collision.
733
+ *
734
+ * Automatically handles translation and rotation for drawing if needed.
735
+ *
736
+ * @extends LeaEntityII
737
+ */
738
+ declare abstract class RectLeaEntity extends LeaEntityII {
739
+ /**
740
+ * @param {string} name
741
+ * @param {number} x Center X
742
+ * @param {number} y Center Y
743
+ * @param {number} width
744
+ * @param {number} height
745
+ */
746
+ constructor(name: string, x?: number, y?: number, width?: number, height?: number);
747
+ /**
748
+ * Width of the rectangle (centered on x).
749
+ */
750
+ width: number;
751
+ /**
752
+ * Height of the rectangle (centered on y).
753
+ */
754
+ height: number;
755
+ /**
756
+ * Left edge of the bounding box.
757
+ */
758
+ get left(): number;
759
+ set left(val: number);
760
+ /**
761
+ * Right edge of the bounding box.
762
+ */
763
+ get right(): number;
764
+ set right(val: number);
765
+ /**
766
+ * Top edge of the bounding box.
767
+ */
768
+ get top(): number;
769
+ set top(val: number);
770
+ /**
771
+ * Bottom edge of the bounding box.
772
+ */
773
+ get bottom(): number;
774
+ set bottom(val: number);
775
+ get lx(): number;
776
+ get ly(): number;
777
+ get lleft(): number;
778
+ get lright(): number;
779
+ get ltop(): number;
780
+ get lbottom(): number;
781
+ /**
782
+ * Checks for axis-aligned bounding box collision with another rectangular entity.
783
+ *
784
+ * @param other - The other entity to check against
785
+ * @returns `true` if the bounding boxes overlap
786
+ */
787
+ isCollidingWith(other: RectLeaEntity): boolean;
788
+ /**
789
+ * Default fill color for the rectangle (used in base draw implementation).
790
+ */
791
+ color: string;
792
+ abstract update(_delta: number): void;
793
+ /**
794
+ * Draws a filled rectangle centered on the entity's position.
795
+ *
796
+ * Subclasses should override or call `super.draw(ctx)` if extending.
797
+ *
798
+ * @param ctx - The 2D rendering context
799
+ */
800
+ draw(ctx: CanvasRenderingContext2D): void;
801
+ }
802
+ declare class LeaTimeout extends LeaEventEmitter<{
803
+ finish: [void];
804
+ }> {
805
+ duration: number;
806
+ ticker: LeaTickerII;
807
+ elapsed: number;
808
+ finished: boolean;
809
+ _resolve: (value?: unknown) => void;
810
+ promise: Promise<unknown>;
811
+ _timeoutId: NodeJS.Timeout;
812
+ /**
813
+ * @param {number} duration Duration in milliseconds
814
+ * @param {LeaTickerII} ticker Optional ticker to drive the timeout
815
+ */
816
+ constructor(duration: number, ticker?: LeaTickerII);
817
+ update(delta?: number): void;
818
+ finish(): void;
819
+ /**
820
+ * Start the timeout manually if no ticker is provided
821
+ */
822
+ start(): this;
823
+ /**
824
+ * Cancel the timeout
825
+ */
826
+ cancel(): void;
827
+ then<TResult1 = unknown, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
828
+ /**
829
+ * @type {Promise<void>['then']}
830
+ */
831
+ after<TResult1 = unknown, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
832
+ }
833
+ /**
834
+ * 2D Vector class similar to Godot's Vector2
835
+ */
836
+ declare class Vector2 {
837
+ /**
838
+ * Creates a new Vector2
839
+ * @param {number} x
840
+ * @param {number} y
841
+ */
842
+ constructor(x?: number, y?: number);
843
+ x: number;
844
+ y: number;
845
+ toJSON(): {
846
+ x: number;
847
+ y: number;
848
+ vec2: boolean;
849
+ };
850
+ /**
851
+ *
852
+ * @param {any} data
853
+ */
854
+ static isVec2(data: any): boolean;
855
+ /**
856
+ *
857
+ * @param {any} data
858
+ */
859
+ static fromSerialized(data: any): Vector2;
860
+ /**
861
+ * Rotate vector by angle (radians) around origin
862
+ * @param {number} angle
863
+ */
864
+ rotate(angle: number): Vector2;
865
+ /**
866
+ * Returns a new Vector2 representing a unit vector pointing in the given angle (radians)
867
+ * @param {number} rad
868
+ * @returns {Vector2}
869
+ */
870
+ static from(rad: number): Vector2;
871
+ /**
872
+ * Returns the angle of the vector relative to the positive X-axis in radians
873
+ * @returns {number}
874
+ */
875
+ get angle(): number;
876
+ /**
877
+ * Returns the length (magnitude) of the vector
878
+ * @returns {number}
879
+ */
880
+ get length(): number;
881
+ /**
882
+ * Returns the squared length (more efficient)
883
+ * @returns {number}
884
+ */
885
+ get lengthSquared(): number;
886
+ /**
887
+ * Returns a normalized vector (length = 1)
888
+ * @returns {Vector2}
889
+ */
890
+ normalized(): Vector2;
891
+ project(other: Vector2): Vector2;
892
+ /**
893
+ * Reflects a normalized vector (length = 1)
894
+ * @returns {Vector2}
895
+ */
896
+ reflect(normal: Vector2): Vector2;
897
+ /**
898
+ * Alignment
899
+ * Dot product with another vector (normalized)
900
+ * @param {Vector2} other
901
+ * @returns {number} -1 .. 1 if vectors are normalized
902
+ */
903
+ dotNormalized(other: Vector2): number;
904
+ /**
905
+ *
906
+ * @param {Vector2} other
907
+ * @returns
908
+ */
909
+ lengthSquaredTo(other: Vector2): number;
910
+ /**
911
+ * Projection
912
+ * True dot product including magnitude
913
+ * @param {Vector2} other
914
+ * @returns {number}
915
+ */
916
+ dot(other: Vector2): number;
917
+ /**
918
+ * Distance to another vector
919
+ * @param {Vector2} other
920
+ * @returns {number}
921
+ */
922
+ distanceTo(other: Vector2): number;
923
+ /**
924
+ * Distance to another vector
925
+ * @param {Vector2} other
926
+ * @returns {number}
927
+ */
928
+ distanceToCheap(other: Vector2): number;
929
+ /**
930
+ * Returns a vector pointing from this vector to another
931
+ * @param {Vector2} other
932
+ * @returns {Vector2}
933
+ */
934
+ directionTo(other: Vector2): Vector2;
935
+ /**
936
+ * Adds another vector
937
+ * @param {Vector2} other
938
+ * @returns {Vector2}
939
+ */
940
+ add(other: Vector2): Vector2;
941
+ /**
942
+ * Adds another vector
943
+ * @param {number} raw
944
+ * @returns {Vector2}
945
+ */
946
+ addRaw(raw: number): Vector2;
947
+ /**
948
+ * Overwrite instance
949
+ * @param {Vector2} newVec
950
+ */
951
+ overwite(newVec: Vector2): void;
952
+ /**
953
+ * Subtracts another vector
954
+ * @param {Vector2} other
955
+ * @returns {Vector2}
956
+ */
957
+ subtract(other: Vector2): Vector2;
958
+ /**
959
+ * Scales the vector by a scalar
960
+ * @param {number} scalar
961
+ * @returns {Vector2}
962
+ */
963
+ scale(scalar: number): Vector2;
964
+ /**
965
+ * Returns a string representation
966
+ * @returns {string}
967
+ */
968
+ toString(): string;
969
+ /**
970
+ * Clones a vector.
971
+ * @returns {Vector2}
972
+ */
973
+ clone(): Vector2;
974
+ }
975
+ /**
976
+ *
977
+ * @param {string} col
978
+ */
979
+ declare function getNormalizedColor(col: string): {
980
+ r: number;
981
+ g: number;
982
+ b: number;
983
+ a: number;
984
+ };
985
+ /**
986
+ *
987
+ * @param {{ r: number; g: number; b: number; a:number }} col
988
+ */
989
+ declare function colToRGBA(col: {
990
+ r: number;
991
+ g: number;
992
+ b: number;
993
+ a: number;
994
+ }): string;
995
+ /**
996
+ * Extract numeric RGBA from ctx.fillStyle
997
+ * Supports hex (#rgb, #rrggbb) and rgb(a)
998
+ * @param {string} fillStyle
999
+ * @returns {{r:number, g:number, b:number, a:number}}
1000
+ */
1001
+ declare function parseFillStyle(fillStyle: string): {
1002
+ r: number;
1003
+ g: number;
1004
+ b: number;
1005
+ a: number;
1006
+ };
1007
+ /**
1008
+ *
1009
+ * @param {string} str
1010
+ * @param {{ r?: number; g?: number; b?: number; a?: number }} param1
1011
+ * @returns {string}
1012
+ */
1013
+ declare function editRGBA(str: string, { r, g, b, a }?: {
1014
+ r?: number;
1015
+ g?: number;
1016
+ b?: number;
1017
+ a?: number;
1018
+ }): string;
1019
+ /**
1020
+ * Scales a 2D coordinate relative to an origin.
1021
+ *
1022
+ * @param {number} absoluteCoord - The original coordinate.
1023
+ * @param {number} scale - The scale factor.
1024
+ * @param {number} origin - The origin point for scaling.
1025
+ * @returns {number} - The new scaled coordinate.
1026
+ */
1027
+ declare function scaleCoord(absoluteCoord: number, scale: number, origin: number): number;
1028
+ declare function getEnvironment(): "web" | "node" | "unknown";
1029
+ declare const ENVIRONMENT: "web" | "node" | "unknown";
1030
+ declare const isNode: boolean;
1031
+ declare const isWeb: boolean;
1032
+ declare class LiaAudio {
1033
+ static unlock(): void;
1034
+ /**
1035
+ * @type {AudioContext}
1036
+ */
1037
+ static audioCtx: AudioContext;
1038
+ static masterGain: GainNode;
1039
+ static musicGain: GainNode;
1040
+ static sfxGain: GainNode;
1041
+ static get SFX_VOLUME(): number;
1042
+ static get MUSIC_VOLUME(): number;
1043
+ static get VOLUME(): number;
1044
+ static set SFX_VOLUME(n: number);
1045
+ static set MUSIC_VOLUME(n: number);
1046
+ static set VOLUME(n: number);
1047
+ /**
1048
+ *
1049
+ * @param {number} note
1050
+ * @returns
1051
+ */
1052
+ static noteToHz(note: number): number;
1053
+ static tuningFreq: number;
1054
+ /**
1055
+ * @type {Map<string, AudioBuffer>}
1056
+ */
1057
+ static audioBufferCache: Map<string, AudioBuffer>;
1058
+ /**
1059
+ * @type {Map<number, { source: LiaAudioSrc, gain: GainNode }>}
1060
+ */
1061
+ static loops: Map<number, {
1062
+ source: LiaAudioSrc;
1063
+ gain: GainNode;
1064
+ }>;
1065
+ /**
1066
+ * @type {Map<string, { source: LiaAudioSrc, gain: GainNode }>}
1067
+ */
1068
+ static sfsx: Map<string, {
1069
+ source: LiaAudioSrc;
1070
+ gain: GainNode;
1071
+ }>;
1072
+ static loopIdCounter: number;
1073
+ static CACHE_NAME: string;
1074
+ /**
1075
+ * Preload and decode audio buffer
1076
+ * @param {string} path
1077
+ * @returns {Promise<AudioBuffer>}
1078
+ */
1079
+ static preLoad(path: string): Promise<AudioBuffer>;
1080
+ /**
1081
+ * @param {string} path
1082
+ * @returns {Promise<Response>}
1083
+ */
1084
+ static getOnlyDownloadedCache(path: string): Promise<Response>;
1085
+ /**
1086
+ * Get AudioBuffer (returns null if not yet loaded)
1087
+ * @param {string} path
1088
+ * @returns {AudioBuffer|null}
1089
+ */
1090
+ static getCached(path: string): AudioBuffer | null;
1091
+ /**
1092
+ * Play SFX once with optional volume
1093
+ * @param {string} path
1094
+ * @param {number} volume
1095
+ * @param {number | null} speed default to random
1096
+ */
1097
+ static playSound(path: string, volume?: number, speed?: number | null, override?: boolean): Promise<void>;
1098
+ /**
1099
+ * Play looping SFX and return loop id
1100
+ * @param {string} path
1101
+ * @param {number} volume
1102
+ * @param {Object} [param2={}]
1103
+ * @param {number} [param2.loopStart=0]
1104
+ * @param {null | number} [param2.loopEnd=null]
1105
+ * @param {boolean} [param2.exclusive=true]
1106
+ * @param {number} [param2.skipMS=0]
1107
+ * @returns {Promise<number | undefined>}
1108
+ */
1109
+ static playLoop(path: string, volume?: number, { loopStart, loopEnd, exclusive, skipMS, }?: {
1110
+ loopStart?: number;
1111
+ loopEnd?: null | number;
1112
+ exclusive?: boolean;
1113
+ skipMS?: number;
1114
+ }): Promise<number | undefined>;
1115
+ /**
1116
+ * Stop a loop by id
1117
+ * @param {number} id
1118
+ */
1119
+ static stopLoop(id: number): void;
1120
+ /**
1121
+ * Create a LiaAudioSrc from a file path without playing it.
1122
+ * @param {string} path - audio file path
1123
+ * @param {Object} [options={}]
1124
+ * @param {number} [options.volume=1]
1125
+ * @param {number} [options.speed=1]
1126
+ * @param {boolean} [options.loop=false]
1127
+ * @param {number} [options.loopStart=0]
1128
+ * @param {number|null} [options.loopEnd=null]
1129
+ * @param {boolean} [options.isMusic]
1130
+ * @returns {Promise<LiaAudioSrc|null>}
1131
+ */
1132
+ static createLiaSource(path: string, { volume, speed, loop, loopStart, loopEnd, isMusic, gain: parentGain, }?: {
1133
+ volume?: number;
1134
+ speed?: number;
1135
+ loop?: boolean;
1136
+ loopStart?: number;
1137
+ loopEnd?: number | null;
1138
+ isMusic?: boolean;
1139
+ gain?: GainNode;
1140
+ }): Promise<LiaAudioSrc | null>;
1141
+ }
1142
+ declare const NOTE_NAMES: readonly ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
1143
+ type NOTE_NAME = (typeof NOTE_NAMES)[number];
1144
+ declare function isNote(note: string): note is NOTE_NAME;
1145
+ /**
1146
+ * High-level AudioBufferSourceNode replacement with play/pause, fades, speed, and strict AudioNode interface.
1147
+ * @implements {AudioNode}
1148
+ */
1149
+ declare class LiaAudioSrc {
1150
+ numberOfInputs: number;
1151
+ numberOfOutputs: number;
1152
+ /**
1153
+ * @param {AudioBuffer} buffer
1154
+ * @param {AudioContext} [context=LiaSfx.audioCtx]
1155
+ */
1156
+ constructor(buffer: AudioBuffer, context?: AudioContext);
1157
+ channelCount: number;
1158
+ channelCountMode: string;
1159
+ channelInterpretation: string;
1160
+ onended: () => any;
1161
+ /**
1162
+ * @type {AudioBufferSourceNode|null}
1163
+ */
1164
+ source: AudioBufferSourceNode | null;
1165
+ /**
1166
+ * @type {AudioBuffer}
1167
+ */
1168
+ buffer: AudioBuffer;
1169
+ /**
1170
+ * @type {AudioContext}
1171
+ */
1172
+ context: AudioContext;
1173
+ _createSource(): AudioBufferSourceNode;
1174
+ /**
1175
+ * Start playback
1176
+ * @param {Object} [options]
1177
+ * @param {number} [options.fadeIn=0] - seconds to fade in
1178
+ * @param {number} [options.offset=null] - start offset in seconds
1179
+ */
1180
+ play({ fadeIn, offset, }?: {
1181
+ fadeIn?: number;
1182
+ offset?: number;
1183
+ }): void;
1184
+ /**
1185
+ * Start playback identical to AudioBufferSourceNode.start()
1186
+ * @param {number} [when=0] - seconds from context.currentTime to start
1187
+ * @param {number} [offset=0] - offset in seconds into the buffer
1188
+ * @param {number} [duration] - how long to play in seconds
1189
+ */
1190
+ start(when: number, offset: number, duration: number): void;
1191
+ /**
1192
+ * Pause playback
1193
+ * @param {Object} [options]
1194
+ * @param {number} [options.fadeOut=0] - seconds to fade out
1195
+ */
1196
+ pause({ fadeOut }?: {
1197
+ fadeOut?: number;
1198
+ }): void;
1199
+ /**
1200
+ * Get playback elapsed time in milliseconds
1201
+ * @returns {number}
1202
+ */
1203
+ getElapsed(): number;
1204
+ /**
1205
+ * Set playback speed
1206
+ * @param {number} rate
1207
+ */
1208
+ setSpeed(rate: number): void;
1209
+ /**
1210
+ * Set loop mode
1211
+ * @param {boolean} loop
1212
+ */
1213
+ setLoop(loop?: boolean): void;
1214
+ loop: boolean;
1215
+ playbackRate: number;
1216
+ startTime: number;
1217
+ /**
1218
+ * @type {GainNode}
1219
+ */
1220
+ tempGain: GainNode;
1221
+ /**
1222
+ * Connect node to AudioNode or AudioParam
1223
+ * @param {AudioNode|AudioParam} destination
1224
+ * @param {number} [output=0]
1225
+ * @param {number} [input=0]
1226
+ * @returns {AudioNode|undefined}
1227
+ */
1228
+ connect(destination: AudioNode | AudioParam, output?: number, input?: number): AudioNode | undefined;
1229
+ /**
1230
+ * Disconnect node from AudioNode or AudioParam
1231
+ * @param {AudioNode} [destinationOrOutput]
1232
+ * @param {number} [output]
1233
+ * @param {number} [input]
1234
+ */
1235
+ disconnect(destinationOrOutput: AudioNode, output: number, input: number): void;
1236
+ output: GainNode;
1237
+ /**
1238
+ * Stop playback immediately or at optional future time
1239
+ * @param {number} [when=0] - seconds from now to stop
1240
+ */
1241
+ stop(when?: number): void;
1242
+ pauseTime: number;
1243
+ isPlaying: boolean;
1244
+ notIndependent: boolean;
1245
+ /** @type {number} */
1246
+ loopStart: number;
1247
+ /** @type {number} */
1248
+ loopEnd: number;
1249
+ }
1250
+ interface SFXConfig {
1251
+ osc: {
1252
+ enabled: boolean;
1253
+ type: "sine" | "square" | "sawtooth" | "triangle";
1254
+ freq: number;
1255
+ detune: number;
1256
+ };
1257
+ noise: {
1258
+ enabled: boolean;
1259
+ level: number;
1260
+ };
1261
+ ampEnv: {
1262
+ attack: number;
1263
+ decay: number;
1264
+ sustain: number;
1265
+ release: number;
1266
+ volume: number;
1267
+ };
1268
+ pitchEnv: {
1269
+ amount: number;
1270
+ decay: number;
1271
+ };
1272
+ filter: {
1273
+ enabled: boolean;
1274
+ type: "lowpass" | "highpass" | "bandpass" | "notch";
1275
+ freq: number;
1276
+ Q: number;
1277
+ envAmount: number;
1278
+ decay: number;
1279
+ };
1280
+ lfo: {
1281
+ enabled: boolean;
1282
+ target: "freq" | "gain" | "filter";
1283
+ rate: number;
1284
+ depth: number;
1285
+ };
1286
+ duration: number;
1287
+ }
1288
+ /**
1289
+ * @type {SFXConfig}
1290
+ */
1291
+ declare const defaultSFXConfig: SFXConfig;
1292
+ declare class LiaOscSFX {
1293
+ /**
1294
+ *
1295
+ * @param {Partial<SFXConfig>} config
1296
+ */
1297
+ constructor(config?: Partial<SFXConfig>);
1298
+ ctx: typeof LiaAudio.audioCtx;
1299
+ /**
1300
+ * @type {SFXConfig}
1301
+ */
1302
+ cfg: SFXConfig;
1303
+ play(outputGain?: GainNode): void;
1304
+ /** @returns {SFXConfig} */
1305
+ getConfig(): SFXConfig;
1306
+ /** @param {Partial<SFXConfig>} patch */
1307
+ setConfig(patch: Partial<SFXConfig>): this;
1308
+ getKey<K extends keyof SFXConfig>(key: K): SFXConfig[K];
1309
+ setKey<K extends keyof SFXConfig>(key: K, value: Partial<SFXConfig[K]>): this;
1310
+ /** @param {SFXConfig['osc']['freq']} freq */
1311
+ setFreq(freq: SFXConfig["osc"]["freq"]): this;
1312
+ /** @param {SFXConfig['osc']['type']} type */
1313
+ setWave(type: SFXConfig["osc"]["type"]): this;
1314
+ /** @param {SFXConfig['ampEnv']['volume']} volume */
1315
+ setVolume(volume: SFXConfig["ampEnv"]["volume"]): this;
1316
+ /** @param {SFXConfig['ampEnv']['attack']} attack @param {SFXConfig['ampEnv']['decay']} decay @param {SFXConfig['ampEnv']['sustain']} sustain @param {SFXConfig['ampEnv']['release']} release */
1317
+ setAmpEnv(attack: SFXConfig["ampEnv"]["attack"], decay: SFXConfig["ampEnv"]["decay"], sustain: SFXConfig["ampEnv"]["sustain"], release: SFXConfig["ampEnv"]["release"]): this;
1318
+ /** @param {SFXConfig['pitchEnv']['amount']} amount @param {SFXConfig['pitchEnv']['decay']} decay */
1319
+ setPitchEnv(amount: SFXConfig["pitchEnv"]["amount"], decay: SFXConfig["pitchEnv"]["decay"]): this;
1320
+ /** @param {SFXConfig['noise']['enabled']} enabled */
1321
+ setNoiseEnabled(enabled: SFXConfig["noise"]["enabled"]): this;
1322
+ /** @param {SFXConfig['noise']['level']} level */
1323
+ setNoiseLevel(level: SFXConfig["noise"]["level"]): this;
1324
+ /** @param {SFXConfig['filter']['enabled']} enabled */
1325
+ setFilterEnabled(enabled: SFXConfig["filter"]["enabled"]): this;
1326
+ setFilter(type: SFXConfig["filter"]["type"], freq: SFXConfig["filter"]["freq"], Q: SFXConfig["filter"]["Q"]): this;
1327
+ setLFOEnabled(enabled: SFXConfig["lfo"]["enabled"]): this;
1328
+ /** @param {SFXConfig['lfo']['target']} target @param {SFXConfig['lfo']['rate']} rate @param {SFXConfig['lfo']['depth']} depth */
1329
+ setLFO(target: SFXConfig["lfo"]["target"], rate: SFXConfig["lfo"]["rate"], depth: SFXConfig["lfo"]["depth"]): this;
1330
+ /** @param {SFXConfig['duration']} duration */
1331
+ setDuration(duration: SFXConfig["duration"]): this;
1332
+ clone(): LiaOscSFX;
1333
+ }
1334
+ declare const sfxUIClick: LiaOscSFX;
1335
+ declare const sfxUIHover: LiaOscSFX;
1336
+ declare const sfxJump: LiaOscSFX;
1337
+ declare const sfxLaser: LiaOscSFX;
1338
+ declare const sfxHit: LiaOscSFX;
1339
+ declare const LiaSFXMap: Map<string, LiaOscSFX>;
1340
+ declare function shortUID(length?: number): string;
1341
+ declare function tinyUID(length?: number): string;
1342
+ /**
1343
+ * @template EventMap
1344
+ * Default event structure
1345
+ */
1346
+ type DefaultWSE<EventMap> = {
1347
+ open: void;
1348
+ close: void;
1349
+ error: Error;
1350
+ message: EventMap[keyof EventMap];
1351
+ key: {
1352
+ key: string;
1353
+ mode: 1 | 2;
1354
+ };
1355
+ };
1356
+ /**
1357
+ * Memory-based client for in-process IPC
1358
+ */
1359
+ declare class GEmitterMemory<Events extends DefaultWSE<Events>> {
1360
+ private peer;
1361
+ private key;
1362
+ private events;
1363
+ mbAcc: number;
1364
+ private connected;
1365
+ constructor();
1366
+ /** Connect to a peer client */
1367
+ connect(peer?: GEmitterMemory<Events>): void;
1368
+ /** Is connected */
1369
+ isConnected(): boolean;
1370
+ /** Add event listener */
1371
+ on<K extends keyof Events>(event: K, listener: (payload: Events[K]) => void): void;
1372
+ /** Remove event listener */
1373
+ off<K extends keyof Events>(event: K, listener: (payload: Events[K]) => void): void;
1374
+ /** Emit event internally */
1375
+ private _emit;
1376
+ /** Send message to peer */
1377
+ send<K extends keyof Events>(event: K, payload: Events[K]): void;
1378
+ /** Receive message from peer */
1379
+ private _receive;
1380
+ /** Disconnect */
1381
+ close(): void;
1382
+ /** Get the client's key */
1383
+ getKey(): string;
1384
+ }
1385
+ /** Cross-browser UUIDv4 generator */
1386
+ declare function generateUUID(): string;
1387
+ declare function setAnimInterval(callback: () => void): {
1388
+ clear: () => boolean;
1389
+ };
1390
+ type Side = "left" | "right" | "top" | "bottom";
1391
+ interface RayHit {
1392
+ side: Side;
1393
+ t: number;
1394
+ }
1395
+ interface RaycastResult extends RayHit {
1396
+ avoidAngle: number;
1397
+ }
1398
+ /**
1399
+ * Core: Raycast to single rectangle
1400
+ */
1401
+ declare function getRayHit(x0: number, y0: number, w: number, h: number, angle: number): RayHit | null;
1402
+ declare function getAvoidAngle(angle: number, side: Side): number;
1403
+ /**
1404
+ Full reusable raycast with avoidance
1405
+ */
1406
+ declare function raycastAvoid(x0: number, y0: number, w: number, h: number, angle: number): RaycastResult | null;
1407
+ declare function isMobile(): boolean;
1408
+ declare const isInitiallyMobile: boolean;
1409
+
1410
+ type LEA_DefaultWSE<EventMap> = DefaultWSE<EventMap>;
1411
+ type LEA_DeltaTweenII = DeltaTweenII;
1412
+ declare const LEA_DeltaTweenII: typeof DeltaTweenII;
1413
+ declare const LEA_ENVIRONMENT: typeof ENVIRONMENT;
1414
+ type LEA_GEmitterMemory<Events extends DefaultWSE<Events>> = GEmitterMemory<Events>;
1415
+ declare const LEA_GEmitterMemory: typeof GEmitterMemory;
1416
+ type LEA_LeaEntityII = LeaEntityII;
1417
+ declare const LEA_LeaEntityII: typeof LeaEntityII;
1418
+ type LEA_LeaEntitySerializer<T extends Record<string, any>> = LeaEntitySerializer<T>;
1419
+ type LEA_LeaEntitySerializerArray<T extends Record<string, any>> = LeaEntitySerializerArray<T>;
1420
+ type LEA_LeaEntitySerializerEach<T extends Record<string, any>, K extends keyof T = keyof T> = LeaEntitySerializerEach<T, K>;
1421
+ type LEA_LeaEventEmitter<Events extends Record<string, any[]>> = LeaEventEmitter<Events>;
1422
+ declare const LEA_LeaEventEmitter: typeof LeaEventEmitter;
1423
+ type LEA_LeaGameII = LeaGameII;
1424
+ declare const LEA_LeaGameII: typeof LeaGameII;
1425
+ type LEA_LeaRendererII = LeaRendererII;
1426
+ declare const LEA_LeaRendererII: typeof LeaRendererII;
1427
+ type LEA_LeaSceneII = LeaSceneII;
1428
+ declare const LEA_LeaSceneII: typeof LeaSceneII;
1429
+ declare const LEA_LeaSerializers: typeof LeaSerializers;
1430
+ type LEA_LeaTickerII = LeaTickerII;
1431
+ declare const LEA_LeaTickerII: typeof LeaTickerII;
1432
+ type LEA_LeaTimeout = LeaTimeout;
1433
+ declare const LEA_LeaTimeout: typeof LeaTimeout;
1434
+ declare const LEA_LeaUtilsII: typeof LeaUtilsII;
1435
+ type LEA_LiaAudio = LiaAudio;
1436
+ declare const LEA_LiaAudio: typeof LiaAudio;
1437
+ type LEA_LiaAudioSrc = LiaAudioSrc;
1438
+ declare const LEA_LiaAudioSrc: typeof LiaAudioSrc;
1439
+ type LEA_LiaOscSFX = LiaOscSFX;
1440
+ declare const LEA_LiaOscSFX: typeof LiaOscSFX;
1441
+ declare const LEA_LiaSFXMap: typeof LiaSFXMap;
1442
+ type LEA_Listener<T extends any[] = any[]> = Listener<T>;
1443
+ type LEA_NOTE_NAME = NOTE_NAME;
1444
+ declare const LEA_NOTE_NAMES: typeof NOTE_NAMES;
1445
+ type LEA_OrderedLeaEntitySerializer<T extends Record<string, any>, FirstKeys extends (keyof T)[]> = OrderedLeaEntitySerializer<T, FirstKeys>;
1446
+ type LEA_RayHit = RayHit;
1447
+ type LEA_RaycastResult = RaycastResult;
1448
+ type LEA_RectLeaEntity = RectLeaEntity;
1449
+ declare const LEA_RectLeaEntity: typeof RectLeaEntity;
1450
+ type LEA_SFXConfig = SFXConfig;
1451
+ type LEA_Side = Side;
1452
+ type LEA_Vector2 = Vector2;
1453
+ declare const LEA_Vector2: typeof Vector2;
1454
+ declare const LEA_colToRGBA: typeof colToRGBA;
1455
+ declare const LEA_defaultSFXConfig: typeof defaultSFXConfig;
1456
+ declare const LEA_editRGBA: typeof editRGBA;
1457
+ declare const LEA_generateUUID: typeof generateUUID;
1458
+ declare const LEA_getAvoidAngle: typeof getAvoidAngle;
1459
+ declare const LEA_getEnvironment: typeof getEnvironment;
1460
+ declare const LEA_getNormalizedColor: typeof getNormalizedColor;
1461
+ declare const LEA_getRayHit: typeof getRayHit;
1462
+ declare const LEA_isInitiallyMobile: typeof isInitiallyMobile;
1463
+ declare const LEA_isMobile: typeof isMobile;
1464
+ declare const LEA_isNode: typeof isNode;
1465
+ declare const LEA_isNote: typeof isNote;
1466
+ declare const LEA_isWeb: typeof isWeb;
1467
+ declare const LEA_parseFillStyle: typeof parseFillStyle;
1468
+ declare const LEA_raycastAvoid: typeof raycastAvoid;
1469
+ declare const LEA_scaleCoord: typeof scaleCoord;
1470
+ declare const LEA_setAnimInterval: typeof setAnimInterval;
1471
+ declare const LEA_sfxHit: typeof sfxHit;
1472
+ declare const LEA_sfxJump: typeof sfxJump;
1473
+ declare const LEA_sfxLaser: typeof sfxLaser;
1474
+ declare const LEA_sfxUIClick: typeof sfxUIClick;
1475
+ declare const LEA_sfxUIHover: typeof sfxUIHover;
1476
+ declare const LEA_shortUID: typeof shortUID;
1477
+ declare const LEA_tinyUID: typeof tinyUID;
1478
+ declare namespace LEA {
1479
+ export { type LEA_DefaultWSE as DefaultWSE, LEA_DeltaTweenII as DeltaTweenII, LEA_ENVIRONMENT as ENVIRONMENT, LEA_GEmitterMemory as GEmitterMemory, LEA_LeaEntityII as LeaEntityII, type LEA_LeaEntitySerializer as LeaEntitySerializer, type LEA_LeaEntitySerializerArray as LeaEntitySerializerArray, type LEA_LeaEntitySerializerEach as LeaEntitySerializerEach, LEA_LeaEventEmitter as LeaEventEmitter, LEA_LeaGameII as LeaGameII, LEA_LeaRendererII as LeaRendererII, LEA_LeaSceneII as LeaSceneII, LEA_LeaSerializers as LeaSerializers, LEA_LeaTickerII as LeaTickerII, LEA_LeaTimeout as LeaTimeout, LEA_LeaUtilsII as LeaUtilsII, LEA_LiaAudio as LiaAudio, LEA_LiaAudioSrc as LiaAudioSrc, LEA_LiaOscSFX as LiaOscSFX, LEA_LiaSFXMap as LiaSFXMap, type LEA_Listener as Listener, type LEA_NOTE_NAME as NOTE_NAME, LEA_NOTE_NAMES as NOTE_NAMES, type LEA_OrderedLeaEntitySerializer as OrderedLeaEntitySerializer, type LEA_RayHit as RayHit, type LEA_RaycastResult as RaycastResult, LEA_RectLeaEntity as RectLeaEntity, type LEA_SFXConfig as SFXConfig, type LEA_Side as Side, LEA_Vector2 as Vector2, LEA_colToRGBA as colToRGBA, LEA_defaultSFXConfig as defaultSFXConfig, LEA_editRGBA as editRGBA, LEA_generateUUID as generateUUID, LEA_getAvoidAngle as getAvoidAngle, LEA_getEnvironment as getEnvironment, LEA_getNormalizedColor as getNormalizedColor, LEA_getRayHit as getRayHit, LEA_isInitiallyMobile as isInitiallyMobile, LEA_isMobile as isMobile, LEA_isNode as isNode, LEA_isNote as isNote, LEA_isWeb as isWeb, LEA_parseFillStyle as parseFillStyle, LEA_raycastAvoid as raycastAvoid, LEA_scaleCoord as scaleCoord, LEA_setAnimInterval as setAnimInterval, LEA_sfxHit as sfxHit, LEA_sfxJump as sfxJump, LEA_sfxLaser as sfxLaser, LEA_sfxUIClick as sfxUIClick, LEA_sfxUIHover as sfxUIHover, LEA_shortUID as shortUID, LEA_tinyUID as tinyUID };
1480
+ }
1481
+
1482
+ /**
1483
+ * Base props interface that every Kayla component can receive.
1484
+ *
1485
+ * Extend this when defining custom component props:
1486
+ *
1487
+ * ```ts
1488
+ * interface MyProps extends FCProps {
1489
+ * speed: number;
1490
+ * }
1491
+ * ```
1492
+ */
1493
+ type FCProps = {
1494
+ key?: string;
1495
+ children?: KaylaElement<any>[];
1496
+ ref?: KaylaRef<KaylaInternals.KaylaRectEntity>;
1497
+ exportsRef?: KaylaRef<KaylaExports<any>>;
1498
+ } & Record<string, unknown>;
1499
+ type FCExports = {} & Record<string, KaylaExportables>;
1500
+ interface FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExports> {
1501
+ (props: Props & {
1502
+ ref?: KaylaElementRef;
1503
+ exportsRef?: KaylaRef<KaylaExports<Exports>>;
1504
+ }): KaylaElement<any>[] | KaylaElement<any> | void;
1505
+ displayName?: string | undefined;
1506
+ }
1507
+ /**
1508
+ * Creates a new game instance that coordinates scenes, renderers, and a shared ticker.
1509
+ *
1510
+ * The game manages the global update loop (via `updateHz`) and allows attaching multiple renderers
1511
+ * and scenes. Start the game with `game.start()` to begin ticking and rendering.
1512
+ *
1513
+ * @param config - Configuration options
1514
+ * @param config.width - Logical viewport width (used for entity coordinates)
1515
+ * @param config.height - Logical viewport height
1516
+ * @param config.updateHz - Tick frequency:
1517
+ * - `"frames"` = run updates every render frame (RAF-synced, variable timestep)
1518
+ * - number = fixed timestep in Hz (e.g. 60)
1519
+ * @returns A `KaylaGame` instance
1520
+ *
1521
+ * @example
1522
+ * const game = createGame({ width: 800, height: 600, updateHz: 60 });
1523
+ * game.start();
1524
+ */
1525
+ declare function createGame({ width, height, updateHz: hz, }: {
1526
+ width: number;
1527
+ height: number;
1528
+ updateHz?: number | "frames";
1529
+ }): KaylaInternals.KaylaGame;
1530
+ /**
1531
+ * Creates a scene that manages a collection of entities and their update/draw lifecycle.
1532
+ *
1533
+ * Scenes handle z-sorted drawing, paused state, and entity addition/removal.
1534
+ * Use `scene.spawn()` to mount a root component tree.
1535
+ *
1536
+ * @param name - Unique identifier for the scene
1537
+ * @returns A `KaylaScene` wrapper with `.spawn()` and other methods
1538
+ *
1539
+ * @example
1540
+ * const scene = createScene("main");
1541
+ * scene.spawn(<GameWorld />);
1542
+ */
1543
+ declare function createScene(name: string): KaylaInternals.KaylaScene;
1544
+ /**
1545
+ * Creates a renderer that drives the canvas draw loop and handles pointer tracking.
1546
+ *
1547
+ * The renderer automatically clears the canvas each frame and emits a `"draw"` event
1548
+ * where scenes can paint. Call `renderer.start()` to begin the RAF loop.
1549
+ *
1550
+ * @param canvas - The target `<canvas>` element
1551
+ * @returns A `KaylaRenderer` instance
1552
+ *
1553
+ * @example
1554
+ * const canvas = document.getElementById("game") as HTMLCanvasElement;
1555
+ * const renderer = createRenderer(canvas);
1556
+ * renderer.start();
1557
+ */
1558
+ declare function createRenderer(canvas: HTMLCanvasElement): KaylaRenderer;
1559
+ /**
1560
+ * Creates a Kayla element descriptor (virtual representation of an entity/component).
1561
+ *
1562
+ * This is the JSX factory used internally by the transpiler. You rarely call it directly,
1563
+ * but it powers declarative trees passed to `scene.spawn()`.
1564
+ *
1565
+ * @template Props - Props type accepted by the component
1566
+ * @param fc - The functional component
1567
+ * @param props - Props including `key`, `ref`, `exportsRef`, `children`, etc.
1568
+ * @returns Element descriptor
1569
+ *
1570
+ * @example
1571
+ * const elem = createElement(Player, { x: 400, y: 300 });
1572
+ * scene.spawn(elem);
1573
+ */
1574
+ declare function createElement<Props extends FCProps>(fc: FC<Props>, props: Props): KaylaElement<Props>;
1575
+ interface KaylaElement<Props extends FCProps> {
1576
+ type: FC<Props>;
1577
+ props: Props;
1578
+ }
1579
+ /**
1580
+ * Read-only view of a state value created via `useState`.
1581
+ *
1582
+ * Returned by `useState`. Changes via `.set()` / `.add()` / `.multiply()` may trigger
1583
+ * a component refresh (re-execution of the component function), which can be expensive
1584
+ * in performance-critical loops.
1585
+ *
1586
+ * **Performance warning:** Avoid frequent `.set()` calls in `useTick` / `usePaint` loops.
1587
+ * Prefer `useSelf` or `useRef` for hot data (position, velocity, timers, counters).
1588
+ * Use `useState` only for infrequent structural changes (e.g. `isDead`, `currentLevel`).
1589
+ *
1590
+ * @template T - Type of the stored value
1591
+ */
1592
+ interface KaylaState<T> extends KaylaInternals.KaylaState<T> {
1593
+ }
1594
+ /**
1595
+ * Mutable reference object whose `.current` property persists across component refreshes.
1596
+ *
1597
+ * Returned by `useRef` and `useSelf`. Changes to `.current` **never** trigger refresh,
1598
+ * making it safe for hot mutable data (position, velocity, timers, DOM nodes, etc.).
1599
+ *
1600
+ * @template T - Type of the referenced value
1601
+ */
1602
+ interface KaylaRef<T> extends KaylaInternals.KaylaRef<T> {
1603
+ }
1604
+ /**
1605
+ * Game instance that coordinates scenes, renderers, and the shared ticker.
1606
+ *
1607
+ * @extends LeaGameII
1608
+ */
1609
+ interface KaylaGame extends KaylaInternals.KaylaGame {
1610
+ }
1611
+ /**
1612
+ * Scene wrapper that manages entity lifecycle and delegates to the underlying LEA scene.
1613
+ *
1614
+ * @extends LeaSceneII (via internal delegation)
1615
+ */
1616
+ interface KaylaScene extends KaylaInternals.KaylaScene {
1617
+ }
1618
+ /**
1619
+ * Renderer wrapper that extends LEA renderer with game integration and pointer utilities.
1620
+ *
1621
+ * @extends LeaRendererII
1622
+ */
1623
+ interface KaylaRenderer extends KaylaInternals.KaylaRenderer {
1624
+ }
1625
+ /**
1626
+ * Internal APIs, do not use outside.
1627
+ */
1628
+ declare namespace KaylaInternals {
1629
+ /**
1630
+ * Game instance that coordinates scenes, renderers, and the shared ticker.
1631
+ *
1632
+ * @extends LeaGameII
1633
+ */
1634
+ class KaylaGame extends LeaGameII {
1635
+ #private;
1636
+ constructor(width: number, height: number, hz: typeof Infinity | number);
1637
+ /**
1638
+ * Whether the game has been started.
1639
+ */
1640
+ get started(): boolean;
1641
+ /**
1642
+ * Starts the game: starts all attached renderers and the ticker.
1643
+ */
1644
+ start(): void;
1645
+ /**
1646
+ * Stops the game: stops all attached renderers and the ticker.
1647
+ */
1648
+ stop(): void;
1649
+ /**
1650
+ * Attaches a renderer to the game.
1651
+ *
1652
+ * If the game is already started, the renderer is started immediately.
1653
+ *
1654
+ * @param renderer - The renderer to attach
1655
+ */
1656
+ addRenderer(renderer: KaylaRenderer): void;
1657
+ /**
1658
+ * Detaches a renderer from the game.
1659
+ *
1660
+ * If the game is running, the renderer is stopped.
1661
+ *
1662
+ * @param renderer - The renderer to detach
1663
+ */
1664
+ deleteRenderer(renderer: KaylaRenderer): void;
1665
+ }
1666
+ /**
1667
+ * Renderer wrapper that extends LEA renderer with game integration and pointer utilities.
1668
+ *
1669
+ * @extends LeaRendererII
1670
+ */
1671
+ class KaylaRenderer extends LeaRendererII {
1672
+ #private;
1673
+ /**
1674
+ * The attached game instance (set via `attachTo`).
1675
+ */
1676
+ game?: KaylaGame;
1677
+ /**
1678
+ * Current canvas-space pointer X coordinate.
1679
+ */
1680
+ pointerX: number;
1681
+ /**
1682
+ * Current canvas-space pointer Y coordinate.
1683
+ */
1684
+ pointerY: number;
1685
+ constructor(canvas: HTMLCanvasElement);
1686
+ listenPointerUpdates(): void;
1687
+ unlistenPointerUpdates(): void;
1688
+ /**
1689
+ * Transforms canvas-space coordinates to world-space coordinates.
1690
+ *
1691
+ * @param mx - Mouse X in canvas pixels
1692
+ * @param my - Mouse Y in canvas pixels
1693
+ * @returns World-space position
1694
+ */
1695
+ pointerPosToWorldPos(mx: number, my: number): Vector2;
1696
+ /**
1697
+ * Returns the current pointer position in world coordinates.
1698
+ *
1699
+ * Requires `listenPointerUpdates()` to have been called.
1700
+ *
1701
+ * @returns World-space position
1702
+ */
1703
+ getMousePos(): Vector2;
1704
+ /**
1705
+ * Registers a draw callback that receives a normalized `KaylaEvent`.
1706
+ *
1707
+ * @param callback - Paint handler
1708
+ * @returns Unsubscribe function
1709
+ */
1710
+ useDraw(callback: KaylaInternalComponent["onPaint"][number]): () => void;
1711
+ /**
1712
+ * Attaches this renderer to a game.
1713
+ *
1714
+ * Sets `renderer.game` and adds it to `game.#renderers`.
1715
+ *
1716
+ * @param game - The game to attach to
1717
+ */
1718
+ attachTo(game: KaylaGame): void;
1719
+ /**
1720
+ * Detaches this renderer from its game (if attached).
1721
+ */
1722
+ detach(): void;
1723
+ }
1724
+ class GlobalKayla {
1725
+ current?: KaylaInternalComponent;
1726
+ saves: {
1727
+ current?: GlobalKayla["current"];
1728
+ }[];
1729
+ constructor();
1730
+ useTick(onTick: KaylaInternalComponent["onTick"][number]): void;
1731
+ usePaint(onPaint: KaylaInternalComponent["onPaint"][number]): void;
1732
+ useEntity(): KaylaElementRef;
1733
+ useSelf<T>(init: () => T): T;
1734
+ useState<T>(initialValue?: T, { alwaysRecall }?: {
1735
+ alwaysRecall?: boolean;
1736
+ }): KaylaState<T>;
1737
+ useRef(initialValue: typeof selfSym): KaylaElementRef;
1738
+ useRef<T>(initialValue: T | null): KaylaRef<T>;
1739
+ useEffect(onEffect: KaylaInternalComponent["onEffect"][number]): void;
1740
+ useExports<T extends FC<any, any>>(fc: T, onExport: KaylaInternalComponent<PropOfFC<T>, ExportsOfFC<T>>["onExport"]): void;
1741
+ save(): void;
1742
+ restore(): void;
1743
+ }
1744
+ class KaylaEvent {
1745
+ #private;
1746
+ preventDefault(): void;
1747
+ isPrevented(): boolean;
1748
+ }
1749
+ /**
1750
+ * Read-only view of a state value created via `useState`.
1751
+ *
1752
+ * Returned by `useState`. Changes via `.set()` / `.add()` / `.multiply()` may trigger
1753
+ * a component refresh (re-execution of the component function), which can be expensive
1754
+ * in performance-critical loops.
1755
+ *
1756
+ * **Performance warning:** Avoid frequent `.set()` calls in `useTick` / `usePaint` loops.
1757
+ * Prefer `useSelf` or `useRef` for hot data (position, velocity, timers, counters).
1758
+ * Use `useState` only for infrequent structural changes (e.g. `isDead`, `currentLevel`).
1759
+ *
1760
+ * @template T - Type of the stored value
1761
+ */
1762
+ class KaylaState<T> {
1763
+ #private;
1764
+ alwaysRecall: boolean;
1765
+ constructor(current: KaylaInternalComponent<any>, initialValue?: T, { alwaysRecall }?: {
1766
+ alwaysRecall?: boolean;
1767
+ });
1768
+ get(this: KaylaState<T>): T;
1769
+ /**
1770
+ * Adds a number to the current value (only available when `T` is `number`).
1771
+ *
1772
+ * Convenience method that calls `.set(get() + added)`.
1773
+ * Behaves exactly like `.set()` regarding refresh overhead.
1774
+ *
1775
+ * @param added - Value to add
1776
+ * @param options - Optional control over refresh
1777
+ * @param options.recall - Force refresh (default: false)
1778
+ */
1779
+ add(this: KaylaState<number>, added: number, { recall }?: {
1780
+ recall?: boolean;
1781
+ }): void;
1782
+ /**
1783
+ * Multiplies the current value by a number (only available when `T` is `number`).
1784
+ *
1785
+ * Convenience method that calls `.set(get() * multiplier)`.
1786
+ * Behaves exactly like `.set()` regarding refresh overhead.
1787
+ *
1788
+ * @param multiplier - Value to multiply by
1789
+ * @param options - Optional control over refresh
1790
+ * @param options.recall - Force refresh (default: false)
1791
+ */
1792
+ multiply(this: KaylaState<number>, added: number, { recall }?: {
1793
+ recall?: boolean;
1794
+ }): void;
1795
+ /**
1796
+ * Updates the state value.
1797
+ *
1798
+ * If the new value differs from the current one (strict `!==` comparison),
1799
+ * and either `recall: true` is passed or `alwaysRecall` was set at creation,
1800
+ * this triggers a component refresh.
1801
+ *
1802
+ * Refreshing re-runs the entire component function, re-binds hooks,
1803
+ * and may re-mount/unmount children — avoid in hot paths.
1804
+ *
1805
+ * @param newValue - The new state value
1806
+ * @param options - Optional control over refresh behavior
1807
+ * @param options.recall - Force a refresh even if `alwaysRecall` is false (default: false)
1808
+ */
1809
+ set(this: KaylaState<T>, s: T, { recall }?: {
1810
+ recall?: boolean;
1811
+ }): void;
1812
+ /**
1813
+ * The current value of the state.
1814
+ *
1815
+ * Reading this property is always safe and does not trigger side effects.
1816
+ *
1817
+ * @readonly
1818
+ */
1819
+ get value(): T;
1820
+ /**
1821
+ * Timestamp (milliseconds since epoch) of the last time the state was changed via `.set()`.
1822
+ *
1823
+ * Useful for dependency tracking or knowing when the value was last mutated.
1824
+ *
1825
+ * @readonly
1826
+ */
1827
+ get lastChanged(): number;
1828
+ }
1829
+ /**
1830
+ * Mutable reference object whose `.current` property persists across component refreshes.
1831
+ *
1832
+ * Returned by `useRef` and `useSelf`. Changes to `.current` **never** trigger refresh,
1833
+ * making it safe for hot mutable data (position, velocity, timers, DOM nodes, etc.).
1834
+ *
1835
+ * @template T - Type of the referenced value
1836
+ */
1837
+ class KaylaRef<T> {
1838
+ #private;
1839
+ constructor(current: KaylaInternalComponent<any>, initialValue?: T);
1840
+ /**
1841
+ * The mutable value held by the ref.
1842
+ *
1843
+ * Reading or writing this property has **no side effects** — it does **not** trigger
1844
+ * component refresh, re-render, or hook re-registration.
1845
+ *
1846
+ * When initialized with the `self` symbol via `useRef(self)`, this becomes a reference
1847
+ * to the underlying `KaylaRectEntity`.
1848
+ *
1849
+ * @type {T}
1850
+ */
1851
+ get current(): T;
1852
+ set current(s: T);
1853
+ }
1854
+ class KaylaInternalComponent<Props extends FCProps = {}, Exports extends FCExports = FCExports> {
1855
+ state: KaylaState<unknown>[];
1856
+ refs: KaylaRef<unknown>[];
1857
+ global: GlobalKayla;
1858
+ callProps: Props;
1859
+ scene: KaylaScene;
1860
+ exports: KaylaExports<Exports>;
1861
+ constructor(globalKayla: GlobalKayla, scene: KaylaScene, element: KaylaElement<Props>);
1862
+ get key(): string;
1863
+ set key(s: string);
1864
+ get children(): KaylaElement<any>[];
1865
+ set children(s: KaylaElement<any>[]);
1866
+ entity?: KaylaRectEntity;
1867
+ onExport: () => KaylaExports<Exports>;
1868
+ onEffect: Array<() => (() => void) | void>;
1869
+ onUnEffect: Array<() => void>;
1870
+ onEffectDeps?: KaylaState<any>[] | undefined;
1871
+ onPaint: Array<(ctx: CanvasRenderingContext2D, event: KaylaEvent) => void>;
1872
+ onTick: Array<(deltaS: number, event: KaylaEvent) => void>;
1873
+ fc?: FC<any>;
1874
+ useStateCallIndex: number;
1875
+ useEffectCallIndex: number;
1876
+ useDrawCallIndex: number;
1877
+ useStepCallIndex: number;
1878
+ useRefCallIndex: number;
1879
+ lastStateDeps: Array<{
1880
+ stateRef: KaylaState<any>;
1881
+ stamp: number;
1882
+ }>;
1883
+ refresh(): void;
1884
+ lastChildren: KaylaInternalComponent<any>[];
1885
+ isFirstUse: boolean;
1886
+ use(): void;
1887
+ unuse(): void;
1888
+ }
1889
+ class KaylaRectEntity extends RectLeaEntity {
1890
+ #private;
1891
+ constructor(component: KaylaInternalComponent, name: string);
1892
+ update(_delta: number): void;
1893
+ draw(ctx: CanvasRenderingContext2D): void;
1894
+ }
1895
+ class KaylaScene {
1896
+ #private;
1897
+ constructor(scene: LeaSceneII);
1898
+ /**
1899
+ * Returns the underlying LEA scene instance.
1900
+ */
1901
+ getScene(): LeaSceneII;
1902
+ private drawHandler;
1903
+ /**
1904
+ * Attaches this scene to a game instance.
1905
+ *
1906
+ * @param game - The game to attach to
1907
+ */
1908
+ attachTo(game: LeaGameII): void;
1909
+ /**
1910
+ * Mounts a root component tree into the scene.
1911
+ *
1912
+ * Triggers component execution, entity creation, and hook registration.
1913
+ *
1914
+ * @param elem - Root Kayla element (usually JSX)
1915
+ */
1916
+ spawn(elem: KaylaElement<any>): void;
1917
+ /**
1918
+ * Detaches this scene from its game (if attached).
1919
+ */
1920
+ detach(): void;
1921
+ private tickHandler;
1922
+ }
1923
+ const singleGlobalInstance: GlobalKayla;
1924
+ }
1925
+ /**
1926
+ * Returns a stateful value and a setter to update it.
1927
+ *
1928
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1929
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1930
+ *
1931
+ * Calling the setter **may** schedule an entity refresh (re-execution of the component function),
1932
+ * which re-binds all hooks to the same entity instance and potentially re-spawns children.
1933
+ *
1934
+ * **Critical performance warning:**
1935
+ * **Do NOT** use `useState` for frequently-updated game data (position, velocity, rotation, timers, health deltas, etc.).
1936
+ * Those **must** live in `useSelf` or plain `useRef`.
1937
+ * `useState` is **only** for infrequent structural changes that should trigger refresh
1938
+ * (e.g. `isDead` → spawn particles, `currentLevel` → reload map, `variant` → change sprite sheet).
1939
+ *
1940
+ * @template T The type of the state value
1941
+ * @param initialValue Optional initial value
1942
+ * @param options Configuration object
1943
+ * @param options.alwaysRecall If `true`, **every** `.set()` call triggers a refresh (default: `false`)
1944
+ * @returns A state wrapper with `.get()`, `.set()`, `.add()`, `.multiply()`, and `.lastChanged`
1945
+ *
1946
+ * @example Correct structural use
1947
+ * const isDead = useState(false);
1948
+ * if (health <= 0) isDead.set(true); // → refresh spawns death animation children
1949
+ *
1950
+ * @example Incorrect hot-data use (do NOT do this)
1951
+ * const pos = useState({ x: 400, y: 300 }); // BAD — thrashing + GC pressure
1952
+ */
1953
+ declare const useState: <T>(initialValue?: T, { alwaysRecall }?: {
1954
+ alwaysRecall?: boolean;
1955
+ }) => KaylaInternals.KaylaState<T>;
1956
+ /**
1957
+ * Returns a mutable ref object whose `.current` property persists across entity refreshes.
1958
+ *
1959
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1960
+ * The call order of all hooks is **strictly fixed**; reordering calls will corrupt internal ref storage.
1961
+ *
1962
+ * Changes to `.current` **never** trigger refresh or re-bind hooks — refs are stable for the entity's lifetime.
1963
+ *
1964
+ * **Primary use:** Hold mutable game state, methods, timers, audio nodes, previous values, etc.
1965
+ * For most entities, wrap your full logic in `useSelf()` instead (strongly recommended pattern).
1966
+ *
1967
+ * Special case: pass the `self` symbol to get the current LEA entity:
1968
+ *
1969
+ * @template T The type of the ref's value
1970
+ * @param initialValue Initial value for `.current`, or `self` symbol for entity reference
1971
+ * @returns A ref object with mutable `.current` property
1972
+ *
1973
+ * @example Entity reference
1974
+ * const entity = useRef(self);
1975
+ * entity.current.x += 10; // direct entity mutation, no refresh
1976
+ *
1977
+ * @example Mutable counter
1978
+ * const timer = useRef(0);
1979
+ * useTick(delta => { timer.current += delta; });
1980
+ */
1981
+ declare const useRef: {
1982
+ (initialValue: typeof selfSym): KaylaElementRef;
1983
+ <T>(initialValue: T | null): KaylaInternals.KaylaRef<T>;
1984
+ };
1985
+ /**
1986
+ * Registers an effect that runs after entity creation and after every refresh.
1987
+ *
1988
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1989
+ * The call order of all hooks is **strictly fixed**; reordering calls will corrupt effect registration.
1990
+ *
1991
+ * The effect callback runs **synchronously** after refresh completes.
1992
+ * If it returns a function, that cleanup runs **before** the next effect execution or when the entity is destroyed.
1993
+ *
1994
+ * Multiple `useEffect` calls **stack** — all run in declaration order.
1995
+ * Effects are **re-registered** on every refresh (no dependency array in current version).
1996
+ *
1997
+ * **Use only for true side-effects** (event listeners, intervals, tweens, audio nodes, physics setup).
1998
+ * For game logic, use `useTick` / `usePaint` / `useSelf` instead.
1999
+ *
2000
+ * @param effect Imperative function that may return a cleanup
2001
+ */
2002
+ declare const useEffect: (onEffect: KaylaInternals.KaylaInternalComponent["onEffect"][number]) => void;
2003
+ /**
2004
+ * Registers a callback that runs on every game tick (update phase).
2005
+ *
2006
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
2007
+ * The call order of all hooks is **strictly fixed**; reordering calls will corrupt tick registration.
2008
+ *
2009
+ * Multiple `useTick` calls **stack** — all run in declaration order every tick.
2010
+ * Call `event.preventDefault()` to skip remaining tick handlers for this entity (including default update).
2011
+ *
2012
+ * **Use for:** physics, movement, AI, timers, collision checks, input polling.
2013
+ *
2014
+ * @param callback Tick handler receiving delta time (seconds) and cancellable event
2015
+ */
2016
+ declare const useTick: (onTick: KaylaInternals.KaylaInternalComponent["onTick"][number]) => void;
2017
+ /**
2018
+ * Registers a callback that runs on every render frame (paint phase).
2019
+ *
2020
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
2021
+ * The call order of all hooks is **strictly fixed**; reordering calls will corrupt paint registration.
2022
+ *
2023
+ * Multiple `usePaint` calls **stack** — all run in declaration order every frame.
2024
+ * Call `event.preventDefault()` to skip remaining paint handlers (including default rect fill).
2025
+ *
2026
+ * **Use for:** drawing sprites, particles, health bars, debug overlays, name tags.
2027
+ *
2028
+ * @param callback Paint handler receiving canvas context and cancellable event
2029
+ */
2030
+ declare const usePaint: (onPaint: KaylaInternals.KaylaInternalComponent["onPaint"][number]) => void;
2031
+ /**
2032
+ * Defines the public API this entity exposes to its parent via the `exportsRef` prop.
2033
+ *
2034
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
2035
+ * The call order of all hooks is **strictly fixed**; only **one** `useExports` call is allowed per component (later calls override earlier ones).
2036
+ *
2037
+ * The exporter function runs during every refresh; the returned object is assigned to `this.exports`.
2038
+ * Parent receives it via `exportsRef.current` (stable reference).
2039
+ *
2040
+ * **Use for:** exposing methods (jump, takeDamage), getters (position, health), or state handles to parent.
2041
+ *
2042
+ * @template T The functional component type (used for type inference)
2043
+ * @param component The component function itself (required for TypeScript inference)
2044
+ * @param exporter Function returning the exportable values/methods
2045
+ *
2046
+ * @example
2047
+ * useExports(Player, () => ({
2048
+ * jump: () => { ... },
2049
+ * getPosition: () => entity.current.pos.clone()
2050
+ * }));
2051
+ */
2052
+ declare const useExports: <T extends FC<any, any>>(fc: T, onExport: KaylaInternals.KaylaInternalComponent<PropOfFC<T>, ExportsOfFC<T>>["onExport"]) => void;
2053
+ /**
2054
+ * Creates and returns a stable object (god-object) for holding most of an entity's state and logic.
2055
+ *
2056
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
2057
+ * The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
2058
+ *
2059
+ * The initializer runs **only once** (on first entity creation); the returned object is the **same reference** on every refresh.
2060
+ *
2061
+ * **Recommended pattern:** Put nearly all mutable state, methods, and game logic here.
2062
+ * Use `useState` **only** for rare structural changes that should trigger refresh.
2063
+ *
2064
+ * @template T The type of the god-object
2065
+ * @param init Factory function returning the object (called only once)
2066
+ * @returns The initialized god-object (stable across refreshes)
2067
+ *
2068
+ * @example
2069
+ * const self = useSelf(() => ({
2070
+ * pos: new Vector2(400, 300),
2071
+ * vel: new Vector2(100, 0),
2072
+ * tick(delta) { this.pos.x += this.vel.x * delta; }
2073
+ * }));
2074
+ *
2075
+ * useTick(delta => self.tick(delta));
2076
+ */
2077
+ declare const useSelf: <T>(init: () => T) => T;
2078
+ /**
2079
+ * Returns a direct reference to the underlying LEA entity instance managed by this component.
2080
+ *
2081
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
2082
+ * The call order of all hooks is **strictly fixed**; reordering calls will corrupt internal state.
2083
+ *
2084
+ * The returned reference is **stable** for the entity's lifetime and allows direct mutation of `x`, `y`, `z`, `width`, `height`, etc.
2085
+ *
2086
+ * @returns Reference to the `KaylaRectEntity` instance
2087
+ */
2088
+ declare const useEntity: () => KaylaElementRef;
2089
+ /**
2090
+ * Special symbol used to obtain a reference to the current entity.
2091
+ *
2092
+ * Pass this to `useRef` to get the underlying `KaylaRectEntity`:
2093
+ *
2094
+ * ```ts
2095
+ * const entity = useRef(self);
2096
+ * entity.current.x += 10;
2097
+ * ```
2098
+ *
2099
+ * @see {@link useRef}
2100
+ */
2101
+ declare const selfSym: unique symbol;
2102
+
2103
+ /**
2104
+ * Schedules a callback to run in the next microtask (via `Promise.resolve().then`).
2105
+ *
2106
+ * Used internally to defer entity refreshes safely and prevent synchronous re-entrancy.
2107
+ * Rarely needed directly by users.
2108
+ *
2109
+ * @param callback - The function to schedule
2110
+ */
2111
+ declare const useNextStack: (callback: () => void) => void;
2112
+ /**
2113
+ * A fragment component that simply returns its children.
2114
+ *
2115
+ * Useful for grouping entities without adding an extra wrapper entity.
2116
+ * Behaves like React.Fragment — no additional DOM/entity overhead.
2117
+ *
2118
+ * @example
2119
+ * return (
2120
+ * <KaylaFragment>
2121
+ * <Enemy />
2122
+ * <Coin />
2123
+ * </KaylaFragment>
2124
+ * );
2125
+ *
2126
+ * // Or shorthand:
2127
+ * return (
2128
+ * <>
2129
+ * <Enemy />
2130
+ * <Coin />
2131
+ * </>
2132
+ * );
2133
+ */
2134
+ declare const KaylaFragment: FC;
2135
+ declare namespace JSX {
2136
+ type Element = KaylaElement<any>;
2137
+ interface IntrinsicElements {
2138
+ }
2139
+ type ElementType = FC<any>;
2140
+ }
2141
+ /**
2142
+ * Marker type for values that can be exported from a component via `useExports`.
2143
+ *
2144
+ * Currently supports `KaylaState` or `KaylaRef` instances.
2145
+ */
2146
+ type KaylaExportables = KaylaState<any> | KaylaRef<any>;
2147
+ /**
2148
+ * Shape of the object returned by a component's `useExports` callback.
2149
+ *
2150
+ * @template StateMap - Record mapping export names to exportable values
2151
+ */
2152
+ type KaylaExports<StateMap extends Record<string, KaylaExportables>> = {
2153
+ [K in keyof StateMap]: StateMap[K];
2154
+ };
2155
+ type PropOfFC<T extends FC<any, any>> = T extends FC<infer Props, any> ? Props : never;
2156
+ type ExportsOfFC<T extends FC<any, any>> = T extends FC<any, infer Exports> ? Exports : never;
2157
+ /**
2158
+ * Creates a temporary ref object **outside** of component context.
2159
+ *
2160
+ * Unlike `useRef`, this ref **does not persist** across entity refreshes — it is recreated
2161
+ * every time the component function runs. Use for one-off values or render-pass temporaries.
2162
+ *
2163
+ * @template T - Type of the ref's value
2164
+ * @param initialValue - Initial value for `.current`
2165
+ * @returns A fresh `KaylaRef` instance
2166
+ *
2167
+ * @example
2168
+ * const temp = useDisposableRef({ count: 0 });
2169
+ * // temp.current is only valid for this render
2170
+ */
2171
+ declare function useDisposableRef<T>(initialValue: T): KaylaInternals.KaylaRef<T>;
2172
+ /**
2173
+ * Reference type returned by `useEntity()` or passed via `ref` prop.
2174
+ *
2175
+ * Provides direct access to the underlying `KaylaRectEntity` (LEA entity wrapper).
2176
+ */
2177
+ interface KaylaElementRef extends KaylaRef<KaylaInternals.KaylaRectEntity> {
2178
+ }
2179
+
2180
+ type kaylaInternals_ExportsOfFC<T extends FC<any, any>> = ExportsOfFC<T>;
2181
+ type kaylaInternals_FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExports> = FC<Props, Exports>;
2182
+ type kaylaInternals_FCExports = FCExports;
2183
+ type kaylaInternals_FCProps = FCProps;
2184
+ declare const kaylaInternals_JSX: typeof JSX;
2185
+ type kaylaInternals_KaylaElement<Props extends FCProps> = KaylaElement<Props>;
2186
+ type kaylaInternals_KaylaElementRef = KaylaElementRef;
2187
+ type kaylaInternals_KaylaExportables = KaylaExportables;
2188
+ type kaylaInternals_KaylaExports<StateMap extends Record<string, KaylaExportables>> = KaylaExports<StateMap>;
2189
+ declare const kaylaInternals_KaylaFragment: typeof KaylaFragment;
2190
+ type kaylaInternals_KaylaGame = KaylaGame;
2191
+ declare const kaylaInternals_KaylaInternals: typeof KaylaInternals;
2192
+ type kaylaInternals_KaylaRef<T> = KaylaRef<T>;
2193
+ type kaylaInternals_KaylaRenderer = KaylaRenderer;
2194
+ type kaylaInternals_KaylaScene = KaylaScene;
2195
+ type kaylaInternals_KaylaState<T> = KaylaState<T>;
2196
+ type kaylaInternals_PropOfFC<T extends FC<any, any>> = PropOfFC<T>;
2197
+ declare const kaylaInternals_createElement: typeof createElement;
2198
+ declare const kaylaInternals_createGame: typeof createGame;
2199
+ declare const kaylaInternals_createRenderer: typeof createRenderer;
2200
+ declare const kaylaInternals_createScene: typeof createScene;
2201
+ declare const kaylaInternals_useDisposableRef: typeof useDisposableRef;
2202
+ declare const kaylaInternals_useEffect: typeof useEffect;
2203
+ declare const kaylaInternals_useEntity: typeof useEntity;
2204
+ declare const kaylaInternals_useExports: typeof useExports;
2205
+ declare const kaylaInternals_useNextStack: typeof useNextStack;
2206
+ declare const kaylaInternals_usePaint: typeof usePaint;
2207
+ declare const kaylaInternals_useRef: typeof useRef;
2208
+ declare const kaylaInternals_useSelf: typeof useSelf;
2209
+ declare const kaylaInternals_useState: typeof useState;
2210
+ declare const kaylaInternals_useTick: typeof useTick;
2211
+ declare namespace kaylaInternals {
2212
+ export { type kaylaInternals_ExportsOfFC as ExportsOfFC, type kaylaInternals_FC as FC, type kaylaInternals_FCExports as FCExports, type kaylaInternals_FCProps as FCProps, kaylaInternals_JSX as JSX, type kaylaInternals_KaylaElement as KaylaElement, type kaylaInternals_KaylaElementRef as KaylaElementRef, type kaylaInternals_KaylaExportables as KaylaExportables, type kaylaInternals_KaylaExports as KaylaExports, kaylaInternals_KaylaFragment as KaylaFragment, type kaylaInternals_KaylaGame as KaylaGame, kaylaInternals_KaylaInternals as KaylaInternals, type kaylaInternals_KaylaRef as KaylaRef, type kaylaInternals_KaylaRenderer as KaylaRenderer, type kaylaInternals_KaylaScene as KaylaScene, type kaylaInternals_KaylaState as KaylaState, type kaylaInternals_PropOfFC as PropOfFC, kaylaInternals_createElement as createElement, kaylaInternals_createGame as createGame, kaylaInternals_createRenderer as createRenderer, kaylaInternals_createScene as createScene, selfSym as self, kaylaInternals_useDisposableRef as useDisposableRef, kaylaInternals_useEffect as useEffect, kaylaInternals_useEntity as useEntity, kaylaInternals_useExports as useExports, kaylaInternals_useNextStack as useNextStack, kaylaInternals_usePaint as usePaint, kaylaInternals_useRef as useRef, kaylaInternals_useSelf as useSelf, kaylaInternals_useState as useState, kaylaInternals_useTick as useTick };
2213
+ }
2214
+
2215
+ declare namespace UI {
2216
+ interface UIProps extends FCProps {
2217
+ x: number;
2218
+ y: number;
2219
+ width: number;
2220
+ height: number;
2221
+ onClick?: () => void;
2222
+ }
2223
+ const UIComponent: FC<UIProps>;
2224
+ }
2225
+
2226
+ type Kayla_ExportsOfFC<T extends FC<any, any>> = ExportsOfFC<T>;
2227
+ type Kayla_FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExports> = FC<Props, Exports>;
2228
+ type Kayla_FCExports = FCExports;
2229
+ type Kayla_FCProps = FCProps;
2230
+ declare const Kayla_JSX: typeof JSX;
2231
+ type Kayla_KaylaElement<Props extends FCProps> = KaylaElement<Props>;
2232
+ type Kayla_KaylaElementRef = KaylaElementRef;
2233
+ type Kayla_KaylaExportables = KaylaExportables;
2234
+ type Kayla_KaylaExports<StateMap extends Record<string, KaylaExportables>> = KaylaExports<StateMap>;
2235
+ declare const Kayla_KaylaFragment: typeof KaylaFragment;
2236
+ type Kayla_KaylaGame = KaylaGame;
2237
+ declare const Kayla_KaylaInternals: typeof KaylaInternals;
2238
+ type Kayla_KaylaRef<T> = KaylaRef<T>;
2239
+ type Kayla_KaylaRenderer = KaylaRenderer;
2240
+ type Kayla_KaylaScene = KaylaScene;
2241
+ type Kayla_KaylaState<T> = KaylaState<T>;
2242
+ type Kayla_PropOfFC<T extends FC<any, any>> = PropOfFC<T>;
2243
+ declare const Kayla_UI: typeof UI;
2244
+ declare const Kayla_createElement: typeof createElement;
2245
+ declare const Kayla_createGame: typeof createGame;
2246
+ declare const Kayla_createRenderer: typeof createRenderer;
2247
+ declare const Kayla_createScene: typeof createScene;
2248
+ declare const Kayla_useDisposableRef: typeof useDisposableRef;
2249
+ declare const Kayla_useEffect: typeof useEffect;
2250
+ declare const Kayla_useEntity: typeof useEntity;
2251
+ declare const Kayla_useExports: typeof useExports;
2252
+ declare const Kayla_useNextStack: typeof useNextStack;
2253
+ declare const Kayla_usePaint: typeof usePaint;
2254
+ declare const Kayla_useRef: typeof useRef;
2255
+ declare const Kayla_useSelf: typeof useSelf;
2256
+ declare const Kayla_useState: typeof useState;
2257
+ declare const Kayla_useTick: typeof useTick;
2258
+ declare namespace Kayla {
2259
+ export { type Kayla_ExportsOfFC as ExportsOfFC, type Kayla_FC as FC, type Kayla_FCExports as FCExports, type Kayla_FCProps as FCProps, Kayla_JSX as JSX, kaylaInternals as Kayla, type Kayla_KaylaElement as KaylaElement, type Kayla_KaylaElementRef as KaylaElementRef, type Kayla_KaylaExportables as KaylaExportables, type Kayla_KaylaExports as KaylaExports, Kayla_KaylaFragment as KaylaFragment, type Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, type Kayla_KaylaRef as KaylaRef, type Kayla_KaylaRenderer as KaylaRenderer, type Kayla_KaylaScene as KaylaScene, type Kayla_KaylaState as KaylaState, type Kayla_PropOfFC as PropOfFC, Kayla_UI as UI, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, selfSym as self, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useState as useState, Kayla_useTick as useTick };
2260
+ }
2261
+
2262
+ declare const _default: {
2263
+ LEA: typeof LEA;
2264
+ Kayla: typeof Kayla;
2265
+ };
2266
+
2267
+ export { Kayla, LEA, _default as default };