@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,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StylusFeatureFactory = void 0;
|
|
4
|
+
exports.makeStylusFeatureFactory = makeStylusFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
7
|
+
const Entity_1 = require("../Entity");
|
|
8
|
+
const PMs_1 = require("../PMs");
|
|
9
|
+
const UCs_1 = require("../UCs");
|
|
10
|
+
/**
|
|
11
|
+
* Factory responsible for setting up the Stylus Feature domain components.
|
|
12
|
+
*
|
|
13
|
+
* Builds the same components as the legacy setupStylus function, split into
|
|
14
|
+
* the DomainFactory phases.
|
|
15
|
+
*
|
|
16
|
+
* @extends DomainFactory
|
|
17
|
+
*/
|
|
18
|
+
class StylusFeatureFactory extends core_1.DomainFactory {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.factoryName = "StylusFeatureFactory";
|
|
22
|
+
}
|
|
23
|
+
setupEntities() {
|
|
24
|
+
(0, Entity_1.makeStylusEntity)(this.appObject);
|
|
25
|
+
}
|
|
26
|
+
setupUCs() {
|
|
27
|
+
(0, UCs_1.makeEmulateStylusUC)(this.appObject);
|
|
28
|
+
}
|
|
29
|
+
setupPMs() {
|
|
30
|
+
(0, PMs_1.makeStylusColorLengthPM)(this.appObject);
|
|
31
|
+
(0, PMs_1.makeStylusIsInUsePM)(this.appObject);
|
|
32
|
+
(0, Transform3D_1.makeTransform3DPM)(this.appObject);
|
|
33
|
+
}
|
|
34
|
+
finalSetup() {
|
|
35
|
+
// No final setup needed
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.StylusFeatureFactory = StylusFeatureFactory;
|
|
39
|
+
/**
|
|
40
|
+
* Factory function to create a new StylusFeatureFactory
|
|
41
|
+
* @param appObjects The AppObjectRepo to get or create the Stylus AppObject from
|
|
42
|
+
* @returns A new StylusFeatureFactory instance
|
|
43
|
+
*/
|
|
44
|
+
function makeStylusFeatureFactory(appObjects) {
|
|
45
|
+
return new StylusFeatureFactory(appObjects.getOrCreate("Stylus"));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=StylusFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StylusFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/StylusFeatureFactory.ts"],"names":[],"mappings":";;;AAyCA,4DAIC;AA7CD,sCAA2D;AAC3D,mDAAsD;AACtD,sCAA6C;AAC7C,gCAAsE;AACtE,gCAA6C;AAE7C;;;;;;;GAOG;AACH,MAAa,oBAAqB,SAAQ,oBAAa;IAAvD;;QACE,gBAAW,GAAG,sBAAsB,CAAC;IAmBvC,CAAC;IAjBC,aAAa;QACX,IAAA,yBAAgB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ;QACN,IAAA,yBAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,IAAA,6BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAA,yBAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,IAAA,+BAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AApBD,oDAoBC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,UAAyB;IAEzB,OAAO,IAAI,oBAAoB,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { makeTransform3DPM } from \"../../Transform3D\";\r\nimport { makeStylusEntity } from \"../Entity\";\r\nimport { makeStylusColorLengthPM, makeStylusIsInUsePM } from \"../PMs\";\r\nimport { makeEmulateStylusUC } from \"../UCs\";\r\n\r\n/**\r\n * Factory responsible for setting up the Stylus Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupStylus function, split into\r\n * the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class StylusFeatureFactory extends DomainFactory {\r\n factoryName = \"StylusFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeStylusEntity(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n makeEmulateStylusUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeStylusColorLengthPM(this.appObject);\r\n makeStylusIsInUsePM(this.appObject);\r\n makeTransform3DPM(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 StylusFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Stylus AppObject from\r\n * @returns A new StylusFeatureFactory instance\r\n */\r\nexport function makeStylusFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): StylusFeatureFactory {\r\n return new StylusFeatureFactory(appObjects.getOrCreate(\"Stylus\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const setupStylus_1 = require("./setupStylus");
|
|
5
|
+
const StylusFeatureFactory_1 = require("./StylusFeatureFactory");
|
|
6
|
+
function makeTestRig() {
|
|
7
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
8
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
9
|
+
const mockError = jest.fn();
|
|
10
|
+
appObjects.submitError = mockError;
|
|
11
|
+
return { appObjects, factories, mockError };
|
|
12
|
+
}
|
|
13
|
+
function componentTypes(appObjects) {
|
|
14
|
+
const types = {};
|
|
15
|
+
appObjects.getAll().forEach((ao) => {
|
|
16
|
+
types[ao.id] = ao
|
|
17
|
+
.allComponents()
|
|
18
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
19
|
+
.map((c) => c.type)
|
|
20
|
+
.sort();
|
|
21
|
+
});
|
|
22
|
+
return types;
|
|
23
|
+
}
|
|
24
|
+
describe("StylusFeatureFactory", () => {
|
|
25
|
+
it("Builds the same components as setupStylus", () => {
|
|
26
|
+
const legacy = makeTestRig();
|
|
27
|
+
(0, setupStylus_1.setupStylus)(legacy.appObjects);
|
|
28
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
29
|
+
(0, StylusFeatureFactory_1.makeStylusFeatureFactory)(appObjects);
|
|
30
|
+
factories.setupDomain();
|
|
31
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
32
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=StylusFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StylusFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/St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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 { setupStylus } from \"./setupStylus\";\r\nimport { makeStylusFeatureFactory } from \"./StylusFeatureFactory\";\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(\"StylusFeatureFactory\", () => {\r\n it(\"Builds the same components as setupStylus\", () => {\r\n const legacy = makeTestRig();\r\n setupStylus(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n makeStylusFeatureFactory(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("./setupStylus"), exports);
|
|
18
|
+
__exportStar(require("./StylusFeatureFactory"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B","sourcesContent":["export * from \"./setupStylus\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,yDAAuC","sourcesContent":["export * from \"./setupStylus\";\r\nexport * from \"./StylusFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZSpaceFeatureFactory = void 0;
|
|
4
|
+
exports.makeZSpaceFeatureFactory = makeZSpaceFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Dispatcher_1 = require("../../Dispatcher");
|
|
7
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
8
|
+
const XR_1 = require("../../XR");
|
|
9
|
+
const Entities_1 = require("../Entities");
|
|
10
|
+
const PM_1 = require("../PM");
|
|
11
|
+
const UC_1 = require("../UC");
|
|
12
|
+
/**
|
|
13
|
+
* Factory responsible for setting up the zSpace Feature domain components.
|
|
14
|
+
*
|
|
15
|
+
* Builds the same components as the legacy setupZSpace function, split into
|
|
16
|
+
* the DomainFactory phases. The IS_ZSPACE_AVAILABLE request is dispatched in
|
|
17
|
+
* finalSetup, so the Dispatcher Feature's factory can be registered before or
|
|
18
|
+
* after this one.
|
|
19
|
+
*
|
|
20
|
+
* @extends DomainFactory
|
|
21
|
+
*/
|
|
22
|
+
class ZSpaceFeatureFactory extends core_1.DomainFactory {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.factoryName = "ZSpaceFeatureFactory";
|
|
26
|
+
}
|
|
27
|
+
setupEntities() {
|
|
28
|
+
Transform3D_1.Transform3D.addIfMissing(this.appObject);
|
|
29
|
+
this.zSpaceEntity = (0, Entities_1.makeZSpaceEntity)(this.appObject);
|
|
30
|
+
(0, XR_1.makeXREntity)(this.appObject);
|
|
31
|
+
}
|
|
32
|
+
setupUCs() {
|
|
33
|
+
(0, UC_1.makeViewFromPoseHook)(this.appObject);
|
|
34
|
+
(0, UC_1.makeStylusFromGamepadHook)(this.appObject);
|
|
35
|
+
(0, UC_1.makeCheckZSpaceDisplaySizeUC)(this.appObject);
|
|
36
|
+
}
|
|
37
|
+
setupPMs() {
|
|
38
|
+
(0, PM_1.makeZSpaceIsEnabledPM)(this.appObject);
|
|
39
|
+
(0, PM_1.makeZSpaceViewerScalePM)(this.appObject);
|
|
40
|
+
if (this.zSpaceEntity) {
|
|
41
|
+
const displayAO = this.zSpaceEntity.display.appObject;
|
|
42
|
+
(0, Transform3D_1.makeTransform3DPM)(displayAO);
|
|
43
|
+
(0, PM_1.makeZSpaceDisplayPM)(displayAO);
|
|
44
|
+
}
|
|
45
|
+
(0, PM_1.makeZSpaceIsSupportedPM)(this.appObject);
|
|
46
|
+
}
|
|
47
|
+
finalSetup() {
|
|
48
|
+
const zSpaceEntity = this.zSpaceEntity;
|
|
49
|
+
if (!zSpaceEntity)
|
|
50
|
+
return;
|
|
51
|
+
const checkForZSpace = Dispatcher_1.IsZSpaceAvailableUC.get(this.appObjects);
|
|
52
|
+
if (!checkForZSpace) {
|
|
53
|
+
this.appObjects.submitWarning(this.factoryName, "Unable to find IsZSpaceAvailableUC. The Dispatcher Feature needs to be setup for zSpace");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
checkForZSpace.doDispatch().then((isSupported) => {
|
|
57
|
+
zSpaceEntity.isSupported = isSupported;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ZSpaceFeatureFactory = ZSpaceFeatureFactory;
|
|
62
|
+
/**
|
|
63
|
+
* Factory function to create a new ZSpaceFeatureFactory
|
|
64
|
+
* @param appObjects The AppObjectRepo to get or create the zSpace AppObject from
|
|
65
|
+
* @returns A new ZSpaceFeatureFactory instance
|
|
66
|
+
*/
|
|
67
|
+
function makeZSpaceFeatureFactory(appObjects) {
|
|
68
|
+
return new ZSpaceFeatureFactory(appObjects.getOrCreate("zSpace"));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=ZSpaceFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZSpaceFeatureFactory.js","sourceRoot":"","sources":["../../../../src/zSpace/Factory/ZSpaceFeatureFactory.ts"],"names":[],"mappings":";;;AAiFA,4DAIC;AArFD,sCAA2D;AAC3D,iDAAuD;AACvD,mDAAmE;AACnE,iCAAwC;AACxC,0CAA6D;AAC7D,8BAKe;AACf,8BAIe;AAEf;;;;;;;;;GASG;AACH,MAAa,oBAAqB,SAAQ,oBAAa;IAAvD;;QACE,gBAAW,GAAG,sBAAsB,CAAC;IA8CvC,CAAC;IA1CC,aAAa;QACX,yBAAW,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,IAAA,iBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,QAAQ;QACN,IAAA,yBAAoB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,IAAA,8BAAyB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAA,iCAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,QAAQ;QACN,IAAA,0BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC;YACtD,IAAA,+BAAiB,EAAC,SAAS,CAAC,CAAC;YAC7B,IAAA,wBAAmB,EAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QAED,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU;QACR,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,YAAY;YAAE,OAAO;QAE1B,MAAM,cAAc,GAAG,gCAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,aAAa,CAC3B,IAAI,CAAC,WAAW,EAChB,yFAAyF,CAC1F,CAAC;YACF,OAAO;QACT,CAAC;QAED,cAAc,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;YAC/C,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/CD,oDA+CC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,UAAyB;IAEzB,OAAO,IAAI,oBAAoB,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { IsZSpaceAvailableUC } from \"../../Dispatcher\";\r\nimport { makeTransform3DPM, Transform3D } from \"../../Transform3D\";\r\nimport { makeXREntity } from \"../../XR\";\r\nimport { makeZSpaceEntity, ZSpaceEntity } from \"../Entities\";\r\nimport {\r\n makeZSpaceDisplayPM,\r\n makeZSpaceIsEnabledPM,\r\n makeZSpaceIsSupportedPM,\r\n makeZSpaceViewerScalePM,\r\n} from \"../PM\";\r\nimport {\r\n makeCheckZSpaceDisplaySizeUC,\r\n makeStylusFromGamepadHook,\r\n makeViewFromPoseHook,\r\n} from \"../UC\";\r\n\r\n/**\r\n * Factory responsible for setting up the zSpace Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupZSpace function, split into\r\n * the DomainFactory phases. The IS_ZSPACE_AVAILABLE request is dispatched in\r\n * finalSetup, so the Dispatcher Feature's factory can be registered before or\r\n * after this one.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class ZSpaceFeatureFactory extends DomainFactory {\r\n factoryName = \"ZSpaceFeatureFactory\";\r\n\r\n private zSpaceEntity?: ZSpaceEntity;\r\n\r\n setupEntities(): void {\r\n Transform3D.addIfMissing(this.appObject);\r\n this.zSpaceEntity = makeZSpaceEntity(this.appObject);\r\n makeXREntity(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n makeViewFromPoseHook(this.appObject);\r\n makeStylusFromGamepadHook(this.appObject);\r\n makeCheckZSpaceDisplaySizeUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeZSpaceIsEnabledPM(this.appObject);\r\n makeZSpaceViewerScalePM(this.appObject);\r\n\r\n if (this.zSpaceEntity) {\r\n const displayAO = this.zSpaceEntity.display.appObject;\r\n makeTransform3DPM(displayAO);\r\n makeZSpaceDisplayPM(displayAO);\r\n }\r\n\r\n makeZSpaceIsSupportedPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n const zSpaceEntity = this.zSpaceEntity;\r\n if (!zSpaceEntity) return;\r\n\r\n const checkForZSpace = IsZSpaceAvailableUC.get(this.appObjects);\r\n if (!checkForZSpace) {\r\n this.appObjects.submitWarning(\r\n this.factoryName,\r\n \"Unable to find IsZSpaceAvailableUC. The Dispatcher Feature needs to be setup for zSpace\",\r\n );\r\n return;\r\n }\r\n\r\n checkForZSpace.doDispatch().then((isSupported) => {\r\n zSpaceEntity.isSupported = isSupported;\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ZSpaceFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the zSpace AppObject from\r\n * @returns A new ZSpaceFeatureFactory instance\r\n */\r\nexport function makeZSpaceFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): ZSpaceFeatureFactory {\r\n return new ZSpaceFeatureFactory(appObjects.getOrCreate(\"zSpace\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const Dispatcher_1 = require("../../Dispatcher");
|
|
5
|
+
const Stylus_1 = require("../../Stylus");
|
|
6
|
+
const Entities_1 = require("../Entities");
|
|
7
|
+
const setupZSpace_1 = require("./setupZSpace");
|
|
8
|
+
const ZSpaceFeatureFactory_1 = require("./ZSpaceFeatureFactory");
|
|
9
|
+
function makeTestRig() {
|
|
10
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
11
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
12
|
+
const mockWarn = jest.fn();
|
|
13
|
+
appObjects.submitWarning = mockWarn;
|
|
14
|
+
const hostHandler = jest.fn((request) => {
|
|
15
|
+
if (request.type === "IS_ZSPACE_AVAILABLE") {
|
|
16
|
+
request.payload.callback(true);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return { appObjects, factories, mockWarn, hostHandler };
|
|
20
|
+
}
|
|
21
|
+
function componentTypes(appObjects) {
|
|
22
|
+
const types = {};
|
|
23
|
+
appObjects.getAll().forEach((ao) => {
|
|
24
|
+
types[ao.id] = ao
|
|
25
|
+
.allComponents()
|
|
26
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
27
|
+
.map((c) => c.type)
|
|
28
|
+
.sort();
|
|
29
|
+
});
|
|
30
|
+
return types;
|
|
31
|
+
}
|
|
32
|
+
describe("ZSpaceFeatureFactory", () => {
|
|
33
|
+
it("Builds the same components as setupZSpace", () => {
|
|
34
|
+
const legacy = makeTestRig();
|
|
35
|
+
(0, Dispatcher_1.makeDispatcherFeatureFactory)(legacy.appObjects, legacy.hostHandler);
|
|
36
|
+
(0, Stylus_1.makeStylusFeatureFactory)(legacy.appObjects);
|
|
37
|
+
legacy.factories.setupDomain();
|
|
38
|
+
(0, setupZSpace_1.setupZSpace)(legacy.appObjects);
|
|
39
|
+
const { appObjects, factories, hostHandler } = makeTestRig();
|
|
40
|
+
(0, Dispatcher_1.makeDispatcherFeatureFactory)(appObjects, hostHandler);
|
|
41
|
+
(0, Stylus_1.makeStylusFeatureFactory)(appObjects);
|
|
42
|
+
(0, ZSpaceFeatureFactory_1.makeZSpaceFeatureFactory)(appObjects);
|
|
43
|
+
factories.setupDomain();
|
|
44
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
45
|
+
});
|
|
46
|
+
it("Asks the Host whether zSpace is available when the Dispatcher factory is registered after it", async () => {
|
|
47
|
+
const { appObjects, factories, mockWarn, hostHandler } = makeTestRig();
|
|
48
|
+
(0, ZSpaceFeatureFactory_1.makeZSpaceFeatureFactory)(appObjects);
|
|
49
|
+
(0, Stylus_1.makeStylusFeatureFactory)(appObjects);
|
|
50
|
+
(0, Dispatcher_1.makeDispatcherFeatureFactory)(appObjects, hostHandler);
|
|
51
|
+
factories.setupDomain();
|
|
52
|
+
await Promise.resolve();
|
|
53
|
+
const requestTypes = hostHandler.mock.calls.map((call) => call[0].type);
|
|
54
|
+
expect(requestTypes).toContain("IS_ZSPACE_AVAILABLE");
|
|
55
|
+
expect(Entities_1.ZSpaceEntity.get(appObjects).isSupported).toBe(true);
|
|
56
|
+
expect(mockWarn).not.toHaveBeenCalledWith("ZSpaceFeatureFactory", expect.anything());
|
|
57
|
+
});
|
|
58
|
+
it("Does not dispatch before finalSetup", () => {
|
|
59
|
+
const { appObjects, factories, hostHandler } = makeTestRig();
|
|
60
|
+
(0, Dispatcher_1.makeDispatcherFeatureFactory)(appObjects, hostHandler);
|
|
61
|
+
(0, Stylus_1.makeStylusFeatureFactory)(appObjects);
|
|
62
|
+
(0, ZSpaceFeatureFactory_1.makeZSpaceFeatureFactory)(appObjects);
|
|
63
|
+
const all = factories.getAll();
|
|
64
|
+
all.forEach((f) => f.setupEntities());
|
|
65
|
+
all.forEach((f) => f.setupUCs());
|
|
66
|
+
all.forEach((f) => f.setupPMs());
|
|
67
|
+
const requestTypes = hostHandler.mock.calls.map((call) => call[0].type);
|
|
68
|
+
expect(requestTypes).not.toContain("IS_ZSPACE_AVAILABLE");
|
|
69
|
+
});
|
|
70
|
+
it("Warns when there is no Dispatcher Feature", () => {
|
|
71
|
+
const { appObjects, factories, mockWarn } = makeTestRig();
|
|
72
|
+
(0, Stylus_1.makeStylusFeatureFactory)(appObjects);
|
|
73
|
+
(0, ZSpaceFeatureFactory_1.makeZSpaceFeatureFactory)(appObjects);
|
|
74
|
+
factories.setupDomain();
|
|
75
|
+
expect(mockWarn).toHaveBeenCalledWith("ZSpaceFeatureFactory", "Unable to find IsZSpaceAvailableUC. The Dispatcher Feature needs to be setup for zSpace");
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=ZSpaceFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZSpaceFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/zSpace/Factory/ZSpaceFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAMqB;AACrB,iDAAgE;AAChE,yCAAwD;AACxD,0CAA2C;AAC3C,+CAA4C;AAC5C,iEAAkE;AAElE,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC3B,UAAU,CAAC,aAAa,GAAG,QAAQ,CAAC;IAEpC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,OAAgB,E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port { makeDispatcherFeatureFactory } from \"../../Dispatcher\";\r\nimport { makeStylusFeatureFactory } from \"../../Stylus\";\r\nimport { ZSpaceEntity } from \"../Entities\";\r\nimport { setupZSpace } from \"./setupZSpace\";\r\nimport { makeZSpaceFeatureFactory } from \"./ZSpaceFeatureFactory\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockWarn = jest.fn();\r\n appObjects.submitWarning = mockWarn;\r\n\r\n const hostHandler = jest.fn((request: Request) => {\r\n if (request.type === \"IS_ZSPACE_AVAILABLE\") {\r\n (request.payload as any).callback(true);\r\n }\r\n });\r\n\r\n return { appObjects, factories, mockWarn, hostHandler };\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(\"ZSpaceFeatureFactory\", () => {\r\n it(\"Builds the same components as setupZSpace\", () => {\r\n const legacy = makeTestRig();\r\n makeDispatcherFeatureFactory(legacy.appObjects, legacy.hostHandler);\r\n makeStylusFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupZSpace(legacy.appObjects);\r\n\r\n const { appObjects, factories, hostHandler } = makeTestRig();\r\n makeDispatcherFeatureFactory(appObjects, hostHandler);\r\n makeStylusFeatureFactory(appObjects);\r\n makeZSpaceFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n });\r\n\r\n it(\"Asks the Host whether zSpace is available when the Dispatcher factory is registered after it\", async () => {\r\n const { appObjects, factories, mockWarn, hostHandler } = makeTestRig();\r\n makeZSpaceFeatureFactory(appObjects);\r\n makeStylusFeatureFactory(appObjects);\r\n makeDispatcherFeatureFactory(appObjects, hostHandler);\r\n factories.setupDomain();\r\n await Promise.resolve();\r\n\r\n const requestTypes = hostHandler.mock.calls.map((call) => call[0].type);\r\n expect(requestTypes).toContain(\"IS_ZSPACE_AVAILABLE\");\r\n expect(ZSpaceEntity.get(appObjects)!.isSupported).toBe(true);\r\n expect(mockWarn).not.toHaveBeenCalledWith(\r\n \"ZSpaceFeatureFactory\",\r\n expect.anything(),\r\n );\r\n });\r\n\r\n it(\"Does not dispatch before finalSetup\", () => {\r\n const { appObjects, factories, hostHandler } = makeTestRig();\r\n makeDispatcherFeatureFactory(appObjects, hostHandler);\r\n makeStylusFeatureFactory(appObjects);\r\n makeZSpaceFeatureFactory(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\r\n const requestTypes = hostHandler.mock.calls.map((call) => call[0].type);\r\n expect(requestTypes).not.toContain(\"IS_ZSPACE_AVAILABLE\");\r\n });\r\n\r\n it(\"Warns when there is no Dispatcher Feature\", () => {\r\n const { appObjects, factories, mockWarn } = makeTestRig();\r\n makeStylusFeatureFactory(appObjects);\r\n makeZSpaceFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(mockWarn).toHaveBeenCalledWith(\r\n \"ZSpaceFeatureFactory\",\r\n \"Unable to find IsZSpaceAvailableUC. The Dispatcher Feature needs to be setup for zSpace\",\r\n );\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("./setupZSpace"), exports);
|
|
18
|
+
__exportStar(require("./ZSpaceFeatureFactory"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/zSpace/Factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B","sourcesContent":["export * from \"./setupZSpace\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/zSpace/Factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,yDAAuC","sourcesContent":["export * from \"./setupZSpace\";\r\nexport * from \"./ZSpaceFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { ToolRepository } from "../../Tools";
|
|
3
|
+
import { MousePanTransformMC, TouchPanTransformTC } from "../../Transform3D";
|
|
4
|
+
import { MouseAddCalloutMC, TouchAddCalloutTC } from "../Controller";
|
|
5
|
+
import { makeCalloutGlobals } from "../Entities";
|
|
6
|
+
import { makeDeleteAllCalloutsUC, makeTryAddCalloutUC, makeTryPanLabelUC, SerializeCallouts, } from "../UC";
|
|
7
|
+
import { makeCalloutRepoFactory } from "./calloutRepoFactory";
|
|
8
|
+
/**
|
|
9
|
+
* Factory responsible for setting up the Callouts Feature domain components.
|
|
10
|
+
*
|
|
11
|
+
* Builds the same components as the legacy setupCallouts function, split into
|
|
12
|
+
* the DomainFactory phases. The CALLOUT tool is created in finalSetup, so its
|
|
13
|
+
* place in the toolbar follows the order the factories are registered.
|
|
14
|
+
*
|
|
15
|
+
* @extends DomainFactory
|
|
16
|
+
*/
|
|
17
|
+
export class CalloutsFeatureFactory extends DomainFactory {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.factoryName = "CalloutsFeatureFactory";
|
|
21
|
+
}
|
|
22
|
+
setupEntities() {
|
|
23
|
+
const globals = makeCalloutGlobals(this.appObject);
|
|
24
|
+
globals.calloutRepoFactory = makeCalloutRepoFactory(this.appObjects);
|
|
25
|
+
}
|
|
26
|
+
setupUCs() {
|
|
27
|
+
makeTryPanLabelUC(this.appObject);
|
|
28
|
+
makeTryAddCalloutUC(this.appObject);
|
|
29
|
+
new SerializeCallouts(this.appObject);
|
|
30
|
+
makeDeleteAllCalloutsUC(this.appObject);
|
|
31
|
+
}
|
|
32
|
+
setupPMs() {
|
|
33
|
+
// No PMs for this feature
|
|
34
|
+
}
|
|
35
|
+
finalSetup() {
|
|
36
|
+
new MouseAddCalloutMC(this.appObject);
|
|
37
|
+
new TouchAddCalloutTC(this.appObject);
|
|
38
|
+
new MousePanTransformMC(this.appObject);
|
|
39
|
+
new TouchPanTransformTC(this.appObject);
|
|
40
|
+
const toolRepo = ToolRepository.get(this.appObjects);
|
|
41
|
+
if (!toolRepo) {
|
|
42
|
+
this.appObjects.submitWarning(this.factoryName, "Unable to find tool repo");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
toolRepo.makeToolFromData({
|
|
46
|
+
toolType: "CALLOUT",
|
|
47
|
+
isDefault: false,
|
|
48
|
+
label: "Callout",
|
|
49
|
+
shortcutLabel: "c",
|
|
50
|
+
hotkeys: [{ keyCode: "KeyC" }],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Factory function to create a new CalloutsFeatureFactory
|
|
56
|
+
* @param appObjects The AppObjectRepo to get or create the Callouts AppObject from
|
|
57
|
+
* @returns A new CalloutsFeatureFactory instance
|
|
58
|
+
*/
|
|
59
|
+
export function makeCalloutsFeatureFactory(appObjects) {
|
|
60
|
+
return new CalloutsFeatureFactory(appObjects.getOrCreate("Callouts"));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=CalloutsFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalloutsFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/CalloutsFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE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QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,UAAU,CAAC,aAAa,CAC3B,IAAI,CAAC,WAAW,EAChB,0BAA0B,CAC3B,CAAC;YACF,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC;YACxB,QAAQ,EAAE,SAAS;YACnB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,SAAS;YAChB,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,UAAyB;IAEzB,OAAO,IAAI,sBAAsB,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { ToolRepository } from \"../../Tools\";\r\nimport { MousePanTransformMC, TouchPanTransformTC } from \"../../Transform3D\";\r\nimport { MouseAddCalloutMC, TouchAddCalloutTC } from \"../Controller\";\r\nimport { makeCalloutGlobals } from \"../Entities\";\r\nimport {\r\n makeDeleteAllCalloutsUC,\r\n makeTryAddCalloutUC,\r\n makeTryPanLabelUC,\r\n SerializeCallouts,\r\n} from \"../UC\";\r\nimport { makeCalloutRepoFactory } from \"./calloutRepoFactory\";\r\n\r\n/**\r\n * Factory responsible for setting up the Callouts Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupCallouts function, split into\r\n * the DomainFactory phases. The CALLOUT tool is created in finalSetup, so its\r\n * place in the toolbar follows the order the factories are registered.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class CalloutsFeatureFactory extends DomainFactory {\r\n factoryName = \"CalloutsFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n const globals = makeCalloutGlobals(this.appObject);\r\n globals.calloutRepoFactory = makeCalloutRepoFactory(this.appObjects);\r\n }\r\n\r\n setupUCs(): void {\r\n makeTryPanLabelUC(this.appObject);\r\n makeTryAddCalloutUC(this.appObject);\r\n new SerializeCallouts(this.appObject);\r\n makeDeleteAllCalloutsUC(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 MouseAddCalloutMC(this.appObject);\r\n new TouchAddCalloutTC(this.appObject);\r\n new MousePanTransformMC(this.appObject);\r\n new TouchPanTransformTC(this.appObject);\r\n\r\n const toolRepo = ToolRepository.get(this.appObjects);\r\n if (!toolRepo) {\r\n this.appObjects.submitWarning(\r\n this.factoryName,\r\n \"Unable to find tool repo\",\r\n );\r\n return;\r\n }\r\n\r\n toolRepo.makeToolFromData({\r\n toolType: \"CALLOUT\",\r\n isDefault: false,\r\n label: \"Callout\",\r\n shortcutLabel: \"c\",\r\n hotkeys: [{ keyCode: \"KeyC\" }],\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new CalloutsFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Callouts AppObject from\r\n * @returns A new CalloutsFeatureFactory instance\r\n */\r\nexport function makeCalloutsFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): CalloutsFeatureFactory {\r\n return new CalloutsFeatureFactory(appObjects.getOrCreate(\"Callouts\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeHideableFeatureFactory } from "../../Hideable";
|
|
3
|
+
import { makeKeyboardInputFeatureFactory } from "../../KeyboardInput";
|
|
4
|
+
import { makeMouseInputFeatureFactory } from "../../MouseInput";
|
|
5
|
+
import { makeStateMachineFeatureFactory } from "../../StateMachine";
|
|
6
|
+
import { makeToolsFeatureFactory, ToolRepository } from "../../Tools";
|
|
7
|
+
import { makeTouchControllerFeatureFactory } from "../../TouchController";
|
|
8
|
+
import { makeCalloutsFeatureFactory } from "./CalloutsFeatureFactory";
|
|
9
|
+
import { setupCallouts } from "./setupCallouts";
|
|
10
|
+
function makeTestRig() {
|
|
11
|
+
const appObjects = makeAppObjectRepo();
|
|
12
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
13
|
+
const mockError = jest.fn();
|
|
14
|
+
appObjects.submitError = mockError;
|
|
15
|
+
return { appObjects, factories, mockError };
|
|
16
|
+
}
|
|
17
|
+
function registerCollaborators(appObjects) {
|
|
18
|
+
makeKeyboardInputFeatureFactory(appObjects);
|
|
19
|
+
makeMouseInputFeatureFactory(appObjects);
|
|
20
|
+
makeTouchControllerFeatureFactory(appObjects);
|
|
21
|
+
makeStateMachineFeatureFactory(appObjects);
|
|
22
|
+
}
|
|
23
|
+
function componentTypes(appObjects) {
|
|
24
|
+
const types = {};
|
|
25
|
+
appObjects.getAll().forEach((ao) => {
|
|
26
|
+
types[ao.id] = ao
|
|
27
|
+
.allComponents()
|
|
28
|
+
.filter((c) => !(c instanceof DomainFactory))
|
|
29
|
+
.map((c) => c.type)
|
|
30
|
+
.sort();
|
|
31
|
+
});
|
|
32
|
+
return types;
|
|
33
|
+
}
|
|
34
|
+
function toolTypes(appObjects) {
|
|
35
|
+
return ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
|
|
36
|
+
}
|
|
37
|
+
describe("CalloutsFeatureFactory", () => {
|
|
38
|
+
it("Builds the same components as setupCallouts", () => {
|
|
39
|
+
const legacy = makeTestRig();
|
|
40
|
+
registerCollaborators(legacy.appObjects);
|
|
41
|
+
makeToolsFeatureFactory(legacy.appObjects);
|
|
42
|
+
legacy.factories.setupDomain();
|
|
43
|
+
setupCallouts(legacy.appObjects);
|
|
44
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
45
|
+
registerCollaborators(appObjects);
|
|
46
|
+
makeToolsFeatureFactory(appObjects);
|
|
47
|
+
makeCalloutsFeatureFactory(appObjects);
|
|
48
|
+
factories.setupDomain();
|
|
49
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
50
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
51
|
+
});
|
|
52
|
+
it("Creates the CALLOUT tool in finalSetup", () => {
|
|
53
|
+
const { appObjects, factories } = makeTestRig();
|
|
54
|
+
registerCollaborators(appObjects);
|
|
55
|
+
makeToolsFeatureFactory(appObjects);
|
|
56
|
+
makeCalloutsFeatureFactory(appObjects);
|
|
57
|
+
const all = factories.getAll();
|
|
58
|
+
all.forEach((f) => f.setupEntities());
|
|
59
|
+
all.forEach((f) => f.setupUCs());
|
|
60
|
+
all.forEach((f) => f.setupPMs());
|
|
61
|
+
expect(ToolRepository.get(appObjects).getTool("CALLOUT")).toBeUndefined();
|
|
62
|
+
all.forEach((f) => f.finalSetup());
|
|
63
|
+
expect(ToolRepository.get(appObjects).getTool("CALLOUT")).toBeDefined();
|
|
64
|
+
});
|
|
65
|
+
it("Creates tools in factory registration order", () => {
|
|
66
|
+
const first = makeTestRig();
|
|
67
|
+
registerCollaborators(first.appObjects);
|
|
68
|
+
makeCalloutsFeatureFactory(first.appObjects);
|
|
69
|
+
makeHideableFeatureFactory(first.appObjects);
|
|
70
|
+
makeToolsFeatureFactory(first.appObjects);
|
|
71
|
+
first.factories.setupDomain();
|
|
72
|
+
const second = makeTestRig();
|
|
73
|
+
registerCollaborators(second.appObjects);
|
|
74
|
+
makeHideableFeatureFactory(second.appObjects);
|
|
75
|
+
makeCalloutsFeatureFactory(second.appObjects);
|
|
76
|
+
makeToolsFeatureFactory(second.appObjects);
|
|
77
|
+
second.factories.setupDomain();
|
|
78
|
+
expect(toolTypes(first.appObjects)).toEqual(["CALLOUT", "HIDE"]);
|
|
79
|
+
expect(toolTypes(second.appObjects)).toEqual(["HIDE", "CALLOUT"]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=CalloutsFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalloutsFeatureFactory.test.js","sourceRoot":"","sources":["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KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAE9B,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,0BAA0B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,0BAA0B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,uBAAuB,CAAC,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,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACpE,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 { makeHideableFeatureFactory } from \"../../Hideable\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeToolsFeatureFactory, ToolRepository } from \"../../Tools\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { makeCalloutsFeatureFactory } from \"./CalloutsFeatureFactory\";\r\nimport { setupCallouts } from \"./setupCallouts\";\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}\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(\"CalloutsFeatureFactory\", () => {\r\n it(\"Builds the same components as setupCallouts\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeToolsFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupCallouts(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeCalloutsFeatureFactory(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(\"Creates the CALLOUT tool in finalSetup\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeCalloutsFeatureFactory(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(\"CALLOUT\")).toBeUndefined();\r\n\r\n all.forEach((f) => f.finalSetup());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"CALLOUT\")).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 makeCalloutsFeatureFactory(first.appObjects);\r\n makeHideableFeatureFactory(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 makeHideableFeatureFactory(second.appObjects);\r\n makeCalloutsFeatureFactory(second.appObjects);\r\n makeToolsFeatureFactory(second.appObjects);\r\n second.factories.setupDomain();\r\n\r\n expect(toolTypes(first.appObjects)).toEqual([\"CALLOUT\", \"HIDE\"]);\r\n expect(toolTypes(second.appObjects)).toEqual([\"HIDE\", \"CALLOUT\"]);\r\n });\r\n});\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./calloutFactory\";\nexport * from \"./calloutRepoFactory\";\nexport * from \"./setupCallouts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./calloutFactory\";\r\nexport * from \"./calloutRepoFactory\";\r\nexport * from \"./setupCallouts\";\r\nexport * from \"./CalloutsFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { makeTryPanTransformUC, MousePanTransformMC, TouchPanTransformTC, } from "../../Transform3D";
|
|
3
|
+
import { makeChannelModelRepo } from "../Entities";
|
|
4
|
+
import { makeActiveModelObjectListPM, makeActiveModelPM } from "../PMs";
|
|
5
|
+
import { makeLoadChannelModelUC, makeSelectChannelModelUC, makeValidateChannelModel, } from "../UC";
|
|
6
|
+
import { makeChannelModelFactory } from "./channelModelFactory";
|
|
7
|
+
/**
|
|
8
|
+
* Factory responsible for setting up the ChannelModel Feature domain components.
|
|
9
|
+
*
|
|
10
|
+
* Builds the same components as the legacy setupChannelModels function, split
|
|
11
|
+
* into the DomainFactory phases.
|
|
12
|
+
*
|
|
13
|
+
* @extends DomainFactory
|
|
14
|
+
*/
|
|
15
|
+
export class ChannelModelFeatureFactory extends DomainFactory {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.factoryName = "ChannelModelFeatureFactory";
|
|
19
|
+
}
|
|
20
|
+
setupEntities() {
|
|
21
|
+
const repo = makeChannelModelRepo(this.appObject);
|
|
22
|
+
repo.channelModelFactory = makeChannelModelFactory(this.appObjects);
|
|
23
|
+
}
|
|
24
|
+
setupUCs() {
|
|
25
|
+
makeLoadChannelModelUC(this.appObject);
|
|
26
|
+
makeSelectChannelModelUC(this.appObject);
|
|
27
|
+
makeTryPanTransformUC(this.appObject);
|
|
28
|
+
makeValidateChannelModel(this.appObject);
|
|
29
|
+
}
|
|
30
|
+
setupPMs() {
|
|
31
|
+
makeActiveModelPM(this.appObject);
|
|
32
|
+
makeActiveModelObjectListPM(this.appObject);
|
|
33
|
+
}
|
|
34
|
+
finalSetup() {
|
|
35
|
+
new MousePanTransformMC(this.appObject);
|
|
36
|
+
new TouchPanTransformTC(this.appObject);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Factory function to create a new ChannelModelFeatureFactory
|
|
41
|
+
* @param appObjects The AppObjectRepo to get or create the ChannelModels AppObject from
|
|
42
|
+
* @returns A new ChannelModelFeatureFactory instance
|
|
43
|
+
*/
|
|
44
|
+
export function makeChannelModelFeatureFactory(appObjects) {
|
|
45
|
+
return new ChannelModelFeatureFactory(appObjects.getOrCreate("ChannelModels"));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ChannelModelFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChannelModelFeatureFactory.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/ChannelModelFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA2B,SAAQ,aAAa;IAA7D;;QACE,gBAAW,GAAG,4BAA4B,CAAC;IAuB7C,CAAC;IArBC,aAAa;QACX,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtE,CAAC;IAED,QAAQ;QACN,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ;QACN,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,UAAU;QACR,IAAI,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,UAAyB;IAEzB,OAAO,IAAI,0BAA0B,CACnC,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CACxC,CAAC;AACJ,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport {\r\n makeTryPanTransformUC,\r\n MousePanTransformMC,\r\n TouchPanTransformTC,\r\n} from \"../../Transform3D\";\r\nimport { makeChannelModelRepo } from \"../Entities\";\r\nimport { makeActiveModelObjectListPM, makeActiveModelPM } from \"../PMs\";\r\nimport {\r\n makeLoadChannelModelUC,\r\n makeSelectChannelModelUC,\r\n makeValidateChannelModel,\r\n} from \"../UC\";\r\nimport { makeChannelModelFactory } from \"./channelModelFactory\";\r\n\r\n/**\r\n * Factory responsible for setting up the ChannelModel Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupChannelModels function, split\r\n * into the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class ChannelModelFeatureFactory extends DomainFactory {\r\n factoryName = \"ChannelModelFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n const repo = makeChannelModelRepo(this.appObject);\r\n repo.channelModelFactory = makeChannelModelFactory(this.appObjects);\r\n }\r\n\r\n setupUCs(): void {\r\n makeLoadChannelModelUC(this.appObject);\r\n makeSelectChannelModelUC(this.appObject);\r\n makeTryPanTransformUC(this.appObject);\r\n makeValidateChannelModel(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeActiveModelPM(this.appObject);\r\n makeActiveModelObjectListPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n new MousePanTransformMC(this.appObject);\r\n new TouchPanTransformTC(this.appObject);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ChannelModelFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the ChannelModels AppObject from\r\n * @returns A new ChannelModelFeatureFactory instance\r\n */\r\nexport function makeChannelModelFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): ChannelModelFeatureFactory {\r\n return new ChannelModelFeatureFactory(\r\n appObjects.getOrCreate(\"ChannelModels\"),\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeMouseInputFeatureFactory } from "../../MouseInput";
|
|
3
|
+
import { makeTouchControllerFeatureFactory } from "../../TouchController";
|
|
4
|
+
import { makeChannelModelFeatureFactory } from "./ChannelModelFeatureFactory";
|
|
5
|
+
import { setupChannelModels } from "./setupChannelModels";
|
|
6
|
+
function makeTestRig() {
|
|
7
|
+
const appObjects = makeAppObjectRepo();
|
|
8
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
9
|
+
const mockError = jest.fn();
|
|
10
|
+
appObjects.submitError = mockError;
|
|
11
|
+
return { appObjects, factories, mockError };
|
|
12
|
+
}
|
|
13
|
+
function registerCollaborators(appObjects) {
|
|
14
|
+
makeMouseInputFeatureFactory(appObjects);
|
|
15
|
+
makeTouchControllerFeatureFactory(appObjects);
|
|
16
|
+
}
|
|
17
|
+
function componentTypes(appObjects) {
|
|
18
|
+
const types = {};
|
|
19
|
+
appObjects.getAll().forEach((ao) => {
|
|
20
|
+
types[ao.id] = ao
|
|
21
|
+
.allComponents()
|
|
22
|
+
.filter((c) => !(c instanceof DomainFactory))
|
|
23
|
+
.map((c) => c.type)
|
|
24
|
+
.sort();
|
|
25
|
+
});
|
|
26
|
+
return types;
|
|
27
|
+
}
|
|
28
|
+
describe("ChannelModelFeatureFactory", () => {
|
|
29
|
+
it("Builds the same components as setupChannelModels", () => {
|
|
30
|
+
const legacy = makeTestRig();
|
|
31
|
+
registerCollaborators(legacy.appObjects);
|
|
32
|
+
legacy.factories.setupDomain();
|
|
33
|
+
setupChannelModels(legacy.appObjects);
|
|
34
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
35
|
+
registerCollaborators(appObjects);
|
|
36
|
+
makeChannelModelFeatureFactory(appObjects);
|
|
37
|
+
factories.setupDomain();
|
|
38
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
39
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=ChannelModelFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChannelModelFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/ChannelModelFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,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,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACzC,iCAAiC,CAAC,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,cAAc,CAA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from \"@vived/core\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { makeChannelModelFeatureFactory } from \"./ChannelModelFeatureFactory\";\r\nimport { setupChannelModels } from \"./setupChannelModels\";\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(\"ChannelModelFeatureFactory\", () => {\r\n it(\"Builds the same components as setupChannelModels\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupChannelModels(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeChannelModelFeatureFactory(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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC","sourcesContent":["export * from \"./channelModelFactory\";\nexport * from \"./channelObjectFactory\";\nexport * from \"./setupChannelModels\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./channelModelFactory\";\r\nexport * from \"./channelObjectFactory\";\r\nexport * from \"./setupChannelModels\";\r\nexport * from \"./ChannelModelFeatureFactory\";\r\n"]}
|