@bitmagic/cli 0.1.64-dev.7 → 0.1.64-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/dist/commands/generate.d.ts +2 -0
- package/dist/commands/generate.js +6 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/trailer.js +18 -4
- package/dist/commands/trailer.js.map +1 -1
- package/dist/editor/hud-replay-page.js +317 -22
- package/dist/editor/hud-replay-page.js.map +1 -1
- package/dist/render/qr-png.d.ts +6 -3
- package/dist/render/qr-png.js +8 -8
- package/dist/render/qr-png.js.map +1 -1
- package/dist/scaffold/skill-files.js +1 -0
- package/dist/scaffold/skill-files.js.map +1 -1
- package/dist/trailer/hud-raster.d.ts +12 -12
- package/dist/trailer/hud-raster.js +85 -32
- package/dist/trailer/hud-raster.js.map +1 -1
- package/dist/trailer/hud-state.d.ts +75 -4
- package/dist/trailer/hud-state.js +132 -17
- package/dist/trailer/hud-state.js.map +1 -1
- package/dist/trailer/io.d.ts +2 -0
- package/dist/trailer/io.js +6 -1
- package/dist/trailer/io.js.map +1 -1
- package/dist/trailer/link.d.ts +1 -0
- package/dist/trailer/link.js +15 -0
- package/dist/trailer/link.js.map +1 -0
- package/dist/trailer/make.d.ts +2 -0
- package/dist/trailer/make.js +1 -0
- package/dist/trailer/make.js.map +1 -1
- package/dist/trailer/merge.js +32 -11
- package/dist/trailer/merge.js.map +1 -1
- package/dist/trailer/render.d.ts +2 -0
- package/dist/trailer/render.js +94 -48
- package/dist/trailer/render.js.map +1 -1
- package/dist/trailer/timeline-types.d.ts +19 -0
- package/dist/trailer/timeline-types.js +42 -2
- package/dist/trailer/timeline-types.js.map +1 -1
- package/dist/trailer/title-raster.js +2 -1
- package/dist/trailer/title-raster.js.map +1 -1
- package/dist/trailer/titles.js +6 -1
- package/dist/trailer/titles.js.map +1 -1
- package/dist/trailer/video-chain.d.ts +96 -8
- package/dist/trailer/video-chain.js +183 -0
- package/dist/trailer/video-chain.js.map +1 -1
- package/package.json +4 -4
|
@@ -13,12 +13,23 @@
|
|
|
13
13
|
* default `server.cors` admits localhost origins, which is what makes the cross-origin module load
|
|
14
14
|
* work.
|
|
15
15
|
*
|
|
16
|
-
* Contract with `trailer/hud-raster.ts` (
|
|
16
|
+
* Contract with `trailer/hud-raster.ts` (the same one the web lane's `game/hud-replay.html` keeps):
|
|
17
17
|
* window.__hudReplayReady === true when the HUD is constructed
|
|
18
18
|
* window.__hudReplay.setViewport(w, h) size the surface to the recording
|
|
19
|
-
* window.__hudReplay.render(state)
|
|
19
|
+
* window.__hudReplay.render(state, ms, clip) apply a state snapshot (synchronous); `ms` is the
|
|
20
|
+
* keyframe's position on the SOURCE clock and `clip` the EDL
|
|
21
|
+
* clip it belongs to — together they seed animation phase
|
|
22
|
+
* (both optional; an older raster passes neither)
|
|
23
|
+
* window.__hudReplay.settle() promise: fonts/images loaded, or 1.5 s
|
|
20
24
|
*
|
|
21
|
-
* Same template-literal
|
|
25
|
+
* Same template-literal rules as the shell page: **no backticks** in the emitted output, and every
|
|
26
|
+
* backslash the emitted JS needs (regex escapes) is written doubled here, because an untagged
|
|
27
|
+
* template drops the backslash from an unknown escape like `\(`.
|
|
28
|
+
*
|
|
29
|
+
* The engine module is imported as a namespace and feature-detected: this page ships in the CLI
|
|
30
|
+
* and runs against whichever engine the project has vendored, so a named import of something that
|
|
31
|
+
* engine predates would fail the whole module load (and with it every overlay) rather than one
|
|
32
|
+
* optional nicety.
|
|
22
33
|
*/
|
|
23
34
|
import { CDN_IMPORTS } from '../scaffold/project-files.js';
|
|
24
35
|
import { importMapEntries } from '../scaffold/aliases.js';
|
|
@@ -34,6 +45,9 @@ export function renderHudReplayHtml(options) {
|
|
|
34
45
|
<html lang="en">
|
|
35
46
|
<head>
|
|
36
47
|
<meta charset="utf-8">
|
|
48
|
+
<!-- The page is served from the sidecar, but captured game sheets and widget markup reference
|
|
49
|
+
assets root-relatively against the GAME origin; the import map is already absolute. -->
|
|
50
|
+
<base href="http://localhost:${options.gamePort}/">
|
|
37
51
|
<title>HUD Replay (trailer overlay)</title>
|
|
38
52
|
<style>
|
|
39
53
|
/* Transparent everywhere — the renderer captures with omitBackground so only HUD pixels carry alpha. */
|
|
@@ -41,10 +55,16 @@ export function renderHudReplayHtml(options) {
|
|
|
41
55
|
/* The HUD fades itself in only on GameState.PLAYING, which never happens here; force it visible and
|
|
42
56
|
kill transitions so a screenshot taken immediately after render() is the settled frame. */
|
|
43
57
|
.hud-root { opacity: 1 !important; transition: none !important; }
|
|
58
|
+
/* First layer: an !important declaration beats every normal one whatever its specificity, so this
|
|
59
|
+
kills any game animation declared normally. A game rule that is itself !important escapes it,
|
|
60
|
+
and freezeMotion() below is what makes THOSE deterministic. Keeping the rule still pays — the
|
|
61
|
+
animations it suppresses are never created at all. */
|
|
44
62
|
.hud-root, .hud-root * { animation: none !important; transition: none !important; }
|
|
45
63
|
/* Gameplay layer holds the reticle/ESC hint — not part of a trailer overlay. */
|
|
46
64
|
.hud-gameplay-layer { display: none !important; }
|
|
47
65
|
</style>
|
|
66
|
+
<!-- Kept last in <head> after every captured-sheet injection; see enforceTransparentPageBackground(). -->
|
|
67
|
+
<style id="hud-replay-transparent">html, body { background: transparent !important; }</style>
|
|
48
68
|
<script type="importmap">
|
|
49
69
|
${JSON.stringify({ imports }, null, 2)}
|
|
50
70
|
</script>
|
|
@@ -52,38 +72,56 @@ ${JSON.stringify({ imports }, null, 2)}
|
|
|
52
72
|
<body>
|
|
53
73
|
<script type="module">
|
|
54
74
|
import { GameHUD } from 'engine/GameHUD.js';
|
|
55
|
-
import
|
|
75
|
+
import * as hudApi from 'engine/hud/index.js';
|
|
56
76
|
|
|
77
|
+
/** Rebuilt whenever the element set changes; kept between same-shape frames. */
|
|
57
78
|
var hud = null;
|
|
58
79
|
var builtKey = '';
|
|
80
|
+
/** The recorded theme currently applied, as JSON — re-applied only on change. */
|
|
81
|
+
var lastThemeJson = 'null';
|
|
59
82
|
|
|
60
83
|
function disposeHud() {
|
|
61
84
|
if (hud) { hud.dispose(); hud = null; }
|
|
85
|
+
// dispose() removes .hud-root/.hud-gameplay-layer, and a previous frame's toast stacks live inside those.
|
|
62
86
|
builtKey = '';
|
|
63
87
|
}
|
|
64
88
|
|
|
65
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Identity of a state's STRUCTURE (not its values): unchanged means mutate, changed means rebuild.
|
|
91
|
+
* Custom css is deliberately NOT part of it: it rides custom-html updates too, and applyValues writes
|
|
92
|
+
* it onto the live container — a per-frame style tick must mutate, never tear the whole HUD down.
|
|
93
|
+
*/
|
|
66
94
|
function structureKey(state) {
|
|
67
95
|
return JSON.stringify([
|
|
68
96
|
(state.elements || []).map(function (e) {
|
|
69
97
|
return [e.id, e.type, e.anchor, e.label == null ? null : e.label, e.icon == null ? null : e.icon,
|
|
70
98
|
e.color == null ? null : e.color, e.width == null ? null : e.width, e.showText == null ? null : e.showText,
|
|
71
|
-
e.iconSize == null ? null : e.iconSize
|
|
99
|
+
e.iconSize == null ? null : e.iconSize];
|
|
72
100
|
}),
|
|
73
101
|
state.health ? 'health' : null,
|
|
74
102
|
]);
|
|
75
103
|
}
|
|
76
104
|
|
|
105
|
+
/**
|
|
106
|
+
* setTheme, not applyThemeGlobals: the full path also writes the theme's decorations stylesheet, the
|
|
107
|
+
* data-hud-theme attribute and re-applies per-element overrides — applyThemeGlobals alone left the
|
|
108
|
+
* first build on the default theme's decorations and every element with the wrong overrides.
|
|
109
|
+
* Synchronous, so a screenshot right after render() sees the settled theme.
|
|
110
|
+
*/
|
|
111
|
+
function applyRecordedTheme(state) {
|
|
112
|
+
var json = JSON.stringify(state.theme == null ? null : state.theme);
|
|
113
|
+
if (json === lastThemeJson) return;
|
|
114
|
+
if (state.theme) hud.setTheme(state.theme);
|
|
115
|
+
lastThemeJson = json;
|
|
116
|
+
}
|
|
117
|
+
|
|
77
118
|
function buildFrom(state) {
|
|
78
119
|
disposeHud();
|
|
79
120
|
hud = new GameHUD();
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// synchronous, so a screenshot right after render() never catches the HUD mid-theme.
|
|
83
|
-
applyThemeGlobals(state.theme, { manageFontLink: true });
|
|
84
|
-
}
|
|
121
|
+
lastThemeJson = 'null';
|
|
122
|
+
applyRecordedTheme(state);
|
|
85
123
|
(state.elements || []).forEach(createElement);
|
|
86
|
-
if (state.health) hud.showHealth();
|
|
124
|
+
if (state.health) hud.showHealth(state.health.width !== undefined ? { width: state.health.width } : undefined);
|
|
87
125
|
builtKey = structureKey(state);
|
|
88
126
|
}
|
|
89
127
|
|
|
@@ -117,6 +155,128 @@ function createElement(el) {
|
|
|
117
155
|
}
|
|
118
156
|
}
|
|
119
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Mirror the recording's game-authored head stylesheets into this page. These are the selector
|
|
160
|
+
* rules custom-element markup depends on — without them the markup replays with browser-default
|
|
161
|
+
* styling. Synced by id (add/update/remove) rather than rebuilt: CSS applies live, so a sheet change
|
|
162
|
+
* never needs a HUD teardown, which is also why stylesheets stay out of structureKey.
|
|
163
|
+
*/
|
|
164
|
+
function applyStylesheets(state) {
|
|
165
|
+
var wanted = new Map();
|
|
166
|
+
(state.stylesheets || []).forEach(function (sheet) { wanted.set(sheet.id, sheet.css); });
|
|
167
|
+
document.head.querySelectorAll('style[data-hud-replay-sheet]').forEach(function (node) {
|
|
168
|
+
var id = node.dataset.hudReplaySheet;
|
|
169
|
+
if (!wanted.has(id)) { node.remove(); return; }
|
|
170
|
+
var css = wanted.get(id);
|
|
171
|
+
if (node.textContent !== css) node.textContent = css;
|
|
172
|
+
wanted.delete(id);
|
|
173
|
+
});
|
|
174
|
+
wanted.forEach(function (css, id) {
|
|
175
|
+
var node = document.createElement('style');
|
|
176
|
+
node.dataset.hudReplaySheet = id;
|
|
177
|
+
node.textContent = css;
|
|
178
|
+
document.head.appendChild(node);
|
|
179
|
+
});
|
|
180
|
+
enforceTransparentPageBackground();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Keep the page background transparent whatever the captured sheets say.
|
|
185
|
+
*
|
|
186
|
+
* A game's head stylesheet is captured whole, and real ones carry page-level rules — body { background }
|
|
187
|
+
* is ordinary game theming. Injected here it paints the page, and Playwright's omitBackground does
|
|
188
|
+
* NOT override an author background (it only clears the base canvas colour), so every overlay PNG
|
|
189
|
+
* comes out as an opaque full-frame rectangle covering the footage. Measured, not theorised.
|
|
190
|
+
*
|
|
191
|
+
* Two layers, because one is not enough: the harness's own <style> re-appended LAST wins on document
|
|
192
|
+
* order against an equal-specificity rule; the style ATTRIBUTE outranks every author rule regardless
|
|
193
|
+
* of specificity, which "html body { ... !important }" (0,0,2) and ":root { ... !important }" (0,1,0)
|
|
194
|
+
* need, since both beat the harness sheet's "html, body" (0,0,1). Deliberate inline style: the
|
|
195
|
+
* cascade offers nothing else a captured sheet cannot outrank. The background shorthand is required
|
|
196
|
+
* (background-color alone leaves a captured background-image painting), and both the root element and
|
|
197
|
+
* body need it: a :root background propagates to the canvas when body is transparent.
|
|
198
|
+
*/
|
|
199
|
+
function enforceTransparentPageBackground() {
|
|
200
|
+
var override = document.getElementById('hud-replay-transparent');
|
|
201
|
+
if (override && override !== document.head.lastElementChild) document.head.appendChild(override);
|
|
202
|
+
[document.documentElement, document.body].forEach(function (el) {
|
|
203
|
+
el.style.setProperty('background', 'transparent', 'important');
|
|
204
|
+
el.style.setProperty('background-image', 'none', 'important');
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Freeze every animation at a deterministic phase.
|
|
210
|
+
*
|
|
211
|
+
* The CSS kill rule in <head> only reaches normal declarations; a game rule that is itself
|
|
212
|
+
* !important ("#hud-custom-gauge .needle { animation: spin 2s linear infinite !important }") keeps
|
|
213
|
+
* running and screenshots would catch whatever phase wall-clock happened to be at.
|
|
214
|
+
*
|
|
215
|
+
* Phase is time since the animation STARTED, which the harness does not know — so it uses the
|
|
216
|
+
* keyframe at which it first saw the animation as the start (the op that inserted the markup lands
|
|
217
|
+
* at most one keyframe earlier), on the SOURCE clock so a speed ramp keeps footage and motion in
|
|
218
|
+
* lockstep. Animations already present at a clip's first keyframe get absolute source time instead:
|
|
219
|
+
* they began before the clip, and for a loop that is the phase the player saw. The first-seen map
|
|
220
|
+
* is reset per clip because keyframes are rasterized in EDL order, not source order. No paint flush
|
|
221
|
+
* is needed: page.screenshot() forces a commit.
|
|
222
|
+
*/
|
|
223
|
+
var animationStarts = new Map();
|
|
224
|
+
/** The clip the previous render() belonged to; a change resets the first-seen map above. */
|
|
225
|
+
var lastClipIndex = null;
|
|
226
|
+
|
|
227
|
+
function animationKey(animation) {
|
|
228
|
+
var target = animation.effect ? animation.effect.target : null;
|
|
229
|
+
var container = target && target.closest ? target.closest('.hud-element') : null;
|
|
230
|
+
// Index path from the container to the target: several nodes in one container can run the same
|
|
231
|
+
// animation name at different times (a stack of "+100" popups).
|
|
232
|
+
var path = [];
|
|
233
|
+
var node = target;
|
|
234
|
+
while (node && node !== container && node.parentNode) {
|
|
235
|
+
path.unshift(Array.prototype.indexOf.call(node.parentNode.childNodes, node));
|
|
236
|
+
node = node.parentNode;
|
|
237
|
+
}
|
|
238
|
+
return (container ? container.id : '') + '|' + path.join('.') + '|' + animation.animationName;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function freezeMotion(frameTimeMs, clipStart) {
|
|
242
|
+
document.getAnimations().forEach(function (animation) {
|
|
243
|
+
if (typeof CSSTransition !== 'undefined' && animation instanceof CSSTransition) {
|
|
244
|
+
// A transition is a state change in flight, not a point on the replay timeline — land it on
|
|
245
|
+
// its end state. Seeding an early frameTimeMs would freeze it mid-fade instead.
|
|
246
|
+
try { animation.finish(); } catch (e) { animation.cancel(); }
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
var key = animationKey(animation);
|
|
250
|
+
var start = animationStarts.get(key);
|
|
251
|
+
if (start === undefined) {
|
|
252
|
+
start = clipStart ? 0 : frameTimeMs;
|
|
253
|
+
animationStarts.set(key, start);
|
|
254
|
+
}
|
|
255
|
+
// pause() first: assigning currentTime to a running animation only shifts its start time.
|
|
256
|
+
// Seeking a pending animation cancels its pending task and lands it exactly.
|
|
257
|
+
animation.pause();
|
|
258
|
+
animation.currentTime = Math.max(0, frameTimeMs - start);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Show/hide without destroying a recorded display.
|
|
264
|
+
*
|
|
265
|
+
* Blanking display to '' looks harmless but is not: a custom element's css routinely carries
|
|
266
|
+
* "display: flex" (the docs' own example does), and clearing it drops the widget to the UA default
|
|
267
|
+
* block, so a two-column widget replays as two stacked rows. Only ever WRITE 'none', and only clear
|
|
268
|
+
* a 'none' when the state says visible — which the reducer decides from the most recent of the css
|
|
269
|
+
* snapshot's own display and the show/hide ops, in frame order (hud-state.ts), so clearing here
|
|
270
|
+
* happens exactly when the game itself cleared it.
|
|
271
|
+
*/
|
|
272
|
+
function applyVisibility(root, visible) {
|
|
273
|
+
if (visible === false) {
|
|
274
|
+
root.style.display = 'none';
|
|
275
|
+
} else if (root.style.display === 'none') {
|
|
276
|
+
root.style.display = '';
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
120
280
|
function setText(root, selector, value) {
|
|
121
281
|
if (value === undefined || value === null) return;
|
|
122
282
|
var node = root.querySelector(selector);
|
|
@@ -129,7 +289,7 @@ function applyValues(state) {
|
|
|
129
289
|
var element = hud.getElement(el.id);
|
|
130
290
|
if (!element) return;
|
|
131
291
|
var root = element.container;
|
|
132
|
-
root
|
|
292
|
+
applyVisibility(root, el.visible);
|
|
133
293
|
switch (el.type) {
|
|
134
294
|
case 'counter':
|
|
135
295
|
setText(root, '.hud-counter__value', el.text);
|
|
@@ -153,6 +313,13 @@ function applyValues(state) {
|
|
|
153
313
|
}
|
|
154
314
|
case 'custom':
|
|
155
315
|
if (typeof el.html === 'string' && root.innerHTML !== el.html) root.innerHTML = el.html;
|
|
316
|
+
// The recorded container cssText (create-time, and per-update since the recorder started
|
|
317
|
+
// carrying it). cssText overwrites wholesale — including any display captured while the
|
|
318
|
+
// widget was game-hidden — so the show/hide verdict is re-asserted after: it owns visibility.
|
|
319
|
+
if (typeof el.css === 'string' && root.style.cssText !== el.css) {
|
|
320
|
+
root.style.cssText = el.css;
|
|
321
|
+
applyVisibility(root, el.visible);
|
|
322
|
+
}
|
|
156
323
|
break;
|
|
157
324
|
default:
|
|
158
325
|
break;
|
|
@@ -160,7 +327,7 @@ function applyValues(state) {
|
|
|
160
327
|
});
|
|
161
328
|
|
|
162
329
|
if (state.health) {
|
|
163
|
-
hud.showHealth();
|
|
330
|
+
hud.showHealth(state.health.width !== undefined ? { width: state.health.width } : undefined);
|
|
164
331
|
hud.updateHealth(state.health.current, state.health.max);
|
|
165
332
|
var container = document.getElementById('hud-health-container');
|
|
166
333
|
if (container) {
|
|
@@ -174,23 +341,135 @@ function applyValues(state) {
|
|
|
174
341
|
if (hudRoot) hudRoot.style.display = state.hudVisible === false ? 'none' : '';
|
|
175
342
|
}
|
|
176
343
|
|
|
177
|
-
/**
|
|
344
|
+
/**
|
|
345
|
+
* Toasts are transient and stack-managed, and the engine's own showToast arms wall-clock removal
|
|
346
|
+
* timers. The replay owns visibility, so render them as plain toast-classed nodes in fresh stacks
|
|
347
|
+
* each frame — one stack per anchor, with the same newest-top rule and per-toast theme override the
|
|
348
|
+
* engine applies (GameHUD.showToast). Recordings that predate the anchor field land on top-center.
|
|
349
|
+
*/
|
|
178
350
|
function applyToasts(state) {
|
|
179
351
|
document.querySelectorAll('.hud-replay-toasts').forEach(function (stale) { stale.remove(); });
|
|
180
352
|
var toasts = state.toasts || [];
|
|
181
353
|
if (!toasts.length) return;
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
354
|
+
var override = state.theme && state.theme.elements ? state.theme.elements.toast : undefined;
|
|
355
|
+
// Base colours come from the APPLIED theme, exactly as the engine's own applyElementOverride passes
|
|
356
|
+
// this.current.colors: a partial override is resolved against the full palette. Feature-detected —
|
|
357
|
+
// an engine from before this export just gets unthemed toasts, not a dead page.
|
|
358
|
+
var applied = hud.getTheme();
|
|
359
|
+
var applyOverride = typeof hudApi.applyPartialThemeProperties === 'function' ? hudApi.applyPartialThemeProperties : null;
|
|
360
|
+
var stacks = new Map();
|
|
186
361
|
toasts.forEach(function (toast) {
|
|
362
|
+
var anchor = toast.anchor || 'top-center';
|
|
363
|
+
var stack = stacks.get(anchor);
|
|
364
|
+
if (!stack) {
|
|
365
|
+
var anchorEl = document.querySelector('.hud-anchor-' + anchor)
|
|
366
|
+
|| document.querySelector('.hud-anchor-top-center')
|
|
367
|
+
|| document.querySelector('.hud-root');
|
|
368
|
+
if (!anchorEl) return;
|
|
369
|
+
stack = document.createElement('div');
|
|
370
|
+
stack.className = (anchor.indexOf('top') === 0 ? 'hud-toast-stack hud-toast-stack--newest-top' : 'hud-toast-stack') + ' hud-replay-toasts';
|
|
371
|
+
anchorEl.appendChild(stack);
|
|
372
|
+
stacks.set(anchor, stack);
|
|
373
|
+
}
|
|
187
374
|
var node = document.createElement('div');
|
|
188
375
|
node.className = 'hud-element hud-toast';
|
|
189
376
|
node.dataset.kind = toast.variant || 'info';
|
|
190
377
|
node.textContent = toast.message;
|
|
378
|
+
if (override && applied && applyOverride) applyOverride(node, override, applied.colors);
|
|
191
379
|
stack.appendChild(node);
|
|
192
380
|
});
|
|
193
|
-
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Everything render() may have started loading, settled — or 1.5 s, whichever comes first. The
|
|
385
|
+
* screenshot that follows render() must not catch fallback type or a half-loaded image, but a dead
|
|
386
|
+
* URL must not stall the whole raster either, so image outcomes (success AND failure) are memoized:
|
|
387
|
+
* an unreachable image costs its timeout once, not once per keyframe.
|
|
388
|
+
*/
|
|
389
|
+
var settledResources = new Set();
|
|
390
|
+
/** Hrefs whose wait hit the deadline — retried only when they can still help. */
|
|
391
|
+
var timedOutResources = new Set();
|
|
392
|
+
var SETTLE_TIMEOUT_MS = 1500;
|
|
393
|
+
|
|
394
|
+
/** Resolves 'settled' when the work finished, 'timeout' when the deadline won. */
|
|
395
|
+
function withDeadline(promise) {
|
|
396
|
+
var timer = null;
|
|
397
|
+
var deadline = new Promise(function (resolve) { timer = setTimeout(function () { resolve('timeout'); }, SETTLE_TIMEOUT_MS); });
|
|
398
|
+
return Promise.race([Promise.resolve(promise).then(function () { return 'settled'; }), deadline])
|
|
399
|
+
.finally(function () { if (timer !== null) clearTimeout(timer); });
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function collectCssImageUrls() {
|
|
403
|
+
var urls = [];
|
|
404
|
+
var pattern = /url\\(\\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\\s*\\)/g;
|
|
405
|
+
document.querySelectorAll('.hud-root, .hud-root *').forEach(function (node) {
|
|
406
|
+
var style = getComputedStyle(node);
|
|
407
|
+
['background-image', 'border-image-source'].forEach(function (prop) {
|
|
408
|
+
var value = style.getPropertyValue(prop);
|
|
409
|
+
if (!value || value === 'none') return;
|
|
410
|
+
var match;
|
|
411
|
+
while ((match = pattern.exec(value)) !== null) {
|
|
412
|
+
var url = match[1] || match[2] || match[3] || '';
|
|
413
|
+
if (url && url.indexOf('data:') !== 0) urls.push(url);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
return urls;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function settle() {
|
|
421
|
+
var waits = [];
|
|
422
|
+
|
|
423
|
+
// The font is keyed off the LIVE link's readiness, not a per-href memo: a deadline win means the
|
|
424
|
+
// font is slow, not absent (memoizing it would leave keyframe 0 on fallback type and every later
|
|
425
|
+
// one on the real face — a visible swap mid-trailer), and every structural rebuild disposes the
|
|
426
|
+
// HUD, which removes this link and creates a fresh one at the same href that has yet to parse.
|
|
427
|
+
// Only a genuine timeout is remembered, so a truly dead font costs 1.5 s once, not per keyframe.
|
|
428
|
+
var fontLink = document.getElementById('hud-active-font');
|
|
429
|
+
if (fontLink && !fontLink.sheet && !timedOutResources.has(fontLink.href)) {
|
|
430
|
+
var href = fontLink.href;
|
|
431
|
+
waits.push(withDeadline(new Promise(function (resolve) {
|
|
432
|
+
fontLink.addEventListener('load', resolve, { once: true });
|
|
433
|
+
fontLink.addEventListener('error', resolve, { once: true });
|
|
434
|
+
}).then(function () { return document.fonts.ready; })).then(function (outcome) {
|
|
435
|
+
if (outcome === 'timeout') timedOutResources.add(href);
|
|
436
|
+
}));
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
document.querySelectorAll('.hud-root img').forEach(function (img) {
|
|
440
|
+
var src = img.currentSrc || img.src;
|
|
441
|
+
if (!src || src.indexOf('data:') === 0 || settledResources.has(src)) return;
|
|
442
|
+
waits.push(withDeadline(img.decode().catch(function () {})).then(function () { settledResources.add(src); }));
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
collectCssImageUrls().forEach(function (url) {
|
|
446
|
+
if (settledResources.has(url)) return;
|
|
447
|
+
waits.push(withDeadline(new Promise(function (resolve) {
|
|
448
|
+
var probe = new Image();
|
|
449
|
+
probe.onload = resolve;
|
|
450
|
+
probe.onerror = resolve;
|
|
451
|
+
probe.src = url;
|
|
452
|
+
})).then(function () { settledResources.add(url); }));
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// Fonts the injected game sheets bring in (@font-face, @import) load lazily once text using them
|
|
456
|
+
// is styled — the computed-style walk above just forced that — and only document.fonts.ready
|
|
457
|
+
// knows about them. Free when nothing is loading. A face that never arrives is remembered by
|
|
458
|
+
// family after one deadline, or every keyframe would pay the full timeout for it.
|
|
459
|
+
var unresolved = [];
|
|
460
|
+
document.fonts.forEach(function (face) {
|
|
461
|
+
if (face.status === 'loading' && !timedOutResources.has('font-family:' + face.family)) unresolved.push(face.family);
|
|
462
|
+
});
|
|
463
|
+
if (unresolved.length || document.fonts.status === 'loading') {
|
|
464
|
+
waits.push(withDeadline(document.fonts.ready).then(function (outcome) {
|
|
465
|
+
if (outcome !== 'timeout') return;
|
|
466
|
+
document.fonts.forEach(function (face) {
|
|
467
|
+
if (face.status === 'loading') timedOutResources.add('font-family:' + face.family);
|
|
468
|
+
});
|
|
469
|
+
}));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return waits.length ? Promise.all(waits).then(function () { return true; }) : Promise.resolve(true);
|
|
194
473
|
}
|
|
195
474
|
|
|
196
475
|
window.__hudReplay = {
|
|
@@ -198,18 +477,34 @@ window.__hudReplay = {
|
|
|
198
477
|
document.body.style.width = width + 'px';
|
|
199
478
|
document.body.style.height = height + 'px';
|
|
200
479
|
},
|
|
201
|
-
render: function (state) {
|
|
480
|
+
render: function (state, frameTimeMs, clipIndex) {
|
|
481
|
+
var clipStart = clipIndex !== lastClipIndex;
|
|
482
|
+
if (clipStart) {
|
|
483
|
+
lastClipIndex = clipIndex;
|
|
484
|
+
animationStarts.clear();
|
|
485
|
+
}
|
|
202
486
|
var key = structureKey(state);
|
|
203
|
-
if (!hud || key !== builtKey)
|
|
487
|
+
if (!hud || key !== builtKey) {
|
|
488
|
+
buildFrom(state);
|
|
489
|
+
} else {
|
|
490
|
+
// A theme change without a structure change (mid-recording setTheme) must not force a
|
|
491
|
+
// rebuild — setTheme re-applies the overrides on the live elements itself.
|
|
492
|
+
applyRecordedTheme(state);
|
|
493
|
+
}
|
|
494
|
+
applyStylesheets(state);
|
|
204
495
|
applyValues(state);
|
|
205
496
|
applyToasts(state);
|
|
497
|
+
// Last: every step above can create elements, and a replaced element brings a fresh running animation.
|
|
498
|
+
freezeMotion(typeof frameTimeMs === 'number' ? frameTimeMs : 0, clipStart);
|
|
206
499
|
return true;
|
|
207
500
|
},
|
|
501
|
+
settle: settle,
|
|
208
502
|
};
|
|
209
503
|
|
|
210
504
|
// Build an empty HUD up front so the first render() has styles injected and the anchor grid in place.
|
|
211
505
|
hud = new GameHUD();
|
|
212
506
|
builtKey = structureKey({ elements: [] });
|
|
507
|
+
enforceTransparentPageBackground();
|
|
213
508
|
window.__hudReplayReady = true;
|
|
214
509
|
</script>
|
|
215
510
|
</body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hud-replay-page.js","sourceRoot":"","sources":["../../src/editor/hud-replay-page.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hud-replay-page.js","sourceRoot":"","sources":["../../src/editor/hud-replay-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO1D,oGAAoG;AACpG,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,MAAM,GAAG,oBAAoB,QAAQ,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CACvF,CAAC;IACF,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrD,OAAO;;;;;;+BAMsB,OAAO,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;EAmB7C,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2brC,CAAC;AACF,CAAC"}
|
package/dist/render/qr-png.d.ts
CHANGED
|
@@ -15,11 +15,14 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Two other hand-rolled PNG encoders exist in this repo — `world-forger-internal`'s vehicle atlas
|
|
17
17
|
* and `game-play-agent`'s solid-colour tile — and neither is reachable from here: the first is in a
|
|
18
|
-
* `private: true` package the CLI does not depend on, the second is server code.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `private: true` package the CLI does not depend on, the second is server code. Within the CLI the
|
|
19
|
+
* chunk/CRC/signature primitives are exported from here and shared with the trailer's transparent
|
|
20
|
+
* frame filler (trailer/video-chain.ts); `ios/icon.ts` predates that and keeps its own.
|
|
21
21
|
*/
|
|
22
22
|
import { Buffer } from 'buffer';
|
|
23
|
+
export declare const PNG_SIGNATURE: Buffer<ArrayBuffer>;
|
|
24
|
+
/** One PNG chunk: length, type, data, and the CRC over type+data (never over the length). */
|
|
25
|
+
export declare function pngChunk(type: string, data: Buffer): Buffer;
|
|
23
26
|
export interface QrPngOptions {
|
|
24
27
|
/** Pixels per module. Defaults to `MODULE_PIXELS`. */
|
|
25
28
|
scale?: number;
|
package/dist/render/qr-png.js
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Two other hand-rolled PNG encoders exist in this repo — `world-forger-internal`'s vehicle atlas
|
|
17
17
|
* and `game-play-agent`'s solid-colour tile — and neither is reachable from here: the first is in a
|
|
18
|
-
* `private: true` package the CLI does not depend on, the second is server code.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `private: true` package the CLI does not depend on, the second is server code. Within the CLI the
|
|
19
|
+
* chunk/CRC/signature primitives are exported from here and shared with the trailer's transparent
|
|
20
|
+
* frame filler (trailer/video-chain.ts); `ios/icon.ts` predates that and keeps its own.
|
|
21
21
|
*/
|
|
22
22
|
import { Buffer } from 'buffer';
|
|
23
23
|
import * as zlib from 'zlib';
|
|
@@ -28,7 +28,7 @@ const MODULE_PIXELS = 8;
|
|
|
28
28
|
* uses — that one is trading margin for terminal columns, and a file has no such constraint.
|
|
29
29
|
*/
|
|
30
30
|
const QUIET_MODULES = 4;
|
|
31
|
-
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
31
|
+
export const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
32
32
|
/** The standard CRC-32 table (PNG spec annex D), built once. */
|
|
33
33
|
function buildCrcTable() {
|
|
34
34
|
const table = new Uint32Array(256);
|
|
@@ -50,7 +50,7 @@ function crc32(bytes) {
|
|
|
50
50
|
return (crc ^ 0xffffffff) >>> 0;
|
|
51
51
|
}
|
|
52
52
|
/** One PNG chunk: length, type, data, and the CRC over type+data (never over the length). */
|
|
53
|
-
function
|
|
53
|
+
export function pngChunk(type, data) {
|
|
54
54
|
const length = Buffer.alloc(4);
|
|
55
55
|
length.writeUInt32BE(data.length, 0);
|
|
56
56
|
const typeAndData = Buffer.concat([Buffer.from(type, 'ascii'), data]);
|
|
@@ -101,11 +101,11 @@ export function encodeQrPng(matrix, options = {}) {
|
|
|
101
101
|
ihdr[12] = 0; // interlace: none
|
|
102
102
|
return Buffer.concat([
|
|
103
103
|
PNG_SIGNATURE,
|
|
104
|
-
|
|
104
|
+
pngChunk('IHDR', ihdr),
|
|
105
105
|
// deflateSync, not fflate's — fflate's `deflateSync` emits RAW deflate with no zlib header,
|
|
106
106
|
// and an IDAT must carry the zlib wrapper. (fflate's `zlibSync` would also do.)
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
pngChunk('IDAT', zlib.deflateSync(raw)),
|
|
108
|
+
pngChunk('IEND', Buffer.alloc(0)),
|
|
109
109
|
]);
|
|
110
110
|
}
|
|
111
111
|
//# sourceMappingURL=qr-png.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr-png.js","sourceRoot":"","sources":["../../src/render/qr-png.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,2FAA2F;AAC3F,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"qr-png.js","sourceRoot":"","sources":["../../src/render/qr-png.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,2FAA2F;AAC3F,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,MAAM,CAAC,MAAM,aA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hC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,aAAa;QACb,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;QACtB,4FAA4F;QAC5F,gFAAgF;QAChF,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAClC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -256,6 +256,7 @@ The creator talks; you edit \`trailer/shots.json\`, run \`bitmagic trailer make\
|
|
|
256
256
|
| "add a title at the start" | a \`title\`-style cue at \`at: 0\` for ~2.5 s, and make the first shot calm enough to read over |
|
|
257
257
|
| "different music", "more epic / chill" | \`--music-prompt\` with the new direction (spends sparks), or \`--music <file>\`; shots keep their beat counts and re-snap |
|
|
258
258
|
| "no HUD" / "show the HUD" | drop or add \`--ui\` (per shot: \`"ui": false\`) |
|
|
259
|
+
| "the HUD stutters" / "smoother HUD" | raise \`--ui-keyframe-rate\` on \`make\` or \`render\` (default 30/s; 0 = every change) |
|
|
259
260
|
| "shorter / longer" | \`--seconds N\` only matters for a fresh auto cut (\`--reset-shots\`); otherwise add or remove shots |
|
|
260
261
|
| "start over" | \`bitmagic trailer make --reset-shots\` |
|
|
261
262
|
| "use the other recording" | \`--recording <dir>\`; shots.json from another recording is kept beside a fresh cut |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-files.js","sourceRoot":"","sources":["../../src/scaffold/skill-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;;;;;;;;;;;CAkBR,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,SAAS,EAAE,S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frame. */
|
|
9
9
|
outDir: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* CSS-pixel viewport the HUD lays out against — the recorded window's
|
|
12
|
+
* aspect-corrected size when the manifest carries one, else the recording
|
|
13
|
+
* resolution (see computeRasterGeometry in hud-state.ts).
|
|
14
|
+
*/
|
|
11
15
|
width: number;
|
|
12
16
|
height: number;
|
|
17
|
+
/** PNG pixels per CSS pixel; >1 keeps overlays at/above the recording size. */
|
|
18
|
+
deviceScaleFactor: number;
|
|
13
19
|
}
|
|
14
20
|
export declare function uiPngPath(outDir: string, index: number): string;
|
|
15
21
|
/**
|
|
16
22
|
* Render one transparent PNG per keyframe, reusing a single browser + page.
|
|
17
|
-
* Returns paths in keyframe order
|
|
18
|
-
* (
|
|
23
|
+
* Returns paths in keyframe order — a slot is null when that one keyframe
|
|
24
|
+
* failed (the caller holds the previous overlay across its window) — or null
|
|
25
|
+
* overall when UI must be skipped entirely (no Chrome, harness unreachable, the
|
|
26
|
+
* page died mid-run, or every keyframe failed).
|
|
19
27
|
*/
|
|
20
|
-
export declare function rasterizeUiKeyframes(keyframes: readonly UiKeyframe[], options: RasterizeOptions): Promise<string
|
|
21
|
-
/**
|
|
22
|
-
* Width/height straight out of a PNG's IHDR chunk, so the filtergraph only
|
|
23
|
-
* pays for a scale filter when the overlay really is the wrong size.
|
|
24
|
-
*/
|
|
25
|
-
export declare function readPngSize(filePath: string): {
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
} | null;
|
|
28
|
+
export declare function rasterizeUiKeyframes(keyframes: readonly UiKeyframe[], options: RasterizeOptions): Promise<Array<string | null> | null>;
|