@vived/app 6.9.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -145
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js +67 -0
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js +84 -0
- package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Callouts/Factories/index.js +1 -0
- package/dist/cjs/Callouts/Factories/index.js.map +1 -1
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js +52 -0
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +44 -0
- package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
- package/dist/cjs/ChannelModel/Factories/index.js +1 -0
- package/dist/cjs/ChannelModel/Factories/index.js.map +1 -1
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js +50 -0
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js +39 -0
- package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Environment/Factories/index.js +2 -1
- package/dist/cjs/Environment/Factories/index.js.map +1 -1
- package/dist/cjs/Environment/Factories/setupEnvironments.js +19 -0
- package/dist/cjs/Environment/Factories/setupEnvironments.js.map +1 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js +69 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js +116 -0
- package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Hideable/Factories/index.js +1 -0
- package/dist/cjs/Hideable/Factories/index.js.map +1 -1
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js +79 -0
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +81 -0
- package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
- package/dist/cjs/HoverLabel/Factories/index.js +1 -0
- package/dist/cjs/HoverLabel/Factories/index.js.map +1 -1
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js +85 -0
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js +100 -0
- package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Landmarks/Factories/index.js +1 -0
- package/dist/cjs/Landmarks/Factories/index.js.map +1 -1
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js +57 -0
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js +60 -0
- package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Selection/Factories/index.js +1 -0
- package/dist/cjs/Selection/Factories/index.js.map +1 -1
- package/dist/cjs/Stick/Factories/StickFeatureFactory.js +45 -0
- package/dist/cjs/Stick/Factories/StickFeatureFactory.js.map +1 -0
- package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js +44 -0
- package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Stick/Factories/index.js +1 -0
- package/dist/cjs/Stick/Factories/index.js.map +1 -1
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js +48 -0
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js +39 -0
- package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
- package/dist/cjs/StoredView/Factories/index.js +1 -0
- package/dist/cjs/StoredView/Factories/index.js.map +1 -1
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js +47 -0
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js +35 -0
- package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
- package/dist/cjs/Stylus/Factories/index.js +1 -0
- package/dist/cjs/Stylus/Factories/index.js.map +1 -1
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js +70 -0
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js +78 -0
- package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
- package/dist/cjs/zSpace/Factory/index.js +1 -0
- package/dist/cjs/zSpace/Factory/index.js.map +1 -1
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js +62 -0
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js +82 -0
- package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
- package/dist/esm/Callouts/Factories/index.js +1 -0
- package/dist/esm/Callouts/Factories/index.js.map +1 -1
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js +47 -0
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +42 -0
- package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
- package/dist/esm/ChannelModel/Factories/index.js +1 -0
- package/dist/esm/ChannelModel/Factories/index.js.map +1 -1
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js +45 -0
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js +37 -0
- package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
- package/dist/esm/Environment/Factories/index.js +2 -1
- package/dist/esm/Environment/Factories/index.js.map +1 -1
- package/dist/esm/Environment/Factories/setupEnvironments.js +16 -0
- package/dist/esm/Environment/Factories/setupEnvironments.js.map +1 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.js +64 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js +114 -0
- package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
- package/dist/esm/Hideable/Factories/index.js +1 -0
- package/dist/esm/Hideable/Factories/index.js.map +1 -1
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js +74 -0
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +79 -0
- package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
- package/dist/esm/HoverLabel/Factories/index.js +1 -0
- package/dist/esm/HoverLabel/Factories/index.js.map +1 -1
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js +80 -0
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js +98 -0
- package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
- package/dist/esm/Landmarks/Factories/index.js +1 -0
- package/dist/esm/Landmarks/Factories/index.js.map +1 -1
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.js +52 -0
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js +58 -0
- package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
- package/dist/esm/Selection/Factories/index.js +1 -0
- package/dist/esm/Selection/Factories/index.js.map +1 -1
- package/dist/esm/Stick/Factories/StickFeatureFactory.js +40 -0
- package/dist/esm/Stick/Factories/StickFeatureFactory.js.map +1 -0
- package/dist/esm/Stick/Factories/StickFeatureFactory.test.js +42 -0
- package/dist/esm/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
- package/dist/esm/Stick/Factories/index.js +1 -0
- package/dist/esm/Stick/Factories/index.js.map +1 -1
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js +43 -0
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js +37 -0
- package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
- package/dist/esm/StoredView/Factories/index.js +1 -0
- package/dist/esm/StoredView/Factories/index.js.map +1 -1
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.js +42 -0
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js +33 -0
- package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
- package/dist/esm/Stylus/Factories/index.js +1 -0
- package/dist/esm/Stylus/Factories/index.js.map +1 -1
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js +65 -0
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js +76 -0
- package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
- package/dist/esm/zSpace/Factory/index.js +1 -0
- package/dist/esm/zSpace/Factory/index.js.map +1 -1
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts +24 -0
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts.map +1 -0
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts +2 -0
- package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Callouts/Factories/index.d.ts +1 -0
- package/dist/types/Callouts/Factories/index.d.ts.map +1 -1
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts +23 -0
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts.map +1 -0
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts +2 -0
- package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/ChannelModel/Factories/index.d.ts +1 -0
- package/dist/types/ChannelModel/Factories/index.d.ts.map +1 -1
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts +23 -0
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts.map +1 -0
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts +2 -0
- package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Environment/Factories/index.d.ts +2 -1
- package/dist/types/Environment/Factories/index.d.ts.map +1 -1
- package/dist/types/Environment/Factories/setupEnvironments.d.ts +3 -0
- package/dist/types/Environment/Factories/setupEnvironments.d.ts.map +1 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts +32 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts.map +1 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts +2 -0
- package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Hideable/Factories/index.d.ts +1 -0
- package/dist/types/Hideable/Factories/index.d.ts.map +1 -1
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts +34 -0
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts.map +1 -0
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts +2 -0
- package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/HoverLabel/Factories/index.d.ts +1 -0
- package/dist/types/HoverLabel/Factories/index.d.ts.map +1 -1
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts +26 -0
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts.map +1 -0
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts +2 -0
- package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Landmarks/Factories/index.d.ts +1 -0
- package/dist/types/Landmarks/Factories/index.d.ts.map +1 -1
- package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts +27 -0
- package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts.map +1 -0
- package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts +2 -0
- package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Selection/Factories/index.d.ts +1 -0
- package/dist/types/Selection/Factories/index.d.ts.map +1 -1
- package/dist/types/Stick/Factories/StickFeatureFactory.d.ts +23 -0
- package/dist/types/Stick/Factories/StickFeatureFactory.d.ts.map +1 -0
- package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts +2 -0
- package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Stick/Factories/index.d.ts +1 -0
- package/dist/types/Stick/Factories/index.d.ts.map +1 -1
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts +23 -0
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts.map +1 -0
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts +2 -0
- package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/StoredView/Factories/index.d.ts +1 -0
- package/dist/types/StoredView/Factories/index.d.ts.map +1 -1
- package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts +23 -0
- package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts.map +1 -0
- package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts +2 -0
- package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/Stylus/Factories/index.d.ts +1 -0
- package/dist/types/Stylus/Factories/index.d.ts.map +1 -1
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts +26 -0
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts.map +1 -0
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts +2 -0
- package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts.map +1 -0
- package/dist/types/zSpace/Factory/index.d.ts +1 -0
- package/dist/types/zSpace/Factory/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,145 +1,166 @@
|
|
|
1
|
-
# @vived/app
|
|
2
|
-
|
|
3
|
-
The shared **Feature Library** that VIVED Slide Apps are built from — a published collection
|
|
4
|
-
of reusable Features, built on [`@vived/core`](https://github.com/vivedlearning/vived_core)'s
|
|
5
|
-
AppObject architecture, that a Slide App pulls in and composes.
|
|
6
|
-
|
|
7
|
-
It is **not** a Slide App and **not** a Host. It runs *inside* a Slide App, and it includes the
|
|
8
|
-
code that implements the App's side of the App↔Host boundary.
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install @vived/app
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
`@vived/core` is a peer dependency:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @vived/core
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Ships ESM, CJS and type declarations. Requires `@vived/core` `>=2.0.0`.
|
|
23
|
-
|
|
24
|
-
## Composing Features
|
|
25
|
-
|
|
26
|
-
The unit of consumption is a **Feature** (`src/<Feature>/`). Each one is wired by its
|
|
27
|
-
`FeatureFactory` — a `DomainFactory` subclass that builds the Feature in phases. Register the
|
|
28
|
-
Features you want with a `DomainFactoryRepo`, then run one phased setup so cross-Feature
|
|
29
|
-
dependencies resolve in the right order:
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import { makeAppObjectRepo, makeDomainFactoryRepo } from "@vived/core";
|
|
33
|
-
import {
|
|
34
|
-
makeChallengeFeatureFactory,
|
|
35
|
-
makeDispatcherFeatureFactory,
|
|
36
|
-
makeObjectPickFeatureFactory,
|
|
37
|
-
makeRequestHandlerFeatureFactory,
|
|
38
|
-
makeStateMachineFeatureFactory,
|
|
39
|
-
} from "@vived/app";
|
|
40
|
-
|
|
41
|
-
const appObjects = makeAppObjectRepo();
|
|
42
|
-
const factories = makeDomainFactoryRepo(appObjects);
|
|
43
|
-
|
|
44
|
-
// The Host boundary. `hostHandler` is the function the Host gave you to receive
|
|
45
|
-
// the App's outbound Requests.
|
|
46
|
-
makeDispatcherFeatureFactory(appObjects, hostHandler);
|
|
47
|
-
makeRequestHandlerFeatureFactory(appObjects);
|
|
48
|
-
|
|
49
|
-
// Whatever else this Slide App needs.
|
|
50
|
-
makeStateMachineFeatureFactory(appObjects);
|
|
51
|
-
makeChallengeFeatureFactory(appObjects);
|
|
52
|
-
makeObjectPickFeatureFactory(appObjects);
|
|
53
|
-
|
|
54
|
-
// Runs every factory's setupEntities, then every setupUCs, then setupPMs,
|
|
55
|
-
// then finalSetup — so a Feature can depend on another Feature's entities.
|
|
56
|
-
factories.setupDomain();
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Order of registration is not significant: the phased orchestration is what resolves
|
|
60
|
-
cross-Feature dependencies. Object Pick registers itself as a Challenge kind during
|
|
61
|
-
`finalSetup`, after every Feature's entities exist.
|
|
62
|
-
|
|
63
|
-
A Feature you don't register simply isn't there. Declining an optional subsystem is a
|
|
64
|
-
supported state and is not an error.
|
|
65
|
-
|
|
66
|
-
### Legacy `setup<Feature>` functions
|
|
67
|
-
|
|
68
|
-
Older `setup<Feature>(appObjects)` functions still exist alongside the factories and are being
|
|
69
|
-
retired one Feature at a time. **Prefer the `FeatureFactory`** — it is the canonical wiring, and
|
|
70
|
-
where the two have drifted the factory is the source of truth. The legacy functions run
|
|
71
|
-
immediately rather than in phases, so they are order-sensitive in ways the factories are not.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
1
|
+
# @vived/app
|
|
2
|
+
|
|
3
|
+
The shared **Feature Library** that VIVED Slide Apps are built from — a published collection
|
|
4
|
+
of reusable Features, built on [`@vived/core`](https://github.com/vivedlearning/vived_core)'s
|
|
5
|
+
AppObject architecture, that a Slide App pulls in and composes.
|
|
6
|
+
|
|
7
|
+
It is **not** a Slide App and **not** a Host. It runs *inside* a Slide App, and it includes the
|
|
8
|
+
code that implements the App's side of the App↔Host boundary.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @vived/app
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`@vived/core` is a peer dependency:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @vived/core
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Ships ESM, CJS and type declarations. Requires `@vived/core` `>=2.0.0`.
|
|
23
|
+
|
|
24
|
+
## Composing Features
|
|
25
|
+
|
|
26
|
+
The unit of consumption is a **Feature** (`src/<Feature>/`). Each one is wired by its
|
|
27
|
+
`FeatureFactory` — a `DomainFactory` subclass that builds the Feature in phases. Register the
|
|
28
|
+
Features you want with a `DomainFactoryRepo`, then run one phased setup so cross-Feature
|
|
29
|
+
dependencies resolve in the right order:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { makeAppObjectRepo, makeDomainFactoryRepo } from "@vived/core";
|
|
33
|
+
import {
|
|
34
|
+
makeChallengeFeatureFactory,
|
|
35
|
+
makeDispatcherFeatureFactory,
|
|
36
|
+
makeObjectPickFeatureFactory,
|
|
37
|
+
makeRequestHandlerFeatureFactory,
|
|
38
|
+
makeStateMachineFeatureFactory,
|
|
39
|
+
} from "@vived/app";
|
|
40
|
+
|
|
41
|
+
const appObjects = makeAppObjectRepo();
|
|
42
|
+
const factories = makeDomainFactoryRepo(appObjects);
|
|
43
|
+
|
|
44
|
+
// The Host boundary. `hostHandler` is the function the Host gave you to receive
|
|
45
|
+
// the App's outbound Requests.
|
|
46
|
+
makeDispatcherFeatureFactory(appObjects, hostHandler);
|
|
47
|
+
makeRequestHandlerFeatureFactory(appObjects);
|
|
48
|
+
|
|
49
|
+
// Whatever else this Slide App needs.
|
|
50
|
+
makeStateMachineFeatureFactory(appObjects);
|
|
51
|
+
makeChallengeFeatureFactory(appObjects);
|
|
52
|
+
makeObjectPickFeatureFactory(appObjects);
|
|
53
|
+
|
|
54
|
+
// Runs every factory's setupEntities, then every setupUCs, then setupPMs,
|
|
55
|
+
// then finalSetup — so a Feature can depend on another Feature's entities.
|
|
56
|
+
factories.setupDomain();
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Order of registration is not significant: the phased orchestration is what resolves
|
|
60
|
+
cross-Feature dependencies. Object Pick registers itself as a Challenge kind during
|
|
61
|
+
`finalSetup`, after every Feature's entities exist.
|
|
62
|
+
|
|
63
|
+
A Feature you don't register simply isn't there. Declining an optional subsystem is a
|
|
64
|
+
supported state and is not an error.
|
|
65
|
+
|
|
66
|
+
### Legacy `setup<Feature>` functions
|
|
67
|
+
|
|
68
|
+
Older `setup<Feature>(appObjects)` functions still exist alongside the factories and are being
|
|
69
|
+
retired one Feature at a time. **Prefer the `FeatureFactory`** — it is the canonical wiring, and
|
|
70
|
+
where the two have drifted the factory is the source of truth. The legacy functions run
|
|
71
|
+
immediately rather than in phases, so they are order-sensitive in ways the factories are not.
|
|
72
|
+
|
|
73
|
+
These factories build the same components as the `setup*` function they replace, with the
|
|
74
|
+
same AppObject id and options:
|
|
75
|
+
|
|
76
|
+
| Legacy function | Factory |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `setupCallouts(appObjects)` | `makeCalloutsFeatureFactory(appObjects)` |
|
|
79
|
+
| `setupChannelModels(appObjects)` | `makeChannelModelFeatureFactory(appObjects)` |
|
|
80
|
+
| `setupEnvironments(appObjects)` | `makeEnvironmentFeatureFactory(appObjects)` |
|
|
81
|
+
| `setupHideable(appObjects, options?)` | `makeHideableFeatureFactory(appObjects, options?)` |
|
|
82
|
+
| `setupHoverLabel(appObjects, options?)` | `makeHoverLabelFeatureFactory(appObjects, options?)` |
|
|
83
|
+
| `setupLandmarks(appObjects)` | `makeLandmarksFeatureFactory(appObjects)` |
|
|
84
|
+
| `setupSelection(appObjects)` | `makeSelectionFeatureFactory(appObjects)` |
|
|
85
|
+
| `setupStick(appObjects)` | `makeStickFeatureFactory(appObjects)` |
|
|
86
|
+
| `setupStoredView(appObjects)` | `makeStoredViewFeatureFactory(appObjects)` |
|
|
87
|
+
| `setupStylus(appObjects)` | `makeStylusFeatureFactory(appObjects)` |
|
|
88
|
+
| `setupZSpace(appObjects)` | `makeZSpaceFeatureFactory(appObjects)` |
|
|
89
|
+
|
|
90
|
+
Two orders still follow registration order. Tools are created in `finalSetup`, so the toolbar
|
|
91
|
+
lists them in the order their factories were registered. Serializers are built in `setupUCs`,
|
|
92
|
+
so the saved state lists its Systems in the same order.
|
|
93
|
+
|
|
94
|
+
## The Host boundary
|
|
95
|
+
|
|
96
|
+
A Slide App and its Host talk only through **Requests** — typed, versioned messages of the
|
|
97
|
+
shape `{ type, version, payload }`. The boundary is two one-way streets, named from the App's
|
|
98
|
+
point of view:
|
|
99
|
+
|
|
100
|
+
| Direction | Feature | What it does |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| Outbound (App → Host) | `Dispatcher` | One UC per request type — `appIsReady`, `submitHitResult`, `getAssetBlobURL`… |
|
|
103
|
+
| Inbound (Host → App) | `RequestHandler` | Routes each incoming Request to a registered UC — `START_APP`, `SET_APP_STATE`, `SET_IS_AUTHORING`… |
|
|
104
|
+
|
|
105
|
+
An outbound Request is answered by a **response callback** passed in its own payload, never by
|
|
106
|
+
the Host sending an inbound Request back.
|
|
107
|
+
|
|
108
|
+
See [`docs/dispatcher-reference.md`](./docs/dispatcher-reference.md) and
|
|
109
|
+
[`docs/feature-factories-reference.md`](./docs/feature-factories-reference.md).
|
|
110
|
+
|
|
111
|
+
## State and serialization
|
|
112
|
+
|
|
113
|
+
**State** is one Slide's serialized snapshot. Each independently-serialized dimension of it is a
|
|
114
|
+
**System** — dissectable meshes, callouts, landmarks, stored view each register as one, and each
|
|
115
|
+
versions and (de)serializes only its own slice. The app-side `StateMachineEntity` gathers every
|
|
116
|
+
registered System into a `SerializedStates` envelope and applies an incoming one
|
|
117
|
+
System-by-System. It does not sequence Slides; the Host owns that.
|
|
118
|
+
|
|
119
|
+
See [`docs/statemachine-serialization-reference.md`](./docs/statemachine-serialization-reference.md).
|
|
120
|
+
|
|
121
|
+
## The framework-free rule
|
|
122
|
+
|
|
123
|
+
Everything in this package is **Domain** code and may not depend on any external framework
|
|
124
|
+
([ADR-0001](./docs/adr/0001-framework-free-domain.md)). Where the domain needs a framework
|
|
125
|
+
capability — rendering, picking — it declares an **abstract** class and the consuming Slide App
|
|
126
|
+
supplies the concrete implementation from its own Frameworks folder.
|
|
127
|
+
|
|
128
|
+
## Features
|
|
129
|
+
|
|
130
|
+
`Babylon` · `BaseApp` · `Callouts` · `Camera` · `Challenge` · `ChannelModel` · `Dispatcher` ·
|
|
131
|
+
`Enablement` · `Environment` · `EventSystem` · `FeatureFlags` · `FramedScreen` · `GLBModel` ·
|
|
132
|
+
`Hideable` · `HoverLabel` · `InspectorTab` · `KeyboardInput` · `Label` · `LabelDrop` ·
|
|
133
|
+
`Landmarks` · `Mesh` · `MouseInput` · `ObjectPick` · `OverlayColor` · `Procedure` · `Question` ·
|
|
134
|
+
`RequestHandler` · `SceneRoot` · `Selection` · `StateMachine` · `Stick` · `StoredView` ·
|
|
135
|
+
`Stylus` · `ThemeColors` · `Tools` · `TouchController` · `Transform3D` · `Transparency` ·
|
|
136
|
+
`UndoRedo` · `Workplane` · `XR` · `zSpace`
|
|
137
|
+
|
|
138
|
+
Every Feature is organized by AppObject component type — Entities, UCs, PMs, Controllers,
|
|
139
|
+
Adapters, Factories, Mocks. Each ships a `Mocks/` folder for testing against it.
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
| Document | What it covers |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| [`CONTEXT.md`](./CONTEXT.md) | The glossary — package identity, Host boundary, State & Systems, component conventions |
|
|
146
|
+
| [`CONTEXT-MAP.md`](./CONTEXT-MAP.md) | How context is organized across the Features |
|
|
147
|
+
| [`CHANGELOG.md`](./CHANGELOG.md) | Release notes |
|
|
148
|
+
| [`docs/adr/`](./docs/adr/) | Architecture decision records |
|
|
149
|
+
| [`CLAUDE.md`](./CLAUDE.md) | Guidance for agents working in this repo |
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm install
|
|
155
|
+
npm test # jest, watch mode
|
|
156
|
+
npm run testOnce
|
|
157
|
+
npm run lint # tslint
|
|
158
|
+
npm run format # prettier
|
|
159
|
+
npm run build # tsc → ESM + CJS + types under dist/
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Tests are co-located as `*.test.ts` next to the code they cover.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
ISC
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CalloutsFeatureFactory = void 0;
|
|
4
|
+
exports.makeCalloutsFeatureFactory = makeCalloutsFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Tools_1 = require("../../Tools");
|
|
7
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
8
|
+
const Controller_1 = require("../Controller");
|
|
9
|
+
const Entities_1 = require("../Entities");
|
|
10
|
+
const UC_1 = require("../UC");
|
|
11
|
+
const calloutRepoFactory_1 = require("./calloutRepoFactory");
|
|
12
|
+
/**
|
|
13
|
+
* Factory responsible for setting up the Callouts Feature domain components.
|
|
14
|
+
*
|
|
15
|
+
* Builds the same components as the legacy setupCallouts function, split into
|
|
16
|
+
* the DomainFactory phases. The CALLOUT tool is created in finalSetup, so its
|
|
17
|
+
* place in the toolbar follows the order the factories are registered.
|
|
18
|
+
*
|
|
19
|
+
* @extends DomainFactory
|
|
20
|
+
*/
|
|
21
|
+
class CalloutsFeatureFactory extends core_1.DomainFactory {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.factoryName = "CalloutsFeatureFactory";
|
|
25
|
+
}
|
|
26
|
+
setupEntities() {
|
|
27
|
+
const globals = (0, Entities_1.makeCalloutGlobals)(this.appObject);
|
|
28
|
+
globals.calloutRepoFactory = (0, calloutRepoFactory_1.makeCalloutRepoFactory)(this.appObjects);
|
|
29
|
+
}
|
|
30
|
+
setupUCs() {
|
|
31
|
+
(0, UC_1.makeTryPanLabelUC)(this.appObject);
|
|
32
|
+
(0, UC_1.makeTryAddCalloutUC)(this.appObject);
|
|
33
|
+
new UC_1.SerializeCallouts(this.appObject);
|
|
34
|
+
(0, UC_1.makeDeleteAllCalloutsUC)(this.appObject);
|
|
35
|
+
}
|
|
36
|
+
setupPMs() {
|
|
37
|
+
// No PMs for this feature
|
|
38
|
+
}
|
|
39
|
+
finalSetup() {
|
|
40
|
+
new Controller_1.MouseAddCalloutMC(this.appObject);
|
|
41
|
+
new Controller_1.TouchAddCalloutTC(this.appObject);
|
|
42
|
+
new Transform3D_1.MousePanTransformMC(this.appObject);
|
|
43
|
+
new Transform3D_1.TouchPanTransformTC(this.appObject);
|
|
44
|
+
const toolRepo = Tools_1.ToolRepository.get(this.appObjects);
|
|
45
|
+
if (!toolRepo) {
|
|
46
|
+
this.appObjects.submitWarning(this.factoryName, "Unable to find tool repo");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
toolRepo.makeToolFromData({
|
|
50
|
+
toolType: "CALLOUT",
|
|
51
|
+
isDefault: false,
|
|
52
|
+
label: "Callout",
|
|
53
|
+
shortcutLabel: "c",
|
|
54
|
+
hotkeys: [{ keyCode: "KeyC" }],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.CalloutsFeatureFactory = CalloutsFeatureFactory;
|
|
59
|
+
/**
|
|
60
|
+
* Factory function to create a new CalloutsFeatureFactory
|
|
61
|
+
* @param appObjects The AppObjectRepo to get or create the Callouts AppObject from
|
|
62
|
+
* @returns A new CalloutsFeatureFactory instance
|
|
63
|
+
*/
|
|
64
|
+
function makeCalloutsFeatureFactory(appObjects) {
|
|
65
|
+
return new CalloutsFeatureFactory(appObjects.getOrCreate("Callouts"));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=CalloutsFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalloutsFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/CalloutsFeatureFactory.ts"],"names":[],"mappings":";;;AAuEA,gEAIC;AA3ED,sCAA2D;AAC3D,uCAA6C;AAC7C,mDAA6E;AAC7E,8CAAqE;AACrE,0CAAiD;AACjD,8BAKe;AACf,6DAA8D;AAE9D;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,oBAAa;IAAzD;;QACE,gBAAW,GAAG,wBAAwB,CAAC;IAyCzC,CAAC;IAvCC,aAAa;QACX,MAAM,OAAO,GAAG,IAAA,6BAAkB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnD,OAAO,CAAC,kBAAkB,GAAG,IAAA,2CAAsB,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvE,CAAC;IAED,QAAQ;QACN,IAAA,sBAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,IAAA,wBAAmB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,sBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,8BAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,8BAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,iCAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,iCAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAExC,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,SAAS;YACnB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,SAAS;YAChB,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,wDA0CC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,UAAyB;IAEzB,OAAO,IAAI,sBAAsB,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { ToolRepository } from \"../../Tools\";\r\nimport { MousePanTransformMC, TouchPanTransformTC } from \"../../Transform3D\";\r\nimport { MouseAddCalloutMC, TouchAddCalloutTC } from \"../Controller\";\r\nimport { makeCalloutGlobals } from \"../Entities\";\r\nimport {\r\n makeDeleteAllCalloutsUC,\r\n makeTryAddCalloutUC,\r\n makeTryPanLabelUC,\r\n SerializeCallouts,\r\n} from \"../UC\";\r\nimport { makeCalloutRepoFactory } from \"./calloutRepoFactory\";\r\n\r\n/**\r\n * Factory responsible for setting up the Callouts Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupCallouts function, split into\r\n * the DomainFactory phases. The CALLOUT tool is created in finalSetup, so its\r\n * place in the toolbar follows the order the factories are registered.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class CalloutsFeatureFactory extends DomainFactory {\r\n factoryName = \"CalloutsFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n const globals = makeCalloutGlobals(this.appObject);\r\n globals.calloutRepoFactory = makeCalloutRepoFactory(this.appObjects);\r\n }\r\n\r\n setupUCs(): void {\r\n makeTryPanLabelUC(this.appObject);\r\n makeTryAddCalloutUC(this.appObject);\r\n new SerializeCallouts(this.appObject);\r\n makeDeleteAllCalloutsUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n // No PMs for this feature\r\n }\r\n\r\n finalSetup(): void {\r\n new MouseAddCalloutMC(this.appObject);\r\n new TouchAddCalloutTC(this.appObject);\r\n new MousePanTransformMC(this.appObject);\r\n new TouchPanTransformTC(this.appObject);\r\n\r\n const toolRepo = ToolRepository.get(this.appObjects);\r\n if (!toolRepo) {\r\n this.appObjects.submitWarning(\r\n this.factoryName,\r\n \"Unable to find tool repo\",\r\n );\r\n return;\r\n }\r\n\r\n toolRepo.makeToolFromData({\r\n toolType: \"CALLOUT\",\r\n isDefault: false,\r\n label: \"Callout\",\r\n shortcutLabel: \"c\",\r\n hotkeys: [{ keyCode: \"KeyC\" }],\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new CalloutsFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Callouts AppObject from\r\n * @returns A new CalloutsFeatureFactory instance\r\n */\r\nexport function makeCalloutsFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): CalloutsFeatureFactory {\r\n return new CalloutsFeatureFactory(appObjects.getOrCreate(\"Callouts\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@vived/core");
|
|
4
|
+
const Hideable_1 = require("../../Hideable");
|
|
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 CalloutsFeatureFactory_1 = require("./CalloutsFeatureFactory");
|
|
11
|
+
const setupCallouts_1 = require("./setupCallouts");
|
|
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, KeyboardInput_1.makeKeyboardInputFeatureFactory)(appObjects);
|
|
21
|
+
(0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
|
|
22
|
+
(0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
|
|
23
|
+
(0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
|
|
24
|
+
}
|
|
25
|
+
function componentTypes(appObjects) {
|
|
26
|
+
const types = {};
|
|
27
|
+
appObjects.getAll().forEach((ao) => {
|
|
28
|
+
types[ao.id] = ao
|
|
29
|
+
.allComponents()
|
|
30
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
31
|
+
.map((c) => c.type)
|
|
32
|
+
.sort();
|
|
33
|
+
});
|
|
34
|
+
return types;
|
|
35
|
+
}
|
|
36
|
+
function toolTypes(appObjects) {
|
|
37
|
+
return Tools_1.ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
|
|
38
|
+
}
|
|
39
|
+
describe("CalloutsFeatureFactory", () => {
|
|
40
|
+
it("Builds the same components as setupCallouts", () => {
|
|
41
|
+
const legacy = makeTestRig();
|
|
42
|
+
registerCollaborators(legacy.appObjects);
|
|
43
|
+
(0, Tools_1.makeToolsFeatureFactory)(legacy.appObjects);
|
|
44
|
+
legacy.factories.setupDomain();
|
|
45
|
+
(0, setupCallouts_1.setupCallouts)(legacy.appObjects);
|
|
46
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
47
|
+
registerCollaborators(appObjects);
|
|
48
|
+
(0, Tools_1.makeToolsFeatureFactory)(appObjects);
|
|
49
|
+
(0, CalloutsFeatureFactory_1.makeCalloutsFeatureFactory)(appObjects);
|
|
50
|
+
factories.setupDomain();
|
|
51
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
52
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
it("Creates the CALLOUT tool in finalSetup", () => {
|
|
55
|
+
const { appObjects, factories } = makeTestRig();
|
|
56
|
+
registerCollaborators(appObjects);
|
|
57
|
+
(0, Tools_1.makeToolsFeatureFactory)(appObjects);
|
|
58
|
+
(0, CalloutsFeatureFactory_1.makeCalloutsFeatureFactory)(appObjects);
|
|
59
|
+
const all = factories.getAll();
|
|
60
|
+
all.forEach((f) => f.setupEntities());
|
|
61
|
+
all.forEach((f) => f.setupUCs());
|
|
62
|
+
all.forEach((f) => f.setupPMs());
|
|
63
|
+
expect(Tools_1.ToolRepository.get(appObjects).getTool("CALLOUT")).toBeUndefined();
|
|
64
|
+
all.forEach((f) => f.finalSetup());
|
|
65
|
+
expect(Tools_1.ToolRepository.get(appObjects).getTool("CALLOUT")).toBeDefined();
|
|
66
|
+
});
|
|
67
|
+
it("Creates tools in factory registration order", () => {
|
|
68
|
+
const first = makeTestRig();
|
|
69
|
+
registerCollaborators(first.appObjects);
|
|
70
|
+
(0, CalloutsFeatureFactory_1.makeCalloutsFeatureFactory)(first.appObjects);
|
|
71
|
+
(0, Hideable_1.makeHideableFeatureFactory)(first.appObjects);
|
|
72
|
+
(0, Tools_1.makeToolsFeatureFactory)(first.appObjects);
|
|
73
|
+
first.factories.setupDomain();
|
|
74
|
+
const second = makeTestRig();
|
|
75
|
+
registerCollaborators(second.appObjects);
|
|
76
|
+
(0, Hideable_1.makeHideableFeatureFactory)(second.appObjects);
|
|
77
|
+
(0, CalloutsFeatureFactory_1.makeCalloutsFeatureFactory)(second.appObjects);
|
|
78
|
+
(0, Tools_1.makeToolsFeatureFactory)(second.appObjects);
|
|
79
|
+
second.factories.setupDomain();
|
|
80
|
+
expect(toolTypes(first.appObjects)).toEqual(["CALLOUT", "HIDE"]);
|
|
81
|
+
expect(toolTypes(second.appObjects)).toEqual(["HIDE", "CALLOUT"]);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=CalloutsFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalloutsFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/CalloutsFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,6CAA4D;AAC5D,uDAAsE;AACtE,iDAAgE;AAChE,qDAAoE;AACpE,uCAAsE;AACtE,2DAA0E;AAC1E,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,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAyB;IACtD,IAAA,+CAA+B,EAAC,UAAU,CAAC,CAAC;IAC5C,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,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,oBAAa,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,SAAS,SAAS,CAAC,UAAyB;IAC1C,OAAO,sBAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,IAAA,+BAAuB,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,IAAA,6BAAa,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEjC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,+BAAuB,EAAC,UAAU,CAAC,CAAC;QACpC,IAAA,mDAA0B,EAAC,UAAU,CAAC,CAAC;QACvC,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,+BAAuB,EAAC,UAAU,CAAC,CAAC;QACpC,IAAA,mDAA0B,EAAC,UAAU,CAAC,CAAC;QAEvC,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;QACjC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjC,MAAM,CAAC,sBAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAE3E,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;QACnC,MAAM,CAAC,sBAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3E,CAAC,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,IAAA,mDAA0B,EAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAA,qCAA0B,EAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAA,+BAAuB,EAAC,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,IAAA,qCAA0B,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAA,mDAA0B,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAA,+BAAuB,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAE/B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeHideableFeatureFactory } from \"../../Hideable\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeToolsFeatureFactory, ToolRepository } from \"../../Tools\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { makeCalloutsFeatureFactory } from \"./CalloutsFeatureFactory\";\r\nimport { setupCallouts } from \"./setupCallouts\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeKeyboardInputFeatureFactory(appObjects);\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n makeStateMachineFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\nfunction toolTypes(appObjects: AppObjectRepo) {\r\n return ToolRepository.get(appObjects)!.allTools.map((t) => t.toolType);\r\n}\r\n\r\ndescribe(\"CalloutsFeatureFactory\", () => {\r\n it(\"Builds the same components as setupCallouts\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeToolsFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupCallouts(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeCalloutsFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Creates the CALLOUT tool in finalSetup\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeCalloutsFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n all.forEach((f) => f.setupPMs());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"CALLOUT\")).toBeUndefined();\r\n\r\n all.forEach((f) => f.finalSetup());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"CALLOUT\")).toBeDefined();\r\n });\r\n\r\n it(\"Creates tools in factory registration order\", () => {\r\n const first = makeTestRig();\r\n registerCollaborators(first.appObjects);\r\n makeCalloutsFeatureFactory(first.appObjects);\r\n makeHideableFeatureFactory(first.appObjects);\r\n makeToolsFeatureFactory(first.appObjects);\r\n first.factories.setupDomain();\r\n\r\n const second = makeTestRig();\r\n registerCollaborators(second.appObjects);\r\n makeHideableFeatureFactory(second.appObjects);\r\n makeCalloutsFeatureFactory(second.appObjects);\r\n makeToolsFeatureFactory(second.appObjects);\r\n second.factories.setupDomain();\r\n\r\n expect(toolTypes(first.appObjects)).toEqual([\"CALLOUT\", \"HIDE\"]);\r\n expect(toolTypes(second.appObjects)).toEqual([\"HIDE\", \"CALLOUT\"]);\r\n });\r\n});\r\n"]}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./calloutFactory"), exports);
|
|
18
18
|
__exportStar(require("./calloutRepoFactory"), exports);
|
|
19
19
|
__exportStar(require("./setupCallouts"), exports);
|
|
20
|
+
__exportStar(require("./CalloutsFeatureFactory"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uDAAqC;AACrC,kDAAgC","sourcesContent":["export * from \"./calloutFactory\";\nexport * from \"./calloutRepoFactory\";\nexport * from \"./setupCallouts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Callouts/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uDAAqC;AACrC,kDAAgC;AAChC,2DAAyC","sourcesContent":["export * from \"./calloutFactory\";\r\nexport * from \"./calloutRepoFactory\";\r\nexport * from \"./setupCallouts\";\r\nexport * from \"./CalloutsFeatureFactory\";\r\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelModelFeatureFactory = void 0;
|
|
4
|
+
exports.makeChannelModelFeatureFactory = makeChannelModelFeatureFactory;
|
|
5
|
+
const core_1 = require("@vived/core");
|
|
6
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
7
|
+
const Entities_1 = require("../Entities");
|
|
8
|
+
const PMs_1 = require("../PMs");
|
|
9
|
+
const UC_1 = require("../UC");
|
|
10
|
+
const channelModelFactory_1 = require("./channelModelFactory");
|
|
11
|
+
/**
|
|
12
|
+
* Factory responsible for setting up the ChannelModel Feature domain components.
|
|
13
|
+
*
|
|
14
|
+
* Builds the same components as the legacy setupChannelModels function, split
|
|
15
|
+
* into the DomainFactory phases.
|
|
16
|
+
*
|
|
17
|
+
* @extends DomainFactory
|
|
18
|
+
*/
|
|
19
|
+
class ChannelModelFeatureFactory extends core_1.DomainFactory {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.factoryName = "ChannelModelFeatureFactory";
|
|
23
|
+
}
|
|
24
|
+
setupEntities() {
|
|
25
|
+
const repo = (0, Entities_1.makeChannelModelRepo)(this.appObject);
|
|
26
|
+
repo.channelModelFactory = (0, channelModelFactory_1.makeChannelModelFactory)(this.appObjects);
|
|
27
|
+
}
|
|
28
|
+
setupUCs() {
|
|
29
|
+
(0, UC_1.makeLoadChannelModelUC)(this.appObject);
|
|
30
|
+
(0, UC_1.makeSelectChannelModelUC)(this.appObject);
|
|
31
|
+
(0, Transform3D_1.makeTryPanTransformUC)(this.appObject);
|
|
32
|
+
(0, UC_1.makeValidateChannelModel)(this.appObject);
|
|
33
|
+
}
|
|
34
|
+
setupPMs() {
|
|
35
|
+
(0, PMs_1.makeActiveModelPM)(this.appObject);
|
|
36
|
+
(0, PMs_1.makeActiveModelObjectListPM)(this.appObject);
|
|
37
|
+
}
|
|
38
|
+
finalSetup() {
|
|
39
|
+
new Transform3D_1.MousePanTransformMC(this.appObject);
|
|
40
|
+
new Transform3D_1.TouchPanTransformTC(this.appObject);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ChannelModelFeatureFactory = ChannelModelFeatureFactory;
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create a new ChannelModelFeatureFactory
|
|
46
|
+
* @param appObjects The AppObjectRepo to get or create the ChannelModels AppObject from
|
|
47
|
+
* @returns A new ChannelModelFeatureFactory instance
|
|
48
|
+
*/
|
|
49
|
+
function makeChannelModelFeatureFactory(appObjects) {
|
|
50
|
+
return new ChannelModelFeatureFactory(appObjects.getOrCreate("ChannelModels"));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ChannelModelFeatureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChannelModelFeatureFactory.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/ChannelModelFeatureFactory.ts"],"names":[],"mappings":";;;AAsDA,wEAMC;AA5DD,sCAA2D;AAC3D,mDAI2B;AAC3B,0CAAmD;AACnD,gCAAwE;AACxE,8BAIe;AACf,+DAAgE;AAEhE;;;;;;;GAOG;AACH,MAAa,0BAA2B,SAAQ,oBAAa;IAA7D;;QACE,gBAAW,GAAG,4BAA4B,CAAC;IAuB7C,CAAC;IArBC,aAAa;QACX,MAAM,IAAI,GAAG,IAAA,+BAAoB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,mBAAmB,GAAG,IAAA,6CAAuB,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtE,CAAC;IAED,QAAQ;QACN,IAAA,2BAAsB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,IAAA,6BAAwB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAA,mCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,6BAAwB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ;QACN,IAAA,uBAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,IAAA,iCAA2B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,UAAU;QACR,IAAI,iCAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,iCAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;CACF;AAxBD,gEAwBC;AAED;;;;GAIG;AACH,SAAgB,8BAA8B,CAC5C,UAAyB;IAEzB,OAAO,IAAI,0BAA0B,CACnC,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CACxC,CAAC;AACJ,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport {\r\n makeTryPanTransformUC,\r\n MousePanTransformMC,\r\n TouchPanTransformTC,\r\n} from \"../../Transform3D\";\r\nimport { makeChannelModelRepo } from \"../Entities\";\r\nimport { makeActiveModelObjectListPM, makeActiveModelPM } from \"../PMs\";\r\nimport {\r\n makeLoadChannelModelUC,\r\n makeSelectChannelModelUC,\r\n makeValidateChannelModel,\r\n} from \"../UC\";\r\nimport { makeChannelModelFactory } from \"./channelModelFactory\";\r\n\r\n/**\r\n * Factory responsible for setting up the ChannelModel Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupChannelModels function, split\r\n * into the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class ChannelModelFeatureFactory extends DomainFactory {\r\n factoryName = \"ChannelModelFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n const repo = makeChannelModelRepo(this.appObject);\r\n repo.channelModelFactory = makeChannelModelFactory(this.appObjects);\r\n }\r\n\r\n setupUCs(): void {\r\n makeLoadChannelModelUC(this.appObject);\r\n makeSelectChannelModelUC(this.appObject);\r\n makeTryPanTransformUC(this.appObject);\r\n makeValidateChannelModel(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeActiveModelPM(this.appObject);\r\n makeActiveModelObjectListPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n new MousePanTransformMC(this.appObject);\r\n new TouchPanTransformTC(this.appObject);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ChannelModelFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the ChannelModels AppObject from\r\n * @returns A new ChannelModelFeatureFactory instance\r\n */\r\nexport function makeChannelModelFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): ChannelModelFeatureFactory {\r\n return new ChannelModelFeatureFactory(\r\n appObjects.getOrCreate(\"ChannelModels\"),\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 TouchController_1 = require("../../TouchController");
|
|
6
|
+
const ChannelModelFeatureFactory_1 = require("./ChannelModelFeatureFactory");
|
|
7
|
+
const setupChannelModels_1 = require("./setupChannelModels");
|
|
8
|
+
function makeTestRig() {
|
|
9
|
+
const appObjects = (0, core_1.makeAppObjectRepo)();
|
|
10
|
+
const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
|
|
11
|
+
const mockError = jest.fn();
|
|
12
|
+
appObjects.submitError = mockError;
|
|
13
|
+
return { appObjects, factories, mockError };
|
|
14
|
+
}
|
|
15
|
+
function registerCollaborators(appObjects) {
|
|
16
|
+
(0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
|
|
17
|
+
(0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
|
|
18
|
+
}
|
|
19
|
+
function componentTypes(appObjects) {
|
|
20
|
+
const types = {};
|
|
21
|
+
appObjects.getAll().forEach((ao) => {
|
|
22
|
+
types[ao.id] = ao
|
|
23
|
+
.allComponents()
|
|
24
|
+
.filter((c) => !(c instanceof core_1.DomainFactory))
|
|
25
|
+
.map((c) => c.type)
|
|
26
|
+
.sort();
|
|
27
|
+
});
|
|
28
|
+
return types;
|
|
29
|
+
}
|
|
30
|
+
describe("ChannelModelFeatureFactory", () => {
|
|
31
|
+
it("Builds the same components as setupChannelModels", () => {
|
|
32
|
+
const legacy = makeTestRig();
|
|
33
|
+
registerCollaborators(legacy.appObjects);
|
|
34
|
+
legacy.factories.setupDomain();
|
|
35
|
+
(0, setupChannelModels_1.setupChannelModels)(legacy.appObjects);
|
|
36
|
+
const { appObjects, factories, mockError } = makeTestRig();
|
|
37
|
+
registerCollaborators(appObjects);
|
|
38
|
+
(0, ChannelModelFeatureFactory_1.makeChannelModelFeatureFactory)(appObjects);
|
|
39
|
+
factories.setupDomain();
|
|
40
|
+
expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
|
|
41
|
+
expect(mockError).not.toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=ChannelModelFeatureFactory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChannelModelFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/ChannelModelFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,iDAAgE;AAChE,2DAA0E;AAC1E,6EAA8E;AAC9E,6DAA0D;AAE1D,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;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,oBAAa,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,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,IAAA,uCAAkB,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEtC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,2DAA8B,EAAC,UAAU,CAAC,CAAC;QAC3C,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 { makeChannelModelFeatureFactory } from \"./ChannelModelFeatureFactory\";\r\nimport { setupChannelModels } from \"./setupChannelModels\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"ChannelModelFeatureFactory\", () => {\r\n it(\"Builds the same components as setupChannelModels\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupChannelModels(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeChannelModelFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n});\r\n"]}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./channelModelFactory"), exports);
|
|
18
18
|
__exportStar(require("./channelObjectFactory"), exports);
|
|
19
19
|
__exportStar(require("./setupChannelModels"), exports);
|
|
20
|
+
__exportStar(require("./ChannelModelFeatureFactory"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|