@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,45 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { makeEnvironmentEntity } from "../Entities/Environment";
|
|
3
|
+
import { makeEnvironmentalIntensityPM } from "../PMs/EnvironmentalIntensityPM";
|
|
4
|
+
import { makeTexturalEnvironmentPM } from "../PMs/TexturalEnvironmentPM";
|
|
5
|
+
import { SerializeEnvironment } from "../UCs/SerializeEnvironment";
|
|
6
|
+
import { makeSetEnvironmentIntensityUC } from "../UCs/SetEnvironmentIntensityUC";
|
|
7
|
+
import { makeSetTexturalEnvironmentUC } from "../UCs/SetTexturalEnvironmentUC";
|
|
8
|
+
/**
|
|
9
|
+
* Factory responsible for setting up the Environment Feature domain components.
|
|
10
|
+
*
|
|
11
|
+
* Builds the same components as the legacy setupEnvironments function, split
|
|
12
|
+
* into the DomainFactory phases.
|
|
13
|
+
*
|
|
14
|
+
* @extends DomainFactory
|
|
15
|
+
*/
|
|
16
|
+
export class EnvironmentFeatureFactory extends DomainFactory {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.factoryName = "EnvironmentFeatureFactory";
|
|
20
|
+
}
|
|
21
|
+
setupEntities() {
|
|
22
|
+
makeEnvironmentEntity(this.appObject);
|
|
23
|
+
}
|
|
24
|
+
setupUCs() {
|
|
25
|
+
makeSetTexturalEnvironmentUC(this.appObject);
|
|
26
|
+
new SerializeEnvironment(this.appObject);
|
|
27
|
+
makeSetEnvironmentIntensityUC(this.appObject);
|
|
28
|
+
}
|
|
29
|
+
setupPMs() {
|
|
30
|
+
makeTexturalEnvironmentPM(this.appObject);
|
|
31
|
+
makeEnvironmentalIntensityPM(this.appObject);
|
|
32
|
+
}
|
|
33
|
+
finalSetup() {
|
|
34
|
+
// No final setup needed
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create a new EnvironmentFeatureFactory
|
|
39
|
+
* @param appObjects The AppObjectRepo to get or create the Environments AppObject from
|
|
40
|
+
* @returns A new EnvironmentFeatureFactory instance
|
|
41
|
+
*/
|
|
42
|
+
export function makeEnvironmentFeatureFactory(appObjects) {
|
|
43
|
+
return new EnvironmentFeatureFactory(appObjects.getOrCreate("Environments"));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=EnvironmentFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvironmentFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/EnvironmentFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E;;;;;;;GAOG;AACH,MAAM,OAAO,yBAA0B,SAAQ,aAAa;IAA5D;;QACE,gBAAW,GAAG,2BAA2B,CAAC;IAoB5C,CAAC;IAlBC,aAAa;QACX,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ;QACN,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,6BAA6B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAED,QAAQ;QACN,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAC3C,UAAyB;IAEzB,OAAO,IAAI,yBAAyB,CAAC,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { makeEnvironmentEntity } from \"../Entities/Environment\";\r\nimport { makeEnvironmentalIntensityPM } from \"../PMs/EnvironmentalIntensityPM\";\r\nimport { makeTexturalEnvironmentPM } from \"../PMs/TexturalEnvironmentPM\";\r\nimport { SerializeEnvironment } from \"../UCs/SerializeEnvironment\";\r\nimport { makeSetEnvironmentIntensityUC } from \"../UCs/SetEnvironmentIntensityUC\";\r\nimport { makeSetTexturalEnvironmentUC } from \"../UCs/SetTexturalEnvironmentUC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Environment Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupEnvironments function, split\r\n * into the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class EnvironmentFeatureFactory extends DomainFactory {\r\n factoryName = \"EnvironmentFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeEnvironmentEntity(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n makeSetTexturalEnvironmentUC(this.appObject);\r\n new SerializeEnvironment(this.appObject);\r\n makeSetEnvironmentIntensityUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeTexturalEnvironmentPM(this.appObject);\r\n makeEnvironmentalIntensityPM(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 EnvironmentFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Environments AppObject from\r\n * @returns A new EnvironmentFeatureFactory instance\r\n */\r\nexport function makeEnvironmentFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): EnvironmentFeatureFactory {\r\n return new EnvironmentFeatureFactory(appObjects.getOrCreate(\"Environments\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeStateMachineFeatureFactory } from "../../StateMachine";
|
|
3
|
+
import { makeEnvironmentFeatureFactory } from "./EnvironmentFeatureFactory";
|
|
4
|
+
import { setupEnvironments } from "./setupEnvironments";
|
|
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("EnvironmentFeatureFactory", () => {
|
|
24
|
+
it("Builds the same components as setupEnvironments", () => {
|
|
25
|
+
const legacy = makeTestRig();
|
|
26
|
+
makeStateMachineFeatureFactory(legacy.appObjects);
|
|
27
|
+
legacy.factories.setupDomain();
|
|
28
|
+
setupEnvironments(legacy.appObjects);
|
|
29
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
30
|
+
makeStateMachineFeatureFactory(appObjects);
|
|
31
|
+
makeEnvironmentFeatureFactory(appObjects);
|
|
32
|
+
factories.setupDomain();
|
|
33
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
34
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=EnvironmentFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvironmentFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/EnvironmentFeatureFactory.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,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,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,C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n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeEnvironmentFeatureFactory } from \"./EnvironmentFeatureFactory\";\r\nimport { setupEnvironments } from \"./setupEnvironments\";\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(\"EnvironmentFeatureFactory\", () => {\r\n it(\"Builds the same components as setupEnvironments\", () => {\r\n const legacy = makeTestRig();\r\n makeStateMachineFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupEnvironments(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n makeStateMachineFeatureFactory(appObjects);\r\n makeEnvironmentFeatureFactory(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/Environment/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from \"./
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from \"./setupEnvironments\";\r\nexport * from \"./EnvironmentFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { makeEnvironmentEntity } from "../Entities/Environment";
|
|
2
|
+
import { makeEnvironmentalIntensityPM } from "../PMs/EnvironmentalIntensityPM";
|
|
3
|
+
import { makeTexturalEnvironmentPM } from "../PMs/TexturalEnvironmentPM";
|
|
4
|
+
import { SerializeEnvironment } from "../UCs/SerializeEnvironment";
|
|
5
|
+
import { makeSetEnvironmentIntensityUC } from "../UCs/SetEnvironmentIntensityUC";
|
|
6
|
+
import { makeSetTexturalEnvironmentUC } from "../UCs/SetTexturalEnvironmentUC";
|
|
7
|
+
export function setupEnvironments(appObjects) {
|
|
8
|
+
const ao = appObjects.getOrCreate("Environments");
|
|
9
|
+
makeEnvironmentEntity(ao);
|
|
10
|
+
makeSetTexturalEnvironmentUC(ao);
|
|
11
|
+
new SerializeEnvironment(ao);
|
|
12
|
+
makeSetEnvironmentIntensityUC(ao);
|
|
13
|
+
makeTexturalEnvironmentPM(ao);
|
|
14
|
+
makeEnvironmentalIntensityPM(ao);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=setupEnvironments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupEnvironments.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/setupEnvironments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,UAAU,iBAAiB,CAAC,UAAyB;IACzD,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAElD,qBAAqB,CAAC,EAAE,CAAC,CAAC;IAE1B,4BAA4B,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAC7B,6BAA6B,CAAC,EAAE,CAAC,CAAC;IAElC,yBAAyB,CAAC,EAAE,CAAC,CAAC;IAC9B,4BAA4B,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport { makeEnvironmentEntity } from \"../Entities/Environment\";\r\nimport { makeEnvironmentalIntensityPM } from \"../PMs/EnvironmentalIntensityPM\";\r\nimport { makeTexturalEnvironmentPM } from \"../PMs/TexturalEnvironmentPM\";\r\nimport { SerializeEnvironment } from \"../UCs/SerializeEnvironment\";\r\nimport { makeSetEnvironmentIntensityUC } from \"../UCs/SetEnvironmentIntensityUC\";\r\nimport { makeSetTexturalEnvironmentUC } from \"../UCs/SetTexturalEnvironmentUC\";\r\n\r\nexport function setupEnvironments(appObjects: AppObjectRepo) {\r\n const ao = appObjects.getOrCreate(\"Environments\");\r\n\r\n makeEnvironmentEntity(ao);\r\n\r\n makeSetTexturalEnvironmentUC(ao);\r\n new SerializeEnvironment(ao);\r\n makeSetEnvironmentIntensityUC(ao);\r\n\r\n makeTexturalEnvironmentPM(ao);\r\n makeEnvironmentalIntensityPM(ao);\r\n}\r\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { ToolRepository } from "../../Tools";
|
|
3
|
+
import { HideMC, HideTC } from "../Controllers";
|
|
4
|
+
import { makeSerializeHideableObjects, makeTryHideWithPickUC } from "../UCs";
|
|
5
|
+
/**
|
|
6
|
+
* Factory responsible for setting up the Hideable Feature domain components.
|
|
7
|
+
*
|
|
8
|
+
* Builds the same components as the legacy setupHideable function, split into
|
|
9
|
+
* the DomainFactory phases. The HIDE tool is created in finalSetup, so its
|
|
10
|
+
* place in the toolbar follows the order the factories are registered.
|
|
11
|
+
*
|
|
12
|
+
* @extends DomainFactory
|
|
13
|
+
*/
|
|
14
|
+
export class HideableFeatureFactory extends DomainFactory {
|
|
15
|
+
/**
|
|
16
|
+
* @param appObject The Hideable AppObject
|
|
17
|
+
* @param options Optional configuration, as for setupHideable
|
|
18
|
+
*/
|
|
19
|
+
constructor(appObject, options) {
|
|
20
|
+
super(appObject);
|
|
21
|
+
this.factoryName = "HideableFeatureFactory";
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
setupEntities() {
|
|
25
|
+
// No entities for this feature
|
|
26
|
+
}
|
|
27
|
+
setupUCs() {
|
|
28
|
+
makeTryHideWithPickUC(this.appObject);
|
|
29
|
+
if (this.options?.skipSerializer !== true) {
|
|
30
|
+
makeSerializeHideableObjects(this.appObject);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
setupPMs() {
|
|
34
|
+
// No PMs for this feature
|
|
35
|
+
}
|
|
36
|
+
finalSetup() {
|
|
37
|
+
new HideMC(this.appObject);
|
|
38
|
+
new HideTC(this.appObject);
|
|
39
|
+
if (this.options?.skipSetupTool === true)
|
|
40
|
+
return;
|
|
41
|
+
const toolRepo = ToolRepository.get(this.appObjects);
|
|
42
|
+
if (!toolRepo) {
|
|
43
|
+
this.appObjects.submitWarning(this.factoryName, "Unable to find tool repo");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
toolRepo.makeToolFromData({
|
|
47
|
+
toolType: "HIDE",
|
|
48
|
+
isDefault: false,
|
|
49
|
+
label: "Hide",
|
|
50
|
+
shortcutLabel: "h",
|
|
51
|
+
hotkeys: [{ keyCode: "KeyH" }],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Factory function to create a new HideableFeatureFactory
|
|
57
|
+
* @param appObjects The AppObjectRepo to get or create the Hideable AppObject from
|
|
58
|
+
* @param options Optional configuration, as for setupHideable
|
|
59
|
+
* @returns A new HideableFeatureFactory instance
|
|
60
|
+
*/
|
|
61
|
+
export function makeHideableFeatureFactory(appObjects, options) {
|
|
62
|
+
return new HideableFeatureFactory(appObjects.getOrCreate("Hideable"), options);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=HideableFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HideableFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/HideableFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAG7E;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAuB,SAAQ,aAAa;IAKvD;;;OAGG;IACH,YAAY,SAAoB,EAAE,OAA8B;QAC9D,KAAK,CAAC,SAAS,CAAC,CAAC;QATnB,gBAAW,GAAG,wBAAwB,CAAC;QAUrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,aAAa;QACX,+BAA+B;IACjC,CAAC;IAED,QAAQ;QACN,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,EAAE,CAAC;YAC1C,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3B,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;YAAE,OAAO;QAEjD,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;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,MAAM;YAChB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,MAAM;YACb,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,UAAyB,EACzB,OAA8B;IAE9B,OAAO,IAAI,sBAAsB,CAC/B,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,EAClC,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { AppObject, AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { ToolRepository } from \"../../Tools\";\r\nimport { HideMC, HideTC } from \"../Controllers\";\r\nimport { makeSerializeHideableObjects, makeTryHideWithPickUC } from \"../UCs\";\r\nimport { SetupHideableOptions } from \"./setupHideable\";\r\n\r\n/**\r\n * Factory responsible for setting up the Hideable Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupHideable function, split into\r\n * the DomainFactory phases. The HIDE 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 HideableFeatureFactory extends DomainFactory {\r\n factoryName = \"HideableFeatureFactory\";\r\n\r\n private options?: SetupHideableOptions;\r\n\r\n /**\r\n * @param appObject The Hideable AppObject\r\n * @param options Optional configuration, as for setupHideable\r\n */\r\n constructor(appObject: AppObject, options?: SetupHideableOptions) {\r\n super(appObject);\r\n this.options = options;\r\n }\r\n\r\n setupEntities(): void {\r\n // No entities for this feature\r\n }\r\n\r\n setupUCs(): void {\r\n makeTryHideWithPickUC(this.appObject);\r\n\r\n if (this.options?.skipSerializer !== true) {\r\n makeSerializeHideableObjects(this.appObject);\r\n }\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 HideMC(this.appObject);\r\n new HideTC(this.appObject);\r\n\r\n if (this.options?.skipSetupTool === true) return;\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: \"HIDE\",\r\n isDefault: false,\r\n label: \"Hide\",\r\n shortcutLabel: \"h\",\r\n hotkeys: [{ keyCode: \"KeyH\" }],\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new HideableFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Hideable AppObject from\r\n * @param options Optional configuration, as for setupHideable\r\n * @returns A new HideableFeatureFactory instance\r\n */\r\nexport function makeHideableFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n options?: SetupHideableOptions,\r\n): HideableFeatureFactory {\r\n return new HideableFeatureFactory(\r\n appObjects.getOrCreate(\"Hideable\"),\r\n options,\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeCalloutsFeatureFactory } from "../../Callouts";
|
|
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 { SerializeHideableObjects } from "../UCs";
|
|
9
|
+
import { makeHideableFeatureFactory } from "./HideableFeatureFactory";
|
|
10
|
+
import { setupHideable } from "./setupHideable";
|
|
11
|
+
function makeTestRig() {
|
|
12
|
+
const appObjects = makeAppObjectRepo();
|
|
13
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
14
|
+
const mockError = jest.fn();
|
|
15
|
+
appObjects.submitError = mockError;
|
|
16
|
+
return { appObjects, factories, mockError };
|
|
17
|
+
}
|
|
18
|
+
function registerCollaborators(appObjects) {
|
|
19
|
+
makeKeyboardInputFeatureFactory(appObjects);
|
|
20
|
+
makeMouseInputFeatureFactory(appObjects);
|
|
21
|
+
makeTouchControllerFeatureFactory(appObjects);
|
|
22
|
+
makeStateMachineFeatureFactory(appObjects);
|
|
23
|
+
}
|
|
24
|
+
function componentTypes(appObjects) {
|
|
25
|
+
const types = {};
|
|
26
|
+
appObjects.getAll().forEach((ao) => {
|
|
27
|
+
types[ao.id] = ao
|
|
28
|
+
.allComponents()
|
|
29
|
+
.filter((c) => !(c instanceof DomainFactory))
|
|
30
|
+
.map((c) => c.type)
|
|
31
|
+
.sort();
|
|
32
|
+
});
|
|
33
|
+
return types;
|
|
34
|
+
}
|
|
35
|
+
function toolTypes(appObjects) {
|
|
36
|
+
return ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
|
|
37
|
+
}
|
|
38
|
+
describe("HideableFeatureFactory", () => {
|
|
39
|
+
it("Builds the same components as setupHideable", () => {
|
|
40
|
+
const legacy = makeTestRig();
|
|
41
|
+
registerCollaborators(legacy.appObjects);
|
|
42
|
+
makeToolsFeatureFactory(legacy.appObjects);
|
|
43
|
+
legacy.factories.setupDomain();
|
|
44
|
+
setupHideable(legacy.appObjects);
|
|
45
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
46
|
+
registerCollaborators(appObjects);
|
|
47
|
+
makeToolsFeatureFactory(appObjects);
|
|
48
|
+
makeHideableFeatureFactory(appObjects);
|
|
49
|
+
factories.setupDomain();
|
|
50
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
51
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
52
|
+
});
|
|
53
|
+
it("Builds the serializer in setupUCs", () => {
|
|
54
|
+
const { appObjects, factories } = makeTestRig();
|
|
55
|
+
registerCollaborators(appObjects);
|
|
56
|
+
const factory = makeHideableFeatureFactory(appObjects);
|
|
57
|
+
const all = factories.getAll();
|
|
58
|
+
all.forEach((f) => f.setupEntities());
|
|
59
|
+
all.forEach((f) => f.setupUCs());
|
|
60
|
+
expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
it("Creates the HIDE tool in finalSetup", () => {
|
|
63
|
+
const { appObjects, factories } = makeTestRig();
|
|
64
|
+
registerCollaborators(appObjects);
|
|
65
|
+
makeToolsFeatureFactory(appObjects);
|
|
66
|
+
makeHideableFeatureFactory(appObjects);
|
|
67
|
+
const all = factories.getAll();
|
|
68
|
+
all.forEach((f) => f.setupEntities());
|
|
69
|
+
all.forEach((f) => f.setupUCs());
|
|
70
|
+
all.forEach((f) => f.setupPMs());
|
|
71
|
+
expect(ToolRepository.get(appObjects).getTool("HIDE")).toBeUndefined();
|
|
72
|
+
all.forEach((f) => f.finalSetup());
|
|
73
|
+
expect(ToolRepository.get(appObjects).getTool("HIDE")).toBeDefined();
|
|
74
|
+
});
|
|
75
|
+
it("Creates tools in factory registration order", () => {
|
|
76
|
+
const first = makeTestRig();
|
|
77
|
+
registerCollaborators(first.appObjects);
|
|
78
|
+
makeHideableFeatureFactory(first.appObjects);
|
|
79
|
+
makeCalloutsFeatureFactory(first.appObjects);
|
|
80
|
+
makeToolsFeatureFactory(first.appObjects);
|
|
81
|
+
first.factories.setupDomain();
|
|
82
|
+
const second = makeTestRig();
|
|
83
|
+
registerCollaborators(second.appObjects);
|
|
84
|
+
makeCalloutsFeatureFactory(second.appObjects);
|
|
85
|
+
makeHideableFeatureFactory(second.appObjects);
|
|
86
|
+
makeToolsFeatureFactory(second.appObjects);
|
|
87
|
+
second.factories.setupDomain();
|
|
88
|
+
expect(toolTypes(first.appObjects)).toEqual(["HIDE", "CALLOUT"]);
|
|
89
|
+
expect(toolTypes(second.appObjects)).toEqual(["CALLOUT", "HIDE"]);
|
|
90
|
+
});
|
|
91
|
+
it("Skips the serializer when skipSerializer is set", () => {
|
|
92
|
+
const { appObjects, factories } = makeTestRig();
|
|
93
|
+
registerCollaborators(appObjects);
|
|
94
|
+
makeToolsFeatureFactory(appObjects);
|
|
95
|
+
const factory = makeHideableFeatureFactory(appObjects, {
|
|
96
|
+
skipSerializer: true,
|
|
97
|
+
});
|
|
98
|
+
factories.setupDomain();
|
|
99
|
+
expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(false);
|
|
100
|
+
expect(ToolRepository.get(appObjects).getTool("HIDE")).toBeDefined();
|
|
101
|
+
});
|
|
102
|
+
it("Skips the tool when skipSetupTool is set", () => {
|
|
103
|
+
const { appObjects, factories } = makeTestRig();
|
|
104
|
+
registerCollaborators(appObjects);
|
|
105
|
+
makeToolsFeatureFactory(appObjects);
|
|
106
|
+
const factory = makeHideableFeatureFactory(appObjects, {
|
|
107
|
+
skipSetupTool: true,
|
|
108
|
+
});
|
|
109
|
+
factories.setupDomain();
|
|
110
|
+
expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(true);
|
|
111
|
+
expect(ToolRepository.get(appObjects).getTool("HIDE")).toBeUndefined();
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=HideableFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HideableFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/HideableFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,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AE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,0BAA0B,CAAC,UAAU,EAAE;YACrD,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACxE,KAAK,CACN,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,0BAA0B,CAAC,UAAU,EAAE;YACrD,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACxE,IAAI,CACL,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC1E,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 { makeCalloutsFeatureFactory } from \"../../Callouts\";\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 { SerializeHideableObjects } from \"../UCs\";\r\nimport { makeHideableFeatureFactory } from \"./HideableFeatureFactory\";\r\nimport { setupHideable } from \"./setupHideable\";\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(\"HideableFeatureFactory\", () => {\r\n it(\"Builds the same components as setupHideable\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeToolsFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupHideable(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeHideableFeatureFactory(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 serializer in setupUCs\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n const factory = makeHideableFeatureFactory(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(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(\r\n true,\r\n );\r\n });\r\n\r\n it(\"Creates the HIDE tool in finalSetup\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeHideableFeatureFactory(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(\"HIDE\")).toBeUndefined();\r\n\r\n all.forEach((f) => f.finalSetup());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).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 makeHideableFeatureFactory(first.appObjects);\r\n makeCalloutsFeatureFactory(first.appObjects);\r\n makeToolsFeatureFactory(first.appObjects);\r\n first.factories.setupDomain();\r\n\r\n const second = makeTestRig();\r\n registerCollaborators(second.appObjects);\r\n makeCalloutsFeatureFactory(second.appObjects);\r\n makeHideableFeatureFactory(second.appObjects);\r\n makeToolsFeatureFactory(second.appObjects);\r\n second.factories.setupDomain();\r\n\r\n expect(toolTypes(first.appObjects)).toEqual([\"HIDE\", \"CALLOUT\"]);\r\n expect(toolTypes(second.appObjects)).toEqual([\"CALLOUT\", \"HIDE\"]);\r\n });\r\n\r\n it(\"Skips the serializer when skipSerializer is set\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n const factory = makeHideableFeatureFactory(appObjects, {\r\n skipSerializer: true,\r\n });\r\n factories.setupDomain();\r\n\r\n expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(\r\n false,\r\n );\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).toBeDefined();\r\n });\r\n\r\n it(\"Skips the tool when skipSetupTool is set\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n const factory = makeHideableFeatureFactory(appObjects, {\r\n skipSetupTool: true,\r\n });\r\n factories.setupDomain();\r\n\r\n expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(\r\n true,\r\n );\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).toBeUndefined();\r\n });\r\n});\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./setupHideable\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./setupHideable\";\r\nexport * from \"./HideableFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DomainFactory, Quaternion, Vector3, } from "@vived/core";
|
|
2
|
+
import { StylusEntity } from "../../Stylus";
|
|
3
|
+
import { makeTransform3DPM } from "../../Transform3D";
|
|
4
|
+
import { makeHoverLabelMouse, makeHoverLabelTouch, makeStylusHoverLabelController, } from "../Controllers";
|
|
5
|
+
import { makeHoverLabelEntity } from "../Entities";
|
|
6
|
+
import { makeAllowHoverLabelPM, makeScreenHoverLabelPM, makeWorldHoverLabelPM, } from "../PM";
|
|
7
|
+
import { makeToggleAllowHoverLabel, makeTryShowHoverLabel, SerializeAllowHoverLabel, } from "../UseCases";
|
|
8
|
+
/**
|
|
9
|
+
* Factory responsible for setting up the HoverLabel Feature domain components.
|
|
10
|
+
*
|
|
11
|
+
* Builds the same components as the legacy setupHoverLabel function, split
|
|
12
|
+
* into the DomainFactory phases. The hover label transform is parented to the
|
|
13
|
+
* StylusEntity in finalSetup, so the Stylus Feature's factory can be
|
|
14
|
+
* registered before or after this one.
|
|
15
|
+
*
|
|
16
|
+
* @extends DomainFactory
|
|
17
|
+
*/
|
|
18
|
+
export class HoverLabelFeatureFactory extends DomainFactory {
|
|
19
|
+
/**
|
|
20
|
+
* @param appObject The HoverLabel AppObject
|
|
21
|
+
* @param options Optional configuration, as for setupHoverLabel
|
|
22
|
+
*/
|
|
23
|
+
constructor(appObject, options) {
|
|
24
|
+
super(appObject);
|
|
25
|
+
this.factoryName = "HoverLabelFeatureFactory";
|
|
26
|
+
this.options = options;
|
|
27
|
+
}
|
|
28
|
+
setupEntities() {
|
|
29
|
+
this.hoverLabelEntity = makeHoverLabelEntity(this.appObject);
|
|
30
|
+
}
|
|
31
|
+
setupUCs() {
|
|
32
|
+
if (this.options?.tryShowFactory) {
|
|
33
|
+
this.options.tryShowFactory(this.appObject);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
makeTryShowHoverLabel(this.appObject);
|
|
37
|
+
}
|
|
38
|
+
makeToggleAllowHoverLabel(this.appObject);
|
|
39
|
+
new SerializeAllowHoverLabel(this.appObject);
|
|
40
|
+
}
|
|
41
|
+
setupPMs() {
|
|
42
|
+
makeWorldHoverLabelPM(this.appObject);
|
|
43
|
+
makeScreenHoverLabelPM(this.appObject);
|
|
44
|
+
makeAllowHoverLabelPM(this.appObject);
|
|
45
|
+
makeTransform3DPM(this.appObject);
|
|
46
|
+
}
|
|
47
|
+
finalSetup() {
|
|
48
|
+
makeHoverLabelMouse(this.appObject);
|
|
49
|
+
makeHoverLabelTouch(this.appObject);
|
|
50
|
+
makeStylusHoverLabelController(this.appObject);
|
|
51
|
+
if (!this.hoverLabelEntity)
|
|
52
|
+
return;
|
|
53
|
+
const stylus = StylusEntity.get(this.appObjects);
|
|
54
|
+
if (!stylus) {
|
|
55
|
+
this.appObjects.submitError(this.factoryName, "StylusEntity needs to be setup for Hover Label");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const transform = this.hoverLabelEntity.transform;
|
|
59
|
+
transform.parent = stylus.transform;
|
|
60
|
+
transform.localPosition = Vector3.Zero();
|
|
61
|
+
transform.localRotation = Quaternion.Identity();
|
|
62
|
+
transform.localScale = Vector3.One();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Factory function to create a new HoverLabelFeatureFactory
|
|
67
|
+
* @param appObjects The AppObjectRepo to get or create the HoverLabel AppObject from
|
|
68
|
+
* @param options Optional configuration, as for setupHoverLabel
|
|
69
|
+
* @returns A new HoverLabelFeatureFactory instance
|
|
70
|
+
*/
|
|
71
|
+
export function makeHoverLabelFeatureFactory(appObjects, options) {
|
|
72
|
+
return new HoverLabelFeatureFactory(appObjects.getOrCreate("HoverLabel"), options);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=HoverLabelFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverLabelFeatureFactory.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/HoverLabelFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,UAAU,EACV,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;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8B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO;QAEnC,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,UAAU,CAAC,WAAW,CACzB,IAAI,CAAC,WAAW,EAChB,gDAAgD,CACjD,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC;QAClD,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;QACpC,SAAS,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QACzC,SAAS,CAAC,aAAa,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;QAChD,SAAS,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACvC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,UAAyB,EACzB,OAA2B;IAE3B,OAAO,IAAI,wBAAwB,CACjC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,EACpC,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n DomainFactory,\r\n Quaternion,\r\n Vector3,\r\n} from \"@vived/core\";\r\nimport { StylusEntity } from \"../../Stylus\";\r\nimport { makeTransform3DPM } from \"../../Transform3D\";\r\nimport {\r\n makeHoverLabelMouse,\r\n makeHoverLabelTouch,\r\n makeStylusHoverLabelController,\r\n} from \"../Controllers\";\r\nimport { HoverLabelEntity, makeHoverLabelEntity } from \"../Entities\";\r\nimport {\r\n makeAllowHoverLabelPM,\r\n makeScreenHoverLabelPM,\r\n makeWorldHoverLabelPM,\r\n} from \"../PM\";\r\nimport {\r\n makeToggleAllowHoverLabel,\r\n makeTryShowHoverLabel,\r\n SerializeAllowHoverLabel,\r\n} from \"../UseCases\";\r\nimport { HoverLabelOptions } from \"./setupHoverLabel\";\r\n\r\n/**\r\n * Factory responsible for setting up the HoverLabel Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupHoverLabel function, split\r\n * into the DomainFactory phases. The hover label transform is parented to the\r\n * StylusEntity in finalSetup, so the Stylus Feature's factory can be\r\n * registered before or after this one.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class HoverLabelFeatureFactory extends DomainFactory {\r\n factoryName = \"HoverLabelFeatureFactory\";\r\n\r\n private hoverLabelEntity?: HoverLabelEntity;\r\n private options?: HoverLabelOptions;\r\n\r\n /**\r\n * @param appObject The HoverLabel AppObject\r\n * @param options Optional configuration, as for setupHoverLabel\r\n */\r\n constructor(appObject: AppObject, options?: HoverLabelOptions) {\r\n super(appObject);\r\n this.options = options;\r\n }\r\n\r\n setupEntities(): void {\r\n this.hoverLabelEntity = makeHoverLabelEntity(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n if (this.options?.tryShowFactory) {\r\n this.options.tryShowFactory(this.appObject);\r\n } else {\r\n makeTryShowHoverLabel(this.appObject);\r\n }\r\n\r\n makeToggleAllowHoverLabel(this.appObject);\r\n new SerializeAllowHoverLabel(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeWorldHoverLabelPM(this.appObject);\r\n makeScreenHoverLabelPM(this.appObject);\r\n makeAllowHoverLabelPM(this.appObject);\r\n makeTransform3DPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n makeHoverLabelMouse(this.appObject);\r\n makeHoverLabelTouch(this.appObject);\r\n makeStylusHoverLabelController(this.appObject);\r\n\r\n if (!this.hoverLabelEntity) return;\r\n\r\n const stylus = StylusEntity.get(this.appObjects);\r\n if (!stylus) {\r\n this.appObjects.submitError(\r\n this.factoryName,\r\n \"StylusEntity needs to be setup for Hover Label\",\r\n );\r\n return;\r\n }\r\n\r\n const transform = this.hoverLabelEntity.transform;\r\n transform.parent = stylus.transform;\r\n transform.localPosition = Vector3.Zero();\r\n transform.localRotation = Quaternion.Identity();\r\n transform.localScale = Vector3.One();\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new HoverLabelFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the HoverLabel AppObject from\r\n * @param options Optional configuration, as for setupHoverLabel\r\n * @returns A new HoverLabelFeatureFactory instance\r\n */\r\nexport function makeHoverLabelFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n options?: HoverLabelOptions,\r\n): HoverLabelFeatureFactory {\r\n return new HoverLabelFeatureFactory(\r\n appObjects.getOrCreate(\"HoverLabel\"),\r\n options,\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
|
|
2
|
+
import { makeMouseInputFeatureFactory } from "../../MouseInput";
|
|
3
|
+
import { makeStateMachineFeatureFactory } from "../../StateMachine";
|
|
4
|
+
import { makeStylusFeatureFactory, StylusEntity } from "../../Stylus";
|
|
5
|
+
import { makeTouchControllerFeatureFactory } from "../../TouchController";
|
|
6
|
+
import { HoverLabelEntity } from "../Entities";
|
|
7
|
+
import { TryShowHoverLabel } from "../UseCases";
|
|
8
|
+
import { makeHoverLabelFeatureFactory } from "./HoverLabelFeatureFactory";
|
|
9
|
+
import { setupHoverLabel } from "./setupHoverLabel";
|
|
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
|
+
makeMouseInputFeatureFactory(appObjects);
|
|
19
|
+
makeTouchControllerFeatureFactory(appObjects);
|
|
20
|
+
makeStateMachineFeatureFactory(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("HoverLabelFeatureFactory", () => {
|
|
34
|
+
it("Builds the same components as setupHoverLabel", () => {
|
|
35
|
+
const legacy = makeTestRig();
|
|
36
|
+
registerCollaborators(legacy.appObjects);
|
|
37
|
+
makeStylusFeatureFactory(legacy.appObjects);
|
|
38
|
+
legacy.factories.setupDomain();
|
|
39
|
+
setupHoverLabel(legacy.appObjects);
|
|
40
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
41
|
+
registerCollaborators(appObjects);
|
|
42
|
+
makeStylusFeatureFactory(appObjects);
|
|
43
|
+
makeHoverLabelFeatureFactory(appObjects);
|
|
44
|
+
factories.setupDomain();
|
|
45
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
46
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
47
|
+
});
|
|
48
|
+
it("Parents the hover label to the stylus when the Stylus factory is registered after it", () => {
|
|
49
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
50
|
+
registerCollaborators(appObjects);
|
|
51
|
+
makeHoverLabelFeatureFactory(appObjects);
|
|
52
|
+
makeStylusFeatureFactory(appObjects);
|
|
53
|
+
factories.setupDomain();
|
|
54
|
+
const hoverLabel = HoverLabelEntity.get(appObjects);
|
|
55
|
+
const stylus = StylusEntity.get(appObjects);
|
|
56
|
+
expect(hoverLabel.transform.parent).toBe(stylus.transform);
|
|
57
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
58
|
+
});
|
|
59
|
+
it("Submits an error when there is no Stylus Feature", () => {
|
|
60
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
61
|
+
registerCollaborators(appObjects);
|
|
62
|
+
makeHoverLabelFeatureFactory(appObjects);
|
|
63
|
+
factories.setupDomain();
|
|
64
|
+
expect(mockError).toHaveBeenCalledWith("HoverLabelFeatureFactory", "StylusEntity needs to be setup for Hover Label");
|
|
65
|
+
});
|
|
66
|
+
it("Uses the try show factory if it is passed in", () => {
|
|
67
|
+
const { appObjects, factories } = makeTestRig();
|
|
68
|
+
registerCollaborators(appObjects);
|
|
69
|
+
makeStylusFeatureFactory(appObjects);
|
|
70
|
+
const tryShowFactory = jest.fn();
|
|
71
|
+
const factory = makeHoverLabelFeatureFactory(appObjects, {
|
|
72
|
+
tryShowFactory,
|
|
73
|
+
});
|
|
74
|
+
factories.setupDomain();
|
|
75
|
+
expect(tryShowFactory).toHaveBeenCalledWith(factory.appObject);
|
|
76
|
+
expect(factory.appObject.hasComponent(TryShowHoverLabel.type)).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=HoverLabelFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverLabelFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/HoverLabelFeatureFactory.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,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE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AE,GAAG,WAAW,EAAE,CAAC;QAC3D,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACzC,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,SAAS,CAAC,CAAC,oBAAoB,CACpC,0BAA0B,EAC1B,gDAAgD,CACjD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACrC,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,4BAA4B,CAAC,UAAU,EAAE;YACvD,cAAc;SACf,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/D,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7E,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 { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeStylusFeatureFactory, StylusEntity } from \"../../Stylus\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { HoverLabelEntity } from \"../Entities\";\r\nimport { TryShowHoverLabel } from \"../UseCases\";\r\nimport { makeHoverLabelFeatureFactory } from \"./HoverLabelFeatureFactory\";\r\nimport { setupHoverLabel } from \"./setupHoverLabel\";\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 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\ndescribe(\"HoverLabelFeatureFactory\", () => {\r\n it(\"Builds the same components as setupHoverLabel\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeStylusFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupHoverLabel(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeStylusFeatureFactory(appObjects);\r\n makeHoverLabelFeatureFactory(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(\"Parents the hover label to the stylus when the Stylus factory is registered after it\", () => {\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeHoverLabelFeatureFactory(appObjects);\r\n makeStylusFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n const hoverLabel = HoverLabelEntity.get(appObjects)!;\r\n const stylus = StylusEntity.get(appObjects)!;\r\n expect(hoverLabel.transform.parent).toBe(stylus.transform);\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Submits an error when there is no Stylus Feature\", () => {\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeHoverLabelFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(mockError).toHaveBeenCalledWith(\r\n \"HoverLabelFeatureFactory\",\r\n \"StylusEntity needs to be setup for Hover Label\",\r\n );\r\n });\r\n\r\n it(\"Uses the try show factory if it is passed in\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeStylusFeatureFactory(appObjects);\r\n const tryShowFactory = jest.fn();\r\n const factory = makeHoverLabelFeatureFactory(appObjects, {\r\n tryShowFactory,\r\n });\r\n factories.setupDomain();\r\n\r\n expect(tryShowFactory).toHaveBeenCalledWith(factory.appObject);\r\n expect(factory.appObject.hasComponent(TryShowHoverLabel.type)).toBe(false);\r\n });\r\n});\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"./setupHoverLabel\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./setupHoverLabel\";\r\nexport * from \"./HoverLabelFeatureFactory\";\r\n"]}
|