@vived/app 6.9.0 → 6.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/README.md +166 -145
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js +67 -0
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js +84 -0
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Callouts/Factories/index.js +1 -0
- package/dist/cjs/Callouts/Factories/index.js.map +1 -1
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js +52 -0
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +44 -0
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
- package/dist/cjs/ChannelModel/Factories/index.js +1 -0
- package/dist/cjs/ChannelModel/Factories/index.js.map +1 -1
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js +50 -0
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js +39 -0
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Environment/Factories/index.js +2 -1
- package/dist/cjs/Environment/Factories/index.js.map +1 -1
- package/dist/cjs/Environment/Factories/setupEnvironments.js +19 -0
- package/dist/cjs/Environment/Factories/setupEnvironments.js.map +1 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js +69 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js +116 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Hideable/Factories/index.js +1 -0
- package/dist/cjs/Hideable/Factories/index.js.map +1 -1
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js +79 -0
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +81 -0
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
- package/dist/cjs/HoverLabel/Factories/index.js +1 -0
- package/dist/cjs/HoverLabel/Factories/index.js.map +1 -1
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js +85 -0
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js +100 -0
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Landmarks/Factories/index.js +1 -0
- package/dist/cjs/Landmarks/Factories/index.js.map +1 -1
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js +57 -0
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js +60 -0
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Selection/Factories/index.js +1 -0
- package/dist/cjs/Selection/Factories/index.js.map +1 -1
- package/dist/cjs/Stick/Factories/StickFeatureFactory.js +45 -0
- package/dist/cjs/Stick/Factories/StickFeatureFactory.js.map +1 -0
- package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js +44 -0
- package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Stick/Factories/index.js +1 -0
- package/dist/cjs/Stick/Factories/index.js.map +1 -1
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js +48 -0
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js +39 -0
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
- package/dist/cjs/StoredView/Factories/index.js +1 -0
- package/dist/cjs/StoredView/Factories/index.js.map +1 -1
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js +47 -0
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js +35 -0
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Stylus/Factories/index.js +1 -0
- package/dist/cjs/Stylus/Factories/index.js.map +1 -1
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js +70 -0
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js +78 -0
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
- package/dist/cjs/zSpace/Factory/index.js +1 -0
- package/dist/cjs/zSpace/Factory/index.js.map +1 -1
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js +62 -0
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js +82 -0
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
- package/dist/esm/Callouts/Factories/index.js +1 -0
- package/dist/esm/Callouts/Factories/index.js.map +1 -1
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js +47 -0
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +42 -0
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
- package/dist/esm/ChannelModel/Factories/index.js +1 -0
- package/dist/esm/ChannelModel/Factories/index.js.map +1 -1
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js +45 -0
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js +37 -0
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
- package/dist/esm/Environment/Factories/index.js +2 -1
- package/dist/esm/Environment/Factories/index.js.map +1 -1
- package/dist/esm/Environment/Factories/setupEnvironments.js +16 -0
- package/dist/esm/Environment/Factories/setupEnvironments.js.map +1 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.js +64 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js +114 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
- package/dist/esm/Hideable/Factories/index.js +1 -0
- package/dist/esm/Hideable/Factories/index.js.map +1 -1
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js +74 -0
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +79 -0
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
- package/dist/esm/HoverLabel/Factories/index.js +1 -0
- package/dist/esm/HoverLabel/Factories/index.js.map +1 -1
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js +80 -0
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js +98 -0
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
- package/dist/esm/Landmarks/Factories/index.js +1 -0
- package/dist/esm/Landmarks/Factories/index.js.map +1 -1
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.js +52 -0
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js +58 -0
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
- package/dist/esm/Selection/Factories/index.js +1 -0
- package/dist/esm/Selection/Factories/index.js.map +1 -1
- package/dist/esm/Stick/Factories/StickFeatureFactory.js +40 -0
- package/dist/esm/Stick/Factories/StickFeatureFactory.js.map +1 -0
- package/dist/esm/Stick/Factories/StickFeatureFactory.test.js +42 -0
- package/dist/esm/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
- package/dist/esm/Stick/Factories/index.js +1 -0
- package/dist/esm/Stick/Factories/index.js.map +1 -1
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js +43 -0
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js +37 -0
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
- package/dist/esm/StoredView/Factories/index.js +1 -0
- package/dist/esm/StoredView/Factories/index.js.map +1 -1
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.js +42 -0
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js +33 -0
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
- package/dist/esm/Stylus/Factories/index.js +1 -0
- package/dist/esm/Stylus/Factories/index.js.map +1 -1
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js +65 -0
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js +76 -0
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
- package/dist/esm/zSpace/Factory/index.js +1 -0
- package/dist/esm/zSpace/Factory/index.js.map +1 -1
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts +24 -0
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts.map +1 -0
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts +2 -0
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Callouts/Factories/index.d.ts +1 -0
- package/dist/types/Callouts/Factories/index.d.ts.map +1 -1
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts +23 -0
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts.map +1 -0
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts +2 -0
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/ChannelModel/Factories/index.d.ts +1 -0
- package/dist/types/ChannelModel/Factories/index.d.ts.map +1 -1
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts +23 -0
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts.map +1 -0
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts +2 -0
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Environment/Factories/index.d.ts +2 -1
- package/dist/types/Environment/Factories/index.d.ts.map +1 -1
- package/dist/types/Environment/Factories/setupEnvironments.d.ts +3 -0
- package/dist/types/Environment/Factories/setupEnvironments.d.ts.map +1 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts +32 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts.map +1 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts +2 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Hideable/Factories/index.d.ts +1 -0
- package/dist/types/Hideable/Factories/index.d.ts.map +1 -1
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts +34 -0
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts.map +1 -0
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts +2 -0
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/HoverLabel/Factories/index.d.ts +1 -0
- package/dist/types/HoverLabel/Factories/index.d.ts.map +1 -1
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts +26 -0
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts.map +1 -0
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts +2 -0
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Landmarks/Factories/index.d.ts +1 -0
- package/dist/types/Landmarks/Factories/index.d.ts.map +1 -1
- package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts +27 -0
- package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts.map +1 -0
- package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts +2 -0
- package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Selection/Factories/index.d.ts +1 -0
- package/dist/types/Selection/Factories/index.d.ts.map +1 -1
- package/dist/types/Stick/Factories/StickFeatureFactory.d.ts +23 -0
- package/dist/types/Stick/Factories/StickFeatureFactory.d.ts.map +1 -0
- package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts +2 -0
- package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Stick/Factories/index.d.ts +1 -0
- package/dist/types/Stick/Factories/index.d.ts.map +1 -1
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts +23 -0
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts.map +1 -0
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts +2 -0
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/StoredView/Factories/index.d.ts +1 -0
- package/dist/types/StoredView/Factories/index.d.ts.map +1 -1
- package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts +23 -0
- package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts.map +1 -0
- package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts +2 -0
- package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Stylus/Factories/index.d.ts +1 -0
- package/dist/types/Stylus/Factories/index.d.ts.map +1 -1
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts +26 -0
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts.map +1 -0
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts +2 -0
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/zSpace/Factory/index.d.ts +1 -0
- package/dist/types/zSpace/Factory/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LandmarksFeatureFactory = void 0;
|
|
4
|
+
exports.makeLandmarksFeatureFactory = makeLandmarksFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Hideable_1 = require("../../Hideable");
|
|
7
|
+
const OverlayColor_1 = require("../../OverlayColor");
|
|
8
|
+
const Selection_1 = require("../../Selection");
|
|
9
|
+
const Tools_1 = require("../../Tools");
|
|
10
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
11
|
+
const Controller_1 = require("../Controller");
|
|
12
|
+
const Entities_1 = require("../Entities");
|
|
13
|
+
const UseCases_1 = require("../UseCases");
|
|
14
|
+
const landmarkRepoFactory_1 = require("./landmarkRepoFactory");
|
|
15
|
+
/**
|
|
16
|
+
* Factory responsible for setting up the Landmarks Feature domain components.
|
|
17
|
+
*
|
|
18
|
+
* Builds the same components as the legacy setupLandmarks function, split
|
|
19
|
+
* into the DomainFactory phases, including the "LandmarkPreview" AppObject.
|
|
20
|
+
* The LANDMARK tool is created in finalSetup, so its place in the toolbar
|
|
21
|
+
* follows the order the factories are registered.
|
|
22
|
+
*
|
|
23
|
+
* @extends DomainFactory
|
|
24
|
+
*/
|
|
25
|
+
class LandmarksFeatureFactory extends core_1.DomainFactory {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.factoryName = "LandmarksFeatureFactory";
|
|
29
|
+
}
|
|
30
|
+
get previewAO() {
|
|
31
|
+
return this.appObjects.getOrCreate("LandmarkPreview");
|
|
32
|
+
}
|
|
33
|
+
setupEntities() {
|
|
34
|
+
const globals = (0, Entities_1.makeLandmarkGlobals)(this.appObject);
|
|
35
|
+
globals.landmarkRepoFactory = (0, landmarkRepoFactory_1.makeLandmarkRepoFactory)(this.appObjects);
|
|
36
|
+
const preview = (0, Entities_1.makeLandmarkEntity)(this.previewAO);
|
|
37
|
+
const previewHidable = Hideable_1.Hideable.get(this.previewAO.id, this.appObjects);
|
|
38
|
+
if (previewHidable) {
|
|
39
|
+
previewHidable.ignoreSerialization = true;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.appObjects.submitError(this.factoryName, "Unable to find Hideable on preview landmark");
|
|
43
|
+
}
|
|
44
|
+
globals.previewLandmark = preview;
|
|
45
|
+
}
|
|
46
|
+
setupUCs() {
|
|
47
|
+
new UseCases_1.SerializeLandmarks(this.appObject);
|
|
48
|
+
(0, UseCases_1.makeDeleteAllLandmarksUC)(this.appObject);
|
|
49
|
+
(0, UseCases_1.makeTryAddLandmarkUC)(this.appObject);
|
|
50
|
+
(0, UseCases_1.makeTryPreviewLandmark)(this.previewAO);
|
|
51
|
+
}
|
|
52
|
+
setupPMs() {
|
|
53
|
+
const previewAO = this.previewAO;
|
|
54
|
+
(0, Transform3D_1.makeTransform3DPM)(previewAO);
|
|
55
|
+
(0, OverlayColor_1.makeOverlayColorPM)(previewAO);
|
|
56
|
+
(0, Selection_1.makeSelectableStatePM)(previewAO);
|
|
57
|
+
(0, Hideable_1.makeIsHiddenPM)(previewAO);
|
|
58
|
+
}
|
|
59
|
+
finalSetup() {
|
|
60
|
+
(0, Controller_1.makeMouseLandmark)(this.appObject);
|
|
61
|
+
(0, Controller_1.makeTouchLandmark)(this.appObject);
|
|
62
|
+
const toolRepo = Tools_1.ToolRepository.get(this.appObjects);
|
|
63
|
+
if (!toolRepo) {
|
|
64
|
+
this.appObjects.submitError(this.factoryName, "Unable to find tool repo");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
toolRepo.makeToolFromData({
|
|
68
|
+
toolType: "LANDMARK",
|
|
69
|
+
isDefault: false,
|
|
70
|
+
label: "Landmark",
|
|
71
|
+
shortcutLabel: "l",
|
|
72
|
+
hotkeys: [{ keyCode: "KeyL" }],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.LandmarksFeatureFactory = LandmarksFeatureFactory;
|
|
77
|
+
/**
|
|
78
|
+
* Factory function to create a new LandmarksFeatureFactory
|
|
79
|
+
* @param appObjects The AppObjectRepo to get or create the Landmarks AppObject from
|
|
80
|
+
* @returns A new LandmarksFeatureFactory instance
|
|
81
|
+
*/
|
|
82
|
+
function makeLandmarksFeatureFactory(appObjects) {
|
|
83
|
+
return new LandmarksFeatureFactory(appObjects.getOrCreate("Landmarks"));
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=LandmarksFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandmarksFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/LandmarksFeatureFactory.ts"],"names":[],"mappings":";;;AA6FA,kEAIC;AAjGD,sCAAsE;AACtE,6CAA0D;AAC1D,qDAAwD;AACxD,+CAAwD;AACxD,uCAA6C;AAC7C,mDAAsD;AACtD,8CAAqE;AACrE,0CAAsE;AACtE,0CAKqB;AACrB,+DAAgE;AAEhE;;;;;;;;;GASG;AACH,MAAa,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C;QACjC,IAAA,yBAAc,EAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,UAAU;QACR,IAAA,8BAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,IAAA,8BAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAElC,MAAM,QAAQ,GAAG,sBAAc,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;YAC1E,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC;YACxB,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,UAAU;YACjB,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AA5DD,0DA4DC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CACzC,UAAyB;IAEzB,OAAO,IAAI,uBAAuB,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { AppObject, AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { Hideable, makeIsHiddenPM } from \"../../Hideable\";\r\nimport { makeOverlayColorPM } from \"../../OverlayColor\";\r\nimport { makeSelectableStatePM } from \"../../Selection\";\r\nimport { ToolRepository } from \"../../Tools\";\r\nimport { makeTransform3DPM } from \"../../Transform3D\";\r\nimport { makeMouseLandmark, makeTouchLandmark } from \"../Controller\";\r\nimport { makeLandmarkEntity, makeLandmarkGlobals } from \"../Entities\";\r\nimport {\r\n makeDeleteAllLandmarksUC,\r\n makeTryAddLandmarkUC,\r\n makeTryPreviewLandmark,\r\n SerializeLandmarks,\r\n} from \"../UseCases\";\r\nimport { makeLandmarkRepoFactory } from \"./landmarkRepoFactory\";\r\n\r\n/**\r\n * Factory responsible for setting up the Landmarks Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupLandmarks function, split\r\n * into the DomainFactory phases, including the \"LandmarkPreview\" AppObject.\r\n * The LANDMARK tool is created in finalSetup, so its place in the toolbar\r\n * follows the order the factories are registered.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class LandmarksFeatureFactory extends DomainFactory {\r\n factoryName = \"LandmarksFeatureFactory\";\r\n\r\n private get previewAO(): AppObject {\r\n return this.appObjects.getOrCreate(\"LandmarkPreview\");\r\n }\r\n\r\n setupEntities(): void {\r\n const globals = makeLandmarkGlobals(this.appObject);\r\n globals.landmarkRepoFactory = makeLandmarkRepoFactory(this.appObjects);\r\n\r\n const preview = makeLandmarkEntity(this.previewAO);\r\n\r\n const previewHidable = Hideable.get(this.previewAO.id, this.appObjects);\r\n if (previewHidable) {\r\n previewHidable.ignoreSerialization = true;\r\n } else {\r\n this.appObjects.submitError(\r\n this.factoryName,\r\n \"Unable to find Hideable on preview landmark\",\r\n );\r\n }\r\n\r\n globals.previewLandmark = preview;\r\n }\r\n\r\n setupUCs(): void {\r\n new SerializeLandmarks(this.appObject);\r\n makeDeleteAllLandmarksUC(this.appObject);\r\n makeTryAddLandmarkUC(this.appObject);\r\n\r\n makeTryPreviewLandmark(this.previewAO);\r\n }\r\n\r\n setupPMs(): void {\r\n const previewAO = this.previewAO;\r\n makeTransform3DPM(previewAO);\r\n makeOverlayColorPM(previewAO);\r\n makeSelectableStatePM(previewAO);\r\n makeIsHiddenPM(previewAO);\r\n }\r\n\r\n finalSetup(): void {\r\n makeMouseLandmark(this.appObject);\r\n makeTouchLandmark(this.appObject);\r\n\r\n const toolRepo = ToolRepository.get(this.appObjects);\r\n if (!toolRepo) {\r\n this.appObjects.submitError(this.factoryName, \"Unable to find tool repo\");\r\n return;\r\n }\r\n\r\n toolRepo.makeToolFromData({\r\n toolType: \"LANDMARK\",\r\n isDefault: false,\r\n label: \"Landmark\",\r\n shortcutLabel: \"l\",\r\n hotkeys: [{ keyCode: \"KeyL\" }],\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new LandmarksFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Landmarks AppObject from\r\n * @returns A new LandmarksFeatureFactory instance\r\n */\r\nexport function makeLandmarksFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): LandmarksFeatureFactory {\r\n return new LandmarksFeatureFactory(appObjects.getOrCreate(\"Landmarks\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const BaseAppState_1 = require("../../BaseApp/Entity/BaseAppState");
|
|
5
|
+
const Callouts_1 = require("../../Callouts");
|
|
6
|
+
const Hideable_1 = require("../../Hideable");
|
|
7
|
+
const KeyboardInput_1 = require("../../KeyboardInput");
|
|
8
|
+
const MouseInput_1 = require("../../MouseInput");
|
|
9
|
+
const Selection_1 = require("../../Selection");
|
|
10
|
+
const StateMachine_1 = require("../../StateMachine");
|
|
11
|
+
const Tools_1 = require("../../Tools");
|
|
12
|
+
const TouchController_1 = require("../../TouchController");
|
|
13
|
+
const Entities_1 = require("../Entities");
|
|
14
|
+
const LandmarksFeatureFactory_1 = require("./LandmarksFeatureFactory");
|
|
15
|
+
const setupLandmarks_1 = require("./setupLandmarks");
|
|
16
|
+
function makeTestRig() {
|
|
17
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
18
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
19
|
+
const mockError = jest.fn();
|
|
20
|
+
appObjects.submitError = mockError;
|
|
21
|
+
return { appObjects, factories, mockError };
|
|
22
|
+
}
|
|
23
|
+
function registerCollaborators(appObjects) {
|
|
24
|
+
(0, KeyboardInput_1.makeKeyboardInputFeatureFactory)(appObjects);
|
|
25
|
+
(0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
|
|
26
|
+
(0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
|
|
27
|
+
(0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
|
|
28
|
+
(0, BaseAppState_1.makeBaseAppState)(appObjects.getOrCreate("BaseApp"));
|
|
29
|
+
(0, Selection_1.makeSelectionFeatureFactory)(appObjects);
|
|
30
|
+
}
|
|
31
|
+
function componentTypes(appObjects) {
|
|
32
|
+
const types = {};
|
|
33
|
+
appObjects.getAll().forEach((ao) => {
|
|
34
|
+
types[ao.id] = ao
|
|
35
|
+
.allComponents()
|
|
36
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
37
|
+
.map((c) => c.type)
|
|
38
|
+
.sort();
|
|
39
|
+
});
|
|
40
|
+
return types;
|
|
41
|
+
}
|
|
42
|
+
function toolTypes(appObjects) {
|
|
43
|
+
return Tools_1.ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
|
|
44
|
+
}
|
|
45
|
+
describe("LandmarksFeatureFactory", () => {
|
|
46
|
+
it("Builds the same components as setupLandmarks", () => {
|
|
47
|
+
const legacy = makeTestRig();
|
|
48
|
+
registerCollaborators(legacy.appObjects);
|
|
49
|
+
(0, Tools_1.makeToolsFeatureFactory)(legacy.appObjects);
|
|
50
|
+
legacy.factories.setupDomain();
|
|
51
|
+
(0, setupLandmarks_1.setupLandmarks)(legacy.appObjects);
|
|
52
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
53
|
+
registerCollaborators(appObjects);
|
|
54
|
+
(0, Tools_1.makeToolsFeatureFactory)(appObjects);
|
|
55
|
+
(0, LandmarksFeatureFactory_1.makeLandmarksFeatureFactory)(appObjects);
|
|
56
|
+
factories.setupDomain();
|
|
57
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
58
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
59
|
+
});
|
|
60
|
+
it("Sets up the preview landmark", () => {
|
|
61
|
+
const { appObjects, factories } = makeTestRig();
|
|
62
|
+
registerCollaborators(appObjects);
|
|
63
|
+
(0, Tools_1.makeToolsFeatureFactory)(appObjects);
|
|
64
|
+
(0, LandmarksFeatureFactory_1.makeLandmarksFeatureFactory)(appObjects);
|
|
65
|
+
factories.setupDomain();
|
|
66
|
+
const preview = Entities_1.LandmarkGlobals.get(appObjects).previewLandmark;
|
|
67
|
+
expect(preview?.appObject.id).toEqual("LandmarkPreview");
|
|
68
|
+
expect(Hideable_1.Hideable.get("LandmarkPreview", appObjects).ignoreSerialization).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
it("Creates the LANDMARK tool in finalSetup", () => {
|
|
71
|
+
const { appObjects, factories } = makeTestRig();
|
|
72
|
+
registerCollaborators(appObjects);
|
|
73
|
+
(0, Tools_1.makeToolsFeatureFactory)(appObjects);
|
|
74
|
+
(0, LandmarksFeatureFactory_1.makeLandmarksFeatureFactory)(appObjects);
|
|
75
|
+
const all = factories.getAll();
|
|
76
|
+
all.forEach((f) => f.setupEntities());
|
|
77
|
+
all.forEach((f) => f.setupUCs());
|
|
78
|
+
all.forEach((f) => f.setupPMs());
|
|
79
|
+
expect(Tools_1.ToolRepository.get(appObjects).getTool("LANDMARK")).toBeUndefined();
|
|
80
|
+
all.forEach((f) => f.finalSetup());
|
|
81
|
+
expect(Tools_1.ToolRepository.get(appObjects).getTool("LANDMARK")).toBeDefined();
|
|
82
|
+
});
|
|
83
|
+
it("Creates tools in factory registration order", () => {
|
|
84
|
+
const first = makeTestRig();
|
|
85
|
+
registerCollaborators(first.appObjects);
|
|
86
|
+
(0, LandmarksFeatureFactory_1.makeLandmarksFeatureFactory)(first.appObjects);
|
|
87
|
+
(0, Callouts_1.makeCalloutsFeatureFactory)(first.appObjects);
|
|
88
|
+
(0, Tools_1.makeToolsFeatureFactory)(first.appObjects);
|
|
89
|
+
first.factories.setupDomain();
|
|
90
|
+
const second = makeTestRig();
|
|
91
|
+
registerCollaborators(second.appObjects);
|
|
92
|
+
(0, Callouts_1.makeCalloutsFeatureFactory)(second.appObjects);
|
|
93
|
+
(0, LandmarksFeatureFactory_1.makeLandmarksFeatureFactory)(second.appObjects);
|
|
94
|
+
(0, Tools_1.makeToolsFeatureFactory)(second.appObjects);
|
|
95
|
+
second.factories.setupDomain();
|
|
96
|
+
expect(toolTypes(first.appObjects)).toEqual(["LANDMARK", "CALLOUT"]);
|
|
97
|
+
expect(toolTypes(second.appObjects)).toEqual(["CALLOUT", "LANDMARK"]);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=LandmarksFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandmarksFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/LandmarksFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,oEAAqE;AACrE,6CAA4D;AAC5D,6CAA0C;AAC1C,uDAAsE;AACtE,iDAAgE;AAChE,+CAA8D;AAC9D,qDAAoE;AACpE,uCAAsE;AACtE,2DAA0E;AAC1E,0CAA8C;AAC9C,uEAAwE;AACxE,qDAAkD;AAElD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAyB;IACtD,IAAA,+CAA+B,EAAC,UAAU,CAAC,CAAC;IAC5C,IAAA,yCAA4B,EAAC,UAAU,CAAC,CAAC;IACzC,IAAA,mDAAiC,EAAC,UAAU,CAAC,CAAC;IAC9C,IAAA,6CAA8B,EA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C;QAC/C,IAAA,+BAAuB,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAE/B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeBaseAppState } from \"../../BaseApp/Entity/BaseAppState\";\r\nimport { makeCalloutsFeatureFactory } from \"../../Callouts\";\r\nimport { Hideable } from \"../../Hideable\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeSelectionFeatureFactory } from \"../../Selection\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeToolsFeatureFactory, ToolRepository } from \"../../Tools\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { LandmarkGlobals } from \"../Entities\";\r\nimport { makeLandmarksFeatureFactory } from \"./LandmarksFeatureFactory\";\r\nimport { setupLandmarks } from \"./setupLandmarks\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeKeyboardInputFeatureFactory(appObjects);\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n makeStateMachineFeatureFactory(appObjects);\r\n makeBaseAppState(appObjects.getOrCreate(\"BaseApp\"));\r\n makeSelectionFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\nfunction toolTypes(appObjects: AppObjectRepo) {\r\n return ToolRepository.get(appObjects)!.allTools.map((t) => t.toolType);\r\n}\r\n\r\ndescribe(\"LandmarksFeatureFactory\", () => {\r\n it(\"Builds the same components as setupLandmarks\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeToolsFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupLandmarks(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeLandmarksFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Sets up the preview landmark\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeLandmarksFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n const preview = LandmarkGlobals.get(appObjects)!.previewLandmark;\r\n expect(preview?.appObject.id).toEqual(\"LandmarkPreview\");\r\n expect(\r\n Hideable.get(\"LandmarkPreview\", appObjects)!.ignoreSerialization,\r\n ).toBe(true);\r\n });\r\n\r\n it(\"Creates the LANDMARK tool in finalSetup\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeLandmarksFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n all.forEach((f) => f.setupPMs());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"LANDMARK\")).toBeUndefined();\r\n\r\n all.forEach((f) => f.finalSetup());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"LANDMARK\")).toBeDefined();\r\n });\r\n\r\n it(\"Creates tools in factory registration order\", () => {\r\n const first = makeTestRig();\r\n registerCollaborators(first.appObjects);\r\n makeLandmarksFeatureFactory(first.appObjects);\r\n makeCalloutsFeatureFactory(first.appObjects);\r\n makeToolsFeatureFactory(first.appObjects);\r\n first.factories.setupDomain();\r\n\r\n const second = makeTestRig();\r\n registerCollaborators(second.appObjects);\r\n makeCalloutsFeatureFactory(second.appObjects);\r\n makeLandmarksFeatureFactory(second.appObjects);\r\n makeToolsFeatureFactory(second.appObjects);\r\n second.factories.setupDomain();\r\n\r\n expect(toolTypes(first.appObjects)).toEqual([\"LANDMARK\", \"CALLOUT\"]);\r\n expect(toolTypes(second.appObjects)).toEqual([\"CALLOUT\", \"LANDMARK\"]);\r\n });\r\n});\r\n"]}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./landmarkFactory"), exports);
|
|
18
18
|
__exportStar(require("./landmarkRepoFactory"), exports);
|
|
19
19
|
__exportStar(require("./setupLandmarks"), exports);
|
|
20
|
+
__exportStar(require("./LandmarksFeatureFactory"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC;AACtC,mDAAiC","sourcesContent":["export * from \"./landmarkFactory\";\nexport * from \"./landmarkRepoFactory\";\nexport * from \"./setupLandmarks\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC;AACtC,mDAAiC;AACjC,4DAA0C","sourcesContent":["export * from \"./landmarkFactory\";\r\nexport * from \"./landmarkRepoFactory\";\r\nexport * from \"./setupLandmarks\";\r\nexport * from \"./LandmarksFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectionFeatureFactory = void 0;
|
|
4
|
+
exports.makeSelectionFeatureFactory = makeSelectionFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Controller_1 = require("../Controller");
|
|
7
|
+
const Entities_1 = require("../Entities");
|
|
8
|
+
const PM_1 = require("../PM");
|
|
9
|
+
const UC_1 = require("../UC");
|
|
10
|
+
/**
|
|
11
|
+
* Factory responsible for setting up the Selection Feature domain components.
|
|
12
|
+
*
|
|
13
|
+
* Builds the same components as the legacy setupSelection function, split
|
|
14
|
+
* into the DomainFactory phases.
|
|
15
|
+
*
|
|
16
|
+
* The Hover, Press and Select UCs exist after setupUCs. An app that overrides
|
|
17
|
+
* their allow* hooks can do so from its own factory's setupPMs or finalSetup,
|
|
18
|
+
* through HoverAppObjectUC.get, PressAppObjectUC.get and SelectAppObjectUC.get.
|
|
19
|
+
*
|
|
20
|
+
* @extends DomainFactory
|
|
21
|
+
*/
|
|
22
|
+
class SelectionFeatureFactory extends core_1.DomainFactory {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.factoryName = "SelectionFeatureFactory";
|
|
26
|
+
}
|
|
27
|
+
setupEntities() {
|
|
28
|
+
(0, Entities_1.makeSelection)(this.appObject);
|
|
29
|
+
}
|
|
30
|
+
setupUCs() {
|
|
31
|
+
new UC_1.ClearSelectionUCHook(this.appObject);
|
|
32
|
+
(0, UC_1.makeHoverAppObject)(this.appObject);
|
|
33
|
+
(0, UC_1.makePressAppObject)(this.appObject);
|
|
34
|
+
(0, UC_1.makeSelectAppObject)(this.appObject);
|
|
35
|
+
}
|
|
36
|
+
setupPMs() {
|
|
37
|
+
(0, PM_1.makeSelectedObjectPM)(this.appObject);
|
|
38
|
+
}
|
|
39
|
+
finalSetup() {
|
|
40
|
+
new Controller_1.MouseHoverOnAppObject(this.appObject);
|
|
41
|
+
new Controller_1.MousePressOnAppObject(this.appObject);
|
|
42
|
+
new Controller_1.TouchPressOnAppObject(this.appObject);
|
|
43
|
+
new Controller_1.MouseSelectAppObject(this.appObject);
|
|
44
|
+
new Controller_1.TapToSelectAppObject(this.appObject);
|
|
45
|
+
new Controller_1.KeyboardToClearSelection(this.appObject);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SelectionFeatureFactory = SelectionFeatureFactory;
|
|
49
|
+
/**
|
|
50
|
+
* Factory function to create a new SelectionFeatureFactory
|
|
51
|
+
* @param appObjects The AppObjectRepo to get or create the Selection AppObject from
|
|
52
|
+
* @returns A new SelectionFeatureFactory instance
|
|
53
|
+
*/
|
|
54
|
+
function makeSelectionFeatureFactory(appObjects) {
|
|
55
|
+
return new SelectionFeatureFactory(appObjects.getOrCreate("Selection"));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=SelectionFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/SelectionFeatureFactory.ts"],"names":[],"mappings":";;;AA+DA,kEAIC;AAnED,sCAA2D;AAC3D,8CAOuB;AACvB,0CAA4C;AAC5C,8BAA6C;AAC7C,8BAKe;AAEf;;;;;;;;;;;GAWG;AACH,MAAa,uBAAwB,SAAQ,oBAAa;IAA1D;;QACE,gBAAW,GAAG,yBAAyB,CAAC;IAyB1C,CAAC;IAvBC,aAAa;QACX,IAAA,wBAAa,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ;QACN,IAAI,yBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAA,uBAAkB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,IAAA,uBAAkB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,IAAA,wBAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,IAAA,yBAAoB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,UAAU;QACR,IAAI,kCAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,kCAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,kCAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,iCAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,iCAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,qCAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF;AA1BD,0DA0BC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CACzC,UAAyB;IAEzB,OAAO,IAAI,uBAAuB,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport {\r\n KeyboardToClearSelection,\r\n MouseHoverOnAppObject,\r\n MousePressOnAppObject,\r\n MouseSelectAppObject,\r\n TapToSelectAppObject,\r\n TouchPressOnAppObject,\r\n} from \"../Controller\";\r\nimport { makeSelection } from \"../Entities\";\r\nimport { makeSelectedObjectPM } from \"../PM\";\r\nimport {\r\n ClearSelectionUCHook,\r\n makeHoverAppObject,\r\n makePressAppObject,\r\n makeSelectAppObject,\r\n} from \"../UC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Selection Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupSelection function, split\r\n * into the DomainFactory phases.\r\n *\r\n * The Hover, Press and Select UCs exist after setupUCs. An app that overrides\r\n * their allow* hooks can do so from its own factory's setupPMs or finalSetup,\r\n * through HoverAppObjectUC.get, PressAppObjectUC.get and SelectAppObjectUC.get.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class SelectionFeatureFactory extends DomainFactory {\r\n factoryName = \"SelectionFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeSelection(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n new ClearSelectionUCHook(this.appObject);\r\n makeHoverAppObject(this.appObject);\r\n makePressAppObject(this.appObject);\r\n makeSelectAppObject(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeSelectedObjectPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n new MouseHoverOnAppObject(this.appObject);\r\n new MousePressOnAppObject(this.appObject);\r\n new TouchPressOnAppObject(this.appObject);\r\n new MouseSelectAppObject(this.appObject);\r\n new TapToSelectAppObject(this.appObject);\r\n new KeyboardToClearSelection(this.appObject);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new SelectionFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Selection AppObject from\r\n * @returns A new SelectionFeatureFactory instance\r\n */\r\nexport function makeSelectionFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): SelectionFeatureFactory {\r\n return new SelectionFeatureFactory(appObjects.getOrCreate(\"Selection\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const BaseAppState_1 = require("../../BaseApp/Entity/BaseAppState");
|
|
5
|
+
const KeyboardInput_1 = require("../../KeyboardInput");
|
|
6
|
+
const MouseInput_1 = require("../../MouseInput");
|
|
7
|
+
const TouchController_1 = require("../../TouchController");
|
|
8
|
+
const UC_1 = require("../UC");
|
|
9
|
+
const SelectionFeatureFactory_1 = require("./SelectionFeatureFactory");
|
|
10
|
+
const setupSelection_1 = require("./setupSelection");
|
|
11
|
+
function makeTestRig() {
|
|
12
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
13
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
14
|
+
const mockError = jest.fn();
|
|
15
|
+
appObjects.submitError = mockError;
|
|
16
|
+
return { appObjects, factories, mockError };
|
|
17
|
+
}
|
|
18
|
+
function registerCollaborators(appObjects) {
|
|
19
|
+
(0, BaseAppState_1.makeBaseAppState)(appObjects.getOrCreate("BaseApp"));
|
|
20
|
+
(0, KeyboardInput_1.makeKeyboardInputFeatureFactory)(appObjects);
|
|
21
|
+
(0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
|
|
22
|
+
(0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
|
|
23
|
+
}
|
|
24
|
+
function componentTypes(appObjects) {
|
|
25
|
+
const types = {};
|
|
26
|
+
appObjects.getAll().forEach((ao) => {
|
|
27
|
+
types[ao.id] = ao
|
|
28
|
+
.allComponents()
|
|
29
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
30
|
+
.map((c) => c.type)
|
|
31
|
+
.sort();
|
|
32
|
+
});
|
|
33
|
+
return types;
|
|
34
|
+
}
|
|
35
|
+
describe("SelectionFeatureFactory", () => {
|
|
36
|
+
it("Builds the same components as setupSelection", () => {
|
|
37
|
+
const legacy = makeTestRig();
|
|
38
|
+
registerCollaborators(legacy.appObjects);
|
|
39
|
+
legacy.factories.setupDomain();
|
|
40
|
+
(0, setupSelection_1.setupSelection)(legacy.appObjects);
|
|
41
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
42
|
+
registerCollaborators(appObjects);
|
|
43
|
+
(0, SelectionFeatureFactory_1.makeSelectionFeatureFactory)(appObjects);
|
|
44
|
+
factories.setupDomain();
|
|
45
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
46
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
47
|
+
});
|
|
48
|
+
it("Builds the Hover, Press and Select UCs in setupUCs, so a later phase can override their allow hooks", () => {
|
|
49
|
+
const { appObjects, factories } = makeTestRig();
|
|
50
|
+
registerCollaborators(appObjects);
|
|
51
|
+
(0, SelectionFeatureFactory_1.makeSelectionFeatureFactory)(appObjects);
|
|
52
|
+
const all = factories.getAll();
|
|
53
|
+
all.forEach((f) => f.setupEntities());
|
|
54
|
+
all.forEach((f) => f.setupUCs());
|
|
55
|
+
expect(UC_1.HoverAppObjectUC.get(appObjects)).toBeDefined();
|
|
56
|
+
expect(UC_1.PressAppObjectUC.get(appObjects)).toBeDefined();
|
|
57
|
+
expect(UC_1.SelectAppObjectUC.get(appObjects)).toBeDefined();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=SelectionFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/SelectionFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,oEAAqE;AACrE,uDAAsE;AACtE,iDAAgE;AAChE,2DAA0E;AAC1E,8BAA8E;AAC9E,uEAAwE;AACxE,qDAAkD;AAElD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,E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W,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qGAAqG,EAAE,GAAG,EAAE;QAC7G,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,qDAA2B,EAAC,UAAU,CAAC,CAAC;QAExC,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;QAC/B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEjC,MAAM,CAAC,qBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,CAAC,qBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,CAAC,sBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeBaseAppState } from \"../../BaseApp/Entity/BaseAppState\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { HoverAppObjectUC, PressAppObjectUC, SelectAppObjectUC } from \"../UC\";\r\nimport { makeSelectionFeatureFactory } from \"./SelectionFeatureFactory\";\r\nimport { setupSelection } from \"./setupSelection\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeBaseAppState(appObjects.getOrCreate(\"BaseApp\"));\r\n makeKeyboardInputFeatureFactory(appObjects);\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"SelectionFeatureFactory\", () => {\r\n it(\"Builds the same components as setupSelection\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupSelection(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeSelectionFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Builds the Hover, Press and Select UCs in setupUCs, so a later phase can override their allow hooks\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeSelectionFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n\r\n expect(HoverAppObjectUC.get(appObjects)).toBeDefined();\r\n expect(PressAppObjectUC.get(appObjects)).toBeDefined();\r\n expect(SelectAppObjectUC.get(appObjects)).toBeDefined();\r\n });\r\n});\r\n"]}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./setupSelection"), exports);
|
|
18
|
+
__exportStar(require("./SelectionFeatureFactory"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC","sourcesContent":["export * from \"./setupSelection\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,4DAA0C","sourcesContent":["export * from \"./setupSelection\";\r\nexport * from \"./SelectionFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StickFeatureFactory = void 0;
|
|
4
|
+
exports.makeStickFeatureFactory = makeStickFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const DoubleClickToStickMC_1 = require("../Controllers/DoubleClickToStickMC");
|
|
7
|
+
const DoubleTapToStickTC_1 = require("../Controllers/DoubleTapToStickTC");
|
|
8
|
+
const TryStickAppObjectUC_1 = require("../UCs/TryStickAppObjectUC");
|
|
9
|
+
/**
|
|
10
|
+
* Factory responsible for setting up the Stick Feature domain components.
|
|
11
|
+
*
|
|
12
|
+
* Builds the same components as the legacy setupStick function, split into
|
|
13
|
+
* the DomainFactory phases.
|
|
14
|
+
*
|
|
15
|
+
* @extends DomainFactory
|
|
16
|
+
*/
|
|
17
|
+
class StickFeatureFactory extends core_1.DomainFactory {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.factoryName = "StickFeatureFactory";
|
|
21
|
+
}
|
|
22
|
+
setupEntities() {
|
|
23
|
+
// No entities for this feature
|
|
24
|
+
}
|
|
25
|
+
setupUCs() {
|
|
26
|
+
(0, TryStickAppObjectUC_1.makeTryStickAppObjectUC)(this.appObject);
|
|
27
|
+
}
|
|
28
|
+
setupPMs() {
|
|
29
|
+
// No PMs for this feature
|
|
30
|
+
}
|
|
31
|
+
finalSetup() {
|
|
32
|
+
new DoubleClickToStickMC_1.DoubleClickToStickMC(this.appObject);
|
|
33
|
+
new DoubleTapToStickTC_1.DoubleTapToStickTC(this.appObject);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.StickFeatureFactory = StickFeatureFactory;
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create a new StickFeatureFactory
|
|
39
|
+
* @param appObjects The AppObjectRepo to get or create the Stick AppObject from
|
|
40
|
+
* @returns A new StickFeatureFactory instance
|
|
41
|
+
*/
|
|
42
|
+
function makeStickFeatureFactory(appObjects) {
|
|
43
|
+
return new StickFeatureFactory(appObjects.getOrCreate("Stick"));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=StickFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/StickFeatureFactory.ts"],"names":[],"mappings":";;;AAuCA,0DAIC;AA3CD,sCAA2D;AAC3D,8EAA2E;AAC3E,0EAAuE;AACvE,oEAAqE;AAErE;;;;;;;GAOG;AACH,MAAa,mBAAoB,SAAQ,oBAAa;IAAtD;;QACE,gBAAW,GAAG,qBAAqB,CAAC;IAkBtC,CAAC;IAhBC,aAAa;QACX,+BAA+B;IACjC,CAAC;IAED,QAAQ;QACN,IAAA,6CAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,2CAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,uCAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAnBD,kDAmBC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CACrC,UAAyB;IAEzB,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { DoubleClickToStickMC } from \"../Controllers/DoubleClickToStickMC\";\r\nimport { DoubleTapToStickTC } from \"../Controllers/DoubleTapToStickTC\";\r\nimport { makeTryStickAppObjectUC } from \"../UCs/TryStickAppObjectUC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Stick Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupStick function, split into\r\n * the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class StickFeatureFactory extends DomainFactory {\r\n factoryName = \"StickFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n // No entities for this feature\r\n }\r\n\r\n setupUCs(): void {\r\n makeTryStickAppObjectUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n // No PMs for this feature\r\n }\r\n\r\n finalSetup(): void {\r\n new DoubleClickToStickMC(this.appObject);\r\n new DoubleTapToStickTC(this.appObject);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new StickFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Stick AppObject from\r\n * @returns A new StickFeatureFactory instance\r\n */\r\nexport function makeStickFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): StickFeatureFactory {\r\n return new StickFeatureFactory(appObjects.getOrCreate(\"Stick\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const MouseInput_1 = require("../../MouseInput");
|
|
5
|
+
const TouchController_1 = require("../../TouchController");
|
|
6
|
+
const setupStick_1 = require("./setupStick");
|
|
7
|
+
const StickFeatureFactory_1 = require("./StickFeatureFactory");
|
|
8
|
+
function makeTestRig() {
|
|
9
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
10
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
11
|
+
const mockError = jest.fn();
|
|
12
|
+
appObjects.submitError = mockError;
|
|
13
|
+
return { appObjects, factories, mockError };
|
|
14
|
+
}
|
|
15
|
+
function registerCollaborators(appObjects) {
|
|
16
|
+
(0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
|
|
17
|
+
(0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
|
|
18
|
+
}
|
|
19
|
+
function componentTypes(appObjects) {
|
|
20
|
+
const types = {};
|
|
21
|
+
appObjects.getAll().forEach((ao) => {
|
|
22
|
+
types[ao.id] = ao
|
|
23
|
+
.allComponents()
|
|
24
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
25
|
+
.map((c) => c.type)
|
|
26
|
+
.sort();
|
|
27
|
+
});
|
|
28
|
+
return types;
|
|
29
|
+
}
|
|
30
|
+
describe("StickFeatureFactory", () => {
|
|
31
|
+
it("Builds the same components as setupStick", () => {
|
|
32
|
+
const legacy = makeTestRig();
|
|
33
|
+
registerCollaborators(legacy.appObjects);
|
|
34
|
+
legacy.factories.setupDomain();
|
|
35
|
+
(0, setupStick_1.setupStick)(legacy.appObjects);
|
|
36
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
37
|
+
registerCollaborators(appObjects);
|
|
38
|
+
(0, StickFeatureFactory_1.makeStickFeatureFactory)(appObjects);
|
|
39
|
+
factories.setupDomain();
|
|
40
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
41
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=StickFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/StickFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,iDAAgE;AAChE,2DAA0E;AAC1E,6CAA0C;AAC1C,+DAAgE;AAEhE,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAyB;IACtD,IAAA,yCAA4B,EAAC,UAAU,CAAC,CAAC;IACzC,IAAA,mDAAiC,EAAC,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,cAAc,CAAC,UAAyB;IAC/C,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,UAAU,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACjC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;aACd,aAAa,EAAE;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,oBAAa,CAAC,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAClB,IAAI,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,IAAA,uBAAU,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE9B,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,6CAAuB,EAAC,UAAU,CAAC,CAAC;QACpC,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { setupStick } from \"./setupStick\";\r\nimport { makeStickFeatureFactory } from \"./StickFeatureFactory\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"StickFeatureFactory\", () => {\r\n it(\"Builds the same components as setupStick\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupStick(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeStickFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n});\r\n"]}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./setupStick"), exports);
|
|
18
|
+
__exportStar(require("./StickFeatureFactory"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B","sourcesContent":["export * from \"./setupStick\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,wDAAsC","sourcesContent":["export * from \"./setupStick\";\r\nexport * from \"./StickFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StoredViewFeatureFactory = void 0;
|
|
4
|
+
exports.makeStoredViewFeatureFactory = makeStoredViewFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Entities_1 = require("../Entities");
|
|
7
|
+
const PM_1 = require("../PM");
|
|
8
|
+
const UC_1 = require("../UC");
|
|
9
|
+
/**
|
|
10
|
+
* Factory responsible for setting up the StoredView Feature domain components.
|
|
11
|
+
*
|
|
12
|
+
* Builds the same components as the legacy setupStoredView function, split
|
|
13
|
+
* into the DomainFactory phases.
|
|
14
|
+
*
|
|
15
|
+
* @extends DomainFactory
|
|
16
|
+
*/
|
|
17
|
+
class StoredViewFeatureFactory extends core_1.DomainFactory {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.factoryName = "StoredViewFeatureFactory";
|
|
21
|
+
}
|
|
22
|
+
setupEntities() {
|
|
23
|
+
(0, Entities_1.makeStoredView)(this.appObject);
|
|
24
|
+
}
|
|
25
|
+
setupUCs() {
|
|
26
|
+
(0, UC_1.makeStoreCurrentViewUC)(this.appObject);
|
|
27
|
+
(0, UC_1.makeRestoreStoredViewUC)(this.appObject);
|
|
28
|
+
(0, UC_1.makeClearStoredViewUC)(this.appObject);
|
|
29
|
+
(0, UC_1.makeSetViewInXRUC)(this.appObject);
|
|
30
|
+
(0, UC_1.makeSerializeStoredView)(this.appObject);
|
|
31
|
+
}
|
|
32
|
+
setupPMs() {
|
|
33
|
+
(0, PM_1.makeHasStoredViewPM)(this.appObject);
|
|
34
|
+
}
|
|
35
|
+
finalSetup() {
|
|
36
|
+
// No final setup needed
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.StoredViewFeatureFactory = StoredViewFeatureFactory;
|
|
40
|
+
/**
|
|
41
|
+
* Factory function to create a new StoredViewFeatureFactory
|
|
42
|
+
* @param appObjects The AppObjectRepo to get or create the StoredView AppObject from
|
|
43
|
+
* @returns A new StoredViewFeatureFactory instance
|
|
44
|
+
*/
|
|
45
|
+
function makeStoredViewFeatureFactory(appObjects) {
|
|
46
|
+
return new StoredViewFeatureFactory(appObjects.getOrCreate("StoredView"));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=StoredViewFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoredViewFeatureFactory.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/StoredViewFeatureFactory.ts"],"names":[],"mappings":";;;AAgDA,oEAIC;AApDD,sCAA2D;AAC3D,0CAA6C;AAC7C,8BAA4C;AAC5C,8BAMe;AAEf;;;;;;;GAOG;AACH,MAAa,wBAAyB,SAAQ,oBAAa;IAA3D;;QACE,gBAAW,GAAG,0BAA0B,CAAC;IAqB3C,CAAC;IAnBC,aAAa;QACX,IAAA,yBAAc,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,QAAQ;QACN,IAAA,2BAAsB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAA,0BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,sBAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,IAAA,wBAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AAtBD,4DAsBC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,UAAyB;IAEzB,OAAO,IAAI,wBAAwB,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { makeStoredView } from \"../Entities\";\r\nimport { makeHasStoredViewPM } from \"../PM\";\r\nimport {\r\n makeClearStoredViewUC,\r\n makeRestoreStoredViewUC,\r\n makeSerializeStoredView,\r\n makeSetViewInXRUC,\r\n makeStoreCurrentViewUC,\r\n} from \"../UC\";\r\n\r\n/**\r\n * Factory responsible for setting up the StoredView Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupStoredView function, split\r\n * into the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class StoredViewFeatureFactory extends DomainFactory {\r\n factoryName = \"StoredViewFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeStoredView(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n makeStoreCurrentViewUC(this.appObject);\r\n makeRestoreStoredViewUC(this.appObject);\r\n makeClearStoredViewUC(this.appObject);\r\n makeSetViewInXRUC(this.appObject);\r\n makeSerializeStoredView(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeHasStoredViewPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n // No final setup needed\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new StoredViewFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the StoredView AppObject from\r\n * @returns A new StoredViewFeatureFactory instance\r\n */\r\nexport function makeStoredViewFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): StoredViewFeatureFactory {\r\n return new StoredViewFeatureFactory(appObjects.getOrCreate(\"StoredView\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const StateMachine_1 = require("../../StateMachine");
|
|
5
|
+
const setupStoredView_1 = require("./setupStoredView");
|
|
6
|
+
const StoredViewFeatureFactory_1 = require("./StoredViewFeatureFactory");
|
|
7
|
+
function makeTestRig() {
|
|
8
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
9
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
10
|
+
const mockError = jest.fn();
|
|
11
|
+
appObjects.submitError = mockError;
|
|
12
|
+
return { appObjects, factories, mockError };
|
|
13
|
+
}
|
|
14
|
+
function componentTypes(appObjects) {
|
|
15
|
+
const types = {};
|
|
16
|
+
appObjects.getAll().forEach((ao) => {
|
|
17
|
+
types[ao.id] = ao
|
|
18
|
+
.allComponents()
|
|
19
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
20
|
+
.map((c) => c.type)
|
|
21
|
+
.sort();
|
|
22
|
+
});
|
|
23
|
+
return types;
|
|
24
|
+
}
|
|
25
|
+
describe("StoredViewFeatureFactory", () => {
|
|
26
|
+
it("Builds the same components as setupStoredView", () => {
|
|
27
|
+
const legacy = makeTestRig();
|
|
28
|
+
(0, StateMachine_1.makeStateMachineFeatureFactory)(legacy.appObjects);
|
|
29
|
+
legacy.factories.setupDomain();
|
|
30
|
+
(0, setupStoredView_1.setupStoredView)(legacy.appObjects);
|
|
31
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
32
|
+
(0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
|
|
33
|
+
(0, StoredViewFeatureFactory_1.makeStoredViewFeatureFactory)(appObjects);
|
|
34
|
+
factories.setupDomain();
|
|
35
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
36
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=StoredViewFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoredViewFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/StoredViewFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,qDAAoE;AACpE,uDAAoD;AACpD,yEAA0E;AAE1E,S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CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { setupStoredView } from \"./setupStoredView\";\r\nimport { makeStoredViewFeatureFactory } from \"./StoredViewFeatureFactory\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"StoredViewFeatureFactory\", () => {\r\n it(\"Builds the same components as setupStoredView\", () => {\r\n const legacy = makeTestRig();\r\n makeStateMachineFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupStoredView(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n makeStateMachineFeatureFactory(appObjects);\r\n makeStoredViewFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n});\r\n"]}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./setupStoredView"), exports);
|
|
18
|
+
__exportStar(require("./StoredViewFeatureFactory"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC","sourcesContent":["export * from \"./setupStoredView\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,6DAA2C","sourcesContent":["export * from \"./setupStoredView\";\r\nexport * from \"./StoredViewFeatureFactory\";\r\n"]}
|