@kayelaa/canvas 0.2.4 → 0.2.6

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.
@@ -368,13 +368,16 @@ declare namespace KaylaInternals {
368
368
  alwaysRecall?: boolean;
369
369
  }): KaylaState<T>;
370
370
  useShouldRefresh(deps: KaylaState<any>[]): void;
371
+ /**
372
+ * @deprecated
373
+ */
371
374
  useRef(initialValue: typeof selfSym): KaylaElementRef;
372
375
  useRef<T>(initialValue: T | null): KaylaRef<T>;
373
376
  useEffect(onEffect: KaylaFiber["onEffect"][number]): void;
374
377
  useViewportEffect(onEffect: KaylaFiber["onViewportEffect"][number]): void;
375
378
  useExports<T extends FC<any, any>>(_fc: T, onExport: KaylaFiber<PropOfFC<T>, ExportsOfFC<T>>["onExport"]): void;
376
- useGlobalClick(onClick: KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig): void;
377
- useClick(onClick: KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig): void;
379
+ useGlobalPointer(onPointer: KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig): void;
380
+ usePointer(onPointer: KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig): void;
378
381
  useContext<T>(context: KaylaContext<T>): T;
379
382
  save(): void;
380
383
  restore(): void;
@@ -566,6 +569,9 @@ declare namespace KaylaInternals {
566
569
  */
567
570
  getFiberChain(): UnsafeKaylaFiber[];
568
571
  }
