@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
@@ -0,0 +1,80 @@
1
+ import { DomainFactory } from "@vived/core";
2
+ import { Hideable, makeIsHiddenPM } from "../../Hideable";
3
+ import { makeOverlayColorPM } from "../../OverlayColor";
4
+ import { makeSelectableStatePM } from "../../Selection";
5
+ import { ToolRepository } from "../../Tools";
6
+ import { makeTransform3DPM } from "../../Transform3D";
7
+ import { makeMouseLandmark, makeTouchLandmark } from "../Controller";
8
+ import { makeLandmarkEntity, makeLandmarkGlobals } from "../Entities";
9
+ import { makeDeleteAllLandmarksUC, makeTryAddLandmarkUC, makeTryPreviewLandmark, SerializeLandmarks, } from "../UseCases";
10
+ import { makeLandmarkRepoFactory } from "./landmarkRepoFactory";
11
+ /**
12
+ * Factory responsible for setting up the Landmarks Feature domain components.
13
+ *
14
+ * Builds the same components as the legacy setupLandmarks function, split
15
+ * into the DomainFactory phases, including the "LandmarkPreview" AppObject.
16
+ * The LANDMARK tool is created in finalSetup, so its place in the toolbar
17
+ * follows the order the factories are registered.
18
+ *
19
+ * @extends DomainFactory
20
+ */
21
+ export class LandmarksFeatureFactory extends DomainFactory {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.factoryName = "LandmarksFeatureFactory";
25
+ }
26
+ get previewAO() {
27
+ return this.appObjects.getOrCreate("LandmarkPreview");
28
+ }
29
+ setupEntities() {
30
+ const globals = makeLandmarkGlobals(this.appObject);
31
+ globals.landmarkRepoFactory = makeLandmarkRepoFactory(this.appObjects);
32
+ const preview = makeLandmarkEntity(this.previewAO);
33
+ const previewHidable = Hideable.get(this.previewAO.id, this.appObjects);
34
+ if (previewHidable) {
35
+ previewHidable.ignoreSerialization = true;
36
+ }
37
+ else {
38
+ this.appObjects.submitError(this.factoryName, "Unable to find Hideable on preview landmark");
39
+ }
40
+ globals.previewLandmark = preview;
41
+ }
42
+ setupUCs() {
43
+ new SerializeLandmarks(this.appObject);
44
+ makeDeleteAllLandmarksUC(this.appObject);
45
+ makeTryAddLandmarkUC(this.appObject);
46
+ makeTryPreviewLandmark(this.previewAO);
47
+ }
48
+ setupPMs() {
49
+ const previewAO = this.previewAO;
50
+ makeTransform3DPM(previewAO);
51
+ makeOverlayColorPM(previewAO);
52
+ makeSelectableStatePM(previewAO);
53
+ makeIsHiddenPM(previewAO);
54
+ }
55
+ finalSetup() {
56
+ makeMouseLandmark(this.appObject);
57
+ makeTouchLandmark(this.appObject);
58
+ const toolRepo = ToolRepository.get(this.appObjects);
59
+ if (!toolRepo) {
60
+ this.appObjects.submitError(this.factoryName, "Unable to find tool repo");
61
+ return;
62
+ }
63
+ toolRepo.makeToolFromData({
64
+ toolType: "LANDMARK",
65
+ isDefault: false,
66
+ label: "Landmark",
67
+ shortcutLabel: "l",
68
+ hotkeys: [{ keyCode: "KeyL" }],
69
+ });
70
+ }
71
+ }
72
+ /**
73
+ * Factory function to create a new LandmarksFeatureFactory
74
+ * @param appObjects The AppObjectRepo to get or create the Landmarks AppObject from
75
+ * @returns A new LandmarksFeatureFactory instance
76
+ */
77
+ export function makeLandmarksFeatureFactory(appObjects) {
78
+ return new LandmarksFeatureFactory(appObjects.getOrCreate("Landmarks"));
79
+ }
80
+ //# sourceMappingURL=LandmarksFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LandmarksFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/LandmarksFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAA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qB,CAAC,SAAS,CAAC,CAAC;QACjC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,UAAU;QACR,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAElC,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;YAC1E,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC;YACxB,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,UAAU;YACjB,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAAyB;IAEzB,OAAO,IAAI,uBAAuB,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { AppObject, AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { Hideable, makeIsHiddenPM } from \"../../Hideable\";\r\nimport { makeOverlayColorPM } from \"../../OverlayColor\";\r\nimport { makeSelectableStatePM } from \"../../Selection\";\r\nimport { ToolRepository } from \"../../Tools\";\r\nimport { makeTransform3DPM } from \"../../Transform3D\";\r\nimport { makeMouseLandmark, makeTouchLandmark } from \"../Controller\";\r\nimport { makeLandmarkEntity, makeLandmarkGlobals } from \"../Entities\";\r\nimport {\r\n makeDeleteAllLandmarksUC,\r\n makeTryAddLandmarkUC,\r\n makeTryPreviewLandmark,\r\n SerializeLandmarks,\r\n} from \"../UseCases\";\r\nimport { makeLandmarkRepoFactory } from \"./landmarkRepoFactory\";\r\n\r\n/**\r\n * Factory responsible for setting up the Landmarks Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupLandmarks function, split\r\n * into the DomainFactory phases, including the \"LandmarkPreview\" AppObject.\r\n * The LANDMARK tool is created in finalSetup, so its place in the toolbar\r\n * follows the order the factories are registered.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class LandmarksFeatureFactory extends DomainFactory {\r\n factoryName = \"LandmarksFeatureFactory\";\r\n\r\n private get previewAO(): AppObject {\r\n return this.appObjects.getOrCreate(\"LandmarkPreview\");\r\n }\r\n\r\n setupEntities(): void {\r\n const globals = makeLandmarkGlobals(this.appObject);\r\n globals.landmarkRepoFactory = makeLandmarkRepoFactory(this.appObjects);\r\n\r\n const preview = makeLandmarkEntity(this.previewAO);\r\n\r\n const previewHidable = Hideable.get(this.previewAO.id, this.appObjects);\r\n if (previewHidable) {\r\n previewHidable.ignoreSerialization = true;\r\n } else {\r\n this.appObjects.submitError(\r\n this.factoryName,\r\n \"Unable to find Hideable on preview landmark\",\r\n );\r\n }\r\n\r\n globals.previewLandmark = preview;\r\n }\r\n\r\n setupUCs(): void {\r\n new SerializeLandmarks(this.appObject);\r\n makeDeleteAllLandmarksUC(this.appObject);\r\n makeTryAddLandmarkUC(this.appObject);\r\n\r\n makeTryPreviewLandmark(this.previewAO);\r\n }\r\n\r\n setupPMs(): void {\r\n const previewAO = this.previewAO;\r\n makeTransform3DPM(previewAO);\r\n makeOverlayColorPM(previewAO);\r\n makeSelectableStatePM(previewAO);\r\n makeIsHiddenPM(previewAO);\r\n }\r\n\r\n finalSetup(): void {\r\n makeMouseLandmark(this.appObject);\r\n makeTouchLandmark(this.appObject);\r\n\r\n const toolRepo = ToolRepository.get(this.appObjects);\r\n if (!toolRepo) {\r\n this.appObjects.submitError(this.factoryName, \"Unable to find tool repo\");\r\n return;\r\n }\r\n\r\n toolRepo.makeToolFromData({\r\n toolType: \"LANDMARK\",\r\n isDefault: false,\r\n label: \"Landmark\",\r\n shortcutLabel: \"l\",\r\n hotkeys: [{ keyCode: \"KeyL\" }],\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new LandmarksFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Landmarks AppObject from\r\n * @returns A new LandmarksFeatureFactory instance\r\n */\r\nexport function makeLandmarksFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): LandmarksFeatureFactory {\r\n return new LandmarksFeatureFactory(appObjects.getOrCreate(\"Landmarks\"));\r\n}\r\n"]}
@@ -0,0 +1,98 @@
1
+ import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
2
+ import { makeBaseAppState } from "../../BaseApp/Entity/BaseAppState";
3
+ import { makeCalloutsFeatureFactory } from "../../Callouts";
4
+ import { Hideable } from "../../Hideable";
5
+ import { makeKeyboardInputFeatureFactory } from "../../KeyboardInput";
6
+ import { makeMouseInputFeatureFactory } from "../../MouseInput";
7
+ import { makeSelectionFeatureFactory } from "../../Selection";
8
+ import { makeStateMachineFeatureFactory } from "../../StateMachine";
9
+ import { makeToolsFeatureFactory, ToolRepository } from "../../Tools";
10
+ import { makeTouchControllerFeatureFactory } from "../../TouchController";
11
+ import { LandmarkGlobals } from "../Entities";
12
+ import { makeLandmarksFeatureFactory } from "./LandmarksFeatureFactory";
13
+ import { setupLandmarks } from "./setupLandmarks";
14
+ function makeTestRig() {
15
+ const appObjects = makeAppObjectRepo();
16
+ const factories = makeDomainFactoryRepo(appObjects);
17
+ const mockError = jest.fn();
18
+ appObjects.submitError = mockError;
19
+ return { appObjects, factories, mockError };
20
+ }
21
+ function registerCollaborators(appObjects) {
22
+ makeKeyboardInputFeatureFactory(appObjects);
23
+ makeMouseInputFeatureFactory(appObjects);
24
+ makeTouchControllerFeatureFactory(appObjects);
25
+ makeStateMachineFeatureFactory(appObjects);
26
+ makeBaseAppState(appObjects.getOrCreate("BaseApp"));
27
+ makeSelectionFeatureFactory(appObjects);
28
+ }
29
+ function componentTypes(appObjects) {
30
+ const types = {};
31
+ appObjects.getAll().forEach((ao) => {
32
+ types[ao.id] = ao
33
+ .allComponents()
34
+ .filter((c) => !(c instanceof DomainFactory))
35
+ .map((c) => c.type)
36
+ .sort();
37
+ });
38
+ return types;
39
+ }
40
+ function toolTypes(appObjects) {
41
+ return ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
42
+ }
43
+ describe("LandmarksFeatureFactory", () => {
44
+ it("Builds the same components as setupLandmarks", () => {
45
+ const legacy = makeTestRig();
46
+ registerCollaborators(legacy.appObjects);
47
+ makeToolsFeatureFactory(legacy.appObjects);
48
+ legacy.factories.setupDomain();
49
+ setupLandmarks(legacy.appObjects);
50
+ const { appObjects, factories, mockError } = makeTestRig();
51
+ registerCollaborators(appObjects);
52
+ makeToolsFeatureFactory(appObjects);
53
+ makeLandmarksFeatureFactory(appObjects);
54
+ factories.setupDomain();
55
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
56
+ expect(mockError).not.toHaveBeenCalled();
57
+ });
58
+ it("Sets up the preview landmark", () => {
59
+ const { appObjects, factories } = makeTestRig();
60
+ registerCollaborators(appObjects);
61
+ makeToolsFeatureFactory(appObjects);
62
+ makeLandmarksFeatureFactory(appObjects);
63
+ factories.setupDomain();
64
+ const preview = LandmarkGlobals.get(appObjects).previewLandmark;
65
+ expect(preview?.appObject.id).toEqual("LandmarkPreview");
66
+ expect(Hideable.get("LandmarkPreview", appObjects).ignoreSerialization).toBe(true);
67
+ });
68
+ it("Creates the LANDMARK tool in finalSetup", () => {
69
+ const { appObjects, factories } = makeTestRig();
70
+ registerCollaborators(appObjects);
71
+ makeToolsFeatureFactory(appObjects);
72
+ makeLandmarksFeatureFactory(appObjects);
73
+ const all = factories.getAll();
74
+ all.forEach((f) => f.setupEntities());
75
+ all.forEach((f) => f.setupUCs());
76
+ all.forEach((f) => f.setupPMs());
77
+ expect(ToolRepository.get(appObjects).getTool("LANDMARK")).toBeUndefined();
78
+ all.forEach((f) => f.finalSetup());
79
+ expect(ToolRepository.get(appObjects).getTool("LANDMARK")).toBeDefined();
80
+ });
81
+ it("Creates tools in factory registration order", () => {
82
+ const first = makeTestRig();
83
+ registerCollaborators(first.appObjects);
84
+ makeLandmarksFeatureFactory(first.appObjects);
85
+ makeCalloutsFeatureFactory(first.appObjects);
86
+ makeToolsFeatureFactory(first.appObjects);
87
+ first.factories.setupDomain();
88
+ const second = makeTestRig();
89
+ registerCollaborators(second.appObjects);
90
+ makeCalloutsFeatureFactory(second.appObjects);
91
+ makeLandmarksFeatureFactory(second.appObjects);
92
+ makeToolsFeatureFactory(second.appObjects);
93
+ second.factories.setupDomain();
94
+ expect(toolTypes(first.appObjects)).toEqual(["LANDMARK", "CALLOUT"]);
95
+ expect(toolTypes(second.appObjects)).toEqual(["CALLOUT", "LANDMARK"]);
96
+ });
97
+ });
98
+ //# sourceMappingURL=LandmarksFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LandmarksFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/LandmarksFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EA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AAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;QAC5B,qBAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACxC,2BAA2B,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9C,0BAA0B,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7C,uBAAuB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1C,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAE9B,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,0BAA0B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,2BAA2B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/C,uBAAuB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAE/B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeBaseAppState } from \"../../BaseApp/Entity/BaseAppState\";\r\nimport { makeCalloutsFeatureFactory } from \"../../Callouts\";\r\nimport { Hideable } from \"../../Hideable\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeSelectionFeatureFactory } from \"../../Selection\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeToolsFeatureFactory, ToolRepository } from \"../../Tools\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { LandmarkGlobals } from \"../Entities\";\r\nimport { makeLandmarksFeatureFactory } from \"./LandmarksFeatureFactory\";\r\nimport { setupLandmarks } from \"./setupLandmarks\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeKeyboardInputFeatureFactory(appObjects);\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n makeStateMachineFeatureFactory(appObjects);\r\n makeBaseAppState(appObjects.getOrCreate(\"BaseApp\"));\r\n makeSelectionFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\nfunction toolTypes(appObjects: AppObjectRepo) {\r\n return ToolRepository.get(appObjects)!.allTools.map((t) => t.toolType);\r\n}\r\n\r\ndescribe(\"LandmarksFeatureFactory\", () => {\r\n it(\"Builds the same components as setupLandmarks\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeToolsFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupLandmarks(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeLandmarksFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Sets up the preview landmark\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeLandmarksFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n const preview = LandmarkGlobals.get(appObjects)!.previewLandmark;\r\n expect(preview?.appObject.id).toEqual(\"LandmarkPreview\");\r\n expect(\r\n Hideable.get(\"LandmarkPreview\", appObjects)!.ignoreSerialization,\r\n ).toBe(true);\r\n });\r\n\r\n it(\"Creates the LANDMARK tool in finalSetup\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeLandmarksFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n all.forEach((f) => f.setupPMs());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"LANDMARK\")).toBeUndefined();\r\n\r\n all.forEach((f) => f.finalSetup());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"LANDMARK\")).toBeDefined();\r\n });\r\n\r\n it(\"Creates tools in factory registration order\", () => {\r\n const first = makeTestRig();\r\n registerCollaborators(first.appObjects);\r\n makeLandmarksFeatureFactory(first.appObjects);\r\n makeCalloutsFeatureFactory(first.appObjects);\r\n makeToolsFeatureFactory(first.appObjects);\r\n first.factories.setupDomain();\r\n\r\n const second = makeTestRig();\r\n registerCollaborators(second.appObjects);\r\n makeCalloutsFeatureFactory(second.appObjects);\r\n makeLandmarksFeatureFactory(second.appObjects);\r\n makeToolsFeatureFactory(second.appObjects);\r\n second.factories.setupDomain();\r\n\r\n expect(toolTypes(first.appObjects)).toEqual([\"LANDMARK\", \"CALLOUT\"]);\r\n expect(toolTypes(second.appObjects)).toEqual([\"CALLOUT\", \"LANDMARK\"]);\r\n });\r\n});\r\n"]}
@@ -1,4 +1,5 @@
1
1
  export * from "./landmarkFactory";
