@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.
Files changed (65) hide show
  1. package/dist/presentation/src/models/RTSeeStory.d.ts +40 -1
  2. package/dist/presentation/src/models/RTSeeStory.d.ts.map +1 -1
  3. package/dist/presentation/src/models/RTSeeStory.js +161 -0
  4. package/dist/presentation/src/models/RTSeeStory.js.map +1 -1
  5. package/dist/presentation/src/models/editor/RTSeeIllustrator.d.ts +57 -0
  6. package/dist/presentation/src/models/editor/RTSeeIllustrator.d.ts.map +1 -0
  7. package/dist/presentation/src/models/editor/RTSeeIllustrator.js +443 -0
  8. package/dist/presentation/src/models/editor/RTSeeIllustrator.js.map +1 -0
  9. package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.d.ts +92 -0
  10. package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.d.ts.map +1 -0
  11. package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.js +494 -0
  12. package/dist/presentation/src/models/editor/RTSeeInteractiveStoryEditorVm.js.map +1 -0
  13. package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.d.ts +71 -0
  14. package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.d.ts.map +1 -0
  15. package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.js +163 -0
  16. package/dist/presentation/src/models/editor/RTSeeStoryElementsEditor.js.map +1 -0
  17. package/dist/presentation/src/models/editor/index.d.ts +4 -0
  18. package/dist/presentation/src/models/editor/index.d.ts.map +1 -0
  19. package/dist/presentation/src/models/editor/index.js +4 -0
  20. package/dist/presentation/src/models/editor/index.js.map +1 -0
  21. package/dist/presentation/src/models/index.d.ts +3 -0
  22. package/dist/presentation/src/models/index.d.ts.map +1 -1
  23. package/dist/presentation/src/models/index.js +3 -0
  24. package/dist/presentation/src/models/index.js.map +1 -1
  25. package/dist/presentation/src/models/manage/RTSeeManageStories.d.ts +3 -0
  26. package/dist/presentation/src/models/manage/RTSeeManageStories.d.ts.map +1 -1
  27. package/dist/presentation/src/models/manage/RTSeeManageStories.js +15 -0
  28. package/dist/presentation/src/models/manage/RTSeeManageStories.js.map +1 -1
  29. package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.d.ts +2 -1
  30. package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.d.ts.map +1 -1
  31. package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.js +3 -0
  32. package/dist/presentation/src/models/remote-actions/PresentationRemoteActions.js.map +1 -1
  33. package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.d.ts +44 -0
  34. package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.d.ts.map +1 -0
  35. package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.js +70 -0
  36. package/dist/presentation/src/models/remote-actions/StoryElementsRemoteActions.js.map +1 -0
  37. package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.d.ts +11 -0
  38. package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.d.ts.map +1 -0
  39. package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.js +12 -0
  40. package/dist/presentation/src/models/story-elements/RTSeeStoryArtifact.js.map +1 -0
  41. package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.d.ts +14 -0
  42. package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.d.ts.map +1 -0
  43. package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.js +44 -0
  44. package/dist/presentation/src/models/story-elements/RTSeeStoryAuthor.js.map +1 -0
  45. package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.d.ts +11 -0
  46. package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.d.ts.map +1 -0
  47. package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.js +12 -0
  48. package/dist/presentation/src/models/story-elements/RTSeeStoryCharacter.js.map +1 -0
  49. package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.d.ts +42 -0
  50. package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.d.ts.map +1 -0
  51. package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.js +106 -0
  52. package/dist/presentation/src/models/story-elements/RTSeeStoryCrudEntity.js.map +1 -0
  53. package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.d.ts +18 -0
  54. package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.d.ts.map +1 -0
  55. package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.js +60 -0
  56. package/dist/presentation/src/models/story-elements/RTSeeStoryElementEntity.js.map +1 -0
  57. package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.d.ts +11 -0
  58. package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.d.ts.map +1 -0
  59. package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.js +12 -0
  60. package/dist/presentation/src/models/story-elements/RTSeeStoryLocation.js.map +1 -0
  61. package/dist/presentation/src/models/story-elements/index.d.ts +7 -0
  62. package/dist/presentation/src/models/story-elements/index.d.ts.map +1 -0
  63. package/dist/presentation/src/models/story-elements/index.js +7 -0
  64. package/dist/presentation/src/models/story-elements/index.js.map +1 -0
  65. package/package.json +2 -2
