bard-legends-framework 0.10.9 → 0.12.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.
Files changed (288) hide show
  1. package/dist/actions-performance.test.d.ts +1 -0
  2. package/dist/actions-performance.test.js +83 -0
  3. package/dist/game-entities/controller/controller.d.ts +2 -3
  4. package/dist/game-entities/controller/controller.js +9 -8
  5. package/dist/game-entities/controller/controller.test.js +2 -2
  6. package/dist/game-entities/entity/entity.d.ts +11 -9
  7. package/dist/game-entities/entity/entity.js +20 -16
  8. package/dist/game-entities/entity/entity.test.js +116 -147
  9. package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +6 -9
  10. package/dist/game-entities/entity/helpers/entity-store.helper.js +22 -57
  11. package/dist/game-entities/entity/helpers/entity-store.helper.test.d.ts +1 -0
  12. package/dist/game-entities/entity/helpers/entity-store.helper.test.js +136 -0
  13. package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +7 -7
  14. package/dist/game-entities/entity/helpers/entity-views.helper.js +28 -23
  15. package/dist/game-entities/entity/singleton-entity.d.ts +3 -3
  16. package/dist/game-entities/entity/singleton-entity.js +1 -1
  17. package/dist/game-entities/entity/singleton-entity.test.js +9 -31
  18. package/dist/game-entities/hard-reset.d.ts +5 -0
  19. package/dist/game-entities/hard-reset.js +14 -0
  20. package/dist/game-entities/index.d.ts +1 -3
  21. package/dist/game-entities/index.js +3 -7
  22. package/dist/game-entities/scene/scene.d.ts +15 -15
  23. package/dist/game-entities/scene/scene.js +61 -60
  24. package/dist/game-entities/scene/scene.test.js +97 -67
  25. package/dist/game-entities/service/service.d.ts +1 -4
  26. package/dist/game-entities/service/service.js +15 -14
  27. package/dist/game-entities/service/service.test.js +33 -38
  28. package/dist/game-entities/unit-test.helper.d.ts +5 -0
  29. package/dist/game-entities/unit-test.helper.js +14 -0
  30. package/dist/game-entities/update-cycle.d.ts +10 -9
  31. package/dist/game-entities/update-cycle.js +34 -23
  32. package/dist/game-entities/view/view.d.ts +10 -11
  33. package/dist/game-entities/view/view.js +17 -35
  34. package/dist/game-entities/view/view.test.js +73 -250
  35. package/dist/physics/entity-types/immovable-physics-entity.d.ts +2 -4
  36. package/dist/physics/entity-types/immovable-physics-entity.js +4 -6
  37. package/dist/physics/entity-types/movable-entity.d.ts +1 -1
  38. package/dist/physics/entity-types/movable-entity.js +6 -6
  39. package/dist/physics/entity-types/movable-physics-entity.d.ts +10 -11
  40. package/dist/physics/entity-types/movable-physics-entity.js +31 -32
  41. package/dist/physics/entity-types/physics-entity.d.ts +12 -15
  42. package/dist/physics/entity-types/physics-entity.js +30 -28
  43. package/dist/physics/interfaces.d.ts +6 -6
  44. package/dist/physics/interfaces.js +4 -4
  45. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
  46. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
  47. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +20 -20
  48. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
  49. package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
  50. package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
  51. package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
  52. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +11 -11
  53. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
  54. package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
  55. package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
  56. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
  57. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
  58. package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
  59. package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
  60. package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
  61. package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
  62. package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
  63. package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
  64. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
  65. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +28 -27
  66. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
  67. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
  68. package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
  69. package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
  70. package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
  71. package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
  72. package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
  73. package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
  74. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
  75. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
  76. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
  77. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +13 -13
  78. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
  79. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +13 -13
  80. package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
  81. package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
  82. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
  83. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
  84. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
  85. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +60 -49
  86. package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
  87. package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
  88. package/dist/physics/module//360/237/247/212entities/physics-world.entity.js +2 -2
  89. package/dist/pixi/components/display-object-array.d.ts +5 -5
  90. package/dist/pixi/components/display-object-array.js +14 -14
  91. package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
  92. package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
  93. package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
  94. package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
  95. package/dist/pixi/components/menu/menu-entity.js +48 -0
  96. package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
  97. package/dist/pixi/components/menu/menu.ui.js +97 -0
  98. package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +4 -3
  99. package/dist/pixi/components/mouse-wheel-listener.ui.js +15 -14
  100. package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
  101. package/dist/pixi/components/scroll-area.ui.js +9 -9
  102. package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
  103. package/dist/pixi/components/scroll-mask.ui.js +25 -24
  104. package/dist/pixi/display-object/container-attributes.d.ts +24 -26
  105. package/dist/pixi/display-object/container-attributes.js +27 -28
  106. package/dist/pixi/display-object/container.d.ts +3 -6
  107. package/dist/pixi/display-object/container.js +2 -12
  108. package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
  109. package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
  110. package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
  111. package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
  112. package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
  113. package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
  114. package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
  115. package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
  116. package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
  117. package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
  118. package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
  119. package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
  120. package/dist/pixi/display-object/filters.d.ts +7 -7
  121. package/dist/pixi/display-object/filters.js +34 -34
  122. package/dist/pixi/display-object/index.d.ts +1 -1
  123. package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
  124. package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
  125. package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
  126. package/dist/pixi/display-object/objects/placeholder.js +7 -7
  127. package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
  128. package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +29 -26
  129. package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
  130. package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
  131. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
  132. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
  133. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
  134. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
  135. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
  136. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
  137. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
  138. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
  139. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
  140. package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
  141. package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
  142. package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
  143. package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
  144. package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
  145. package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
  146. package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
  147. package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
  148. package/dist/pixi/display-object/objects/text/text.js +34 -35
  149. package/dist/pixi/game.d.ts +26 -17
  150. package/dist/pixi/game.js +53 -39
  151. package/dist/pixi/helpers/game-assets.d.ts +5 -5
  152. package/dist/pixi/helpers/game-assets.js +14 -11
  153. package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
  154. package/dist/pixi/helpers/position-conversion.helper.js +3 -3
  155. package/dist/pixi/index.d.ts +3 -37
  156. package/dist/pixi/index.js +6 -22
  157. package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
  158. package/dist/pixi/modules/CAMERA/camera.js +9 -9
  159. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
  160. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
  161. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
  162. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
  163. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
  164. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
  165. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
  166. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
  167. package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
  168. package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
  169. package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js +4 -4
  170. package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
  171. package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +50 -49
  172. package/dist/pixi/pixi-definitions.d.ts +38 -0
  173. package/dist/pixi/pixi-definitions.js +37 -0
  174. package/dist/pixi/services/keyboard/keyboard.d.ts +6 -4
  175. package/dist/pixi/services/keyboard/keyboard.js +15 -13
  176. package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +12 -11
  177. package/dist/pixi/services/mouse/mouse-target-focus.service.js +31 -30
  178. package/dist/pixi/services/mouse/mouse.service.d.ts +16 -6
  179. package/dist/pixi/services/mouse/mouse.service.js +42 -22
  180. package/dist/utilities/animator/animating-content/fade-in-content.d.ts +18 -0
  181. package/dist/utilities/animator/animating-content/fade-in-content.js +37 -0
  182. package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
  183. package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
  184. package/dist/utilities/animator/animating-content/slide-in-content.d.ts +37 -0
  185. package/dist/utilities/animator/animating-content/slide-in-content.js +99 -0
  186. package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
  187. package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
  188. package/dist/utilities/animator/animations.d.ts +45 -0
  189. package/dist/utilities/animator/animations.js +92 -0
  190. package/dist/utilities/animator/animator/animator.d.ts +44 -0
  191. package/dist/utilities/animator/animator/animator.js +234 -0
  192. package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
  193. package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
  194. package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
  195. package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
  196. package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
  197. package/dist/utilities/animator/animator/animator.test.js +1046 -0
  198. package/dist/utilities/animator/animator.d.ts +60 -0
  199. package/dist/utilities/animator/animator.js +322 -0
  200. package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
  201. package/dist/utilities/animator/animator.performance.test.js +46 -0
  202. package/dist/utilities/animator/animator.test.d.ts +1 -0
  203. package/dist/utilities/animator/animator.test.js +928 -0
  204. package/dist/utilities/animator/animator2/animator.d.ts +42 -0
  205. package/dist/utilities/animator/animator2/animator.js +222 -0
  206. package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
  207. package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
  208. package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
  209. package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
  210. package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
  211. package/dist/utilities/animator/animator2/animator.test.js +1007 -0
  212. package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
  213. package/dist/utilities/animator/animator_old/animator.js +337 -0
  214. package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
  215. package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
  216. package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
  217. package/dist/utilities/animator/animator_old/animator.test.js +996 -0
  218. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
  219. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
  220. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
  221. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
  222. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
  223. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
  224. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
  225. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
  226. package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
  227. package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
  228. package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
  229. package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
  230. package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
  231. package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
  232. package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
  233. package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
  234. package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
  235. package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
  236. package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
  237. package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
  238. package/dist/utilities/animator/index.d.ts +7 -0
  239. package/dist/utilities/animator/index.js +24 -0
  240. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
  241. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
  242. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
  243. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
  244. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
  245. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
  246. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
  247. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
  248. package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
  249. package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
  250. package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
  251. package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
  252. package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
  253. package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
  254. package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
  255. package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
  256. package/dist/utilities/animator/state-animation/slide-state-animation.d.ts +24 -0
  257. package/dist/utilities/animator/state-animation/slide-state-animation.js +130 -0
  258. package/dist/utilities/animator/state-animation/slide-state-animation.test.d.ts +1 -0
  259. package/dist/utilities/animator/state-animation/slide-state-animation.test.js +301 -0
  260. package/dist/utilities/animator/state-animation/state-animation.d.ts +33 -0
  261. package/dist/utilities/animator/state-animation/state-animation.js +146 -0
  262. package/dist/utilities/animator/state-animation/state-animation.test.d.ts +1 -0
  263. package/dist/utilities/animator/state-animation/state-animation.test.js +335 -0
  264. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.d.ts +32 -0
  265. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.js +168 -0
  266. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.d.ts +1 -0
  267. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +431 -0
  268. package/dist/utilities/data-structures/vector-set/vector-set.d.ts +7 -0
  269. package/dist/utilities/data-structures/vector-set/vector-set.js +26 -0
  270. package/dist/utilities/delta-time/delta-time.d.ts +3 -0
  271. package/dist/utilities/delta-time/delta-time.js +10 -0
  272. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +6 -0
  273. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +55 -0
  274. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.d.ts +1 -0
  275. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.js +100 -0
  276. package/dist/utilities/grid-algorithms/path-finder/path-finder.d.ts +8 -0
  277. package/dist/utilities/grid-algorithms/path-finder/path-finder.js +98 -0
  278. package/dist/utilities/grid-algorithms/path-finder/path-finder.test.d.ts +1 -0
  279. package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +155 -0
  280. package/dist/utilities/grid-algorithms/position-to-grid-position-converter.d.ts +6 -0
  281. package/dist/utilities/grid-algorithms/position-to-grid-position-converter.js +17 -0
  282. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +18 -0
  283. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +129 -0
  284. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.d.ts +1 -0
  285. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +254 -0
  286. package/dist/utilities/index.d.ts +6 -6
  287. package/dist/utilities/index.js +6 -6
  288. package/package.json +8 -6
