bard-legends-framework 0.11.0 → 0.12.1

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 (258) 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 -2
  4. package/dist/game-entities/controller/controller.js +8 -8
  5. package/dist/game-entities/controller/controller.test.js +2 -2
  6. package/dist/game-entities/entity/entity.d.ts +7 -7
  7. package/dist/game-entities/entity/entity.js +18 -12
  8. package/dist/game-entities/entity/entity.test.js +93 -30
  9. package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +3 -3
  10. package/dist/game-entities/entity/helpers/entity-store.helper.js +12 -12
  11. package/dist/game-entities/entity/helpers/entity-store.helper.test.js +11 -11
  12. package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +6 -6
  13. package/dist/game-entities/entity/helpers/entity-views.helper.js +25 -22
  14. package/dist/game-entities/entity/singleton-entity.test.js +9 -4
  15. package/dist/game-entities/hard-reset.d.ts +5 -0
  16. package/dist/game-entities/hard-reset.js +14 -0
  17. package/dist/game-entities/index.d.ts +1 -1
  18. package/dist/game-entities/index.js +3 -3
  19. package/dist/game-entities/scene/scene.d.ts +13 -13
  20. package/dist/game-entities/scene/scene.js +41 -46
  21. package/dist/game-entities/scene/scene.test.js +95 -37
  22. package/dist/game-entities/service/service.d.ts +1 -4
  23. package/dist/game-entities/service/service.js +12 -13
  24. package/dist/game-entities/service/service.test.js +33 -12
  25. package/dist/game-entities/unit-test.helper.js +1 -1
  26. package/dist/game-entities/update-cycle.d.ts +7 -17
  27. package/dist/game-entities/update-cycle.js +25 -19
  28. package/dist/game-entities/view/view.d.ts +6 -6
  29. package/dist/game-entities/view/view.js +15 -21
  30. package/dist/game-entities/view/view.test.js +40 -9
  31. package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -1
  32. package/dist/physics/entity-types/immovable-physics-entity.js +4 -4
  33. package/dist/physics/entity-types/movable-entity.d.ts +1 -1
  34. package/dist/physics/entity-types/movable-entity.js +2 -2
  35. package/dist/physics/entity-types/movable-physics-entity.d.ts +8 -8
  36. package/dist/physics/entity-types/movable-physics-entity.js +27 -27
  37. package/dist/physics/entity-types/physics-entity.d.ts +10 -14
  38. package/dist/physics/entity-types/physics-entity.js +27 -26
  39. package/dist/physics/interfaces.d.ts +6 -6
  40. package/dist/physics/interfaces.js +4 -4
  41. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
  42. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
  43. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +19 -19
  44. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
  45. package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
  46. package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
  47. package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
  48. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +10 -10
  49. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
  50. package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
  51. package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
  52. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
  53. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
  54. package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
  55. package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
  56. package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
  57. package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
  58. package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
  59. package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
  60. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
  61. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +27 -26
  62. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
  63. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
  64. package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
  65. package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
  66. package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
  67. package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
  68. package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
  69. package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
  70. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
  71. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
  72. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
  73. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +12 -12
  74. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
  75. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +12 -12
  76. package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
  77. package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
  78. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
  79. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
  80. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
  81. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +43 -42
  82. package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
  83. package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
  84. package/dist/pixi/components/display-object-array.d.ts +5 -5
  85. package/dist/pixi/components/display-object-array.js +14 -14
  86. package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
  87. package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
  88. package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
  89. package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
  90. package/dist/pixi/components/menu/menu-entity.js +48 -0
  91. package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
  92. package/dist/pixi/components/menu/menu.ui.js +97 -0
  93. package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +2 -2
  94. package/dist/pixi/components/mouse-wheel-listener.ui.js +11 -11
  95. package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
  96. package/dist/pixi/components/scroll-area.ui.js +9 -9
  97. package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
  98. package/dist/pixi/components/scroll-mask.ui.js +25 -24
  99. package/dist/pixi/display-object/container-attributes.d.ts +24 -25
  100. package/dist/pixi/display-object/container-attributes.js +26 -26
  101. package/dist/pixi/display-object/container.d.ts +3 -3
  102. package/dist/pixi/display-object/container.js +2 -2
  103. package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
  104. package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
  105. package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
  106. package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
  107. package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
  108. package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
  109. package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
  110. package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
  111. package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
  112. package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
  113. package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
  114. package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
  115. package/dist/pixi/display-object/filters.d.ts +7 -7
  116. package/dist/pixi/display-object/filters.js +34 -34
  117. package/dist/pixi/display-object/index.d.ts +1 -1
  118. package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
  119. package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
  120. package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
  121. package/dist/pixi/display-object/objects/placeholder.js +7 -7
  122. package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
  123. package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +26 -25
  124. package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
  125. package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
  126. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
  127. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
  128. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
  129. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
  130. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
  131. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
  132. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
  133. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
  134. package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
  135. package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
  136. package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
  137. package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
  138. package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
  139. package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
  140. package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
  141. package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
  142. package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
  143. package/dist/pixi/display-object/objects/text/text.js +34 -35
  144. package/dist/pixi/game.d.ts +20 -15
  145. package/dist/pixi/game.js +40 -35
  146. package/dist/pixi/helpers/game-assets.d.ts +5 -5
  147. package/dist/pixi/helpers/game-assets.js +14 -11
  148. package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
  149. package/dist/pixi/helpers/position-conversion.helper.js +3 -3
  150. package/dist/pixi/index.d.ts +3 -37
  151. package/dist/pixi/index.js +6 -22
  152. package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
  153. package/dist/pixi/modules/CAMERA/camera.js +9 -9
  154. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
  155. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
  156. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
  157. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
  158. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
  159. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
  160. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
  161. package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
  162. package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
  163. package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
  164. package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
  165. package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +49 -48
  166. package/dist/pixi/pixi-definitions.d.ts +38 -0
  167. package/dist/pixi/pixi-definitions.js +37 -0
  168. package/dist/pixi/services/keyboard/keyboard.d.ts +2 -2
  169. package/dist/pixi/services/keyboard/keyboard.js +9 -9
  170. package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +10 -10
  171. package/dist/pixi/services/mouse/mouse-target-focus.service.js +28 -28
  172. package/dist/pixi/services/mouse/mouse.service.d.ts +1 -1
  173. package/dist/pixi/services/mouse/mouse.service.js +5 -5
  174. package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
  175. package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
  176. package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
  177. package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
  178. package/dist/utilities/animator/animations.d.ts +14 -6
  179. package/dist/utilities/animator/animations.js +15 -11
  180. package/dist/utilities/animator/animator/animator.d.ts +44 -0
  181. package/dist/utilities/animator/animator/animator.js +234 -0
  182. package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
  183. package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
  184. package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
  185. package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
  186. package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
  187. package/dist/utilities/animator/animator/animator.test.js +1046 -0
  188. package/dist/utilities/animator/animator.d.ts +2 -3
  189. package/dist/utilities/animator/animator.js +66 -59
  190. package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
  191. package/dist/utilities/animator/animator.performance.test.js +46 -0
  192. package/dist/utilities/animator/animator.test.js +89 -28
  193. package/dist/utilities/animator/animator2/animator.d.ts +42 -0
  194. package/dist/utilities/animator/animator2/animator.js +222 -0
  195. package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
  196. package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
  197. package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
  198. package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
  199. package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
  200. package/dist/utilities/animator/animator2/animator.test.js +1007 -0
  201. package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
  202. package/dist/utilities/animator/animator_old/animator.js +337 -0
  203. package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
  204. package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
  205. package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
  206. package/dist/utilities/animator/animator_old/animator.test.js +996 -0
  207. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
  208. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
  209. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
  210. package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
  211. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
  212. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
  213. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
  214. package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
  215. package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
  216. package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
  217. package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
  218. package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
  219. package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
  220. package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
  221. package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
  222. package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
  223. package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
  224. package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
  225. package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
  226. package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
  227. package/dist/utilities/animator/index.d.ts +6 -6
  228. package/dist/utilities/animator/index.js +6 -6
  229. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
  230. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
  231. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
  232. package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
  233. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
  234. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
  235. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
  236. package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
  237. package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
  238. package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
  239. package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
  240. package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
  241. package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
  242. package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
  243. package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
  244. package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
  245. package/dist/utilities/animator/state-animation/slide-state-animation.test.js +30 -30
  246. package/dist/utilities/animator/state-animation/state-animation.js +7 -7
  247. package/dist/utilities/animator/state-animation/state-animation.test.js +24 -24
  248. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +30 -30
  249. package/dist/utilities/data-structures/vector-set/vector-set.d.ts +1 -1
  250. package/dist/utilities/data-structures/vector-set/vector-set.js +5 -5
  251. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +1 -1
  252. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +5 -5
  253. package/dist/utilities/grid-algorithms/path-finder/path-finder.js +21 -21
  254. package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +9 -9
  255. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +14 -14
  256. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +43 -43
  257. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +21 -21
  258. package/package.json +7 -5
