bard-legends-framework 0.9.5 → 0.9.7

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 (239) hide show
  1. package/dist/_interfaces/index.d.ts +2 -2
  2. package/dist/_interfaces/index.js +2 -3
  3. package/dist/game-entities/attachable/attachable.d.ts +6 -6
  4. package/dist/game-entities/attachable/attachable.js +28 -30
  5. package/dist/game-entities/attachable/attachable.spec.js +129 -128
  6. package/dist/game-entities/attachable/attachable.store.d.ts +5 -5
  7. package/dist/game-entities/attachable/attachable.store.js +34 -32
  8. package/dist/game-entities/attachable/attachable.test.js +132 -131
  9. package/dist/game-entities/attachable/destroyable.d.ts +13 -13
  10. package/dist/game-entities/attachable/destroyable.js +64 -69
  11. package/dist/game-entities/attachable/helpers/decorate-actions-lib.d.ts +15 -15
  12. package/dist/game-entities/attachable/helpers/decorate-actions-lib.js +125 -116
  13. package/dist/game-entities/attachable/helpers/referance-variable.d.ts +15 -15
  14. package/dist/game-entities/attachable/helpers/referance-variable.js +47 -48
  15. package/dist/game-entities/attachable/interfaces.d.ts +6 -6
  16. package/dist/game-entities/attachable/interfaces.js +2 -3
  17. package/dist/game-entities/base/helpers/decorate-actions-lib.js +0 -1
  18. package/dist/game-entities/controller/controller.js +0 -1
  19. package/dist/game-entities/controller/controller.spec.js +128 -125
  20. package/dist/game-entities/entity/entity.spec.js +263 -293
  21. package/dist/game-entities/entity/helpers/view-creation.helper.d.ts +7 -7
  22. package/dist/game-entities/entity/helpers/view-creation.helper.js +48 -48
  23. package/dist/game-entities/scene/scene.spec.js +219 -223
  24. package/dist/game-entities/service/service.js +0 -4
  25. package/dist/game-entities/service/service.spec.js +265 -237
  26. package/dist/game-entities/service/service.test.js +4 -2
  27. package/dist/game-entities/update-loop.d.ts +18 -18
  28. package/dist/game-entities/update-loop.js +46 -28
  29. package/dist/game-entities/view/view.js +1 -1
  30. package/dist/game-entities/view/view.spec.js +490 -506
  31. package/dist/game-entities/view/view.test.js +1 -1
  32. package/dist/lib/animator/animations.d.ts +13 -13
  33. package/dist/lib/animator/animations.js +43 -40
  34. package/dist/lib/animator/animator.d.ts +41 -41
  35. package/dist/lib/animator/animator.js +194 -197
  36. package/dist/lib/animator/animator.spec.js +699 -612
  37. package/dist/lib/animator/index.js +24 -19
  38. package/dist/lib/libraries/animator/animations.d.ts +13 -13
  39. package/dist/lib/libraries/animator/animations.js +43 -40
  40. package/dist/lib/libraries/animator/animator.d.ts +41 -41
  41. package/dist/lib/libraries/animator/animator.js +194 -197
  42. package/dist/lib/libraries/animator/animator.spec.js +699 -612
  43. package/dist/lib/libraries/animator/index.js +24 -19
  44. package/dist/lib/libraries/path-finder/path-finder.d.ts +2 -2
  45. package/dist/lib/libraries/path-finder/path-finder.js +19 -20
  46. package/dist/lib/path-finder/path-finder.d.ts +2 -2
  47. package/dist/lib/path-finder/path-finder.js +19 -20
  48. package/dist/lib/services/keyboard/keyboard.d.ts +4 -4
  49. package/dist/lib/services/keyboard/keyboard.js +39 -31
  50. package/dist/lib/services/mouse/mouse.service.d.ts +8 -8
  51. package/dist/lib/services/mouse/mouse.service.js +65 -53
  52. package/dist/lib/services/mouse/mouser-target-focus.service.d.ts +11 -11
  53. package/dist/lib/services/mouse/mouser-target-focus.service.js +83 -81
  54. package/dist/lib/update-loop.d.ts +10 -10
  55. package/dist/lib/update-loop.js +35 -27
  56. package/dist/physics/entitity-types/immovable-physics-entity.d.ts +6 -6
  57. package/dist/physics/entitity-types/immovable-physics-entity.js +23 -24
  58. package/dist/physics/entitity-types/movable-entity.d.ts +6 -6
  59. package/dist/physics/entitity-types/movable-entity.js +21 -22
  60. package/dist/physics/entitity-types/movable-physics-entity.d.ts +14 -14
  61. package/dist/physics/entitity-types/movable-physics-entity.js +83 -88
  62. package/dist/physics/entitity-types/physics-entity.d.ts +23 -23
  63. package/dist/physics/entitity-types/physics-entity.js +97 -88
  64. package/dist/physics/helpers/closest-available-space.helper.d.ts +16 -16
  65. package/dist/physics/helpers/closest-available-space.helper.js +98 -96
  66. package/dist/physics/helpers/closest-available-space.helper.spec.js +115 -68
  67. package/dist/physics/helpers/p2js.helper.d.ts +3 -3
  68. package/dist/physics/helpers/p2js.helper.js +21 -22
  69. package/dist/physics/helpers/shape-factory.d.ts +9 -4
  70. package/dist/physics/helpers/shape-factory.js +99 -75
  71. package/dist/physics/libs/p2js.helper.js +1 -1
  72. package/dist/physics/libs/position-to-grid-position-converter.d.ts +3 -3
  73. package/dist/physics/libs/position-to-grid-position-converter.js +15 -13
  74. package/dist/physics/module//360/237/223/220services/availability-grid.service.d.ts +10 -5
  75. package/dist/physics/module//360/237/223/220services/availability-grid.service.js +77 -57
  76. package/dist/physics/module//360/237/223/220services/border.service.d.ts +2 -2
  77. package/dist/physics/module//360/237/223/220services/border.service.js +57 -37
  78. package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +1 -1
  79. package/dist/physics/module//360/237/223/220services/collisions.service.d.ts +7 -7
  80. package/dist/physics/module//360/237/223/220services/collisions.service.js +110 -98
  81. package/dist/physics/module//360/237/223/220services/debug-visuals.service.d.ts +28 -6
  82. package/dist/physics/module//360/237/223/220services/debug-visuals.service.js +121 -89
  83. package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.d.ts +15 -7
  84. package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.js +117 -93
  85. package/dist/physics/module//360/237/223/220services/explosion.service.d.ts +14 -7
  86. package/dist/physics/module//360/237/223/220services/explosion.service.js +102 -77
  87. package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.d.ts +15 -7
  88. package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js +117 -93
  89. package/dist/physics/module//360/237/223/220services/explosions/explosion.service.d.ts +14 -7
  90. package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js +102 -77
  91. package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.d.ts +3 -3
  92. package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js +71 -67
  93. package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.d.ts +3 -3
  94. package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.js +71 -67
  95. package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +1 -1
  96. package/dist/physics/module//360/237/223/220services/materials.service.d.ts +16 -11
  97. package/dist/physics/module//360/237/223/220services/materials.service.js +118 -108
  98. package/dist/physics/module//360/237/223/220services/path-finder.service.d.ts +19 -8
  99. package/dist/physics/module//360/237/223/220services/path-finder.service.js +121 -82
  100. package/dist/physics/module//360/237/223/220services/physics-world.service.d.ts +30 -15
  101. package/dist/physics/module//360/237/223/220services/physics-world.service.js +122 -100
  102. package/dist/physics/module//360/237/223/220services/ray-casting.service.d.ts +3 -3
  103. package/dist/physics/module//360/237/223/220services/ray-casting.service.js +87 -86
  104. package/dist/physics/module//360/237/223/220services/shape-creation.service.d.ts +9 -4
  105. package/dist/physics/module//360/237/223/220services/shape-creation.service.js +113 -84
  106. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +2 -1
  107. package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.d.ts +8 -8
  108. package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.js +32 -33
  109. package/dist/physics/physics-world.d.ts +50 -34
  110. package/dist/physics/physics-world.js +142 -133
  111. package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.d.ts +3 -3
  112. package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.js +15 -13
  113. package/dist/physics/sub-elements/available-spaces/physics-availability-grid.d.ts +9 -9
  114. package/dist/physics/sub-elements/available-spaces/physics-availability-grid.js +82 -77
  115. package/dist/physics/sub-elements/available-spaces/physics-available-spaces.d.ts +18 -14
  116. package/dist/physics/sub-elements/available-spaces/physics-available-spaces.js +91 -79
  117. package/dist/physics/sub-elements/collisions/contact-equation-orginiser.d.ts +11 -11
  118. package/dist/physics/sub-elements/collisions/contact-equation-orginiser.js +84 -76
  119. package/dist/physics/sub-elements/collisions/physics-collision.d.ts +7 -7
  120. package/dist/physics/sub-elements/collisions/physics-collision.js +43 -44
  121. package/dist/physics/sub-elements/elements/physics-body-groups.d.ts +11 -11
  122. package/dist/physics/sub-elements/elements/physics-body-groups.js +54 -54
  123. package/dist/physics/sub-elements/elements/physics-materials.d.ts +15 -10
  124. package/dist/physics/sub-elements/elements/physics-materials.js +101 -100
  125. package/dist/physics/sub-elements/elements/physics-world-borders.d.ts +3 -3
  126. package/dist/physics/sub-elements/elements/physics-world-borders.js +69 -45
  127. package/dist/physics/sub-elements/physics-body-groups.d.ts +8 -8
  128. package/dist/physics/sub-elements/physics-body-groups.js +41 -42
  129. package/dist/physics/sub-elements/physics-collision.d.ts +16 -16
  130. package/dist/physics/sub-elements/physics-collision.js +141 -121
  131. package/dist/physics/sub-elements/physics-materials.d.ts +15 -10
  132. package/dist/physics/sub-elements/physics-materials.js +101 -100
  133. package/dist/physics/sub-elements/physics-world-borders.d.ts +2 -2
  134. package/dist/physics/sub-elements/physics-world-borders.js +25 -26
  135. package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.d.ts +15 -11
  136. package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.js +59 -59
  137. package/dist/physics/sub-elements/raycasting/physics-explosion.d.ts +13 -6
  138. package/dist/physics/sub-elements/raycasting/physics-explosion.js +108 -73
  139. package/dist/physics/sub-elements/raycasting/ray-cast.d.ts +19 -19
  140. package/dist/physics/sub-elements/raycasting/ray-cast.js +93 -98
  141. package/dist/pixi/display-object/components/filters.d.ts +18 -18
  142. package/dist/pixi/display-object/components/filters.js +106 -81
  143. package/dist/pixi/display-object/components/glow-effect.d.ts +8 -8
  144. package/dist/pixi/display-object/components/glow-effect.js +33 -36
  145. package/dist/pixi/display-object/components/glow-filter.d.ts +8 -8
  146. package/dist/pixi/display-object/components/glow-filter.js +33 -36
  147. package/dist/pixi/display-object/container-attributes.js +1 -1
  148. package/dist/pixi/display-object/display-object-attributes.d.ts +41 -41
  149. package/dist/pixi/display-object/display-object-attributes.js +148 -150
  150. package/dist/pixi/display-object/display-object.d.ts +17 -17
  151. package/dist/pixi/display-object/display-object.js +79 -75
  152. package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.d.ts +9 -4
  153. package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.js +89 -77
  154. package/dist/pixi/display-object/filters/base-filters/blur.filter.js +30 -30
  155. package/dist/pixi/display-object/filters/base-filters/contrast-filter.d.ts +9 -4
  156. package/dist/pixi/display-object/filters/base-filters/contrast-filter.js +62 -53
  157. package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.d.ts +10 -5
  158. package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.js +93 -81
  159. package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.d.ts +12 -7
  160. package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.js +120 -109
  161. package/dist/pixi/display-object/filters/base-filters/expand-with-color.d.ts +10 -5
  162. package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +32 -32
  163. package/dist/pixi/display-object/filters/base-filters/expand-with-color.js +92 -85
  164. package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +28 -28
  165. package/dist/pixi/display-object/filters/templates/plane.template.js +20 -20
  166. package/dist/pixi/display-object/filters.js +20 -4
  167. package/dist/pixi/display-object/objects/components/filters.d.ts +18 -18
  168. package/dist/pixi/display-object/objects/components/filters.js +106 -81
  169. package/dist/pixi/display-object/objects/container.d.ts +2 -2
  170. package/dist/pixi/display-object/objects/container.js +39 -30
  171. package/dist/pixi/display-object/objects/graphics.d.ts +28 -28
  172. package/dist/pixi/display-object/objects/graphics.js +218 -202
  173. package/dist/pixi/display-object/objects/helpers/filters.d.ts +25 -25
  174. package/dist/pixi/display-object/objects/helpers/filters.js +150 -124
  175. package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.d.ts +7 -7
  176. package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.js +114 -95
  177. package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.d.ts +5 -5
  178. package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.js +81 -57
  179. package/dist/pixi/display-object/objects/sprite.d.ts +43 -43
  180. package/dist/pixi/display-object/objects/sprite.js +248 -233
  181. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +1 -1
  182. package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +9 -9
  183. package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +1 -1
  184. package/dist/pixi/display-object/objects/text.d.ts +25 -25
  185. package/dist/pixi/display-object/objects/text.js +111 -102
  186. package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.d.ts +13 -9
  187. package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.js +96 -67
  188. package/dist/pixi/game.d.ts +1 -1
  189. package/dist/pixi/game.js +2 -2
  190. package/dist/pixi/helpers/glow-sprite-generator.d.ts +6 -6
  191. package/dist/pixi/helpers/glow-sprite-generator.js +99 -84
  192. package/dist/pixi/helpers/pixi-container.helper.d.ts +1 -1
  193. package/dist/pixi/helpers/pixi-container.helper.js +10 -8
  194. package/dist/pixi/helpers/screen-position-to-stage.helper.d.ts +1 -1
  195. package/dist/pixi/helpers/screen-position-to-stage.helper.js +12 -12
  196. package/dist/pixi/helpers/screen-position-to-stage.helper.test.js +174 -79
  197. package/dist/pixi/modules/CAMERA/index.d.ts +1 -1
  198. package/dist/pixi/modules/CAMERA/index.js +3 -3
  199. package/dist/services/keyboard/keyboard.d.ts +4 -4
  200. package/dist/services/keyboard/keyboard.js +39 -31
  201. package/dist/services/mouse/mouse.service.d.ts +8 -8
  202. package/dist/services/mouse/mouse.service.js +65 -53
  203. package/dist/services/mouse/mouser-target-focus.service.d.ts +11 -11
  204. package/dist/services/mouse/mouser-target-focus.service.js +83 -81
  205. package/dist/utilities/libraries/animator/animating-content/state-animation.d.ts +29 -26
  206. package/dist/utilities/libraries/animator/animating-content/state-animation.js +159 -165
  207. package/dist/utilities/libraries/animator/animating-content/state-animation.test.js +386 -375
  208. package/dist/utilities/libraries/animator/animator.spec.js +765 -656
  209. package/dist/utilities/libraries/binary-heap/binary-heap.d.ts +11 -11
  210. package/dist/utilities/libraries/binary-heap/binary-heap.js +79 -81
  211. package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.d.ts +11 -11
  212. package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.js +79 -81
  213. package/dist/utilities/libraries/data-structures/grid/grid.d.ts +35 -31
  214. package/dist/utilities/libraries/data-structures/grid/grid.js +128 -117
  215. package/dist/utilities/libraries/data-structures/grid/grid.spec.js +176 -138
  216. package/dist/utilities/libraries/data-structures/grid/grid.test.js +218 -141
  217. package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.d.ts +3 -3
  218. package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.js +15 -13
  219. package/dist/utilities/libraries/data-structures/queue/queue.d.ts +21 -21
  220. package/dist/utilities/libraries/data-structures/queue/queue.js +63 -66
  221. package/dist/utilities/libraries/data-structures/queue/queue.test.js +54 -55
  222. package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js +122 -68
  223. package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js +140 -135
  224. package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js +293 -229
  225. package/dist/utilities/libraries/path-finder/path-finder.d.ts +7 -7
  226. package/dist/utilities/libraries/path-finder/path-finder.js +113 -109
  227. package/dist/utilities/libraries/path-finder/path-finder.spec.js +131 -106
  228. package/dist/utilities/services/keyboard/keyboard.d.ts +4 -4
  229. package/dist/utilities/services/keyboard/keyboard.js +42 -34
  230. package/dist/utilities/services/mouse/helpers/mouse-position.helper.d.ts +1 -1
  231. package/dist/utilities/services/mouse/helpers/mouse-position.helper.js +12 -12
  232. package/dist/utilities/services/mouse/helpers/mouse-position.helper.test.js +168 -73
  233. package/dist/utilities/services/mouse/mouse-target-focus.service.d.ts +15 -15
  234. package/dist/utilities/services/mouse/mouse-target-focus.service.js +79 -76
  235. package/dist/utilities/services/mouse/mouse.service.d.ts +9 -9
  236. package/dist/utilities/services/mouse/mouse.service.js +86 -72
  237. package/dist/utilities/services/mouse/mouser-target-focus.service.d.ts +11 -11
  238. package/dist/utilities/services/mouse/mouser-target-focus.service.js +83 -81
  239. package/package.json +6 -12