2
2
  export * from "./landmarkRepoFactory";
3
3
  export * from "./setupLandmarks";
4
+ export * from "./LandmarksFeatureFactory";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./landmarkFactory\";\nexport * from \"./landmarkRepoFactory\";\nexport * from \"./setupLandmarks\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Landmarks/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./landmarkFactory\";\r\nexport * from \"./landmarkRepoFactory\";\r\nexport * from \"./setupLandmarks\";\r\nexport * from \"./LandmarksFeatureFactory\";\r\n"]}
@@ -0,0 +1,52 @@
1
+ import { DomainFactory } from "@vived/core";
2
+ import { KeyboardToClearSelection, MouseHoverOnAppObject, MousePressOnAppObject, MouseSelectAppObject, TapToSelectAppObject, TouchPressOnAppObject, } from "../Controller";
3
+ import { makeSelection } from "../Entities";
4
+ import { makeSelectedObjectPM } from "../PM";
5
+ import { ClearSelectionUCHook, makeHoverAppObject, makePressAppObject, makeSelectAppObject, } from "../UC";
6
+ /**
7
+ * Factory responsible for setting up the Selection Feature domain components.
8
+ *
9
+ * Builds the same components as the legacy setupSelection function, split
10
+ * into the DomainFactory phases.
11
+ *
12
+ * The Hover, Press and Select UCs exist after setupUCs. An app that overrides
13
+ * their allow* hooks can do so from its own factory's setupPMs or finalSetup,
14
+ * through HoverAppObjectUC.get, PressAppObjectUC.get and SelectAppObjectUC.get.
15
+ *
16
+ * @extends DomainFactory
17
+ */
18
+ export class SelectionFeatureFactory extends DomainFactory {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.factoryName = "SelectionFeatureFactory";
22
+ }
23
+ setupEntities() {
24
+ makeSelection(this.appObject);
25
+ }
26
+ setupUCs() {
27
+ new ClearSelectionUCHook(this.appObject);
28
+ makeHoverAppObject(this.appObject);
29
+ makePressAppObject(this.appObject);
30
+ makeSelectAppObject(this.appObject);
31
+ }
32
+ setupPMs() {
33
+ makeSelectedObjectPM(this.appObject);
34
+ }
35
+ finalSetup() {
36
+ new MouseHoverOnAppObject(this.appObject);
37
+ new MousePressOnAppObject(this.appObject);
38
+ new TouchPressOnAppObject(this.appObject);
39
+ new MouseSelectAppObject(this.appObject);
40
+ new TapToSelectAppObject(this.appObject);
41
+ new KeyboardToClearSelection(this.appObject);
42
+ }
43
+ }
44
+ /**
45
+ * Factory function to create a new SelectionFeatureFactory
46
+ * @param appObjects The AppObjectRepo to get or create the Selection AppObject from
47
+ * @returns A new SelectionFeatureFactory instance
48
+ */
49
+ export function makeSelectionFeatureFactory(appObjects) {
50
+ return new SelectionFeatureFactory(appObjects.getOrCreate("Selection"));
51
+ }
52
+ //# sourceMappingURL=SelectionFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/SelectionFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,OAAO,CAAC;AAEf;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,uBAAwB,SAAQ,aAAa;IAA1D;;QACE,gBAAW,GAAG,yBAAyB,CAAC;IAyB1C,CAAC;IAvBC,aAAa;QACX,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ;QACN,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,UAAU;QACR,IAAI,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAAyB;IAEzB,OAAO,IAAI,uBAAuB,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport {\r\n KeyboardToClearSelection,\r\n MouseHoverOnAppObject,\r\n MousePressOnAppObject,\r\n MouseSelectAppObject,\r\n TapToSelectAppObject,\r\n TouchPressOnAppObject,\r\n} from \"../Controller\";\r\nimport { makeSelection } from \"../Entities\";\r\nimport { makeSelectedObjectPM } from \"../PM\";\r\nimport {\r\n ClearSelectionUCHook,\r\n makeHoverAppObject,\r\n makePressAppObject,\r\n makeSelectAppObject,\r\n} from \"../UC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Selection Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupSelection function, split\r\n * into the DomainFactory phases.\r\n *\r\n * The Hover, Press and Select UCs exist after setupUCs. An app that overrides\r\n * their allow* hooks can do so from its own factory's setupPMs or finalSetup,\r\n * through HoverAppObjectUC.get, PressAppObjectUC.get and SelectAppObjectUC.get.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class SelectionFeatureFactory extends DomainFactory {\r\n factoryName = \"SelectionFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeSelection(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n new ClearSelectionUCHook(this.appObject);\r\n makeHoverAppObject(this.appObject);\r\n makePressAppObject(this.appObject);\r\n makeSelectAppObject(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeSelectedObjectPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n new MouseHoverOnAppObject(this.appObject);\r\n new MousePressOnAppObject(this.appObject);\r\n new TouchPressOnAppObject(this.appObject);\r\n new MouseSelectAppObject(this.appObject);\r\n new TapToSelectAppObject(this.appObject);\r\n new KeyboardToClearSelection(this.appObject);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new SelectionFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Selection AppObject from\r\n * @returns A new SelectionFeatureFactory instance\r\n */\r\nexport function makeSelectionFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): SelectionFeatureFactory {\r\n return new SelectionFeatureFactory(appObjects.getOrCreate(\"Selection\"));\r\n}\r\n"]}
@@ -0,0 +1,58 @@
1
+ import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
2
+ import { makeBaseAppState } from "../../BaseApp/Entity/BaseAppState";
3
+ import { makeKeyboardInputFeatureFactory } from "../../KeyboardInput";
4
+ import { makeMouseInputFeatureFactory } from "../../MouseInput";
5
+ import { makeTouchControllerFeatureFactory } from "../../TouchController";
6
+ import { HoverAppObjectUC, PressAppObjectUC, SelectAppObjectUC } from "../UC";
7
+ import { makeSelectionFeatureFactory } from "./SelectionFeatureFactory";
8
+ import { setupSelection } from "./setupSelection";
9
+ function makeTestRig() {
10
+ const appObjects = makeAppObjectRepo();
11
+ const factories = makeDomainFactoryRepo(appObjects);
12
+ const mockError = jest.fn();
13
+ appObjects.submitError = mockError;
14
+ return { appObjects, factories, mockError };
15
+ }
16
+ function registerCollaborators(appObjects) {
17
+ makeBaseAppState(appObjects.getOrCreate("BaseApp"));
18
+ makeKeyboardInputFeatureFactory(appObjects);
19
+ makeMouseInputFeatureFactory(appObjects);
20
+ makeTouchControllerFeatureFactory(appObjects);
21
+ }
22
+ function componentTypes(appObjects) {
23
+ const types = {};
24
+ appObjects.getAll().forEach((ao) => {
25
+ types[ao.id] = ao
26
+ .allComponents()
27
+ .filter((c) => !(c instanceof DomainFactory))
28
+ .map((c) => c.type)
29
+ .sort();
30
+ });
31
+ return types;
32
+ }
33
+ describe("SelectionFeatureFactory", () => {
34
+ it("Builds the same components as setupSelection", () => {
35
+ const legacy = makeTestRig();
36
+ registerCollaborators(legacy.appObjects);
37
+ legacy.factories.setupDomain();
38
+ setupSelection(legacy.appObjects);
39
+ const { appObjects, factories, mockError } = makeTestRig();
40
+ registerCollaborators(appObjects);
41
+ makeSelectionFeatureFactory(appObjects);
42
+ factories.setupDomain();
43
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
44
+ expect(mockError).not.toHaveBeenCalled();
45
+ });
46
+ it("Builds the Hover, Press and Select UCs in setupUCs, so a later phase can override their allow hooks", () => {
47
+ const { appObjects, factories } = makeTestRig();
48
+ registerCollaborators(appObjects);
49
+ makeSelectionFeatureFactory(appObjects);
50
+ const all = factories.getAll();
51
+ all.forEach((f) => f.setupEntities());
52
+ all.forEach((f) => f.setupUCs());
53
+ expect(HoverAppObjectUC.get(appObjects)).toBeDefined();
54
+ expect(PressAppObjectUC.get(appObjects)).toBeDefined();
55
+ expect(SelectAppObjectUC.get(appObjects)).toBeDefined();
56
+ });
57
+ });
58
+ //# sourceMappingURL=SelectionFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/SelectionFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAyB;IACtD,gB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;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qGAAqG,EAAE,GAAG,EAAE;QAC7G,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,2BAA2B,CAAC,UAAU,CAAC,CAAC;QAExC,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;QAC/B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEjC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeBaseAppState } from \"../../BaseApp/Entity/BaseAppState\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { HoverAppObjectUC, PressAppObjectUC, SelectAppObjectUC } from \"../UC\";\r\nimport { makeSelectionFeatureFactory } from \"./SelectionFeatureFactory\";\r\nimport { setupSelection } from \"./setupSelection\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeBaseAppState(appObjects.getOrCreate(\"BaseApp\"));\r\n makeKeyboardInputFeatureFactory(appObjects);\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"SelectionFeatureFactory\", () => {\r\n it(\"Builds the same components as setupSelection\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupSelection(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeSelectionFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Builds the Hover, Press and Select UCs in setupUCs, so a later phase can override their allow hooks\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeSelectionFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n\r\n expect(HoverAppObjectUC.get(appObjects)).toBeDefined();\r\n expect(PressAppObjectUC.get(appObjects)).toBeDefined();\r\n expect(SelectAppObjectUC.get(appObjects)).toBeDefined();\r\n });\r\n});\r\n"]}
@@ -1,2 +1,3 @@
1
1
  export * from "./setupSelection";
