@kayelaa/canvas 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -3
  3. package/docs/@kayelaa/namespaces/Kayla/README.md +0 -67
  4. package/docs/@kayelaa/namespaces/Kayla/functions/createElement.md +0 -51
  5. package/docs/@kayelaa/namespaces/Kayla/functions/createGame.md +0 -55
  6. package/docs/@kayelaa/namespaces/Kayla/functions/createReassignableObject.md +0 -27
  7. package/docs/@kayelaa/namespaces/Kayla/functions/createRenderer.md +0 -38
  8. package/docs/@kayelaa/namespaces/Kayla/functions/createScene.md +0 -37
  9. package/docs/@kayelaa/namespaces/Kayla/functions/createUseHook.md +0 -83
  10. package/docs/@kayelaa/namespaces/Kayla/functions/setLogLevel.md +0 -21
  11. package/docs/@kayelaa/namespaces/Kayla/functions/useDisposableRef.md +0 -45
  12. package/docs/@kayelaa/namespaces/Kayla/functions/useNextStack.md +0 -28
  13. package/docs/@kayelaa/namespaces/Kayla/interfaces/FC.md +0 -41
  14. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaCustomHookConfig.md +0 -86
  15. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaElement.md +0 -31
  16. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaFiberControl.md +0 -102
  17. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaGame.md +0 -369
  18. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaRect.md +0 -308
  19. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaRef.md +0 -68
  20. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaRenderer.md +0 -948
  21. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaScene.md +0 -105
  22. package/docs/@kayelaa/namespaces/Kayla/interfaces/KaylaState.md +0 -266
  23. package/docs/@kayelaa/namespaces/Kayla/interfaces/UnsafeKaylaFiber.md +0 -618
  24. package/docs/@kayelaa/namespaces/Kayla/namespaces/JSX/README.md +0 -16
  25. package/docs/@kayelaa/namespaces/Kayla/namespaces/JSX/interfaces/IntrinsicElements.md +0 -9
  26. package/docs/@kayelaa/namespaces/Kayla/namespaces/JSX/type-aliases/Element.md +0 -11
  27. package/docs/@kayelaa/namespaces/Kayla/namespaces/JSX/type-aliases/ElementType.md +0 -11
  28. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/README.md +0 -35
  29. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/GlobalKayla.md +0 -425
  30. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaEvent.md +0 -43
  31. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaFiber.md +0 -526
  32. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaGame.md +0 -391
  33. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaInternalRef.md +0 -94
  34. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaInternalState.md +0 -258
  35. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaRect.md +0 -298
  36. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaRectEntity.md +0 -1034
  37. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaRenderer.md +0 -934
  38. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/classes/KaylaScene.md +0 -105
  39. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/functions/createReassignableRef.md +0 -27
  40. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/interfaces/KaylaFiberControl.md +0 -86
  41. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/interfaces/KaylaInternalRefIm.md +0 -64
  42. package/docs/@kayelaa/namespaces/Kayla/namespaces/KaylaInternals/variables/singleGlobalInstance.md +0 -11
  43. package/docs/@kayelaa/namespaces/Kayla/type-aliases/ExportsOfFC.md +0 -17
  44. package/docs/@kayelaa/namespaces/Kayla/type-aliases/FCExports.md +0 -11
  45. package/docs/@kayelaa/namespaces/Kayla/type-aliases/FCProps.md +0 -39
  46. package/docs/@kayelaa/namespaces/Kayla/type-aliases/KaylaElementRef.md +0 -15
  47. package/docs/@kayelaa/namespaces/Kayla/type-aliases/KaylaExportables.md +0 -15
  48. package/docs/@kayelaa/namespaces/Kayla/type-aliases/KaylaExports.md +0 -21
  49. package/docs/@kayelaa/namespaces/Kayla/type-aliases/PropOfFC.md +0 -17
  50. package/docs/@kayelaa/namespaces/Kayla/type-aliases/Reassignable.md +0 -33
  51. package/docs/@kayelaa/namespaces/Kayla/variables/KaylaFragment.md +0 -35
  52. package/docs/@kayelaa/namespaces/Kayla/variables/self.md +0 -24
  53. package/docs/@kayelaa/namespaces/Kayla/variables/useEffect.md +0 -40
  54. package/docs/@kayelaa/namespaces/Kayla/variables/useEntity.md +0 -52
  55. package/docs/@kayelaa/namespaces/Kayla/variables/useExports.md +0 -52
  56. package/docs/@kayelaa/namespaces/Kayla/variables/useFiber.md +0 -31
  57. package/docs/@kayelaa/namespaces/Kayla/variables/useFiberControl.md +0 -45
  58. package/docs/@kayelaa/namespaces/Kayla/variables/useInitialization.md +0 -49
  59. package/docs/@kayelaa/namespaces/Kayla/variables/usePaint.md +0 -31
  60. package/docs/@kayelaa/namespaces/Kayla/variables/useRect.md +0 -38
  61. package/docs/@kayelaa/namespaces/Kayla/variables/useRef.md +0 -83
  62. package/docs/@kayelaa/namespaces/Kayla/variables/useSelf.md +0 -55
  63. package/docs/@kayelaa/namespaces/Kayla/variables/useShouldRefresh.md +0 -41
  64. package/docs/@kayelaa/namespaces/Kayla/variables/useState.md +0 -70
  65. package/docs/@kayelaa/namespaces/Kayla/variables/useTick.md +0 -31
  66. package/docs/@kayelaa/namespaces/LEA/README.md +0 -79
  67. package/docs/@kayelaa/namespaces/LEA/classes/DeltaTweenII.md +0 -372
  68. package/docs/@kayelaa/namespaces/LEA/classes/GEmitterMemory.md +0 -189
  69. package/docs/@kayelaa/namespaces/LEA/classes/LeaEntityII.md +0 -634
  70. package/docs/@kayelaa/namespaces/LEA/classes/LeaEventEmitter.md +0 -273
  71. package/docs/@kayelaa/namespaces/LEA/classes/LeaGameII.md +0 -261
  72. package/docs/@kayelaa/namespaces/LEA/classes/LeaRendererII.md +0 -705
  73. package/docs/@kayelaa/namespaces/LEA/classes/LeaSceneII.md +0 -428
  74. package/docs/@kayelaa/namespaces/LEA/classes/LeaTickerII.md +0 -488
  75. package/docs/@kayelaa/namespaces/LEA/classes/LeaTimeout.md +0 -490
  76. package/docs/@kayelaa/namespaces/LEA/classes/LiaAudio.md +0 -425
  77. package/docs/@kayelaa/namespaces/LEA/classes/LiaAudioSrc.md +0 -423
  78. package/docs/@kayelaa/namespaces/LEA/classes/LiaOscSFX.md +0 -403
  79. package/docs/@kayelaa/namespaces/LEA/classes/RectLeaEntity.md +0 -992
  80. package/docs/@kayelaa/namespaces/LEA/classes/Vector2.md +0 -501
  81. package/docs/@kayelaa/namespaces/LEA/functions/colToRGBA.md +0 -35
  82. package/docs/@kayelaa/namespaces/LEA/functions/editRGBA.md +0 -39
  83. package/docs/@kayelaa/namespaces/LEA/functions/generateUUID.md +0 -17
  84. package/docs/@kayelaa/namespaces/LEA/functions/getAvoidAngle.md +0 -25
  85. package/docs/@kayelaa/namespaces/LEA/functions/getEnvironment.md +0 -15
  86. package/docs/@kayelaa/namespaces/LEA/functions/getNormalizedColor.md +0 -37
  87. package/docs/@kayelaa/namespaces/LEA/functions/getRayHit.md +0 -39
  88. package/docs/@kayelaa/namespaces/LEA/functions/isMobile.md +0 -15
  89. package/docs/@kayelaa/namespaces/LEA/functions/isNote.md +0 -21
  90. package/docs/@kayelaa/namespaces/LEA/functions/parseFillStyle.md +0 -40
  91. package/docs/@kayelaa/namespaces/LEA/functions/raycastAvoid.md +0 -39
  92. package/docs/@kayelaa/namespaces/LEA/functions/scaleCoord.md +0 -39
  93. package/docs/@kayelaa/namespaces/LEA/functions/setAnimInterval.md +0 -29
  94. package/docs/@kayelaa/namespaces/LEA/functions/shortUID.md +0 -21
  95. package/docs/@kayelaa/namespaces/LEA/functions/tinyUID.md +0 -21
  96. package/docs/@kayelaa/namespaces/LEA/interfaces/RayHit.md +0 -29
  97. package/docs/@kayelaa/namespaces/LEA/interfaces/RaycastResult.md +0 -45
  98. package/docs/@kayelaa/namespaces/LEA/interfaces/SFXConfig.md +0 -157
  99. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/README.md +0 -27
  100. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/booleanExport.md +0 -21
  101. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/booleanImport.md +0 -21
  102. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/createLookup.md +0 -55
  103. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/createLowPrecision.md +0 -49
  104. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/createLowPrecisionRadToDeg.md +0 -49
  105. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/createPercent.md +0 -49
  106. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/createRounder.md +0 -31
  107. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/degToRad.md +0 -21
  108. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/lightWeightRounder.md +0 -21
  109. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/radToDeg.md +0 -21
  110. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/vec2Export.md +0 -21
  111. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/functions/vec2Import.md +0 -21
  112. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/variables/angleRadToDeg.md +0 -41
  113. package/docs/@kayelaa/namespaces/LEA/namespaces/LeaSerializers/variables/booleanMap.md +0 -41
  114. package/docs/@kayelaa/namespaces/LEA/type-aliases/DefaultWSE.md +0 -67
  115. package/docs/@kayelaa/namespaces/LEA/type-aliases/LeaEntitySerializer.md +0 -17
  116. package/docs/@kayelaa/namespaces/LEA/type-aliases/LeaEntitySerializerArray.md +0 -17
  117. package/docs/@kayelaa/namespaces/LEA/type-aliases/LeaEntitySerializerEach.md +0 -21
  118. package/docs/@kayelaa/namespaces/LEA/type-aliases/Listener.md +0 -31
  119. package/docs/@kayelaa/namespaces/LEA/type-aliases/NOTE_NAME.md +0 -11
  120. package/docs/@kayelaa/namespaces/LEA/type-aliases/OrderedLeaEntitySerializer.md +0 -21
  121. package/docs/@kayelaa/namespaces/LEA/type-aliases/Side.md +0 -11
  122. package/docs/@kayelaa/namespaces/LEA/variables/ENVIRONMENT.md +0 -11
  123. package/docs/@kayelaa/namespaces/LEA/variables/LeaUtilsII.md +0 -445
  124. package/docs/@kayelaa/namespaces/LEA/variables/LiaSFXMap.md +0 -11
  125. package/docs/@kayelaa/namespaces/LEA/variables/NOTE_NAMES.md +0 -11
  126. package/docs/@kayelaa/namespaces/LEA/variables/defaultSFXConfig.md +0 -11
  127. package/docs/@kayelaa/namespaces/LEA/variables/isInitiallyMobile.md +0 -11
  128. package/docs/@kayelaa/namespaces/LEA/variables/isNode.md +0 -11
  129. package/docs/@kayelaa/namespaces/LEA/variables/isWeb.md +0 -11
  130. package/docs/@kayelaa/namespaces/LEA/variables/sfxHit.md +0 -11
  131. package/docs/@kayelaa/namespaces/LEA/variables/sfxJump.md +0 -11
  132. package/docs/@kayelaa/namespaces/LEA/variables/sfxLaser.md +0 -11
  133. package/docs/@kayelaa/namespaces/LEA/variables/sfxUIClick.md +0 -11
  134. package/docs/@kayelaa/namespaces/LEA/variables/sfxUIHover.md +0 -11
  135. package/docs/README.md +0 -14
  136. package/docs/variables/default.md +0 -25