@@ -1,139 +1,140 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1
+ var __createBinding =
2
+ (this && this.__createBinding) ||
3
+ (Object.create
4
+ ? (o, m, k, k2) => {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: () => m[k] };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }
12
+ : (o, m, k, k2) => {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ });
16
+ var __setModuleDefault =
17
+ (this && this.__setModuleDefault) ||
18
+ (Object.create
19
+ ? (o, v) => {
20
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
21
+ }
22
+ : (o, v) => {
23
+ o['default'] = v;
24
+ });
25
+ var __decorate =
26
+ (this && this.__decorate) ||
27
+ ((decorators, target, key, desc) => {
28
+ var c = arguments.length,
29
+ r = c < 3 ? target : desc === null ? (desc = Object.getOwnPropertyDescriptor(target, key)) : desc,
30
+ d;
31
+ if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
32
+ r = Reflect.decorate(decorators, target, key, desc);
33
+ else
34
+ for (var i = decorators.length - 1; i >= 0; i--)
35
+ if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
36
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
37
+ });
38
+ var __importStar =
39
+ (this && this.__importStar) ||
40
+ (mod => {
25
41
  if (mod && mod.__esModule) return mod;
26
42
  var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
43
+ if (mod != null) for (var k in mod) if (k !== 'default' && Object.hasOwn(mod, k)) __createBinding(result, mod, k);
28
44
  __setModuleDefault(result, mod);
29
45
  return result;
30
- };
31
- var __metadata = (this && this.__metadata) || function (k, v) {
32
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const vitest_1 = require("vitest");
36
- const actions_lib_1 = require("actions-lib");
37
- const ActionsLib = __importStar(require("actions-lib"));
38
- const entity_1 = require("../entity/entity");
39
- const update_cycle_1 = require("../update-cycle");
40
- const scene_1 = require("../scene/scene");
41
- const decorate_actions_lib_1 = require("./helpers/decorate-actions-lib");
46
+ });
47
+ var __metadata =
48
+ (this && this.__metadata) ||
49
+ ((k, v) => {
50
+ if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function') return Reflect.metadata(k, v);
51
+ });
52
+ Object.defineProperty(exports, '__esModule', { value: true });
53
+ const vitest_1 = require('vitest');
54
+ const actions_lib_1 = require('actions-lib');
55
+ const ActionsLib = __importStar(require('actions-lib'));
56
+ const entity_1 = require('../entity/entity');
57
+ const update_cycle_1 = require('../update-cycle');
58
+ const scene_1 = require('../scene/scene');
59
+ const decorate_actions_lib_1 = require('./helpers/decorate-actions-lib');
42
60
  decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