@@ -0,0 +1,42 @@
1
+ import { IAttachment, NotifierCallbackFunction, SingleEvent } from 'actions-lib';
2
+ import { AnimatorAnimation } from '../animations';
3
+ export declare enum ReAnimateHandlingType {
4
+ throwError = 1,
5
+ ignoreNewAnimation = 2,
6
+ completePrevious = 3
7
+ }
8
+ export declare enum AnimationsCompletionHandlingType {
9
+ returnToOriginal = 1,
10
+ stayInCurrentState = 2,
11
+ jumpToEnd = 3,
12
+ loop = 4
13
+ }
14
+ export interface AnimationOptions {
15
+ readonly duration: number;
16
+ readonly animation: AnimatorAnimation;
17
+ readonly reAnimateHandling: ReAnimateHandlingType;
18
+ readonly completionHandling: AnimationsCompletionHandlingType;
19
+ }
20
+ type NumericKeys<T> = {
21
+ [P in keyof T]: T[P] extends number ? P : never;
22
+ }[keyof T] & string;
23
+ export declare class Animator<T extends object = any, K extends NumericKeys<T> = NumericKeys<T>> {
24
+ private static _animatedObjects;
25
+ private static _getAnimatedObjectProperties;
26
+ private _target;
27
+ private _options;
28
+ private _animatedProperties;
29
+ private _subscribeCallback?;
30
+ private _ongoingAnimation;
31
+ get animating(): boolean;
32
+ constructor(target: T & Record<K, number>, animatedProperties: K | K[], partialOptions?: Partial<AnimationOptions>);
33
+ subscribe(callback: NotifierCallbackFunction<T>): IAttachment;
34
+ animate(values: Record<K, number>, partialOptions?: Partial<AnimationOptions>): SingleEvent<void>;
35
+ set(values: Record<K, number>): void;
36
+ completeAnimation(completionHandling?: AnimationsCompletionHandlingType): void;
37
+ private _isAnimatingToSameValues;
38
+ private _setCompletionValues;
39
+ private _setValues;
40
+ private _lockAnimatedProperties;
41
+ }
42
+ export {};
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Animator = exports.AnimationsCompletionHandlingType = exports.ReAnimateHandlingType = void 0;
4
+ const actions_lib_1 = require("actions-lib");
5
+ const helpers_lib_1 = require("helpers-lib");
6
+ const game_entities_1 = require("../../../game-entities");
7
+ const animations_1 = require("../animations");
8
+ var ReAnimateHandlingType;
9
+ (function (ReAnimateHandlingType) {
10
+ ReAnimateHandlingType[ReAnimateHandlingType["throwError"] = 1] = "throwError";
11
+ ReAnimateHandlingType[ReAnimateHandlingType["ignoreNewAnimation"] = 2] = "ignoreNewAnimation";
12
+ ReAnimateHandlingType[ReAnimateHandlingType["completePrevious"] = 3] = "completePrevious";
13
+ })(ReAnimateHandlingType || (exports.ReAnimateHandlingType = ReAnimateHandlingType = {}));
14
+ var AnimationsCompletionHandlingType;
15
+ (function (AnimationsCompletionHandlingType) {
16
+ AnimationsCompletionHandlingType[AnimationsCompletionHandlingType["returnToOriginal"] = 1] = "returnToOriginal";
17
+ AnimationsCompletionHandlingType[AnimationsCompletionHandlingType["stayInCurrentState"] = 2] = "stayInCurrentState";
18
+ AnimationsCompletionHandlingType[AnimationsCompletionHandlingType["jumpToEnd"] = 3] = "jumpToEnd";
19
+ AnimationsCompletionHandlingType[AnimationsCompletionHandlingType["loop"] = 4] = "loop";
20
+ })(AnimationsCompletionHandlingType || (exports.AnimationsCompletionHandlingType = AnimationsCompletionHandlingType = {}));
21
+ class Animator {
22
+ static { this._animatedObjects = new WeakMap(); }
23
+ static _getAnimatedObjectProperties(target) {
24
+ let animatedObjectProperties = Animator._animatedObjects.get(target);
25
+ if (!animatedObjectProperties) {
26
+ animatedObjectProperties = new helpers_lib_1.MapToWeakRefs();
27
+ Animator._animatedObjects.set(target, animatedObjectProperties);
28
+ }
29
+ return animatedObjectProperties;
30
+ }
31
+ get animating() {
32
+ return this._ongoingAnimation !== undefined;
33
+ }
34
+ constructor(target, animatedProperties, partialOptions) {
35
+ this._target = target;
36
+ this._options = {
37
+ duration: 200,
38
+ animation: animations_1.Animations.lineer,
39
+ reAnimateHandling: ReAnimateHandlingType.throwError,
40
+ completionHandling: AnimationsCompletionHandlingType.stayInCurrentState,
41
+ ...partialOptions
42
+ };
43
+ this._animatedProperties = helpers_lib_1.Comparator.isArray(animatedProperties) ? animatedProperties : [animatedProperties];
44
+ this._lockAnimatedProperties(target, this._animatedProperties); // NOTE: this can be removed in release mode
45
+ }
46
+ subscribe(callback) {
47
+ if (this._subscribeCallback) {
48
+ throw new Error('Animator: subscribe is already set, there should be max one subscriber by design.');
49
+ }
50
+ this._subscribeCallback = callback;
51
+ return new actions_lib_1.ActionSubscription(() => {
52
+ this._subscribeCallback = undefined;
53
+ });
54
+ }
55
+ animate(values, partialOptions) {
56
+ let options = {
57
+ ...this._options,
58
+ ...partialOptions
59
+ };
60
+ if (this._ongoingAnimation) {
61
+ switch (options.reAnimateHandling) {
62
+ case ReAnimateHandlingType.throwError:
63
+ throw new Error(`Animator: new animation triggered while another is not complete yet.`);
64
+ case ReAnimateHandlingType.ignoreNewAnimation:
65
+ return actions_lib_1.SingleEvent.instant();
66
+ case ReAnimateHandlingType.completePrevious:
67
+ this._setCompletionValues(options.completionHandling, this._ongoingAnimation._propertyStartingValues, this._ongoingAnimation._propertyTargetValues, true);
68
+ break;
69
+ default: {
70
+ let _ = options.reAnimateHandling;
71
+ throw new Error(`Animator: unknown re-animate handling type: "${options.reAnimateHandling}"`);
72
+ }
73
+ }
74
+ }
75
+ let event = actions_lib_1.SingleEvent.create((resolve, context) => {
76
+ let updateCycleSubscription;
77
+ let animationState = {
78
+ _duration: options.duration,
79
+ _elapsedTime: 0,
80
+ _propertyStartingValues: this._animatedProperties.reduce((acc, key) => {
81
+ acc[key] = this._target[key];
82
+ return acc;
83
+ }, {}),
84
+ _propertyTargetValues: this._animatedProperties.reduce((acc, key) => {
85
+ acc[key] = values[key];
86
+ return acc;
87
+ }, {}),
88
+ _completionHandling: options.completionHandling,
89
+ _animation: options.animation,
90
+ _completionCallback: resolve
91
+ };
92
+ if (animationState._completionHandling !== AnimationsCompletionHandlingType.loop &&
93
+ this._isAnimatingToSameValues(animationState)) {
94
+ this._ongoingAnimation = undefined;
95
+ resolve();
96
+ return;
97
+ }
98
+ else {
99
+ animationState._animation.start();
100
+ }
101
+ let previousAnimationState = this._ongoingAnimation;
102
+ this._ongoingAnimation = animationState;
103
+ updateCycleSubscription = game_entities_1.UpdateCycle.beforeSceneUpdateAction
104
+ .subscribe(update => {
105
+ animationState._elapsedTime += update.delta;
106
+ let animationIsCompete = animationState._elapsedTime >= animationState._duration;
107
+ if (animationIsCompete) {
108
+ if (animationState._completionHandling === AnimationsCompletionHandlingType.loop) {
109
+ animationState._elapsedTime %= animationState._duration;
110
+ animationState._animation.start();
111
+ animationIsCompete = false;
112
+ }
113
+ else {
114
+ this._setCompletionValues(animationState._completionHandling, animationState._propertyStartingValues, animationState._propertyTargetValues, false);
115
+ this._ongoingAnimation = undefined;
116
+ animationState._completionCallback();
117
+ }
118
+ }
119
+ if (!animationIsCompete) {
120
+ let multiplier = animationState._animation.multiplierFunction(animationState._elapsedTime / animationState._duration);
121
+ let changeHappened = false;
122
+ for (let i = 0; i < this._animatedProperties.length; i++) {
123
+ let key = this._animatedProperties[i];
124
+ let propertyStartingValue = animationState._propertyStartingValues[key];
125
+ let propertyTargetValue = animationState._propertyTargetValues[key];
126
+ let relativeTarget = propertyTargetValue - propertyStartingValue;
127
+ let newValue = relativeTarget * multiplier + propertyStartingValue;
128
+ if (newValue !== this._target[key]) {
129
+ changeHappened = true;
130
+ this._target[key] = newValue;
131
+ }
132
+ }
133
+ changeHappened && this._subscribeCallback?.(this._target);
134
+ }
135
+ })
136
+ .attach(context.attachable);
137
+ previousAnimationState?._completionCallback();
138
+ return () => {
139
+ if (this._ongoingAnimation === animationState) {
140
+ updateCycleSubscription.destroy();
141
+ this._setCompletionValues(this._ongoingAnimation._completionHandling, this._ongoingAnimation._propertyStartingValues, this._ongoingAnimation._propertyTargetValues, true);
142
+ this._ongoingAnimation = undefined;
143
+ }
144
+ };
145
+ });
146
+ return event;
147
+ }
148
+ set(values) {
149
+ let changeHappened = false;
150
+ for (let i = 0; i < this._animatedProperties.length; i++) {
151
+ let key = this._animatedProperties[i];
152
+ if (this._target[key] !== values[key]) {
153
+ changeHappened = true;
154
+ this._target[key] = values[key];
155
+ }
156
+ }
157
+ changeHappened && this._subscribeCallback?.(this._target);
158
+ this._ongoingAnimation?._completionCallback();
159
+ }
160
+ completeAnimation(completionHandling) {
161
+ if (this._ongoingAnimation) {
162
+ completionHandling = completionHandling ?? this._ongoingAnimation._completionHandling;
163
+ this._setCompletionValues(completionHandling, this._ongoingAnimation._propertyStartingValues, this._ongoingAnimation._propertyTargetValues, true);
164
+ let callback = this._ongoingAnimation._completionCallback;
165
+ this._ongoingAnimation = undefined;
166
+ callback();
167
+ }
168
+ }
169
+ _isAnimatingToSameValues(ongoingAnimation) {
170
+ for (let i = 0; i < this._animatedProperties.length; i++) {
171
+ let key = this._animatedProperties[i];
172
+ if (this._target[key] !== ongoingAnimation._propertyTargetValues[key]) {
173
+ return false;
174
+ }
175
+ }
176
+ return true;
177
+ }
178
+ _setCompletionValues(completionHandling, startingValues, targetValues, interruptedCompletion) {
179
+ switch (completionHandling) {
180
+ case AnimationsCompletionHandlingType.returnToOriginal:
181
+ this._setValues(startingValues);
182
+ break;
183
+ case AnimationsCompletionHandlingType.stayInCurrentState:
184
+ if (!interruptedCompletion) {
185
+ this._setValues(targetValues);
186
+ }
187
+ break;
188
+ case AnimationsCompletionHandlingType.jumpToEnd:
189
+ this._setValues(targetValues);
190
+ break;
191
+ case AnimationsCompletionHandlingType.loop:
192
+ this._setValues(startingValues);
193
+ break;
194
+ default: {
195
+ let _ = completionHandling;
196
+ throw new Error(`Animator: unknown completion handling type: "${completionHandling}"`);
197
+ }
198
+ }
199
+ }
200
+ _setValues(values) {
201
+ let changeHappened = false;
202
+ for (let i = 0; i < this._animatedProperties.length; i++) {
203
+ let key = this._animatedProperties[i];
204
+ if (this._target[key] !== values[key]) {
205
+ changeHappened = true;
206
+ this._target[key] = values[key];
207
+ }
208
+ }
209
+ changeHappened && this._subscribeCallback?.(this._target);
210
+ }
211
+ _lockAnimatedProperties(target, animatedProperties) {
212
+ let animatedObjectProperties = Animator._getAnimatedObjectProperties(target);
213
+ for (let key of animatedProperties) {
214
+ if (animatedObjectProperties.has(key)) {
215
+ throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(target, undefined, 2)}", Property: "${key}"`);
216
+ }
217
+ animatedObjectProperties.set(key, this);
218
+ }
219
+ }
220
+ }
221
+ exports.Animator = Animator;
222
+ //# sourceMappingURL=animator.js.map
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@memlab/core");
4
+ const actions_lib_1 = require("actions-lib");
5
+ const helpers_lib_1 = require("helpers-lib");
6
+ const vitest_1 = require("vitest");
7
+ const game_entities_1 = require("../../../game-entities");
8
+ const animator_1 = require("./animator");
9
+ const ClassNamesToCheck = ['Animator', 'SingleEvent'];
10
+ vitest_1.describe.skipIf(process.env.QUICK)('Memory Leak', () => {
11
+ (0, vitest_1.beforeEach)(() => {
12
+ actions_lib_1.ActionLib.hardReset();
13
+ });
14
+ async function checkMemoryLeaks(...additionalNames) {
15
+ await helpers_lib_1.UnitTestHelper.waitForAllOperations();
16
+ await (0, helpers_lib_1.Wait)();
17
+ let snapshot = await (0, core_1.takeNodeMinimalHeap)();
18
+ ClassNamesToCheck.concat(additionalNames).forEach(name => {
19
+ if (snapshot.hasObjectWithClassName(name)) {
20
+ throw new Error(`"${name}" has at least one instance in the memory.`);
21
+ }
22
+ });
23
+ }
24
+ (0, vitest_1.test)('simple animator', async () => {
25
+ let target = { x: 1 };
26
+ let animator = new animator_1.Animator(target, 'x');
27
+ (0, vitest_1.expect)(animator).toBeDefined();
28
+ animator = undefined;
29
+ await (0, vitest_1.expect)(checkMemoryLeaks()).resolves.not.toThrow();
30
+ }, 60000);
31
+ (0, vitest_1.test)('sample animation', async () => {
32
+ let target = { x: 1 };
33
+ let animator = new animator_1.Animator(target, 'x');
34
+ let animation = animator.animate({ x: 2 }).attachToRoot();
35
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
36
+ (0, vitest_1.expect)(animation).toBeDefined();
37
+ animation.destroy();
38
+ animator = undefined;
39
+ animation = undefined;
40
+ await (0, vitest_1.expect)(checkMemoryLeaks()).resolves.not.toThrow();
41
+ }, 60000);
42
+ (0, vitest_1.test)('target contains the animator', async () => {
43
+ class Foo {
44
+ constructor() {
45
+ this.x = 0;
46
+ this.animator = new animator_1.Animator(this, 'x');
47
+ }
48
+ }
49
+ let foo = new Foo();
50
+ (0, vitest_1.expect)(foo).toBeDefined();
51
+ foo = undefined;
52
+ await (0, vitest_1.expect)(checkMemoryLeaks(Foo.name)).resolves.not.toThrow();
53
+ }, 60000);
54
+ (0, vitest_1.test)('default animation contains the animator', async () => {
55
+ class FaultyAnimation {
56
+ start() { }
57
+ multiplierFunction(t) {
58
+ return 0;
59
+ }
60
+ setAnimator(anim) {
61
+ this.animator = anim;
62
+ }
63
+ }
64
+ let animation = new FaultyAnimation();
65
+ let animator = new animator_1.Animator({ x: 1 }, 'x', { animation });
66
+ animation.setAnimator(animator);
67
+ (0, vitest_1.expect)(animator).toBeDefined();
68
+ animation = undefined;
69
+ animator = undefined;
70
+ await (0, vitest_1.expect)(checkMemoryLeaks(FaultyAnimation.name)).resolves.not.toThrow();
71
+ }, 60000);
72
+ });
73
+ //# sourceMappingURL=animator.memory-leak.test.js.map
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const helpers_lib_1 = require("helpers-lib");
4
+ const vitest_1 = require("vitest");
5
+ const game_entities_1 = require("../../../game-entities");
6
+ const animator_1 = require("./animator");
7
+ vitest_1.describe.skipIf(!process.env.MANUAL)('Performance Tests', () => {
8
+ (0, vitest_1.test)('no anim single', async () => {
9
+ await helpers_lib_1.UnitTestHelper.testPerformance(async () => {
10
+ return new Promise(resolve => {
11
+ let obj = { x: 0, y: 0 };
12
+ new animator_1.Animator(obj, 'x', {
13
+ duration: 1
14
+ });
15
+ resolve();
16
+ });
17
+ // old animator: 18.053100109100342
18
+ // 11.454499959945679
19
+ }, { sampleCount: 100, repetationCount: 10000 });
20
+ }, 60000);
21
+ (0, vitest_1.test)('no anim multiple', async () => {
22
+ await helpers_lib_1.UnitTestHelper.testPerformance(async () => {
23
+ return new Promise(resolve => {
24
+ let obj = { x: 0, y: 0 };
25
+ new animator_1.Animator(obj, ['x', 'y'], {
26
+ duration: 1
27
+ });
28
+ resolve();
29
+ });
30
+ // old animator: 18.6875
31
+ // 12.170400142669678
32
+ }, { sampleCount: 100, repetationCount: 10000 });
33
+ }, 60000);
34
+ (0, vitest_1.test)('single anim with trigger', async () => {
35
+ await helpers_lib_1.UnitTestHelper.testPerformance(async () => {
36
+ return new Promise(resolve => {
37
+ let obj = { x: 0, y: 0 };
38
+ let animator = new animator_1.Animator(obj, 'x', {
39
+ duration: 1
40
+ });
41
+ let animation = animator.animate({ x: 1 }).tap(resolve).attachToRoot();
42
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
43
+ animation.destroy();
44
+ });
45
+ // old animator: 31.59340000152588
46
+ // 31.48099994659424
47
+ }, { sampleCount: 100, repetationCount: 10000 });
48
+ }, 60000);
49
+ (0, vitest_1.test)('multiple anim with trigger', async () => {
50
+ await helpers_lib_1.UnitTestHelper.testPerformance(async () => {
51
+ return new Promise(resolve => {
52
+ let obj = { x: 0, y: 0 };
53
+ let animator = new animator_1.Animator(obj, ['x', 'y'], {
54
+ duration: 1
55
+ });
56
+ let animation = animator.animate({ x: 1, y: 1 }).tap(resolve).attachToRoot();
57
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
58
+ animation.destroy();
59
+ });
60
+ // old animator: 35.71740007400513
61
+ // 34.62980008125305
62
+ }, { sampleCount: 100, repetationCount: 10000 });
63
+ }, 60000);
64
+ });
65
+ //# sourceMappingURL=animator.performance.test.js.map