@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.
Files changed (206) hide show
  1. package/README.md +166 -145
  2. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js +67 -0
  3. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
  4. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js +84 -0
  5. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
  6. package/dist/cjs/Callouts/Factories/index.js +1 -0
  7. package/dist/cjs/Callouts/Factories/index.js.map +1 -1
  8. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js +52 -0
  9. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
  10. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +44 -0
  11. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
  12. package/dist/cjs/ChannelModel/Factories/index.js +1 -0
  13. package/dist/cjs/ChannelModel/Factories/index.js.map +1 -1
  14. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js +50 -0
  15. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
  16. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js +39 -0
  17. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
  18. package/dist/cjs/Environment/Factories/index.js +2 -1
  19. package/dist/cjs/Environment/Factories/index.js.map +1 -1
  20. package/dist/cjs/Environment/Factories/setupEnvironments.js +19 -0
  21. package/dist/cjs/Environment/Factories/setupEnvironments.js.map +1 -0
  22. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js +69 -0
  23. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
  24. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js +116 -0
  25. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
  26. package/dist/cjs/Hideable/Factories/index.js +1 -0
  27. package/dist/cjs/Hideable/Factories/index.js.map +1 -1
  28. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js +79 -0
  29. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
  30. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +81 -0
  31. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
  32. package/dist/cjs/HoverLabel/Factories/index.js +1 -0
  33. package/dist/cjs/HoverLabel/Factories/index.js.map +1 -1
  34. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js +85 -0
  35. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
  36. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js +100 -0
  37. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
  38. package/dist/cjs/Landmarks/Factories/index.js +1 -0
  39. package/dist/cjs/Landmarks/Factories/index.js.map +1 -1
  40. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js +57 -0
  41. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
  42. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js +60 -0
  43. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
  44. package/dist/cjs/Selection/Factories/index.js +1 -0
  45. package/dist/cjs/Selection/Factories/index.js.map +1 -1
  46. package/dist/cjs/Stick/Factories/StickFeatureFactory.js +45 -0
  47. package/dist/cjs/Stick/Factories/StickFeatureFactory.js.map +1 -0
  48. package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js +44 -0
  49. package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
  50. package/dist/cjs/Stick/Factories/index.js +1 -0
  51. package/dist/cjs/Stick/Factories/index.js.map +1 -1
  52. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js +48 -0
  53. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
  54. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js +39 -0
  55. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
  56. package/dist/cjs/StoredView/Factories/index.js +1 -0
  57. package/dist/cjs/StoredView/Factories/index.js.map +1 -1
  58. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js +47 -0
  59. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
  60. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js +35 -0
  61. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
  62. package/dist/cjs/Stylus/Factories/index.js +1 -0
  63. package/dist/cjs/Stylus/Factories/index.js.map +1 -1
  64. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js +70 -0
  65. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
  66. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js +78 -0
  67. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
  68. package/dist/cjs/zSpace/Factory/index.js +1 -0
  69. package/dist/cjs/zSpace/Factory/index.js.map +1 -1
  70. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js +62 -0
  71. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
  72. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js +82 -0
  73. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
  74. package/dist/esm/Callouts/Factories/index.js +1 -0
  75. package/dist/esm/Callouts/Factories/index.js.map +1 -1
  76. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js +47 -0
  77. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
  78. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +42 -0
  79. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
  80. package/dist/esm/ChannelModel/Factories/index.js +1 -0
  81. package/dist/esm/ChannelModel/Factories/index.js.map +1 -1
  82. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js +45 -0
  83. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
  84. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js +37 -0
  85. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
  86. package/dist/esm/Environment/Factories/index.js +2 -1
  87. package/dist/esm/Environment/Factories/index.js.map +1 -1
  88. package/dist/esm/Environment/Factories/setupEnvironments.js +16 -0
  89. package/dist/esm/Environment/Factories/setupEnvironments.js.map +1 -0
  90. package/dist/esm/Hideable/Factories/HideableFeatureFactory.js +64 -0
  91. package/dist/esm/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
  92. package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js +114 -0
  93. package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
  94. package/dist/esm/Hideable/Factories/index.js +1 -0
  95. package/dist/esm/Hideable/Factories/index.js.map +1 -1
  96. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js +74 -0
  97. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
  98. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +79 -0
  99. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
  100. package/dist/esm/HoverLabel/Factories/index.js +1 -0
  101. package/dist/esm/HoverLabel/Factories/index.js.map +1 -1
  102. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js +80 -0
  103. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
  104. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js +98 -0
  105. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
  106. package/dist/esm/Landmarks/Factories/index.js +1 -0
  107. package/dist/esm/Landmarks/Factories/index.js.map +1 -1
  108. package/dist/esm/Selection/Factories/SelectionFeatureFactory.js +52 -0
  109. package/dist/esm/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
  110. package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js +58 -0
  111. package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
  112. package/dist/esm/Selection/Factories/index.js +1 -0
  113. package/dist/esm/Selection/Factories/index.js.map +1 -1
  114. package/dist/esm/Stick/Factories/StickFeatureFactory.js +40 -0
  115. package/dist/esm/Stick/Factories/StickFeatureFactory.js.map +1 -0
  116. package/dist/esm/Stick/Factories/StickFeatureFactory.test.js +42 -0
  117. package/dist/esm/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
  118. package/dist/esm/Stick/Factories/index.js +1 -0
  119. package/dist/esm/Stick/Factories/index.js.map +1 -1
  120. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js +43 -0
  121. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
  122. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js +37 -0
  123. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
  124. package/dist/esm/StoredView/Factories/index.js +1 -0
  125. package/dist/esm/StoredView/Factories/index.js.map +1 -1
  126. package/dist/esm/Stylus/Factories/StylusFeatureFactory.js +42 -0
  127. package/dist/esm/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
  128. package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js +33 -0
  129. package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
  130. package/dist/esm/Stylus/Factories/index.js +1 -0
  131. package/dist/esm/Stylus/Factories/index.js.map +1 -1
  132. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js +65 -0
  133. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
  134. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js +76 -0
  135. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
  136. package/dist/esm/zSpace/Factory/index.js +1 -0
  137. package/dist/esm/zSpace/Factory/index.js.map +1 -1
  138. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts +24 -0
  139. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts.map +1 -0
  140. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts +2 -0
  141. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts.map +1 -0
  142. package/dist/types/Callouts/Factories/index.d.ts +1 -0
  143. package/dist/types/Callouts/Factories/index.d.ts.map +1 -1
  144. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts +23 -0
  145. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts.map +1 -0
  146. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts +2 -0
  147. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts.map +1 -0
  148. package/dist/types/ChannelModel/Factories/index.d.ts +1 -0
  149. package/dist/types/ChannelModel/Factories/index.d.ts.map +1 -1
  150. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts +23 -0
  151. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts.map +1 -0
  152. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts +2 -0
  153. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts.map +1 -0
  154. package/dist/types/Environment/Factories/index.d.ts +2 -1
  155. package/dist/types/Environment/Factories/index.d.ts.map +1 -1
  156. package/dist/types/Environment/Factories/setupEnvironments.d.ts +3 -0
  157. package/dist/types/Environment/Factories/setupEnvironments.d.ts.map +1 -0
  158. package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts +32 -0
  159. package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts.map +1 -0
  160. package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts +2 -0
  161. package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts.map +1 -0
  162. package/dist/types/Hideable/Factories/index.d.ts +1 -0
  163. package/dist/types/Hideable/Factories/index.d.ts.map +1 -1
  164. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts +34 -0
  165. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts.map +1 -0
  166. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts +2 -0
  167. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts.map +1 -0
  168. package/dist/types/HoverLabel/Factories/index.d.ts +1 -0
  169. package/dist/types/HoverLabel/Factories/index.d.ts.map +1 -1
  170. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts +26 -0
  171. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts.map +1 -0
  172. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts +2 -0
  173. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts.map +1 -0
  174. package/dist/types/Landmarks/Factories/index.d.ts +1 -0
  175. package/dist/types/Landmarks/Factories/index.d.ts.map +1 -1
  176. package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts +27 -0
  177. package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts.map +1 -0
  178. package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts +2 -0
  179. package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts.map +1 -0
  180. package/dist/types/Selection/Factories/index.d.ts +1 -0
  181. package/dist/types/Selection/Factories/index.d.ts.map +1 -1
  182. package/dist/types/Stick/Factories/StickFeatureFactory.d.ts +23 -0
  183. package/dist/types/Stick/Factories/StickFeatureFactory.d.ts.map +1 -0
  184. package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts +2 -0
  185. package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts.map +1 -0
  186. package/dist/types/Stick/Factories/index.d.ts +1 -0
  187. package/dist/types/Stick/Factories/index.d.ts.map +1 -1
  188. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts +23 -0
  189. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts.map +1 -0
  190. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts +2 -0
  191. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts.map +1 -0
  192. package/dist/types/StoredView/Factories/index.d.ts +1 -0
  193. package/dist/types/StoredView/Factories/index.d.ts.map +1 -1
  194. package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts +23 -0
  195. package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts.map +1 -0
  196. package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts +2 -0
  197. package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts.map +1 -0
  198. package/dist/types/Stylus/Factories/index.d.ts +1 -0
  199. package/dist/types/Stylus/Factories/index.d.ts.map +1 -1
  200. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts +26 -0
  201. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts.map +1 -0
  202. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts +2 -0
  203. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts.map +1 -0
  204. package/dist/types/zSpace/Factory/index.d.ts +1 -0
  205. package/dist/types/zSpace/Factory/index.d.ts.map +1 -1
  206. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC","sourcesContent":["export * from \"./channelModelFactory\";\nexport * from \"./channelObjectFactory\";\nexport * from \"./setupChannelModels\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC;AACrC,+DAA6C","sourcesContent":["export * from \"./channelModelFactory\";\r\nexport * from \"./channelObjectFactory\";\r\nexport * from \"./setupChannelModels\";\r\nexport * from \"./ChannelModelFeatureFactory\";\r\n"]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvironmentFeatureFactory = void 0;