572
+ /**
573
+ * @private
574
+ */
569
575
  class KaylaFiber<Props extends FCProps = {}, Exports extends FCExports = FCExports> implements KaylaFiberControlIm {
570
576
  state: KaylaState<any>[];
571
577
  refs: KaylaRef<unknown>[];
@@ -598,7 +604,7 @@ declare namespace KaylaInternals {
598
604
  onExport: () => KaylaExports<Exports>;
599
605
  onEffect: Array<() => (() => void) | void>;
600
606
  onViewportEffect: Array<(renderer: KaylaRenderer, width: number, height: number) => void>;
601
- onGlobalClick: Array<{
607
+ onGlobalPointer: Array<{
602
608
  handler: (pos: Vector2, type: KaylaClickType, action: KaylaPointerAction) => void | void;
603
609
  config: KaylaClickConfig;
604
610
  }>;
@@ -863,6 +869,10 @@ declare namespace KaylaInternals {
863
869
  */
864
870
  attachTo(game: KaylaGame): void;
865
871
  /**
872
+ * **Dangerous**: Call this function only **ONCE**.
873
+ *
874
+ * There is no way to unmount a spawned root.
875
+ *
866
876
  * Mounts a root component tree into the scene.
867
877
  *
868
878
  * Triggers component execution, entity creation, and hook registration.
@@ -906,7 +916,7 @@ declare class KaylaContext<Context> {
906
916
  * @param defaultValue Fallback value used when no `<Provider>` is found in the ancestor chain
907
917
  * @returns Context object with a `.Provider` component (and `.defaultValue` for reference)
908
918
  *
909
- * @example Creating and using a simple game settings context
919
+ * @example
910
920
  * // settings.ts
911
921
  * export const GameSettingsContext = createContext({
912
922
  * difficulty: "normal",
@@ -936,7 +946,7 @@ type KaylaClickType = "left" | "right" | "middle" | "invalid";
936
946
  type KaylaPointerAction = "down" | "up" | "move" | "cancel" | "any";
937
947
  interface KaylaClickConfig {
938
948
  /**
939
- * Default: "left"
949
+ * Default: "any"
940
950
  */
941
951
  type?: Exclude<KaylaClickType, "invalid"> | "any";
942
952
  /**
@@ -1055,6 +1065,8 @@ declare const useEffect: (onEffect: KaylaInternals.KaylaFiber["onEffect"][number
1055
1065
  */
1056
1066
  declare const useViewportEffect: (onEffect: KaylaInternals.KaylaFiber["onViewportEffect"][number]) => void;
1057
1067
  /**
1068
+ * Alternative: {@link useGlobalPointer}
1069
+ * @deprecated
1058
1070
  * Registers a callback that runs on **every click anywhere** in any attached renderer.
1059
1071
  *
1060
1072
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
@@ -1072,8 +1084,32 @@ declare const useViewportEffect: (onEffect: KaylaInternals.KaylaFiber["onViewpor
1072
1084
  * }
1073
1085
  * });
1074
1086
  */
1075
- declare const useGlobalClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig) => void;
1087
+ declare const useGlobalClick: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1088
+ /**
1089
+ * Registers a callback that runs on **every pointer events anywhere** in any attached renderer.
1090
+ *
1091
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1092
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1093
+ *
1094
+ * Useful for global input (pause menu toggle, debug shortcuts, drag anywhere…).
1095
+ * Multiple `useGlobalPointer` calls **stack** and run in declaration order.
1096
+ *
1097
+ * @param callback Global pointer handler — receives world position and click type
1098
+ *
1099
+ * @example
1100
+ * useGlobalPointer((pos) => {
1101
+ * isPaused.set(!isPaused.get());
1102
+ * }, { type: "right", action: "down" });
1103
+ * useGlobalPointer((pos) => {
1104
+ * // set player pos as mouse pos
1105
+ * player.x = pos.x;
1106
+ * player.y = pos.y;
1107
+ * }, { action: "move" });
1108
+ */
1109
+ declare const useGlobalPointer: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1076
1110
  /**
1111
+ * Alternative: {@link usePointer}
1112
+ * @deprecated
1077
1113
  * Registers a callback that runs **whenever the entity is clicked** (inside its bounds).
1078
1114
  *
1079
1115
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
@@ -1095,7 +1131,28 @@ declare const useGlobalClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick
1095
1131
  *
1096
1132
  * @see {@link useGlobalClick} — for clicks anywhere (not bound to this entity)
1097
1133
  */
1098
- declare const useClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig) => void;
1134
+ declare const useClick: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1135
+ /**
1136
+ * Registers a callback that runs **whenever the entity has pointer events that's bound to entity/collides** (inside its bounds).
1137
+ *
1138
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1139
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1140
+ *
1141
+ * Uses the rectangle bounds from {@link useRect} / underlying entity.
1142
+ * Multiple `usePointer` calls **stack** and run in declaration order.
1143
+ *
1144
+ * @param callback pointer handler — receives world position and click type ("left" | "right" | "middle")
1145
+ *
1146
+ * @example
1147
+ * usePointer((pos) => {
1148
+ * score.add(1);
1149
+ * playSound("collect");
1150
+ * // optional: spawn particle children on click
1151
+ * }, { type: "left", action: "up" });
1152
+ *
1153
+ * @see {@link useGlobalPointer} — for pointer events anywhere (not bound to this entity)
1154
+ */
1155
+ declare const usePointer: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1099
1156
  /**
1100
1157
  * Runs a one-time initialization function **exactly once** when the entity is first mounted.
1101
1158
  *
@@ -1158,7 +1215,7 @@ declare const useRect: () => KaylaRect;
1158
1215
  *
1159
1216
  * @param callback Update handler — receives delta time (seconds) and cancellable event
1160
1217
  *
1161
- * @example Movement + simple boundary check
1218
+ * @example
1162
1219
  * useTick((dt, event) => {
1163
1220
  * rect.pos.x += 200 * dt;
1164
1221
  * if (rect.right > 800) {
@@ -1415,7 +1472,7 @@ declare const useCurrentTicker: () => LeaTickerII;
1415
1472
  * @param context - The context object created via `createContext(defaultValue)`
1416
1473
  * @returns The current context value (type-inferred from context)
1417
1474
  *
1418
- * @example Using a theme context
1475
+ * @example
1419
1476
  * const ThemeContext = createContext({
1420
1477
  * bg: "#111",
1421
1478
  * accent: "#ff3366",
@@ -1474,7 +1531,7 @@ declare const selfSym: unique symbol;
1474
1531
  *
1475
1532
  * @param callback Function to run asynchronously in the next microtask
1476
1533
  *
1477
- * @example Accessing child exports right after spawn
1534
+ * @example
1478
1535
  * function Parent() {
1479
1536
  * const childrenRef = useRef<KaylaExports<any>[]>([]);
1480
1537
  *
@@ -1495,7 +1552,7 @@ declare const selfSym: unique symbol;
1495
1552
  * );
1496
1553
  * }
1497
1554
  *
1498
- * @example Delaying something until after paint/tick phase
1555
+ * @example
1499
1556
  * useTick(dt => {
1500
1557
  * // ... movement logic ...
1501
1558
  * useNextStack(() => {
@@ -1511,7 +1568,7 @@ declare const useNextStack: (callback: () => void) => void;
1511
1568
  *
1512
1569
  * **This is a regular functional component** — use it in JSX/TSX just like any other component.
1513
1570
  *
1514
- * @example Grouping without extra entity overhead
1571
+ * @example
1515
1572
  * function Explosion() {
1516
1573
  * return (
1517
1574
  * <KaylaFragment>
@@ -1697,9 +1754,11 @@ declare const Kayla_useExports: typeof useExports;
1697
1754
  declare const Kayla_useFiber: typeof useFiber;
1698
1755
  declare const Kayla_useFiberControl: typeof useFiberControl;
1699
1756
  declare const Kayla_useGlobalClick: typeof useGlobalClick;
1757
+ declare const Kayla_useGlobalPointer: typeof useGlobalPointer;
1700
1758
  declare const Kayla_useInitialization: typeof useInitialization;
1701
1759
  declare const Kayla_useNextStack: typeof useNextStack;
1702
1760
  declare const Kayla_usePaint: typeof usePaint;
1761
+ declare const Kayla_usePointer: typeof usePointer;
1703
1762
  declare const Kayla_useRect: typeof useRect;
1704
1763
  declare const Kayla_useRef: typeof useRef;
1705
1764
  declare const Kayla_useSelf: typeof useSelf;
@@ -1708,7 +1767,7 @@ declare const Kayla_useState: typeof useState;
1708
1767
  declare const Kayla_useTick: typeof useTick;
1709
1768
  declare const Kayla_useViewportEffect: typeof useViewportEffect;
1710
1769
  declare namespace Kayla {
1711
- 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_KaylaClickConfig as KaylaClickConfig, 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, type Kayla_KaylaPointerAction as KaylaPointerAction, 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, Kayla_useViewportEffect as useViewportEffect };
1770
+ 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_KaylaClickConfig as KaylaClickConfig, 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, type Kayla_KaylaPointerAction as KaylaPointerAction, 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_useGlobalPointer as useGlobalPointer, Kayla_useInitialization as useInitialization, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_usePointer as usePointer, Kayla_useRect as useRect, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useShouldRefresh as useShouldRefresh, Kayla_useState as useState, Kayla_useTick as useTick, Kayla_useViewportEffect as useViewportEffect };
1712
1771
  }
1713
1772
 
1714
- export { useRef as $, createUseHook as A, selfSym as B, setLogLevel as C, useClick as D, type ExportsOfFC as E, type FCProps as F, useContext as G, useCurrentGame as H, useCurrentRenderer as I, JSX as J, Kayla as K, useCurrentScene as L, useCurrentTicker as M, useDisposableRef as N, useEffect as O, type PropOfFC as P, useEntity as Q, type Reassignable as R, useExports as S, useFiber as T, type UnsafeKaylaFiber as U, useFiberControl as V, useGlobalClick as W, useInitialization as X, useNextStack as Y, usePaint as Z, useRect as _, type FCExports as a, useSelf as a0, useShouldRefresh as a1, useState as a2, useTick as a3, useViewportEffect as a4, type FC as b, type KaylaClickConfig as c, type KaylaClickType as d, KaylaContext as e, type KaylaCustomHookConfig as f, type KaylaElement as g, type KaylaElementRef as h, type KaylaExportables as i, type KaylaExports as j, type KaylaFiberControl as k, KaylaFragment as l, KaylaGame as m, KaylaInternals as n, type KaylaPointerAction as o, KaylaRect as p, type KaylaRef as q, KaylaRenderer as r, KaylaScene as s, type KaylaState as t, createContext as u, createElement as v, createGame as w, createReassignableObject as x, createRenderer as y, createScene as z };
1773
+ export { usePointer as $, createUseHook as A, selfSym as B, setLogLevel as C, useClick as D, type ExportsOfFC as E, type FCProps as F, useContext as G, useCurrentGame as H, useCurrentRenderer as I, JSX as J, Kayla as K, useCurrentScene as L, useCurrentTicker as M, useDisposableRef as N, useEffect as O, type PropOfFC as P, useEntity as Q, type Reassignable as R, useExports as S, useFiber as T, type UnsafeKaylaFiber as U, useFiberControl as V, useGlobalClick as W, useGlobalPointer as X, useInitialization as Y, useNextStack as Z, usePaint as _, type FCExports as a, useRect as a0, useRef as a1, useSelf as a2, useShouldRefresh as a3, useState as a4, useTick as a5, useViewportEffect as a6, type FC as b, type KaylaClickConfig as c, type KaylaClickType as d, KaylaContext as e, type KaylaCustomHookConfig as f, type KaylaElement as g, type KaylaElementRef as h, type KaylaExportables as i, type KaylaExports as j, type KaylaFiberControl as k, KaylaFragment as l, KaylaGame as m, KaylaInternals as n, type KaylaPointerAction as o, KaylaRect as p, type KaylaRef as q, KaylaRenderer as r, KaylaScene as s, type KaylaState as t, createContext as u, createElement as v, createGame as w, createReassignableObject as x, createRenderer as y, createScene as z };
@@ -368,13 +368,16 @@ declare namespace KaylaInternals {
368
368
  alwaysRecall?: boolean;
369
369
  }): KaylaState<T>;
370
370
  useShouldRefresh(deps: KaylaState<any>[]): void;
371
+ /**
372
+ * @deprecated
373
+ */
371
374
  useRef(initialValue: typeof selfSym): KaylaElementRef;
372
375
  useRef<T>(initialValue: T | null): KaylaRef<T>;
373
376
  useEffect(onEffect: KaylaFiber["onEffect"][number]): void;
374
377
  useViewportEffect(onEffect: KaylaFiber["onViewportEffect"][number]): void;
375
378
  useExports<T extends FC<any, any>>(_fc: T, onExport: KaylaFiber<PropOfFC<T>, ExportsOfFC<T>>["onExport"]): void;
376
- useGlobalClick(onClick: KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig): void;
377
- useClick(onClick: KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig): void;
379
+ useGlobalPointer(onPointer: KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig): void;
380
+ usePointer(onPointer: KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig): void;
378
381
  useContext<T>(context: KaylaContext<T>): T;
379
382
  save(): void;
380
383
  restore(): void;
@@ -566,6 +569,9 @@ declare namespace KaylaInternals {
566
569
  */
567
570
  getFiberChain(): UnsafeKaylaFiber[];
568
571
  }
572
+ /**
573
+ * @private
574
+ */
569
575
  class KaylaFiber<Props extends FCProps = {}, Exports extends FCExports = FCExports> implements KaylaFiberControlIm {
570
576
  state: KaylaState<any>[];
571
577
  refs: KaylaRef<unknown>[];
@@ -598,7 +604,7 @@ declare namespace KaylaInternals {
598
604
  onExport: () => KaylaExports<Exports>;
599
605
  onEffect: Array<() => (() => void) | void>;
600
606
  onViewportEffect: Array<(renderer: KaylaRenderer, width: number, height: number) => void>;
601
- onGlobalClick: Array<{
607
+ onGlobalPointer: Array<{
602
608
  handler: (pos: Vector2, type: KaylaClickType, action: KaylaPointerAction) => void | void;
603
609
  config: KaylaClickConfig;
604
610
  }>;
@@ -863,6 +869,10 @@ declare namespace KaylaInternals {
863
869
  */
864
870
  attachTo(game: KaylaGame): void;
865
871
  /**
872
+ * **Dangerous**: Call this function only **ONCE**.
873
+ *
874
+ * There is no way to unmount a spawned root.
875
+ *
866
876
  * Mounts a root component tree into the scene.
867
877
  *
868
878
  * Triggers component execution, entity creation, and hook registration.
@@ -906,7 +916,7 @@ declare class KaylaContext<Context> {
906
916
  * @param defaultValue Fallback value used when no `<Provider>` is found in the ancestor chain
907
917
  * @returns Context object with a `.Provider` component (and `.defaultValue` for reference)
908
918
  *
909
- * @example Creating and using a simple game settings context
919
+ * @example
910
920
  * // settings.ts
911
921
  * export const GameSettingsContext = createContext({
912
922
  * difficulty: "normal",
@@ -936,7 +946,7 @@ type KaylaClickType = "left" | "right" | "middle" | "invalid";
936
946
  type KaylaPointerAction = "down" | "up" | "move" | "cancel" | "any";
937
947
  interface KaylaClickConfig {
938
948
  /**
939
- * Default: "left"
949
+ * Default: "any"
940
950
  */
941
951
  type?: Exclude<KaylaClickType, "invalid"> | "any";
942
952
  /**
@@ -1055,6 +1065,8 @@ declare const useEffect: (onEffect: KaylaInternals.KaylaFiber["onEffect"][number
1055
1065
  */
1056
1066
  declare const useViewportEffect: (onEffect: KaylaInternals.KaylaFiber["onViewportEffect"][number]) => void;
1057
1067
  /**
1068
+ * Alternative: {@link useGlobalPointer}
1069
+ * @deprecated
1058
1070
  * Registers a callback that runs on **every click anywhere** in any attached renderer.
1059
1071
  *
1060
1072
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
@@ -1072,8 +1084,32 @@ declare const useViewportEffect: (onEffect: KaylaInternals.KaylaFiber["onViewpor
1072
1084
  * }
1073
1085
  * });
1074
1086
  */
1075
- declare const useGlobalClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig) => void;
1087
+ declare const useGlobalClick: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1088
+ /**
1089
+ * Registers a callback that runs on **every pointer events anywhere** in any attached renderer.
1090
+ *
1091
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1092
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1093
+ *
1094
+ * Useful for global input (pause menu toggle, debug shortcuts, drag anywhere…).
1095
+ * Multiple `useGlobalPointer` calls **stack** and run in declaration order.
1096
+ *
1097
+ * @param callback Global pointer handler — receives world position and click type
1098
+ *
1099
+ * @example
1100
+ * useGlobalPointer((pos) => {
1101
+ * isPaused.set(!isPaused.get());
1102
+ * }, { type: "right", action: "down" });
1103
+ * useGlobalPointer((pos) => {
1104
+ * // set player pos as mouse pos
1105
+ * player.x = pos.x;
1106
+ * player.y = pos.y;
1107
+ * }, { action: "move" });
1108
+ */
1109
+ declare const useGlobalPointer: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1076
1110
  /**
1111
+ * Alternative: {@link usePointer}
1112
+ * @deprecated
1077
1113
  * Registers a callback that runs **whenever the entity is clicked** (inside its bounds).
1078
1114
  *
1079
1115
  * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
@@ -1095,7 +1131,28 @@ declare const useGlobalClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick
1095
1131
  *
1096
1132
  * @see {@link useGlobalClick} — for clicks anywhere (not bound to this entity)
1097
1133
  */
1098
- declare const useClick: (onClick: KaylaInternals.KaylaFiber["onGlobalClick"][number]["handler"], config?: KaylaClickConfig) => void;
1134
+ declare const useClick: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1135
+ /**
1136
+ * Registers a callback that runs **whenever the entity has pointer events that's bound to entity/collides** (inside its bounds).
1137
+ *
1138
+ * **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
1139
+ * The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
1140
+ *
1141
+ * Uses the rectangle bounds from {@link useRect} / underlying entity.
1142
+ * Multiple `usePointer` calls **stack** and run in declaration order.
1143
+ *
1144
+ * @param callback pointer handler — receives world position and click type ("left" | "right" | "middle")
1145
+ *
1146
+ * @example
1147
+ * usePointer((pos) => {
1148
+ * score.add(1);
1149
+ * playSound("collect");
1150
+ * // optional: spawn particle children on click
1151
+ * }, { type: "left", action: "up" });
1152
+ *
1153
+ * @see {@link useGlobalPointer} — for pointer events anywhere (not bound to this entity)
1154
+ */
1155
+ declare const usePointer: (onPointer: KaylaInternals.KaylaFiber["onGlobalPointer"][number]["handler"], config?: KaylaClickConfig) => void;
1099
1156
  /**
1100
1157
  * Runs a one-time initialization function **exactly once** when the entity is first mounted.
1101
1158
  *
@@ -1158,7 +1215,7 @@ declare const useRect: () => KaylaRect;
1158
1215
  *
1159
1216
  * @param callback Update handler — receives delta time (seconds) and cancellable event
1160
1217
  *
1161
- * @example Movement + simple boundary check
1218
+ * @example
1162
1219
  * useTick((dt, event) => {
1163
1220
  * rect.pos.x += 200 * dt;
1164
1221
  * if (rect.right > 800) {
@@ -1415,7 +1472,7 @@ declare const useCurrentTicker: () => LeaTickerII;
1415
1472
  * @param context - The context object created via `createContext(defaultValue)`
1416
1473
  * @returns The current context value (type-inferred from context)
1417
1474
  *
1418
- * @example Using a theme context
1475
+ * @example
1419
1476
  * const ThemeContext = createContext({
1420
1477
  * bg: "#111",
1421
1478
  * accent: "#ff3366",
@@ -1474,7 +1531,7 @@ declare const selfSym: unique symbol;
1474
1531
  *
1475
1532
  * @param callback Function to run asynchronously in the next microtask
1476
1533
  *
1477
- * @example Accessing child exports right after spawn
1534
+ * @example
1478
1535
  * function Parent() {
1479
1536
  * const childrenRef = useRef<KaylaExports<any>[]>([]);
1480
1537
  *
@@ -1495,7 +1552,7 @@ declare const selfSym: unique symbol;
1495
1552
  * );
1496
1553
  * }
1497
1554
  *
1498
- * @example Delaying something until after paint/tick phase
1555
+ * @example
1499
1556
  * useTick(dt => {
1500
1557
  * // ... movement logic ...
1501
1558
  * useNextStack(() => {
@@ -1511,7 +1568,7 @@ declare const useNextStack: (callback: () => void) => void;
1511
1568
  *
1512
1569
  * **This is a regular functional component** — use it in JSX/TSX just like any other component.
1513
1570
  *
1514
- * @example Grouping without extra entity overhead
1571
+ * @example
1515
1572
  * function Explosion() {
1516
1573
  * return (
1517
1574
  * <KaylaFragment>
@@ -1697,9 +1754,11 @@ declare const Kayla_useExports: typeof useExports;
1697
1754
  declare const Kayla_useFiber: typeof useFiber;
1698
1755
  declare const Kayla_useFiberControl: typeof useFiberControl;
1699
1756
  declare const Kayla_useGlobalClick: typeof useGlobalClick;
1757
+ declare const Kayla_useGlobalPointer: typeof useGlobalPointer;
1700
1758
  declare const Kayla_useInitialization: typeof useInitialization;
1701
1759
  declare const Kayla_useNextStack: typeof useNextStack;
1702
1760
  declare const Kayla_usePaint: typeof usePaint;
1761
+ declare const Kayla_usePointer: typeof usePointer;
1703
1762
  declare const Kayla_useRect: typeof useRect;
1704
1763
  declare const Kayla_useRef: typeof useRef;
1705
1764
  declare const Kayla_useSelf: typeof useSelf;
@@ -1708,7 +1767,7 @@ declare const Kayla_useState: typeof useState;
1708
1767
  declare const Kayla_useTick: typeof useTick;
1709
1768
  declare const Kayla_useViewportEffect: typeof useViewportEffect;
1710
1769
  declare namespace Kayla {
1711
- 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_KaylaClickConfig as KaylaClickConfig, 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, type Kayla_KaylaPointerAction as KaylaPointerAction, 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, Kayla_useViewportEffect as useViewportEffect };
1770
+ 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_KaylaClickConfig as KaylaClickConfig, 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, type Kayla_KaylaPointerAction as KaylaPointerAction, 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_useGlobalPointer as useGlobalPointer, Kayla_useInitialization as useInitialization, Kayla_useNextStack as useNextStack, Kayla_usePaint as usePaint, Kayla_usePointer as usePointer, Kayla_useRect as useRect, Kayla_useRef as useRef, Kayla_useSelf as useSelf, Kayla_useShouldRefresh as useShouldRefresh, Kayla_useState as useState, Kayla_useTick as useTick, Kayla_useViewportEffect as useViewportEffect };
1712
1771
  }
1713
1772
 
1714
- export { useRef as $, createUseHook as A, selfSym as B, setLogLevel as C, useClick as D, type ExportsOfFC as E, type FCProps as F, useContext as G, useCurrentGame as H, useCurrentRenderer as I, JSX as J, Kayla as K, useCurrentScene as L, useCurrentTicker as M, useDisposableRef as N, useEffect as O, type PropOfFC as P, useEntity as Q, type Reassignable as R, useExports as S, useFiber as T, type UnsafeKaylaFiber as U, useFiberControl as V, useGlobalClick as W, useInitialization as X, useNextStack as Y, usePaint as Z, useRect as _, type FCExports as a, useSelf as a0, useShouldRefresh as a1, useState as a2, useTick as a3, useViewportEffect as a4, type FC as b, type KaylaClickConfig as c, type KaylaClickType as d, KaylaContext as e, type KaylaCustomHookConfig as f, type KaylaElement as g, type KaylaElementRef as h, type KaylaExportables as i, type KaylaExports as j, type KaylaFiberControl as k, KaylaFragment as l, KaylaGame as m, KaylaInternals as n, type KaylaPointerAction as o, KaylaRect as p, type KaylaRef as q, KaylaRenderer as r, KaylaScene as s, type KaylaState as t, createContext as u, createElement as v, createGame as w, createReassignableObject as x, createRenderer as y, createScene as z };
1773
+ export { usePointer as $, createUseHook as A, selfSym as B, setLogLevel as C, useClick as D, type ExportsOfFC as E, type FCProps as F, useContext as G, useCurrentGame as H, useCurrentRenderer as I, JSX as J, Kayla as K, useCurrentScene as L, useCurrentTicker as M, useDisposableRef as N, useEffect as O, type PropOfFC as P, useEntity as Q, type Reassignable as R, useExports as S, useFiber as T, type UnsafeKaylaFiber as U, useFiberControl as V, useGlobalClick as W, useGlobalPointer as X, useInitialization as Y, useNextStack as Z, usePaint as _, type FCExports as a, useRect as a0, useRef as a1, useSelf as a2, useShouldRefresh as a3, useState as a4, useTick as a5, useViewportEffect as a6, type FC as b, type KaylaClickConfig as c, type KaylaClickType as d, KaylaContext as e, type KaylaCustomHookConfig as f, type KaylaElement as g, type KaylaElementRef as h, type KaylaExportables as i, type KaylaExports as j, type KaylaFiberControl as k, KaylaFragment as l, KaylaGame as m, KaylaInternals as n, type KaylaPointerAction as o, KaylaRect as p, type KaylaRef as q, KaylaRenderer as r, KaylaScene as s, type KaylaState as t, createContext as u, createElement as v, createGame as w, createReassignableObject as x, createRenderer as y, createScene as z };