@configura/babylon-view 1.4.0 → 1.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/animation/AnimatableObject.d.ts +8 -8
  4. package/dist/animation/AnimatableObject.js +3 -3
  5. package/dist/animation/animator/Animator.d.ts +33 -33
  6. package/dist/animation/animator/Animator.js +58 -58
  7. package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
  8. package/dist/animation/animator/AnimatorEasing.js +31 -31
  9. package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
  10. package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
  11. package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
  12. package/dist/animation/animator/AnimatorHighlight.js +32 -32
  13. package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
  14. package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
  15. package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
  16. package/dist/animation/animator/AnimatorQueue.js +57 -57
  17. package/dist/animation/animator/AnimatorScale.d.ts +8 -8
  18. package/dist/animation/animator/AnimatorScale.js +13 -13
  19. package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
  20. package/dist/animation/animator/AnimatorSpin.js +13 -13
  21. package/dist/animation/animator/EasingFunctions.d.ts +35 -35
  22. package/dist/animation/animator/EasingFunctions.js +137 -137
  23. package/dist/animation/coordinator/Coordinator.d.ts +28 -28
  24. package/dist/animation/coordinator/Coordinator.js +47 -47
  25. package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
  26. package/dist/animation/coordinator/CoordinatorDropAndSpin.js +133 -133
  27. package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
  28. package/dist/animation/coordinator/CoordinatorIdentity.js +12 -12
  29. package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
  30. package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
  31. package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
  32. package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
  33. package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
  34. package/dist/animation/coordinator/CoordinatorPulseBounce.js +40 -40
  35. package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
  36. package/dist/animation/coordinator/CoordinatorPulseHighlight.js +34 -34
  37. package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
  38. package/dist/animation/coordinator/CoordinatorPulseInflate.js +30 -30
  39. package/dist/camera/CameraCreator.d.ts +5 -5
  40. package/dist/camera/CameraCreator.js +4 -4
  41. package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +26 -26
  42. package/dist/camera/CfgArcRotateCameraPointersInput.js +264 -264
  43. package/dist/camera/CfgOrbitalCamera.d.ts +68 -68
  44. package/dist/camera/CfgOrbitalCamera.js +250 -250
  45. package/dist/camera/CfgOrbitalCameraControlProps.d.ts +6 -6
  46. package/dist/camera/CfgOrbitalCameraControlProps.js +3 -3
  47. package/dist/camera/GradingApplier.d.ts +3 -3
  48. package/dist/camera/GradingApplier.js +48 -48
  49. package/dist/engine/EngineCreator.d.ts +3 -3
  50. package/dist/engine/EngineCreator.js +10 -10
  51. package/dist/geometry/CfgGeometry.d.ts +29 -29
  52. package/dist/geometry/CfgGeometry.js +146 -146
  53. package/dist/geometry/CfgMesh.d.ts +10 -10
  54. package/dist/geometry/CfgMesh.js +38 -38
  55. package/dist/geometry/geoSplitter.d.ts +8 -8
  56. package/dist/geometry/geoSplitter.js +192 -192
  57. package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
  58. package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
  59. package/dist/geometry/stretch/CfgStretchData.d.ts +114 -114
  60. package/dist/geometry/stretch/CfgStretchData.js +340 -340
  61. package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
  62. package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
  63. package/dist/index.d.ts +13 -13
  64. package/dist/index.js +13 -13
  65. package/dist/light/CfgDirectionalLight.d.ts +8 -8
  66. package/dist/light/CfgDirectionalLight.js +18 -18
  67. package/dist/light/CfgHemisphericLight.d.ts +7 -7
  68. package/dist/light/CfgHemisphericLight.js +17 -17
  69. package/dist/light/CfgPointLight.d.ts +8 -8
  70. package/dist/light/CfgPointLight.js +18 -18
  71. package/dist/light/DefaultLightRig.d.ts +19 -19
  72. package/dist/light/DefaultLightRig.js +77 -77
  73. package/dist/light/LightRigCreator.d.ts +9 -9
  74. package/dist/light/LightRigCreator.js +3 -3
  75. package/dist/material/CfgMaterial.d.ts +68 -68
  76. package/dist/material/CfgMaterial.js +482 -482
  77. package/dist/material/DummyMaterialCreator.d.ts +4 -4
  78. package/dist/material/DummyMaterialCreator.js +15 -15
  79. package/dist/material/material.d.ts +18 -18
  80. package/dist/material/material.js +128 -128
  81. package/dist/material/texture.d.ts +14 -14
  82. package/dist/material/texture.js +306 -306
  83. package/dist/nodes/CfgContentRootNode.d.ts +19 -19
  84. package/dist/nodes/CfgContentRootNode.js +75 -75
  85. package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
  86. package/dist/nodes/CfgDeferredMeshNode.js +377 -377
  87. package/dist/nodes/CfgProductNode.d.ts +126 -126
  88. package/dist/nodes/CfgProductNode.js +578 -578
  89. package/dist/nodes/CfgSymNode.d.ts +50 -50
  90. package/dist/nodes/CfgSymNode.js +249 -249
  91. package/dist/nodes/CfgSymRootNode.d.ts +45 -45
  92. package/dist/nodes/CfgSymRootNode.js +220 -220
  93. package/dist/nodes/CfgTransformNode.d.ts +33 -33
  94. package/dist/nodes/CfgTransformNode.js +83 -83
  95. package/dist/scene/SceneCreator.d.ts +6 -6
  96. package/dist/scene/SceneCreator.js +22 -22
  97. package/dist/utilities/CfgBoundingBox.d.ts +21 -21
  98. package/dist/utilities/CfgBoundingBox.js +81 -81
  99. package/dist/utilities/anchor/anchor.d.ts +51 -51
  100. package/dist/utilities/anchor/anchor.js +136 -136
  101. package/dist/utilities/anchor/anchorMap.d.ts +20 -20
  102. package/dist/utilities/anchor/anchorMap.js +111 -111
  103. package/dist/utilities/utilities3D.d.ts +70 -70
  104. package/dist/utilities/utilities3D.js +265 -265
  105. package/dist/utilities/utilitiesColor.d.ts +18 -18
  106. package/dist/utilities/utilitiesColor.js +48 -48
  107. package/dist/utilities/utilitiesImage.d.ts +6 -6
  108. package/dist/utilities/utilitiesImage.js +107 -107
  109. package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
  110. package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
  111. package/dist/view/BaseView.d.ts +78 -78
  112. package/dist/view/BaseView.js +297 -297
  113. package/dist/view/BaseViewConfiguration.d.ts +32 -32
  114. package/dist/view/BaseViewConfiguration.js +10 -8
  115. package/dist/view/RenderEnv.d.ts +43 -43
  116. package/dist/view/RenderEnv.js +7 -7
  117. package/dist/view/SingleProductDefaultCameraView.d.ts +33 -33
  118. package/dist/view/SingleProductDefaultCameraView.js +141 -141
  119. package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +46 -46
  120. package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
  121. package/dist/view/SingleProductView.d.ts +42 -42
  122. package/dist/view/SingleProductView.js +206 -206
  123. package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
  124. package/dist/view/SingleProductViewConfiguration.js +19 -19
  125. package/package.json +5 -5