@@ -0,0 +1,443 @@
1
+ import { EventEmitter } from 'events';
2
+ import { RTSeeIllustratorEvents, } from '@rtsee/common';
3
+ import { RTSeeCore } from '@rtsee/core';
4
+ async function optimizeImageDataUrl(url, maxDimension = 1024, quality = 0.85) {
5
+ if (!url || !url.startsWith('data:image/') || typeof window === 'undefined') {
6
+ return url;
7
+ }
8
+ // Don't touch small images
9
+ if (url.length < 200000) {
10
+ return url;
11
+ }
12
+ return new Promise((resolve) => {
13
+ try {
14
+ const img = new Image();
15
+ img.onload = () => {
16
+ let width = img.naturalWidth || img.width;
17
+ let height = img.naturalHeight || img.height;
18
+ if (!width || !height) {
19
+ resolve(url);
20
+ return;
21
+ }
22
+ if (width > maxDimension || height > maxDimension) {
23
+ if (width > height) {
24
+ height = Math.round((height * maxDimension) / width);
25
+ width = maxDimension;
26
+ }
27
+ else {
28
+ width = Math.round((width * maxDimension) / height);
29
+ height = maxDimension;
30
+ }
31
+ }
32
+ const canvas = document.createElement('canvas');
33
+ canvas.width = width;
34
+ canvas.height = height;
35
+ const ctx = canvas.getContext('2d');
36
+ if (!ctx) {
37
+ resolve(url);
38
+ return;
39
+ }
40
+ ctx.drawImage(img, 0, 0, width, height);
41
+ const compressed = canvas.toDataURL('image/jpeg', quality);
42
+ resolve(compressed);
43
+ };
44
+ img.onerror = () => resolve(url);
45
+ img.src = url;
46
+ }
47
+ catch {
48
+ resolve(url);
49
+ }
50
+ });
51
+ }
52
+ export class RTSeeIllustrator extends EventEmitter {
53
+ prompt = '';
54
+ expanded = false;
55
+ configExpanded = false;
56
+ submitting = false;
57
+ lastGeneratedImageUrl = null;
58
+ reviewingGeneratedImage = false;
59
+ currentGeneratedImageUrl = null;
60
+ iterationPrompt = '';
61
+ generationError = null;
62
+ iterationHistory = [];
63
+ activeChatId = null;
64
+ activeAgentId = null;
65
+ agents = [];
66
+ config = {
67
+ aspectRatio: '1:1',
68
+ style: 'Classic Fairy Tale pixel-art Storybook',
69
+ mood: 'Dreamy & Magical',
70
+ lighting: 'Soft Diffused Storybook Glow',
71
+ negativePrompt: 'modern elements, cars, text, watermark, signature, blurry, low quality, photorealistic plastic, distorted faces, mutated anatomy',
72
+ numberOfImages: 1,
73
+ };
74
+ contextImages = [];
75
+ isBrowser = typeof window !== 'undefined';
76
+ onAgentsResponseBound;
77
+ onAddImageBound;
78
+ onGenStartedBound;
79
+ onGenCompletedBound;
80
+ onGetCurrentImageBound;
81
+ onSetPromptBound;
82
+ constructor() {
83
+ super();
84
+ this.init();
85
+ }
86
+ init() {
87
+ if (!this.isBrowser)
88
+ return;
89
+ this.onAgentsResponseBound = (e) => {
90
+ const customEvent = e;
91
+ if (customEvent.detail) {
92
+ this.handleAgentsResponse(customEvent.detail);
93
+ }
94
+ };
95
+ this.onAddImageBound = (e) => {
96
+ const customEvent = e;
97
+ if (customEvent.detail) {
98
+ this.addImageToContext(customEvent.detail);
99
+ }
100
+ };
101
+ this.onGenStartedBound = () => {
102
+ this.submitting = true;
103
+ this.generationError = null;
104
+ this.emit('changed');
105
+ };
106
+ this.onGenCompletedBound = (e) => {
107
+ this.submitting = false;
108
+ const customEvent = e;
109
+ const detail = customEvent.detail;
110
+ if (detail?.imageUrl) {
111
+ this.currentGeneratedImageUrl = detail.imageUrl;
112
+ this.lastGeneratedImageUrl = detail.imageUrl;
113
+ this.iterationHistory.push(detail.imageUrl);
114
+ this.reviewingGeneratedImage = true;
115
+ this.generationError = null;
116
+ this.expanded = true;
117
+ }
118
+ else {
119
+ this.generationError = detail?.error || 'No image returned by model. Please try again.';
120
+ }
121
+ this.emit('changed');
122
+ };
123
+ this.onGetCurrentImageBound = (e) => {
124
+ const customEvent = e;
125
+ const detail = customEvent.detail;
126
+ if (this.reviewingGeneratedImage && this.currentGeneratedImageUrl) {
127
+ // 1. If RTSeeIllustrator is in reviewingGeneratedImage mode, the currently reviewed image should be applied
128
+ const response = {
129
+ isLoaded: true,
130
+ isActive: true,
131
+ reviewingGeneratedImage: true,
132
+ imageUrl: this.currentGeneratedImageUrl,
133
+ requestId: detail?.requestId,
134
+ };
135
+ if (detail?.callback) {
136
+ detail.callback(response);
137
+ }
138
+ else if (this.isBrowser) {
139
+ window.dispatchEvent(new CustomEvent(RTSeeIllustratorEvents.CURRENT_IMAGE_RESPONSE, {
140
+ detail: response,
141
+ }));
142
+ }
143
+ }
144
+ else {
145
+ // 2. If RTSeeIllustrator is not active, it should expand and scroll it into view.
146
+ this.expanded = true;
147
+ this.emit('changed');
148
+ this.emit('scroll-into-view');
149
+ if (this.isBrowser) {
150
+ setTimeout(() => {
151
+ const el = document.querySelector('rtsee-illustrator') ||
152
+ document.querySelector('.rtsee-illustrator-container') ||
153
+ document.querySelector('.rtsee-illustrator');
154
+ if (el) {
155
+ el.scrollIntoView({ behavior: 'smooth', block: 'center' });
156
+ }
157
+ }, 60);
158
+ const response = {
159
+ isLoaded: true,
160
+ isActive: false,
161
+ reviewingGeneratedImage: false,
162
+ imageUrl: null,
163
+ requestId: detail?.requestId,
164
+ };
165
+ if (detail?.callback) {
166
+ detail.callback(response);
167
+ }
168
+ else {
169
+ window.dispatchEvent(new CustomEvent(RTSeeIllustratorEvents.CURRENT_IMAGE_RESPONSE, {
170
+ detail: response,
171
+ }));
172
+ }
173
+ }
174
+ }
175
+ };
176
+ this.onSetPromptBound = (e) => {
177
+ const customEvent = e;
178
+ const prompt = typeof customEvent?.detail === 'string'
179
+ ? customEvent.detail
180
+ : customEvent?.detail?.prompt;
181
+ if (typeof prompt === 'string') {
182
+ this.setPrompt(prompt);
183
+ }
184
+ };
185
+ window.addEventListener(RTSeeIllustratorEvents.AGENTS_RESPONSE, this.onAgentsResponseBound);
186
+ window.addEventListener(RTSeeIllustratorEvents.ADD_IMAGE_TO_CONTEXT, this.onAddImageBound);
187
+ window.addEventListener(RTSeeIllustratorEvents.GENERATION_STARTED, this.onGenStartedBound);
188
+ window.addEventListener(RTSeeIllustratorEvents.GENERATION_COMPLETED, this.onGenCompletedBound);
189
+ window.addEventListener(RTSeeIllustratorEvents.GET_CURRENT_IMAGE, this.onGetCurrentImageBound);
190
+ window.addEventListener(RTSeeIllustratorEvents.SET_PROMPT, this.onSetPromptBound);
191
+ // Initial request for agents from any open chat
192
+ this.requestAgents();
193
+ }
194
+ destroy() {
195
+ if (!this.isBrowser)
196
+ return;
197
+ if (this.onAgentsResponseBound) {
198
+ window.removeEventListener(RTSeeIllustratorEvents.AGENTS_RESPONSE, this.onAgentsResponseBound);
199
+ }
200
+ if (this.onAddImageBound) {
201
+ window.removeEventListener(RTSeeIllustratorEvents.ADD_IMAGE_TO_CONTEXT, this.onAddImageBound);
202
+ }
203
+ if (this.onGenStartedBound) {
204
+ window.removeEventListener(RTSeeIllustratorEvents.GENERATION_STARTED, this.onGenStartedBound);
205
+ }
206
+ if (this.onGenCompletedBound) {
207
+ window.removeEventListener(RTSeeIllustratorEvents.GENERATION_COMPLETED, this.onGenCompletedBound);
208
+ }
209
+ if (this.onGetCurrentImageBound) {
210
+ window.removeEventListener(RTSeeIllustratorEvents.GET_CURRENT_IMAGE, this.onGetCurrentImageBound);
211
+ }
212
+ if (this.onSetPromptBound) {
213
+ window.removeEventListener(RTSeeIllustratorEvents.SET_PROMPT, this.onSetPromptBound);
214
+ }
215
+ }
216
+ setPrompt(prompt) {
217
+ this.prompt = prompt || '';
218
+ this.reviewingGeneratedImage = false;
219
+ this.currentGeneratedImageUrl = null;
220
+ this.iterationPrompt = '';
221
+ this.expanded = true;
222
+ this.emit('changed');
223
+ }
224
+ requestAgents() {
225
+ if (!this.isBrowser)
226
+ return;
227
+ window.dispatchEvent(new CustomEvent(RTSeeIllustratorEvents.REQUEST_AGENTS));
228
+ }
229
+ handleAgentsResponse(payload) {
230
+ if (payload.chatId) {
231
+ this.activeChatId = payload.chatId;
232
+ }
233
+ if (Array.isArray(payload.agents)) {
234
+ this.agents = payload.agents;
235
+ if (payload.activeAgentId) {
236
+ this.activeAgentId = payload.activeAgentId;
237
+ }
238
+ else if (!this.activeAgentId && this.agents.length > 0) {
239
+ this.activeAgentId = this.agents[0].id;
240
+ }
241
+ }
242
+ this.emit('changed');
243
+ }
244
+ get activeAgent() {
245
+ return this.agents.find((a) => a.id === this.activeAgentId);
246
+ }
247
+ selectAgent(agentId) {
248
+ this.activeAgentId = agentId;
249
+ if (this.isBrowser) {
250
+ window.dispatchEvent(new CustomEvent(RTSeeIllustratorEvents.ACTIVE_AGENT_CHANGED, {
251
+ detail: { agentId, chatId: this.activeChatId },
252
+ }));
253
+ }
254
+ this.emit('changed');
255
+ }
256
+ toggleExpand() {
257
+ this.expanded = !this.expanded;
258
+ this.emit('changed');
259
+ }
260
+ toggleConfig() {
261
+ this.configExpanded = !this.configExpanded;
262
+ this.emit('changed');
263
+ }
264
+ addImageToContext(image) {
265
+ const id = image.id || RTSeeCore.uuidv4();
266
+ const existingIndex = this.contextImages.findIndex((img) => img.id === id || (image.imageUrl && img.imageUrl === image.imageUrl));
267
+ const newImage = {
268
+ id,
269
+ imageUrl: image.imageUrl || '',
270
+ title: image.title || 'Context reference',
271
+ description: image.description || '',
272
+ visualDescription: image.visualDescription || image.description || '',
273
+ sourceType: image.sourceType || 'custom',
274
+ active: image.active !== false,
275
+ };
276
+ if (existingIndex !== -1) {
277
+ this.contextImages[existingIndex] = {
278
+ ...this.contextImages[existingIndex],
279
+ ...newImage,
280
+ active: true,
281
+ };
282
+ }
283
+ else {
284
+ this.contextImages.push(newImage);
285
+ }
286
+ // Auto-expand so the user immediately sees the context item added
287
+ this.expanded = true;
288
+ this.emit('changed');
289
+ }
290
+ removeImageFromContext(id) {
291
+ this.contextImages = this.contextImages.filter((img) => img.id !== id);
292
+ this.emit('changed');
293
+ }
294
+ toggleImageActive(id) {
295
+ const img = this.contextImages.find((item) => item.id === id);
296
+ if (img) {
297
+ img.active = !img.active;
298
+ this.emit('changed');
299
+ }
300
+ }
301
+ updateImageDescription(id, description) {
302
+ const img = this.contextImages.find((item) => item.id === id);
303
+ if (img) {
304
+ img.description = description;
305
+ this.emit('changed');
306
+ }
307
+ }
308
+ updateImageVisualDescription(id, visualDescription) {
309
+ const img = this.contextImages.find((item) => item.id === id);
310
+ if (img) {
311
+ img.visualDescription = visualDescription;
312
+ this.emit('changed');
313
+ }
314
+ }
315
+ clearContext() {
316
+ this.contextImages = [];
317
+ this.emit('changed');
318
+ }
319
+ removeContextImage(id) {
320
+ this.removeImageFromContext(id);
321
+ }
322
+ get canSubmit() {
323
+ if (this.submitting)
324
+ return false;
325
+ if (this.reviewingGeneratedImage) {
326
+ return !!(this.iterationPrompt.trim() || this.prompt.trim());
327
+ }
328
+ return !!this.prompt.trim();
329
+ }
330
+ get activeContextImages() {
331
+ return this.contextImages.filter((img) => img.active !== false);
332
+ }
333
+ discardGeneratedImage() {
334
+ this.reviewingGeneratedImage = false;
335
+ this.currentGeneratedImageUrl = null;
336
+ this.iterationPrompt = '';
337
+ this.generationError = null;
338
+ this.emit('changed');
339
+ }
340
+ acceptGeneratedImage() {
341
+ if (this.currentGeneratedImageUrl) {
342
+ this.addImageToContext({
343
+ imageUrl: this.currentGeneratedImageUrl,
344
+ title: 'Story Illustration',
345
+ description: this.prompt,
346
+ visualDescription: this.prompt,
347
+ sourceType: 'custom',
348
+ active: true,
349
+ });
350
+ }
351
+ this.reviewingGeneratedImage = false;
352
+ this.currentGeneratedImageUrl = null;
353
+ this.iterationPrompt = '';
354
+ this.generationError = null;
355
+ this.emit('changed');
356
+ }
357
+ async submitIteration() {
358
+ if (!this.currentGeneratedImageUrl) {
359
+ return;
360
+ }
361
+ const changeRequest = this.iterationPrompt.trim() || this.prompt.trim();
362
+ if (!changeRequest) {
363
+ return;
364
+ }
365
+ if (!this.activeAgentId) {
366
+ if (this.agents.length > 0) {
367
+ this.activeAgentId = this.agents[0].id;
368
+ }
369
+ else {
370
+ this.requestAgents();
371
+ }
372
+ }
373
+ this.submitting = true;
374
+ this.generationError = null;
375
+ this.emit('changed');
376
+ // Optimize/compress image if it is an oversized data URL (and ignore default placeholder images)
377
+ const isCurrentDefault = this.currentGeneratedImageUrl ? this.currentGeneratedImageUrl.toLowerCase().includes('default') : false;
378
+ const optimizedImageUrl = isCurrentDefault ? '' : await optimizeImageDataUrl(this.currentGeneratedImageUrl);
379
+ // Build the iteration base context image representing the current draft
380
+ const iterationBaseImage = {
381
+ id: 'iter-base-' + RTSeeCore.uuidv4(),
382
+ imageUrl: optimizedImageUrl,
383
+ title: 'Current Draft (To Iterate Upon)',
384
+ description: `Original base scene: ${this.prompt}`,
385
+ visualDescription: `Base illustration generated in previous step. Modify this visual according to the revision instructions while preserving core visual style and composition. Requested modifications: ${changeRequest}`,
386
+ sourceType: 'iteration-base',
387
+ active: true,
388
+ };
389
+ // Send all other context pictures alongside the image meant to be iterated upon
390
+ const allContextImages = [
391
+ ...this.contextImages.map((img) => ({ ...img })),
392
+ iterationBaseImage,
393
+ ];
394
+ const iterationPromptText = `Modify and refine the current draft illustration. Requested changes: "${changeRequest}". Maintain visual continuity with the story characters, locations, and artifacts referenced in the context. Original scene description: "${this.prompt}".`;
395
+ const payload = {
396
+ chatId: this.activeChatId || undefined,
397
+ agentId: this.activeAgentId || '',
398
+ prompt: iterationPromptText,
399
+ config: { ...this.config },
400
+ contextImages: allContextImages,
401
+ isIteration: true,
402
+ baseImageUrl: optimizedImageUrl,
403
+ };
404
+ if (this.isBrowser) {
405
+ window.dispatchEvent(new CustomEvent(RTSeeIllustratorEvents.SUBMIT_PROMPT, {
406
+ detail: payload,
407
+ }));
408
+ }
409
+ }
410
+ submitPrompt() {
411
+ if (this.reviewingGeneratedImage) {
412
+ void this.submitIteration();
413
+ return;
414
+ }
415
+ if (!this.prompt.trim()) {
416
+ return;
417
+ }
418
+ if (!this.activeAgentId) {
419
+ if (this.agents.length > 0) {
420
+ this.activeAgentId = this.agents[0].id;
421
+ }
422
+ else {
423
+ this.requestAgents();
424
+ }
425
+ }
426
+ const payload = {
427
+ chatId: this.activeChatId || undefined,
428
+ agentId: this.activeAgentId || '',
429
+ prompt: this.prompt.trim(),
430
+ config: { ...this.config },
431
+ contextImages: this.contextImages.map((img) => ({ ...img })),
432
+ };
433
+ this.submitting = true;
434
+ this.generationError = null;
435
+ this.emit('changed');
436
+ if (this.isBrowser) {
437
+ window.dispatchEvent(new CustomEvent(RTSeeIllustratorEvents.SUBMIT_PROMPT, {
438
+ detail: payload,
439
+ }));
440
+ }
441
+ }
442
+ }
443
+ //# sourceMappingURL=RTSeeIllustrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RTSeeIllustrator.js","sourceRoot":"","sources":["../../../../../src/models/editor/RTSeeIllustrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAQL,sBAAsB,GACvB,MAAM,eAAe,CAAC;A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SeeTag, ITagsRemoteActions } from "@rtsee/common";
2
+ import { IRTSeeHandlerCommonOptions, RTSeeSignalHandlersDriver } from "@rtsee/core";
3
+ import { ManageStoryAuthorForm, ManageStoryForm, SelectStoryAuthorForm } from "@rtsee/utilities-ui";
4
+ import { RTSeeStory } from "../RTSeeStory";
5
+ import { RTSeeManageStorySlide } from "../manage/RTSeeManageStorySlide";
6
+ import { IPresentationRemoteActions } from "../remote-actions/PresentationRemoteActions";
7
+ import { RTSeeStoryCharacter } from "../story-elements/RTSeeStoryCharacter";
8
+ import { RTSeeStoryArtifact } from "../story-elements/RTSeeStoryArtifact";
9
+ import { RTSeeStoryLocation } from "../story-elements/RTSeeStoryLocation";
10
+ import { RTSeeStoryAuthor } from "../story-elements/RTSeeStoryAuthor";
11
+ import { RTSeeStoryEditorSection, RTSeeStoryElementsEditor } from "./RTSeeStoryElementsEditor";
12
+ export interface IRTSeeInteractiveStoryEditorOptions extends IRTSeeHandlerCommonOptions {
13
+ /** story to edit (a blank story is created when both story and storyId are missing) */
14
+ story?: IRTSeeStory;
15
+ /** id of the story to load (used when story is not provided) */
16
+ storyId?: string;
17
+ entitiesRemoteActions: IEntitiesRemoteActions & ITagsRemoteActions;
18
+ /** sections collapsed on init (all the sections are expanded by default) */
19
+ collapsedSections?: RTSeeStoryEditorSection[];
20
+ slidesLimit?: number;
21
+ }
22
+ /**
23
+ * Business logic of the interactive story editor.
24
+ * Orchestrates the story domain entities (story, characters, artifacts, locations, author, slides)
25
+ * and their edit forms. The UI layer only renders the state & forwards the user actions.
26
+ */
27
+ export declare class RTSeeInteractiveStoryEditorVm extends RTSeeSignalHandlersDriver {
28
+ story: RTSeeStory | null;
29
+ presentationRemoteActions: IPresentationRemoteActions;
30
+ entitiesRemoteActions: IEntitiesRemoteActions & ITagsRemoteActions;
31
+ collapsedSections: Set<RTSeeStoryEditorSection>;
32
+ detailsExpanded: boolean;
33
+ detailsForm: ManageStoryForm | null;
34
+ detailsSaveInProgress: boolean;
35
+ detailsError: string | null;
36
+ charactersEditor: RTSeeStoryElementsEditor<IRTSeeStoryCharacter, RTSeeStoryCharacter>;
37
+ artifactsEditor: RTSeeStoryElementsEditor<IRTSeeStoryArtifact, RTSeeStoryArtifact>;
38
+ locationsEditor: RTSeeStoryElementsEditor<IRTSeeStoryLocation, RTSeeStoryLocation>;
39
+ slides: IRTSeeStorySlide[];
40
+ totalSlides: number;
41
+ activeSlide: RTSeeManageStorySlide | null;
42
+ slidesLoadInProgress: boolean;
43
+ authorExpanded: boolean;
44
+ authorForm: SelectStoryAuthorForm | null;
45
+ newAuthor: RTSeeStoryAuthor | null;
46
+ newAuthorForm: ManageStoryAuthorForm | null;
47
+ authorSaveInProgress: boolean;
48
+ authorError: string | null;
49
+ initInProgress: boolean;
50
+ initError: string | null;
51
+ private readonly options;
52
+ private authorsCache;
53
+ constructor(options: IRTSeeInteractiveStoryEditorOptions);
54
+ get companionUrlValue(): string;
55
+ get isNewStory(): boolean;
56
+ init(): Promise<void>;
57
+ isCollapsed(section: RTSeeStoryEditorSection): boolean;
58
+ toggleSection(section: RTSeeStoryEditorSection, collapsed?: boolean): void;
59
+ expandDetails(): void;
60
+ collapseDetails(): void;
61
+ toggleDetails(): void;
62
+ saveDetails(model: IRTSeeStory): Promise<void>;
63
+ loadSlides(): Promise<void>;
64
+ isSlideExpanded(slide: IRTSeeStorySlide): boolean;
65
+ expandSlide(slide: IRTSeeStorySlide): void;
66
+ expandNewSlide(): void;
67
+ collapseSlide(): void;
68
+ get author(): RTSeeStoryAuthor | null;
69
+ toggleAuthor(): void;
70
+ expandAuthor(): void;
71
+ collapseAuthor(): void;
72
+ /** Assigns an existing author to the story (null clears the author) */
73
+ assignAuthor(storyAuthorId: string | null): Promise<void>;
74
+ /** Opens the form to create a brand new author */
75
+ startNewAuthor(): void;
76
+ cancelNewAuthor(): void;
77
+ saveNewAuthor(model: IRTSeeStoryAuthor): Promise<void>;
78
+ getAuthorsSuggestions(query: string): Promise<IRTSeeStoryAuthor[]>;
79
+ getStoryCategories(_query: string): Promise<IRTSeeStoryCategory[]>;
80
+ getTags(_query: string): Promise<IRTSeeTag[]>;
81
+ destroy(): void;
82
+ private resolveStoryData;
83
+ private getBlankStoryData;
84
+ private loadAuthor;
85
+ private getAuthorData;
86
+ /** Persists the story with its current links (elements ids & author id) */
87
+ private saveStoryLinks;
88
+ private openSlide;
89
+ private requireStory;
90
+ private getErrorMessage;
91
+ }
92
+ //# sourceMappingURL=RTSeeInteractiveStoryEditorVm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RTSeeInteractiveStoryEditorVm.d.ts","sourceRoot":"","sources":["../../../../../src/models/editor/RTSeeInteractiveStoryEditorVm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EAEjB,mBAAmB,EAEnB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EAIT,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAWL,qBAAqB,EAErB,eAAe,EAGf,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAEL,0BAA0B,EAC3B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAKpC,MAAM,WAAW,mC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