popost 4.6.6 → 4.6.8

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 (95) hide show
  1. package/SKILL.md +6 -6
  2. package/assets/canvas/assets/{dist-BmD8AP0A.js → dist-CX2mxpwq.js} +1 -1
  3. package/assets/canvas/assets/{es-CC29Cabv.js → es-BFnFFu6P.js} +1 -1
  4. package/assets/canvas/assets/{index-DS6BKqT0.css → index-C5rz5H21.css} +1 -1
  5. package/assets/canvas/assets/{index-DhwyFpu2.js → index-CwqBT_rk.js} +1 -1
  6. package/assets/canvas/assets/{jszip.min-Bwf_yCrF.js → jszip.min-DqfCBLrH.js} +1 -1
  7. package/assets/canvas/build-info.json +7 -7
  8. package/assets/canvas/index.html +2 -2
  9. package/assets/video/examples/catalogue.json +114 -0
  10. package/assets/video/examples/list-cards.html +155 -0
  11. package/assets/video/examples/page-flip.html +163 -0
  12. package/assets/video/times.js +59 -0
  13. package/dist/cli.js +2772 -1280
  14. package/dist/index.js +2243 -846
  15. package/dist/types/cloud/service.d.ts +2 -0
  16. package/dist/types/device-login.d.ts +6 -1
  17. package/dist/types/device-pending.d.ts +11 -0
  18. package/dist/types/editor/handoff.d.ts +1 -1
  19. package/dist/types/runtime.d.ts +5 -1
  20. package/dist/types/system-browser.d.ts +17 -0
  21. package/dist/types/version.d.ts +1 -1
  22. package/dist/types/video/commands/replication-books.d.ts +2 -0
  23. package/dist/types/video/compile/footage.d.ts +2 -0
  24. package/dist/types/video/compile/index.d.ts +2 -0
  25. package/dist/types/video/compile/page-bundle.d.ts +1 -1
  26. package/dist/types/video/compile/page.d.ts +1 -0
  27. package/dist/types/video/describe/parts.d.ts +3 -1
  28. package/dist/types/video/eval/readback-kept.d.ts +10 -0
  29. package/dist/types/video/eval/readback-run.d.ts +5 -1
  30. package/dist/types/video/generate/cast.d.ts +4 -0
  31. package/dist/types/video/media/footage.d.ts +1 -0
  32. package/dist/types/video/page/apply.d.ts +1 -1
  33. package/dist/types/video/page/contract.d.ts +16 -0
  34. package/dist/types/video/page/dom.d.ts +5 -0
  35. package/dist/types/video/page/times.d.ts +31 -0
  36. package/dist/types/video/preview/protocol.d.ts +1 -0
  37. package/dist/types/video/preview/reference.d.ts +9 -0
  38. package/dist/types/video/preview/shell/dom.d.ts +9 -0
  39. package/dist/types/video/preview/shell/footage.d.ts +1 -0
  40. package/dist/types/video/preview/shell/i18n.d.ts +1 -0
  41. package/dist/types/video/preview/shell/studio/copy.d.ts +1 -0
  42. package/dist/types/video/preview/shell/studio/style.d.ts +2 -2
  43. package/dist/types/video/preview/shell/studio/ui.d.ts +2 -0
  44. package/dist/types/video/preview/shell-bundle.d.ts +1 -1
  45. package/dist/types/video/project/check-sound.d.ts +3 -0
  46. package/dist/types/video/render/chunked.d.ts +29 -0
  47. package/dist/types/video/render/chunks.d.ts +39 -0
  48. package/dist/types/video/render/encode.d.ts +5 -0
  49. package/dist/types/video/render/index.d.ts +26 -0
  50. package/dist/types/video/render/record.d.ts +1 -1
  51. package/dist/types/video/render/session.d.ts +17 -0
  52. package/dist/types/video/render/shots.d.ts +11 -0
  53. package/dist/types/video/replication/books.d.ts +64 -0
  54. package/dist/types/video/replication/production.d.ts +5 -0
  55. package/dist/types/video/replication/retiming.d.ts +16 -0
  56. package/dist/types/video/replication/review.d.ts +50 -0
  57. package/dist/types/video/retarget/fps.d.ts +3 -5
  58. package/dist/types/video/retarget/index.d.ts +10 -2
  59. package/dist/types/video/retarget/speak.d.ts +2 -0
  60. package/dist/types/video/retarget/takes.d.ts +66 -0
  61. package/dist/types/video/retarget/tempo.d.ts +2 -0
  62. package/dist/types/video/speech/types.d.ts +5 -0
  63. package/dist/types/video/template/fill.d.ts +2 -0
  64. package/dist/types/video/template/save.d.ts +2 -0
  65. package/dist/types/video/template/structure.d.ts +1 -0
  66. package/dist/types/video/voice/cache.d.ts +10 -0
  67. package/dist/types/video/voice/hosted.d.ts +10 -4
  68. package/dist/types/video/voice/index.d.ts +25 -1
  69. package/dist/types/video/wallet.d.ts +7 -0
  70. package/dist/types/workflow/post-bundle.d.ts +9 -2
  71. package/package.json +1 -1
  72. package/references/host-editor.md +2 -2
  73. package/references/image-workflow.md +1 -1
  74. package/references/onboarding.md +5 -3
  75. package/references/post-bundle.md +1 -1
  76. package/references/providers.md +1 -1
  77. package/references/video-editing.md +4 -0
  78. package/references/video-effects.md +9 -1
  79. package/references/video-performers.md +12 -2
  80. package/references/video-project.md +5 -3
  81. package/references/video-replication.md +32 -3
  82. package/references/video-scenes.md +52 -2
  83. package/references/video-sfx.md +1 -1
  84. package/references/video-sound.md +18 -3
  85. package/references/video-step-0-machine.md +61 -0
  86. package/references/video-step-1-read.md +168 -0
  87. package/references/video-step-2-structure.md +24 -0
  88. package/references/video-step-3-content.md +117 -0
  89. package/references/video-step-4-lines.md +88 -0
  90. package/references/video-step-5-scenes.md +126 -0
  91. package/references/video-step-6-voice.md +53 -0
  92. package/references/video-step-7-deliver.md +92 -0
  93. package/references/video-templates.md +17 -7
  94. package/references/video-tools.md +8 -6
  95. package/references/video.md +50 -666