@@ -1,133 +1,133 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
11
- import { CfgProductNode } from "../../nodes/CfgProductNode.js";
12
- import { CfgSymRootNode } from "../../nodes/CfgSymRootNode.js";
13
- import { SingleProductViewPhase, } from "../../view/SingleProductViewConfiguration.js";
14
- import { AnimationState } from "../animator/Animator.js";
15
- import { AnimatorPointToPoint } from "../animator/AnimatorPointToPoint.js";
16
- import { AnimatorSpin } from "../animator/AnimatorSpin.js";
17
- import { EasingFunctions } from "../animator/EasingFunctions.js";
18
- import { CoordinatorNodeQueues, defaultConfig as baseDefaultConfig, } from "./CoordinatorNodeQueues.js";
19
- export const defaultConfig = Object.assign(Object.assign({}, baseDefaultConfig), { distance: 5, enterDuration: 1000, exitDuration: 500, staggerDuration: 1000, spinDuration: 1500 });
20
- export class CoordinatorDropAndSpin extends CoordinatorNodeQueues {
21
- constructor(view, phaseObservable, config) {
22
- super(view, phaseObservable, Object.assign(Object.assign({}, defaultConfig), config));
23
- this.phaseListenerDropAndSpin = (phase) => {
24
- const { previous, current } = phase;
25
- if (previous !== SingleProductViewPhase.ApplyMaterials ||
26
- current === SingleProductViewPhase.Error ||
27
- current === SingleProductViewPhase.Aborted) {
28
- return;
29
- }
30
- if (this.isFirstRun) {
31
- this.applyDelay();
32
- }
33
- this.run();
34
- };
35
- this.phaseObservable.listen(this.phaseListenerDropAndSpin);
36
- }
37
- static getCoordinatorCreator(config) {
38
- return (view, phaseObservable) => {
39
- return new this(view, phaseObservable, config || {});
40
- };
41
- }
42
- destroy() {
43
- super.destroy();
44
- this.phaseObservable.stopListen(this.phaseListenerDropAndSpin);
45
- }
46
- setProduct(productNode) {
47
- super.setProduct(productNode);
48
- let queue = this.getAnimatorQueue(productNode, true);
49
- const animator = new AnimatorSpin(productNode, {
50
- translationVector: productNode.boundingBox.center,
51
- easing: EasingFunctions.easeInOutQuad,
52
- duration: this._config.spinDuration,
53
- startPosition: 0,
54
- endPosition: Math.PI * 2,
55
- }, "spin");
56
- queue.add(animator);
57
- }
58
- prepareForEnter(node, _isNewProduct) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- const queue = this.getAnimatorQueue(node, true);
61
- const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
62
- const animator = new AnimatorPointToPoint(node, {
63
- easing: EasingFunctions.easeOutCubic,
64
- duration: this._config.enterDuration,
65
- startPosition: Vector3.TransformCoordinates(new Vector3(0, this._config.distance, 0), adjustToWorldMatrix),
66
- }, "enter");
67
- animator.apply0();
68
- queue.add(animator);
69
- });
70
- }
71
- prepareForExit(node) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- const queue = this.getAnimatorQueue(node);
74
- if (queue === undefined) {
75
- return;
76
- }
77
- const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
78
- const animator = new AnimatorPointToPoint(node, {
79
- easing: EasingFunctions.easeInCubic,
80
- duration: this._config.exitDuration,
81
- endPosition: Vector3.TransformCoordinates(new Vector3(0, -this._config.distance, 0), adjustToWorldMatrix),
82
- }, "exit");
83
- queue.add(animator);
84
- yield new Promise((resolve) => {
85
- const isDone = () => {
86
- this.removeAnimatorQueue(queue);
87
- resolve();
88
- queue.stopListenForDone(isDone);
89
- };
90
- queue.listenForDone(isDone);
91
- });
92
- });
93
- }
94
- applyDelay() {
95
- //So that they fall in in order by z
96
- const queuesWithDelay = this.animationQueues
97
- .filter((q) => {
98
- if (!(q.node instanceof CfgSymRootNode)) {
99
- return false;
100
- }
101
- const top = q.peek();
102
- if (top === undefined) {
103
- return false;
104
- }
105
- return top.type === "enter" && top.state === AnimationState.Ready;
106
- })
107
- .map((q) => ({
108
- q,
109
- bb: q.node.boundingBox.clone().applyMatrix(q.node.worldOriginalMatrix),
110
- }));
111
- queuesWithDelay.sort((left, right) => {
112
- return left.bb.minimum.y < right.bb.minimum.y ? -1 : 1;
113
- });
114
- let delayCounter = 0;
115
- for (const animationQueue of queuesWithDelay) {
116
- const top = animationQueue.q.peek();
117
- if (top === undefined) {
118
- continue;
119
- }
120
- top.delay = delayCounter;
121
- delayCounter += this._config.staggerDuration;
122
- }
123
- const productQueue = this.animationQueues.find((q) => {
124
- return q.node instanceof CfgProductNode;
125
- });
126
- if (productQueue) {
127
- const topProductAnimation = productQueue.peek();
128
- if (topProductAnimation && topProductAnimation.state === AnimationState.Ready) {
129
- topProductAnimation.delay = delayCounter;
130
- }
131
- }
132
- }
133
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
11
+ import { CfgProductNode } from "../../nodes/CfgProductNode.js";
12
+ import { CfgSymRootNode } from "../../nodes/CfgSymRootNode.js";
13
+ import { SingleProductViewPhase, } from "../../view/SingleProductViewConfiguration.js";
14
+ import { AnimationState } from "../animator/Animator.js";
15
+ import { AnimatorPointToPoint } from "../animator/AnimatorPointToPoint.js";
16
+ import { AnimatorSpin } from "../animator/AnimatorSpin.js";
17
+ import { EasingFunctions } from "../animator/EasingFunctions.js";
18
+ import { CoordinatorNodeQueues, defaultConfig as baseDefaultConfig, } from "./CoordinatorNodeQueues.js";
19
+ export const defaultConfig = Object.assign(Object.assign({}, baseDefaultConfig), { distance: 5, enterDuration: 1000, exitDuration: 500, staggerDuration: 1000, spinDuration: 1500 });
20
+ export class CoordinatorDropAndSpin extends CoordinatorNodeQueues {
21
+ constructor(view, phaseObservable, config) {
22
+ super(view, phaseObservable, Object.assign(Object.assign({}, defaultConfig), config));
23
+ this.phaseListenerDropAndSpin = (phase) => {
24
+ const { previous, current } = phase;
25
+ if (previous !== SingleProductViewPhase.ApplyMaterials ||
26
+ current === SingleProductViewPhase.Error ||
27
+ current === SingleProductViewPhase.Aborted) {
28
+ return;
29
+ }
30
+ if (this.isFirstRun) {
31
+ this.applyDelay();
32
+ }
33
+ this.run();
34
+ };
35
+ this.phaseObservable.listen(this.phaseListenerDropAndSpin);
36
+ }
37
+ static getCoordinatorCreator(config) {
38
+ return (view, phaseObservable) => {
39
+ return new this(view, phaseObservable, config || {});
40
+ };
41
+ }
42
+ destroy() {
43
+ super.destroy();
44
+ this.phaseObservable.stopListen(this.phaseListenerDropAndSpin);
45
+ }
46
+ setProduct(productNode) {
47
+ super.setProduct(productNode);
48
+ let queue = this.getAnimatorQueue(productNode, true);
49
+ const animator = new AnimatorSpin(productNode, {
50
+ translationVector: productNode.boundingBox.center,
51
+ easing: EasingFunctions.easeInOutQuad,
52
+ duration: this._config.spinDuration,
53
+ startPosition: 0,
54
+ endPosition: Math.PI * 2,
55
+ }, "spin");
56
+ queue.add(animator);
57
+ }
58
+ prepareForEnter(node, _isNewProduct) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const queue = this.getAnimatorQueue(node, true);
61
+ const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
62
+ const animator = new AnimatorPointToPoint(node, {
63
+ easing: EasingFunctions.easeOutCubic,
64
+ duration: this._config.enterDuration,
65
+ startPosition: Vector3.TransformCoordinates(new Vector3(0, this._config.distance, 0), adjustToWorldMatrix),
66
+ }, "enter");
67
+ animator.apply0();
68
+ queue.add(animator);
69
+ });
70
+ }
71
+ prepareForExit(node) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const queue = this.getAnimatorQueue(node);
74
+ if (queue === undefined) {
75
+ return;
76
+ }
77
+ const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
78
+ const animator = new AnimatorPointToPoint(node, {
79
+ easing: EasingFunctions.easeInCubic,
80
+ duration: this._config.exitDuration,
81
+ endPosition: Vector3.TransformCoordinates(new Vector3(0, -this._config.distance, 0), adjustToWorldMatrix),
82
+ }, "exit");
83
+ queue.add(animator);
84
+ yield new Promise((resolve) => {
85
+ const isDone = () => {
86
+ this.removeAnimatorQueue(queue);
87
+ resolve();
88
+ queue.stopListenForDone(isDone);
89
+ };
90
+ queue.listenForDone(isDone);
91
+ });
92
+ });
93
+ }
94
+ applyDelay() {
95
+ //So that they fall in in order by z
96
+ const queuesWithDelay = this.animationQueues
97
+ .filter((q) => {
98
+ if (!(q.node instanceof CfgSymRootNode)) {
99
+ return false;
100
+ }
101
+ const top = q.peek();
102
+ if (top === undefined) {
103
+ return false;
104
+ }
105
+ return top.type === "enter" && top.state === AnimationState.Ready;
106
+ })
107
+ .map((q) => ({
108
+ q,
109
+ bb: q.node.boundingBox.clone().applyMatrix(q.node.worldOriginalMatrix),
110
+ }));
111
+ queuesWithDelay.sort((left, right) => {
112
+ return left.bb.minimum.y < right.bb.minimum.y ? -1 : 1;
113
+ });
114
+ let delayCounter = 0;
115
+ for (const animationQueue of queuesWithDelay) {
116
+ const top = animationQueue.q.peek();
117
+ if (top === undefined) {
118
+ continue;
119
+ }
120
+ top.delay = delayCounter;
121
+ delayCounter += this._config.staggerDuration;
122
+ }
123
+ const productQueue = this.animationQueues.find((q) => {
124
+ return q.node instanceof CfgProductNode;
125
+ });
126
+ if (productQueue) {
127
+ const topProductAnimation = productQueue.peek();
128
+ if (topProductAnimation && topProductAnimation.state === AnimationState.Ready) {
129
+ topProductAnimation.delay = delayCounter;
130
+ }
131
+ }
132
+ }
133
+ }
@@ -1,12 +1,12 @@
1
- import { Observable } from "@configura/web-utilities";
2
- import { SingleProductView } from "../../view/SingleProductView.js";
3
- import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
- import { Coordinator } from "./Coordinator.js";
5
- export declare class CoordinatorIdentity extends Coordinator<{}> {
6
- protected view: SingleProductView;
7
- protected phaseObservable: Observable<SingleProductViewPhaseEvent>;
8
- constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>);
9
- willTick(_now: number, _delta: number): boolean;
10
- tick(_now: number, _delta: number): void;
11
- }
1
+ import { Observable } from "@configura/web-utilities";
2
+ import { SingleProductView } from "../../view/SingleProductView.js";
3
+ import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
+ import { Coordinator } from "./Coordinator.js";
5
+ export declare class CoordinatorIdentity extends Coordinator<{}> {
6
+ protected view: SingleProductView;
7
+ protected phaseObservable: Observable<SingleProductViewPhaseEvent>;
8
+ constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>);
9
+ willTick(_now: number, _delta: number): boolean;
10
+ tick(_now: number, _delta: number): void;
11
+ }
12
12
  //# sourceMappingURL=CoordinatorIdentity.d.ts.map
