@meltemi/diagrams-player 0.0.0-stage → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -2
  3. package/dist/controller.d.ts +146 -0
  4. package/dist/controller.d.ts.map +1 -0
  5. package/dist/controller.js +500 -0
  6. package/dist/controller.js.map +1 -0
  7. package/dist/document.d.ts +54 -0
  8. package/dist/document.d.ts.map +1 -0
  9. package/dist/document.js +204 -0
  10. package/dist/document.js.map +1 -0
  11. package/dist/ease.d.ts +14 -0
  12. package/dist/ease.d.ts.map +1 -0
  13. package/dist/ease.js +57 -0
  14. package/dist/ease.js.map +1 -0
  15. package/dist/format.d.ts +102 -0
  16. package/dist/format.d.ts.map +1 -0
  17. package/dist/format.js +18 -0
  18. package/dist/format.js.map +1 -0
  19. package/dist/frame.d.ts +30 -0
  20. package/dist/frame.d.ts.map +1 -0
  21. package/dist/frame.js +47 -0
  22. package/dist/frame.js.map +1 -0
  23. package/dist/html.d.ts +54 -0
  24. package/dist/html.d.ts.map +1 -0
  25. package/dist/html.js +123 -0
  26. package/dist/html.js.map +1 -0
  27. package/dist/index.d.ts +6 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +6 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/messages/en.d.ts +151 -0
  32. package/dist/messages/en.d.ts.map +1 -0
  33. package/dist/messages/en.js +157 -0
  34. package/dist/messages/en.js.map +1 -0
  35. package/dist/messages/es.d.ts +4 -0
  36. package/dist/messages/es.d.ts.map +1 -0
  37. package/dist/messages/es.js +105 -0
  38. package/dist/messages/es.js.map +1 -0
  39. package/dist/messages/index.d.ts +104 -0
  40. package/dist/messages/index.d.ts.map +1 -0
  41. package/dist/messages/index.js +9 -0
  42. package/dist/messages/index.js.map +1 -0
  43. package/dist/node.d.ts +6 -0
  44. package/dist/node.d.ts.map +1 -0
  45. package/dist/node.js +37 -0
  46. package/dist/node.js.map +1 -0
  47. package/dist/player.js +149 -0
  48. package/dist/viewport.d.ts +69 -0
  49. package/dist/viewport.d.ts.map +1 -0
  50. package/dist/viewport.js +189 -0
  51. package/dist/viewport.js.map +1 -0
  52. package/package.json +51 -3
