@vived/app 4.28.1 → 4.29.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/Environment/Adapters/environmentalIntensityAdapter.d.ts +2 -0
- package/lib/Components/Environment/Adapters/environmentalIntensityAdapter.js +19 -0
- package/lib/Components/Environment/Adapters/index.d.ts +2 -0
- package/lib/Components/Environment/Adapters/index.js +14 -0
- package/lib/Components/Environment/Adapters/texturalEnvironmentAdapter.d.ts +3 -0
- package/lib/Components/Environment/Adapters/texturalEnvironmentAdapter.js +20 -0
- package/lib/Components/Environment/Controllers/index.d.ts +3 -0
- package/lib/Components/Environment/Controllers/index.js +15 -0
- package/lib/Components/Environment/Controllers/setTexturalEnvironment.d.ts +3 -0
- package/lib/Components/Environment/Controllers/setTexturalEnvironment.js +13 -0
- package/lib/Components/Environment/Controllers/submitEnvironmentIntensity.d.ts +2 -0
- package/lib/Components/Environment/Controllers/submitEnvironmentIntensity.js +13 -0
- package/lib/Components/Environment/Controllers/updateEnvironmentIntensity.d.ts +2 -0
- package/lib/Components/Environment/Controllers/updateEnvironmentIntensity.js +13 -0
- package/lib/Components/Environment/Entities/Environment.d.ts +20 -0
- package/lib/Components/Environment/Entities/Environment.js +53 -0
- package/lib/Components/Environment/Entities/index.d.ts +1 -0
- package/lib/Components/Environment/Entities/index.js +13 -0
- package/lib/Components/Environment/Factories/index.d.ts +1 -0
- package/lib/Components/Environment/Factories/index.js +13 -0
- package/lib/Components/Environment/Factories/setupEnvironmnets.d.ts +2 -0
- package/lib/Components/Environment/Factories/setupEnvironmnets.js +19 -0
- package/lib/Components/Environment/Mocks/EnvironmentalIntensityPmMock.d.ts +8 -0
- package/lib/Components/Environment/Mocks/EnvironmentalIntensityPmMock.js +15 -0
- package/lib/Components/Environment/Mocks/SetEnvironmentIntensityUcMock.d.ts +9 -0
- package/lib/Components/Environment/Mocks/SetEnvironmentIntensityUcMock.js +16 -0
- package/lib/Components/Environment/Mocks/SetTexturalEnvironmentUcMock.d.ts +8 -0
- package/lib/Components/Environment/Mocks/SetTexturalEnvironmentUcMock.js +15 -0
- package/lib/Components/Environment/Mocks/TexturalEnvironmentPmMock.d.ts +8 -0
- package/lib/Components/Environment/Mocks/TexturalEnvironmentPmMock.js +15 -0
- package/lib/Components/Environment/Mocks/index.d.ts +4 -0
- package/lib/Components/Environment/Mocks/index.js +16 -0
- package/lib/Components/Environment/PMs/EnvironmentalIntensityPM.d.ts +6 -0
- package/lib/Components/Environment/PMs/EnvironmentalIntensityPM.js +34 -0
- package/lib/Components/Environment/PMs/TexturalEnvironmentPM.d.ts +7 -0
- package/lib/Components/Environment/PMs/TexturalEnvironmentPM.js +34 -0
- package/lib/Components/Environment/PMs/index.d.ts +2 -0
- package/lib/Components/Environment/PMs/index.js +14 -0
- package/lib/Components/Environment/UCs/SerializeEnvironment.d.ts +23 -0
- package/lib/Components/Environment/UCs/SerializeEnvironment.js +73 -0
- package/lib/Components/Environment/UCs/SetEnvironmentIntensityUC.d.ts +8 -0
- package/lib/Components/Environment/UCs/SetEnvironmentIntensityUC.js +69 -0
- package/lib/Components/Environment/UCs/SetTexturalEnvironmentUC.d.ts +8 -0
- package/lib/Components/Environment/UCs/SetTexturalEnvironmentUC.js +58 -0
- package/lib/Components/Environment/UCs/index.d.ts +3 -0
- package/lib/Components/Environment/UCs/index.js +15 -0
- package/lib/Components/Environment/index.d.ts +7 -0
- package/lib/Components/Environment/index.js +19 -0
- package/lib/Components/Question/Adapters/index.d.ts +2 -0
- package/lib/Components/Question/Adapters/index.js +14 -0
- package/lib/Components/Question/Adapters/questionAnswerAdapter.d.ts +3 -0
- package/lib/Components/Question/Adapters/questionAnswerAdapter.js +27 -0
- package/lib/Components/Question/Adapters/questionChallengeAdapter.d.ts +3 -0
- package/lib/Components/Question/Adapters/questionChallengeAdapter.js +23 -0
- package/lib/Components/Question/Factories/index.d.ts +2 -0
- package/lib/Components/Question/Factories/index.js +14 -0
- package/lib/Components/Question/Factories/setupQuestionAnswer.d.ts +3 -0
- package/lib/Components/Question/Factories/setupQuestionAnswer.js +18 -0
- package/lib/Components/Question/Factories/setupQuestionChallenge.d.ts +3 -0
- package/lib/Components/Question/Factories/setupQuestionChallenge.js +20 -0
- package/lib/Components/Question/Mocks/QuestionAnswerPmMock.d.ts +7 -0
- package/lib/Components/Question/Mocks/QuestionAnswerPmMock.js +11 -0
- package/lib/Components/Question/Mocks/QuestionChallengePmMock.d.ts +8 -0
- package/lib/Components/Question/Mocks/QuestionChallengePmMock.js +15 -0
- package/lib/Components/Question/Mocks/index.d.ts +2 -0
- package/lib/Components/Question/Mocks/index.js +2 -0
- package/lib/Components/Question/PM/QuestionAnswerPM.d.ts +4 -6
- package/lib/Components/Question/PM/QuestionAnswerPM.js +20 -7
- package/lib/Components/Question/PM/QuestionChallengePM.d.ts +2 -7
- package/lib/Components/Question/PM/QuestionChallengePM.js +18 -8
- package/lib/Components/Question/index.d.ts +2 -0
- package/lib/Components/Question/index.js +2 -0
- package/lib/Components/index.d.ts +2 -1
- package/lib/Components/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeSetEnvironmentIntensityUC = exports.SetEnvironmentIntensityUC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const Dispatcher_1 = require("../../Dispatcher");
|
|
6
|
+
const UndoRedo_1 = require("../../UndoRedo");
|
|
7
|
+
const Environment_1 = require("../Entities/Environment");
|
|
8
|
+
class SetEnvironmentIntensityUC extends AppObject_1.AppObjectUC {
|
|
9
|
+
static get(appObjects) {
|
|
10
|
+
return AppObject_1.getSingletonComponent(SetEnvironmentIntensityUC.type, appObjects);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SetEnvironmentIntensityUC = SetEnvironmentIntensityUC;
|
|
14
|
+
SetEnvironmentIntensityUC.type = "SetEnvironmentIntensityUC";
|
|
15
|
+
function makeSetEnvironmentIntensityUC(appObject) {
|
|
16
|
+
return new SetEnvironmentIntensityUCImp(appObject);
|
|
17
|
+
}
|
|
18
|
+
exports.makeSetEnvironmentIntensityUC = makeSetEnvironmentIntensityUC;
|
|
19
|
+
class SetEnvironmentIntensityUCImp extends SetEnvironmentIntensityUC {
|
|
20
|
+
constructor(appObject) {
|
|
21
|
+
super(appObject, SetEnvironmentIntensityUC.type);
|
|
22
|
+
this.update = (val) => {
|
|
23
|
+
if (!this.environment)
|
|
24
|
+
return;
|
|
25
|
+
if (!this.initialIntensity) {
|
|
26
|
+
this.initialIntensity = this.environment.intensity;
|
|
27
|
+
}
|
|
28
|
+
this.environment.intensity = val;
|
|
29
|
+
};
|
|
30
|
+
this.appObjects.registerSingleton(this);
|
|
31
|
+
}
|
|
32
|
+
get environment() {
|
|
33
|
+
return this.getCachedSingleton(Environment_1.EnvironmentEntity.type);
|
|
34
|
+
}
|
|
35
|
+
get undo() {
|
|
36
|
+
return this.getCachedSingleton(UndoRedo_1.UndoRedoEntity.type);
|
|
37
|
+
}
|
|
38
|
+
get dispatchStateChange() {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = this.getCachedSingleton(Dispatcher_1.DispatchStateChangeUC.type)) === null || _a === void 0 ? void 0 : _a.doDispatch;
|
|
41
|
+
}
|
|
42
|
+
submit() {
|
|
43
|
+
var _a;
|
|
44
|
+
if (!this.initialIntensity)
|
|
45
|
+
return;
|
|
46
|
+
const dispatchStateChange = this.dispatchStateChange;
|
|
47
|
+
const environment = this.environment;
|
|
48
|
+
if (!environment || !dispatchStateChange) {
|
|
49
|
+
this.error("Missing component");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const undoIntensity = this.initialIntensity;
|
|
53
|
+
const redoIntensity = environment.intensity;
|
|
54
|
+
if (undoIntensity === redoIntensity)
|
|
55
|
+
return;
|
|
56
|
+
(_a = this.undo) === null || _a === void 0 ? void 0 : _a.submitAction({
|
|
57
|
+
undoAction: () => {
|
|
58
|
+
environment.intensity = undoIntensity;
|
|
59
|
+
dispatchStateChange();
|
|
60
|
+
},
|
|
61
|
+
redoAction: () => {
|
|
62
|
+
environment.intensity = redoIntensity;
|
|
63
|
+
dispatchStateChange();
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
dispatchStateChange();
|
|
67
|
+
this.initialIntensity = undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { Environments } from "../Entities/Environment";
|
|
3
|
+
export declare abstract class SetTexturalEnvironmentUC extends AppObjectUC {
|
|
4
|
+
static readonly type = "SetTexturalEnvironmentUC";
|
|
5
|
+
abstract setEnvironment(env: Environments): void;
|
|
6
|
+
static get(appObjects: AppObjectRepo): SetTexturalEnvironmentUC | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function makeSetTexturalEnvironmentUC(appObject: AppObject): SetTexturalEnvironmentUC;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeSetTexturalEnvironmentUC = exports.SetTexturalEnvironmentUC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const Dispatcher_1 = require("../../Dispatcher");
|
|
6
|
+
const UndoRedo_1 = require("../../UndoRedo");
|
|
7
|
+
const Environment_1 = require("../Entities/Environment");
|
|
8
|
+
class SetTexturalEnvironmentUC extends AppObject_1.AppObjectUC {
|
|
9
|
+
static get(appObjects) {
|
|
10
|
+
return AppObject_1.getSingletonComponent(SetTexturalEnvironmentUC.type, appObjects);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SetTexturalEnvironmentUC = SetTexturalEnvironmentUC;
|
|
14
|
+
SetTexturalEnvironmentUC.type = "SetTexturalEnvironmentUC";
|
|
15
|
+
function makeSetTexturalEnvironmentUC(appObject) {
|
|
16
|
+
return new SetTexturalEnvironmentUCImp(appObject);
|
|
17
|
+
}
|
|
18
|
+
exports.makeSetTexturalEnvironmentUC = makeSetTexturalEnvironmentUC;
|
|
19
|
+
class SetTexturalEnvironmentUCImp extends SetTexturalEnvironmentUC {
|
|
20
|
+
constructor(appObject) {
|
|
21
|
+
super(appObject, SetTexturalEnvironmentUC.type);
|
|
22
|
+
this.setEnvironment = (env) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const dispatchStateChange = this.dispatchStateChange;
|
|
25
|
+
const environment = this.environment;
|
|
26
|
+
if (!environment || !dispatchStateChange) {
|
|
27
|
+
this.error("Missing component");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (environment.currentEnvironment === env)
|
|
31
|
+
return;
|
|
32
|
+
const previousEnv = environment.currentEnvironment;
|
|
33
|
+
environment.currentEnvironment = env;
|
|
34
|
+
(_a = this.undo) === null || _a === void 0 ? void 0 : _a.submitAction({
|
|
35
|
+
undoAction: () => {
|
|
36
|
+
environment.currentEnvironment = previousEnv;
|
|
37
|
+
dispatchStateChange();
|
|
38
|
+
},
|
|
39
|
+
redoAction: () => {
|
|
40
|
+
environment.currentEnvironment = env;
|
|
41
|
+
dispatchStateChange();
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
dispatchStateChange();
|
|
45
|
+
};
|
|
46
|
+
this.appObjects.registerSingleton(this);
|
|
47
|
+
}
|
|
48
|
+
get environment() {
|
|
49
|
+
return this.getCachedSingleton(Environment_1.EnvironmentEntity.type);
|
|
50
|
+
}
|
|
51
|
+
get undo() {
|
|
52
|
+
return this.getCachedSingleton(UndoRedo_1.UndoRedoEntity.type);
|
|
53
|
+
}
|
|
54
|
+
get dispatchStateChange() {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = this.getCachedSingleton(Dispatcher_1.DispatchStateChangeUC.type)) === null || _a === void 0 ? void 0 : _a.doDispatch;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./SerializeEnvironment"), exports);
|
|
14
|
+
__exportStar(require("./SetEnvironmentIntensityUC"), exports);
|
|
15
|
+
__exportStar(require("./SetTexturalEnvironmentUC"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Adapters"), exports);
|
|
14
|
+
__exportStar(require("./Controllers"), exports);
|
|
15
|
+
__exportStar(require("./Entities"), exports);
|
|
16
|
+
__exportStar(require("./Factories"), exports);
|
|
17
|
+
__exportStar(require("./Mocks"), exports);
|
|
18
|
+
__exportStar(require("./PMs"), exports);
|
|
19
|
+
__exportStar(require("./UCs"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./questionAnswerAdapter"), exports);
|
|
14
|
+
__exportStar(require("./questionChallengeAdapter"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.questionAnswerAdapter = void 0;
|
|
4
|
+
const QuestionAnswerPM_1 = require("../PM/QuestionAnswerPM");
|
|
5
|
+
exports.questionAnswerAdapter = {
|
|
6
|
+
defaultVM: QuestionAnswerPM_1.defaultQuestionChallengeAnswerVM,
|
|
7
|
+
subscribe: (id, appObjects, setVM) => {
|
|
8
|
+
if (!id)
|
|
9
|
+
return;
|
|
10
|
+
const pm = QuestionAnswerPM_1.QuestionAnswerPM.getByID(id, appObjects);
|
|
11
|
+
if (!pm) {
|
|
12
|
+
appObjects.submitError("questionAnswerAdapter", "Unable to find QuestionAnswerPM");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
pm.addView(setVM);
|
|
16
|
+
},
|
|
17
|
+
unsubscribe: (id, appObjects, setVM) => {
|
|
18
|
+
if (!id)
|
|
19
|
+
return;
|
|
20
|
+
const pm = QuestionAnswerPM_1.QuestionAnswerPM.getByID(id, appObjects);
|
|
21
|
+
if (!pm) {
|
|
22
|
+
appObjects.submitError("questionAnswerAdapter", "Unable to find QuestionAnswerPM");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
pm.removeView(setVM);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.questionChallengeAdapter = void 0;
|
|
4
|
+
const QuestionChallengePM_1 = require("../PM/QuestionChallengePM");
|
|
5
|
+
exports.questionChallengeAdapter = {
|
|
6
|
+
defaultVM: QuestionChallengePM_1.defaultQuestionChallengeVM,
|
|
7
|
+
subscribe: (appObjects, setVM) => {
|
|
8
|
+
const pm = QuestionChallengePM_1.QuestionChallengePM.get(appObjects);
|
|
9
|
+
if (!pm) {
|
|
10
|
+
appObjects.submitError("questionChallengeAdapter", "Unable to find QuestionChallengePM");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
pm.addView(setVM);
|
|
14
|
+
},
|
|
15
|
+
unsubscribe: (appObjects, setVM) => {
|
|
16
|
+
const pm = QuestionChallengePM_1.QuestionChallengePM.get(appObjects);
|
|
17
|
+
if (!pm) {
|
|
18
|
+
appObjects.submitError("questionChallengeAdapter", "Unable to find QuestionChallengePM");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
pm.removeView(setVM);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./setupQuestionAnswer"), exports);
|
|
14
|
+
__exportStar(require("./setupQuestionChallenge"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupQuestionAnswer = void 0;
|
|
4
|
+
const Utilities_1 = require("../../../Utilities");
|
|
5
|
+
const Entities_1 = require("../Entities");
|
|
6
|
+
const PM_1 = require("../PM");
|
|
7
|
+
const UC_1 = require("../UC");
|
|
8
|
+
function setupQuestionAnswer(appObjects, id) {
|
|
9
|
+
const idToUse = id !== null && id !== void 0 ? id : Utilities_1.generateUniqueID();
|
|
10
|
+
const ao = appObjects.getOrCreate(idToUse);
|
|
11
|
+
const answerEntity = Entities_1.makeQuestionAnswerEntity(ao);
|
|
12
|
+
UC_1.makeSetAnswerFeedbackUC(ao);
|
|
13
|
+
UC_1.makeSetAnswerTextUC(ao);
|
|
14
|
+
UC_1.makeToggleQuestionChallengeAnswerIsCorrectUC(ao);
|
|
15
|
+
PM_1.makeQuestionAnswerPM(ao);
|
|
16
|
+
return answerEntity;
|
|
17
|
+
}
|
|
18
|
+
exports.setupQuestionAnswer = setupQuestionAnswer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupQuestionChallenge = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
const PM_1 = require("../PM");
|
|
6
|
+
const UC_1 = require("../UC");
|
|
7
|
+
const setupQuestionAnswer_1 = require("./setupQuestionAnswer");
|
|
8
|
+
function setupQuestionChallenge(appObjects) {
|
|
9
|
+
const ao = appObjects.getOrCreate("QuestionChallenge");
|
|
10
|
+
const questionEntity = Entities_1.makeQuestionEntity(ao);
|
|
11
|
+
UC_1.makeAddQuestionAnswerUC(ao);
|
|
12
|
+
UC_1.makeDeleteQuestionAnswerUC(ao);
|
|
13
|
+
UC_1.makeSubmitQuestionAnswerUC(ao);
|
|
14
|
+
new UC_1.SerializeQuestionChallenge(ao);
|
|
15
|
+
UC_1.makeValidateQuestionChallengeStateUC(ao);
|
|
16
|
+
PM_1.makeQuestionChallengePM(ao);
|
|
17
|
+
questionEntity.answerFactory = (id) => setupQuestionAnswer_1.setupQuestionAnswer(appObjects, id);
|
|
18
|
+
return questionEntity;
|
|
19
|
+
}
|
|
20
|
+
exports.setupQuestionChallenge = setupQuestionChallenge;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { QuestionAnswerPM } from "../PM/QuestionAnswerPM";
|
|
4
|
+
export declare class QuestionAnswerPmMock extends QuestionAnswerPM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: AppObject);
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuestionAnswerPmMock = void 0;
|
|
4
|
+
const QuestionAnswerPM_1 = require("../PM/QuestionAnswerPM");
|
|
5
|
+
class QuestionAnswerPmMock extends QuestionAnswerPM_1.QuestionAnswerPM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, QuestionAnswerPM_1.QuestionAnswerPM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.QuestionAnswerPmMock = QuestionAnswerPmMock;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject, AppObjectRepo } from "../../../AppObject";
|
|
3
|
+
import { QuestionChallengePM } from "../PM/QuestionChallengePM";
|
|
4
|
+
export declare class QuestionChallengePmMock extends QuestionChallengePM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: AppObject);
|
|
7
|
+
}
|
|
8
|
+
export declare function makeQuestionChallengePmMock(appObjects: AppObjectRepo): QuestionChallengePmMock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeQuestionChallengePmMock = exports.QuestionChallengePmMock = void 0;
|
|
4
|
+
const QuestionChallengePM_1 = require("../PM/QuestionChallengePM");
|
|
5
|
+
class QuestionChallengePmMock extends QuestionChallengePM_1.QuestionChallengePM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, QuestionChallengePM_1.QuestionChallengePM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.QuestionChallengePmMock = QuestionChallengePmMock;
|
|
12
|
+
function makeQuestionChallengePmMock(appObjects) {
|
|
13
|
+
return new QuestionChallengePmMock(appObjects.getOrCreate("QuestionChallengePmMock"));
|
|
14
|
+
}
|
|
15
|
+
exports.makeQuestionChallengePmMock = makeQuestionChallengePmMock;
|
|
@@ -12,3 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./MockQuestionAnswerEntity"), exports);
|
|
14
14
|
__exportStar(require("./MockValidateQuestion"), exports);
|
|
15
|
+
__exportStar(require("./QuestionAnswerPmMock"), exports);
|
|
16
|
+
__exportStar(require("./QuestionChallengePmMock"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AppObjectRepo } from "../../../AppObject";
|
|
1
2
|
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
3
|
import { AppObjectPM } from "../../../AppObject/AppObjectPM";
|
|
3
4
|
export declare const defaultQuestionChallengeAnswerVM: QuestionAnswerVM;
|
|
@@ -8,12 +9,9 @@ export interface QuestionAnswerVM {
|
|
|
8
9
|
textValidation?: string;
|
|
9
10
|
feedbackValidation?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare class QuestionAnswerPM extends AppObjectPM<QuestionAnswerVM> {
|
|
12
|
+
export declare abstract class QuestionAnswerPM extends AppObjectPM<QuestionAnswerVM> {
|
|
12
13
|
static readonly type = "QuestionAnswerPM";
|
|
13
14
|
static get(appObject: AppObject): QuestionAnswerPM | undefined;
|
|
14
|
-
|
|
15
|
-
vmsAreEqual(a: QuestionAnswerVM, b: QuestionAnswerVM): boolean;
|
|
16
|
-
dispose: () => void;
|
|
17
|
-
private onAnswerChange;
|
|
18
|
-
constructor(appObject: AppObject);
|
|
15
|
+
static getByID(id: string, appObjects: AppObjectRepo): QuestionAnswerPM | undefined;
|
|
19
16
|
}
|
|
17
|
+
export declare function makeQuestionAnswerPM(appObject: AppObject): QuestionAnswerPM;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuestionAnswerPM = exports.defaultQuestionChallengeAnswerVM = void 0;
|
|
3
|
+
exports.makeQuestionAnswerPM = exports.QuestionAnswerPM = exports.defaultQuestionChallengeAnswerVM = void 0;
|
|
4
4
|
const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
|
|
5
5
|
const QuestionAnswerEntity_1 = require("../Entities/QuestionAnswerEntity");
|
|
6
6
|
exports.defaultQuestionChallengeAnswerVM = {
|
|
@@ -9,6 +9,22 @@ exports.defaultQuestionChallengeAnswerVM = {
|
|
|
9
9
|
isCorrect: false,
|
|
10
10
|
};
|
|
11
11
|
class QuestionAnswerPM extends AppObjectPM_1.AppObjectPM {
|
|
12
|
+
static get(appObject) {
|
|
13
|
+
return appObject.getComponent(QuestionAnswerPM.type);
|
|
14
|
+
}
|
|
15
|
+
static getByID(id, appObjects) {
|
|
16
|
+
var _a;
|
|
17
|
+
return (_a = appObjects
|
|
18
|
+
.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(QuestionAnswerPM.type);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.QuestionAnswerPM = QuestionAnswerPM;
|
|
22
|
+
QuestionAnswerPM.type = "QuestionAnswerPM";
|
|
23
|
+
function makeQuestionAnswerPM(appObject) {
|
|
24
|
+
return new QuestionAnswerPMImp(appObject);
|
|
25
|
+
}
|
|
26
|
+
exports.makeQuestionAnswerPM = makeQuestionAnswerPM;
|
|
27
|
+
class QuestionAnswerPMImp extends QuestionAnswerPM {
|
|
12
28
|
constructor(appObject) {
|
|
13
29
|
super(appObject, QuestionAnswerPM.type);
|
|
14
30
|
this.dispose = () => {
|
|
@@ -29,17 +45,16 @@ class QuestionAnswerPM extends AppObjectPM_1.AppObjectPM {
|
|
|
29
45
|
};
|
|
30
46
|
this.doUpdateView(vm);
|
|
31
47
|
};
|
|
32
|
-
this.answer = appObject.getComponent(QuestionAnswerEntity_1.QuestionAnswerEntity.type);
|
|
33
48
|
if (this.answer) {
|
|
34
49
|
this.answer.addChangeObserver(this.onAnswerChange);
|
|
35
50
|
this.onAnswerChange();
|
|
36
51
|
}
|
|
37
52
|
else {
|
|
38
|
-
this.
|
|
53
|
+
this.error("QuestionAnswerPM has been added to an app object that does not have QuestionAnswerEntity");
|
|
39
54
|
}
|
|
40
55
|
}
|
|
41
|
-
|
|
42
|
-
return
|
|
56
|
+
get answer() {
|
|
57
|
+
return this.getCachedLocalComponent(QuestionAnswerEntity_1.QuestionAnswerEntity.type);
|
|
43
58
|
}
|
|
44
59
|
vmsAreEqual(a, b) {
|
|
45
60
|
if (a.answerText !== b.answerText)
|
|
@@ -55,5 +70,3 @@ class QuestionAnswerPM extends AppObjectPM_1.AppObjectPM {
|
|
|
55
70
|
return true;
|
|
56
71
|
}
|
|
57
72
|
}
|
|
58
|
-
exports.QuestionAnswerPM = QuestionAnswerPM;
|
|
59
|
-
QuestionAnswerPM.type = "QuestionAnswerPM";
|
|
@@ -9,13 +9,8 @@ export interface QuestionChallengeVM {
|
|
|
9
9
|
reviewFeedback: string;
|
|
10
10
|
validationMessage?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare class QuestionChallengePM extends AppObjectPM<QuestionChallengeVM> {
|
|
12
|
+
export declare abstract class QuestionChallengePM extends AppObjectPM<QuestionChallengeVM> {
|
|
13
13
|
static readonly type = "QuestionChallengePM";
|
|
14
14
|
static get: (appObjects: AppObjectRepo) => QuestionChallengePM | undefined;
|
|
15
|
-
private questionEntity?;
|
|
16
|
-
private baseAppState?;
|
|
17
|
-
private onEntityChange;
|
|
18
|
-
vmsAreEqual(a: QuestionChallengeVM, b: QuestionChallengeVM): boolean;
|
|
19
|
-
dispose: () => void;
|
|
20
|
-
constructor(appObject: AppObject);
|
|
21
15
|
}
|
|
16
|
+
export declare function makeQuestionChallengePM(appObject: AppObject): QuestionChallengePM;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuestionChallengePM = exports.defaultQuestionChallengeVM = exports.SLIDE_TEXT_CANNOT_BE_FALSY = void 0;
|
|
3
|
+
exports.makeQuestionChallengePM = exports.QuestionChallengePM = exports.defaultQuestionChallengeVM = exports.SLIDE_TEXT_CANNOT_BE_FALSY = void 0;
|
|
4
4
|
const AppObject_1 = require("../../../AppObject");
|
|
5
5
|
const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
|
|
6
6
|
const BaseApp_1 = require("../../BaseApp");
|
|
@@ -12,6 +12,15 @@ exports.defaultQuestionChallengeVM = {
|
|
|
12
12
|
reviewFeedback: "",
|
|
13
13
|
};
|
|
14
14
|
class QuestionChallengePM extends AppObjectPM_1.AppObjectPM {
|
|
15
|
+
}
|
|
16
|
+
exports.QuestionChallengePM = QuestionChallengePM;
|
|
17
|
+
QuestionChallengePM.type = "QuestionChallengePM";
|
|
18
|
+
QuestionChallengePM.get = (appObjects) => AppObject_1.getSingletonComponent(QuestionChallengePM.type, appObjects);
|
|
19
|
+
function makeQuestionChallengePM(appObject) {
|
|
20
|
+
return new QuestionChallengePMImp(appObject);
|
|
21
|
+
}
|
|
22
|
+
exports.makeQuestionChallengePM = makeQuestionChallengePM;
|
|
23
|
+
class QuestionChallengePMImp extends QuestionChallengePM {
|
|
15
24
|
constructor(appObject) {
|
|
16
25
|
super(appObject, QuestionChallengePM.type);
|
|
17
26
|
this.onEntityChange = () => {
|
|
@@ -39,24 +48,28 @@ class QuestionChallengePM extends AppObjectPM_1.AppObjectPM {
|
|
|
39
48
|
(_a = this.questionEntity) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onEntityChange);
|
|
40
49
|
(_b = this.baseAppState) === null || _b === void 0 ? void 0 : _b.removeChangeObserver(this.onEntityChange);
|
|
41
50
|
};
|
|
42
|
-
this.baseAppState = BaseApp_1.BaseAppState.get(this.appObjects);
|
|
43
51
|
if (!this.baseAppState) {
|
|
44
|
-
this.
|
|
52
|
+
this.error("Unable to find BaseAppStateEntity");
|
|
45
53
|
return;
|
|
46
54
|
}
|
|
47
55
|
else {
|
|
48
56
|
this.baseAppState.addChangeObserver(this.onEntityChange);
|
|
49
57
|
this.onEntityChange();
|
|
50
58
|
}
|
|
51
|
-
this.questionEntity = appObject.getComponent(QuestionEntity_1.QuestionEntity.type);
|
|
52
59
|
if (this.questionEntity) {
|
|
53
60
|
this.questionEntity.addChangeObserver(this.onEntityChange);
|
|
54
61
|
this.onEntityChange();
|
|
55
62
|
}
|
|
56
63
|
else {
|
|
57
|
-
this.
|
|
64
|
+
this.error("Unable to find QuestionEntity");
|
|
58
65
|
}
|
|
59
66
|
}
|
|
67
|
+
get questionEntity() {
|
|
68
|
+
return this.getCachedSingleton(QuestionEntity_1.QuestionEntity.type);
|
|
69
|
+
}
|
|
70
|
+
get baseAppState() {
|
|
71
|
+
return this.getCachedSingleton(BaseApp_1.BaseAppState.type);
|
|
72
|
+
}
|
|
60
73
|
vmsAreEqual(a, b) {
|
|
61
74
|
if (a.gotItRight !== b.gotItRight)
|
|
62
75
|
return false;
|
|
@@ -74,6 +87,3 @@ class QuestionChallengePM extends AppObjectPM_1.AppObjectPM {
|
|
|
74
87
|
return idsMatch;
|
|
75
88
|
}
|
|
76
89
|
}
|
|
77
|
-
exports.QuestionChallengePM = QuestionChallengePM;
|
|
78
|
-
QuestionChallengePM.type = "QuestionChallengePM";
|
|
79
|
-
QuestionChallengePM.get = (appObjects) => AppObject_1.getSingletonComponent(QuestionChallengePM.type, appObjects);
|
|
@@ -10,8 +10,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Adapters"), exports);
|
|
13
14
|
__exportStar(require("./Controllers"), exports);
|
|
14
15
|
__exportStar(require("./Entities"), exports);
|
|
16
|
+
__exportStar(require("./Factories"), exports);
|
|
15
17
|
__exportStar(require("./Mocks"), exports);
|
|
16
18
|
__exportStar(require("./PM"), exports);
|
|
17
19
|
__exportStar(require("./UC"), exports);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from "./BaseApp";
|
|
2
1
|
export * from "./Babylon";
|
|
2
|
+
export * from "./BaseApp";
|
|
3
3
|
export * from "./Callouts";
|
|
4
4
|
export * from "./Camera";
|
|
5
5
|
export * from "./Challenge";
|
|
6
6
|
export * from "./ChannelModel";
|
|
7
7
|
export * from "./Dispatcher";
|
|
8
8
|
export * from "./Enablement";
|
|
9
|
+
export * from "./Environment";
|
|
9
10
|
export * from "./FeatureFlags";
|
|
10
11
|
export * from "./FramedScreen";
|
|
11
12
|
export * from "./GLBModel";
|
package/lib/Components/index.js
CHANGED
|
@@ -10,14 +10,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./BaseApp"), exports);
|
|
14
13
|
__exportStar(require("./Babylon"), exports);
|
|
14
|
+
__exportStar(require("./BaseApp"), exports);
|
|
15
15
|
__exportStar(require("./Callouts"), exports);
|
|
16
16
|
__exportStar(require("./Camera"), exports);
|
|
17
17
|
__exportStar(require("./Challenge"), exports);
|
|
18
18
|
__exportStar(require("./ChannelModel"), exports);
|
|
19
19
|
__exportStar(require("./Dispatcher"), exports);
|
|
20
20
|
__exportStar(require("./Enablement"), exports);
|
|
21
|
+
__exportStar(require("./Environment"), exports);
|
|
21
22
|
__exportStar(require("./FeatureFlags"), exports);
|
|
22
23
|
__exportStar(require("./FramedScreen"), exports);
|
|
23
24
|
__exportStar(require("./GLBModel"), exports);
|