43
61
  (0, vitest_1.describe)('ATTACHABLE', () => {
44
- (0, vitest_1.beforeEach)(() => {
45
- update_cycle_1.UpdateCycle.hardResetAction.trigger();
46
- let SampleScene = class SampleScene extends scene_1.Scene {
47
- };
48
- SampleScene = __decorate([
49
- (0, scene_1.SceneDecorator)()
50
- ], SampleScene);
51
- SampleScene.open(undefined);
52
- });
53
- (0, vitest_1.test)('dummy', () => {
54
- (0, vitest_1.expect)(true).toBeTruthy();
55
- });
56
- (0, vitest_1.test)('destroyable', async () => {
57
- let Sample = class Sample extends entity_1.Entity {
58
- };
59
- Sample = __decorate([
60
- (0, entity_1.EntityDecorator)()
61
- ], Sample);
62
- class Foo {
63
- constructor() {
64
- this.destroyed = false;
65
- }
66
- destroy() {
67
- this.destroyed = true;
68
- }
69
- }
70
- let sample = new Sample().attach(scene_1.Scene.activeScene);
71
- let foo = new Foo();
72
- sample['setAttachment'](foo);
73
- sample.destroy();
74
- await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
75
- (0, vitest_1.expect)(foo.destroyed).toBeTruthy();
76
- });
77
- (0, vitest_1.test)('destroyable, delayed', async () => {
78
- let Sample = class Sample extends entity_1.Entity {
79
- };
80
- Sample = __decorate([
81
- (0, entity_1.EntityDecorator)()
82
- ], Sample);
83
- class Foo {
84
- constructor() {
85
- this.destroyed = false;
86
- }
87
- destroy() {
88
- this.destroyed = true;
89
- }
90
- }
91
- let sample = new Sample().attach(scene_1.Scene.activeScene);
92
- let foo = new Foo();
93
- sample['setAttachment'](foo);
94
- sample.destroy();
95
- await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
96
- (0, vitest_1.expect)(foo.destroyed).toBeTruthy();
97
- });
98
- (0, vitest_1.test)('subscription', async () => {
99
- let Sample = class Sample extends entity_1.Entity {
100
- };
101
- Sample = __decorate([
102
- (0, entity_1.EntityDecorator)()
103
- ], Sample);
104
- let foo = new actions_lib_1.Variable();
105
- let sample = new Sample().attach(scene_1.Scene.activeScene);
106
- (0, vitest_1.expect)(foo.listenerCount).toEqual(0);
107
- foo.subscribe(() => { }).attach(sample);
108
- (0, vitest_1.expect)(foo.listenerCount).toEqual(1);
109
- sample.destroy();
110
- await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
111
- (0, vitest_1.expect)(foo.listenerCount).toEqual(0);
112
- });
113
- (0, vitest_1.test)('entity attachment in constructor', async () => {
114
- let childDestoyIsCalled = false;
115
- let Parent = class Parent extends entity_1.Entity {
116
- constructor() {
117
- super();
118
- new Child().attach(this);
119
- }
120
- };
121
- Parent = __decorate([
122
- (0, entity_1.EntityDecorator)(),
123
- __metadata("design:paramtypes", [])
124
- ], Parent);
125
- let Child = class Child extends entity_1.Entity {
126
- afterDestroy() {
127
- childDestoyIsCalled = true;
128
- }
129
- };
130
- Child = __decorate([
131
- (0, entity_1.EntityDecorator)()
132
- ], Child);
133
- let parent = new Parent().attach(scene_1.Scene.activeScene);
134
- parent.destroy();
135
- await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
136
- (0, vitest_1.expect)(childDestoyIsCalled).toBeTruthy();
137
- });
62
+ (0, vitest_1.beforeEach)(() => {
63
+ update_cycle_1.UpdateCycle.hardResetAction.trigger();
64
+ let SampleScene = class SampleScene extends scene_1.Scene {};
65
+ SampleScene = __decorate([(0, scene_1.SceneDecorator)()], SampleScene);
66
+ SampleScene.open(undefined);
67
+ });
68
+ (0, vitest_1.test)('dummy', () => {
69
+ (0, vitest_1.expect)(true).toBeTruthy();
70
+ });
71
+ (0, vitest_1.test)('destroyable', async () => {
72
+ let Sample = class Sample extends entity_1.Entity {};
73
+ Sample = __decorate([(0, entity_1.EntityDecorator)()], Sample);
74
+ class Foo {
75
+ constructor() {
76
+ this.destroyed = false;
77
+ }
78
+ destroy() {
79
+ this.destroyed = true;
80
+ }
81
+ }
82
+ const sample = new Sample().attach(scene_1.Scene.activeScene);
83
+ const foo = new Foo();
84
+ sample['setAttachment'](foo);
85
+ sample.destroy();
86
+ await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
87
+ (0, vitest_1.expect)(foo.destroyed).toBeTruthy();
88
+ });
89
+ (0, vitest_1.test)('destroyable, delayed', async () => {
90
+ let Sample = class Sample extends entity_1.Entity {};
91
+ Sample = __decorate([(0, entity_1.EntityDecorator)()], Sample);
92
+ class Foo {
93
+ constructor() {
94
+ this.destroyed = false;
95
+ }
96
+ destroy() {
97
+ this.destroyed = true;
98
+ }
99
+ }
100
+ const sample = new Sample().attach(scene_1.Scene.activeScene);
101
+ const foo = new Foo();
102
+ sample['setAttachment'](foo);
103
+ sample.destroy();
104
+ await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
105
+ (0, vitest_1.expect)(foo.destroyed).toBeTruthy();
106
+ });
107
+ (0, vitest_1.test)('subscription', async () => {
108
+ let Sample = class Sample extends entity_1.Entity {};
109
+ Sample = __decorate([(0, entity_1.EntityDecorator)()], Sample);
110
+ const foo = new actions_lib_1.Variable();
111
+ const sample = new Sample().attach(scene_1.Scene.activeScene);
112
+ (0, vitest_1.expect)(foo.listenerCount).toEqual(0);
113
+ foo.subscribe(() => {}).attach(sample);
114
+ (0, vitest_1.expect)(foo.listenerCount).toEqual(1);
115
+ sample.destroy();
116
+ await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
117
+ (0, vitest_1.expect)(foo.listenerCount).toEqual(0);
118
+ });
119
+ (0, vitest_1.test)('entity attachment in constructor', async () => {
120
+ let childDestoyIsCalled = false;
121
+ let Parent = class Parent extends entity_1.Entity {
122
+ constructor() {
123
+ super();
124
+ new Child().attach(this);
125
+ }
126
+ };
127
+ Parent = __decorate([(0, entity_1.EntityDecorator)(), __metadata('design:paramtypes', [])], Parent);
128
+ let Child = class Child extends entity_1.Entity {
129
+ afterDestroy() {
130
+ childDestoyIsCalled = true;
131
+ }
132
+ };
133
+ Child = __decorate([(0, entity_1.EntityDecorator)()], Child);
134
+ const parent = new Parent().attach(scene_1.Scene.activeScene);
135
+ parent.destroy();
136
+ await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
137
+ (0, vitest_1.expect)(childDestoyIsCalled).toBeTruthy();
138
+ });
138
139
  });
