@kayelaa/canvas 0.1.14 → 0.2.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.
@@ -1,13 +1,16 @@
1
- import { a as LeaGameII, b as LeaRendererII, V as Vector2, R as RectLeaEntity, c as LeaSceneII } from './lea-DvxsutSf.cjs';
1
+ import { a as LeaGameII, b as LeaTimeout, c as LeaRendererII, d as LeaEventEmitter, V as Vector2, e as LeaTickerII, R as RectLeaEntity, f as LeaSceneII } from './lea-k7IGP_-W.cjs';
2
2
 
3
3
  /**
4
- * Base props interface that every Kayla component can receive.
4
+ * Base props that every Kayla functional component can receive.
5
5
  *
6
- * Extend this when defining custom component props:
6
+ * @remarks
7
+ * Extend this interface when defining custom component props.
7
8
  *
9
+ * @example
8
10
  * ```ts
9
- * interface MyProps extends FCProps {
10
- * speed: number;
11
+ * interface PlayerProps extends FCProps {
12
+ * initialSpeed?: number;
13
+ * color: string;
11
14
  * }
12
15
  * ```
13
16
  */
@@ -17,7 +20,23 @@ type FCProps = {
17
20
  ref?: KaylaRef<KaylaInternals.KaylaRectEntity>;
18
21
  exportsRef?: KaylaRef<KaylaExports<any>>;
19
22
  } & Record<string, unknown>;
23
+ /**
24
+ * Shape of the object that a component can expose to its parent via `exportsRef`.
25
+ *
26
+ * @remarks
27
+ * Usually contains methods, state handles, refs, or getters.
28
+ */
20
29
  type FCExports = {} & Record<string, KaylaExportables>;