@@ -1,31 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useFiber
6
-
7
- # Variable: useFiber()
8
-
9
- > `const` **useFiber**: () => [`UnsafeKaylaFiber`](../interfaces/UnsafeKaylaFiber.md)
10
-
11
- Defined in: [kayla-internals.ts:1713](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1713)
12
-
13
- **UNSAFE** — Returns direct access to the current `KaylaFiber` instance.
14
-
15
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
16
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
17
-
18
- **Use with extreme caution** — this exposes internal implementation details.
19
- Most use-cases should use `useFiberControl()` instead.
20
-
21
- Intended only for advanced debugging, testing, or very specific low-level needs.
22
-
23
- ## Returns
24
-
25
- [`UnsafeKaylaFiber`](../interfaces/UnsafeKaylaFiber.md)
26
-
27
- The current fiber (may change on refresh — do not cache!)
28
-
29
- ## See
30
-
31
- [useFiberControl](useFiberControl.md) for the safe alternative
@@ -1,45 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useFiberControl
6
-
7
- # Variable: useFiberControl()
8
-
9
- > `const` **useFiberControl**: () => [`KaylaFiberControl`](../namespaces/KaylaInternals/interfaces/KaylaFiberControl.md)
10
-
11
- Defined in: [kayla-internals.ts:1696](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1696)
12
-
13
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
14
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
15
-
16
- Returns a safe control surface for the current fiber instance.
17
-
18
- Provides limited, controlled access to fiber-level operations:
19
- - Manually trigger a refresh
20
- - Read the current number of direct children
21
- - Set a safety limit on maximum allowed direct children (soft enforcement)
22
-
23
- **This is the recommended way** to interact with fiber internals when needed.
24
- Avoid using `useFiber()` (unsafe) unless you have a very specific reason.
25
-
26
- The returned object is stable across refreshes.
27
-
28
- ## Returns
29
-
30
- [`KaylaFiberControl`](../namespaces/KaylaInternals/interfaces/KaylaFiberControl.md)
31
-
32
- ## Example
33
-
34
- ```ts
35
- const control = useFiberControl();
36
-
37
- // Force refresh (rarely needed — prefer declarative + useShouldRefresh)
38
- control.refresh();
39
-
40
- // Monitor child count
41
- if (control.childrenCount > 100) {
42
- console.warn("Too many children");
43
- control.setMaxChildren(80);
44
- }
45
- ```
@@ -1,49 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useInitialization
6
-
7
- # Variable: useInitialization()
8
-
9
- > `const` **useInitialization**: (`init`) => `void`
10
-
11
- Defined in: [kayla-internals.ts:1563](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1563)
12
-
13
- Runs the provided callback **exactly once** when the entity is first created/mounted.
14
-
15
- Unlike `useEffect`, this hook **never re-runs** on subsequent refreshes — even if structural state changes.
16
- Ideal for true one-time initialization that should survive refreshes:
17
- - Creating physics bodies / collision shapes
18
- - Setting up audio contexts / WebGL resources
19
- - Attaching global event listeners (pointer lock, resize observers)
20
- - One-time asset preloading or data fetching
21
-
22
- If the callback returns a cleanup function, it will be called **only when the entity is finally destroyed** (unuse).
23
-
24
- **This hook MUST be called at the top level of a component function.**
25
-
26
- ## Parameters
27
-
28
- ### init
29
-
30
- () => `void` \| () => `void`
31
-
32
- Callback that runs once on first mount. May return a cleanup function.
33
-
34
- ## Returns
35
-
36
- `void`
37
-
38
- ## Example
39
-
40
- ```ts
41
- useInitialization(() => {
42
- const audioCtx = new AudioContext();
43
- // one-time setup
44
-
45
- return () => {
46
- audioCtx.close(); // cleanup only on destroy
47
- };
48
- });
49
- ```
@@ -1,31 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / usePaint
6
-
7
- # Variable: usePaint()
8
-
9
- > `const` **usePaint**: (`onPaint`) => `void`
10
-
11
- Defined in: [kayla-internals.ts:1616](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1616)
12
-
13
- Registers a callback that runs on every render frame (paint phase).
14
-
15
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
16
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt paint registration.
17
-
18
- Multiple `usePaint` calls **stack** — all run in declaration order every frame.
19
- Call `event.preventDefault()` to skip remaining paint handlers (including default rect fill).
20
-
21
- **Use for:** drawing sprites, particles, health bars, debug overlays, name tags.
22
-
23
- ## Parameters
24
-
25
- ### onPaint
26
-
27
- (`ctx`, `event`) => `void`
28
-
29
- ## Returns
30
-
31
- `void`
@@ -1,38 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useRect
6
-
7
- # Variable: useRect()
8
-
9
- > `const` **useRect**: () => [`KaylaRect`](../namespaces/KaylaInternals/classes/KaylaRect.md)
10
-
11
- Defined in: [kayla-internals.ts:1586](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1586)
12
-
13
- Returns a stable facade object giving convenient mutable access to the
14
- current component's underlying rectangle entity properties.
15
-
16
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
17
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
18
-
19
- The returned object is created only once per entity lifetime and always
20
- points to the current KaylaRectEntity.
21
-
22
- Prefer this over `useEntity()` when you just need position & size.
23
-
24
- ## Returns
25
-
26
- [`KaylaRect`](../namespaces/KaylaInternals/classes/KaylaRect.md)
27
-
28
- Facade with `.pos`, `.x`, `.y`, `.width`, `.height`, `.z`, etc.
29
-
30
- ## Example
31
-
32
- ```ts
33
- const rect = useRect();
34
- useTick(dt => {
35
- rect.pos.x += 180 * dt; // direct Vector2 mutation
36
- rect.y += Math.sin(rect.x * 0.01) * 60 * dt; // alias usage
37
- });
38
- ```
@@ -1,83 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useRef
6
-
7
- # Variable: useRef()
8
-
9
- > `const` **useRef**: \{(`initialValue`): [`KaylaElementRef`](../type-aliases/KaylaElementRef.md); \<`T`\>(`initialValue`): [`KaylaRef`](../interfaces/KaylaRef.md)\<`T`\>; \}
10
-
11
- Defined in: [kayla-internals.ts:1497](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1497)
12
-
13
- Returns a mutable ref object whose `.current` property persists across entity refreshes.
14
-
15
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
16
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt internal ref storage.
17
-
18
- Changes to `.current` **never** trigger refresh or re-bind hooks — refs are stable for the entity's lifetime.
19
-
20
- **Primary use:** Hold mutable game state, methods, timers, audio nodes, previous values, etc.
21
- For most entities, wrap your full logic in `useSelf()` instead (strongly recommended pattern).
22
-
23
- Special case: pass the `self` symbol to get the current LEA entity:
24
-
25
- ## Call Signature
26
-
27
- > (`initialValue`): [`KaylaElementRef`](../type-aliases/KaylaElementRef.md)
28
-
29
- ### Parameters
30
-
31
- #### initialValue
32
-
33
- *typeof* [`self`](self.md)
34
-
35
- ### Returns
36
-
37
- [`KaylaElementRef`](../type-aliases/KaylaElementRef.md)
38
-
39
- ## Call Signature
40
-
41
- > \<`T`\>(`initialValue`): [`KaylaRef`](../interfaces/KaylaRef.md)\<`T`\>
42
-
43
- ### Type Parameters
44
-
45
- #### T
46
-
47
- `T`
48
-
49
- ### Parameters
50
-
51
- #### initialValue
52
-
53
- `T`
54
-
55
- ### Returns
56
-
57
- [`KaylaRef`](../interfaces/KaylaRef.md)\<`T`\>
58
-
59
- ## Template
60
-
61
- The type of the ref's value
62
-
63
- ## Param
64
-
65
- Initial value for `.current`, or `self` symbol for entity reference
66
-
67
- ## Returns
68
-
69
- A ref object with mutable `.current` property
70
-
71
- ## Examples
72
-
73
- ```ts
74
- Entity reference
75
- const entity = useRef(self);
76
- entity.current.x += 10; // direct entity mutation, no refresh
77
- ```
78
-
79
- ```ts
80
- Mutable counter
81
- const timer = useRef(0);
82
- useTick(delta => { timer.current += delta; });
83
- ```
@@ -1,55 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useSelf
6
-
7
- # Variable: useSelf()
8
-
9
- > `const` **useSelf**: \<`T`\>(`init`) => `T`
10
-
11
- Defined in: [kayla-internals.ts:1665](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1665)
12
-
13
- Creates and returns a stable object (god-object) for holding most of an entity's state and logic.
14
-
15
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
16
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt ref storage.
17
-
18
- The initializer runs **only once** (on first entity creation); the returned object is the **same reference** on every refresh.
19
-
20
- **Recommended pattern:** Put nearly all mutable state, methods, and game logic here.
21
- Use `useState` **only** for rare structural changes that should trigger refresh.
22
-
23
- ## Type Parameters
24
-
25
- ### T
26
-
27
- `T`
28
-
29
- The type of the god-object
30
-
31
- ## Parameters
32
-
33
- ### init
34
-
35
- () => `T`
36
-
37
- Factory function returning the object (called only once)
38
-
39
- ## Returns
40
-
41
- `T`
42
-
43
- The initialized god-object (stable across refreshes)
44
-
45
- ## Example
46
-
47
- ```ts
48
- const self = useSelf(() => ({
49
- pos: new Vector2(400, 300),
50
- vel: new Vector2(100, 0),
51
- tick(delta) { this.pos.x += this.vel.x * delta; }
52
- }));
53
-
54
- useTick(delta => self.tick(delta));
55
- ```
@@ -1,41 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useShouldRefresh
6
-
7
- # Variable: useShouldRefresh()
8
-
9
- > `const` **useShouldRefresh**: (`deps`) => `void`
10
-
11
- Defined in: [kayla-internals.ts:1516](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1516)
12
-
13
- Opt-in: only refresh this component when one of the listed states changes.
14
-
15
- Call this **once** at the top level of your component (after all useState calls
16
- you want to watch).
17
-
18
- If none of the watched states change since last refresh → skip re-running
19
- the component body, hook re-binding, child reconciliation, etc.
20
-
21
- ## Parameters
22
-
23
- ### deps
24
-
25
- [`KaylaState`](../interfaces/KaylaState.md)\<`any`\>[]
26
-
27
- ## Returns
28
-
29
- `void`
30
-
31
- ## Example
32
-
33
- ```ts
34
- const health = useState(100);
35
- const level = useState(1);
36
- const isPaused = useState(false);
37
-
38
- useShouldRefresh([health, level, isPaused]);
39
-
40
- // Now the component only re-runs when one of those actually changes
41
- ```
@@ -1,70 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useState
6
-
7
- # Variable: useState()
8
-
9
- > `const` **useState**: \<`T`\>(`initialValue?`, `options`) => [`KaylaState`](../interfaces/KaylaState.md)\<`T`\>
10
-
11
- Defined in: [kayla-internals.ts:1470](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1470)
12
-
13
- Returns a stateful value and a setter to update it.
14
-
15
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
16
- The call order of all hooks is **strictly fixed** across every refresh; reordering calls will corrupt internal state.
17
-
18
- Calling the setter **may** schedule an entity refresh (re-execution of the component function),
19
- which re-binds all hooks to the same entity instance and potentially re-spawns children.
20
-
21
- **Critical performance warning:**
22
- **Do NOT** use `useState` for frequently-updated game data (position, velocity, rotation, timers, health deltas, etc.).
23
- Those **must** live in `useSelf` or plain `useRef`.
24
- `useState` is **only** for infrequent structural changes that should trigger refresh
25
- (e.g. `isDead` → spawn particles, `currentLevel` → reload map, `variant` → change sprite sheet).
26
-
27
- ## Type Parameters
28
-
29
- ### T
30
-
31
- `T`
32
-
33
- The type of the state value
34
-
35
- ## Parameters
36
-
37
- ### initialValue?
38
-
39
- `T`
40
-
41
- Optional initial value
42
-
43
- ### options?
44
-
45
- Configuration object
46
-
47
- #### alwaysRecall?
48
-
49
- `boolean` = `false`
50
-
51
- If `true`, **every** `.set()` call triggers a refresh (default: `false`)
52
-
53
- ## Returns
54
-
55
- [`KaylaState`](../interfaces/KaylaState.md)\<`T`\>
56
-
57
- A state wrapper with `.get()`, `.set()`, `.add()`, `.multiply()`, and `.lastChanged`
58
-
59
- ## Examples
60
-
61
- ```ts
62
- Correct structural use
63
- const isDead = useState(false);
64
- if (health <= 0) isDead.set(true); // → refresh spawns death animation children
65
- ```
66
-
67
- ```ts
68
- Incorrect hot-data use (do NOT do this)
69
- const pos = useState({ x: 400, y: 300 }); // BAD — thrashing + GC pressure
70
- ```
@@ -1,31 +0,0 @@
1
- [**@kayelaa/canvas**](../../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../../README.md) / [Kayla](../README.md) / useTick
6
-
7
- # Variable: useTick()
8
-
9
- > `const` **useTick**: (`onTick`) => `void`
10
-
11
- Defined in: [kayla-internals.ts:1601](https://github.com/lianecagara/kaye-tanks-v2/blob/4a28d0500ea6e343627b34fac908efa8113674cc/kayla/src/kayla-internals.ts#L1601)
12
-
13
- Registers a callback that runs on every game tick (update phase).
14
-
15
- **This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks.**
16
- The call order of all hooks is **strictly fixed**; reordering calls will corrupt tick registration.
17
-
18
- Multiple `useTick` calls **stack** — all run in declaration order every tick.
19
- Call `event.preventDefault()` to skip remaining tick handlers for this entity (including default update).
20
-
21
- **Use for:** physics, movement, AI, timers, collision checks, input polling.
22
-
23
- ## Parameters
24
-
25
- ### onTick
26
-
27
- (`deltaS`, `event`) => `void`
28
-
29
- ## Returns
30
-
31
- `void`
@@ -1,79 +0,0 @@
1
- [**@kayelaa/canvas**](../../../README.md)
2
-
3
- ***
4
-
5
- [@kayelaa/canvas](../../../README.md) / LEA
6
-
7
- # LEA
8
-
9
- ## Namespaces
10
-
11
- - [LeaSerializers](namespaces/LeaSerializers/README.md)
12
-
13
- ## Classes
14
-
15
- - [LeaEventEmitter](classes/LeaEventEmitter.md)
16
- - [LeaRendererII](classes/LeaRendererII.md)
17
- - [LeaTickerII](classes/LeaTickerII.md)
18
- - [LeaEntityII](classes/LeaEntityII.md)
19
- - [LeaSceneII](classes/LeaSceneII.md)
20
- - [LeaGameII](classes/LeaGameII.md)
21
- - [DeltaTweenII](classes/DeltaTweenII.md)
22
- - [RectLeaEntity](classes/RectLeaEntity.md)
23
- - [LeaTimeout](classes/LeaTimeout.md)
24
- - [Vector2](classes/Vector2.md)
25
- - [LiaAudio](classes/LiaAudio.md)
26
- - [LiaAudioSrc](classes/LiaAudioSrc.md)
27
- - [LiaOscSFX](classes/LiaOscSFX.md)
28
- - [GEmitterMemory](classes/GEmitterMemory.md)
29
-
30
- ## Interfaces
31
-
32
- - [SFXConfig](interfaces/SFXConfig.md)
33
- - [RayHit](interfaces/RayHit.md)
34
- - [RaycastResult](interfaces/RaycastResult.md)
35
-
36
- ## Type Aliases
37
-
38
- - [Listener](type-aliases/Listener.md)
39
- - [LeaEntitySerializerEach](type-aliases/LeaEntitySerializerEach.md)
40
- - [LeaEntitySerializer](type-aliases/LeaEntitySerializer.md)
41
- - [LeaEntitySerializerArray](type-aliases/LeaEntitySerializerArray.md)
42
- - [OrderedLeaEntitySerializer](type-aliases/OrderedLeaEntitySerializer.md)
43
- - [NOTE\_NAME](type-aliases/NOTE_NAME.md)
44
- - [DefaultWSE](type-aliases/DefaultWSE.md)
45
- - [Side](type-aliases/Side.md)
46
-
47
- ## Variables
48
-
49
- - [LeaUtilsII](variables/LeaUtilsII.md)
50
- - [ENVIRONMENT](variables/ENVIRONMENT.md)
51
- - [isNode](variables/isNode.md)
52
- - [isWeb](variables/isWeb.md)
53
- - [NOTE\_NAMES](variables/NOTE_NAMES.md)
54
- - [defaultSFXConfig](variables/defaultSFXConfig.md)
55
- - [sfxUIClick](variables/sfxUIClick.md)
56
- - [sfxUIHover](variables/sfxUIHover.md)
57
- - [sfxJump](variables/sfxJump.md)
58
- - [sfxLaser](variables/sfxLaser.md)
59
- - [sfxHit](variables/sfxHit.md)
60
- - [LiaSFXMap](variables/LiaSFXMap.md)
61
- - [isInitiallyMobile](variables/isInitiallyMobile.md)
62
-
63
- ## Functions
64
-
65
- - [getNormalizedColor](functions/getNormalizedColor.md)
66
- - [colToRGBA](functions/colToRGBA.md)
67
- - [parseFillStyle](functions/parseFillStyle.md)
68
- - [editRGBA](functions/editRGBA.md)
69
- - [scaleCoord](functions/scaleCoord.md)
70
- - [getEnvironment](functions/getEnvironment.md)
71
- - [isNote](functions/isNote.md)
72
- - [shortUID](functions/shortUID.md)
73
- - [tinyUID](functions/tinyUID.md)
74
- - [generateUUID](functions/generateUUID.md)
75
- - [setAnimInterval](functions/setAnimInterval.md)
76
- - [getRayHit](functions/getRayHit.md)
77
- - [getAvoidAngle](functions/getAvoidAngle.md)
78
- - [raycastAvoid](functions/raycastAvoid.md)
79
- - [isMobile](functions/isMobile.md)