@@ -0,0 +1,439 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const game_entities_1 = require("../../../../game-entities");
5
+ const fade_in_state_animation_1 = require("./fade-in-state-animation");
6
+ var AnimationState;
7
+ (function (AnimationState) {
8
+ AnimationState[AnimationState["Hidden"] = 1] = "Hidden";
9
+ AnimationState[AnimationState["Visible"] = 2] = "Visible";
10
+ AnimationState[AnimationState["Appearing"] = 3] = "Appearing";
11
+ AnimationState[AnimationState["Disappearing"] = 4] = "Disappearing";
12
+ AnimationState[AnimationState["DisappearToChange"] = 5] = "DisappearToChange";
13
+ })(AnimationState || (AnimationState = {}));
14
+ (0, vitest_1.describe)('FadeInStateAnimation', () => {
15
+ let heap = [];
16
+ let stateAnimation;
17
+ (0, vitest_1.beforeEach)(async () => {
18
+ if (stateAnimation) {
19
+ stateAnimation.destroy();
20
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
21
+ }
22
+ heap = [];
23
+ stateAnimation = new fade_in_state_animation_1.FadeInStateAnimation({ duration: 4 })
24
+ .onStateChange(state => heap.push(state))
25
+ .onValueChange(value => heap.push(value))
26
+ .attachToRoot();
27
+ });
28
+ (0, vitest_1.describe)('Appearing', () => {
29
+ (0, vitest_1.test)('default values', () => {
30
+ (0, vitest_1.expect)(heap).toEqual([]);
31
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
32
+ value: 0,
33
+ state: undefined,
34
+ queuedState: undefined,
35
+ animationState: AnimationState.Hidden
36
+ });
37
+ });
38
+ (0, vitest_1.test)('initial values', () => {
39
+ stateAnimation.setState('A');
40
+ (0, vitest_1.expect)(heap).toEqual(['A']);
41
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
42
+ value: 0,
43
+ state: 'A',
44
+ queuedState: undefined,
45
+ animationState: AnimationState.Appearing
46
+ });
47
+ });
48
+ (0, vitest_1.test)('animation in the middle', async () => {
49
+ stateAnimation.setState('A');
50
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
51
+ (0, vitest_1.expect)(heap).toEqual(['A', 0.25]);
52
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
53
+ value: 0.25,
54
+ state: 'A',
55
+ queuedState: undefined,
56
+ animationState: AnimationState.Appearing
57
+ });
58
+ });
59
+ (0, vitest_1.test)('animation end', async () => {
60
+ stateAnimation.setState('A');
61
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
62
+ (0, vitest_1.expect)(heap).toEqual(['A', 1]);
63
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
64
+ value: 1,
65
+ state: 'A',
66
+ queuedState: undefined,
67
+ animationState: AnimationState.Visible
68
+ });
69
+ });
70
+ (0, vitest_1.test)('instant once', async () => {
71
+ stateAnimation.setState('A', { instant: true });
72
+ (0, vitest_1.expect)(heap).toEqual(['A', 1]);
73
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
74
+ value: 1,
75
+ state: 'A',
76
+ queuedState: undefined,
77
+ animationState: AnimationState.Visible
78
+ });
79
+ });
80
+ (0, vitest_1.test)('instant twice', async () => {
81
+ stateAnimation.setState('A', { instant: true });
82
+ heap = [];
83
+ stateAnimation.setState('A', { instant: true });
84
+ (0, vitest_1.expect)(heap).toEqual([]);
85
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
86
+ value: 1,
87
+ state: 'A',
88
+ queuedState: undefined,
89
+ animationState: AnimationState.Visible
90
+ });
91
+ });
92
+ });
93
+ (0, vitest_1.describe)('Disappearing', () => {
94
+ (0, vitest_1.beforeEach)(async () => {
95
+ stateAnimation.setState('A', { instant: true });
96
+ heap = [];
97
+ });
98
+ (0, vitest_1.test)('initial values', async () => {
99
+ stateAnimation.setState(undefined);
100
+ (0, vitest_1.expect)(heap).toEqual([]);
101
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
102
+ value: 1,
103
+ state: 'A',
104
+ queuedState: undefined,
105
+ animationState: AnimationState.Disappearing
106
+ });
107
+ });
108
+ (0, vitest_1.test)('animation in the middle', async () => {
109
+ stateAnimation.setState(undefined);
110
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
111
+ (0, vitest_1.expect)(heap).toEqual([0.75]);
112
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
113
+ value: 0.75,
114
+ state: 'A',
115
+ queuedState: undefined,
116
+ animationState: AnimationState.Disappearing
117
+ });
118
+ });
119
+ (0, vitest_1.test)('animation end', async () => {
120
+ stateAnimation.setState(undefined);
121
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
122
+ (0, vitest_1.expect)(heap).toEqual([undefined, 0]);
123
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
124
+ value: 0,
125
+ state: undefined,
126
+ queuedState: undefined,
127
+ animationState: AnimationState.Hidden
128
+ });
129
+ });
130
+ (0, vitest_1.test)('instant', async () => {
131
+ stateAnimation.setState(undefined, { instant: true });
132
+ (0, vitest_1.expect)(heap).toEqual([undefined, 0]);
133
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
134
+ value: 0,
135
+ state: undefined,
136
+ queuedState: undefined,
137
+ animationState: AnimationState.Hidden
138
+ });
139
+ });
140
+ });
141
+ (0, vitest_1.describe)('Cancel appearing', () => {
142
+ (0, vitest_1.beforeEach)(async () => {
143
+ stateAnimation.setState('A');
144
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
145
+ heap = [];
146
+ });
147
+ (0, vitest_1.test)('initial values', () => {
148
+ stateAnimation.setState(undefined);
149
+ (0, vitest_1.expect)(heap).toEqual([]);
150
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
151
+ value: 0.5,
152
+ state: 'A',
153
+ queuedState: undefined,
154
+ animationState: AnimationState.Disappearing
155
+ });
156
+ });
157
+ (0, vitest_1.test)('animation end', async () => {
158
+ stateAnimation.setState(undefined);
159
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
160
+ (0, vitest_1.expect)(heap).toEqual([undefined, 0]);
161
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
162
+ value: 0,
163
+ state: undefined,
164
+ queuedState: undefined,
165
+ animationState: AnimationState.Hidden
166
+ });
167
+ });
168
+ (0, vitest_1.test)('instant', async () => {
169
+ stateAnimation.setState(undefined, { instant: true });
170
+ (0, vitest_1.expect)(heap).toEqual([undefined, 0]);
171
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
172
+ value: 0,
173
+ state: undefined,
174
+ queuedState: undefined,
175
+ animationState: AnimationState.Hidden
176
+ });
177
+ });
178
+ });
179
+ (0, vitest_1.describe)('Cancel disappearing', () => {
180
+ (0, vitest_1.beforeEach)(async () => {
181
+ stateAnimation.setState('A');
182
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
183
+ stateAnimation.setState(undefined);
184
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
185
+ heap = [];
186
+ });
187
+ (0, vitest_1.test)('initial values', () => {
188
+ stateAnimation.setState('A');
189
+ (0, vitest_1.expect)(heap).toEqual([]);
190
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
191
+ value: 0.5,
192
+ state: 'A',
193
+ queuedState: undefined,
194
+ animationState: AnimationState.Appearing
195
+ });
196
+ });
197
+ (0, vitest_1.test)('animation end', async () => {
198
+ stateAnimation.setState('A');
199
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
200
+ (0, vitest_1.expect)(heap).toEqual([1]);
201
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
202
+ value: 1,
203
+ state: 'A',
204
+ queuedState: undefined,
205
+ animationState: AnimationState.Visible
206
+ });
207
+ });
208
+ (0, vitest_1.test)('instant', async () => {
209
+ stateAnimation.setState('A', { instant: true });
210
+ (0, vitest_1.expect)(heap).toEqual([1]);
211
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
212
+ value: 1,
213
+ state: 'A',
214
+ queuedState: undefined,
215
+ animationState: AnimationState.Visible
216
+ });
217
+ });
218
+ (0, vitest_1.test)('callbacks', async () => {
219
+ let stateChangeCalledWith = 'unset';
220
+ let valueChangeCalledWith = 'unset';
221
+ stateAnimation
222
+ .onStateChange(state => {
223
+ stateChangeCalledWith = state;
224
+ })
225
+ .onValueChange(value => {
226
+ valueChangeCalledWith = value;
227
+ });
228
+ stateAnimation.setState('A');
229
+ (0, vitest_1.expect)(stateChangeCalledWith).toBe('unset');
230
+ (0, vitest_1.expect)(valueChangeCalledWith).toBe('unset');
231
+ stateChangeCalledWith = 'unset';
232
+ valueChangeCalledWith = 'unset';
233
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
234
+ (0, vitest_1.expect)(stateChangeCalledWith).toBe('unset');
235
+ (0, vitest_1.expect)(valueChangeCalledWith).toBe(0.75);
236
+ stateChangeCalledWith = 'unset';
237
+ valueChangeCalledWith = 'unset';
238
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
239
+ (0, vitest_1.expect)(stateChangeCalledWith).toBe('unset');
240
+ (0, vitest_1.expect)(valueChangeCalledWith).toBe(1);
241
+ });
242
+ });
243
+ (0, vitest_1.describe)('Disappear to change', () => {
244
+ (0, vitest_1.beforeEach)(async () => {
245
+ stateAnimation.setState('A');
246
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
247
+ heap = [];
248
+ });
249
+ (0, vitest_1.test)('initial values', async () => {
250
+ stateAnimation.setState('B');
251
+ (0, vitest_1.expect)(heap).toEqual([]);
252
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
253
+ value: 1,
254
+ state: 'A',
255
+ queuedState: 'B',
256
+ animationState: AnimationState.DisappearToChange
257
+ });
258
+ });
259
+ (0, vitest_1.test)('dissapear animation in the middle', async () => {
260
+ stateAnimation.setState('B');
261
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
262
+ (0, vitest_1.expect)(heap).toEqual([0.75]);
263
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
264
+ value: 0.75,
265
+ state: 'A',
266
+ queuedState: 'B',
267
+ animationState: AnimationState.DisappearToChange
268
+ });
269
+ });
270
+ (0, vitest_1.test)('dissapear animation end', async () => {
271
+ stateAnimation.setState('B');
272
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
273
+ (0, vitest_1.expect)(heap).toEqual(['B', 0]);
274
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
275
+ value: 0,
276
+ state: 'B',
277
+ queuedState: undefined,
278
+ animationState: AnimationState.Appearing
279
+ });
280
+ });
281
+ (0, vitest_1.test)('appear animation in the middle', async () => {
282
+ stateAnimation.setState('B');
283
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
284
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
285
+ (0, vitest_1.expect)(heap).toEqual(['B', 0, 0.25]);
286
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
287
+ value: 0.25,
288
+ state: 'B',
289
+ queuedState: undefined,
290
+ animationState: AnimationState.Appearing
291
+ });
292
+ });
293
+ (0, vitest_1.test)('appear animation end', async () => {
294
+ stateAnimation.setState('B');
295
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
296
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
297
+ (0, vitest_1.expect)(heap).toEqual(['B', 0, 1]);
298
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
299
+ value: 1,
300
+ state: 'B',
301
+ queuedState: undefined,
302
+ animationState: AnimationState.Visible
303
+ });
304
+ });
305
+ (0, vitest_1.test)('returning back to the original state', async () => {
306
+ stateAnimation.setState('B');
307
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
308
+ stateAnimation.setState('A');
309
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
310
+ (0, vitest_1.expect)(heap).toEqual([0.75, 1]);
311
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
312
+ value: 1,
313
+ state: 'A',
314
+ queuedState: undefined,
315
+ animationState: AnimationState.Visible
316
+ });
317
+ });
318
+ (0, vitest_1.test)('edge case, changing the decition back at the moment of re-appearing', async () => {
319
+ stateAnimation.setState('B');
320
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
321
+ stateAnimation.setState('A');
322
+ game_entities_1.UpdateCycle.triggerUpdateTick(1);
323
+ (0, vitest_1.expect)(heap).toEqual(['B', 0, 'A', 0.25]);
324
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
325
+ value: 0.25,
326
+ state: 'A',
327
+ queuedState: undefined,
328
+ animationState: AnimationState.Appearing
329
+ });
330
+ });
331
+ (0, vitest_1.test)('instant', async () => {
332
+ stateAnimation.setState('B', { instant: true });
333
+ (0, vitest_1.expect)(heap).toEqual(['B', 1]);
334
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
335
+ value: 1,
336
+ state: 'B',
337
+ queuedState: undefined,
338
+ animationState: AnimationState.Visible
339
+ });
340
+ });
341
+ });
342
+ (0, vitest_1.describe)('Nullish State', () => {
343
+ (0, vitest_1.test)('initial values', () => {
344
+ stateAnimation.setState('');
345
+ (0, vitest_1.expect)(heap).toEqual(['']);
346
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
347
+ value: 0,
348
+ state: '',
349
+ queuedState: undefined,
350
+ animationState: AnimationState.Appearing
351
+ });
352
+ });
353
+ (0, vitest_1.test)('instant', () => {
354
+ stateAnimation.setState('', { instant: true });
355
+ (0, vitest_1.expect)(heap).toEqual(['', 1]);
356
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
357
+ value: 1,
358
+ state: '',
359
+ queuedState: undefined,
360
+ animationState: AnimationState.Visible
361
+ });
362
+ });
363
+ (0, vitest_1.test)('Cancel appearing', async () => {
364
+ stateAnimation.setState('A');
365
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
366
+ heap = [];
367
+ stateAnimation.setState('');
368
+ (0, vitest_1.expect)(heap).toEqual([]);
369
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
370
+ value: 0.5,
371
+ state: 'A',
372
+ queuedState: '',
373
+ animationState: AnimationState.DisappearToChange
374
+ });
375
+ });
376
+ (0, vitest_1.test)('Cancel disappearing', async () => {
377
+ stateAnimation.setState('A');
378
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
379
+ stateAnimation.setState(undefined);
380
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
381
+ heap = [];
382
+ stateAnimation.setState('');
383
+ (0, vitest_1.expect)(heap).toEqual([]);
384
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
385
+ value: 0.5,
386
+ state: 'A',
387
+ queuedState: '',
388
+ animationState: AnimationState.DisappearToChange
389
+ });
390
+ });
391
+ (0, vitest_1.test)('Disappear to change', () => {
392
+ stateAnimation.setState('A', { instant: true });
393
+ heap = [];
394
+ stateAnimation.setState('');
395
+ (0, vitest_1.expect)(heap).toEqual([]);
396
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
397
+ value: 1,
398
+ state: 'A',
399
+ queuedState: '',
400
+ animationState: AnimationState.DisappearToChange
401
+ });
402
+ });
403
+ (0, vitest_1.test)('Change disappear to change', async () => {
404
+ stateAnimation.setState('A', { instant: true });
405
+ stateAnimation.setState('B');
406
+ game_entities_1.UpdateCycle.triggerUpdateTick(2);
407
+ heap = [];
408
+ stateAnimation.setState('');
409
+ (0, vitest_1.expect)(heap).toEqual([]);
410
+ (0, vitest_1.expect)(stateAnimation.currentState).toEqual({
411
+ value: 0.5,
412
+ state: 'A',
413
+ queuedState: '',
414
+ animationState: AnimationState.DisappearToChange
415
+ });
416
+ });
417
+ });
418
+ (0, vitest_1.describe)('Error Cases:', () => {
419
+ (0, vitest_1.test)('completion on hidden state', async () => {
420
+ let consoleErrorSpy = vitest_1.vi.spyOn(console, 'error').mockImplementation(() => { });
421
+ stateAnimation.setState('A');
422
+ stateAnimation.setState(undefined);
423
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
424
+ (0, vitest_1.expect)(consoleErrorSpy).not.toBeCalled();
425
+ consoleErrorSpy.mockRestore();
426
+ });
427
+ (0, vitest_1.test)('completion on visible state', async () => {
428
+ let consoleErrorSpy = vitest_1.vi.spyOn(console, 'error').mockImplementation(() => { });
429
+ stateAnimation.setState('A');
430
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
431
+ stateAnimation.setState(undefined);
432
+ stateAnimation.setState('A');
433
+ game_entities_1.UpdateCycle.triggerUpdateTick(4);
434
+ (0, vitest_1.expect)(consoleErrorSpy).not.toBeCalled();
435
+ consoleErrorSpy.mockRestore();
436
+ });
437
+ });
438
+ });
439
+ //# sourceMappingURL=fade-in-state-animation.test.js.map
@@ -0,0 +1,41 @@
1
+ import { Vector } from 'helpers-lib';
2
+ import { Container } from '../../../../pixi/display-object/container';
3
+ import { AnimatorAnimation } from '../../animations';
4
+ export declare enum ScrollDirection {
5
+ Horizontal = 1,
6
+ Vertical = 2
7
+ }
8
+ export interface ScrollInContentOptions {
9
+ readonly duration: number;
10
+ readonly animation: AnimatorAnimation;
11
+ readonly size: Vector;
12
+ readonly margin: number;
13
+ readonly direction: ScrollDirection;
14
+ }
15
+ export declare class SlideInContentByIndex extends Container {
16
+ private _createFunction;
17
+ private _options;
18
+ private _directionProperty;
19
+ private _stateAnimation;
20
+ private _contents;
21
+ constructor(_createFunction: (value: {
22
+ index: number;
23
+ container: Container;
24
+ }) => void, partialOptions?: Partial<ScrollInContentOptions>);
25
+ setIndex(index: number, options?: {
26
+ instant?: boolean;
27
+ }): this;
28
+ private _createMask;
29
+ }
30
+ export declare class SlideInContent<T> extends SlideInContentByIndex {
31
+ readonly itemToIndex: Map<T, number>;
32
+ readonly indexToItem: Map<number, T>;
33
+ constructor(items: T[], createFunction: (value: {
34
+ index: number;
35
+ item: T;
36
+ container: Container;
37
+ }) => void, partialOptions?: Partial<ScrollInContentOptions>);
38
+ setItem(item: T, options?: {
39
+ instant?: boolean;
40
+ }): this;
41
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlideInContent = exports.SlideInContentByIndex = exports.ScrollDirection = void 0;
4
+ const helpers_lib_1 = require("helpers-lib");
5
+ const scroll_mask_ui_1 = require("../../../../pixi/components/scroll-mask.ui");
6
+ const container_1 = require("../../../../pixi/display-object/container");
7
+ const animations_1 = require("../../animations");
8
+ const slide_state_animation_1 = require("./slide-state-animation");
9
+ var ScrollDirection;
10
+ (function (ScrollDirection) {
11
+ ScrollDirection[ScrollDirection["Horizontal"] = 1] = "Horizontal";
12
+ ScrollDirection[ScrollDirection["Vertical"] = 2] = "Vertical";
13
+ })(ScrollDirection || (exports.ScrollDirection = ScrollDirection = {}));
14
+ class SlideInContentByIndex extends container_1.Container {
15
+ constructor(_createFunction, partialOptions) {
16
+ super();
17
+ this._createFunction = _createFunction;
18
+ this._directionProperty = 'x';
19
+ this._contents = new Map();
20
+ this._options = {
21
+ duration: 300,
22
+ animation: animations_1.Animations.easeInOutCubic,
23
+ size: new helpers_lib_1.Vector(500, 500),
24
+ margin: 20,
25
+ direction: ScrollDirection.Horizontal,
26
+ ...partialOptions
27
+ };
28
+ let fullSize = this._options.direction === ScrollDirection.Horizontal
29
+ ? new helpers_lib_1.Vector(this._options.size.x + this._options.margin * 2, this._options.size.y)
30
+ : new helpers_lib_1.Vector(this._options.size.x, this._options.size.y + this._options.margin * 2);
31
+ let wrapper = new container_1.Container()
32
+ .setPosition(this._options.direction === ScrollDirection.Horizontal
33
+ ? new helpers_lib_1.Vector(-this._options.margin, 0)
34
+ : new helpers_lib_1.Vector(0, -this._options.margin), { round: false })
35
+ .displayParent(this)
36
+ .attach(this);
37
+ this._createMask(fullSize, this._options.margin, this._options.direction, wrapper);
38
+ this._directionProperty = this._options.direction === ScrollDirection.Horizontal ? 'x' : 'y';
39
+ this._stateAnimation = new slide_state_animation_1.SlideStateAnimation({
40
+ duration: this._options.duration,
41
+ animation: this._options.animation
42
+ })
43
+ .onStateChange((state, index) => {
44
+ if (state === slide_state_animation_1.SlideStateAnimationState.Appear) {
45
+ let container = new container_1.Container().displayParent(this).attach(this);
46
+ this._contents.set(index, container);
47
+ this._createFunction({ index, container });
48
+ }
49
+ else {
50
+ let container = this._contents.get(index);
51
+ if (container) {
52
+ container.destroy();
53
+ this._contents.delete(index);
54
+ }
55
+ }
56
+ })
57
+ .onValueChange((value, index) => {
58
+ let container = this._contents.get(index);
59
+ if (container) {
60
+ let vec = { x: 0, y: 0 };
61
+ vec[this._directionProperty] = fullSize[this._directionProperty] * value + this._options.margin;
62
+ container.setPosition(helpers_lib_1.Vector.fromVec2(vec), { round: false });
63
+ }
64
+ })
65
+ .attach(this);
66
+ this.addChildTo = wrapper;
67
+ }
68
+ setIndex(index, options) {
69
+ this._stateAnimation.setIndex(index, options);
70
+ return this;
71
+ }
72
+ _createMask(size, padding, direction, container) {
73
+ new scroll_mask_ui_1.ScrollMaskUI(container, new helpers_lib_1.Vector(size.x, size.y), padding, direction).attach(this);
74
+ }
75
+ }
76
+ exports.SlideInContentByIndex = SlideInContentByIndex;
77
+ class SlideInContent extends SlideInContentByIndex {
78
+ constructor(items, createFunction, partialOptions) {
79
+ super((value) => {
80
+ let item = this.indexToItem.get(value.index);
81
+ if (item) {
82
+ createFunction({ index: value.index, item, container: value.container });
83
+ }
84
+ else {
85
+ throw new Error(`SlideInContent: The item with index '${value.index}' is not part of the items list`);
86
+ }
87
+ }, partialOptions);
88
+ this.itemToIndex = new Map();
89
+ this.indexToItem = new Map();
90
+ items.forEach((item, index) => {
91
+ this.itemToIndex.set(item, index);
92
+ this.indexToItem.set(index, item);
93
+ });
94
+ }
95
+ setItem(item, options) {
96
+ let index = this.itemToIndex.get(item);
97
+ if (index !== undefined) {
98
+ this.setIndex(index, options);
99
+ }
100
+ else {
101
+ throw new Error(`SlideInContent: The item '${item}' is not part of the items list`);
102
+ }
103
+ return this;
104
+ }
105
+ }
106
+ exports.SlideInContent = SlideInContent;
107
+ //# sourceMappingURL=slide-in-content.js.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const slide_in_content_1 = require("./slide-in-content");
5
+ (0, vitest_1.describe)('Slide In Content', () => {
6
+ (0, vitest_1.test)('should exist', () => {
7
+ (0, vitest_1.expect)(slide_in_content_1.SlideInContent).toBeDefined();
8
+ });
9
+ });
10
+ //# sourceMappingURL=slide-in-content.test.js.map
@@ -0,0 +1,24 @@
1
+ import { Attachable } from 'actions-lib';
2
+ import { StateAnimationOptions } from './state-animation';
3
+ export declare enum SlideStateAnimationState {
4
+ Appear = 1,
5
+ Disappear = 2
6
+ }
7
+ export declare class SlideStateAnimation extends Attachable {
8
+ private _stateAnimation;
9
+ private _options;
10
+ private _index;
11
+ private _nextIndex;
12
+ private _animationState;
13
+ constructor(partialOptions?: Partial<StateAnimationOptions>);
14
+ setIndex(index: number, options?: {
15
+ instant?: boolean;
16
+ }): void;
17
+ private _handleStateChange;
18
+ private _handleValueChange;
19
+ private _handleNewTarget;
20
+ private _onStateChangeAction;
21
+ private _onValueChangeAction;
22
+ onStateChange(callback: (state: SlideStateAnimationState, index: number) => void): this;
23
+ onValueChange(callback: (value: number, index: number) => void): this;
24
+ }