139
- //# sourceMappingURL=attachable.test.js.map
140
+ //# sourceMappingURL=attachable.test.js.map
@@ -1,17 +1,17 @@
1
1
  import { Action } from 'actions-lib';
2
2
  import { CanBeAttached, IAttachable } from './interfaces';
3
3
  export declare abstract class Destroyable {
4
- private attachedParent;
5
- private _attachIsCalled;
6
- get attachIsCalled(): boolean;
7
- private _destroyed;
8
- get destroyed(): boolean;
9
- readonly onDestroy: Action<void>;
10
- constructor();
11
- destroy(): void;
12
- protected afterDestroy(): void;
13
- protected destroySelf(): void;
14
- attach(parent: IAttachable | string): this;
15
- skipAttachCheck(): this;
16
- protected destroyAttachment(object: CanBeAttached): void;
4
+ private attachedParent;
5
+ private _attachIsCalled;
6
+ get attachIsCalled(): boolean;
7
+ private _destroyed;
8
+ get destroyed(): boolean;
9
+ readonly onDestroy: Action<void>;
10
+ constructor();
11
+ destroy(): void;
12
+ protected afterDestroy(): void;
13
+ protected destroySelf(): void;
14
+ attach(parent: IAttachable | string): this;
15
+ skipAttachCheck(): this;
16
+ protected destroyAttachment(object: CanBeAttached): void;
17
17
  }