2
+ export * from "./SelectionFeatureFactory";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./setupSelection\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Selection/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./setupSelection\";\r\nexport * from \"./SelectionFeatureFactory\";\r\n"]}
@@ -0,0 +1,40 @@
1
+ import { DomainFactory } from "@vived/core";
2
+ import { DoubleClickToStickMC } from "../Controllers/DoubleClickToStickMC";
3
+ import { DoubleTapToStickTC } from "../Controllers/DoubleTapToStickTC";
4
+ import { makeTryStickAppObjectUC } from "../UCs/TryStickAppObjectUC";
5
+ /**
6
+ * Factory responsible for setting up the Stick Feature domain components.
7
+ *
8
+ * Builds the same components as the legacy setupStick function, split into
9
+ * the DomainFactory phases.
10
+ *
11
+ * @extends DomainFactory
12
+ */
13
+ export class StickFeatureFactory extends DomainFactory {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.factoryName = "StickFeatureFactory";
17
+ }
18
+ setupEntities() {
19
+ // No entities for this feature
20
+ }
21
+ setupUCs() {
22
+ makeTryStickAppObjectUC(this.appObject);
23
+ }
24
+ setupPMs() {
25
+ // No PMs for this feature
26
+ }
27
+ finalSetup() {
28
+ new DoubleClickToStickMC(this.appObject);
29
+ new DoubleTapToStickTC(this.appObject);
30
+ }
31
+ }
32
+ /**
33
+ * Factory function to create a new StickFeatureFactory
34
+ * @param appObjects The AppObjectRepo to get or create the Stick AppObject from
35
+ * @returns A new StickFeatureFactory instance
36
+ */
37
+ export function makeStickFeatureFactory(appObjects) {
38
+ return new StickFeatureFactory(appObjects.getOrCreate("Stick"));
39
+ }
40
+ //# sourceMappingURL=StickFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/StickFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAAtD;;QACE,gBAAW,GAAG,qBAAqB,CAAC;IAkBtC,CAAC;IAhBC,aAAa;QACX,+BAA+B;IACjC,CAAC;IAED,QAAQ;QACN,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAyB;IAEzB,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { DoubleClickToStickMC } from \"../Controllers/DoubleClickToStickMC\";\r\nimport { DoubleTapToStickTC } from \"../Controllers/DoubleTapToStickTC\";\r\nimport { makeTryStickAppObjectUC } from \"../UCs/TryStickAppObjectUC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Stick Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupStick function, split into\r\n * the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class StickFeatureFactory extends DomainFactory {\r\n factoryName = \"StickFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n // No entities for this feature\r\n }\r\n\r\n setupUCs(): void {\r\n makeTryStickAppObjectUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n // No PMs for this feature\r\n }\r\n\r\n finalSetup(): void {\r\n new DoubleClickToStickMC(this.appObject);\r\n new DoubleTapToStickTC(this.appObject);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new StickFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Stick AppObject from\r\n * @returns A new StickFeatureFactory instance\r\n */\r\nexport function makeStickFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): StickFeatureFactory {\r\n return new StickFeatureFactory(appObjects.getOrCreate(\"Stick\"));\r\n}\r\n"]}
@@ -0,0 +1,42 @@
1
+ import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
2
+ import { makeMouseInputFeatureFactory } from "../../MouseInput";
3
+ import { makeTouchControllerFeatureFactory } from "../../TouchController";
4
+ import { setupStick } from "./setupStick";
5
+ import { makeStickFeatureFactory } from "./StickFeatureFactory";
6
+ function makeTestRig() {
7
+ const appObjects = makeAppObjectRepo();
8
+ const factories = makeDomainFactoryRepo(appObjects);
9
+ const mockError = jest.fn();
10
+ appObjects.submitError = mockError;
11
+ return { appObjects, factories, mockError };
12
+ }
13
+ function registerCollaborators(appObjects) {
14
+ makeMouseInputFeatureFactory(appObjects);
15
+ makeTouchControllerFeatureFactory(appObjects);
16
+ }
17
+ function componentTypes(appObjects) {
18
+ const types = {};
19
+ appObjects.getAll().forEach((ao) => {
20
+ types[ao.id] = ao
21
+ .allComponents()
22
+ .filter((c) => !(c instanceof DomainFactory))
23
+ .map((c) => c.type)
24
+ .sort();
25
+ });
26
+ return types;
27
+ }
28
+ describe("StickFeatureFactory", () => {
29
+ it("Builds the same components as setupStick", () => {
30
+ const legacy = makeTestRig();
31
+ registerCollaborators(legacy.appObjects);
32
+ legacy.factories.setupDomain();
33
+ setupStick(legacy.appObjects);
34
+ const { appObjects, factories, mockError } = makeTestRig();
35
+ registerCollaborators(appObjects);
36
+ makeStickFeatureFactory(appObjects);
37
+ factories.setupDomain();
38
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
39
+ expect(mockError).not.toHaveBeenCalled();
40
+ });
41
+ });
42
+ //# sourceMappingURL=StickFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/StickFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAyB;IACtD,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACzC,iCAAiC,CAAC,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,cAAc,CAAC,UAAyB;IAC/C,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,UAAU,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACjC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;aACd,aAAa,EAAE;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa,CAAC,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAClB,IAAI,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE9B,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACpC,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { setupStick } from \"./setupStick\";\r\nimport { makeStickFeatureFactory } from \"./StickFeatureFactory\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"StickFeatureFactory\", () => {\r\n it(\"Builds the same components as setupStick\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupStick(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeStickFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n});\r\n"]}
@@ -1,2 +1,3 @@
1
1
  export * from "./setupStick";
