@rtsee/presentation 0.0.109 → 0.0.110
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/dist/presentation/src/models/RTSeeStory.d.ts +40 -1
- package/dist/presentation/src/models/RTSeeStory.d.ts.map +1 -1
- package/dist/presentation/src/models/RTSeeStory.js +161 -0
- package/dist/presentation/src/models/RTSeeStory.js.map +1 -1
- package/dist/presentation/src/models/editor/RTSeeIllustrator.d.ts +57 -0
- package/dist/presentation/src/models/editor/RTSeeIllustrator.d.ts.map +1 -0
- package/dist/presentation/src/models/editor/RTSeeIllustrator.js +443 -0
- package/dist/presentation/src/models/editor/RTSeeIllustrator.js.map +1 -0
- package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.d.ts +92 -0
- package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.d.ts.map +1 -0
- package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.js +494 -0
- package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.js.map +1 -0
- package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.d.ts +71 -0
- package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.d.ts.map +1 -0
- package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.js +163 -0
- package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.js.map +1 -0
- package/dist/presentation/src/models/editor/index.d.ts +4 -0
- package/dist/presentation/src/models/editor/index.d.ts.map +1 -0
- package/dist/presentation/src/models/editor/index.js +4 -0
- package/dist/presentation/src/models/editor/index.js.map +1 -0
- package/dist/presentation/src/models/index.d.ts +3 -0
- package/dist/presentation/src/models/index.d.ts.map +1 -1
- package/dist/presentation/src/models/index.js +3 -0
- package/dist/presentation/src/models/index.js.map +1 -1
- package/dist/presentation/src/models/manage/RTSeeManageStories.d.ts +3 -0
- package/dist/presentation/src/models/manage/RTSeeManageStories.d.ts.map +1 -1
- package/dist/presentation/src/models/manage/RTSeeManageStories.js +15 -0
- package/dist/presentation/src/models/manage/RTSeeManageStories.js.map +1 -1
- package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.d.ts +2 -1
- package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.d.ts.map +1 -1
- package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.js +3 -0
- package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.js.map +1 -1
- package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.d.ts +44 -0
- package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.d.ts.map +1 -0
- package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.js +70 -0
- package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.js.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.d.ts +11 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.js +12 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.js.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.d.ts +14 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.js +44 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.js.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.d.ts +11 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.js +12 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.js.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.d.ts +42 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.js +106 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.js.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.d.ts +18 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.js +60 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.js.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.d.ts +11 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.js +12 -0
- package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.js.map +1 -0
- package/dist/presentation/src/models/story-elements/index.d.ts +7 -0
- package/dist/presentation/src/models/story-elements/index.d.ts.map +1 -0
- package/dist/presentation/src/models/story-elements/index.js +7 -0
- package/dist/presentation/src/models/story-elements/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import { RTSeeSignalHandlersDriver } from "@rtsee/core";
|
|
2
|
+
import { generateManageStoryAuthorFields, generateManageStoryElementFields, generateManageStoryFields, generateSelectStoryAuthorFields, getManageStoryAuthorFieldsOptions, getManageStoryElementFieldsOptions, getManageStoryFieldsOptions, getSelectStoryAuthorFieldsOptions, ManageStoryArtifactForm, ManageStoryAuthorForm, ManageStoryCharacterForm, ManageStoryForm, ManageStoryLocationForm, SelectStoryAuthorForm, } from "@rtsee/utilities-ui";
|
|
3
|
+
import { RTSeeStory } from "../RTSeeStory";
|
|
4
|
+
import { RTSeeManageStorySlide } from "../manage/RTSeeManageStorySlide";
|
|
5
|
+
import { getPresentationRemoteActions, } from "../remote-actions/PresentationRemoteActions";
|
|
6
|
+
import { RTSeeStoryAuthor } from "../story-elements/RTSeeStoryAuthor";
|
|
7
|
+
import { RTSeeStoryElementEntity } from "../story-elements/RTSeeStoryElementEntity";
|
|
8
|
+
import { RTSeeStoryEditorSection, RTSeeStoryElementsEditor, } from "./RTSeeStoryElementsEditor";
|
|
9
|
+
const DEFAULT_SLIDES_LIMIT = 1000;
|
|
10
|
+
const AUTHORS_SUGGESTIONS_LIMIT = 20;
|
|
11
|
+
/**
|
|
12
|
+
* Business logic of the interactive story editor.
|
|
13
|
+
* Orchestrates the story domain entities (story, characters, artifacts, locations, author, slides)
|
|
14
|
+
* and their edit forms. The UI layer only renders the state & forwards the user actions.
|
|
15
|
+
*/
|
|
16
|
+
export class RTSeeInteractiveStoryEditorVm extends RTSeeSignalHandlersDriver {
|
|
17
|
+
story = null;
|
|
18
|
+
presentationRemoteActions;
|
|
19
|
+
entitiesRemoteActions;
|
|
20
|
+
collapsedSections;
|
|
21
|
+
// details
|
|
22
|
+
detailsExpanded = false;
|
|
23
|
+
detailsForm = null;
|
|
24
|
+
detailsSaveInProgress = false;
|
|
25
|
+
detailsError = null;
|
|
26
|
+
// elements
|
|
27
|
+
charactersEditor;
|
|
28
|
+
artifactsEditor;
|
|
29
|
+
locationsEditor;
|
|
30
|
+
// slides
|
|
31
|
+
slides = [];
|
|
32
|
+
totalSlides = 0;
|
|
33
|
+
activeSlide = null;
|
|
34
|
+
slidesLoadInProgress = false;
|
|
35
|
+
// author
|
|
36
|
+
authorExpanded = false;
|
|
37
|
+
authorForm = null;
|
|
38
|
+
newAuthor = null;
|
|
39
|
+
newAuthorForm = null;
|
|
40
|
+
authorSaveInProgress = false;
|
|
41
|
+
authorError = null;
|
|
42
|
+
// ui
|
|
43
|
+
initInProgress = false;
|
|
44
|
+
initError = null;
|
|
45
|
+
options;
|
|
46
|
+
authorsCache = new Map();
|
|
47
|
+
constructor(options) {
|
|
48
|
+
super(options);
|
|
49
|
+
if (!options.companionUrl || !options.peer) {
|
|
50
|
+
throw new Error("RTSeeInteractiveStoryEditorVm: companionUrl/peer is missing");
|
|
51
|
+
}
|
|
52
|
+
this.options = options;
|
|
53
|
+
this.entitiesRemoteActions = options.entitiesRemoteActions;
|
|
54
|
+
this.presentationRemoteActions = getPresentationRemoteActions(this.signalingClient);
|
|
55
|
+
this.collapsedSections = new Set(options.collapsedSections || []);
|
|
56
|
+
this.charactersEditor = new RTSeeStoryElementsEditor({
|
|
57
|
+
section: RTSeeStoryEditorSection.characters,
|
|
58
|
+
label: "Character",
|
|
59
|
+
getItems: () => this.story?.characters || [],
|
|
60
|
+
createEntity: (data) => this.requireStory().createCharacter(data),
|
|
61
|
+
getBlankData: () => RTSeeStoryElementEntity.getBlankData(this.applicationId),
|
|
62
|
+
createForm: (data, onSubmit) => new ManageStoryCharacterForm({
|
|
63
|
+
name: "Manage Character",
|
|
64
|
+
...generateManageStoryElementFields(getManageStoryElementFieldsOptions(data, this.companionUrl, this.getTags.bind(this), this.peer)),
|
|
65
|
+
onSubmit,
|
|
66
|
+
}),
|
|
67
|
+
attach: (entity) => this.requireStory().addCharacter(entity),
|
|
68
|
+
detach: (id) => this.requireStory().removeCharacter(id),
|
|
69
|
+
getStoryId: () => this.story?.id || "",
|
|
70
|
+
saveStory: () => this.saveStoryLinks(),
|
|
71
|
+
});
|
|
72
|
+
this.artifactsEditor = new RTSeeStoryElementsEditor({
|
|
73
|
+
section: RTSeeStoryEditorSection.artifacts,
|
|
74
|
+
label: "Artifact",
|
|
75
|
+
getItems: () => this.story?.artifacts || [],
|
|
76
|
+
createEntity: (data) => this.requireStory().createArtifact(data),
|
|
77
|
+
getBlankData: () => RTSeeStoryElementEntity.getBlankData(this.applicationId),
|
|
78
|
+
createForm: (data, onSubmit) => new ManageStoryArtifactForm({
|
|
79
|
+
name: "Manage Artifact",
|
|
80
|
+
...generateManageStoryElementFields(getManageStoryElementFieldsOptions(data, this.companionUrl, this.getTags.bind(this), this.peer)),
|
|
81
|
+
onSubmit,
|
|
82
|
+
}),
|
|
83
|
+
attach: (entity) => this.requireStory().addArtifact(entity),
|
|
84
|
+
detach: (id) => this.requireStory().removeArtifact(id),
|
|
85
|
+
getStoryId: () => this.story?.id || "",
|
|
86
|
+
saveStory: () => this.saveStoryLinks(),
|
|
87
|
+
});
|
|
88
|
+
this.locationsEditor = new RTSeeStoryElementsEditor({
|
|
89
|
+
section: RTSeeStoryEditorSection.locations,
|
|
90
|
+
label: "Location",
|
|
91
|
+
getItems: () => this.story?.locations || [],
|
|
92
|
+
createEntity: (data) => this.requireStory().createLocation(data),
|
|
93
|
+
getBlankData: () => RTSeeStoryElementEntity.getBlankData(this.applicationId),
|
|
94
|
+
createForm: (data, onSubmit) => new ManageStoryLocationForm({
|
|
95
|
+
name: "Manage Location",
|
|
96
|
+
...generateManageStoryElementFields(getManageStoryElementFieldsOptions(data, this.companionUrl, this.getTags.bind(this), this.peer)),
|
|
97
|
+
onSubmit,
|
|
98
|
+
}),
|
|
99
|
+
attach: (entity) => this.requireStory().addLocation(entity),
|
|
100
|
+
detach: (id) => this.requireStory().removeLocation(id),
|
|
101
|
+
getStoryId: () => this.story?.id || "",
|
|
102
|
+
saveStory: () => this.saveStoryLinks(),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
get companionUrlValue() {
|
|
106
|
+
return this.companionUrl || "";
|
|
107
|
+
}
|
|
108
|
+
get isNewStory() {
|
|
109
|
+
return !this.story || !this.story.id;
|
|
110
|
+
}
|
|
111
|
+
// ---- lifecycle ----
|
|
112
|
+
async init() {
|
|
113
|
+
this.initInProgress = true;
|
|
114
|
+
this.initError = null;
|
|
115
|
+
try {
|
|
116
|
+
const storyData = await this.resolveStoryData();
|
|
117
|
+
this.story = new RTSeeStory({
|
|
118
|
+
...this.getHandlerCommonOptions(),
|
|
119
|
+
applicationId: storyData.applicationId || this.applicationId,
|
|
120
|
+
storyData,
|
|
121
|
+
entitiesRemoteActions: this.entitiesRemoteActions,
|
|
122
|
+
getRemoteSlides: (query) => this.presentationRemoteActions.getSlides.send(query),
|
|
123
|
+
});
|
|
124
|
+
if (this.isNewStory) {
|
|
125
|
+
this.expandDetails();
|
|
126
|
+
}
|
|
127
|
+
await Promise.all([this.loadSlides(), this.loadAuthor()]);
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
this.initError = this.getErrorMessage(e);
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
this.initInProgress = false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// ---- sections ----
|
|
137
|
+
isCollapsed(section) {
|
|
138
|
+
return this.collapsedSections.has(section);
|
|
139
|
+
}
|
|
140
|
+
toggleSection(section, collapsed) {
|
|
141
|
+
const shouldCollapse = collapsed !== undefined ? collapsed : !this.isCollapsed(section);
|
|
142
|
+
if (shouldCollapse) {
|
|
143
|
+
this.collapsedSections.add(section);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this.collapsedSections.delete(section);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// ---- details ----
|
|
150
|
+
expandDetails() {
|
|
151
|
+
const story = this.requireStory();
|
|
152
|
+
this.detailsError = null;
|
|
153
|
+
this.detailsExpanded = true;
|
|
154
|
+
const storyData = story.toJson();
|
|
155
|
+
this.detailsForm = new ManageStoryForm({
|
|
156
|
+
name: "Manage Story",
|
|
157
|
+
...generateManageStoryFields(getManageStoryFieldsOptions(storyData, this.companionUrlValue, this.getStoryCategories.bind(this), this.getTags.bind(this), this.peer)),
|
|
158
|
+
onSubmit: (model) => {
|
|
159
|
+
void this.saveDetails(model);
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
collapseDetails() {
|
|
164
|
+
this.detailsExpanded = false;
|
|
165
|
+
this.detailsForm = null;
|
|
166
|
+
this.detailsError = null;
|
|
167
|
+
}
|
|
168
|
+
toggleDetails() {
|
|
169
|
+
if (this.detailsExpanded) {
|
|
170
|
+
this.collapseDetails();
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this.expandDetails();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async saveDetails(model) {
|
|
177
|
+
if (this.detailsSaveInProgress) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (this.detailsForm && !this.detailsForm.isValid) {
|
|
181
|
+
this.detailsError = "Please fix the highlighted fields";
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.detailsSaveInProgress = true;
|
|
185
|
+
this.detailsError = null;
|
|
186
|
+
try {
|
|
187
|
+
// only take the fields edited by the form, element links are kept by the story
|
|
188
|
+
await this.requireStory().save({
|
|
189
|
+
name: model.name,
|
|
190
|
+
description: model.description,
|
|
191
|
+
imageUrl: model.imageUrl,
|
|
192
|
+
tagIds: model.tagIds,
|
|
193
|
+
categoriesIds: model.categoriesIds,
|
|
194
|
+
averageReadTime: model.averageReadTime,
|
|
195
|
+
recommendedAge: model.recommendedAge,
|
|
196
|
+
friendlyUrl: model.friendlyUrl,
|
|
197
|
+
isPublished: model.isPublished,
|
|
198
|
+
});
|
|
199
|
+
this.collapseDetails();
|
|
200
|
+
this.emit("story-saved", this.story);
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
this.detailsError = this.getErrorMessage(e);
|
|
204
|
+
}
|
|
205
|
+
finally {
|
|
206
|
+
this.detailsSaveInProgress = false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// ---- slides ----
|
|
210
|
+
async loadSlides() {
|
|
211
|
+
if (this.isNewStory) {
|
|
212
|
+
this.slides = [];
|
|
213
|
+
this.totalSlides = 0;
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this.slidesLoadInProgress = true;
|
|
217
|
+
try {
|
|
218
|
+
const response = await this.presentationRemoteActions.getSlides.send({
|
|
219
|
+
storyId: this.requireStory().id,
|
|
220
|
+
slideNumber: 0,
|
|
221
|
+
direction: "front",
|
|
222
|
+
limit: this.options.slidesLimit || DEFAULT_SLIDES_LIMIT,
|
|
223
|
+
populate: true,
|
|
224
|
+
});
|
|
225
|
+
this.slides = [...response.slides].sort((a, b) => a.slideNumber - b.slideNumber);
|
|
226
|
+
this.totalSlides = response.total;
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
console.error("RTSeeInteractiveStoryEditorVm: failed to load slides", e);
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
this.slidesLoadInProgress = false;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
isSlideExpanded(slide) {
|
|
236
|
+
return !!this.activeSlide && !!slide.id && this.activeSlide.slide.id === slide.id;
|
|
237
|
+
}
|
|
238
|
+
expandSlide(slide) {
|
|
239
|
+
if (this.isSlideExpanded(slide)) {
|
|
240
|
+
this.collapseSlide();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.openSlide({ ...slide });
|
|
244
|
+
}
|
|
245
|
+
expandNewSlide() {
|
|
246
|
+
if (this.isNewStory) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
this.openSlide({
|
|
250
|
+
id: "",
|
|
251
|
+
applicationId: this.applicationId,
|
|
252
|
+
configurationId: "",
|
|
253
|
+
name: "",
|
|
254
|
+
tagIds: [],
|
|
255
|
+
tags: [],
|
|
256
|
+
storyId: this.requireStory().id,
|
|
257
|
+
text: "",
|
|
258
|
+
slideNumber: this.slides.length + 1,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
collapseSlide() {
|
|
262
|
+
this.activeSlide?.removeAllListeners();
|
|
263
|
+
this.activeSlide = null;
|
|
264
|
+
}
|
|
265
|
+
// ---- author ----
|
|
266
|
+
get author() {
|
|
267
|
+
return this.story?.author || null;
|
|
268
|
+
}
|
|
269
|
+
toggleAuthor() {
|
|
270
|
+
if (this.authorExpanded) {
|
|
271
|
+
this.collapseAuthor();
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this.expandAuthor();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
expandAuthor() {
|
|
278
|
+
this.authorExpanded = true;
|
|
279
|
+
this.authorError = null;
|
|
280
|
+
this.authorForm = new SelectStoryAuthorForm({
|
|
281
|
+
name: "Story Author",
|
|
282
|
+
...generateSelectStoryAuthorFields(getSelectStoryAuthorFieldsOptions(this.story?.storyAuthorId, this.getAuthorsSuggestions.bind(this))),
|
|
283
|
+
onSubmit: (model) => {
|
|
284
|
+
void this.assignAuthor(model.storyAuthorId);
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
collapseAuthor() {
|
|
289
|
+
this.authorExpanded = false;
|
|
290
|
+
this.authorForm = null;
|
|
291
|
+
this.cancelNewAuthor();
|
|
292
|
+
this.authorError = null;
|
|
293
|
+
}
|
|
294
|
+
/** Assigns an existing author to the story (null clears the author) */
|
|
295
|
+
async assignAuthor(storyAuthorId) {
|
|
296
|
+
if (this.authorSaveInProgress) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const story = this.requireStory();
|
|
300
|
+
const previous = story.author;
|
|
301
|
+
this.authorSaveInProgress = true;
|
|
302
|
+
this.authorError = null;
|
|
303
|
+
try {
|
|
304
|
+
const author = storyAuthorId
|
|
305
|
+
? story.createAuthor(await this.getAuthorData(storyAuthorId))
|
|
306
|
+
: null;
|
|
307
|
+
story.setAuthor(author);
|
|
308
|
+
await this.saveStoryLinks();
|
|
309
|
+
this.collapseAuthor();
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
story.setAuthor(previous);
|
|
313
|
+
this.authorError = this.getErrorMessage(e);
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
this.authorSaveInProgress = false;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/** Opens the form to create a brand new author */
|
|
320
|
+
startNewAuthor() {
|
|
321
|
+
const story = this.requireStory();
|
|
322
|
+
this.newAuthor = story.createAuthor(RTSeeStoryAuthor.getBlankData(this.applicationId));
|
|
323
|
+
this.newAuthorForm = new ManageStoryAuthorForm({
|
|
324
|
+
name: "New Author",
|
|
325
|
+
...generateManageStoryAuthorFields(getManageStoryAuthorFieldsOptions(this.newAuthor.toJson(), this.companionUrlValue, this.getTags.bind(this), this.peer)),
|
|
326
|
+
onSubmit: (model) => {
|
|
327
|
+
void this.saveNewAuthor(model);
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
cancelNewAuthor() {
|
|
332
|
+
this.newAuthor = null;
|
|
333
|
+
this.newAuthorForm = null;
|
|
334
|
+
}
|
|
335
|
+
async saveNewAuthor(model) {
|
|
336
|
+
const author = this.newAuthor;
|
|
337
|
+
if (!author || this.authorSaveInProgress) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (this.newAuthorForm && !this.newAuthorForm.isValid) {
|
|
341
|
+
this.authorError = "Please fix the highlighted fields";
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
this.authorSaveInProgress = true;
|
|
345
|
+
this.authorError = null;
|
|
346
|
+
try {
|
|
347
|
+
const saved = await author.save({ ...model, id: "" });
|
|
348
|
+
this.authorsCache.set(saved.id, saved);
|
|
349
|
+
this.requireStory().setAuthor(author);
|
|
350
|
+
await this.saveStoryLinks();
|
|
351
|
+
this.collapseAuthor();
|
|
352
|
+
}
|
|
353
|
+
catch (e) {
|
|
354
|
+
this.authorError = author.lastError || this.getErrorMessage(e);
|
|
355
|
+
}
|
|
356
|
+
finally {
|
|
357
|
+
this.authorSaveInProgress = false;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// ---- suggestions ----
|
|
361
|
+
async getAuthorsSuggestions(query) {
|
|
362
|
+
try {
|
|
363
|
+
const response = await this.presentationRemoteActions.getAuthors.send({
|
|
364
|
+
query: query || undefined,
|
|
365
|
+
limit: AUTHORS_SUGGESTIONS_LIMIT,
|
|
366
|
+
});
|
|
367
|
+
response.authors.forEach((a) => this.authorsCache.set(a.id, a));
|
|
368
|
+
return response.authors;
|
|
369
|
+
}
|
|
370
|
+
catch (e) {
|
|
371
|
+
console.error(e);
|
|
372
|
+
return [];
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async getStoryCategories(_query) {
|
|
376
|
+
try {
|
|
377
|
+
const result = await this.presentationRemoteActions.getCategories.send({ populate: false });
|
|
378
|
+
return result.categories;
|
|
379
|
+
}
|
|
380
|
+
catch (e) {
|
|
381
|
+
console.error(e);
|
|
382
|
+
return [];
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
async getTags(_query) {
|
|
386
|
+
try {
|
|
387
|
+
const result = await this.entitiesRemoteActions.getTags.send({
|
|
388
|
+
applicationId: this.applicationId,
|
|
389
|
+
flat: true,
|
|
390
|
+
});
|
|
391
|
+
return result.tags;
|
|
392
|
+
}
|
|
393
|
+
catch (e) {
|
|
394
|
+
console.error(e);
|
|
395
|
+
return [];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
destroy() {
|
|
399
|
+
this.collapseSlide();
|
|
400
|
+
this.removeAllListeners();
|
|
401
|
+
}
|
|
402
|
+
// ---- private ----
|
|
403
|
+
async resolveStoryData() {
|
|
404
|
+
if (this.options.story && this.options.story.id) {
|
|
405
|
+
// always reload: the provided story may not have the populated elements
|
|
406
|
+
return await this.presentationRemoteActions.getStory.send(this.options.story.id);
|
|
407
|
+
}
|
|
408
|
+
if (this.options.storyId) {
|
|
409
|
+
return await this.presentationRemoteActions.getStory.send(this.options.storyId);
|
|
410
|
+
}
|
|
411
|
+
return this.options.story || this.getBlankStoryData();
|
|
412
|
+
}
|
|
413
|
+
getBlankStoryData() {
|
|
414
|
+
return {
|
|
415
|
+
id: "",
|
|
416
|
+
applicationId: this.applicationId,
|
|
417
|
+
configurationId: "",
|
|
418
|
+
name: "",
|
|
419
|
+
description: "",
|
|
420
|
+
totalSlides: 0,
|
|
421
|
+
categories: [],
|
|
422
|
+
categoriesIds: [],
|
|
423
|
+
tagIds: [],
|
|
424
|
+
tags: [],
|
|
425
|
+
characters: [],
|
|
426
|
+
artifacts: [],
|
|
427
|
+
locations: [],
|
|
428
|
+
storyAuthorId: null,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
async loadAuthor() {
|
|
432
|
+
const story = this.requireStory();
|
|
433
|
+
if (story.author || !story.storyAuthorId) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
story.setAuthor(story.createAuthor(await this.getAuthorData(story.storyAuthorId)));
|
|
438
|
+
}
|
|
439
|
+
catch (e) {
|
|
440
|
+
console.error("RTSeeInteractiveStoryEditorVm: failed to load the author", e);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
async getAuthorData(authorId) {
|
|
444
|
+
const cached = this.authorsCache.get(authorId);
|
|
445
|
+
if (cached) {
|
|
446
|
+
return cached;
|
|
447
|
+
}
|
|
448
|
+
const author = await this.presentationRemoteActions.getAuthor.send(authorId);
|
|
449
|
+
this.authorsCache.set(author.id, author);
|
|
450
|
+
return author;
|
|
451
|
+
}
|
|
452
|
+
/** Persists the story with its current links (elements ids & author id) */
|
|
453
|
+
async saveStoryLinks() {
|
|
454
|
+
const story = this.requireStory();
|
|
455
|
+
if (!story.id && !story.name) {
|
|
456
|
+
// a new story cannot be saved without details, links are persisted with the details
|
|
457
|
+
this.expandDetails();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
await story.save();
|
|
461
|
+
this.emit("story-saved", story);
|
|
462
|
+
}
|
|
463
|
+
openSlide(slide) {
|
|
464
|
+
this.collapseSlide();
|
|
465
|
+
const manageSlide = new RTSeeManageStorySlide({
|
|
466
|
+
slide,
|
|
467
|
+
companionUrl: this.companionUrlValue,
|
|
468
|
+
peer: this.peer,
|
|
469
|
+
signalingClient: this.signalingClient,
|
|
470
|
+
entitiesRemoteActions: this.entitiesRemoteActions,
|
|
471
|
+
});
|
|
472
|
+
manageSlide.on("cancel-clicked", () => this.collapseSlide());
|
|
473
|
+
manageSlide.on("created", () => {
|
|
474
|
+
this.collapseSlide();
|
|
475
|
+
void this.loadSlides();
|
|
476
|
+
});
|
|
477
|
+
manageSlide.on("updated", () => {
|
|
478
|
+
this.collapseSlide();
|
|
479
|
+
void this.loadSlides();
|
|
480
|
+
});
|
|
481
|
+
this.activeSlide = manageSlide;
|
|
482
|
+
}
|
|
483
|
+
requireStory() {
|
|
484
|
+
if (!this.story) {
|
|
485
|
+
throw new Error("RTSeeInteractiveStoryEditorVm: call init() first");
|
|
486
|
+
}
|
|
487
|
+
return this.story;
|
|
488
|
+
}
|
|
489
|
+
getErrorMessage(e) {
|
|
490
|
+
const error = e;
|
|
491
|
+
return error?.friendlyMessage || error?.message || `${e}`;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
//# sourceMappingURL=RTSeeInteractiveStoryEditorVm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeInteractiveStoryEditorVm.js","sourceRoot":"","sources":["../../../../../src/models/editor/RTSeeInteractiveStoryEditorVm.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA8B,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EACL,+BAA+B,EAC/B,gCAAgC,EAChC,yBAAyB,EACzB,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EAClC,2BAA2B,EAC3B,iCAAiC,EAEjC,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EAEvB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,4BAA4B,GAE7B,MAAM,6CAA6C,CAAC;AAIrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,oBAAoB,GAAW,IAAI,CAAC;AAC1C,MAAM,yBAAyB,GAAW,EAAE,CAAC;A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AW,GAA0B,IAAI,qBAAqB,CAAC;YACnE,KAAK;YACL,YAAY,EAAE,IAAI,CAAC,iBAAiB;YACpC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;SAClD,CAAC,CAAC;QAEH,WAAW,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAC7D,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC7B,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC7B,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEO,eAAe,CAAC,CAAU;QAChC,MAAM,KAAK,GAAG,CAAmD,CAAC;QAClE,OAAO,KAAK,EAAE,eAAe,IAAI,KAAK,EAAE,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IRTSeeStoryElement } from "@rtsee/common";
|
|
2
|
+
import { RTSeeForm } from "@rtsee/utilities-ui";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
import { RTSeeStoryElementEntity } from "../story-elements/RTSeeStoryElementEntity";
|
|
5
|
+
export declare enum RTSeeStoryEditorSection {
|
|
6
|
+
details = "details",
|
|
7
|
+
characters = "characters",
|
|
8
|
+
artifacts = "artifacts",
|
|
9
|
+
locations = "locations",
|
|
10
|
+
slides = "slides",
|
|
11
|
+
author = "author"
|
|
12
|
+
}
|
|
13
|
+
export interface IRTSeeStoryElementsEditorOptions<TData extends IRTSeeStoryElement, TEntity extends RTSeeStoryElementEntity<TData>> {
|
|
14
|
+
section: RTSeeStoryEditorSection;
|
|
15
|
+
/** human readable (singular) name of the element, e.g. "Character" */
|
|
16
|
+
label: string;
|
|
17
|
+
/** current story elements (story is the source of truth) */
|
|
18
|
+
getItems: () => TEntity[];
|
|
19
|
+
/** builds a domain entity from data */
|
|
20
|
+
createEntity: (data: TData) => TEntity;
|
|
21
|
+
/** data of a new (blank) element */
|
|
22
|
+
getBlankData: () => TData;
|
|
23
|
+
/** builds the edit form of an element */
|
|
24
|
+
createForm: (data: TData, onSubmit: (model: TData) => void) => RTSeeForm<TData>;
|
|
25
|
+
/** links the element to the story (local) */
|
|
26
|
+
attach: (entity: TEntity) => void;
|
|
27
|
+
/** unlinks the element from the story (local) */
|
|
28
|
+
detach: (id: string) => void;
|
|
29
|
+
/** id of the story (empty for a story that was not saved yet) */
|
|
30
|
+
getStoryId: () => string;
|
|
31
|
+
/** persists the story links (characters / artifacts / locations ids) */
|
|
32
|
+
saveStory: () => Promise<unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Orchestrates the thumbnails list and the (single) expanded edit form of one kind of
|
|
36
|
+
* story element (characters, artifacts or locations).
|
|
37
|
+
*/
|
|
38
|
+
export declare class RTSeeStoryElementsEditor<TData extends IRTSeeStoryElement, TEntity extends RTSeeStoryElementEntity<TData>> extends EventEmitter {
|
|
39
|
+
readonly section: RTSeeStoryEditorSection;
|
|
40
|
+
readonly label: string;
|
|
41
|
+
expanded: TEntity | null;
|
|
42
|
+
form: RTSeeForm<TData> | null;
|
|
43
|
+
saveInProgress: boolean;
|
|
44
|
+
removeInProgress: boolean;
|
|
45
|
+
error: string | null;
|
|
46
|
+
private readonly options;
|
|
47
|
+
constructor(options: IRTSeeStoryElementsEditorOptions<TData, TEntity>);
|
|
48
|
+
get items(): TEntity[];
|
|
49
|
+
get isCreating(): boolean;
|
|
50
|
+
get busy(): boolean;
|
|
51
|
+
isExpanded(entity: TEntity): boolean;
|
|
52
|
+
/** Expands the edit form of an existing element */
|
|
53
|
+
expand(entity: TEntity): void;
|
|
54
|
+
/** Expands the edit form of a new (blank) element */
|
|
55
|
+
expandNew(): void;
|
|
56
|
+
collapse(): void;
|
|
57
|
+
/** Submits the expanded form */
|
|
58
|
+
submit(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Creates / updates the expanded element.
|
|
61
|
+
* A new element is attached to the story (server side when the story already exists).
|
|
62
|
+
*/
|
|
63
|
+
save(model: TData): Promise<void>;
|
|
64
|
+
/** Removes the element from the story only (the element is kept for other stories) */
|
|
65
|
+
detach(entity: TEntity): Promise<void>;
|
|
66
|
+
/** Deletes the element permanently (from all the stories) */
|
|
67
|
+
delete(entity: TEntity): Promise<void>;
|
|
68
|
+
private open;
|
|
69
|
+
private getErrorMessage;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=RTSeeStoryElementsEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeStoryElementsEditor.d.ts","sourceRoot":"","sources":["../../../../../src/models/editor/RTSeeStoryElementsEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEpF,oBAAY,uBAAuB;IACjC,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB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