30
+ /**
31
+ * Functional component type used across Kayla.
32
+ *
33
+ * @typeParam Props - Props the component accepts
34
+ * @typeParam Exports - Public API the component exposes (optional)
35
+ *
36
+ * @remarks
37
+ * Components must return zero, one, or many `KaylaElement`s.
38
+ * Returning `void` is allowed but produces no entities.
39
+ */
21
40
  interface FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExports> {
22
41
  (props: Props & {
23
42
  ref?: KaylaElementRef;
@@ -93,22 +112,32 @@ declare function createRenderer(canvas: HTMLCanvasElement): KaylaRenderer;
93
112
  * scene.spawn(elem);
94
113
  */
95
114
  declare function createElement<Props extends FCProps>(fc: FC<Props>, props: Props): KaylaElement<Props>;
115
+ /**
116
+ * Virtual element descriptor — the JSX representation of a component instance.
117
+ *
118
+ * @typeParam Props - Props type of the target component
119
+ *
120
+ * @see {@link createElement}
121
+ * @see {@link FC}
122
+ */
96
123
  interface KaylaElement<Props extends FCProps> {
97
124
  type: FC<Props>;
98
125
  props: Props;
99
126
  }
100
127
  /**
101
- * Read-only view of a state value created via `useState`.
128
+ * Read-only view of a piece of state managed by `useState`.
102
129
  *
103
- * Returned by `useState`. Changes via `.set()` / `.add()` / `.multiply()` may trigger
104
- * a component refresh (re-execution of the component function), which can be expensive
105
- * in performance-critical loops.
130
+ * @typeParam T - Type of the stored value
106
131
  *
107
- * **Performance warning:** Avoid frequent `.set()` calls in `useTick` / `usePaint` loops.
108
- * Prefer `useSelf` or `useRef` for hot data (position, velocity, timers, counters).
109
- * Use `useState` only for infrequent structural changes (e.g. `isDead`, `currentLevel`).
132
+ * @remarks
133
+ * **Performance critical warning**
134
+ * Frequent `.set()` calls inside `useTick` / `usePaint` loops will cause expensive
135
+ * component re-execution (refresh).
136
+ * → Use `useSelf` or `useRef` for position, velocity, timers, counters, etc.
137
+ * → Reserve `useState` for infrequent **structural** changes (health → 0, level up, isDead, etc.).
110
138
  *
111
- * @template T - Type of the stored value
139
+ * @see {@link useState}
140
+ * @see {@link useSelf} – recommended for most game loop data
112
141
  */
113
142
  interface KaylaState<T> extends KaylaInternals.KaylaInternalState<T> {
114
143
  }
@@ -170,7 +199,25 @@ interface KaylaRenderer extends KaylaInternals.KaylaRenderer {
170
199
  * rect.y += 5;
171
200
  * ```
172
201
  */
173
- interface KaylaRect extends KaylaInternals.KaylaRect {
202
+ interface KaylaRect extends KaylaInternals.KaylaInternalRect {
203
+ }
204
+ declare namespace KaylaRect {
205
+ function rawCollision(a: RawKaylaRect, b: RawKaylaRect): boolean;
206
+ function getCurrToBound(curr: Vector2, angleTo: number, bounds: RawKaylaRect): Vector2;
207
+ function createRawRect(hint: Partial<RawKaylaRect> & {
208
+ x?: number;
209
+ y?: number;
210
+ }): RawKaylaRect;
211
+ interface RawKaylaRect {
212
+ left: number;
213
+ right: number;
214
+ top: number;
215
+ bottom: number;
216
+ width: number;
217
+ height: number;
218
+ x: number;
219
+ y: number;
220
+ }
174
221
  }
175
222
  /**
176
223
  * Internal APIs, do not use outside.
@@ -184,6 +231,12 @@ declare namespace KaylaInternals {
184
231
  class KaylaGame extends LeaGameII {
185
232
  #private;
186
233
  constructor(width: number, height: number, hz: typeof Infinity | number);
234
+ /**
235
+ * Thenable tick-based timeout system
236
+ * @param ms milliseconds to wait, zero can be provided for next tick.
237
+ * @returns a thenable.
238
+ */
239
+ delay(ms: number): LeaTimeout;
187
240
  /**
188
241
  * Whether the game has been started.
189
242
  */
@@ -204,6 +257,16 @@ declare namespace KaylaInternals {
204
257
  * @param renderer - The renderer to attach
205
258
  */
206
259
  addRenderer(renderer: KaylaRenderer): void;
260
+ /**
261
+ * Always resolves the first ever renderer registered.
262
+ */
263
+ get mainRenderer(): KaylaRenderer;
264
+ /**
265
+ * Resolves all valid renderers.
266
+ *
267
+ * @returns - Shallow copy of renderers.
268
+ */
269
+ getRenderers(): KaylaRenderer[];
207
270
  /**
208
271
  * Detaches a renderer from the game.
209
272
  *
@@ -219,7 +282,6 @@ declare namespace KaylaInternals {
219
282
  * @extends LeaRendererII
220
283
  */
221
284
  class KaylaRenderer extends LeaRendererII {
222
- #private;
223
285
  /**
224
286
  * The attached game instance (set via `attachTo`).
225
287
  */
@@ -232,7 +294,16 @@ declare namespace KaylaInternals {
232
294
  * Current canvas-space pointer Y coordinate.
233
295
  */
234
296
  pointerY: number;
297
+ /**
298
+ * Pointer related event-emitter
299
+ */
300
+ protected pointerEvents: LeaEventEmitter<{
301
+ down: [Vector2, KaylaClickType];
302
+ }>;
235
303
  constructor(canvas: HTMLCanvasElement);
304
+ protected pointerPosUpdater(e: PointerEvent): void;
305
+ protected onPointerDown(e: PointerEvent): void;
306
+ static getClickType(e: PointerEvent): KaylaClickType;
236
307
  listenPointerUpdates(): void;
237
308
  unlistenPointerUpdates(): void;
238
309
  /**
@@ -285,6 +356,10 @@ declare namespace KaylaInternals {
285
356
  useRect(): KaylaRect;
286
357
  useFiber(): UnsafeKaylaFiber;
287
358
  useFiberControl(): KaylaFiberControl;
359
+ useCurrentTicker(): LeaTickerII;
360
+ useCurrentRenderer(): KaylaRenderer;
361
+ useCurrentGame(): KaylaGame;
362
+ useCurrentScene(): KaylaScene;
288
363
  useState<T>(initialValue?: T, { alwaysRecall }?: {
289
364
  alwaysRecall?: boolean;
290
365
  }): KaylaState<T>;
@@ -293,6 +368,9 @@ declare namespace KaylaInternals {
293
368
  useRef<T>(initialValue: T | null): KaylaRef<T>;
294
369
  useEffect(onEffect: KaylaFiber["onEffect"][number]): void;
295
370
  useExports<T extends FC<any, any>>(_fc: T, onExport: KaylaFiber<PropOfFC<T>, ExportsOfFC<T>>["onExport"]): void;
371
+ useGlobalClick(onClick: KaylaFiber["onGlobalClick"][number]): void;
372
+ useClick(onClick: KaylaFiber["onGlobalClick"][number]): void;
373
+ useContext<T>(context: KaylaContext<T>): T;
296
374
  save(): void;
297
375
  restore(): void;
298
376
  logLevel: "silent" | "warn" | "info" | "debug";
@@ -310,17 +388,19 @@ declare namespace KaylaInternals {
310
388
  isPrevented(): boolean;
311
389
  }
312
390
  /**
313
- * Read-only view of a state value created via `useState`.
391
+ * Read-only view of a piece of state managed by `useState`.
314
392
  *
315
- * Returned by `useState`. Changes via `.set()` / `.add()` / `.multiply()` may trigger
316
- * a component refresh (re-execution of the component function), which can be expensive
317
- * in performance-critical loops.
393
+ * @typeParam T - Type of the stored value
318
394
  *
319
- * **Performance warning:** Avoid frequent `.set()` calls in `useTick` / `usePaint` loops.
320
- * Prefer `useSelf` or `useRef` for hot data (position, velocity, timers, counters).
321
- * Use `useState` only for infrequent structural changes (e.g. `isDead`, `currentLevel`).
395
+ * @remarks
396
+ * **Performance critical warning**
397
+ * Frequent `.set()` calls inside `useTick` / `usePaint` loops will cause expensive
398
+ * component re-execution (refresh).
399
+ * → Use `useSelf` or `useRef` for position, velocity, timers, counters, etc.
400
+ * → Reserve `useState` for infrequent **structural** changes (health → 0, level up, isDead, etc.).
322
401
  *
323
- * @template T - Type of the stored value
402
+ * @see {@link useState}
403
+ * @see {@link useSelf} – recommended for most game loop data
324
404
  */
325
405
  class KaylaInternalState<T> {
326
406
  #private;
@@ -328,6 +408,7 @@ declare namespace KaylaInternals {
328
408
  constructor(current: KaylaFiber<any>, initialValue?: T, { alwaysRecall }?: {
329
409
  alwaysRecall?: boolean;
330
410
  });
411
+ /** Get the current value */
331
412
  get(this: KaylaState<T>): T;
332
413
  [Symbol.iterator](): Iterator<never>;
333
414
  refreshBased(): readonly [(s: T, args_1?: {
@@ -424,7 +505,7 @@ declare namespace KaylaInternals {
424
505
  set current(s: T);
425
506
  }
426
507
  function createReassignableRef<T>(initial: T): KaylaRef<T>;
427
- interface KaylaFiberControl {
508
+ interface KaylaFiberControlIm {
428
509
  /**
429
510
  * Current number of direct child fibers (readonly).
430
511
  * Reflects the length of `lastChildren` after the last reconciliation.
@@ -459,17 +540,46 @@ declare namespace KaylaInternals {
459
540
  * @returns {number} The limit (Infinity if no limit set)
460
541
  */
461
542
  getMaxChildren(): number;
543
+ /**
544
+ * Returns the key of the fiber.
545
+ */
546
+ get key(): string;
547
+ /**
548
+ * Returns an array of direct child entities.
549
+ * @returns Child entities
550
+ * @note Data may be stale; call fresh to ensure up-to-date results
551
+ */
552
+ getChildrenEntities(): KaylaRectEntity[];
553
+ /**
554
+ * Returns an array of ancestor entities, from closest to root.
555
+ * @returns Ancestor entities
556
+ */
557
+ getEntityChain(): KaylaRectEntity[];
558
+ /**
559
+ * Returns an array of ancestor fibers, from closest to root.
560
+ * @returns Ancestor fibers
561
+ */
562
+ getFiberChain(): UnsafeKaylaFiber[];
462
563
  }
463
- class KaylaFiber<Props extends FCProps = {}, Exports extends FCExports = FCExports> implements KaylaFiberControl {
564
+ class KaylaFiber<Props extends FCProps = {}, Exports extends FCExports = FCExports> implements KaylaFiberControlIm {
464
565
  state: KaylaState<any>[];
465
566
  refs: KaylaRef<unknown>[];
466
567
  global: GlobalKayla;
467
568
  callProps: Props;
468
569
  scene: KaylaScene;
469
570
  exports: KaylaExports<Exports>;
571
+ detectedParent?: KaylaFiber<any, any>;
572
+ contextInfo?: {
573
+ instance: KaylaContext<any>;
574
+ value: unknown;
575
+ };
470
576
  get childrenCount(): number;
471
577
  maxSafeChildren: number;
472
578
  constructor(globalKayla: GlobalKayla, scene: KaylaScene, element: KaylaElement<Props>);
579
+ getChildrenEntities(): KaylaRectEntity[];
580
+ pointerHook(pos: Vector2, type: KaylaClickType): void;
581
+ bindEvents(): void;
582
+ unbindEvents(): void;
473
583
  get key(): string;
474
584
  set key(s: string);
475
585
  get children(): KaylaElement<any>[];
@@ -477,6 +587,7 @@ declare namespace KaylaInternals {
477
587
  entity?: KaylaRectEntity;
478
588
  onExport: () => KaylaExports<Exports>;
479
589
  onEffect: Array<() => (() => void) | void>;
590
+ onGlobalClick: Array<(pos: Vector2, type: KaylaClickType) => void | void>;
480
591
  onInit: () => (() => void) | void;
481
592
  onUnInit: () => (() => void) | void;
482
593
  onUnEffect: Array<() => void>;
@@ -486,6 +597,7 @@ declare namespace KaylaInternals {
486
597
  fc?: FC<any>;
487
598
  useStateCallIndex: number;
488
599
  useEffectCallIndex: number;
600
+ useGlobalClickCallIndex: number;
489
601
  useDrawCallIndex: number;
490
602
  useStepCallIndex: number;
491
603
  useRefCallIndex: number;
@@ -495,8 +607,14 @@ declare namespace KaylaInternals {
495
607
  }>;
496
608
  watchedDeps?: KaylaState<any>[];
497
609
  lastDepStamps: number[];
610
+ getAttachedRenderer(): KaylaRenderer;
611
+ getAttachedGame(): KaylaGame;
498
612
  setMaxChildren(max: number): void;
499
613
  getMaxChildren(): number;
614
+ getFiberChain(): UnsafeKaylaFiber[];
615
+ getContextChain(): KaylaFiber<any, any>["contextInfo"][];
616
+ findContextValueFromInst(inst: KaylaContext<any>): unknown;
617
+ getEntityChain(): KaylaRectEntity[];
500
618
  shouldFullRefresh(): boolean;
501
619
  captureDepStamps(): void;
502
620
  refresh(): void;
@@ -511,7 +629,7 @@ declare namespace KaylaInternals {
511
629
  * Wraps a {@link LEA.RectLeaEntity} and delegates `update()` and `draw()` to the
512
630
  * component's `useTick` / `usePaint` hooks.
513
631
  *
514
- * Users should almost never interact with this class directly — use {@link KaylaRect}
632
+ * Users should almost never interact with this class directly — use {@link KaylaInternalRect}
515
633
  * or {@link useEntity()} / {@link useRef(self)} instead.
516
634
  *
517
635
  * @extends LEA.RectLeaEntity
@@ -519,9 +637,16 @@ declare namespace KaylaInternals {
519
637
  */
520
638
  class KaylaRectEntity extends RectLeaEntity {
521
639
  #private;
640
+ flags: Map<string, unknown>;
641
+ getRawRect(): KaylaRect.RawKaylaRect;
642
+ getFiber(): KaylaFiber<{}, Record<string, KaylaExportables>>;
522
643
  constructor(component: KaylaFiber, name: string);
644
+ setFlag(key: string, value: unknown): Map<string, unknown>;
645
+ getFlag(key: string): unknown;
646
+ removeFlag(key: string): boolean;
523
647
  update(_delta: number): void;
524
648
  draw(ctx: CanvasRenderingContext2D): void;
649
+ getRect(): KaylaInternalRect;
525
650
  }
526
651
  /**
527
652
  * A convenient facade for the rectangle entity associated with the current Kayla component.
@@ -550,9 +675,10 @@ declare namespace KaylaInternals {
550
675
  * rect.y += 5;
551
676
  * ```
552
677
  */
553
- class KaylaRect {
678
+ class KaylaInternalRect {
554
679
  #private;
555
680
  constructor(fiber: KaylaFiber<any, any>);
681
+ getRaw(): KaylaRect.RawKaylaRect;
556
682
  private get entity();
557
683
  /**
558
684
  * Checks whether this rectangle is currently colliding (overlapping or touching) with another rectangle.
@@ -565,10 +691,10 @@ declare namespace KaylaInternals {
565
691
  * - Touching edges **are** considered colliding (inclusive bounds check).
566
692
  * - Returns `false` if either entity is missing or not yet mounted.
567
693
  *
568
- * @param other - The other {@link KaylaRect} to test collision against
694
+ * @param other - The other {@link KaylaInternalRect} to test collision against
569
695
  * @returns `true` if the rectangles overlap or touch, `false` otherwise
570
696
  *
571
- * @example Basic enemy-player collision in useTick
697
+ * @example
572
698
  * ```ts
573
699
  * const playerRect = useRect();
574
700
  * const enemyRect = otherEnemy.exportsRef.current?.rect; // assuming exported via useExports
@@ -585,7 +711,11 @@ declare namespace KaylaInternals {
585
711
  *
586
712
  * @see {@link LEA.RectLeaEntity.isCollidingWith} — the underlying LEA implementation
587
713
  */
588
- isCollidingWith(rect: KaylaRect): boolean;
714
+ isCollidingWith(rect: KaylaInternalRect): boolean;
715
+ get setFlag(): (key: string, value: unknown) => Map<string, unknown>;
716
+ get getFlag(): (key: string) => unknown;
717
+ get removeFlag(): (key: string) => boolean;
718
+ isHovered(): boolean;
589
719
  /**
590
720
  * The position of the rectangle's top-left corner (or center, depending on LEA's origin convention).
591
721
  *
@@ -637,21 +767,79 @@ declare namespace KaylaInternals {
637
767
  */
638
768
  get z(): number;
639
769
  set z(s: number);
770
+ /**
771
+ * Left edge of the rectangle from `pos.x` and `width`.
772
+ * Writing to this property immediately updates the used properties.
773
+ *
774
+ * @type {number}
775
+ */
776
+ get left(): number;
777
+ set left(s: number);
778
+ /**
779
+ * Right edge of the rectangle from `pos.x` and `width`.
780
+ * Writing to this property immediately updates the used properties.
781
+ *
782
+ * @type {number}
783
+ */
784
+ get right(): number;
785
+ set right(s: number);
786
+ /**
787
+ * Top edge (flipped Y) of the rectangle from `pos.y` and `height`.
788
+ * Writing to this property immediately updates the used properties.
789
+ *
790
+ * @type {number}
791
+ */
792
+ get top(): number;
793
+ set top(s: number);
794
+ /**
795
+ * Top edge (flipped Y) of the rectangle from `pos.y` and `height`.
796
+ * Writing to this property immediately updates the used properties.
797
+ *
798
+ * @type {number}
799
+ */
800
+ get bottom(): number;
801
+ set bottom(s: number);
802
+ /**
803
+ * Converts a world position to local space relative to this entity.
804
+ *
805
+ * @param worldVec - World position
806
+ * @returns Local position
807
+ */
808
+ get toLocal(): (worldVec: Vector2) => Vector2;
809
+ /**
810
+ * Converts a local position to world space.
811
+ *
812
+ * @param localVec - Local position
813
+ * @returns World position
814
+ */
815
+ get toWorld(): (localVec: Vector2) => Vector2;
640
816
  }
641
817
  class KaylaScene {
642
818
  #private;
643
819
  constructor(scene: LeaSceneII);
820
+ /**
821
+ * Exposes all the dangerous fibers.
822
+ */
823
+ getFibers(): KaylaFiber<{}, Record<string, KaylaExportables>>[];
824
+ /**
825
+ * Exposes all the entities dangerously.
826
+ */
827
+ getEntities(): KaylaRectEntity[];
644
828
  /**
645
829
  * Returns the underlying LEA scene instance.
646
830
  */
647
831
  getScene(): LeaSceneII;
832
+ /**
833
+ * Exposes the game object.
834
+ */
835
+ getGame(): KaylaGame;
648
836
  private drawHandler;
649
837
  /**
650
838
  * Attaches this scene to a game instance.
651
839
  *
652
840
  * @param game - The game to attach to
653
841
  */
654
- attachTo(game: LeaGameII): void;
842
+ attachTo(game: KaylaGame): void;
655
843
  /**
656
844
  * Mounts a root component tree into the scene.
657
845
  *
@@ -659,7 +847,8 @@ declare namespace KaylaInternals {
659
847
  *
660
848
  * @param elem - Root Kayla element (usually JSX)
661
849
  */
662
- spawn(elem: KaylaElement<any>): void;
850
+ spawn(elem: KaylaElement<any>): Promise<void>;
851
+ private createFiber;
663
852
  /**
664
853
  * Detaches this scene from its game (if attached).
665
854
  */
@@ -668,83 +857,131 @@ declare namespace KaylaInternals {
668
857
  }
669
858
  const singleGlobalInstance: GlobalKayla;
670
859
  }
860
+ declare namespace KaylaContext {
861
+ interface ProviderProps<Context> extends FCProps {
862
+ value?: Context;
863
+ }
864
+ interface ProviderExports<Context> extends FCExports {
865
+ value: Context;
866
+ }
867
+ }
868
+ declare class KaylaContext<Context> {
869
+ #private;
870
+ constructor(defaultValue: Context);
871
+ get defaultValue(): Context;
872
+ Provider: FC<KaylaContext.ProviderProps<Context>, KaylaContext.ProviderExports<Context>>;
873
+ Consumer: never;
874
+ }
875
+ /**
876
+ * Creates a context object for sharing values across the component tree without manual prop drilling.
877
+ *
878
+ * **Unlike React, the Provider is a regular functional component** — use it like any other Kayla component.
879
+ * The context value is provided via the `value` prop on `<Provider>`.
880
+ *
881
+ * **This is not a hook** — call it at the top level of your module (outside components).
882
+ *
883
+ * @template T Type of the context value
884
+ * @param defaultValue Fallback value used when no `<Provider>` is found in the ancestor chain
885
+ * @returns Context object with a `.Provider` component (and `.defaultValue` for reference)
886
+ *
887
+ * @example Creating and using a simple game settings context
888
+ * // settings.ts
889
+ * export const GameSettingsContext = createContext({
890
+ * difficulty: "normal",
891
+ * soundVolume: 0.7,
892
+ * showParticles: true
893
+ * });
894
+ *
895
+ * // Root or layout component
896
+ * <GameSettingsContext.Provider value={{ difficulty: currentMode, soundVolume: 0.5, showParticles: false }}>
897
+ * <HUD />
898
+ * <GameWorld />
899
+ * </GameSettingsContext.Provider>
900
+ *
901
+ * // Deep child component
902
+ * const settings = useContext(GameSettingsContext);
903
+ *
904
+ * usePaint(ctx => {
905
+ * if (settings.showParticles) {
906
+ * // draw fancy effects
907
+ * }
908
+ * });
909
+ *
910
+ * @see {@link useContext} — to consume the context value in any descendant
911
+ */
912
+ declare function createContext<T>(defaultValue: T | null): KaylaContext<T>;
913
+ type KaylaClickType = "left" | "right" | "middle" | "invalid";
671
914
  /**
672
- * Returns a stateful value and a setter to update it.
915
+ * Returns a stateful value wrapper with `.get()`, `.set()`, `.add()` (for numbers), etc.
673
916
  *
674
917
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
675
918
  * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
676
919
  *
677
- * Calling the setter **may** schedule an entity refresh (re-execution of the component function),
678
- * which re-binds all hooks to the same entity instance and potentially re-spawns children.
679
- *
680
920
  * **Critical performance warning:**
681
- * **Do NOT** use `useState` for frequently-updated game data (position, velocity, rotation, timers, health deltas, etc.).
682
- * Those **must** live in `useSelf` or plain `useRef`.
683
- * `useState` is **only** for infrequent structural changes that should trigger refresh
684
- * (e.g. `isDead` spawn particles, `currentLevel` reload map, `variant`change sprite sheet).
685
- *
686
- * @template T The type of the state value
687
- * @param initialValue Optional initial value
688
- * @param options Configuration object
689
- * @param options.alwaysRecall If `true`, **every** `.set()` call triggers a refresh (default: `false`)
690
- * @returns A state wrapper with `.get()`, `.set()`, `.add()`, `.multiply()`, and `.lastChanged`
691
- *
692
- * @example Correct structural use
693
- * const isDead = useState(false);
694
- * if (health <= 0) isDead.set(true); // → refresh spawns death animation children
695
- *
696
- * @example Incorrect hot-data use (do NOT do this)
697
- * const pos = useState({ x: 400, y: 300 }); // BAD — thrashing + GC pressure
921
+ * Frequent `.set()` calls (especially inside `useTick`/`usePaint`) cause full component refresh expensive re-execution,
922
+ * hook re-binding, child reconciliation. **Do NOT** use `useState` for position, velocity, timers, counters, health deltas, etc.
923
+ * → Use `useSelf` or `useRef` for hot loop data.
924
+ * Reserve `useState` for infrequent **structural** changes (isDead, levelUp, gameOver, variant change spawn different children).
925
+ *
926
+ * @template T Type of the stored value
927
+ * @param initialValue Optional starting value
928
+ * @param options Configuration
929
+ * @param options.alwaysRecall If `true`, **every** `.set()` triggers refresh (default: `false`)
930
+ * @returns Read-only state handle with `.get()`, `.set(newValue, {recall?})`, `.add(delta, {recall?})`, `.lastChanged`
931
+ *
932
+ * @example
933
+ * const isGameOver = useState(false);
934
+ * if (player.health <= 0) isGameOver.set(true); // → refresh show game over screen children
935
+ *
936
+ * @example
937
+ * const x = useState(400); // BAD — massive overhead
938
+ * x.set(x.get() + speed * dt); // thrashing + GC pressure
698
939
  */
699
940
  declare const useState: <T>(initialValue?: T, { alwaysRecall }?: {
700
941
  alwaysRecall?: boolean;
701
942
  }) => KaylaState<T>;
702
943
  /**
703
- * Returns a mutable ref object whose `.current` property persists across entity refreshes.
944
+ * Creates a mutable reference that **persists across refreshes** and **never causes refresh** when `.current` is changed.
704
945
  *
705
946
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
706
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt internal ref storage.
707
- *
708
- * Changes to `.current` **never** trigger refresh or re-bind hooks — refs are stable for the entity's lifetime.
709
- *
710
- * **Primary use:** Hold mutable game state, methods, timers, audio nodes, previous values, etc.
711
- * For most entities, wrap your full logic in `useSelf()` instead (strongly recommended pattern).
947
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
712
948
  *
713
- * Special case: pass the `self` symbol to get the current LEA entity:
949
+ * Ideal for: mutable game data (position, velocity, timers, audio nodes, DOM refs, previous values), methods, etc.
950
+ * Special usage: pass the {@link self} symbol to get a stable reference to the current entity's {@link KaylaRectEntity}.
714
951
  *
715
- * @template T The type of the ref's value
716
- * @param initialValue Initial value for `.current`, or `self` symbol for entity reference
717
- * @returns A ref object with mutable `.current` property
952
+ * @template T Type of value stored in `.current`
953
+ * @param initialValue Starting value or {@link self} to receive the entity
954
+ * @returns Mutable ref object changes to `.current` have **zero** render cost
718
955
  *
719
- * @example Entity reference
956
+ * @example
720
957
  * const entity = useRef(self);
721
- * entity.current.x += 10; // direct entity mutation, no refresh
958
+ * entity.current.pos.x += 120 * dt; // direct mutation no refresh
722
959
  *
723
- * @example Mutable counter
724
- * const timer = useRef(0);
725
- * useTick(delta => { timer.current += delta; });
960
+ * @example
961
+ * const elapsed = useRef(0);
962
+ * useTick(dt => { elapsed.current += dt; });
726
963
  */
727
964
  declare const useRef: {
728
965
  (initialValue: typeof selfSym): KaylaElementRef;
729
966
  <T>(initialValue: T | null): KaylaRef<T>;
730
967
  };
731
968
  /**
732
- * Opt-in: only refresh this component when one of the listed states changes.
969
+ * Opt-in: skip full refresh unless one of the listed states has changed since last refresh.
970
+ *
971
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
972
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
733
973
  *
734
- * Call this **once** at the top level of your component (after all useState calls
735
- * you want to watch).
974
+ * Call **once**, after all relevant `useState` hooks.
975
+ * If none of the watched states changed → skips re-running component body, hooks, children.
736
976
  *
737
- * If none of the watched states change since last refresh → skip re-running
738
- * the component body, hook re-binding, child reconciliation, etc.
977
+ * @param deps Array of `useState` handles to watch
739
978
  *
740
979
  * @example
741
- * const health = useState(100);
742
- * const level = useState(1);
743
- * const isPaused = useState(false);
744
- *
745
- * useShouldRefresh([health, level, isPaused]);
980
+ * const health = useState(100);
981
+ * const level = useState(1);
982
+ * useShouldRefresh([health, level]);
746
983
  *
747
- * // Now the component only re-runs when one of those actually changes
984
+ * // now only refreshes when health or level actually changes
748
985
  */
749
986
  declare const useShouldRefresh: (deps: KaylaState<any>[]) => void;
750
987
  /**
@@ -768,255 +1005,480 @@ declare const useShouldRefresh: (deps: KaylaState<any>[]) => void;
768
1005
  */
769
1006
  declare const useEffect: (onEffect: KaylaInternals.KaylaFiber["onEffect"][number]) => void;
770
1007
  /**
771
- * Runs the provided callback **exactly once** when the entity is first created/mounted.
1008
+ * Registers a callback that runs on **every click anywhere** in any attached renderer.
772
1009
  *
773
- * Unlike `useEffect`, this hook **never re-runs** on subsequent refresheseven if structural state changes.
774
- * Ideal for true one-time initialization that should survive refreshes:
775
- * - Creating physics bodies / collision shapes
776
- * - Setting up audio contexts / WebGL resources
777
- * - Attaching global event listeners (pointer lock, resize observers)
778
- * - One-time asset preloading or data fetching
1010
+ * **This hook MUST be called at the top level of a component function never inside loops, conditions, nested functions, or callbacks.**
1011
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
779
1012
  *
780
- * If the callback returns a cleanup function, it will be called **only when the entity is finally destroyed** (unuse).
1013
+ * Useful for global input (pause menu toggle, debug shortcuts, drag anywhere…).
1014
+ * Multiple `useGlobalClick` calls **stack** and run in declaration order.
781
1015
  *
782
- * **This hook MUST be called at the top level of a component function.**
1016
+ * @param callback Global click handler receives world position and click type
783
1017
  *
784
- * @param init - Callback that runs once on first mount. May return a cleanup function.
785
1018
  * @example
786
- * useInitialization(() => {
787
- * const audioCtx = new AudioContext();
788
- * // one-time setup
1019
+ * useGlobalClick((pos, type) => {
1020
+ * if (type === "right") {
1021
+ * isPaused.set(!isPaused.get());
1022
+ * }
1023
+ * });
1024
+ */
1025
+ declare const useGlobalClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick"][number]) => void;
1026
+ /**
1027
+ * Registers a callback that runs **whenever the entity is clicked** (inside its bounds).
789
1028
  *
790
- * return () => {
791
- * audioCtx.close(); // cleanup only on destroy
792
- * };
1029
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1030
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1031
+ *
1032
+ * Uses the rectangle bounds from {@link useRect} / underlying entity.
1033
+ * Multiple `useClick` calls **stack** and run in declaration order.
1034
+ *
1035
+ * @param callback Click handler — receives world position and click type ("left" | "right" | "middle")
1036
+ *
1037
+ * @example
1038
+ * useClick((pos, type) => {
1039
+ * if (type === "left") {
1040
+ * score.add(1);
1041
+ * playSound("collect");
1042
+ * // optional: spawn particle children on click
1043
+ * }
1044
+ * });
1045
+ *
1046
+ * @see {@link useGlobalClick} — for clicks anywhere (not bound to this entity)
1047
+ */
1048
+ declare const useClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick"][number]) => void;
1049
+ /**
1050
+ * Runs a one-time initialization function **exactly once** when the entity is first mounted.
1051
+ *
1052
+ * Unlike `useEffect`, this **never re-runs** on refreshes — perfect for true setup that should survive structural changes.
1053
+ *
1054
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1055
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1056
+ *
1057
+ * If the callback returns a function, it is called **only on final entity destruction**.
1058
+ *
1059
+ * @param init One-time setup function — may return cleanup
1060
+ *
1061
+ * @example
1062
+ * useInitialization(() => {
1063
+ * const body = physicsEngine.createBody({ ... });
1064
+ * return () => physicsEngine.destroyBody(body); // cleanup only on unmount
793
1065
  * });
794
1066
  */
795
1067
  declare const useInitialization: (init: KaylaInternals.KaylaFiber["onInit"]) => void;
796
1068
  /**
797
- * Returns a stable facade object giving convenient mutable access to the
798
- * current component's underlying rectangle entity properties.
1069
+ * Returns a convenient, mutable facade for the current entity's rectangle properties.
799
1070
  *
800
1071
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
801
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
1072
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
802
1073
  *
803
- * The returned object is created only once per entity lifetime and always
804
- * points to the current {@link KaylaRectEntity}.
1074
+ * Provides direct getters/setters for `x`, `y`, `width`, `height`, `z`, `pos` (live Vector2), `left`/`right`/`top`/`bottom`, plus helpers like `.isCollidingWith()` and `.isHovered()`.
805
1075
  *
806
- * Prefer this over `useEntity()` when you just need position & size.
1076
+ * **Recommended over `useEntity()` for most cases** cleaner API, same performance, better discoverability.
807
1077
  *
808
- * @returns {KaylaRect} Facade with `.pos`, `.x`, `.y`, `.width`, `.height`, `.z`, etc.
1078
+ * @returns {KaylaRect} Mutable rect facade (changes never trigger refresh)
809
1079
  *
810
1080
  * @example
811
1081
  * const rect = useRect();
1082
+ *
812
1083
  * useTick(dt => {
813
- * rect.pos.x += 180 * dt; // direct Vector2 mutation
814
- * rect.y += Math.sin(rect.x * 0.01) * 60 * dt; // alias usage
1084
+ * rect.x += 180 * dt; // alias setter
1085
+ * rect.pos.y = 300 + Math.sin(Date.now() * 0.001) * 80; // live Vector2
1086
+ * rect.z = Math.floor(rect.x / 100); // sort by horizontal position
815
1087
  * });
1088
+ *
1089
+ * useTick(() => {
1090
+ * if (rect.isHovered()) {
1091
+ * rect.width = 80; // visual feedback
1092
+ * }
1093
+ * });
1094
+ *
1095
+ * @see {@link useEntity} — when you need the raw LEA entity methods/properties
816
1096
  */
817
- declare const useRect: () => KaylaInternals.KaylaRect;
1097
+ declare const useRect: () => KaylaRect;
818
1098
  /**
819
- * Registers a callback that runs on every game tick (update phase).
1099
+ * Registers a function that runs on **every game tick** (update phase).
820
1100
  *
821
1101
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
822
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt tick registration.
1102
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
823
1103
  *
824
- * Multiple `useTick` calls **stack** all run in declaration order every tick.
825
- * Call `event.preventDefault()` to skip remaining tick handlers for this entity (including default update).
1104
+ * Multiple `useTick` calls **stack** and run in declaration order.
1105
+ * Call `event.preventDefault()` to skip remaining tick handlers (including default entity update).
826
1106
  *
827
- * **Use for:** physics, movement, AI, timers, collision checks, input polling.
1107
+ * @param callback Update handler receives delta time (seconds) and cancellable event
828
1108
  *
829
- * @param callback Tick handler receiving delta time (seconds) and cancellable event
1109
+ * @example Movement + simple boundary check
1110
+ * useTick((dt, event) => {
1111
+ * rect.pos.x += 200 * dt;
1112
+ * if (rect.right > 800) {
1113
+ * rect.pos.x = 800 - rect.width;
1114
+ * event.preventDefault(); // skip default update if desired
1115
+ * }
1116
+ * });
830
1117
  */
831
1118
  declare const useTick: (onTick: KaylaInternals.KaylaFiber["onTick"][number]) => void;
832
1119
  /**
833
- * Registers a callback that runs on every render frame (paint phase).
1120
+ * Registers a function that runs on **every render frame** (paint phase).
834
1121
  *
835
1122
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
836
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt paint registration.
1123
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
837
1124
  *
838
- * Multiple `usePaint` calls **stack** all run in declaration order every frame.
839
- * Call `event.preventDefault()` to skip remaining paint handlers (including default rect fill).
1125
+ * Multiple `usePaint` calls **stack** and run in declaration order.
1126
+ * Call `event.preventDefault()` to skip remaining paint calls (including default rect fill).
840
1127
  *
841
- * **Use for:** drawing sprites, particles, health bars, debug overlays, name tags.
1128
+ * @param callback Paint handler receives CanvasRenderingContext2D and cancellable event
842
1129
  *
843
- * @param callback Paint handler receiving canvas context and cancellable event
1130
+ * @example
1131
+ * usePaint((ctx) => {
1132
+ * ctx.save();
1133
+ * ctx.translate(rect.x, rect.y);
1134
+ * ctx.fillStyle = "rgba(255,0,0,0.3)";
1135
+ * ctx.fillRect(-rect.width/2, -rect.height/2, rect.width, rect.height);
1136
+ * ctx.restore();
1137
+ * });
844
1138
  */
845
1139
  declare const usePaint: (onPaint: KaylaInternals.KaylaFiber["onPaint"][number]) => void;
846
1140
  /**
847
- * Defines the public API this entity exposes to its parent via the `exportsRef` prop.
1141
+ * Exposes a public API (methods, getters, state handles…) to parent components via `exportsRef`.
848
1142
  *
849
1143
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
850
- * The call order of all hooks is **strictly fixed**; only **one** `useExports` call is allowed per component (later calls override earlier ones).
851
- *
852
- * The exporter function runs during every refresh; the returned object is assigned to `this.exports`.
853
- * Parent receives it via `exportsRef.current` (stable reference).
1144
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
854
1145
  *
855
- * **Use for:** exposing methods (jump, takeDamage), getters (position, health), or state handles to parent.
1146
+ * Only **one** `useExports` per component later calls override earlier ones.
1147
+ * The exporter function runs on every refresh.
856
1148
  *
857
- * @template T The functional component type (used for type inference)
858
- * @param component The component function itself (required for TypeScript inference)
859
- * @param exporter Function returning the exportable values/methods
1149
+ * @param component The component function itself (for TS inference)
1150
+ * @param exporter Returns object of exportable values/methods
860
1151
  *
861
1152
  * @example
862
1153
  * useExports(Player, () => ({
863
- * jump: () => { ... },
864
- * getPosition: () => entity.current.pos.clone()
1154
+ * takeDamage: (amount: number) => { health -= amount; },
1155
+ * getHealth: () => health,
1156
+ * rect: useRect() // or exportsRef.current?.rect
865
1157
  * }));
1158
+ *
1159
+ * // Parent usage
1160
+ * <Player exportsRef={enemyRef} />
1161
+ * enemyRef.current?.takeDamage(25);
866
1162
  */
867
1163
  declare const useExports: <T extends FC<any, any>>(_fc: T, onExport: KaylaInternals.KaylaFiber<PropOfFC<T>, ExportsOfFC<T>>["onExport"]) => void;
868
1164
  /**
869
- * Creates and returns a stable object (god-object) for holding most of an entity's state and logic.
1165
+ * Creates a stable "god object" that holds most of an entity's mutable state and logic.
1166
+ * The initializer runs **only once** — returned object is the **same reference** forever.
870
1167
  *
871
1168
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
872
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
873
- *
874
- * The initializer runs **only once** (on first entity creation); the returned object is the **same reference** on every refresh.
1169
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
875
1170
  *
876
- * **Recommended pattern:** Put nearly all mutable state, methods, and game logic here.
877
- * Use `useState` **only** for rare structural changes that should trigger refresh.
1171
+ * **Recommended 2025–2026 pattern:** Put almost everything here (position, velocity, health, AI state, methods…).
1172
+ * Use `useState` **only** for rare structural triggers.
878
1173
  *
879
- * @template T The type of the god-object
880
- * @param init Factory function returning the object (called only once)
881
- * @returns The initialized god-object (stable across refreshes)
1174
+ * @template T Type of your state/logic object
1175
+ * @param init Factory called once returns your stateful object
1176
+ * @returns The same object instance on every render
882
1177
  *
883
1178
  * @example
884
1179
  * const self = useSelf(() => ({
885
- * pos: new Vector2(400, 300),
886
- * vel: new Vector2(100, 0),
887
- * tick(delta) { this.pos.x += this.vel.x * delta; }
1180
+ * pos: new LEA.Vector2(400, 300),
1181
+ * vel: new LEA.Vector2(180, 0),
1182
+ * health: 100,
1183
+ * hurt(dmg: number) {
1184
+ * this.health -= dmg;
1185
+ * if (this.health <= 0) {
1186
+ * // structural change → useState trigger
1187
+ * isDead.set(true);
1188
+ * }
1189
+ * }
888
1190
  * }));
889
1191
  *
890
- * useTick(delta => self.tick(delta));
1192
+ * useTick(dt => {
1193
+ * self.pos.add(self.vel.clone().scale(dt));
1194
+ * });
891
1195
  */
892
1196
  declare const useSelf: <T>(init: () => T) => T;
893
1197
  /**
1198
+ * Provides safe, controlled access to fiber-level operations and metadata.
1199
+ *
1200
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1201
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1202
+ *
1203
+ * Returned object is stable across refreshes.
1204
+ * Use this instead of `useFiber()` when you need fiber introspection or manual control.
1205
+ *
1206
+ * @returns {KaylaFiberControl} Safe fiber control surface
1207
+ *
1208
+ * @example
1209
+ * const control = useFiberControl();
1210
+ * if (control.childrenCount > 120) {
1211
+ * control.setMaxChildren(100); // soft-enforces limit + logs warning
1212
+ * }
1213
+ *
1214
+ * // Rare manual refresh (prefer useShouldRefresh + declarative patterns)
1215
+ * if (someExternalCondition) control.refresh();
1216
+ */
1217
+ declare const useFiberControl: () => KaylaFiberControl;
1218
+ /**
1219
+ * **UNSAFE** — direct access to the internal `KaylaFiber` instance.
1220
+ *
894
1221
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
895
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
1222
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
896
1223
  *
897
- * Returns a safe control surface for the current fiber instance.
1224
+ * **Avoid unless you have a very specific low-level need** (advanced debugging, custom reconciler experiments…).
1225
+ * Prefer {@link useFiberControl} for almost everything.
898
1226
  *
899
- * Provides limited, controlled access to fiber-level operations:
900
- * - Manually trigger a refresh
901
- * - Read the current number of direct children
902
- * - Set a safety limit on maximum allowed direct children (soft enforcement)
1227
+ * @returns Current fiber (do **not** cache — may become stale)
1228
+ */
1229
+ declare const useFiber: () => UnsafeKaylaFiber;
1230
+ /**
1231
+ * Returns a stable ref to the underlying raw {@link KaylaRectEntity} (LEA entity).
903
1232
  *
904
- * **This is the recommended way** to interact with fiber internals when needed.
905
- * Avoid using `useFiber()` (unsafe) unless you have a very specific reason.
1233
+ * **This hook MUST be called at the top level of a component function never inside loops, conditions, nested functions, or callbacks.**
1234
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1235
+ *
1236
+ * Use when you need direct access to LEA-specific features not exposed on {@link KaylaRect} (custom flags, advanced transforms…).
906
1237
  *
907
- * The returned object is stable across refreshes.
1238
+ * **Most of the time prefer {@link useRect}** — it wraps the same entity with a nicer, game-oriented API.
908
1239
  *
909
- * @returns {KaylaFiberControl}
1240
+ * @returns Stable ref to the entity instance
910
1241
  *
911
1242
  * @example
912
- * const control = useFiberControl();
1243
+ * const entityRef = useEntity();
1244
+ * entityRef.current.setFlag("invincible", true);
913
1245
  *
914
- * // Force refresh (rarely needed — prefer declarative + useShouldRefresh)
915
- * control.refresh();
1246
+ * useTick(() => {
1247
+ * if (entityRef.current.getFlag("invincible")) {
1248
+ * // skip damage logic
1249
+ * }
1250
+ * });
916
1251
  *
917
- * // Monitor child count
918
- * if (control.childrenCount > 100) {
919
- * console.warn("Too many children");
920
- * control.setMaxChildren(80);
921
- * }
1252
+ * @see {@link useRef}(`self`) — alternative way to get the same entity ref
1253
+ * @see {@link useRect} usually the better daily driver
922
1254
  */
923
- declare const useFiberControl: () => KaylaInternals.KaylaFiberControl;
1255
+ declare const useEntity: () => KaylaElementRef;
924
1256
  /**
925
- * **UNSAFE** Returns direct access to the current `KaylaFiber` instance.
1257
+ * Returns the current game instance this entity belongs to.
926
1258
  *
927
1259
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
928
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
1260
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1261
+ *
1262
+ * Useful for accessing global timing, adding renderers/scenes dynamically, etc.
1263
+ *
1264
+ * @returns {KaylaGame} The game coordinator
929
1265
  *
930
- * **Use with extreme caution** — this exposes internal implementation details.
931
- * Most use-cases should use `useFiberControl()` instead.
1266
+ * @example
1267
+ * const game = useCurrentGame();
1268
+ * game.delay(3000).then(() => {
1269
+ * spawnNextLevel();
1270
+ * });
1271
+ */
1272
+ declare const useCurrentGame: () => KaylaInternals.KaylaGame;
1273
+ /**
1274
+ * Returns the main (usually first) renderer attached to the current game.
1275
+ *
1276
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1277
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
932
1278
  *
933
- * Intended only for advanced debugging, testing, or very specific low-level needs.
1279
+ * Handy for pointer world coordinate conversion or canvas measurements.
934
1280
  *
935
- * @returns {UnsafeKaylaFiber} The current fiber (may change on refresh — do not cache!)
1281
+ * @returns Primary {@link KaylaRenderer}
936
1282
  *
937
- * @see {@link useFiberControl} for the safe alternative
1283
+ * @example
1284
+ * const renderer = useCurrentRenderer();
1285
+ * useTick(() => {
1286
+ * const mouseWorld = renderer.getMousePos();
1287
+ * rect.pos.copy(mouseWorld);
1288
+ * });
938
1289
  */
939
- declare const useFiber: () => UnsafeKaylaFiber;
1290
+ declare const useCurrentRenderer: () => KaylaInternals.KaylaRenderer;
940
1291
  /**
1292
+ * Returns the scene this component/entity was spawned into.
1293
+ *
941
1294
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
942
- * The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
1295
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
943
1296
  *
944
- * Returns a direct reference to the underlying {@link KaylaRectEntity} instance managed by this component.
1297
+ * Useful when you need to interact with the scene directly (e.g. spawn additional root-level entities,
1298
+ * check paused state, access scene-specific data, or manipulate the entity collection).
945
1299
  *
946
- * The returned ref is **stable** for the entity's lifetime and allows low-level access to all LEA entity properties
947
- * (`x`, `y`, `z`, `width`, `height`, `pos`, custom data, etc.).
1300
+ * @returns {KaylaScene} The scene wrapper managing this entity's lifecycle and siblings
948
1301
  *
949
- * **Recommended alternative in 2025–2026 style:**
950
- * Prefer {@link useRect} for most use-cases — it provides a cleaner, more convenient facade with the same mutability
951
- * and **no performance difference**, but better readability and discoverability (`.x`, `.y`, `.pos`, `.width`, `.isCollidingWith(...)`).
1302
+ * @example
1303
+ * const scene = useCurrentScene();
952
1304
  *
953
- * Use `useEntity()` only when you need:
954
- * - Direct access to LEA-specific properties/methods not exposed on {@link KaylaRect}
955
- * - `.current` typing as `KaylaRectEntity` (more precise than the facade)
956
- * - Passing the raw entity reference to external systems (physics, pooling, debugging)
1305
+ * useInitialization(() => {
1306
+ * // Example: spawn a floating damage number when hit
1307
+ * const showDamage = (amount: number) => {
1308
+ * scene.spawn(
1309
+ * <DamagePopup x={rect.x} y={rect.y - 40} value={amount} />
1310
+ * );
1311
+ * };
1312
+ *
1313
+ * // ... later in useExports or event handler
1314
+ * return { showDamage };
1315
+ * });
1316
+ */
1317
+ declare const useCurrentScene: () => KaylaInternals.KaylaScene;
1318
+ /**
1319
+ * Returns the shared game ticker — the central update scheduler.
1320
+ *
1321
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1322
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
957
1323
  *
958
- * **This hook MUST be called at the top level of a component function.**
1324
+ * Gives direct access to LEA's ticker for creating precise, game-time-aware timeouts, intervals,
1325
+ * or one-shot scheduled tasks that respect pause / speed modifiers / fixed timestep.
959
1326
  *
960
- * @returns {KaylaElementRef} Stable ref to the `KaylaRectEntity` instance
1327
+ * @returns {LEA.LeaTickerII} The game's update ticker instance
961
1328
  *
962
1329
  * @example
963
- * ```ts
964
- * const entityRef = useEntity();
1330
+ * const ticker = useCurrentTicker();
1331
+ *
1332
+ * useInitialization(() => {
1333
+ * const timeout = ticker.createTimeout(4500); // 4.5 seconds game time
965
1334
  *
1335
+ * timeout.then(() => {
1336
+ * // cleanup logic or spawn explosion children
1337
+ * isDead.set(true);
1338
+ * });
1339
+ *
1340
+ * return () => timeout.cancel(); // important: prevent memory leak on early destroy
1341
+ * });
1342
+ *
1343
+ * @example
966
1344
  * useTick(dt => {
967
- * entityRef.current.pos.x += 200 * dt;
968
- * entityRef.current.z = Math.sin(Date.now() * 0.001) * 10 + 10;
1345
+ * if (someCondition && !scheduled) {
1346
+ * ticker.createTimeout(0).then(() => doNextFrameThing());
1347
+ * scheduled = true;
1348
+ * }
969
1349
  * });
970
- * ```
1350
+ */
1351
+ declare const useCurrentTicker: () => LeaTickerII;
1352
+ /**
1353
+ * Reads the current value of a Kayla context.
1354
+ *
1355
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1356
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
971
1357
  *
972
- * @see {@link useRect} usually the better choice (cleaner API, includes collision helper)
973
- * @see {@link useRef} with `self` symbol alternative way to get the entity ref
1358
+ * Context lets you share global-ish data (theme, game mode, player reference, audio settings…)
1359
+ * down the tree without passing props through every level.
1360
+ *
1361
+ * Returns the nearest ancestor `<Provider>`'s value — or the default value if no provider is found.
1362
+ *
1363
+ * @param context - The context object created via `createContext(defaultValue)`
1364
+ * @returns The current context value (type-inferred from context)
1365
+ *
1366
+ * @example Using a theme context
1367
+ * const ThemeContext = createContext({
1368
+ * bg: "#111",
1369
+ * accent: "#ff3366",
1370
+ * text: "#eee"
1371
+ * });
1372
+ *
1373
+ * // Deep in UI tree:
1374
+ * const theme = useContext(ThemeContext);
1375
+ *
1376
+ * usePaint(ctx => {
1377
+ * ctx.fillStyle = theme.bg;
1378
+ * ctx.fillRect(0, 0, rect.width, rect.height);
1379
+ * });
1380
+ *
1381
+ * // Provider somewhere higher:
1382
+ * <ThemeContext.Provider value={{ bg: "#000", accent: currentThemeColor, text: "#fff" }}>
1383
+ * <HUD />
1384
+ * <World />
1385
+ * </ThemeContext.Provider>
1386
+ *
1387
+ * @see {@link createContext} — to create the context object
974
1388
  */
975
- declare const useEntity: () => KaylaElementRef;
1389
+ declare const useContext: <T>(context: KaylaContext<T>) => T;
976
1390
  /**
977
- * Special symbol used to obtain a reference to the current entity.
1391
+ * Special symbol used with `useRef` to get a stable reference to the current entity's underlying LEA `KaylaRectEntity`.
978
1392
  *
979
- * Pass this to `useRef` to get the underlying `KaylaRectEntity`:
1393
+ * Pass this symbol directly as the initial value to `useRef(self)` it is replaced with the actual entity instance once mounted.
980
1394
  *
981
- * ```ts
1395
+ * **Do NOT** use this symbol anywhere else — it's only meaningful as the argument to `useRef`.
1396
+ *
1397
+ * @example
982
1398
  * const entity = useRef(self);
983
- * entity.current.x += 10;
984
- * ```
985
1399
  *
986
- * @see {@link useRef}
1400
+ * useTick(dt => {
1401
+ * entity.current.pos.x += 150 * dt;
1402
+ * entity.current.setFlag("invulnerable", true);
1403
+ * });
1404
+ *
1405
+ * // Later — access raw LEA entity methods
1406
+ * entity.current.getRect(); // or other LEA-specific stuff
1407
+ *
1408
+ * @see {@link useRef} — the hook that accepts this symbol
1409
+ * @see {@link useEntity} — alternative that directly returns the ref (no symbol needed)
1410
+ * @see {@link useRect} — usually more convenient for day-to-day position/size work
987
1411
  */
988
1412
  declare const selfSym: unique symbol;
989
1413
 
990
1414
  /**
991
- * Schedules a callback to run in the next microtask (via `Promise.resolve().then`).
992
- *
993
- * Used internally to defer entity refreshes safely and prevent synchronous re-entrancy.
994
- * Rarely needed directly by users.
1415
+ * Schedules a callback to run in the **next microtask** (after the current call stack clears).
1416
+ *
1417
+ * **This is not a hook** you can call it anywhere inside a component function, including inside `useTick`, `useInitialization`, `useEffect`, etc.
1418
+ *
1419
+ * Most useful when you need to:
1420
+ * - Access `exportsRef.current`, child entities, or sibling fibers **immediately after** mount/refresh
1421
+ * - Work around cases where the fiber tree isn't fully reconciled yet during the current execution
1422
+ *
1423
+ * @param callback Function to run asynchronously in the next microtask
1424
+ *
1425
+ * @example Accessing child exports right after spawn
1426
+ * function Parent() {
1427
+ * const childrenRef = useRef<KaylaExports<any>[]>([]);
1428
+ *
1429
+ * useInitialization(() => {
1430
+ * useNextStack(() => {
1431
+ * // Now children should be mounted & exports available
1432
+ * const kids = getChildrenEntities(); // or however you collect them
1433
+ * childrenRef.current = kids.map(k => k.exportsRef?.current).filter(Boolean);
1434
+ * console.log("Children ready:", childrenRef.current.length);
1435
+ * });
1436
+ * });
1437
+ *
1438
+ * return (
1439
+ * <>
1440
+ * <Child exportsRef={child1Ref} />
1441
+ * <Child exportsRef={child2Ref} />
1442
+ * </>
1443
+ * );
1444
+ * }
995
1445
  *
996
- * @param callback - The function to schedule
1446
+ * @example Delaying something until after paint/tick phase
1447
+ * useTick(dt => {
1448
+ * // ... movement logic ...
1449
+ * useNextStack(() => {
1450
+ * // check collisions or post-process after all ticks have run
1451
+ * });
1452
+ * });
997
1453
  */
998
1454
  declare const useNextStack: (callback: () => void) => void;
999
1455
  /**
1000
- * A fragment component that simply returns its children.
1456
+ * Fragment component allows returning multiple children without creating an extra wrapper entity/rectangle.
1001
1457
  *
1002
- * Useful for grouping entities without adding an extra wrapper entity.
1003
- * Behaves like React.Fragment — no additional DOM/entity overhead.
1458
+ * Behaves like React.Fragment: zero runtime cost, no additional `KaylaRectEntity` is spawned.
1004
1459
  *
1005
- * @example
1006
- * return (
1007
- * <KaylaFragment>
1008
- * <Enemy />
1009
- * <Coin />
1010
- * </KaylaFragment>
1011
- * );
1012
- *
1013
- * // Or shorthand:
1014
- * return (
1015
- * <>
1016
- * <Enemy />
1017
- * <Coin />
1018
- * </>
1019
- * );
1460
+ * **This is a regular functional component** — use it in JSX/TSX just like any other component.
1461
+ *
1462
+ * @example Grouping without extra entity overhead
1463
+ * function Explosion() {
1464
+ * return (
1465
+ * <KaylaFragment>
1466
+ * <Particle x={0} y={0} color="yellow" />
1467
+ * <Particle x={-20} y={10} color="orange" />
1468
+ * <Particle x={15} y={-15} color="red" />
1469
+ * </KaylaFragment>
1470
+ * );
1471
+ * }
1472
+ *
1473
+ * // Or using JSX fragment shorthand (preferred)
1474
+ * function Explosion() {
1475
+ * return (
1476
+ * <>
1477
+ * <Particle x={0} y={0} color="yellow" />
1478
+ * <Particle x={-20} y={10} color="orange" />
1479
+ * </>
1480
+ * );
1481
+ * }
1020
1482
  */
1021
1483
  declare const KaylaFragment: FC;
1022
1484
  declare namespace JSX {
@@ -1069,7 +1531,7 @@ declare function createReassignableObject<T extends object>(initial: T): Reassig
1069
1531
  declare function setLogLevel(level: KaylaInternals.GlobalKayla["logLevel"]): void;
1070
1532
  interface UnsafeKaylaFiber extends KaylaInternals.KaylaFiber<FCProps, FCExports> {
1071
1533
  }
1072
- interface KaylaFiberControl extends KaylaInternals.KaylaFiberControl {
1534
+ interface KaylaFiberControl extends KaylaInternals.KaylaFiberControlIm {
1073
1535
  }
1074
1536
  /**
1075
1537
  * Configuration for a custom Kayla hook created via `createUseHook`.
@@ -1109,7 +1571,7 @@ interface KaylaCustomHookConfig<Return, Params = void> {
1109
1571
  * @param config Configuration with onUse + optional memoize/name
1110
1572
  * @returns A hook function you can call in components, optionally with params
1111
1573
  *
1112
- * @example Basic memoized hook with no params
1574
+ * @example
1113
1575
  * const useMyTimer = createUseHook({
1114
1576
  * name: "useMyTimer",
1115
1577
  * onUse: () => {
@@ -1119,7 +1581,7 @@ interface KaylaCustomHookConfig<Return, Params = void> {
1119
1581
  * }
1120
1582
  * });
1121
1583
  *
1122
- * @example Hook that accepts runtime params
1584
+ * @example
1123
1585
  * const useMoveSpeed = createUseHook<number, { baseSpeed: number }>({
1124
1586
  * name: "useMoveSpeed",
1125
1587
  * onUse: (fiber, global, { baseSpeed }) => {
@@ -1139,6 +1601,9 @@ type Kayla_FC<Props extends FCProps = FCProps, Exports extends FCExports = FCExp
1139
1601
  type Kayla_FCExports = FCExports;
1140
1602
  type Kayla_FCProps = FCProps;
1141
1603
  declare const Kayla_JSX: typeof JSX;
1604
+ type Kayla_KaylaClickType = KaylaClickType;
1605
+ type Kayla_KaylaContext<Context> = KaylaContext<Context>;
1606
+ declare const Kayla_KaylaContext: typeof KaylaContext;
1142
1607
  type Kayla_KaylaCustomHookConfig<Return, Params = void> = KaylaCustomHookConfig<Return, Params>;
1143
1608
  type Kayla_KaylaElement<Props extends FCProps> = KaylaElement<Props>;
1144
1609
  type Kayla_KaylaElementRef = KaylaElementRef;
@@ -1148,7 +1613,7 @@ type Kayla_KaylaFiberControl = KaylaFiberControl;
1148
1613
  declare const Kayla_KaylaFragment: typeof KaylaFragment;
1149
1614
  type Kayla_KaylaGame = KaylaGame;
1150
1615
  declare const Kayla_KaylaInternals: typeof KaylaInternals;
1151
- type Kayla_KaylaRect = KaylaRect;
1616
+ declare const Kayla_KaylaRect: typeof KaylaRect;
1152
1617
  type Kayla_KaylaRef<T> = KaylaRef<T>;
1153
1618
  type Kayla_KaylaRenderer = KaylaRenderer;
1154
1619
  type Kayla_KaylaScene = KaylaScene;
@@ -1156,6 +1621,7 @@ type Kayla_KaylaState<T> = KaylaState<T>;
1156
1621
  type Kayla_PropOfFC<T extends FC<any, any>> = PropOfFC<T>;
1157
1622
  type Kayla_Reassignable<T extends Record<any, any>> = Reassignable<T>;
1158
1623
  type Kayla_UnsafeKaylaFiber = UnsafeKaylaFiber;
1624
+ declare const Kayla_createContext: typeof createContext;
1159
1625
  declare const Kayla_createElement: typeof createElement;
1160
1626
  declare const Kayla_createGame: typeof createGame;
1161
1627
  declare const Kayla_createReassignableObject: typeof createReassignableObject;
@@ -1163,12 +1629,19 @@ declare const Kayla_createRenderer: typeof createRenderer;
1163
1629
  declare const Kayla_createScene: typeof createScene;
1164
1630
  declare const Kayla_createUseHook: typeof createUseHook;
1165
1631
  declare const Kayla_setLogLevel: typeof setLogLevel;
1632
+ declare const Kayla_useClick: typeof useClick;
1633
+ declare const Kayla_useContext: typeof useContext;
1634
+ declare const Kayla_useCurrentGame: typeof useCurrentGame;
1635
+ declare const Kayla_useCurrentRenderer: typeof useCurrentRenderer;
1636
+ declare const Kayla_useCurrentScene: typeof useCurrentScene;
1637
+ declare const Kayla_useCurrentTicker: typeof useCurrentTicker;
1166
1638
  declare const Kayla_useDisposableRef: typeof useDisposableRef;
1167
1639
  declare const Kayla_useEffect: typeof useEffect;
1168
1640
  declare const Kayla_useEntity: typeof useEntity;
1169
1641
  declare const Kayla_useExports: typeof useExports;
1170
1642
  declare const Kayla_useFiber: typeof useFiber;
1171
1643
  declare const Kayla_useFiberControl: typeof useFiberControl;
1644
+ declare const Kayla_useGlobalClick: typeof useGlobalClick;
1172
1645
  declare const Kayla_useInitialization: typeof useInitialization;
1173
1646
  declare const Kayla_useNextStack: typeof useNextStack;
1174
1647
  declare const Kayla_usePaint: typeof usePaint;
@@ -1179,7 +1652,7 @@ declare const Kayla_useShouldRefresh: typeof useShouldRefresh;
1179
1652
  declare const Kayla_useState: typeof useState;
1180
1653
  declare const Kayla_useTick: typeof useTick;
1181
1654
  declare namespace Kayla {
1182
- 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, type Kayla_KaylaCustomHookConfig as KaylaCustomHookConfig, type Kayla_KaylaElement as KaylaElement, type Kayla_KaylaElementRef as KaylaElementRef, type Kayla_KaylaExportables as KaylaExportables, type Kayla_KaylaExports as KaylaExports, type Kayla_KaylaFiberControl as KaylaFiberControl, Kayla_KaylaFragment as KaylaFragment, type Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, type Kayla_KaylaRect as KaylaRect, 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, type Kayla_Reassignable as Reassignable, type Kayla_UnsafeKaylaFiber as UnsafeKaylaFiber, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createReassignableObject as createReassignableObject, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, Kayla_createUseHook as createUseHook, selfSym as self, Kayla_setLogLevel as setLogLevel, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useFiber as useFiber, Kayla_useFiberControl as useFiberControl, Kayla_useInitialization as useInitialization, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRect as useRect, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useShouldRefresh as useShouldRefresh, Kayla_useState as useState, Kayla_useTick as useTick };
1655
+ 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, type Kayla_KaylaClickType as KaylaClickType, Kayla_KaylaContext as KaylaContext, type Kayla_KaylaCustomHookConfig as KaylaCustomHookConfig, type Kayla_KaylaElement as KaylaElement, type Kayla_KaylaElementRef as KaylaElementRef, type Kayla_KaylaExportables as KaylaExportables, type Kayla_KaylaExports as KaylaExports, type Kayla_KaylaFiberControl as KaylaFiberControl, Kayla_KaylaFragment as KaylaFragment, type Kayla_KaylaGame as KaylaGame, Kayla_KaylaInternals as KaylaInternals, Kayla_KaylaRect as KaylaRect, 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, type Kayla_Reassignable as Reassignable, type Kayla_UnsafeKaylaFiber as UnsafeKaylaFiber, Kayla_createContext as createContext, Kayla_createElement as createElement, Kayla_createGame as createGame, Kayla_createReassignableObject as createReassignableObject, Kayla_createRenderer as createRenderer, Kayla_createScene as createScene, Kayla_createUseHook as createUseHook, selfSym as self, Kayla_setLogLevel as setLogLevel, Kayla_useClick as useClick, Kayla_useContext as useContext, Kayla_useCurrentGame as useCurrentGame, Kayla_useCurrentRenderer as useCurrentRenderer, Kayla_useCurrentScene as useCurrentScene, Kayla_useCurrentTicker as useCurrentTicker, Kayla_useDisposableRef as useDisposableRef, Kayla_useEffect as useEffect, Kayla_useEntity as useEntity, Kayla_useExports as useExports, Kayla_useFiber as useFiber, Kayla_useFiberControl as useFiberControl, Kayla_useGlobalClick as useGlobalClick, Kayla_useInitialization as useInitialization, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_useRect as useRect, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useShouldRefresh as useShouldRefresh, Kayla_useState as useState, Kayla_useTick as useTick };
1183
1656
  }
1184
1657
 
1185
- export { useEntity as A, useExports as B, useFiber as C, useFiberControl as D, type ExportsOfFC as E, type FCProps as F, useInitialization as G, useNextStack as H, usePaint as I, JSX as J, Kayla as K, useRect as L, useRef as M, useSelf as N, useShouldRefresh as O, type PropOfFC as P, useState as Q, type Reassignable as R, useTick as S, type UnsafeKaylaFiber as U, type FC as a, type FCExports as b, type KaylaCustomHookConfig as c, type KaylaElement as d, type KaylaElementRef as e, type KaylaExportables as f, type KaylaExports as g, type KaylaFiberControl as h, KaylaFragment as i, KaylaGame as j, KaylaInternals as k, KaylaRect as l, type KaylaRef as m, KaylaRenderer as n, KaylaScene as o, type KaylaState as p, createElement as q, createGame as r, createReassignableObject as s, createRenderer as t, createScene as u, createUseHook as v, selfSym as w, setLogLevel as x, useDisposableRef as y, useEffect as z };
1658
+ export { useShouldRefresh as $, setLogLevel as A, useClick as B, useContext as C, useCurrentGame as D, type ExportsOfFC as E, type FCProps as F, useCurrentRenderer as G, useCurrentScene as H, useCurrentTicker as I, JSX as J, Kayla as K, useDisposableRef as L, useEffect as M, useEntity as N, useExports as O, type PropOfFC as P, useFiber as Q, type Reassignable as R, useFiberControl as S, useGlobalClick as T, type UnsafeKaylaFiber as U, useInitialization as V, useNextStack as W, usePaint as X, useRect as Y, useRef as Z, useSelf as _, type FCExports as a, useState as a0, useTick as a1, type FC as b, type KaylaClickType as c, KaylaContext as d, type KaylaCustomHookConfig as e, type KaylaElement as f, type KaylaElementRef as g, type KaylaExportables as h, type KaylaExports as i, type KaylaFiberControl as j, KaylaFragment as k, KaylaGame as l, KaylaInternals as m, KaylaRect as n, type KaylaRef as o, KaylaRenderer as p, KaylaScene as q, type KaylaState as r, createContext as s, createElement as t, createGame as u, createReassignableObject as v, createRenderer as w, createScene as x, createUseHook as y, selfSym as z };