2
+ export * from "./StickFeatureFactory";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from \"./setupStick\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Stick/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./setupStick\";\r\nexport * from \"./StickFeatureFactory\";\r\n"]}
@@ -0,0 +1,43 @@
1
+ import { DomainFactory } from "@vived/core";
2
+ import { makeStoredView } from "../Entities";
3
+ import { makeHasStoredViewPM } from "../PM";
4
+ import { makeClearStoredViewUC, makeRestoreStoredViewUC, makeSerializeStoredView, makeSetViewInXRUC, makeStoreCurrentViewUC, } from "../UC";
5
+ /**
6
+ * Factory responsible for setting up the StoredView Feature domain components.
7
+ *
8
+ * Builds the same components as the legacy setupStoredView function, split
9
+ * into the DomainFactory phases.
10
+ *
11
+ * @extends DomainFactory
12
+ */
13
+ export class StoredViewFeatureFactory extends DomainFactory {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.factoryName = "StoredViewFeatureFactory";
17
+ }
18
+ setupEntities() {
19
+ makeStoredView(this.appObject);
20
+ }
21
+ setupUCs() {
22
+ makeStoreCurrentViewUC(this.appObject);
23
+ makeRestoreStoredViewUC(this.appObject);
24
+ makeClearStoredViewUC(this.appObject);
25
+ makeSetViewInXRUC(this.appObject);
26
+ makeSerializeStoredView(this.appObject);
27
+ }
28
+ setupPMs() {
29
+ makeHasStoredViewPM(this.appObject);
30
+ }
31
+ finalSetup() {
32
+ // No final setup needed
33
+ }
34
+ }
35
+ /**
36
+ * Factory function to create a new StoredViewFeatureFactory
37
+ * @param appObjects The AppObjectRepo to get or create the StoredView AppObject from
38
+ * @returns A new StoredViewFeatureFactory instance
39
+ */
40
+ export function makeStoredViewFeatureFactory(appObjects) {
41
+ return new StoredViewFeatureFactory(appObjects.getOrCreate("StoredView"));
42
+ }
43
+ //# sourceMappingURL=StoredViewFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoredViewFeatureFactory.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/StoredViewFeatureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,OAAO,CAAC;AAEf;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAA3D;;QACE,gBAAW,GAAG,0BAA0B,CAAC;IAqB3C,CAAC;IAnBC,aAAa;QACX,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,QAAQ;QACN,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,UAAyB;IAEzB,OAAO,IAAI,wBAAwB,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { makeStoredView } from \"../Entities\";\r\nimport { makeHasStoredViewPM } from \"../PM\";\r\nimport {\r\n makeClearStoredViewUC,\r\n makeRestoreStoredViewUC,\r\n makeSerializeStoredView,\r\n makeSetViewInXRUC,\r\n makeStoreCurrentViewUC,\r\n} from \"../UC\";\r\n\r\n/**\r\n * Factory responsible for setting up the StoredView Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupStoredView function, split\r\n * into the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class StoredViewFeatureFactory extends DomainFactory {\r\n factoryName = \"StoredViewFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeStoredView(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n makeStoreCurrentViewUC(this.appObject);\r\n makeRestoreStoredViewUC(this.appObject);\r\n makeClearStoredViewUC(this.appObject);\r\n makeSetViewInXRUC(this.appObject);\r\n makeSerializeStoredView(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeHasStoredViewPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n // No final setup needed\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new StoredViewFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the StoredView AppObject from\r\n * @returns A new StoredViewFeatureFactory instance\r\n */\r\nexport function makeStoredViewFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): StoredViewFeatureFactory {\r\n return new StoredViewFeatureFactory(appObjects.getOrCreate(\"StoredView\"));\r\n}\r\n"]}
@@ -0,0 +1,37 @@
1
+ import { DomainFactory, makeAppObjectRepo, makeDomainFactoryRepo, } from "@vived/core";
2
+ import { makeStateMachineFeatureFactory } from "../../StateMachine";
3
+ import { setupStoredView } from "./setupStoredView";
4
+ import { makeStoredViewFeatureFactory } from "./StoredViewFeatureFactory";
5
+ function makeTestRig() {
6
+ const appObjects = makeAppObjectRepo();
7
+ const factories = makeDomainFactoryRepo(appObjects);
8
+ const mockError = jest.fn();
9
+ appObjects.submitError = mockError;
10
+ return { appObjects, factories, mockError };
11
+ }
12
+ function componentTypes(appObjects) {
13
+ const types = {};
14
+ appObjects.getAll().forEach((ao) => {
15
+ types[ao.id] = ao
16
+ .allComponents()
17
+ .filter((c) => !(c instanceof DomainFactory))
18
+ .map((c) => c.type)
19
+ .sort();
20
+ });
21
+ return types;
22
+ }
23
+ describe("StoredViewFeatureFactory", () => {
24
+ it("Builds the same components as setupStoredView", () => {
25
+ const legacy = makeTestRig();
26
+ makeStateMachineFeatureFactory(legacy.appObjects);
27
+ legacy.factories.setupDomain();
28
+ setupStoredView(legacy.appObjects);
29
+ const { appObjects, factories, mockError } = makeTestRig();
30
+ makeStateMachineFeatureFactory(appObjects);
31
+ makeStoredViewFeatureFactory(appObjects);
32
+ factories.setupDomain();
33
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
34
+ expect(mockError).not.toHaveBeenCalled();
35
+ });
36
+ });
37
+ //# sourceMappingURL=StoredViewFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoredViewFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/StoredViewFeatureFactory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE1E,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,UAAyB;IAC/C,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,UAAU,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACjC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;aACd,aAAa,EAAE;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa,CAAC,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAClB,IAAI,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,8BAA8B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEnC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,8BAA8B,CAAC,UAAU,CAAC,CAAC;QAC3C,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACzC,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { setupStoredView } from \"./setupStoredView\";\r\nimport { makeStoredViewFeatureFactory } from \"./StoredViewFeatureFactory\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"StoredViewFeatureFactory\", () => {\r\n it(\"Builds the same components as setupStoredView\", () => {\r\n const legacy = makeTestRig();\r\n makeStateMachineFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupStoredView(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n makeStateMachineFeatureFactory(appObjects);\r\n makeStoredViewFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n});\r\n"]}
@@ -1,2 +1,3 @@
1
1
  export * from "./setupStoredView";
2
+ export * from "./StoredViewFeatureFactory";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"./setupStoredView\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/StoredView/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./setupStoredView\";\r\nexport * from \"./StoredViewFeatureFactory\";\r\n"]}