@@ -1,12 +1,12 @@
1
- import { Coordinator, defaultConfig as baseDefaultConfig } from "./Coordinator.js";
2
- export class CoordinatorIdentity extends Coordinator {
3
- constructor(view, phaseObservable) {
4
- super(view, phaseObservable, baseDefaultConfig);
5
- this.view = view;
6
- this.phaseObservable = phaseObservable;
7
- }
8
- willTick(_now, _delta) {
9
- return false;
10
- }
11
- tick(_now, _delta) { }
12
- }
1
+ import { Coordinator, defaultConfig as baseDefaultConfig } from "./Coordinator.js";
2
+ export class CoordinatorIdentity extends Coordinator {
3
+ constructor(view, phaseObservable) {
4
+ super(view, phaseObservable, baseDefaultConfig);
5
+ this.view = view;
6
+ this.phaseObservable = phaseObservable;
7
+ }
8
+ willTick(_now, _delta) {
9
+ return false;
10
+ }
11
+ tick(_now, _delta) { }
12
+ }
@@ -1,19 +1,19 @@
1
- import { Observable } from "@configura/web-utilities";
2
- import { SingleProductView } from "../../view/SingleProductView.js";
3
- import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
- import { AnimatableObject } from "../AnimatableObject.js";
5
- import { AnimatorQueue } from "../animator/AnimatorQueue.js";
6
- import { Coordinator, CoordinatorConfig } from "./Coordinator.js";
7
- export declare type CoordinatorNodeQueuesConfig = CoordinatorConfig & {};
8
- export declare const defaultConfig: CoordinatorNodeQueuesConfig;
9
- export declare abstract class CoordinatorNodeQueues<Config extends CoordinatorNodeQueuesConfig> extends Coordinator<Config> {
10
- protected animationQueues: AnimatorQueue[];
11
- protected isFirstRun: boolean;
12
- protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Config);
13
- getAnimatorQueue(node: AnimatableObject, orCreate?: boolean): AnimatorQueue | undefined;
14
- removeAnimatorQueue(queue: AnimatorQueue): void;
15
- protected run(): false | undefined;
16
- willTick(now: number, delta: number): boolean;
17
- tick(now: number, delta: number): void;
18
- }
1
+ import { Observable } from "@configura/web-utilities";
2
+ import { SingleProductView } from "../../view/SingleProductView.js";
3
+ import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
+ import { AnimatableObject } from "../AnimatableObject.js";
5
+ import { AnimatorQueue } from "../animator/AnimatorQueue.js";
6
+ import { Coordinator, CoordinatorConfig } from "./Coordinator.js";
7
+ export declare type CoordinatorNodeQueuesConfig = CoordinatorConfig & {};
8
+ export declare const defaultConfig: CoordinatorNodeQueuesConfig;
9
+ export declare abstract class CoordinatorNodeQueues<Config extends CoordinatorNodeQueuesConfig> extends Coordinator<Config> {
10
+ protected animationQueues: AnimatorQueue[];
11
+ protected isFirstRun: boolean;
12
+ protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Config);
13
+ getAnimatorQueue(node: AnimatableObject, orCreate?: boolean): AnimatorQueue | undefined;
14
+ removeAnimatorQueue(queue: AnimatorQueue): void;
15
+ protected run(): false | undefined;
16
+ willTick(now: number, delta: number): boolean;
17
+ tick(now: number, delta: number): void;
18
+ }
19
19
  //# sourceMappingURL=CoordinatorNodeQueues.d.ts.map
