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.
- package/dist/actions-performance.test.d.ts +1 -0
- package/dist/actions-performance.test.js +83 -0
- package/dist/game-entities/controller/controller.d.ts +2 -3
- package/dist/game-entities/controller/controller.js +9 -8
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +11 -9
- package/dist/game-entities/entity/entity.js +20 -16
- package/dist/game-entities/entity/entity.test.js +116 -147
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +6 -9
- package/dist/game-entities/entity/helpers/entity-store.helper.js +22 -57
- package/dist/game-entities/entity/helpers/entity-store.helper.test.d.ts +1 -0
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +136 -0
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +7 -7
- package/dist/game-entities/entity/helpers/entity-views.helper.js +28 -23
- package/dist/game-entities/entity/singleton-entity.d.ts +3 -3
- package/dist/game-entities/entity/singleton-entity.js +1 -1
- package/dist/game-entities/entity/singleton-entity.test.js +9 -31
- package/dist/game-entities/hard-reset.d.ts +5 -0
- package/dist/game-entities/hard-reset.js +14 -0
- package/dist/game-entities/index.d.ts +1 -3
- package/dist/game-entities/index.js +3 -7
- package/dist/game-entities/scene/scene.d.ts +15 -15
- package/dist/game-entities/scene/scene.js +61 -60
- package/dist/game-entities/scene/scene.test.js +97 -67
- package/dist/game-entities/service/service.d.ts +1 -4
- package/dist/game-entities/service/service.js +15 -14
- package/dist/game-entities/service/service.test.js +33 -38
- package/dist/game-entities/unit-test.helper.d.ts +5 -0
- package/dist/game-entities/unit-test.helper.js +14 -0
- package/dist/game-entities/update-cycle.d.ts +10 -9
- package/dist/game-entities/update-cycle.js +34 -23
- package/dist/game-entities/view/view.d.ts +10 -11
- package/dist/game-entities/view/view.js +17 -35
- package/dist/game-entities/view/view.test.js +73 -250
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +2 -4
- package/dist/physics/entity-types/immovable-physics-entity.js +4 -6
- package/dist/physics/entity-types/movable-entity.d.ts +1 -1
- package/dist/physics/entity-types/movable-entity.js +6 -6
- package/dist/physics/entity-types/movable-physics-entity.d.ts +10 -11
- package/dist/physics/entity-types/movable-physics-entity.js +31 -32
- package/dist/physics/entity-types/physics-entity.d.ts +12 -15
- package/dist/physics/entity-types/physics-entity.js +30 -28
- package/dist/physics/interfaces.d.ts +6 -6
- package/dist/physics/interfaces.js +4 -4
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +20 -20
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +11 -11
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
- package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +28 -27
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +60 -49
- package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
- package/dist/physics/module//360/237/247/212entities/physics-world.entity.js +2 -2
- package/dist/pixi/components/display-object-array.d.ts +5 -5
- package/dist/pixi/components/display-object-array.js +14 -14
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
- package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
- package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
- package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
- package/dist/pixi/components/menu/menu-entity.js +48 -0
- package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
- package/dist/pixi/components/menu/menu.ui.js +97 -0
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +4 -3
- package/dist/pixi/components/mouse-wheel-listener.ui.js +15 -14
- package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
- package/dist/pixi/components/scroll-area.ui.js +9 -9
- package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
- package/dist/pixi/components/scroll-mask.ui.js +25 -24
- package/dist/pixi/display-object/container-attributes.d.ts +24 -26
- package/dist/pixi/display-object/container-attributes.js +27 -28
- package/dist/pixi/display-object/container.d.ts +3 -6
- package/dist/pixi/display-object/container.js +2 -12
- package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
- package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
- package/dist/pixi/display-object/filters.d.ts +7 -7
- package/dist/pixi/display-object/filters.js +34 -34
- package/dist/pixi/display-object/index.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
- package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +7 -7
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +29 -26
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
- package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
- package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
- package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
- package/dist/pixi/display-object/objects/text/text.js +34 -35
- package/dist/pixi/game.d.ts +26 -17
- package/dist/pixi/game.js +53 -39
- package/dist/pixi/helpers/game-assets.d.ts +5 -5
- package/dist/pixi/helpers/game-assets.js +14 -11
- package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
- package/dist/pixi/helpers/position-conversion.helper.js +3 -3
- package/dist/pixi/index.d.ts +3 -37
- package/dist/pixi/index.js +6 -22
- package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
- package/dist/pixi/modules/CAMERA/camera.js +9 -9
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
- package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js +4 -4
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +50 -49
- package/dist/pixi/pixi-definitions.d.ts +38 -0
- package/dist/pixi/pixi-definitions.js +37 -0
- package/dist/pixi/services/keyboard/keyboard.d.ts +6 -4
- package/dist/pixi/services/keyboard/keyboard.js +15 -13
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +12 -11
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +31 -30
- package/dist/pixi/services/mouse/mouse.service.d.ts +16 -6
- package/dist/pixi/services/mouse/mouse.service.js +42 -22
- package/dist/utilities/animator/animating-content/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/animating-content/fade-in-content.js +37 -0
- package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/animating-content/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/animating-content/slide-in-content.js +99 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/animations.d.ts +45 -0
- package/dist/utilities/animator/animations.js +92 -0
- package/dist/utilities/animator/animator/animator.d.ts +44 -0
- package/dist/utilities/animator/animator/animator.js +234 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
- package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.test.js +1046 -0
- package/dist/utilities/animator/animator.d.ts +60 -0
- package/dist/utilities/animator/animator.js +322 -0
- package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator.performance.test.js +46 -0
- package/dist/utilities/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator.test.js +928 -0
- package/dist/utilities/animator/animator2/animator.d.ts +42 -0
- package/dist/utilities/animator/animator2/animator.js +222 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
- package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.test.js +1007 -0
- package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
- package/dist/utilities/animator/animator_old/animator.js +337 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
- package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.test.js +996 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
- package/dist/utilities/animator/index.d.ts +7 -0
- package/dist/utilities/animator/index.js +24 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/state-animation.d.ts +33 -0
- package/dist/utilities/animator/state-animation/state-animation.js +146 -0
- package/dist/utilities/animator/state-animation/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/state-animation.test.js +335 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +431 -0
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +7 -0
- package/dist/utilities/data-structures/vector-set/vector-set.js +26 -0
- package/dist/utilities/delta-time/delta-time.d.ts +3 -0
- package/dist/utilities/delta-time/delta-time.js +10 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +6 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +55 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.js +100 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.d.ts +8 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +98 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +155 -0
- package/dist/utilities/grid-algorithms/position-to-grid-position-converter.d.ts +6 -0
- package/dist/utilities/grid-algorithms/position-to-grid-position-converter.js +17 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +18 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +129 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +254 -0
- package/dist/utilities/index.d.ts +6 -6
- package/dist/utilities/index.js +6 -6
- package/package.json +8 -6
|
@@ -0,0 +1,335 @@
|
|
|
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 state_animation_1 = require("./state-animation");
|
|
6
|
+
(0, vitest_1.describe)('StateAnimation', () => {
|
|
7
|
+
let stateAnimation;
|
|
8
|
+
let heap = [];
|
|
9
|
+
(0, vitest_1.beforeEach)(async () => {
|
|
10
|
+
if (stateAnimation) {
|
|
11
|
+
stateAnimation.destroy();
|
|
12
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
13
|
+
}
|
|
14
|
+
heap = [];
|
|
15
|
+
stateAnimation = new state_animation_1.StateAnimation({ duration: 4 })
|
|
16
|
+
.onStateChange((state, nextState) => heap.push({ state, nextState }))
|
|
17
|
+
.onValueChange(value => heap.push(value))
|
|
18
|
+
.attachToRoot();
|
|
19
|
+
});
|
|
20
|
+
(0, vitest_1.describe)('Creation', () => {
|
|
21
|
+
(0, vitest_1.test)('default values', () => {
|
|
22
|
+
(0, vitest_1.expect)(heap).toEqual([]);
|
|
23
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
24
|
+
value: 0,
|
|
25
|
+
state: undefined,
|
|
26
|
+
nextState: undefined,
|
|
27
|
+
queuedState: undefined,
|
|
28
|
+
animationState: 'idle'
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.test)('initial values', () => {
|
|
32
|
+
stateAnimation.setState('A');
|
|
33
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: undefined }, 0]);
|
|
34
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
35
|
+
value: 0,
|
|
36
|
+
state: 'A',
|
|
37
|
+
nextState: undefined,
|
|
38
|
+
queuedState: undefined,
|
|
39
|
+
animationState: 'idle'
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
(0, vitest_1.test)('initial value as nullish', () => {
|
|
43
|
+
stateAnimation.setState('');
|
|
44
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: '', nextState: undefined }, 0]);
|
|
45
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
46
|
+
value: 0,
|
|
47
|
+
state: '',
|
|
48
|
+
nextState: undefined,
|
|
49
|
+
queuedState: undefined,
|
|
50
|
+
animationState: 'idle'
|
|
51
|
+
});
|
|
52
|
+
heap = [];
|
|
53
|
+
stateAnimation.setState('B');
|
|
54
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: '', nextState: 'B' }, 0]);
|
|
55
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
56
|
+
value: 0,
|
|
57
|
+
state: '',
|
|
58
|
+
nextState: 'B',
|
|
59
|
+
queuedState: undefined,
|
|
60
|
+
animationState: 'transitioning'
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.describe)('Transitioning', () => {
|
|
65
|
+
(0, vitest_1.beforeEach)(() => {
|
|
66
|
+
stateAnimation.setState('A');
|
|
67
|
+
heap = [];
|
|
68
|
+
});
|
|
69
|
+
(0, vitest_1.test)('initial values', () => {
|
|
70
|
+
stateAnimation.setState('B');
|
|
71
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'B' }, 0]);
|
|
72
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
73
|
+
value: 0,
|
|
74
|
+
state: 'A',
|
|
75
|
+
nextState: 'B',
|
|
76
|
+
queuedState: undefined,
|
|
77
|
+
animationState: 'transitioning'
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
(0, vitest_1.test)('animation in the middle', async () => {
|
|
81
|
+
stateAnimation.setState('B');
|
|
82
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
83
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'B' }, 0, 0.25]);
|
|
84
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
85
|
+
value: 0.25,
|
|
86
|
+
state: 'A',
|
|
87
|
+
nextState: 'B',
|
|
88
|
+
queuedState: undefined,
|
|
89
|
+
animationState: 'transitioning'
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
(0, vitest_1.test)('animation end', async () => {
|
|
93
|
+
stateAnimation.setState('B');
|
|
94
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
95
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'B' }, 0, { state: 'B', nextState: undefined }, 0]);
|
|
96
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
97
|
+
value: 0,
|
|
98
|
+
state: 'B',
|
|
99
|
+
nextState: undefined,
|
|
100
|
+
queuedState: undefined,
|
|
101
|
+
animationState: 'idle'
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
(0, vitest_1.test)('instant from beggining', async () => {
|
|
105
|
+
stateAnimation.setState('B', { instant: true });
|
|
106
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: undefined }, 0]);
|
|
107
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
108
|
+
value: 0,
|
|
109
|
+
state: 'B',
|
|
110
|
+
nextState: undefined,
|
|
111
|
+
queuedState: undefined,
|
|
112
|
+
animationState: 'idle'
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
(0, vitest_1.test)('instant from middle', async () => {
|
|
116
|
+
stateAnimation.setState('B');
|
|
117
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
118
|
+
heap = [];
|
|
119
|
+
stateAnimation.setState('B', { instant: true });
|
|
120
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: undefined }, 0]);
|
|
121
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
122
|
+
value: 0,
|
|
123
|
+
state: 'B',
|
|
124
|
+
nextState: undefined,
|
|
125
|
+
queuedState: undefined,
|
|
126
|
+
animationState: 'idle'
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
(0, vitest_1.describe)('Queued State', () => {
|
|
131
|
+
(0, vitest_1.beforeEach)(async () => {
|
|
132
|
+
stateAnimation.setState('A');
|
|
133
|
+
stateAnimation.setState('B');
|
|
134
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
135
|
+
heap = [];
|
|
136
|
+
});
|
|
137
|
+
(0, vitest_1.test)('initial values', () => {
|
|
138
|
+
stateAnimation.setState('C');
|
|
139
|
+
(0, vitest_1.expect)(heap).toEqual([]);
|
|
140
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
141
|
+
value: 0.5,
|
|
142
|
+
state: 'A',
|
|
143
|
+
nextState: 'B',
|
|
144
|
+
queuedState: 'C',
|
|
145
|
+
animationState: 'transitioning'
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
(0, vitest_1.test)('animation in the middle', async () => {
|
|
149
|
+
stateAnimation.setState('C');
|
|
150
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
151
|
+
(0, vitest_1.expect)(heap).toEqual([0.75]);
|
|
152
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
153
|
+
value: 0.75,
|
|
154
|
+
state: 'A',
|
|
155
|
+
nextState: 'B',
|
|
156
|
+
queuedState: 'C',
|
|
157
|
+
animationState: 'transitioning'
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
(0, vitest_1.test)('transition start', async () => {
|
|
161
|
+
stateAnimation.setState('C');
|
|
162
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
163
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: 'C' }, 0]);
|
|
164
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
165
|
+
value: 0,
|
|
166
|
+
state: 'B',
|
|
167
|
+
nextState: 'C',
|
|
168
|
+
queuedState: undefined,
|
|
169
|
+
animationState: 'transitioning'
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
(0, vitest_1.test)('transition middle', async () => {
|
|
173
|
+
stateAnimation.setState('C');
|
|
174
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
175
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
176
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: 'C' }, 0, 0.5]);
|
|
177
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
178
|
+
value: 0.5,
|
|
179
|
+
state: 'B',
|
|
180
|
+
nextState: 'C',
|
|
181
|
+
queuedState: undefined,
|
|
182
|
+
animationState: 'transitioning'
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
(0, vitest_1.test)('transition end', async () => {
|
|
186
|
+
stateAnimation.setState('C');
|
|
187
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
188
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
189
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: 'C' }, 0, { state: 'C', nextState: undefined }, 0]);
|
|
190
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
191
|
+
value: 0,
|
|
192
|
+
state: 'C',
|
|
193
|
+
nextState: undefined,
|
|
194
|
+
queuedState: undefined,
|
|
195
|
+
animationState: 'idle'
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
(0, vitest_1.test)('queued value during reverting', async () => {
|
|
199
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
200
|
+
stateAnimation.setState('A');
|
|
201
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
202
|
+
stateAnimation.setState('C');
|
|
203
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
204
|
+
(0, vitest_1.expect)(heap).toEqual([0.75, 0.5, 0.25]);
|
|
205
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
206
|
+
value: 0.25,
|
|
207
|
+
state: 'A',
|
|
208
|
+
nextState: 'B',
|
|
209
|
+
queuedState: 'C',
|
|
210
|
+
animationState: 'reverting'
|
|
211
|
+
});
|
|
212
|
+
heap = [];
|
|
213
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
214
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'C' }, 0]);
|
|
215
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
216
|
+
value: 0,
|
|
217
|
+
state: 'A',
|
|
218
|
+
nextState: 'C',
|
|
219
|
+
queuedState: undefined,
|
|
220
|
+
animationState: 'transitioning'
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
(0, vitest_1.test)('instant', async () => {
|
|
224
|
+
stateAnimation.setState('C', { instant: true });
|
|
225
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'C', nextState: undefined }, 0]);
|
|
226
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
227
|
+
value: 0,
|
|
228
|
+
state: 'C',
|
|
229
|
+
nextState: undefined,
|
|
230
|
+
queuedState: undefined,
|
|
231
|
+
animationState: 'idle'
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
(0, vitest_1.test)('edge case, setting zero', async () => {
|
|
235
|
+
let stateAnimationNumber = new state_animation_1.StateAnimation({ duration: 4 }).attachToRoot();
|
|
236
|
+
stateAnimationNumber.setState(2, { instant: true });
|
|
237
|
+
stateAnimationNumber.setState(1);
|
|
238
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
239
|
+
stateAnimationNumber.setState(0);
|
|
240
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
241
|
+
(0, vitest_1.expect)(stateAnimationNumber.currentState).toEqual({
|
|
242
|
+
value: 0,
|
|
243
|
+
state: 1,
|
|
244
|
+
nextState: 0,
|
|
245
|
+
queuedState: undefined,
|
|
246
|
+
animationState: 'transitioning'
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
(0, vitest_1.describe)('Reverting', () => {
|
|
251
|
+
(0, vitest_1.beforeEach)(async () => {
|
|
252
|
+
stateAnimation.setState('A');
|
|
253
|
+
stateAnimation.setState('B');
|
|
254
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(3);
|
|
255
|
+
heap = [];
|
|
256
|
+
});
|
|
257
|
+
(0, vitest_1.test)('initial values', () => {
|
|
258
|
+
stateAnimation.setState('A');
|
|
259
|
+
(0, vitest_1.expect)(heap).toEqual([]);
|
|
260
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
261
|
+
value: 0.75,
|
|
262
|
+
state: 'A',
|
|
263
|
+
nextState: 'B',
|
|
264
|
+
queuedState: undefined,
|
|
265
|
+
animationState: 'reverting'
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
(0, vitest_1.test)('animation in the middle', async () => {
|
|
269
|
+
stateAnimation.setState('A');
|
|
270
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
271
|
+
(0, vitest_1.expect)(heap).toEqual([0.5]);
|
|
272
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
273
|
+
value: 0.5,
|
|
274
|
+
state: 'A',
|
|
275
|
+
nextState: 'B',
|
|
276
|
+
queuedState: undefined,
|
|
277
|
+
animationState: 'reverting'
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
(0, vitest_1.test)('animation end', async () => {
|
|
281
|
+
stateAnimation.setState('A');
|
|
282
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(3);
|
|
283
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: undefined }, 0]);
|
|
284
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
285
|
+
value: 0,
|
|
286
|
+
state: 'A',
|
|
287
|
+
nextState: undefined,
|
|
288
|
+
queuedState: undefined,
|
|
289
|
+
animationState: 'idle'
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
(0, vitest_1.test)('re-reverting', async () => {
|
|
293
|
+
stateAnimation.setState('A');
|
|
294
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
295
|
+
stateAnimation.setState('B');
|
|
296
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
297
|
+
(0, vitest_1.expect)(heap).toEqual([0.5, 0.75]);
|
|
298
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
299
|
+
value: 0.75,
|
|
300
|
+
state: 'A',
|
|
301
|
+
nextState: 'B',
|
|
302
|
+
queuedState: undefined,
|
|
303
|
+
animationState: 'transitioning'
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
(0, vitest_1.test)('instant', async () => {
|
|
307
|
+
stateAnimation.setState('A', { instant: true });
|
|
308
|
+
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: undefined }, 0]);
|
|
309
|
+
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
310
|
+
value: 0,
|
|
311
|
+
state: 'A',
|
|
312
|
+
nextState: undefined,
|
|
313
|
+
queuedState: undefined,
|
|
314
|
+
animationState: 'idle'
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
(0, vitest_1.test)('edge case, setting zero', async () => {
|
|
318
|
+
let stateAnimationNumber = new state_animation_1.StateAnimation({ duration: 4 }).attachToRoot();
|
|
319
|
+
stateAnimationNumber.setState(2, { instant: true });
|
|
320
|
+
stateAnimationNumber.setState(1);
|
|
321
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
322
|
+
stateAnimationNumber.setState(2);
|
|
323
|
+
stateAnimationNumber.setState(0);
|
|
324
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
325
|
+
(0, vitest_1.expect)(stateAnimationNumber.currentState).toEqual({
|
|
326
|
+
value: 0,
|
|
327
|
+
state: 2,
|
|
328
|
+
nextState: 0,
|
|
329
|
+
queuedState: undefined,
|
|
330
|
+
animationState: 'transitioning'
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
//# sourceMappingURL=state-animation.test.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Attachable } from 'actions-lib';
|
|
2
|
+
import { StateAnimationOptions } from './state-animation';
|
|
3
|
+
type AnimationState = 'hidden' | 'visible' | 'appearing' | 'disappearing' | 'disappearToChange';
|
|
4
|
+
export declare class VisitDisappearStateAnimation<T> extends Attachable {
|
|
5
|
+
private animator;
|
|
6
|
+
private options;
|
|
7
|
+
private value;
|
|
8
|
+
private state;
|
|
9
|
+
private queuedState;
|
|
10
|
+
private animationState;
|
|
11
|
+
get currentState(): {
|
|
12
|
+
value: number;
|
|
13
|
+
state: T | undefined;
|
|
14
|
+
queuedState: T | undefined;
|
|
15
|
+
animationState: AnimationState;
|
|
16
|
+
};
|
|
17
|
+
constructor(partialOptions?: Partial<StateAnimationOptions>);
|
|
18
|
+
/**
|
|
19
|
+
* @param state - The new state to set. Keep in mind falsy values are also considered as a new state. To set the state to "disappear" use undefined.
|
|
20
|
+
* @param options - Optional options.
|
|
21
|
+
* @param options.instant - If true, the state will be set immediately.
|
|
22
|
+
*/
|
|
23
|
+
setState(state: T | undefined, options?: {
|
|
24
|
+
instant?: boolean;
|
|
25
|
+
}): void;
|
|
26
|
+
private onComplete;
|
|
27
|
+
private onStateChangeAction;
|
|
28
|
+
private onValueChangeAction;
|
|
29
|
+
onStateChange(callback: (state: T | undefined) => void): this;
|
|
30
|
+
onValueChange(callback: (value: number) => void): this;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisitDisappearStateAnimation = void 0;
|
|
4
|
+
const actions_lib_1 = require("actions-lib");
|
|
5
|
+
const animations_1 = require("../animations");
|
|
6
|
+
const animator_1 = require("../animator");
|
|
7
|
+
class VisitDisappearStateAnimation extends actions_lib_1.Attachable {
|
|
8
|
+
get currentState() {
|
|
9
|
+
return {
|
|
10
|
+
value: this.value,
|
|
11
|
+
state: this.state,
|
|
12
|
+
queuedState: this.queuedState,
|
|
13
|
+
animationState: this.animationState
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
constructor(partialOptions) {
|
|
17
|
+
super();
|
|
18
|
+
this.animationState = 'hidden';
|
|
19
|
+
this.onStateChangeAction = new actions_lib_1.Action();
|
|
20
|
+
this.onValueChangeAction = new actions_lib_1.Action();
|
|
21
|
+
this.options = { duration: 500, animation: new animations_1.AnimationLineer(), ...partialOptions };
|
|
22
|
+
this.value = 0;
|
|
23
|
+
this.animator = new animator_1.Animator(this, 'value', {
|
|
24
|
+
duration: this.options.duration,
|
|
25
|
+
animation: this.options.animation,
|
|
26
|
+
reAnimateHandling: animator_1.ReAnimateHandlingType.completePrevious,
|
|
27
|
+
completeAnimationsHandling: animator_1.CompleteAnimationsHandlingType.stayInCurrentState
|
|
28
|
+
})
|
|
29
|
+
.onComplete((key, value) => this.onComplete(value))
|
|
30
|
+
.onChange(() => this.onValueChangeAction.trigger(this.value))
|
|
31
|
+
.attach(this);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param state - The new state to set. Keep in mind falsy values are also considered as a new state. To set the state to "disappear" use undefined.
|
|
35
|
+
* @param options - Optional options.
|
|
36
|
+
* @param options.instant - If true, the state will be set immediately.
|
|
37
|
+
*/
|
|
38
|
+
setState(state, options) {
|
|
39
|
+
if (options?.instant) {
|
|
40
|
+
this.animator.completeAnimations();
|
|
41
|
+
this.animationState = state !== undefined ? 'visible' : 'hidden';
|
|
42
|
+
this.queuedState = undefined;
|
|
43
|
+
let value = state !== undefined ? 1 : 0;
|
|
44
|
+
let differentState = this.state !== state;
|
|
45
|
+
if (differentState) {
|
|
46
|
+
this.state = state;
|
|
47
|
+
this.onStateChangeAction.trigger(this.state);
|
|
48
|
+
}
|
|
49
|
+
if (differentState || this.value !== value) {
|
|
50
|
+
this.value = value;
|
|
51
|
+
this.onValueChangeAction.trigger(this.value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
switch (this.animationState) {
|
|
56
|
+
case 'hidden':
|
|
57
|
+
if (state !== undefined) {
|
|
58
|
+
this.animationState = 'appearing';
|
|
59
|
+
this.queuedState = undefined;
|
|
60
|
+
this.state = state;
|
|
61
|
+
this.onStateChangeAction.trigger(this.state);
|
|
62
|
+
this.animator.animate({ value: 1 });
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 'visible':
|
|
66
|
+
if (state === undefined) {
|
|
67
|
+
this.animationState = 'disappearing';
|
|
68
|
+
this.queuedState = undefined;
|
|
69
|
+
this.animator.animate({ value: 0 });
|
|
70
|
+
}
|
|
71
|
+
else if (state !== this.state) {
|
|
72
|
+
this.animationState = 'disappearToChange';
|
|
73
|
+
this.queuedState = state;
|
|
74
|
+
this.animator.animate({ value: 0 });
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case 'appearing':
|
|
78
|
+
if (state === undefined) {
|
|
79
|
+
this.animationState = 'disappearing';
|
|
80
|
+
this.queuedState = undefined;
|
|
81
|
+
this.animator.animate({ value: 0 }, { duration: this.value * this.options.duration });
|
|
82
|
+
}
|
|
83
|
+
else if (state !== this.state) {
|
|
84
|
+
if (this.value > 0) {
|
|
85
|
+
this.animationState = 'disappearToChange';
|
|
86
|
+
this.queuedState = state;
|
|
87
|
+
this.animator.animate({ value: 0 }, { duration: this.value * this.options.duration });
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.queuedState = undefined;
|
|
91
|
+
this.state = state;
|
|
92
|
+
this.onStateChangeAction.trigger(this.state);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case 'disappearing':
|
|
97
|
+
if (state === this.state) {
|
|
98
|
+
this.animationState = 'appearing';
|
|
99
|
+
this.animator.animate({ value: 1 }, { duration: (1 - this.value) * this.options.duration });
|
|
100
|
+
}
|
|
101
|
+
else if (state !== undefined) {
|
|
102
|
+
this.animationState = 'disappearToChange';
|
|
103
|
+
this.queuedState = state;
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case 'disappearToChange':
|
|
107
|
+
if (state === undefined) {
|
|
108
|
+
this.animationState = 'disappearing';
|
|
109
|
+
this.queuedState = undefined;
|
|
110
|
+
}
|
|
111
|
+
else if (state === this.state) {
|
|
112
|
+
this.animationState = 'appearing';
|
|
113
|
+
this.queuedState = undefined;
|
|
114
|
+
this.animator.animate({ value: 1 }, { duration: (1 - this.value) * this.options.duration });
|
|
115
|
+
}
|
|
116
|
+
else if (state !== this.queuedState) {
|
|
117
|
+
this.queuedState = state;
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
onComplete(value) {
|
|
124
|
+
switch (this.animationState) {
|
|
125
|
+
case 'appearing':
|
|
126
|
+
if (value === 1) {
|
|
127
|
+
this.animationState = 'visible';
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case 'disappearing':
|
|
131
|
+
if (this.queuedState !== undefined) {
|
|
132
|
+
throw new Error('VisitDisappearStateAnimation: Unexpected state, disappearing should not have a queued value');
|
|
133
|
+
}
|
|
134
|
+
if (value === 0) {
|
|
135
|
+
this.animationState = 'hidden';
|
|
136
|
+
this.state = undefined;
|
|
137
|
+
this.onStateChangeAction.trigger(this.state);
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
case 'disappearToChange':
|
|
141
|
+
if (this.queuedState === undefined) {
|
|
142
|
+
throw new Error('VisitDisappearStateAnimation: Unexpected state, disappearToChange should always have a queued value');
|
|
143
|
+
}
|
|
144
|
+
if (value === 0) {
|
|
145
|
+
this.animationState = 'appearing';
|
|
146
|
+
this.state = this.queuedState;
|
|
147
|
+
this.queuedState = undefined;
|
|
148
|
+
this.onStateChangeAction.trigger(this.state);
|
|
149
|
+
this.animator.animate({ value: 1 });
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case 'hidden':
|
|
153
|
+
case 'visible':
|
|
154
|
+
// Do nothing
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
onStateChange(callback) {
|
|
159
|
+
this.onStateChangeAction.subscribe(value => callback(value)).attach(this);
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
onValueChange(callback) {
|
|
163
|
+
this.onValueChangeAction.subscribe(value => callback(value)).attach(this);
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.VisitDisappearStateAnimation = VisitDisappearStateAnimation;
|
|
168
|
+
//# sourceMappingURL=visit-disappear-state-animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|