@vived/app 6.8.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/Dispatcher/Factories/DispatcherFeatureFactory.js +4 -3
- package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.js.map +1 -1
- package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.test.js +35 -0
- package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Dispatcher/Factories/setupDispatchers.js +1 -0
- package/dist/cjs/Dispatcher/Factories/setupDispatchers.js.map +1 -1
- package/dist/cjs/Dispatcher/Factories/setupDispatchers.test.js +33 -0
- package/dist/cjs/Dispatcher/Factories/setupDispatchers.test.js.map +1 -0
- 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/Dispatcher/Factories/DispatcherFeatureFactory.js +5 -4
- package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.js.map +1 -1
- package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.test.js +33 -0
- package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.test.js.map +1 -0
- package/dist/esm/Dispatcher/Factories/setupDispatchers.js +2 -1
- package/dist/esm/Dispatcher/Factories/setupDispatchers.js.map +1 -1
- package/dist/esm/Dispatcher/Factories/setupDispatchers.test.js +31 -0
- package/dist/esm/Dispatcher/Factories/setupDispatchers.test.js.map +1 -0
- 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/Dispatcher/Factories/DispatcherFeatureFactory.d.ts +3 -3
- package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.d.ts.map +1 -1
- package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.test.d.ts +2 -0
- package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Dispatcher/Factories/setupDispatchers.d.ts.map +1 -1
- package/dist/types/Dispatcher/Factories/setupDispatchers.test.d.ts +2 -0
- package/dist/types/Dispatcher/Factories/setupDispatchers.test.d.ts.map +1 -0
- 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
- package/src/Dispatcher/README.md +9 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC","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,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./landmarkFactory\";\r\nexport * from \"./landmarkRepoFactory\";\r\nexport * from \"./setupLandmarks\";\r\nexport * from \"./LandmarksFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { KeyboardToClearSelection, MouseHoverOnAppObject, MousePressOnAppObject, MouseSelectAppObject, TapToSelectAppObject, TouchPressOnAppObject, } from "../Controller";
|
|
3
|
+
import { makeSelection } from "../Entities";
|
|
4
|
+
import { makeSelectedObjectPM } from "../PM";
|
|
5
|
+
import { ClearSelectionUCHook, makeHoverAppObject, makePressAppObject, makeSelectAppObject, } from "../UC";
|
|
6
|
+
/**
|
|
7
|
+
* Factory responsible for setting up the Selection Feature domain components.
|
|
8
|
+
*
|
|
9
|
+
* Builds the same components as the legacy setupSelection function, split
|
|
10
|
+
* into the DomainFactory phases.
|
|
11
|
+
*
|
|
12
|
+
* The Hover, Press and Select UCs exist after setupUCs. An app that overrides
|
|
13
|
+
* their allow* hooks can do so from its own factory's setupPMs or finalSetup,
|
|
14
|
+
* through HoverAppObjectUC.get, PressAppObjectUC.get and SelectAppObjectUC.get.
|
|
15
|
+
*
|
|
16
|
+
* @extends DomainFactory
|
|
17
|
+
*/
|
|
18
|
+
export class SelectionFeatureFactory extends DomainFactory {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.factoryName = "SelectionFeatureFactory";
|
|
22
|
+
}
|
|
23
|
+
setupEntities() {
|
|
24
|
+
makeSelection(this.appObject);
|
|
25
|
+
}
|
|
26
|
+
setupUCs() {
|
|
27
|
+
new ClearSelectionUCHook(this.appObject);
|
|
28
|
+
makeHoverAppObject(this.appObject);
|
|
29
|
+
makePressAppObject(this.appObject);
|
|
30
|
+
makeSelectAppObject(this.appObject);
|
|
31
|
+
}
|
|
32
|
+
setupPMs() {
|
|
33
|
+
makeSelectedObjectPM(this.appObject);
|
|
34
|
+
}
|
|
35
|
+
finalSetup() {
|
|
36
|
+
new MouseHoverOnAppObject(this.appObject);
|
|
37
|
+
new MousePressOnAppObject(this.appObject);
|
|
38
|
+
new TouchPressOnAppObject(this.appObject);
|
|
39
|
+
new MouseSelectAppObject(this.appObject);
|
|
40
|
+
new TapToSelectAppObject(this.appObject);
|
|
41
|
+
new KeyboardToClearSelection(this.appObject);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create a new SelectionFeatureFactory
|
|
46
|
+
* @param appObjects The AppObjectRepo to get or create the Selection AppObject from
|
|
47
|
+
* @returns A new SelectionFeatureFactory instance
|
|
48
|
+
*/
|
|
49
|
+
export function makeSelectionFeatureFactory(appObjects) {
|
|
50
|
+
return new SelectionFeatureFactory(appObjects.getOrCreate("Selection"));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=SelectionFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/SelectionFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,OAAO,CAAC;AAEf;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,uBAAwB,SAAQ,aAAa;IAA1D;;QACE,gBAAW,GAAG,yBAAyB,CAAC;IAyB1C,CAAC;IAvBC,aAAa;QACX,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ;QACN,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,UAAU;QACR,IAAI,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,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,58 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeBaseAppState } from "../../BaseApp/Entity/BaseAppState";
|
|
3
|
+
import { makeKeyboardInputFeatureFactory } from "../../KeyboardInput";
|
|
4
|
+
import { makeMouseInputFeatureFactory } from "../../MouseInput";
|
|
5
|
+
import { makeTouchControllerFeatureFactory } from "../../TouchController";
|
|
6
|
+
import { HoverAppObjectUC, PressAppObjectUC, SelectAppObjectUC } from "../UC";
|
|
7
|
+
import { makeSelectionFeatureFactory } from "./SelectionFeatureFactory";
|
|
8
|
+
import { setupSelection } from "./setupSelection";
|
|
9
|
+
function makeTestRig() {
|
|
10
|
+
const appObjects = makeAppObjectRepo();
|
|
11
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
12
|
+
const mockError = jest.fn();
|
|
13
|
+
appObjects.submitError = mockError;
|
|
14
|
+
return { appObjects, factories, mockError };
|
|
15
|
+
}
|
|
16
|
+
function registerCollaborators(appObjects) {
|
|
17
|
+
makeBaseAppState(appObjects.getOrCreate("BaseApp"));
|
|
18
|
+
makeKeyboardInputFeatureFactory(appObjects);
|
|
19
|
+
makeMouseInputFeatureFactory(appObjects);
|
|
20
|
+
makeTouchControllerFeatureFactory(appObjects);
|
|
21
|
+
}
|
|
22
|
+
function componentTypes(appObjects) {
|
|
23
|
+
const types = {};
|
|
24
|
+
appObjects.getAll().forEach((ao) => {
|
|
25
|
+
types[ao.id] = ao
|
|
26
|
+
.allComponents()
|
|
27
|
+
.filter((c) => !(c instanceof DomainFactory))
|
|
28
|
+
.map((c) => c.type)
|
|
29
|
+
.sort();
|
|
30
|
+
});
|
|
31
|
+
return types;
|
|
32
|
+
}
|
|
33
|
+
describe("SelectionFeatureFactory", () => {
|
|
34
|
+
it("Builds the same components as setupSelection", () => {
|
|
35
|
+
const legacy = makeTestRig();
|
|
36
|
+
registerCollaborators(legacy.appObjects);
|
|
37
|
+
legacy.factories.setupDomain();
|
|
38
|
+
setupSelection(legacy.appObjects);
|
|
39
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
40
|
+
registerCollaborators(appObjects);
|
|
41
|
+
makeSelectionFeatureFactory(appObjects);
|
|
42
|
+
factories.setupDomain();
|
|
43
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
44
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
45
|
+
});
|
|
46
|
+
it("Builds the Hover, Press and Select UCs in setupUCs, so a later phase can override their allow hooks", () => {
|
|
47
|
+
const { appObjects, factories } = makeTestRig();
|
|
48
|
+
registerCollaborators(appObjects);
|
|
49
|
+
makeSelectionFeatureFactory(appObjects);
|
|
50
|
+
const all = factories.getAll();
|
|
51
|
+
all.forEach((f) => f.setupEntities());
|
|
52
|
+
all.forEach((f) => f.setupUCs());
|
|
53
|
+
expect(HoverAppObjectUC.get(appObjects)).toBeDefined();
|
|
54
|
+
expect(PressAppObjectUC.get(appObjects)).toBeDefined();
|
|
55
|
+
expect(SelectAppObjectUC.get(appObjects)).toBeDefined();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
//# 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,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,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,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,+BAA+B,CAAC,UAAU,CAAC,CAAC;IAC5C,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACzC,iCAAiC,CAAC,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,aAAa,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,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAElC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,2BAA2B,CAAC,UAAU,CAAC,CAAC;QACxC,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;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,2BAA2B,CAAC,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,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,CAAC,iBAAiB,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./setupSelection\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./setupSelection\";\r\nexport * from \"./SelectionFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { DoubleClickToStickMC } from "../Controllers/DoubleClickToStickMC";
|
|
3
|
+
import { DoubleTapToStickTC } from "../Controllers/DoubleTapToStickTC";
|
|
4
|
+
import { makeTryStickAppObjectUC } from "../UCs/TryStickAppObjectUC";
|
|
5
|
+
/**
|
|
6
|
+
* Factory responsible for setting up the Stick Feature domain components.
|
|
7
|
+
*
|
|
8
|
+
* Builds the same components as the legacy setupStick function, split into
|
|
9
|
+
* the DomainFactory phases.
|
|
10
|
+
*
|
|
11
|
+
* @extends DomainFactory
|
|
12
|
+
*/
|
|
13
|
+
export class StickFeatureFactory extends DomainFactory {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.factoryName = "StickFeatureFactory";
|
|
17
|
+
}
|
|
18
|
+
setupEntities() {
|
|
19
|
+
// No entities for this feature
|
|
20
|
+
}
|
|
21
|
+
setupUCs() {
|
|
22
|
+
makeTryStickAppObjectUC(this.appObject);
|
|
23
|
+
}
|
|
24
|
+
setupPMs() {
|
|
25
|
+
// No PMs for this feature
|
|
26
|
+
}
|
|
27
|
+
finalSetup() {
|
|
28
|
+
new DoubleClickToStickMC(this.appObject);
|
|
29
|
+
new DoubleTapToStickTC(this.appObject);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Factory function to create a new StickFeatureFactory
|
|
34
|
+
* @param appObjects The AppObjectRepo to get or create the Stick AppObject from
|
|
35
|
+
* @returns A new StickFeatureFactory instance
|
|
36
|
+
*/
|
|
37
|
+
export function makeStickFeatureFactory(appObjects) {
|
|
38
|
+
return new StickFeatureFactory(appObjects.getOrCreate("Stick"));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=StickFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/StickFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAAtD;;QACE,gBAAW,GAAG,qBAAqB,CAAC;IAkBtC,CAAC;IAhBC,aAAa;QACX,+BAA+B;IACjC,CAAC;IAED,QAAQ;QACN,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,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,42 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeMouseInputFeatureFactory } from "../../MouseInput";
|
|
3
|
+
import { makeTouchControllerFeatureFactory } from "../../TouchController";
|
|
4
|
+
import { setupStick } from "./setupStick";
|
|
5
|
+
import { makeStickFeatureFactory } from "./StickFeatureFactory";
|
|
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("StickFeatureFactory", () => {
|
|
29
|
+
it("Builds the same components as setupStick", () => {
|
|
30
|
+
const legacy = makeTestRig();
|
|
31
|
+
registerCollaborators(legacy.appObjects);
|
|
32
|
+
legacy.factories.setupDomain();
|
|
33
|
+
setupStick(legacy.appObjects);
|
|
34
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
35
|
+
registerCollaborators(appObjects);
|
|
36
|
+
makeStickFeatureFactory(appObjects);
|
|
37
|
+
factories.setupDomain();
|
|
38
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
39
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# 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,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,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,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,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,aAAa,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,UAAU,CAAC,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,uBAAuB,CAAC,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from \"./setupStick\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./setupStick\";\r\nexport * from \"./StickFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { makeStoredView } from "../Entities";
|
|
3
|
+
import { makeHasStoredViewPM } from "../PM";
|
|
4
|
+
import { makeClearStoredViewUC, makeRestoreStoredViewUC, makeSerializeStoredView, makeSetViewInXRUC, makeStoreCurrentViewUC, } from "../UC";
|
|
5
|
+
/**
|
|
6
|
+
* Factory responsible for setting up the StoredView Feature domain components.
|
|
7
|
+
*
|
|
8
|
+
* Builds the same components as the legacy setupStoredView function, split
|
|
9
|
+
* into the DomainFactory phases.
|
|
10
|
+
*
|
|
11
|
+
* @extends DomainFactory
|
|
12
|
+
*/
|
|
13
|
+
export class StoredViewFeatureFactory extends DomainFactory {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.factoryName = "StoredViewFeatureFactory";
|
|
17
|
+
}
|
|
18
|
+
setupEntities() {
|
|
19
|
+
makeStoredView(this.appObject);
|
|
20
|
+
}
|
|
21
|
+
setupUCs() {
|
|
22
|
+
makeStoreCurrentViewUC(this.appObject);
|
|
23
|
+
makeRestoreStoredViewUC(this.appObject);
|
|
24
|
+
makeClearStoredViewUC(this.appObject);
|
|
25
|
+
makeSetViewInXRUC(this.appObject);
|
|
26
|
+
makeSerializeStoredView(this.appObject);
|
|
27
|
+
}
|
|
28
|
+
setupPMs() {
|
|
29
|
+
makeHasStoredViewPM(this.appObject);
|
|
30
|
+
}
|
|
31
|
+
finalSetup() {
|
|
32
|
+
// No final setup needed
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Factory function to create a new StoredViewFeatureFactory
|
|
37
|
+
* @param appObjects The AppObjectRepo to get or create the StoredView AppObject from
|
|
38
|
+
* @returns A new StoredViewFeatureFactory instance
|
|
39
|
+
*/
|
|
40
|
+
export function makeStoredViewFeatureFactory(appObjects) {
|
|
41
|
+
return new StoredViewFeatureFactory(appObjects.getOrCreate("StoredView"));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=StoredViewFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoredViewFeatureFactory.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/StoredViewFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,OAAO,CAAC;AAEf;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAA3D;;QACE,gBAAW,GAAG,0BAA0B,CAAC;IAqB3C,CAAC;IAnBC,aAAa;QACX,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,QAAQ;QACN,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,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,37 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeStateMachineFeatureFactory } from "../../StateMachine";
|
|
3
|
+
import { setupStoredView } from "./setupStoredView";
|
|
4
|
+
import { makeStoredViewFeatureFactory } from "./StoredViewFeatureFactory";
|
|
5
|
+
function makeTestRig() {
|
|
6
|
+
const appObjects = makeAppObjectRepo();
|
|
7
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
8
|
+
const mockError = jest.fn();
|
|
9
|
+
appObjects.submitError = mockError;
|
|
10
|
+
return { appObjects, factories, mockError };
|
|
11
|
+
}
|
|
12
|
+
function componentTypes(appObjects) {
|
|
13
|
+
const types = {};
|
|
14
|
+
appObjects.getAll().forEach((ao) => {
|
|
15
|
+
types[ao.id] = ao
|
|
16
|
+
.allComponents()
|
|
17
|
+
.filter((c) => !(c instanceof DomainFactory))
|
|
18
|
+
.map((c) => c.type)
|
|
19
|
+
.sort();
|
|
20
|
+
});
|
|
21
|
+
return types;
|
|
22
|
+
}
|
|
23
|
+
describe("StoredViewFeatureFactory", () => {
|
|
24
|
+
it("Builds the same components as setupStoredView", () => {
|
|
25
|
+
const legacy = makeTestRig();
|
|
26
|
+
makeStateMachineFeatureFactory(legacy.appObjects);
|
|
27
|
+
legacy.factories.setupDomain();
|
|
28
|
+
setupStoredView(legacy.appObjects);
|
|
29
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
30
|
+
makeStateMachineFeatureFactory(appObjects);
|
|
31
|
+
makeStoredViewFeatureFactory(appObjects);
|
|
32
|
+
factories.setupDomain();
|
|
33
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
34
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
//# 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,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE1E,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,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,aAAa,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,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,8BAA8B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,8BAA8B,CAAC,UAAU,CAAC,CAAC;QAC3C,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACzC,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 { 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"./setupStoredView\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./setupStoredView\";\r\nexport * from \"./StoredViewFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { makeTransform3DPM } from "../../Transform3D";
|
|
3
|
+
import { makeStylusEntity } from "../Entity";
|
|
4
|
+
import { makeStylusColorLengthPM, makeStylusIsInUsePM } from "../PMs";
|
|
5
|
+
import { makeEmulateStylusUC } from "../UCs";
|
|
6
|
+
/**
|
|
7
|
+
* Factory responsible for setting up the Stylus Feature domain components.
|
|
8
|
+
*
|
|
9
|
+
* Builds the same components as the legacy setupStylus function, split into
|
|
10
|
+
* the DomainFactory phases.
|
|
11
|
+
*
|
|
12
|
+
* @extends DomainFactory
|
|
13
|
+
*/
|
|
14
|
+
export class StylusFeatureFactory extends DomainFactory {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.factoryName = "StylusFeatureFactory";
|
|
18
|
+
}
|
|
19
|
+
setupEntities() {
|
|
20
|
+
makeStylusEntity(this.appObject);
|
|
21
|
+
}
|
|
22
|
+
setupUCs() {
|
|
23
|
+
makeEmulateStylusUC(this.appObject);
|
|
24
|
+
}
|
|
25
|
+
setupPMs() {
|
|
26
|
+
makeStylusColorLengthPM(this.appObject);
|
|
27
|
+
makeStylusIsInUsePM(this.appObject);
|
|
28
|
+
makeTransform3DPM(this.appObject);
|
|
29
|
+
}
|
|
30
|
+
finalSetup() {
|
|
31
|
+
// No final setup needed
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Factory function to create a new StylusFeatureFactory
|
|
36
|
+
* @param appObjects The AppObjectRepo to get or create the Stylus AppObject from
|
|
37
|
+
* @returns A new StylusFeatureFactory instance
|
|
38
|
+
*/
|
|
39
|
+
export function makeStylusFeatureFactory(appObjects) {
|
|
40
|
+
return new StylusFeatureFactory(appObjects.getOrCreate("Stylus"));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=StylusFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StylusFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/StylusFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IAAvD;;QACE,gBAAW,GAAG,sBAAsB,CAAC;IAmBvC,CAAC;IAjBC,aAAa;QACX,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ;QACN,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,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,33 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { setupStylus } from "./setupStylus";
|
|
3
|
+
import { makeStylusFeatureFactory } from "./StylusFeatureFactory";
|
|
4
|
+
function makeTestRig() {
|
|
5
|
+
const appObjects = makeAppObjectRepo();
|
|
6
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
7
|
+
const mockError = jest.fn();
|
|
8
|
+
appObjects.submitError = mockError;
|
|
9
|
+
return { appObjects, factories, mockError };
|
|
10
|
+
}
|
|
11
|
+
function componentTypes(appObjects) {
|
|
12
|
+
const types = {};
|
|
13
|
+
appObjects.getAll().forEach((ao) => {
|
|
14
|
+
types[ao.id] = ao
|
|
15
|
+
.allComponents()
|
|
16
|
+
.filter((c) => !(c instanceof DomainFactory))
|
|
17
|
+
.map((c) => c.type)
|
|
18
|
+
.sort();
|
|
19
|
+
});
|
|
20
|
+
return types;
|
|
21
|
+
}
|
|
22
|
+
describe("StylusFeatureFactory", () => {
|
|
23
|
+
it("Builds the same components as setupStylus", () => {
|
|
24
|
+
const legacy = makeTestRig();
|
|
25
|
+
setupStylus(legacy.appObjects);
|
|
26
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
27
|
+
makeStylusFeatureFactory(appObjects);
|
|
28
|
+
factories.setupDomain();
|
|
29
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
30
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=StylusFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StylusFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/StylusFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,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,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,aAAa,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,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE/B,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACrC,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 { 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./setupStylus\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stylus/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./setupStylus\";\r\nexport * from \"./StylusFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { IsZSpaceAvailableUC } from "../../Dispatcher";
|
|
3
|
+
import { makeTransform3DPM, Transform3D } from "../../Transform3D";
|
|
4
|
+
import { makeXREntity } from "../../XR";
|
|
5
|
+
import { makeZSpaceEntity } from "../Entities";
|
|
6
|
+
import { makeZSpaceDisplayPM, makeZSpaceIsEnabledPM, makeZSpaceIsSupportedPM, makeZSpaceViewerScalePM, } from "../PM";
|
|
7
|
+
import { makeCheckZSpaceDisplaySizeUC, makeStylusFromGamepadHook, makeViewFromPoseHook, } from "../UC";
|
|
8
|
+
/**
|
|
9
|
+
* Factory responsible for setting up the zSpace Feature domain components.
|
|
10
|
+
*
|
|
11
|
+
* Builds the same components as the legacy setupZSpace function, split into
|
|
12
|
+
* the DomainFactory phases. The IS_ZSPACE_AVAILABLE request is dispatched in
|
|
13
|
+
* finalSetup, so the Dispatcher Feature's factory can be registered before or
|
|
14
|
+
* after this one.
|
|
15
|
+
*
|
|
16
|
+
* @extends DomainFactory
|
|
17
|
+
*/
|
|
18
|
+
export class ZSpaceFeatureFactory extends DomainFactory {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.factoryName = "ZSpaceFeatureFactory";
|
|
22
|
+
}
|
|
23
|
+
setupEntities() {
|
|
24
|
+
Transform3D.addIfMissing(this.appObject);
|
|
25
|
+
this.zSpaceEntity = makeZSpaceEntity(this.appObject);
|
|
26
|
+
makeXREntity(this.appObject);
|
|
27
|
+
}
|
|
28
|
+
setupUCs() {
|
|
29
|
+
makeViewFromPoseHook(this.appObject);
|
|
30
|
+
makeStylusFromGamepadHook(this.appObject);
|
|
31
|
+
makeCheckZSpaceDisplaySizeUC(this.appObject);
|
|
32
|
+
}
|
|
33
|
+
setupPMs() {
|
|
34
|
+
makeZSpaceIsEnabledPM(this.appObject);
|
|
35
|
+
makeZSpaceViewerScalePM(this.appObject);
|
|
36
|
+
if (this.zSpaceEntity) {
|
|
37
|
+
const displayAO = this.zSpaceEntity.display.appObject;
|
|
38
|
+
makeTransform3DPM(displayAO);
|
|
39
|
+
makeZSpaceDisplayPM(displayAO);
|
|
40
|
+
}
|
|
41
|
+
makeZSpaceIsSupportedPM(this.appObject);
|
|
42
|
+
}
|
|
43
|
+
finalSetup() {
|
|
44
|
+
const zSpaceEntity = this.zSpaceEntity;
|
|
45
|
+
if (!zSpaceEntity)
|
|
46
|
+
return;
|
|
47
|
+
const checkForZSpace = IsZSpaceAvailableUC.get(this.appObjects);
|
|
48
|
+
if (!checkForZSpace) {
|
|
49
|
+
this.appObjects.submitWarning(this.factoryName, "Unable to find IsZSpaceAvailableUC. The Dispatcher Feature needs to be setup for zSpace");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
checkForZSpace.doDispatch().then((isSupported) => {
|
|
53
|
+
zSpaceEntity.isSupported = isSupported;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Factory function to create a new ZSpaceFeatureFactory
|
|
59
|
+
* @param appObjects The AppObjectRepo to get or create the zSpace AppObject from
|
|
60
|
+
* @returns A new ZSpaceFeatureFactory instance
|
|
61
|
+
*/
|
|
62
|
+
export function makeZSpaceFeatureFactory(appObjects) {
|
|
63
|
+
return new ZSpaceFeatureFactory(appObjects.getOrCreate("zSpace"));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=ZSpaceFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZSpaceFeatureFactory.js","sourceRoot":"","sources":["../../../../src/zSpace/Factory/ZSpaceFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAgB,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAEf;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IAAvD;;QACE,gBAAW,GAAG,sBAAsB,CAAC;IA8CvC,CAAC;IA1CC,aAAa;QACX,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,QAAQ;QACN,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,QAAQ;QACN,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,uBAAuB,CAAC,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,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC7B,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QAED,uBAAuB,CAAC,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,mBAAmB,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;AAED;;;;GAIG;AACH,MAAM,UAAU,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"]}
|