@@ -1,50 +1,50 @@
1
- import { AnimatorQueue } from "../animator/AnimatorQueue.js";
2
- import { Coordinator, defaultConfig as baseDefaultConfig, } from "./Coordinator.js";
3
- export const defaultConfig = Object.assign({}, baseDefaultConfig);
4
- export class CoordinatorNodeQueues extends Coordinator {
5
- constructor(view, phaseObservable, config) {
6
- super(view, phaseObservable, config);
7
- this.animationQueues = [];
8
- this.isFirstRun = true;
9
- }
10
- getAnimatorQueue(node, orCreate = false) {
11
- let queue = this.animationQueues.find((queue) => queue.node === node);
12
- if (queue === undefined && orCreate) {
13
- queue = new AnimatorQueue(node);
14
- this.animationQueues.push(queue);
15
- }
16
- return queue;
17
- }
18
- removeAnimatorQueue(queue) {
19
- const index = this.animationQueues.indexOf(queue);
20
- if (index < 0) {
21
- return;
22
- }
23
- this.animationQueues.splice(index, 1);
24
- }
25
- run() {
26
- if (this.productNode === undefined) {
27
- return false;
28
- }
29
- if (this.isFirstRun) {
30
- this.isFirstRun = false;
31
- }
32
- this.animationQueues.forEach((o) => {
33
- o.run();
34
- });
35
- }
36
- willTick(now, delta) {
37
- let someWillTick = false;
38
- for (const o of this.animationQueues) {
39
- if (o.willTick(now, delta)) {
40
- someWillTick = true;
41
- }
42
- }
43
- return someWillTick;
44
- }
45
- tick(now, delta) {
46
- for (const o of this.animationQueues) {
47
- o.tick(now, delta);
48
- }
49
- }
50
- }
1
+ import { AnimatorQueue } from "../animator/AnimatorQueue.js";
2
+ import { Coordinator, defaultConfig as baseDefaultConfig, } from "./Coordinator.js";
3
+ export const defaultConfig = Object.assign({}, baseDefaultConfig);
4
+ export class CoordinatorNodeQueues extends Coordinator {
5
+ constructor(view, phaseObservable, config) {
6
+ super(view, phaseObservable, config);
7
+ this.animationQueues = [];
8
+ this.isFirstRun = true;
9
+ }
10
+ getAnimatorQueue(node, orCreate = false) {
11
+ let queue = this.animationQueues.find((queue) => queue.node === node);
12
+ if (queue === undefined && orCreate) {
13
+ queue = new AnimatorQueue(node);
14
+ this.animationQueues.push(queue);
15
+ }
16
+ return queue;
17
+ }
18
+ removeAnimatorQueue(queue) {
19
+ const index = this.animationQueues.indexOf(queue);
20
+ if (index < 0) {
21
+ return;
22
+ }
23
+ this.animationQueues.splice(index, 1);
24
+ }
25
+ run() {
26
+ if (this.productNode === undefined) {
27
+ return false;
28
+ }
29
+ if (this.isFirstRun) {
30
+ this.isFirstRun = false;
31
+ }
32
+ this.animationQueues.forEach((o) => {
33
+ o.run();
34
+ });
35
+ }
36
+ willTick(now, delta) {
37
+ let someWillTick = false;
38
+ for (const o of this.animationQueues) {
39
+ if (o.willTick(now, delta)) {
40
+ someWillTick = true;
41
+ }
42
+ }
43
+ return someWillTick;
44
+ }
45
+ tick(now, delta) {
46
+ for (const o of this.animationQueues) {
47
+ o.tick(now, delta);
48
+ }
49
+ }
50
+ }
@@ -1,22 +1,22 @@
1
- import { Observable } from "@configura/web-utilities";
2
- import { CfgDeferredMeshNode } from "../../nodes/CfgDeferredMeshNode.js";
3
- import { CfgSymRootNode } from "../../nodes/CfgSymRootNode.js";
4
- import { SingleProductView } from "../../view/SingleProductView.js";
5
- import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
6
- import { AnimatableObject } from "../AnimatableObject.js";
7
- import { CoordinatorNodeQueues, CoordinatorNodeQueuesConfig } from "./CoordinatorNodeQueues.js";
8
- export declare type CoordinatorPulseConfig = CoordinatorNodeQueuesConfig & {
9
- duration: number;
10
- delay: number;
11
- doForNewProducts: boolean;
12
- };
13
- export declare const defaultConfig: CoordinatorPulseConfig;
14
- export declare abstract class CoordinatorPulse<Config extends CoordinatorPulseConfig> extends CoordinatorNodeQueues<Config> {
15
- protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Config);
16
- destroy(): void;
17
- private phaseListenerPulse;
18
- protected abstract _prepare(node: AnimatableObject, isNewProduct: boolean): Promise<void>;
19
- prepareForEnter(node: CfgSymRootNode, isNewProduct: boolean): Promise<void>;
20
- prepareForMaterialChange(node: CfgDeferredMeshNode, isNewProduct: boolean): Promise<void>;
21
- }
1
+ import { Observable } from "@configura/web-utilities";
2
+ import { CfgDeferredMeshNode } from "../../nodes/CfgDeferredMeshNode.js";
3
+ import { CfgSymRootNode } from "../../nodes/CfgSymRootNode.js";
4
+ import { SingleProductView } from "../../view/SingleProductView.js";
5
+ import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
6
+ import { AnimatableObject } from "../AnimatableObject.js";
7
+ import { CoordinatorNodeQueues, CoordinatorNodeQueuesConfig } from "./CoordinatorNodeQueues.js";
8
+ export declare type CoordinatorPulseConfig = CoordinatorNodeQueuesConfig & {
9
+ duration: number;
10
+ delay: number;
11
+ doForNewProducts: boolean;
12
+ };
13
+ export declare const defaultConfig: CoordinatorPulseConfig;
14
+ export declare abstract class CoordinatorPulse<Config extends CoordinatorPulseConfig> extends CoordinatorNodeQueues<Config> {
15
+ protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Config);
16
+ destroy(): void;
17
+ private phaseListenerPulse;
18
+ protected abstract _prepare(node: AnimatableObject, isNewProduct: boolean): Promise<void>;
19
+ prepareForEnter(node: CfgSymRootNode, isNewProduct: boolean): Promise<void>;
20
+ prepareForMaterialChange(node: CfgDeferredMeshNode, isNewProduct: boolean): Promise<void>;
21
+ }
22
22
  //# sourceMappingURL=CoordinatorPulse.d.ts.map