@@ -0,0 +1,500 @@
1
+ import { DEFAULT_LOCALE } from "@meltemi/diagrams-i18n";
2
+ import { DRILL_DURATIONS, sceneGroups, transitionFor, } from "@meltemi/diagrams-motion";
3
+ import { messages } from "./messages/index.js";
4
+ /** The trail never grows past this: `link` cycles are legal. */
5
+ export const TRAIL_LIMIT = 32;
6
+ /** Steps of the arrow keys, in milliseconds. */
7
+ export const STEP = 1000;
8
+ export const SMALL_STEP = 100;
9
+ /** The final state of a scene is drawn this long before the next one starts. */
10
+ const BEFORE_NEXT = 0.01;
11
+ /**
12
+ * The command of a key pressed in the player, or undefined. Left and Right step a second, `,` and
13
+ * `.` a tenth (Shift and the arrows pan the drawing).
14
+ */
15
+ export function commandForKey(key) {
16
+ switch (key) {
17
+ case " ":
18
+ case "k":
19
+ case "K":
20
+ return "toggle";
21
+ case "ArrowLeft":
22
+ return "back";
23
+ case "ArrowRight":
24
+ return "forward";
25
+ case ",":
26
+ return "backSmall";
27
+ case ".":
28
+ return "forwardSmall";
29
+ case "Home":
30
+ return "start";
31
+ case "End":
32
+ return "end";
33
+ case "PageUp":
34
+ case "p":
35
+ case "P":
36
+ return "previousScene";
37
+ case "PageDown":
38
+ case "n":
39
+ case "N":
40
+ return "nextScene";
41
+ case "s":
42
+ case "S":
43
+ return "toggleStatic";
44
+ default:
45
+ return undefined;
46
+ }
47
+ }
48
+ const secondsFormats = new Map();
49
+ /**
50
+ * Seconds with up to three decimals in a language, like `decimal(locale, s, 3)`; the formatter is
51
+ * made once, since the clock formats a time on every animation frame.
52
+ */
53
+ function secondsFormat(locale) {
54
+ let format = secondsFormats.get(locale);
55
+ if (!format) {
56
+ format = new Intl.NumberFormat(locale, { maximumFractionDigits: 3, useGrouping: false });
57
+ secondsFormats.set(locale, format);
58
+ }
59
+ return format;
60
+ }
61
+ /** `1.2 s`, `800 ms` or `0 s`, with the language's decimal mark: `1,2 s` in Spanish. */
62
+ export function formatTime(ms, locale = DEFAULT_LOCALE) {
63
+ if (ms === 0)
64
+ return "0 s";
65
+ if (ms >= 1000)
66
+ return `${secondsFormat(locale).format(Math.round(ms) / 1000)} s`;
67
+ return `${Math.round(ms)} ms`;
68
+ }
69
+ /**
70
+ * The state of a player without its page: the clock, the scenes, the static view and what to
71
+ * announce. The runtime draws `frameTime` and calls `tick` on animation frames.
72
+ */
73
+ export class PlayerController {
74
+ document;
75
+ time = 0;
76
+ playing = false;
77
+ staticView;
78
+ loop;
79
+ /** The language of the announcements. */
80
+ locale;
81
+ constructor(document, options = {}) {
82
+ this.document = document;
83
+ this.effectsView = document.kind === "effects" ? document.key : "";
84
+ this.reducedMotion = options.reducedMotion === true;
85
+ this.staticView = options.static === true || options.reducedMotion === true;
86
+ this.loop = options.loop === true;
87
+ this.locale = options.locale ?? DEFAULT_LOCALE;
88
+ if (options.autoplay && !options.reducedMotion && !this.staticView)
89
+ this.playing = true;
90
+ if (this.staticView)
91
+ this.time = this.sceneEnd(0);
92
+ }
93
+ /** The view of an effects document on screen, by key. */
94
+ effectsView;
95
+ /** The element or relation selected, whose details the panel shows. */
96
+ selection = null;
97
+ /** The item the keyboard walk reached. */
98
+ focused = null;
99
+ /** The views above the one on screen, outermost first. */
100
+ trail = [];
101
+ /** A drill-down on its way, or null. */
102
+ drill = null;
103
+ reducedMotion;
104
+ /** What to announce once a drill-down settles, until the runtime takes it. */
105
+ settled = null;
106
+ /** The key of the view on screen: an effects document's current view, or the scene's view. */
107
+ get view() {
108
+ if (this.document.kind === "effects")
109
+ return this.effectsView;
110
+ const scene = this.scenes[this.sceneIndex];
111
+ return scene?.view ?? this.document.timeline.views[0] ?? "";
112
+ }
113
+ /** How long the document plays, or null for effects that repeat forever. */
114
+ get duration() {
115
+ return this.document.kind === "story"
116
+ ? this.document.timeline.durationMs
117
+ : (this.document.views[this.effectsView]?.durationMs ?? null);
118
+ }
119
+ get scenes() {
120
+ return this.document.kind === "story" ? this.document.timeline.scenes : [];
121
+ }
122
+ /** The scene at a time: the last one that has started. */
123
+ sceneIndexAt(t) {
124
+ const scenes = this.scenes;
125
+ let index = 0;
126
+ for (let i = 0; i < scenes.length; i++)
127
+ if (scenes[i].startMs <= t)
128
+ index = i;
129
+ return index;
130
+ }
131
+ get sceneIndex() {
132
+ return this.sceneIndexAt(this.time);
133
+ }
134
+ /** The time of a scene's final state. */
135
+ sceneEnd(index) {
136
+ const scene = this.scenes[index];
137
+ if (!scene)
138
+ return 0;
139
+ const end = scene.startMs + scene.durationMs;
140
+ return index === this.scenes.length - 1 ? end : Math.max(scene.startMs, end - BEFORE_NEXT);
141
+ }
142
+ /** Whether the play button can play: never in the static view of a story. */
143
+ get canPlay() {
144
+ return !(this.staticView && this.document.kind === "story");
145
+ }
146
+ play() {
147
+ if (!this.canPlay)
148
+ return;
149
+ const duration = this.duration;
150
+ if (duration !== null && this.time >= duration)
151
+ this.time = 0;
152
+ this.playing = true;
153
+ }
154
+ pause() {
155
+ this.playing = false;
156
+ }
157
+ toggle() {
158
+ if (this.playing)
159
+ this.pause();
160
+ else
161
+ this.play();
162
+ }
163
+ /** Moves the clock on by `elapsed` ms while playing; returns true when playback ended. */
164
+ tick(elapsed) {
165
+ const drill = this.drill;
166
+ if (drill) {
167
+ drill.time += Math.max(0, elapsed);
168
+ if (drill.time >= this.drillDuration)
169
+ this.settle();
170
+ return false;
171
+ }
172
+ if (!this.playing)
173
+ return false;
174
+ const duration = this.duration;
175
+ const next = this.time + Math.max(0, elapsed);
176
+ if (duration === null) {
177
+ this.time = next;
178
+ return false;
179
+ }
180
+ if (next < duration) {
181
+ this.time = next;
182
+ return false;
183
+ }
184
+ if (this.loop && duration > 0) {
185
+ this.time = next % duration;
186
+ return false;
187
+ }
188
+ this.time = duration;
189
+ this.playing = false;
190
+ return true;
191
+ }
192
+ /** Shows a time; in the static view, the final state of the scene at that time. */
193
+ seek(t) {
194
+ const duration = this.duration;
195
+ const clamped = Math.max(0, duration === null ? t : Math.min(duration, t));
196
+ this.time =
197
+ this.staticView && this.scenes.length > 0
198
+ ? this.sceneEnd(this.sceneIndexAt(clamped))
199
+ : clamped;
200
+ }
201
+ goToScene(index) {
202
+ const scenes = this.scenes;
203
+ if (scenes.length === 0)
204
+ return;
205
+ const i = Math.max(0, Math.min(scenes.length - 1, index));
206
+ this.time = this.staticView ? this.sceneEnd(i) : scenes[i].startMs;
207
+ }
208
+ setStatic(on) {
209
+ this.staticView = on;
210
+ if (!on)
211
+ return;
212
+ // Nothing moves in the static view.
213
+ this.playing = false;
214
+ if (this.scenes.length > 0)
215
+ this.time = this.sceneEnd(this.sceneIndex);
216
+ }
217
+ /** The time whose frame is drawn. */
218
+ get frameTime() {
219
+ return this.time;
220
+ }
221
+ /** Runs a keyboard command. */
222
+ run(command) {
223
+ switch (command) {
224
+ case "toggle":
225
+ this.toggle();
226
+ break;
227
+ case "back":
228
+ case "forward":
229
+ case "backSmall":
230
+ case "forwardSmall": {
231
+ if (this.staticView && this.scenes.length > 0) {
232
+ this.goToScene(this.sceneIndex + (command.startsWith("back") ? -1 : 1));
233
+ break;
234
+ }
235
+ const step = command.endsWith("Small") ? SMALL_STEP : STEP;
236
+ this.pause();
237
+ this.seek(this.time + (command.startsWith("back") ? -step : step));
238
+ break;
239
+ }
240
+ case "start":
241
+ this.pause();
242
+ this.seek(0);
243
+ break;
244
+ case "end":
245
+ this.pause();
246
+ this.seek(this.duration ?? this.time);
247
+ break;
248
+ case "previousScene": {
249
+ // In the animated view, the start of the current scene first, then the previous one.
250
+ const index = this.sceneIndex;
251
+ const start = this.scenes[index]?.startMs ?? 0;
252
+ this.goToScene(!this.staticView && this.time > start + 250 ? index : index - 1);
253
+ break;
254
+ }
255
+ case "nextScene":
256
+ this.goToScene(this.sceneIndex + 1);
257
+ break;
258
+ case "toggleStatic":
259
+ this.setStatic(!this.staticView);
260
+ break;
261
+ }
262
+ }
263
+ // ---------------------------------------------------------------- selection and drill-down
264
+ /** The title of a view, or its key. */
265
+ titleOf(view) {
266
+ return this.document.names[view]?.title ?? view;
267
+ }
268
+ /** The elements (with a box) and relations (with a track) of a view, in drawing order. */
269
+ items(view = this.view) {
270
+ const scene = this.document.views[view]?.scene;
271
+ if (!scene)
272
+ return [];
273
+ const elements = [];
274
+ const relations = [];
275
+ const seen = new Set();
276
+ for (const group of sceneGroups(scene.items)) {
277
+ const key = `${group.role}:${group.id}`;
278
+ if (seen.has(key))
279
+ continue;
280
+ if (group.role === "element" && group.bounds)
281
+ elements.push({ role: "element", id: group.id });
282
+ else if (group.role === "relation" && group.track && group.track.length > 1)
283
+ relations.push({ role: "relation", id: group.id });
284
+ else
285
+ continue;
286
+ seen.add(key);
287
+ }
288
+ return [...elements, ...relations];
289
+ }
290
+ /**
291
+ * Moves the keyboard walk to the next (`1`) or previous (`-1`) item that `shown` accepts,
292
+ * wrapping at the ends; returns the item reached, or null when there is none.
293
+ */
294
+ moveFocus(step, shown = () => true) {
295
+ const items = this.items().filter(shown);
296
+ if (items.length === 0)
297
+ return (this.focused = null);
298
+ const current = this.focused;
299
+ const at = current
300
+ ? items.findIndex((i) => i.role === current.role && i.id === current.id)
301
+ : -1;
302
+ const next = at < 0 ? (step > 0 ? 0 : items.length - 1) : (at + step + items.length) % items.length;
303
+ return (this.focused = items[next]);
304
+ }
305
+ /** Selects an item of the view on screen, or clears; false for an unknown item. */
306
+ select(item) {
307
+ if (item === null) {
308
+ this.selection = null;
309
+ return true;
310
+ }
311
+ if (!this.items().some((i) => i.role === item.role && i.id === item.id))
312
+ return false;
313
+ this.selection = item;
314
+ return true;
315
+ }
316
+ /** What an element of the view on screen opens in the document; null for stories and drills. */
317
+ canOpen(id) {
318
+ if (this.document.kind !== "effects" || this.drill)
319
+ return null;
320
+ const target = this.document.details[this.view]?.elements[id]?.opens ?? null;
321
+ return target && this.document.views[target.view] ? target : null;
322
+ }
323
+ durations() {
324
+ return this.reducedMotion ? { cameraMs: 0, transitionMs: 0 } : { ...DRILL_DURATIONS };
325
+ }
326
+ /** How long the drill-down on its way lasts. */
327
+ get drillDuration() {
328
+ const spec = this.drill?.spec;
329
+ return spec ? spec.cameraMs + spec.transitionMs : 0;
330
+ }
331
+ start(spec, select, extra = {}) {
332
+ this.drill = { spec, time: 0, extra, select, resume: this.playing };
333
+ this.playing = false;
334
+ this.selection = null;
335
+ this.focused = null;
336
+ if (this.drillDuration <= 0)
337
+ this.settle();
338
+ }
339
+ settle() {
340
+ const drill = this.drill;
341
+ if (!drill)
342
+ return;
343
+ this.drill = null;
344
+ this.effectsView = drill.spec.to;
345
+ this.time = 0;
346
+ this.playing = drill.resume && !this.staticView;
347
+ this.selection = drill.select ? { role: "element", id: drill.select } : null;
348
+ const title = this.titleOf(drill.spec.to);
349
+ const t = messages(this.locale).player;
350
+ this.settled = drill.spec.direction === "down" ? t.opened(title) : t.wentUp(title);
351
+ }
352
+ /** Opens what an element of the view on screen opens; false when it opens nothing here. */
353
+ open(id) {
354
+ const target = this.canOpen(id);
355
+ if (!target)
356
+ return false;
357
+ const from = this.view;
358
+ this.trail.push({ view: from, element: id });
359
+ if (this.trail.length > TRAIL_LIMIT)
360
+ this.trail.shift();
361
+ this.start({
362
+ from,
363
+ to: target.view,
364
+ element: id,
365
+ transition: target.transition,
366
+ direction: "down",
367
+ ...this.durations(),
368
+ }, target.element);
369
+ return true;
370
+ }
371
+ /**
372
+ * Plays a drill-down into the document's own view from a view the document lacks (a catalog
373
+ * page that came from another page): going down, `element` is in `from`; going up, in the
374
+ * document's view.
375
+ */
376
+ enter(from, element, direction, transition, select = null) {
377
+ if (this.document.kind !== "effects")
378
+ return;
379
+ this.effectsView = from.key;
380
+ // Going down, the page it came from moved the camera already: the change of view is left.
381
+ const durations = this.durations();
382
+ if (direction === "down")
383
+ durations.cameraMs = 0;
384
+ this.start({
385
+ from: from.key,
386
+ to: this.document.key,
387
+ element,
388
+ transition,
389
+ direction,
390
+ ...durations,
391
+ }, select, { [from.key]: from.view });
392
+ }
393
+ /** Goes up to a view of the trail (the one just above by default); false when there is none. */
394
+ up(index = this.trail.length - 1) {
395
+ if (this.document.kind !== "effects" || this.drill)
396
+ return false;
397
+ const step = this.trail[index];
398
+ if (!step)
399
+ return false;
400
+ const above = this.document.views[step.view];
401
+ const here = this.document.views[this.view];
402
+ if (!above || !here)
403
+ return false;
404
+ this.trail.length = index;
405
+ const written = this.document.details[step.view]?.elements[step.element]?.opens;
406
+ const transition = written && written.view === this.view
407
+ ? written.transition
408
+ : transitionFor(above.scene, here.scene, step.element);
409
+ this.start({
410
+ from: this.view,
411
+ to: step.view,
412
+ element: step.element,
413
+ transition,
414
+ direction: "up",
415
+ ...this.durations(),
416
+ }, step.element);
417
+ return true;
418
+ }
419
+ /** What a settled drill-down says, once: "Opened containers". */
420
+ takeSettled() {
421
+ const text = this.settled;
422
+ this.settled = null;
423
+ return text;
424
+ }
425
+ /** What a screen reader hears about the current scene, in the player's language. */
426
+ announcement() {
427
+ const scenes = this.scenes;
428
+ const scene = scenes[this.sceneIndex];
429
+ if (!scene)
430
+ return "";
431
+ return messages(this.locale).player.scene(this.sceneIndex + 1, scenes.length, scene.id, scene.title);
432
+ }
433
+ }
434
+ // ---------------------------------------------------------------------- summary
435
+ function phrase(doc, view, action, locale) {
436
+ const t = messages(locale).story;
437
+ const labels = doc.names[view]?.labels ?? {};
438
+ const name = (id) => labels[id] ?? id;
439
+ const targets = t.list(action.targets.map((target) => name(target.id)));
440
+ const time = formatTime(action.durationMs, locale);
441
+ switch (action.kind) {
442
+ case "reveal":
443
+ return t.reveal(targets, time);
444
+ case "hide":
445
+ return t.hide(targets, time);
446
+ case "highlight":
447
+ return t.highlight(targets, time);
448
+ case "focus":
449
+ return action.all ? t.clearFocus : t.focus(targets);
450
+ case "camera":
451
+ return action.all ? t.frameAll : t.frame(targets);
452
+ case "trace": {
453
+ const id = action.targets[0]?.id ?? "";
454
+ const ends = doc.views[view]?.ends[id];
455
+ return t.trace(name(id), ends ? [name(ends[0]), name(ends[1])] : null, time);
456
+ }
457
+ case "hold":
458
+ return t.hold(time);
459
+ case "parallel":
460
+ return t.parallel(action.children.map((c) => phrase(doc, view, c, locale)).join("; "));
461
+ }
462
+ }
463
+ /** The scenes of a story and their actions in words, with labels instead of ids. */
464
+ export function storySummary(doc, locale = DEFAULT_LOCALE) {
465
+ const t = messages(locale).story;
466
+ let previous;
467
+ return doc.timeline.scenes.map((scene, i) => {
468
+ const items = [];
469
+ const viewTitle = doc.names[scene.view]?.title ?? scene.view.split("#").pop();
470
+ if (scene.transition && previous !== undefined && previous !== scene.view) {
471
+ const { kind, durationMs } = scene.transition;
472
+ items.push(t.transition(kind, viewTitle, durationMs > 0 ? formatTime(durationMs, locale) : null));
473
+ }
474
+ previous = scene.view;
475
+ for (const action of scene.actions)
476
+ items.push(phrase(doc, scene.view, action, locale));
477
+ const end = scene.startMs + scene.durationMs;
478
+ return {
479
+ heading: t.scene(i + 1, scene.title ?? scene.id, formatTime(scene.startMs, locale), formatTime(end, locale)),
480
+ items,
481
+ };
482
+ });
483
+ }
484
+ /** The effects of a diagram in words. */
485
+ export function effectsSummary(doc, locale = DEFAULT_LOCALE, view = doc.key) {
486
+ const t = messages(locale).effects;
487
+ const labels = doc.names[view]?.labels ?? {};
488
+ return (doc.views[view]?.plan.effects ?? []).map((e) => {
489
+ const name = labels[e.target] ?? e.target;
490
+ const what = e.effect === "flow"
491
+ ? t.flow(name)
492
+ : e.effect === "dash"
493
+ ? t.dash(name)
494
+ : e.effect === "trace"
495
+ ? t.trace(name)
496
+ : t.pulse(name);
497
+ return t.cycle(what, formatTime(e.durationMs, locale), e.repeat === "forever" ? t.forever : t.times(e.repeat), e.delayMs > 0 ? formatTime(e.delayMs, locale) : null);
498
+ });
499
+ }
500
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"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CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACrD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAC1C,MAAM,IAAI,GACR,CAAC,CAAC,MAAM,KAAK,MAAM;YACjB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACd,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM;gBACnB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO;oBACpB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;oBACf,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,CAAC,CAAC,KAAK,CACZ,IAAI,EACJ,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,EAChC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EACtD,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CACrD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { Locale } from "@meltemi/diagrams-i18n";
2
+ import { type LayoutResult } from "@meltemi/diagrams-layout";
3
+ import type { FlowDiagram, StoryDefinition } from "@meltemi/diagrams-model";
4
+ import { type DrillTransition } from "@meltemi/diagrams-motion";
5
+ import { type FontProvider } from "@meltemi/diagrams-render";
6
+ import { type EffectsPlayerDocument, type OpenTarget, type StoryPlayerDocument, type ViewDetails } from "./format.js";
7
+ export * from "./format.js";
8
+ /** A diagram with its layout, as a host laid it out with its themes and assets. */
9
+ export interface LaidOutView {
10
+ readonly diagram: FlowDiagram;
11
+ readonly layout: LayoutResult;
12
+ }
13
+ /** What an element opens, as a host resolved it: views are named by the host's keys. */
14
+ export interface HostOpenTarget {
15
+ readonly view: string;
16
+ readonly element: string | null;
17
+ readonly transition: DrillTransition;
18
+ }
19
+ /** The views a host bundles with a diagram and what their elements open. */
20
+ export interface DrillViews {
21
+ /** The host's key of the diagram's own view. */
22
+ readonly root: string;
23
+ /** The other views, by the host's keys, in the order they were reached. */
24
+ readonly views: ReadonlyMap<string, LaidOutView>;
25
+ /** By the host's view key, then element id: what the element opens. */
26
+ readonly opens: ReadonlyMap<string, Readonly<Record<string, HostOpenTarget>>>;
27
+ }
28
+ export interface DocumentOptions {
29
+ /** Embeds the fonts of the text; without it, frames use the fonts of the viewer. */
30
+ readonly fonts?: FontProvider;
31
+ /** The content language of the type words; English by default, never the machine's. */
32
+ readonly locale?: Locale;
33
+ /** Effects documents: the views a drill-down reaches and what opens them. */
34
+ readonly drill?: DrillViews;
35
+ }
36
+ /**
37
+ * The details of a view: only the compiled diagram's labels, kinds, type words, technology,
38
+ * descriptions, URLs, entity paths and relation fields; never comments, positions or paths.
39
+ */
40
+ export declare function detailsOf(diagram: FlowDiagram, locale?: Locale, opens?: Readonly<Record<string, OpenTarget>>, parent?: ViewDetails["parent"]): ViewDetails;
41
+ /**
42
+ * The player document of a story, from the laid-out views it shows by view key, or undefined when
43
+ * one of them is missing or cannot be drawn.
44
+ */
45
+ export declare function storyDocument(story: StoryDefinition, layouts: ReadonlyMap<string, LaidOutView>, options?: DocumentOptions): StoryPlayerDocument | undefined;
46
+ /** The view keys a story shows, with the view each key stands for. */
47
+ export declare function storyViews(story: StoryDefinition): Map<string, StoryDefinition["target"]>;
48
+ /**
49
+ * The player document of a diagram and its effects, with the views a drill-down reaches from it
50
+ * when the host gives them, or undefined when the diagram cannot be drawn. A bundled view that
51
+ * cannot be drawn is left out, with the targets that lead to it.
52
+ */
53
+ export declare function effectsDocument(view: LaidOutView, options?: DocumentOptions): EffectsPlayerDocument | undefined;
54
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAGL,KAAK,qBAAqB,EAG1B,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AAErB,cAAc,aAAa,CAAC;AAE5B,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AAED,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAA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