@@ -0,0 +1,163 @@
1
+ <!doctype html>
2
+ <html><head><meta charset="utf-8"><title>Pages that turn on the voice</title>
3
+ <style>
4
+ html, body { margin: 0; width: 1280px; height: 720px; overflow: hidden; }
5
+ body { font-family: "Inter", "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif; }
6
+ #stage { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background: var(--ground); }
7
+ #book { position: absolute; transform-origin: 50% 50%; }
8
+ .page { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); backface-visibility: hidden; }
9
+ /* A drawn stand-in under every page, seen until the page has a picture: its label and a few ruled lines. */
10
+ .paper { position: absolute; left: 8%; right: 8%; top: 10%; bottom: 10%;
11
+ background: linear-gradient(var(--accent), var(--accent)) 0 0 / 22% 3% no-repeat, linear-gradient(#d7dbe3, #d7dbe3) 0 62% / 100% 2.4% no-repeat,
12
+ linear-gradient(#d7dbe3, #d7dbe3) 0 72% / 92% 2.4% no-repeat, linear-gradient(#d7dbe3, #d7dbe3) 0 82% / 70% 2.4% no-repeat; }
13
+ .label { position: absolute; left: 0; right: 0; top: 14%; font-weight: 800; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
14
+ .page img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
15
+ .shade { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #000000; opacity: 0; }
16
+ </style></head>
17
+ <body>
18
+ <!-- A stack of pages; at each spoken line (or when its label is said) the top page turns away and shows the next.
19
+ Give the pages as pictures (pages=../assets/a.png|../assets/b.png, paths from the scene file) or let a fill set
20
+ their slots (page-1, page-2, ...); without pictures each page is drawn with its label. -->
21
+ <div id="stage"><div id="book"></div></div>
22
+ <script type="application/json" id="popost-params">
23
+ {
24
+ "about": "Pages that turn as the narration goes on: a stack of pictures or drawn pages (screenshots, slides, a catalogue, before and after) whose top page turns away like a book page, slides off the stack or is pushed aside at each spoken line of the shot, or when its label is said. Without a voice the pages turn at even steps.",
25
+ "class": "card",
26
+ "seconds": 4,
27
+ "tags": [ "page", "pages", "flip", "turn", "book", "slides", "gallery", "screenshots", "stack", "voice", "narration", "content" ],
28
+ "params": [
29
+ { "name": "pages", "type": "text", "maxLength": 1200, "default": "", "what": "the pictures of the pages, separated by |, as paths from the scene file (../assets/a.png); empty: drawn pages with the labels" },
30
+ { "name": "labels", "type": "text", "maxLength": 400, "default": "First page|Second page|Third page", "what": "the label of each page, separated by |: drawn on a page without a picture, and the words that turn to it with follow=words" },
31
+ { "name": "style", "type": "choice", "default": "book", "options": [ "book", "stack", "slide" ], "what": "how the top page goes: turned about its left edge, lifted off the stack, or pushed aside by the next" },
32
+ { "name": "fit", "type": "choice", "default": "cover", "options": [ "cover", "contain" ], "what": "how a picture fills its page: cover crops it, contain shows all of it" },
33
+ { "name": "width", "type": "number", "default": 0.8, "min": 0.1, "max": 1, "unit": "fraction of the canvas width", "what": "the width of the pages" },
34
+ { "name": "height", "type": "number", "default": 0.56, "min": 0.1, "max": 1, "unit": "fraction of the canvas height", "what": "the height of the pages" },
35
+ { "name": "y", "type": "number", "default": 0.43, "min": 0, "max": 1, "unit": "fraction of the canvas height", "what": "the middle of the pages (leave the caption band free)" },
36
+ { "name": "radius", "type": "number", "default": 0.03, "min": 0, "max": 0.3, "unit": "fraction of the smaller side", "what": "the corner radius of a page" },
37
+ { "name": "turn", "type": "number", "default": 0.6, "min": 0.15, "max": 3, "unit": "seconds", "what": "how long a page takes to go" },
38
+ { "name": "follow", "type": "choice", "default": "lines", "options": [ "lines", "words", "even" ], "what": "when each comes on: at the spoken lines of the shot (from firstLine on), when its text is said, or at even steps of stagger; without a voice (a sheet) always at even steps" },
39
+ { "name": "firstLine", "type": "number", "default": 2, "min": 1, "max": 30, "unit": "line of the shot", "what": "the line of the shot at which the second page comes (the first is there from the start)" },
40
+ { "name": "lead", "type": "number", "default": 0.25, "min": 0, "max": 1.5, "unit": "seconds", "what": "how long before its line or word a page starts to turn" },
41
+ { "name": "stagger", "type": "number", "default": 1.2, "min": 0.2, "max": 8, "unit": "seconds", "what": "the step between two at even steps, and after the last time the voice gives" },
42
+ { "name": "delay", "type": "number", "default": 0.1, "min": 0, "max": 20, "unit": "seconds", "what": "when the first page arrives; at even steps the second follows by stagger" },
43
+ { "name": "ground", "type": "colour", "default": "#121722", "what": "the background" },
44
+ { "name": "paper", "type": "colour", "default": "#ffffff", "what": "a page without a picture" },
45
+ { "name": "ink", "type": "colour", "default": "#1c2230", "what": "the labels" },
46
+ { "name": "accent", "type": "colour", "default": "#3a86ff", "what": "the mark on a drawn page" },
47
+ { "name": "shadow", "type": "number", "default": 0.35, "min": 0, "max": 1, "unit": "0 to 1", "what": "how dark the shadow under the pages and the shade of a turning page are" }
48
+ ],
49
+ "values": {}
50
+ }
51
+ </script>
52
+ <script>
53
+ (function () {
54
+ // The voice's times in this shot, which the engine puts in the address of the scene (as popost-times.js reads them):
55
+ // none in a sheet or a scene alone, and then everything comes on at even steps.
56
+ var times = (function () {
57
+ try { var h = String(location.hash), k = h.indexOf('popost-times='); return k < 0 ? null : JSON.parse(decodeURIComponent(h.slice(k + 13))); } catch (e) { return null; }
58
+ })();
59
+ var lines = times && times.lines || [], words = times && times.words || [];
60
+ var plain = function (s) { return String(s).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu, ''); };
61
+ // Where the first spoken word that begins the text starts, not before after; undefined when it is not said.
62
+ var wordAt = function (text, after) {
63
+ var want = plain(text);
64
+ if (!want) return undefined;
65
+ for (var i = 0; i < words.length; i++) {
66
+ if (words[i].at < after - 0.001) continue;
67
+ var own = plain(words[i].text), joined = own;
68
+ for (var j = i + 1; j < words.length && joined.length < own.length + want.length; j++) joined += plain(words[j].text);
69
+ var found = joined.indexOf(want);
70
+ if (found >= 0 && found < Math.max(1, own.length)) return words[i].at;
71
+ }
72
+ return undefined;
73
+ };
74
+ var block = JSON.parse(document.getElementById('popost-params').textContent), P = {};
75
+ block.params.forEach(function (p) { P[p.name] = block.values && block.values[p.name] !== undefined ? block.values[p.name] : p.default; });
76
+ var size = /width:\s*(\d+)px;\s*height:\s*(\d+)px;/.exec(document.querySelector('style').textContent) || [0, 1280, 720];
77
+ var W = Number(size[1]), H = Number(size[2]);
78
+ var clamp01 = function (t) { return Math.min(1, Math.max(0, t)); };
79
+ var out3 = function (t) { t = clamp01(t); return 1 - Math.pow(1 - t, 3); };
80
+ var inOut = function (t) { t = clamp01(t); return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(2 - 2 * t, 3) / 2; };
81
+ // When each of count things comes on: at the shot's lines from firstLine, when its text is said, or at even steps;
82
+ // what the voice does not give follows the one before by stagger. Never two at once.
83
+ var timesOf = function (texts, first, firstLine) {
84
+ var at = [], lead = Number(P.lead), stagger = Number(P.stagger);
85
+ texts.forEach(function (text, k) {
86
+ var t;
87
+ if (P.follow === 'words') { var w = wordAt(text, k ? at[k - 1] + lead : 0); if (w !== undefined) t = w - lead; }
88
+ if (t === undefined && P.follow !== 'even') { var l = lines[firstLine - 1 + k]; if (l) t = l.at - lead; }
89
+ if (t === undefined) t = k ? at[k - 1] + stagger : first;
90
+ at.push(Math.max(0, k ? Math.max(t, at[k - 1] + 0.12) : t));
91
+ });
92
+ return at;
93
+ };
94
+
95
+ var split = function (s) { return String(s).split('|').map(function (x) { return x.trim(); }); };
96
+ var pics = split(P.pages).filter(Boolean), labels = split(P.labels);
97
+ var count = Math.max(1, pics.length, labels.filter(Boolean).length);
98
+ var stage = document.getElementById('stage'), book = document.getElementById('book');
99
+ ['ground', 'paper', 'ink', 'accent'].forEach(function (c) { stage.style.setProperty('--' + c, P[c]); });
100
+ var bw = W * Number(P.width), bh = H * Number(P.height), unit = Math.min(W, H);
101
+ book.style.left = ((W - bw) / 2).toFixed(1) + 'px';
102
+ book.style.top = (H * Number(P.y) - bh / 2).toFixed(1) + 'px';
103
+ book.style.width = bw.toFixed(1) + 'px';
104
+ book.style.height = bh.toFixed(1) + 'px';
105
+ if (P.style === 'slide') book.style.overflow = 'hidden';
106
+ var radius = (Math.min(bw, bh) * Number(P.radius)).toFixed(1) + 'px';
107
+ if (P.style === 'slide') book.style.borderRadius = radius;
108
+ book.style.boxShadow = '0 ' + (unit * 0.02).toFixed(1) + 'px ' + (unit * 0.05).toFixed(1) + 'px rgba(0, 0, 0, ' + (Number(P.shadow) * 0.9).toFixed(3) + ')';
109
+ var pages = [];
110
+ for (var k = 0; k < count; k++) {
111
+ var page = document.createElement('div'), paper = document.createElement('div'), label = document.createElement('div'), img = document.createElement('img'), shade = document.createElement('div');
112
+ page.className = 'page';
113
+ page.style.zIndex = String(count - k);
114
+ page.style.borderRadius = radius;
115
+ page.style.transformOrigin = P.style === 'book' ? '0 50%' : '50% 50%';
116
+ paper.className = 'paper';
117
+ label.className = 'label';
118
+ label.setAttribute('data-slot', 'label-' + (k + 1));
119
+ label.textContent = labels[k] || '';
120
+ label.style.fontSize = (Math.min(bw, bh) * 0.085).toFixed(1) + 'px';
121
+ paper.appendChild(label);
122
+ img.alt = '';
123
+ img.setAttribute('data-slot', 'page-' + (k + 1));
124
+ img.setAttribute('src', pics[k] || 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
125
+ img.style.objectFit = P.fit;
126
+ shade.className = 'shade';
127
+ page.appendChild(paper);
128
+ page.appendChild(img);
129
+ page.appendChild(shade);
130
+ book.appendChild(page);
131
+ pages.push({ page: page, shade: shade });
132
+ }
133
+ // The first page arrives at delay; page k comes when the page above it starts to go.
134
+ var later = [];
135
+ for (var n = 1; n < count; n++) later.push(labels[n] || '');
136
+ var at = [Number(P.delay)].concat(timesOf(later, Number(P.delay) + Number(P.stagger), Number(P.firstLine)));
137
+ var turn = Number(P.turn), dark = Number(P.shadow);
138
+
139
+ // Every frame from its time alone: page k goes from at[k + 1] over turn seconds; the one under it comes up.
140
+ var render = function (seconds) {
141
+ var e = out3((seconds - at[0]) / 0.45);
142
+ book.style.opacity = e.toFixed(4);
143
+ book.style.transform = 'translateY(' + ((1 - e) * 3).toFixed(3) + 'vh) scale(' + (0.95 + 0.05 * e).toFixed(4) + ')';
144
+ pages.forEach(function (p, k) {
145
+ var leave = k + 1 < count ? inOut((seconds - at[k + 1]) / turn) : 0;
146
+ var come = k > 0 ? inOut((seconds - at[k]) / turn) : 1;
147
+ p.page.style.visibility = leave >= 1 ? 'hidden' : 'visible';
148
+ if (P.style === 'book') {
149
+ p.page.style.transform = 'perspective(' + (bw * 2.2).toFixed(0) + 'px) rotateY(' + (-92 * leave).toFixed(3) + 'deg)';
150
+ p.shade.style.opacity = (dark * (leave * 1.2 + (1 - come))).toFixed(4);
151
+ } else if (P.style === 'stack') {
152
+ p.page.style.transform = 'translateY(' + (-118 * leave).toFixed(3) + '%) rotate(' + (-6 * leave).toFixed(3) + 'deg) scale(' + (0.94 + 0.06 * come).toFixed(4) + ')';
153
+ p.shade.style.opacity = (dark * 0.8 * (1 - come)).toFixed(4);
154
+ } else {
155
+ p.page.style.transform = 'translateX(' + ((k > 0 ? 1 - come : 0) * 100 - leave * 100).toFixed(3) + '%)';
156
+ p.shade.style.opacity = '0';
157
+ }
158
+ });
159
+ };
160
+ window.__popostScene = { render: render, cues: at.slice(1).map(function (t) { return { at: Math.round(t * 1000) / 1000, cue: 'whoosh', gain: 0.4 }; }) };
161
+ })();
162
+ </script>
163
+ </body></html>
@@ -0,0 +1,59 @@
1
+ /*
2
+ * popost-times.js: the voice's times in a scene of the popost Skill. Part of the popost Skill (CLIPCAT AI LTD), under
3
+ * the Skill's licence.
4
+ *
5
+ * The engine gives every scene the lines and the words that are spoken while its shot is on screen, in seconds of the
6
+ * shot: the time render(seconds) is given and the position of a tween on a timeline. Bring a thing on when it is said,
7
+ * and it moves with the voice when the narration is spoken again (another voice, a changed line, a faster reading).
8
+ * The times are there when the scene's script runs, before its first frame.
9
+ *
10
+ * popostTimes.line(2) seconds where the shot's 2nd line starts; undefined when it has fewer lines
11
+ * popostTimes.line(2, 1.4) ... or 1.4 when it has fewer (no voice: a sheet, a scene alone)
12
+ * popostTimes.lineEnd(2, 3) where that line ends
13
+ * popostTimes.word('price', 2.0) where the first spoken word that begins "price" starts (case, spaces and
14
+ * punctuation do not count; a word may run over several tokens)
15
+ * popostTimes.word('price', 2.0, popostTimes.line(3, 0)) the same, not before the 3rd line
16
+ * popostTimes.lines [{ at, end }] of every line that starts in the shot, in order
17
+ * popostTimes.words [{ text, at, end }] of every word that starts in the shot
18
+ * popostTimes.seconds the length of the shot (null without times)
19
+ * popostTimes.voiced whether the engine gave times
20
+ *
21
+ * A video without a voice gives the times of its caption lines; a shot in which nothing is said gives none, and every
22
+ * call returns what it was given to use otherwise.
23
+ */
24
+ (function () {
25
+ var KEY = 'popost-times=';
26
+ var given = null;
27
+ try {
28
+ var hash = String(location.hash || ''), at = hash.indexOf(KEY);
29
+ if (at >= 0) given = JSON.parse(decodeURIComponent(hash.slice(at + KEY.length)));
30
+ } catch (e) {
31
+ given = null;
32
+ }
33
+ var lines = given && Array.isArray(given.lines) ? given.lines : [];
34
+ var words = given && Array.isArray(given.words) ? given.words : [];
35
+ var plain = function (s) { return String(s).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu, ''); };
36
+ var line = function (n, otherwise) { var l = lines[n - 1]; return l ? l.at : otherwise; };
37
+ var lineEnd = function (n, otherwise) { var l = lines[n - 1]; return l ? l.end : otherwise; };
38
+ var word = function (text, otherwise, after) {
39
+ var want = plain(text);
40
+ if (!want) return otherwise;
41
+ for (var i = 0; i < words.length; i++) {
42
+ if (after !== undefined && words[i].at < after - 0.001) continue;
43
+ var own = plain(words[i].text), joined = own;
44
+ for (var j = i + 1; j < words.length && joined.length < own.length + want.length; j++) joined += plain(words[j].text);
45
+ var found = joined.indexOf(want);
46
+ if (found >= 0 && found < Math.max(1, own.length)) return words[i].at;
47
+ }
48
+ return otherwise;
49
+ };
50
+ window.popostTimes = {
51
+ voiced: given !== null,
52
+ seconds: given && typeof given.seconds === 'number' ? given.seconds : null,
53
+ lines: lines,
54
+ words: words,
55
+ line: line,
56
+ lineEnd: lineEnd,
57
+ word: word,
58
+ };
59
+ })();