@@ -1,76 +1,71 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ Object.defineProperty(exports, '__esModule', { value: true });
3
2
  exports.Destroyable = void 0;
4
- const actions_lib_1 = require("actions-lib");
5
- const helpers_lib_1 = require("helpers-lib");
6
- const attachable_store_1 = require("./attachable.store");
3
+ const actions_lib_1 = require('actions-lib');
4
+ const helpers_lib_1 = require('helpers-lib');
5
+ const attachable_store_1 = require('./attachable.store');
7
6
  class Destroyable {
8
- get attachIsCalled() {
9
- return this._attachIsCalled;
7
+ get attachIsCalled() {
8
+ return this._attachIsCalled;
9
+ }
10
+ get destroyed() {
11
+ return this._destroyed;
12
+ }
13
+ constructor() {
14
+ this._attachIsCalled = false;
15
+ this._destroyed = false;
16
+ this.onDestroy = new actions_lib_1.Action();
17
+ setTimeout(() => {
18
+ if (!this._destroyed && !this._attachIsCalled) {
19
+ throw new Error(`Destroyable: The object is not attached to anything!`);
20
+ }
21
+ });
22
+ }
23
+ destroy() {
24
+ if (!this._destroyed) {
25
+ this.destroySelf();
26
+ this.afterDestroy();
27
+ this._destroyed = true;
10
28
  }
11
- get destroyed() {
12
- return this._destroyed;
29
+ }
30
+ afterDestroy() {}
31
+ destroySelf() {
32
+ this.onDestroy.trigger();
33
+ this.attachedParent?.removeAttachment(this);
34
+ this.attachedParent = undefined;
35
+ }
36
+ attach(parent) {
37
+ this._attachIsCalled = true;
38
+ if (!this._destroyed) {
39
+ const parentEntity = attachable_store_1.AttachableStore.findAttachableParent(parent);
40
+ // @ts-expect-error
41
+ if (parentEntity === this) {
42
+ throw new Error(`Entity cannot be attach to itself! entity: "${this.constructor.name}"`);
43
+ }
44
+ this.attachedParent = parentEntity;
45
+ parentEntity.setAttachment(this);
13
46
  }
14
- constructor() {
15
- this._attachIsCalled = false;
16
- this._destroyed = false;
17
- this.onDestroy = new actions_lib_1.Action();
18
- setTimeout(() => {
19
- if (!this._destroyed && !this._attachIsCalled) {
20
- throw new Error(`Destroyable: The object is not attached to anything!`);
21
- }
22
- });
23
- }
24
- destroy() {
25
- if (!this._destroyed) {
26
- this.destroySelf();
27
- this.afterDestroy();
28
- this._destroyed = true;
29
- }
30
- }
31
- afterDestroy() { }
32
- destroySelf() {
33
- this.onDestroy.trigger();
34
- this.attachedParent?.removeAttachment(this);
35
- this.attachedParent = undefined;
36
- }
37
- attach(parent) {
38
- this._attachIsCalled = true;
39
- if (!this._destroyed) {
40
- let parentEntity = attachable_store_1.AttachableStore.findAttachableParent(parent);
41
- // @ts-ignore
42
- if (parentEntity === this) {
43
- throw new Error(`Entity cannot be attach to itself! entity: "${this.constructor.name}"`);
44
- }
45
- this.attachedParent = parentEntity;
46
- parentEntity.setAttachment(this);
47
- }
48
- return this;
49
- }
50
- skipAttachCheck() {
51
- this._attachIsCalled = true;
52
- return this;
53
- }
54
- destroyAttachment(object) {
55
- if (object instanceof actions_lib_1.Variable) {
56
- this.destroyAttachment(object.value);
57
- }
58
- else if (object instanceof Array) {
59
- object.forEach((item) => this.destroyAttachment(item));
60
- }
61
- else if (helpers_lib_1.Comparator.isObject(object)) {
62
- let item = object;
63
- if (helpers_lib_1.Comparator.isFunction(item.destroy)) {
64
- item.destroy();
65
- }
66
- else if (helpers_lib_1.Comparator.isFunction(item.unsubscribe)) {
67
- item.unsubscribe();
68
- }
69
- }
70
- else {
71
- throw new Error(`Destroyable: destroyAttachment is used with not supperted type! Target: "${object}"`);
72
- }
47
+ return this;
48
+ }
49
+ skipAttachCheck() {
50
+ this._attachIsCalled = true;
51
+ return this;
52
+ }
53
+ destroyAttachment(object) {
54
+ if (object instanceof actions_lib_1.Variable) {
55
+ this.destroyAttachment(object.value);
56
+ } else if (object instanceof Array) {
57
+ object.forEach(item => this.destroyAttachment(item));
58
+ } else if (helpers_lib_1.Comparator.isObject(object)) {
59
+ const item = object;
60
+ if (helpers_lib_1.Comparator.isFunction(item.destroy)) {
61
+ item.destroy();
62
+ } else if (helpers_lib_1.Comparator.isFunction(item.unsubscribe)) {
63
+ item.unsubscribe();
64
+ }
65
+ } else {
66
+ throw new Error(`Destroyable: destroyAttachment is used with not supperted type! Target: "${object}"`);
73
67
  }
68
+ }
74
69
  }
75
70
  exports.Destroyable = Destroyable;
76
- //# sourceMappingURL=destroyable.js.map
71
+ //# sourceMappingURL=destroyable.js.map
@@ -1,20 +1,20 @@
1
1
  import { Attachable } from '../attachable';
2
2
  declare module 'actions-lib' {
3
- interface ActionSubscription {
4
- attach(parent: Attachable | string): ActionSubscription;
5
- skipAttachCheck(): ActionSubscription;
6
- decorateActionSubscription(): ActionSubscription;
7
- }
8
- interface ReducerEffectChannel<EffectType, ResponseType> {
9
- attach(parent: Attachable | string): ReducerEffectChannel<EffectType, ResponseType>;
10
- skipAttachCheck(): ReducerEffectChannel<EffectType, ResponseType>;
11
- decorateEffectChannel(): ReducerEffectChannel<EffectType, ResponseType>;
12
- }
3
+ interface ActionSubscription {
4
+ attach(parent: Attachable | string): ActionSubscription;
5
+ skipAttachCheck(): ActionSubscription;
6
+ decorateActionSubscription(): ActionSubscription;
7
+ }
8
+ interface ReducerEffectChannel<EffectType, ResponseType> {
9
+ attach(parent: Attachable | string): ReducerEffectChannel<EffectType, ResponseType>;
10
+ skipAttachCheck(): ReducerEffectChannel<EffectType, ResponseType>;
11
+ decorateEffectChannel(): ReducerEffectChannel<EffectType, ResponseType>;
12
+ }
13
13
  }
14
14
  export declare class ActionsLibDecorator {
15
- static decorate(actionsLib: any): void;
16
- private static decorateAttachFunctions;
17
- private static decorateUnsubscriptions;
18
- private static decorateSubscriptions;
19
- private static decorateEffectChannels;
15
+ static decorate(actionsLib: any): void;
16
+ private static decorateAttachFunctions;
17
+ private static decorateUnsubscriptions;
18
+ private static decorateSubscriptions;
19
+ private static decorateEffectChannels;
20
20
  }