@vived/host 3.9.3 → 3.10.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/lib/Components/Apps/UCs/StartAppUC.js +16 -9
- package/lib/Components/Dispatcher/UCs/DispatchSetStateUC.d.ts +19 -1
- package/lib/Components/Dispatcher/UCs/DispatchSetStateUC.js +24 -10
- package/lib/Components/StateMachine/UCs/CancelEditing/CancelSandboxEditingUC.js +10 -2
- package/lib/Components/StateMachine/UCs/EditActiveState/EditActiveSandboxStateUC.js +10 -2
- package/lib/Components/StateMachine/UCs/TransitionToState/TransitionToSandboxStateUC.js +11 -2
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ class StartAppUCImp extends StartAppUC {
|
|
|
35
35
|
constructor(appObject) {
|
|
36
36
|
super(appObject, StartAppUC.type);
|
|
37
37
|
this.start = (container) => {
|
|
38
|
-
var _a, _b, _c;
|
|
38
|
+
var _a, _b, _c, _d, _e;
|
|
39
39
|
if (!this.stateMachine)
|
|
40
40
|
return;
|
|
41
41
|
if (!this.dispatchStart)
|
|
@@ -43,20 +43,27 @@ class StartAppUCImp extends StartAppUC {
|
|
|
43
43
|
if (!this.editStateEntity)
|
|
44
44
|
return;
|
|
45
45
|
this.dispatchStart.doDispatch(container);
|
|
46
|
-
let
|
|
46
|
+
let state = {};
|
|
47
47
|
if (this.stateMachine.activeState && this.stateMachine.activeState) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
stateString = JSON.stringify(state.stateData);
|
|
51
|
-
}
|
|
48
|
+
state =
|
|
49
|
+
(_b = (_a = this.stateMachine.getStateByID(this.stateMachine.activeState)) === null || _a === void 0 ? void 0 : _a.stateData) !== null && _b !== void 0 ? _b : {};
|
|
52
50
|
}
|
|
53
|
-
|
|
51
|
+
const hideNavigation = this.stateMachine.states.length <= 1;
|
|
52
|
+
const hasNextSlide = this.stateMachine.nextState !== undefined;
|
|
53
|
+
const hasPreviousSlide = this.stateMachine.previousState !== undefined;
|
|
54
|
+
const dto = {
|
|
55
|
+
finalState: state,
|
|
56
|
+
hideNavigation,
|
|
57
|
+
hasNextSlide,
|
|
58
|
+
hasPreviousSlide
|
|
59
|
+
};
|
|
60
|
+
(_c = this.dispatchSetState) === null || _c === void 0 ? void 0 : _c.doDispatch(dto);
|
|
54
61
|
let isAuthoring = this.editStateEntity.isEditing;
|
|
55
62
|
if (this.stateMachine.activeState === undefined) {
|
|
56
63
|
isAuthoring = true;
|
|
57
64
|
}
|
|
58
|
-
(
|
|
59
|
-
(
|
|
65
|
+
(_d = this.dispatchSetIsAuthoring) === null || _d === void 0 ? void 0 : _d.doDispatch(isAuthoring);
|
|
66
|
+
(_e = this.dispatchThemeColors) === null || _e === void 0 ? void 0 : _e.doDispatch();
|
|
60
67
|
};
|
|
61
68
|
}
|
|
62
69
|
get stateMachine() {
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { HostAppObject, HostAppObjectRepo, HostAppObjectUC } from "../../../HostAppObject";
|
|
2
|
+
export interface DispatchStateDTO {
|
|
3
|
+
finalState: object;
|
|
4
|
+
hideNavigation: boolean;
|
|
5
|
+
hasNextSlide: boolean;
|
|
6
|
+
hasPreviousSlide: boolean;
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
2
9
|
export declare abstract class DispatchSetStateUC extends HostAppObjectUC {
|
|
3
10
|
static readonly type = "DispatchSetStateUC";
|
|
4
11
|
readonly requestType = "SET_APP_STATE";
|
|
5
|
-
abstract doDispatch(
|
|
12
|
+
abstract doDispatch(dto: DispatchStateDTO): void;
|
|
6
13
|
static get(appObject: HostAppObject): DispatchSetStateUC | undefined;
|
|
7
14
|
static getByID(id: string, appObjects: HostAppObjectRepo): DispatchSetStateUC | undefined;
|
|
8
15
|
}
|
|
9
16
|
export declare function makeDispatchSetStateUC(appObject: HostAppObject): DispatchSetStateUC;
|
|
17
|
+
export interface SetStatePayloadV2 {
|
|
18
|
+
finalState: string;
|
|
19
|
+
duration?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface SetStatePayloadV3 {
|
|
22
|
+
finalState: object;
|
|
23
|
+
hideNavigation: boolean;
|
|
24
|
+
hasNextSlide: boolean;
|
|
25
|
+
hasPreviousSlide: boolean;
|
|
26
|
+
duration?: number;
|
|
27
|
+
}
|
|
@@ -31,22 +31,36 @@ function makeDispatchSetStateUC(appObject) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.makeDispatchSetStateUC = makeDispatchSetStateUC;
|
|
33
33
|
class DispatchSetStateUCImp extends DispatchSetStateUC {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.requestVersion = 2;
|
|
37
|
-
this.dispatcher = appObject.getComponent(Entities_1.HostDispatchEntity.type);
|
|
38
|
-
if (!this.dispatcher) {
|
|
39
|
-
this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first");
|
|
40
|
-
this.dispose();
|
|
41
|
-
}
|
|
34
|
+
get dispatcher() {
|
|
35
|
+
return this.getCachedLocalComponent(Entities_1.HostDispatchEntity.type);
|
|
42
36
|
}
|
|
43
|
-
doDispatch(
|
|
37
|
+
doDispatch(dto) {
|
|
44
38
|
if (!this.dispatcher)
|
|
45
39
|
return;
|
|
40
|
+
const { finalState, duration, hasNextSlide, hasPreviousSlide, hideNavigation } = dto;
|
|
41
|
+
const requestedPayload = this.dispatcher.getRequestPayloadVersion(this.requestType);
|
|
42
|
+
if (!requestedPayload || requestedPayload <= 2) {
|
|
43
|
+
this.dispatchV2(finalState, duration);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
46
|
const payload = {
|
|
47
47
|
finalState,
|
|
48
|
+
duration,
|
|
49
|
+
hasNextSlide,
|
|
50
|
+
hasPreviousSlide,
|
|
51
|
+
hideNavigation
|
|
52
|
+
};
|
|
53
|
+
this.dispatcher.formRequestAndDispatch(this.requestType, 3, payload);
|
|
54
|
+
}
|
|
55
|
+
dispatchV2(state, duration) {
|
|
56
|
+
var _a;
|
|
57
|
+
const payload = {
|
|
58
|
+
finalState: JSON.stringify(state),
|
|
48
59
|
duration
|
|
49
60
|
};
|
|
50
|
-
this.dispatcher.formRequestAndDispatch(this.requestType,
|
|
61
|
+
(_a = this.dispatcher) === null || _a === void 0 ? void 0 : _a.formRequestAndDispatch(this.requestType, 2, payload);
|
|
62
|
+
}
|
|
63
|
+
constructor(appObject) {
|
|
64
|
+
super(appObject, DispatchSetStateUC.type);
|
|
51
65
|
}
|
|
52
66
|
}
|
|
@@ -30,8 +30,16 @@ class CancelSandboxEditingUC extends CancelEditingUC_1.CancelEditingUC {
|
|
|
30
30
|
if (this.stateMachine.activeState) {
|
|
31
31
|
const state = this.stateMachine.getStateByID(this.stateMachine.activeState);
|
|
32
32
|
if (state) {
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const hideNavigation = this.stateMachine.states.length <= 1;
|
|
34
|
+
const hasNextSlide = this.stateMachine.nextState !== undefined;
|
|
35
|
+
const hasPreviousSlide = this.stateMachine.previousState !== undefined;
|
|
36
|
+
const dto = {
|
|
37
|
+
finalState: state.stateData,
|
|
38
|
+
hideNavigation,
|
|
39
|
+
hasNextSlide,
|
|
40
|
+
hasPreviousSlide
|
|
41
|
+
};
|
|
42
|
+
dispatchSetState.doDispatch(dto);
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
else {
|
|
@@ -34,8 +34,16 @@ class EditActiveSandboxStateUCImp extends EditActiveStateUC_1.EditActiveStateUC
|
|
|
34
34
|
this.warn("Unable to find state");
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const hideNavigation = this.stateMachine.states.length <= 1;
|
|
38
|
+
const hasNextSlide = this.stateMachine.nextState !== undefined;
|
|
39
|
+
const hasPreviousSlide = this.stateMachine.previousState !== undefined;
|
|
40
|
+
const dto = {
|
|
41
|
+
finalState: state.stateData,
|
|
42
|
+
hideNavigation,
|
|
43
|
+
hasNextSlide,
|
|
44
|
+
hasPreviousSlide
|
|
45
|
+
};
|
|
46
|
+
dispatchSetState.doDispatch(dto);
|
|
39
47
|
dispatchSetIsAuthoring.doDispatch(true);
|
|
40
48
|
this.editStateEntity.startEditing(state);
|
|
41
49
|
};
|
|
@@ -31,9 +31,18 @@ class TransitionToSandboxStateUCImp extends TransitionToStateUC_1.TransitionToSt
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
stateMachine.setActiveStateByID(id);
|
|
34
|
-
const stateStr = JSON.stringify(state.stateData);
|
|
35
34
|
const duration = stateMachine.transitionDuration;
|
|
36
|
-
|
|
35
|
+
const hideNavigation = stateMachine.states.length <= 1;
|
|
36
|
+
const hasNextSlide = stateMachine.nextState !== undefined;
|
|
37
|
+
const hasPreviousSlide = stateMachine.previousState !== undefined;
|
|
38
|
+
const dto = {
|
|
39
|
+
finalState: state.stateData,
|
|
40
|
+
duration,
|
|
41
|
+
hideNavigation,
|
|
42
|
+
hasNextSlide,
|
|
43
|
+
hasPreviousSlide
|
|
44
|
+
};
|
|
45
|
+
dispatchSetState.doDispatch(dto);
|
|
37
46
|
}
|
|
38
47
|
constructor(appObject) {
|
|
39
48
|
super(appObject, TransitionToStateUC_1.TransitionToStateUC.type);
|