@@ -1,47 +1,47 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { SingleProductViewPhase, } from "../../view/SingleProductViewConfiguration.js";
11
- import { CoordinatorNodeQueues, defaultConfig as baseDefaultConfig, } from "./CoordinatorNodeQueues.js";
12
- export const defaultConfig = Object.assign(Object.assign({}, baseDefaultConfig), { duration: 1000, delay: 50, doForNewProducts: false });
13
- export class CoordinatorPulse extends CoordinatorNodeQueues {
14
- constructor(view, phaseObservable, config) {
15
- super(view, phaseObservable, config);
16
- this.phaseListenerPulse = (phase) => {
17
- const { previous, current } = phase;
18
- if (previous !== SingleProductViewPhase.AppliedMaterials ||
19
- current === SingleProductViewPhase.Error ||
20
- current === SingleProductViewPhase.Aborted) {
21
- return;
22
- }
23
- this.run();
24
- };
25
- this.phaseObservable.listen(this.phaseListenerPulse);
26
- }
27
- destroy() {
28
- super.destroy();
29
- this.phaseObservable.stopListen(this.phaseListenerPulse);
30
- }
31
- prepareForEnter(node, isNewProduct) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- if (!this._config.doForNewProducts && isNewProduct) {
34
- return;
35
- }
36
- yield this._prepare(node, isNewProduct);
37
- });
38
- }
39
- prepareForMaterialChange(node, isNewProduct) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- if (isNewProduct) {
42
- return;
43
- }
44
- yield this._prepare(node, isNewProduct);
45
- });
46
- }
47
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { SingleProductViewPhase, } from "../../view/SingleProductViewConfiguration.js";
11
+ import { CoordinatorNodeQueues, defaultConfig as baseDefaultConfig, } from "./CoordinatorNodeQueues.js";
12
+ export const defaultConfig = Object.assign(Object.assign({}, baseDefaultConfig), { duration: 1000, delay: 50, doForNewProducts: false });
13
+ export class CoordinatorPulse extends CoordinatorNodeQueues {
14
+ constructor(view, phaseObservable, config) {
15
+ super(view, phaseObservable, config);
16
+ this.phaseListenerPulse = (phase) => {
17
+ const { previous, current } = phase;
18
+ if (previous !== SingleProductViewPhase.AppliedMaterials ||
19
+ current === SingleProductViewPhase.Error ||
20
+ current === SingleProductViewPhase.Aborted) {
21
+ return;
22
+ }
23
+ this.run();
24
+ };
25
+ this.phaseObservable.listen(this.phaseListenerPulse);
26
+ }
27
+ destroy() {
28
+ super.destroy();
29
+ this.phaseObservable.stopListen(this.phaseListenerPulse);
30
+ }
31
+ prepareForEnter(node, isNewProduct) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ if (!this._config.doForNewProducts && isNewProduct) {
34
+ return;
35
+ }
36
+ yield this._prepare(node, isNewProduct);
37
+ });
38
+ }
39
+ prepareForMaterialChange(node, isNewProduct) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (isNewProduct) {
42
+ return;
43
+ }
44
+ yield this._prepare(node, isNewProduct);
45
+ });
46
+ }
47
+ }
@@ -1,15 +1,15 @@
1
- import { Observable } from "@configura/web-utilities";
2
- import { SingleProductView } from "../../view/SingleProductView.js";
3
- import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
- import { AnimatableObject } from "../AnimatableObject.js";
5
- import { CoordinatorCreator } from "./Coordinator.js";
6
- import { CoordinatorPulse, CoordinatorPulseConfig } from "./CoordinatorPulse.js";
7
- export declare type CoordinatorPulseBounceConfig = CoordinatorPulseConfig & {
8
- height: number;
9
- };
10
- export declare class CoordinatorPulseBounce extends CoordinatorPulse<CoordinatorPulseBounceConfig> {
11
- static getCoordinatorCreator(config?: Partial<CoordinatorPulseBounceConfig>): CoordinatorCreator;
12
- protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Partial<CoordinatorPulseBounceConfig>);
13
- _prepare(node: AnimatableObject, _isNewProduct: boolean): Promise<void>;
14
- }
1
+ import { Observable } from "@configura/web-utilities";
2
+ import { SingleProductView } from "../../view/SingleProductView.js";
3
+ import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
+ import { AnimatableObject } from "../AnimatableObject.js";
5
+ import { CoordinatorCreator } from "./Coordinator.js";
6
+ import { CoordinatorPulse, CoordinatorPulseConfig } from "./CoordinatorPulse.js";
7
+ export declare type CoordinatorPulseBounceConfig = CoordinatorPulseConfig & {
8
+ height: number;
9
+ };
10
+ export declare class CoordinatorPulseBounce extends CoordinatorPulse<CoordinatorPulseBounceConfig> {
11
+ static getCoordinatorCreator(config?: Partial<CoordinatorPulseBounceConfig>): CoordinatorCreator;
12
+ protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Partial<CoordinatorPulseBounceConfig>);
13
+ _prepare(node: AnimatableObject, _isNewProduct: boolean): Promise<void>;
14
+ }
15
15
  //# sourceMappingURL=CoordinatorPulseBounce.d.ts.map