4
+ exports.makeEnvironmentFeatureFactory = makeEnvironmentFeatureFactory;
5
+ const core_1 = require("@vived/core");
6
+ const Environment_1 = require("../Entities/Environment");
7
+ const EnvironmentalIntensityPM_1 = require("../PMs/EnvironmentalIntensityPM");
8
+ const TexturalEnvironmentPM_1 = require("../PMs/TexturalEnvironmentPM");
9
+ const SerializeEnvironment_1 = require("../UCs/SerializeEnvironment");
10
+ const SetEnvironmentIntensityUC_1 = require("../UCs/SetEnvironmentIntensityUC");
11
+ const SetTexturalEnvironmentUC_1 = require("../UCs/SetTexturalEnvironmentUC");
12
+ /**
13
+ * Factory responsible for setting up the Environment Feature domain components.
14
+ *
15
+ * Builds the same components as the legacy setupEnvironments function, split
16
+ * into the DomainFactory phases.
17
+ *
18
+ * @extends DomainFactory
19
+ */
20
+ class EnvironmentFeatureFactory extends core_1.DomainFactory {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.factoryName = "EnvironmentFeatureFactory";
24
+ }
25
+ setupEntities() {
26
+ (0, Environment_1.makeEnvironmentEntity)(this.appObject);
27
+ }
28
+ setupUCs() {
29
+ (0, SetTexturalEnvironmentUC_1.makeSetTexturalEnvironmentUC)(this.appObject);
30
+ new SerializeEnvironment_1.SerializeEnvironment(this.appObject);
31
+ (0, SetEnvironmentIntensityUC_1.makeSetEnvironmentIntensityUC)(this.appObject);
32
+ }
33
+ setupPMs() {
34
+ (0, TexturalEnvironmentPM_1.makeTexturalEnvironmentPM)(this.appObject);
35
+ (0, EnvironmentalIntensityPM_1.makeEnvironmentalIntensityPM)(this.appObject);
36
+ }
37
+ finalSetup() {
38
+ // No final setup needed
39
+ }
40
+ }
41
+ exports.EnvironmentFeatureFactory = EnvironmentFeatureFactory;
42
+ /**
43
+ * Factory function to create a new EnvironmentFeatureFactory
44
+ * @param appObjects The AppObjectRepo to get or create the Environments AppObject from
45
+ * @returns A new EnvironmentFeatureFactory instance
46
+ */
47
+ function makeEnvironmentFeatureFactory(appObjects) {
48
+ return new EnvironmentFeatureFactory(appObjects.getOrCreate("Environments"));
49
+ }
50
+ //# sourceMappingURL=EnvironmentFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/EnvironmentFeatureFactory.ts"],"names":[],"mappings":";;;AA4CA,sEAIC;AAhDD,sCAA2D;AAC3D,yDAAgE;AAChE,8EAA+E;AAC/E,wEAAyE;AACzE,sEAAmE;AACnE,gFAAiF;AACjF,8EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAa,yBAA0B,SAAQ,oBAAa;IAA5D;;QACE,gBAAW,GAAG,2BAA2B,CAAC;IAoB5C,CAAC;IAlBC,aAAa;QACX,IAAA,mCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ;QACN,IAAA,uDAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,2CAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAA,yDAA6B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAED,QAAQ;QACN,IAAA,iDAAyB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAA,uDAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AArBD,8DAqBC;AAED;;;;GAIG;AACH,SAAgB,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,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const StateMachine_1 = require("../../StateMachine");
5
+ const EnvironmentFeatureFactory_1 = require("./EnvironmentFeatureFactory");
6
+ const setupEnvironments_1 = require("./setupEnvironments");
7
+ function makeTestRig() {
8
+ const appObjects = (0, core_1.makeAppObjectRepo)();
9
+ const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
10
+ const mockError = jest.fn();
11
+ appObjects.submitError = mockError;
12
+ return { appObjects, factories, mockError };
13
+ }
14
+ function componentTypes(appObjects) {
15
+ const types = {};
16
+ appObjects.getAll().forEach((ao) => {
17
+ types[ao.id] = ao
18
+ .allComponents()
19
+ .filter((c) => !(c instanceof core_1.DomainFactory))
20
+ .map((c) => c.type)
21
+ .sort();
22
+ });
23
+ return types;
24
+ }
25
+ describe("EnvironmentFeatureFactory", () => {
26
+ it("Builds the same components as setupEnvironments", () => {
27
+ const legacy = makeTestRig();
28
+ (0, StateMachine_1.makeStateMachineFeatureFactory)(legacy.appObjects);
29
+ legacy.factories.setupDomain();
30
+ (0, setupEnvironments_1.setupEnvironments)(legacy.appObjects);
31
+ const { appObjects, factories, mockError } = makeTestRig();
32
+ (0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
33
+ (0, EnvironmentFeatureFactory_1.makeEnvironmentFeatureFactory)(appObjects);
34
+ factories.setupDomain();
35
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
36
+ expect(mockError).not.toHaveBeenCalled();
37
+ });
38
+ });
39
+ //# sourceMappingURL=EnvironmentFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/EnvironmentFe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AAA,6CAA8B,EAAC,UAAU,CAAC,CAAC;QAC3C,IAAA,yDAA6B,EAAC,UAAU,CAAC,CAAC;QAC1C,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 { 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"]}
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./setupEnvironmnets"), exports);
17
+ __exportStar(require("./setupEnvironments"), exports);
18
+ __exportStar(require("./EnvironmentFeatureFactory"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC","sourcesContent":["export * from \"./setupEnvironmnets\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,8DAA4C","sourcesContent":["export * from \"./setupEnvironments\";\r\nexport * from \"./EnvironmentFeatureFactory\";\r\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupEnvironments = setupEnvironments;
4
+ const Environment_1 = require("../Entities/Environment");
5
+ const EnvironmentalIntensityPM_1 = require("../PMs/EnvironmentalIntensityPM");
6
+ const TexturalEnvironmentPM_1 = require("../PMs/TexturalEnvironmentPM");
7
+ const SerializeEnvironment_1 = require("../UCs/SerializeEnvironment");
8
+ const SetEnvironmentIntensityUC_1 = require("../UCs/SetEnvironmentIntensityUC");
9
+ const SetTexturalEnvironmentUC_1 = require("../UCs/SetTexturalEnvironmentUC");
10
+ function setupEnvironments(appObjects) {
11
+ const ao = appObjects.getOrCreate("Environments");
12
+ (0, Environment_1.makeEnvironmentEntity)(ao);
13
+ (0, SetTexturalEnvironmentUC_1.makeSetTexturalEnvironmentUC)(ao);
14
+ new SerializeEnvironment_1.SerializeEnvironment(ao);
15
+ (0, SetEnvironmentIntensityUC_1.makeSetEnvironmentIntensityUC)(ao);
16
+ (0, TexturalEnvironmentPM_1.makeTexturalEnvironmentPM)(ao);
17
+ (0, EnvironmentalIntensityPM_1.makeEnvironmentalIntensityPM)(ao);
18
+ }
19
+ //# sourceMappingURL=setupEnvironments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupEnvironments.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/setupEnvironments.ts"],"names":[],"mappings":";;AAQA,8CAWC;AAlBD,yDAAgE;AAChE,8EAA+E;AAC/E,wEAAyE;AACzE,sEAAmE;AACnE,gFAAiF;AACjF,8EAA+E;AAE/E,SAAgB,iBAAiB,CAAC,UAAyB;IACzD,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAElD,IAAA,mCAAqB,EAAC,EAAE,CAAC,CAAC;IAE1B,IAAA,uDAA4B,EAAC,EAAE,CAAC,CAAC;IACjC,IAAI,2CAAoB,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAA,yDAA6B,EAAC,EAAE,CAAC,CAAC;IAElC,IAAA,iDAAyB,EAAC,EAAE,CAAC,CAAC;IAC9B,IAAA,uDAA4B,EAAC,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,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HideableFeatureFactory = void 0;
4
+ exports.makeHideableFeatureFactory = makeHideableFeatureFactory;
5
+ const core_1 = require("@vived/core");
6
+ const Tools_1 = require("../../Tools");
7
+ const Controllers_1 = require("../Controllers");
8
+ const UCs_1 = require("../UCs");
9
+ /**
10
+ * Factory responsible for setting up the Hideable Feature domain components.
11
+ *
12
+ * Builds the same components as the legacy setupHideable function, split into
13
+ * the DomainFactory phases. The HIDE tool is created in finalSetup, so its
14
+ * place in the toolbar follows the order the factories are registered.
15
+ *
16
+ * @extends DomainFactory
17
+ */
18
+ class HideableFeatureFactory extends core_1.DomainFactory {
19
+ /**
20
+ * @param appObject The Hideable AppObject
21
+ * @param options Optional configuration, as for setupHideable
22
+ */
23
+ constructor(appObject, options) {
24
+ super(appObject);
25
+ this.factoryName = "HideableFeatureFactory";
26
+ this.options = options;
27
+ }
28
+ setupEntities() {
29
+ // No entities for this feature
30
+ }
31
+ setupUCs() {
32
+ (0, UCs_1.makeTryHideWithPickUC)(this.appObject);
33
+ if (this.options?.skipSerializer !== true) {
34
+ (0, UCs_1.makeSerializeHideableObjects)(this.appObject);
35
+ }
36
+ }
37
+ setupPMs() {
38
+ // No PMs for this feature
39
+ }
40
+ finalSetup() {
41
+ new Controllers_1.HideMC(this.appObject);
42
+ new Controllers_1.HideTC(this.appObject);
43
+ if (this.options?.skipSetupTool === true)
44
+ return;
45
+ const toolRepo = Tools_1.ToolRepository.get(this.appObjects);
46
+ if (!toolRepo) {
47
+ this.appObjects.submitWarning(this.factoryName, "Unable to find tool repo");
48
+ return;
49
+ }
50
+ toolRepo.makeToolFromData({
51
+ toolType: "HIDE",
52
+ isDefault: false,
53
+ label: "Hide",
54
+ shortcutLabel: "h",
55
+ hotkeys: [{ keyCode: "KeyH" }],
56
+ });
57
+ }
58
+ }
59
+ exports.HideableFeatureFactory = HideableFeatureFactory;
60
+ /**
61
+ * Factory function to create a new HideableFeatureFactory
62
+ * @param appObjects The AppObjectRepo to get or create the Hideable AppObject from
63
+ * @param options Optional configuration, as for setupHideable
64
+ * @returns A new HideableFeatureFactory instance
65
+ */
66
+ function makeHideableFeatureFactory(appObjects, options) {
67
+ return new HideableFeatureFactory(appObjects.getOrCreate("Hideable"), options);
68
+ }
69
+ //# sourceMappingURL=HideableFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HideableFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/HideableFeatureFactory.ts"],"names":[],"mappings":";;;AA4EA,gEAQC;AApFD,sCAAsE;AACtE,uCAA6C;AAC7C,gDAAgD;AAChD,gCAA6E;AAG7E;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,oBAAa;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,IAAA,2BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAA,kCAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,oBAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,oBAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3B,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;YAAE,OAAO;QAEjD,MAAM,QAAQ,GAAG,sBAAc,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;AArDD,wDAqDC;AAED;;;;;GAKG;AACH,SAAgB,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,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const Callouts_1 = require("../../Callouts");
5
+ const KeyboardInput_1 = require("../../KeyboardInput");
6
+ const MouseInput_1 = require("../../MouseInput");
7
+ const StateMachine_1 = require("../../StateMachine");
8
+ const Tools_1 = require("../../Tools");
9
+ const TouchController_1 = require("../../TouchController");
10
+ const UCs_1 = require("../UCs");
11
+ const HideableFeatureFactory_1 = require("./HideableFeatureFactory");
12
+ const setupHideable_1 = require("./setupHideable");
13
+ function makeTestRig() {
14
+ const appObjects = (0, core_1.makeAppObjectRepo)();
15
+ const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
16
+ const mockError = jest.fn();
17
+ appObjects.submitError = mockError;
18
+ return { appObjects, factories, mockError };
19
+ }
20
+ function registerCollaborators(appObjects) {
21
+ (0, KeyboardInput_1.makeKeyboardInputFeatureFactory)(appObjects);
22
+ (0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
23
+ (0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
24
+ (0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
25
+ }
26
+ function componentTypes(appObjects) {
27
+ const types = {};
28
+ appObjects.getAll().forEach((ao) => {
29
+ types[ao.id] = ao
30
+ .allComponents()
31
+ .filter((c) => !(c instanceof core_1.DomainFactory))
32
+ .map((c) => c.type)
33
+ .sort();
34
+ });
35
+ return types;
36
+ }
37
+ function toolTypes(appObjects) {
38
+ return Tools_1.ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
39
+ }
40
+ describe("HideableFeatureFactory", () => {
41
+ it("Builds the same components as setupHideable", () => {
42
+ const legacy = makeTestRig();
43
+ registerCollaborators(legacy.appObjects);
44
+ (0, Tools_1.makeToolsFeatureFactory)(legacy.appObjects);
45
+ legacy.factories.setupDomain();
46
+ (0, setupHideable_1.setupHideable)(legacy.appObjects);
47
+ const { appObjects, factories, mockError } = makeTestRig();
48
+ registerCollaborators(appObjects);
49
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
50
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects);
51
+ factories.setupDomain();
52
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
53
+ expect(mockError).not.toHaveBeenCalled();
54
+ });
55
+ it("Builds the serializer in setupUCs", () => {
56
+ const { appObjects, factories } = makeTestRig();
57
+ registerCollaborators(appObjects);
58
+ const factory = (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects);
59
+ const all = factories.getAll();
60
+ all.forEach((f) => f.setupEntities());
61
+ all.forEach((f) => f.setupUCs());
62
+ expect(factory.appObject.hasComponent(UCs_1.SerializeHideableObjects.type)).toBe(true);
63
+ });
64
+ it("Creates the HIDE tool in finalSetup", () => {
65
+ const { appObjects, factories } = makeTestRig();
66
+ registerCollaborators(appObjects);
67
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
68
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects);
69
+ const all = factories.getAll();
70
+ all.forEach((f) => f.setupEntities());
71
+ all.forEach((f) => f.setupUCs());
72
+ all.forEach((f) => f.setupPMs());
73
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeUndefined();
74
+ all.forEach((f) => f.finalSetup());
75
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeDefined();
76
+ });
77
+ it("Creates tools in factory registration order", () => {
78
+ const first = makeTestRig();
79
+ registerCollaborators(first.appObjects);
80
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(first.appObjects);
81
+ (0, Callouts_1.makeCalloutsFeatureFactory)(first.appObjects);
82
+ (0, Tools_1.makeToolsFeatureFactory)(first.appObjects);
83
+ first.factories.setupDomain();
84
+ const second = makeTestRig();
85
+ registerCollaborators(second.appObjects);
86
+ (0, Callouts_1.makeCalloutsFeatureFactory)(second.appObjects);
87
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(second.appObjects);
88
+ (0, Tools_1.makeToolsFeatureFactory)(second.appObjects);
89
+ second.factories.setupDomain();
90
+ expect(toolTypes(first.appObjects)).toEqual(["HIDE", "CALLOUT"]);
91
+ expect(toolTypes(second.appObjects)).toEqual(["CALLOUT", "HIDE"]);
92
+ });
93
+ it("Skips the serializer when skipSerializer is set", () => {
94
+ const { appObjects, factories } = makeTestRig();
95
+ registerCollaborators(appObjects);
96
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
97
+ const factory = (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects, {
98
+ skipSerializer: true,
99
+ });
100
+ factories.setupDomain();
101
+ expect(factory.appObject.hasComponent(UCs_1.SerializeHideableObjects.type)).toBe(false);
102
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeDefined();
103
+ });
104
+ it("Skips the tool when skipSetupTool is set", () => {
105
+ const { appObjects, factories } = makeTestRig();
106
+ registerCollaborators(appObjects);
107
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
108
+ const factory = (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects, {
109
+ skipSetupTool: true,
110
+ });
111
+ factories.setupDomain();
112
+ expect(factory.appObject.hasComponent(UCs_1.SerializeHideableObjects.type)).toBe(true);
113
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeUndefined();
114
+ });
115
+ });
116
+ //# 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,sCAKqB;AACrB,6CAA4D;AAC5D,uDAAsE;AACtE,iDAAgE;AAChE,qDAAoE;AACpE,uCAAsE;AACtE,2DAA0E;AAC1E,gCAAkD;AAClD,qEAAsE;AACtE,mDAAgD;AAEhD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SA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IAAA,+BAAuB,EAAC,UAAU,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,IAAA,mDAA0B,EAAC,UAAU,EAAE;YACrD,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,8BAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACxE,IAAI,CACL,CAAC;QACF,MAAM,CAAC,sBAAc,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"]}
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./setupHideable"), exports);
18
+ __exportStar(require("./HideableFeatureFactory"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC","sourcesContent":["export * from \"./setupHideable\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2DAAyC","sourcesContent":["export * from \"./setupHideable\";\r\nexport * from \"./HideableFeatureFactory\";\r\n"]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HoverLabelFeatureFactory = void 0;
4
+ exports.makeHoverLabelFeatureFactory = makeHoverLabelFeatureFactory;
5
+ const core_1 = require("@vived/core");
6
+ const Stylus_1 = require("../../Stylus");
7
+ const Transform3D_1 = require("../../Transform3D");
8
+ const Controllers_1 = require("../Controllers");
9
+ const Entities_1 = require("../Entities");
10
+ const PM_1 = require("../PM");
11
+ const UseCases_1 = require("../UseCases");
12
+ /**
13
+ * Factory responsible for setting up the HoverLabel Feature domain components.
14
+ *
15
+ * Builds the same components as the legacy setupHoverLabel function, split
16
+ * into the DomainFactory phases. The hover label transform is parented to the
17
+ * StylusEntity in finalSetup, so the Stylus Feature's factory can be
18
+ * registered before or after this one.
19
+ *
20
+ * @extends DomainFactory
21
+ */
22
+ class HoverLabelFeatureFactory extends core_1.DomainFactory {
23
+ /**
24
+ * @param appObject The HoverLabel AppObject
25
+ * @param options Optional configuration, as for setupHoverLabel
26
+ */
27
+ constructor(appObject, options) {
28
+ super(appObject);
29
+ this.factoryName = "HoverLabelFeatureFactory";
30
+ this.options = options;
31
+ }
32
+ setupEntities() {
33
+ this.hoverLabelEntity = (0, Entities_1.makeHoverLabelEntity)(this.appObject);
34
+ }
35
+ setupUCs() {
36
+ if (this.options?.tryShowFactory) {
37
+ this.options.tryShowFactory(this.appObject);
38
+ }
39
+ else {
40
+ (0, UseCases_1.makeTryShowHoverLabel)(this.appObject);
41
+ }
42
+ (0, UseCases_1.makeToggleAllowHoverLabel)(this.appObject);
43
+ new UseCases_1.SerializeAllowHoverLabel(this.appObject);
44
+ }
45
+ setupPMs() {
46
+ (0, PM_1.makeWorldHoverLabelPM)(this.appObject);
47
+ (0, PM_1.makeScreenHoverLabelPM)(this.appObject);
48
+ (0, PM_1.makeAllowHoverLabelPM)(this.appObject);
49
+ (0, Transform3D_1.makeTransform3DPM)(this.appObject);
50
+ }
51
+ finalSetup() {
52
+ (0, Controllers_1.makeHoverLabelMouse)(this.appObject);
53
+ (0, Controllers_1.makeHoverLabelTouch)(this.appObject);
54
+ (0, Controllers_1.makeStylusHoverLabelController)(this.appObject);
55
+ if (!this.hoverLabelEntity)
56
+ return;
57
+ const stylus = Stylus_1.StylusEntity.get(this.appObjects);
58
+ if (!stylus) {
59
+ this.appObjects.submitError(this.factoryName, "StylusEntity needs to be setup for Hover Label");
60
+ return;
61
+ }
62
+ const transform = this.hoverLabelEntity.transform;
63
+ transform.parent = stylus.transform;
64
+ transform.localPosition = core_1.Vector3.Zero();
65
+ transform.localRotation = core_1.Quaternion.Identity();
66
+ transform.localScale = core_1.Vector3.One();
67
+ }
68
+ }
69
+ exports.HoverLabelFeatureFactory = HoverLabelFeatureFactory;
70
+ /**
71
+ * Factory function to create a new HoverLabelFeatureFactory
72
+ * @param appObjects The AppObjectRepo to get or create the HoverLabel AppObject from
73
+ * @param options Optional configuration, as for setupHoverLabel
74
+ * @returns A new HoverLabelFeatureFactory instance
75
+ */
76
+ function makeHoverLabelFeatureFactory(appObjects, options) {
77
+ return new HoverLabelFeatureFactory(appObjects.getOrCreate("HoverLabel"), options);
78
+ }
79
+ //# sourceMappingURL=HoverLabelFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HoverLabelFeatureFactory.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/HoverLabelFeatureFactory.ts"],"names":[],"mappings":";;;AAwGA,oEAQC;AAhHD,sCAMqB;AACrB,yCAA4C;AAC5C,mDAAsD;AACtD,gDAIwB;AACxB,0CAAqE;AACrE,8BAIe;AACf,0CAIqB;AAGrB;;;;;;;;;GASG;AACH,MAAa,wBAAyB,SAAQ,oBAAa;IAMzD;;;OAGG;IACH,YAAY,SAAoB,EAAE,OAA2B;QAC3D,KAAK,CAAC,SAAS,CAAC,CAAC;QAVnB,gBAAW,GAAG,0BAA0B,CAAC;QAWvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,gBAAgB,GAAG,IAAA,+BAAoB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,IAAA,gCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;QAED,IAAA,oCAAyB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,mCAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,QAAQ;QACN,IAAA,0BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,2BAAsB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,IAAA,0BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,+BAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,UAAU;QACR,IAAA,iCAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,IAAA,iCAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,IAAA,4CAA8B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO;QAEnC,MAAM,MAAM,GAAG,qBAAY,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,cAAO,CAAC,IAAI,EAAE,CAAC;QACzC,SAAS,CAAC,aAAa,GAAG,iBAAU,CAAC,QAAQ,EAAE,CAAC;QAChD,SAAS,CAAC,UAAU,GAAG,cAAO,CAAC,GAAG,EAAE,CAAC;IACvC,CAAC;CACF;AA3DD,4DA2DC;AAED;;;;;GAKG;AACH,SAAgB,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,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const MouseInput_1 = require("../../MouseInput");
5
+ const StateMachine_1 = require("../../StateMachine");
6
+ const Stylus_1 = require("../../Stylus");
7
+ const TouchController_1 = require("../../TouchController");
8
+ const Entities_1 = require("../Entities");
9
+ const UseCases_1 = require("../UseCases");
10
+ const HoverLabelFeatureFactory_1 = require("./HoverLabelFeatureFactory");
11
+ const setupHoverLabel_1 = require("./setupHoverLabel");
12
+ function makeTestRig() {
13
+ const appObjects = (0, core_1.makeAppObjectRepo)();
14
+ const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
15
+ const mockError = jest.fn();
16
+ appObjects.submitError = mockError;
17
+ return { appObjects, factories, mockError };
18
+ }
19
+ function registerCollaborators(appObjects) {
20
+ (0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
21
+ (0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
22
+ (0, StateMachine_1.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 core_1.DomainFactory))
30
+ .map((c) => c.type)
31
+ .sort();
32
+ });
33
+ return types;
34
+ }
35
+ describe("HoverLabelFeatureFactory", () => {
36
+ it("Builds the same components as setupHoverLabel", () => {
37
+ const legacy = makeTestRig();
38
+ registerCollaborators(legacy.appObjects);
39
+ (0, Stylus_1.makeStylusFeatureFactory)(legacy.appObjects);
40
+ legacy.factories.setupDomain();
41
+ (0, setupHoverLabel_1.setupHoverLabel)(legacy.appObjects);
42
+ const { appObjects, factories, mockError } = makeTestRig();
43
+ registerCollaborators(appObjects);
44
+ (0, Stylus_1.makeStylusFeatureFactory)(appObjects);
45
+ (0, HoverLabelFeatureFactory_1.makeHoverLabelFeatureFactory)(appObjects);
46
+ factories.setupDomain();
47
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
48
+ expect(mockError).not.toHaveBeenCalled();
49
+ });
50
+ it("Parents the hover label to the stylus when the Stylus factory is registered after it", () => {
51
+ const { appObjects, factories, mockError } = makeTestRig();
52
+ registerCollaborators(appObjects);
53
+ (0, HoverLabelFeatureFactory_1.makeHoverLabelFeatureFactory)(appObjects);
54
+ (0, Stylus_1.makeStylusFeatureFactory)(appObjects);
55
+ factories.setupDomain();
56
+ const hoverLabel = Entities_1.HoverLabelEntity.get(appObjects);
57
+ const stylus = Stylus_1.StylusEntity.get(appObjects);
58
+ expect(hoverLabel.transform.parent).toBe(stylus.transform);
59
+ expect(mockError).not.toHaveBeenCalled();
60
+ });
61
+ it("Submits an error when there is no Stylus Feature", () => {
62
+ const { appObjects, factories, mockError } = makeTestRig();
63
+ registerCollaborators(appObjects);
64
+ (0, HoverLabelFeatureFactory_1.makeHoverLabelFeatureFactory)(appObjects);
65
+ factories.setupDomain();
66
+ expect(mockError).toHaveBeenCalledWith("HoverLabelFeatureFactory", "StylusEntity needs to be setup for Hover Label");
67
+ });
68
+ it("Uses the try show factory if it is passed in", () => {
69
+ const { appObjects, factories } = makeTestRig();
70
+ registerCollaborators(appObjects);
71
+ (0, Stylus_1.makeStylusFeatureFactory)(appObjects);
72
+ const tryShowFactory = jest.fn();
73
+ const factory = (0, HoverLabelFeatureFactory_1.makeHoverLabelFeatureFactory)(appObjects, {
74
+ tryShowFactory,
75
+ });
76
+ factories.setupDomain();
77
+ expect(tryShowFactory).toHaveBeenCalledWith(factory.appObject);
78
+ expect(factory.appObject.hasComponent(UseCases_1.TryShowHoverLabel.type)).toBe(false);
79
+ });
80
+ });
81
+ //# 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,sCAKqB;AACrB,iDAAgE;AAChE,qDAAoE;AACpE,yCAAsE;AACtE,2DAA0E;AAC1E,0CAA+C;AAC/C,0CAAgD;AAChD,yEAA0E;AAC1E,uDAAoD;AAEpD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAyB;IACtD,IAAA,yCAA4B,EAAC,UAAU,CAAC,CAAC;IACzC,IAAA,mDAAiC,EAAC,UAAU,CAAC,CAAC;IAC9C,IAAA,6CAA8B,EAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,cAAc,CAAC,UAAyB;IAC/C,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,UAA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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,4BAAiB,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"]}
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./setupHoverLabel"), exports);
18
+ __exportStar(require("./HoverLabelFeatureFactory"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC","sourcesContent":["export * from \"./setupHoverLabel\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/HoverLabel/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,6DAA2C","sourcesContent":["export * from \"./setupHoverLabel\";\r\nexport * from \"./HoverLabelFeatureFactory\";\r\n"]}