@johnoscott/isometric-engine 0.16.0 → 0.17.1
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 +7 -1
- package/iso-editor.js +157 -154
- package/iso-remotion.js +353 -0
- package/iso-render.js +120 -117
- package/iso-systems.js +114 -111
- package/isometric-diagram.js +105 -102
- package/js/iso-core/arimo.js +5 -0
- package/js/iso-core/arimo.json +1 -0
- package/js/iso-core/index.js +3 -2
- package/js/iso-core/kernel.js +13 -2
- package/js/iso-objects/timeline.js +14 -6
- package/js/iso-systems/compile.js +13 -6
- package/js/iso-viewer/play.js +43 -8
- package/package.json +23 -1
- package/src/iso-core/arimo.json +1 -0
- package/src/iso-core/arimo.ts +6 -0
- package/src/iso-core/index.ts +1 -1
- package/src/iso-core/kernel.ts +11 -1
- package/src/iso-objects/timeline.ts +10 -2
- package/src/iso-systems/compile.ts +12 -6
- package/src/iso-viewer/play.ts +37 -9
- package/types/iso-core/arimo.d.ts +2 -0
- package/types/iso-core/index.d.ts +1 -1
- package/types/iso-core/kernel.d.ts +9 -0
- package/types/iso-objects/timeline.d.ts +4 -1
- package/types/iso-systems/compile.d.ts +3 -0
- package/types/iso-viewer/play.d.ts +2 -2
- package/types/remotion/entry.d.ts +2 -0
- package/types/remotion/frames.d.ts +71 -0
- package/types/remotion/index.d.ts +39 -0
package/src/iso-viewer/play.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface PlayerOptions {
|
|
|
24
24
|
loop?: boolean;
|
|
25
25
|
rate?: number;
|
|
26
26
|
ambient?: 'on' | 'off';
|
|
27
|
-
/** a reader who asked for less motion (default 'ignore': motion plays). 'respect': the last state, everything lit, the ambient off, until they press Play */
|
|
27
|
+
/** a reader who asked for less motion (default 'ignore': motion plays, and they get a Motion off button). 'respect': the last state, everything lit, the ambient off, until they press Play */
|
|
28
28
|
reducedMotion?: 'ignore' | 'respect';
|
|
29
29
|
mode?: 'light' | 'dark';
|
|
30
30
|
/** the timeline is the drawing's own steps (motionOfSteps): its callouts and marks show at their step, and the other steps' numbers dim */
|
|
@@ -74,8 +74,9 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
74
74
|
let scene = o.scene, svg = svgOf(scene.rendered.svg), frozen: number | undefined, stepTo: number | undefined, userPaused = false, gone = false;
|
|
75
75
|
const tr = transport(o.timeline ?? NOTHING, { loop: o.loop, rate: o.rate, ambient: o.ambient, clock: o.clock });
|
|
76
76
|
const controls = o.controls ?? true;
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const asked = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches, calm = asked && o.reducedMotion === 'respect';
|
|
78
|
+
/** off: the reader pressed Motion off, and nothing moves, whoever asks it to */
|
|
79
|
+
let resting = calm, off = false, inView = true;
|
|
79
80
|
|
|
80
81
|
// ---- the parts ----
|
|
81
82
|
const btn = (cls: string, label: string, text: string, f: () => void) => h('button', { type: 'button', class: `iso-play-btn ${cls}`, 'aria-label': label, title: label, on: { click: f as EventListener } }, text);
|
|
@@ -83,8 +84,11 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
83
84
|
const back = btn('back', 'Back', '‹', () => byHand(() => step(Math.max(0, at() - 1))));
|
|
84
85
|
const play = btn('play', 'Play', '▶', () => toggle());
|
|
85
86
|
const next = btn('next', 'Next', '›', () => byHand(() => step(Math.min(tr.timeline.beats.length - 1, at() + 1))));
|
|
86
|
-
const again = btn('again', 'Reset', '↺', () => byHand(() => { stop(); tr.restart(); }));
|
|
87
|
+
const again = btn('again', 'Reset', '↺', () => byHand(() => { stop(); if (off) tr.seek(0); else tr.restart(); }));
|
|
87
88
|
const amb = btn('ambient', 'Ambient motion', '∿', () => { wake(); tr.ambient = !tr.ambient; show(); });
|
|
89
|
+
// a reader who asked their machine for less motion: it plays, as for anybody, and they get this (docs/design/MOTION.md, 6.2)
|
|
90
|
+
const still = btn('still', 'Motion off', 'Motion off', () => setOff(!off));
|
|
91
|
+
still.title = 'Draw everything in place, with nothing moving';
|
|
88
92
|
const bar = h('input', { type: 'range', class: 'iso-play-bar', min: 0, step: 1, 'aria-label': 'Time', on: { input: (() => byHand(() => { stop(); tr.seek(Number(bar.value)); })) as EventListener } });
|
|
89
93
|
const time = h('span', { class: 'iso-play-time' });
|
|
90
94
|
const dots = h('div', { class: 'iso-play-dots' });
|
|
@@ -92,9 +96,9 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
92
96
|
const text = h('div', { class: 'iso-play-text' }), code = h('pre', { class: 'iso-play-code' }), facts = h('dl', { class: 'iso-play-facts' });
|
|
93
97
|
const say = h('div', { class: 'iso-play-say', 'aria-live': 'polite' }, h('div', { class: 'iso-play-head' }, num, title, chapter, count), text, code, facts);
|
|
94
98
|
const list = h('details', { class: 'iso-play-list' });
|
|
95
|
-
const row = h('div', { class: 'iso-play-row' }, back, play, next, again, amb, bar, time);
|
|
99
|
+
const row = h('div', { class: 'iso-play-row' }, back, play, next, again, amb, still, bar, time), alone = h('div', { class: 'iso-play-row' });
|
|
96
100
|
const root = h('div', { class: 'iso-play', role: 'group', 'aria-roledescription': 'animated diagram', 'aria-label': o.label ?? 'Diagram', tabindex: controls ? 0 : undefined, 'data-mode': o.mode ?? 'light' },
|
|
97
|
-
stage, controls
|
|
101
|
+
stage, controls ? row : alone, controls && dots, controls && say, controls && list);
|
|
98
102
|
host.append(root);
|
|
99
103
|
|
|
100
104
|
// ---- what there is to show: the beats ----
|
|
@@ -113,6 +117,9 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
113
117
|
for (const el of [back, next, dots]) el.hidden = !some;
|
|
114
118
|
say.hidden = !said; list.hidden = !said;
|
|
115
119
|
amb.hidden = !tr.timeline.loops;
|
|
120
|
+
still.hidden = !asked || calm || (tr.duration <= 0 && !tr.timeline.loops) || (!controls && !o.autoplay && !tr.timeline.loops);
|
|
121
|
+
alone.hidden = still.hidden;
|
|
122
|
+
if (!controls && !still.hidden) alone.append(still);
|
|
116
123
|
bar.max = String(Math.round(tr.duration));
|
|
117
124
|
for (const el of [play, again, bar, time]) el.hidden = tr.duration <= 0;
|
|
118
125
|
told = undefined;
|
|
@@ -153,7 +160,7 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
153
160
|
dotOf.forEach((d, i) => { d.classList.toggle('on', i === b?.index); d.classList.toggle('done', b !== undefined && i < b.index); if (i === b?.index) d.setAttribute('aria-current', 'step'); else d.removeAttribute('aria-current'); });
|
|
154
161
|
}
|
|
155
162
|
function show() {
|
|
156
|
-
const S = frozen !== undefined ? tr.timeline.at(frozen, { ambient: frozen }) : resting ? lit(tr.timeline.at(tr.duration, { ambient: 'off' })) : tr.state();
|
|
163
|
+
const S = frozen !== undefined ? tr.timeline.at(frozen, { ambient: frozen }) : resting ? lit(tr.timeline.at(tr.duration, { ambient: 'off' })) : off ? tr.timeline.at(tr.time, { ambient: 'off' }) : tr.state();
|
|
157
164
|
paint(svg, S, scene.rendered, { styles: 'cssom' });
|
|
158
165
|
root.dataset.time = String(Math.round(frozen ?? tr.time));
|
|
159
166
|
if (frozen !== undefined) marks(tr.timeline.beatAt(frozen)); else caption();
|
|
@@ -169,6 +176,8 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
169
176
|
amb.setAttribute('aria-pressed', String(tr.ambient));
|
|
170
177
|
say.setAttribute('aria-live', on ? 'off' : 'polite');
|
|
171
178
|
root.dataset.playing = String(on);
|
|
179
|
+
still.setAttribute('aria-pressed', String(off));
|
|
180
|
+
play.disabled = off; amb.disabled = off;
|
|
172
181
|
}
|
|
173
182
|
|
|
174
183
|
// ---- playing ----
|
|
@@ -180,6 +189,19 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
180
189
|
/** the reader did it: an autoplay doesn't start again by itself */
|
|
181
190
|
function byHand(f: () => void) { wake(); userPaused = true; f(); buttons(); show(); }
|
|
182
191
|
function stop() { stepTo = undefined; tr.pause(); }
|
|
192
|
+
/** off: everything in place and lit, nothing moving, the steps open as text; on again: from the first step, playing if it began by itself */
|
|
193
|
+
function setOff(v: boolean) {
|
|
194
|
+
if (gone || v === off) return;
|
|
195
|
+
off = v; resting = v; told = undefined;
|
|
196
|
+
stop();
|
|
197
|
+
tr.active = inView && !off;
|
|
198
|
+
tr.seek(off ? tr.duration : 0);
|
|
199
|
+
if (off) list.open = true;
|
|
200
|
+
marks(tr.beat);
|
|
201
|
+
buttons(); show();
|
|
202
|
+
if (!off && o.autoplay === true && !userPaused) tr.play();
|
|
203
|
+
pick();
|
|
204
|
+
}
|
|
183
205
|
function step(i: number) {
|
|
184
206
|
const b = tr.timeline.beats[i];
|
|
185
207
|
if (!b || gone) return;
|
|
@@ -188,9 +210,12 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
188
210
|
const nextStart = tr.timeline.beats[i + 1]?.start ?? Infinity;
|
|
189
211
|
// through the beat, and to a stop within it (its end is the next one's start)
|
|
190
212
|
stepTo = Math.max(b.start, Math.min(b.end, nextStart, tr.duration) - 1);
|
|
213
|
+
// off: the step as it is when it is over, and no way there
|
|
214
|
+
if (off) { const to = stepTo; stepTo = undefined; tr.seek(to); return; }
|
|
191
215
|
tr.play({ until: stepTo });
|
|
192
216
|
}
|
|
193
217
|
function toggle() {
|
|
218
|
+
if (off) return;
|
|
194
219
|
wake();
|
|
195
220
|
if (going()) { userPaused = true; stop(); } else { userPaused = false; stepTo = undefined; tr.pause(); tr.play(); }
|
|
196
221
|
buttons(); show();
|
|
@@ -216,10 +241,10 @@ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): P
|
|
|
216
241
|
// ---- in view: neither clock moves for a player nobody can see; one that autoplays in view is one at a time ----
|
|
217
242
|
const me = {
|
|
218
243
|
seen: 0, wants: o.autoplay === 'visible' && !calm,
|
|
219
|
-
auto(on: boolean) { if (on) { if (!userPaused && !going()) { stepTo = undefined; tr.play(); } } else if (going()) { stepTo = undefined; tr.pause(); } },
|
|
244
|
+
auto(on: boolean) { if (on) { if (!off && !userPaused && !going()) { stepTo = undefined; tr.play(); } } else if (going()) { stepTo = undefined; tr.pause(); } },
|
|
220
245
|
};
|
|
221
246
|
mounted.set(root, me);
|
|
222
|
-
const io = typeof IntersectionObserver === 'function' ? new IntersectionObserver(es => { for (const e of es) { me.seen = e.isIntersecting ? e.intersectionRatio : 0; if (frozen === undefined) tr.active =
|
|
247
|
+
const io = typeof IntersectionObserver === 'function' ? new IntersectionObserver(es => { for (const e of es) { me.seen = e.isIntersecting ? e.intersectionRatio : 0; inView = e.isIntersecting; if (frozen === undefined) tr.active = inView && !off; } pick(); }, { threshold: [0, 0.2, 0.35, 0.5, 0.7, 0.9, 1] }) : undefined;
|
|
223
248
|
io?.observe(root);
|
|
224
249
|
|
|
225
250
|
beats(); buttons(); show();
|
|
@@ -254,6 +279,9 @@ export const PLAY_CSS = `
|
|
|
254
279
|
.iso-play-btn:hover{border-color:var(--ip-muted)}
|
|
255
280
|
.iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}
|
|
256
281
|
.iso-play-btn.ambient[aria-pressed="false"]{color:var(--ip-muted);text-decoration:line-through}
|
|
282
|
+
.iso-play-btn.still{font-size:12px;white-space:nowrap}
|
|
283
|
+
.iso-play-btn.still[aria-pressed="true"]{background:var(--ip-ink);color:var(--ip-bg)}
|
|
284
|
+
.iso-play-btn:disabled{opacity:.4;cursor:default}
|
|
257
285
|
.iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}
|
|
258
286
|
.iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
|
|
259
287
|
.iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S, C, iso, n1, pt, esc, tag, FONTS, textWidth, apply, matStr, faceFrame, Bounds, Kernel, center } from './kernel.js';
|
|
1
|
+
export { S, C, iso, n1, pt, esc, tag, FONTS, textWidth, withFont, apply, matStr, faceFrame, Bounds, Kernel, center } from './kernel.js';
|
|
2
2
|
export type { P2, P3, Box, Attrs, FontKey, Font, Mat, Face, TextRect } from './kernel.js';
|
|
3
3
|
export { termLines, envelope, bubble, fileLines, keyGlyph, socketGlyph, screenFaces, screenGlass, placeholderFace } from './glyphs.js';
|
|
4
4
|
export type { FacePainter } from './glyphs.js';
|
|
@@ -63,6 +63,15 @@ export declare const FONTS: {
|
|
|
63
63
|
size: number;
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
+
/** Another font's widths, by its name: never the default, and a drawing laid out with it says so. What it has no table for is the default's. */
|
|
67
|
+
export interface FontTable {
|
|
68
|
+
name: string; /** its font-family, with what stands in for it */
|
|
69
|
+
sans: string; /** the mono text's, when it has one */
|
|
70
|
+
mono?: string;
|
|
71
|
+
widths: Partial<Record<FontKey, Record<string, number>>>;
|
|
72
|
+
}
|
|
73
|
+
/** runs `fn` (now: it may not wait for anything) with its text measured as that font's */
|
|
74
|
+
export declare function withFont<T>(f: FontTable | undefined, fn: () => T): T;
|
|
66
75
|
export declare function textWidth(str: string, f: Font): number;
|
|
67
76
|
/** [a b c d e f] as in SVG matrix(): x' = a x + c y + e, y' = b x + d y + f */
|
|
68
77
|
export type Mat = [number, number, number, number, number, number];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CompiledScene } from './compile.js';
|
|
2
2
|
import { antsOf } from './ants.js';
|
|
3
3
|
import { type MotionModel, type SceneState } from './motion.js';
|
|
4
|
-
import { type MotionDiag, type MotionDoc, type Say } from './motion-doc.js';
|
|
4
|
+
import { type MotionDiag, type MotionDoc, type Say, type Transition } from './motion-doc.js';
|
|
5
5
|
export interface BeatInfo {
|
|
6
6
|
name: string;
|
|
7
7
|
index: number;
|
|
@@ -62,5 +62,8 @@ export interface MotionSource {
|
|
|
62
62
|
}
|
|
63
63
|
export declare function motionSource(scene: CompiledScene): MotionSource;
|
|
64
64
|
export declare function bindMotion(drawing: CompiledScene | MotionSource, doc: MotionDoc, opts?: BindOptions): Timeline;
|
|
65
|
+
/** how long a transition is, ms, and how far it is in at t of them */
|
|
66
|
+
export declare const transitionMs: (g: Transition['timing'], fps?: number) => number;
|
|
67
|
+
export declare function transitionAt(g: Transition['timing'], t: number, length: number): number;
|
|
65
68
|
/** A drawing's own steps as a motion document, so that every drawing with steps has a timeline. */
|
|
66
69
|
export declare function motionOfSteps(scene: CompiledScene): MotionDoc;
|
|
@@ -2,6 +2,7 @@ import type { Diag } from '../iso-core/errors.js';
|
|
|
2
2
|
import { type Compiled } from '../iso-objects/compile.js';
|
|
3
3
|
import { type ThemeMode } from '../iso-objects/resolve.js';
|
|
4
4
|
import type { MonoTable } from '../iso-core/mono.js';
|
|
5
|
+
import { type FontTable } from '../iso-core/kernel.js';
|
|
5
6
|
export type { Compiled, CompiledScene } from '../iso-objects/compile.js';
|
|
6
7
|
export interface CompileOptions {
|
|
7
8
|
/** overrides every scene's grid snap (the editor's snap control) */
|
|
@@ -15,6 +16,8 @@ export interface CompileOptions {
|
|
|
15
16
|
treatment?: 'mono' | 'none';
|
|
16
17
|
/** a host's own table, over the treatment's */
|
|
17
18
|
mono?: MonoTable;
|
|
19
|
+
/** (0.17.0) a self-contained drawing laid out with another font's widths (Arimo's: modules/iso-core/arimo), and asking for it. The host loads the font */
|
|
20
|
+
font?: FontTable;
|
|
18
21
|
/** a file with an error draws nothing: `scenes` is empty (true), or it throws ('throw'). Default: what could be laid
|
|
19
22
|
* out is in `scenes` all the same, with `ok` false */
|
|
20
23
|
strict?: boolean | 'throw';
|
|
@@ -14,7 +14,7 @@ export interface PlayerOptions {
|
|
|
14
14
|
loop?: boolean;
|
|
15
15
|
rate?: number;
|
|
16
16
|
ambient?: 'on' | 'off';
|
|
17
|
-
/** a reader who asked for less motion (default 'ignore': motion plays). 'respect': the last state, everything lit, the ambient off, until they press Play */
|
|
17
|
+
/** a reader who asked for less motion (default 'ignore': motion plays, and they get a Motion off button). 'respect': the last state, everything lit, the ambient off, until they press Play */
|
|
18
18
|
reducedMotion?: 'ignore' | 'respect';
|
|
19
19
|
mode?: 'light' | 'dark';
|
|
20
20
|
/** the timeline is the drawing's own steps (motionOfSteps): its callouts and marks show at their step, and the other steps' numbers dim */
|
|
@@ -34,4 +34,4 @@ export interface Player {
|
|
|
34
34
|
}
|
|
35
35
|
export declare function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): Player;
|
|
36
36
|
/** The player's stylesheet: its own, under one class; the colours are custom properties a host may set. */
|
|
37
|
-
export declare const PLAY_CSS = "\n.iso-play{--ip-ink:#1c2026;--ip-muted:#68707c;--ip-line:#dfe3e8;--ip-bg:#fff;--ip-code:#f2f4f7;--ip-focus:#2a64d6;container:iso-play/inline-size;display:block;color:var(--ip-ink);background:var(--ip-bg);font:14px/1.5 system-ui,-apple-system,\"Segoe UI\",sans-serif;border-radius:10px}\n.iso-play[data-mode=\"dark\"]{--ip-ink:#e6e9ee;--ip-muted:#98a1ae;--ip-line:#333a44;--ip-bg:#15181d;--ip-code:#1f242b;--ip-focus:#7aa7ff;color-scheme:dark}\n.iso-play:focus-visible,.iso-play button:focus-visible,.iso-play input:focus-visible,.iso-play summary:focus-visible{outline:2px solid var(--ip-focus);outline-offset:2px}\n.iso-play [hidden]{display:none}\n.iso-play-stage svg{display:block;width:100%;height:auto}\n.iso-play-stage [data-go]{cursor:pointer}\n.iso-play-row{display:flex;align-items:center;gap:6px;padding:8px 12px 4px}\n.iso-play-btn{font:inherit;min-width:32px;height:32px;padding:0 8px;border:1px solid var(--ip-line);border-radius:8px;background:none;color:inherit;cursor:pointer}\n.iso-play-btn:hover{border-color:var(--ip-muted)}\n.iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}\n.iso-play-btn.ambient[aria-pressed=\"false\"]{color:var(--ip-muted);text-decoration:line-through}\n.iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}\n.iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}\n.iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}\n.iso-play-group{display:inline-flex;gap:0}\n.iso-play-dot{width:24px;height:24px;padding:0;border:0;background:none;cursor:pointer;display:grid;place-items:center}\n.iso-play-dot::before{content:\"\";width:9px;height:9px;border-radius:50%;background:var(--ip-line)}\n.iso-play-dot.done::before{background:var(--ip-muted)}\n.iso-play-dot.on::before{background:var(--ip-ink);width:11px;height:11px}\n.iso-play-say{padding:4px 12px 10px;min-height:5.2em}\n.iso-play-head{display:flex;align-items:baseline;gap:8px;font-weight:700}\n.iso-play-num{flex:none;display:inline-grid;place-items:center;min-width:22px;height:22px;border-radius:11px;background:var(--ip-ink);color:var(--ip-bg);font-size:11px;align-self:center}\n.iso-play-chapter,.iso-play-count{color:var(--ip-muted);font-size:12px;font-weight:500}\n.iso-play-count{margin-left:auto;white-space:nowrap}\n.iso-play-text{max-width:80ch}\n.iso-play-text a{color:inherit}\n.iso-play-code{margin:6px 0 0;padding:6px 10px;border-radius:8px;background:var(--ip-code);font:12px/1.5 ui-monospace,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}\n.iso-play-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 0;font-size:12px}\n.iso-play-facts dt{color:var(--ip-muted)}\n.iso-play-facts dd{margin:0 8px 0 -10px;font-weight:600}\n.iso-play-list{padding:0 12px 10px;font-size:13px}\n.iso-play-list summary{color:var(--ip-muted);cursor:pointer}\n.iso-play.frozen>:not(.iso-play-stage){display:none}\n@container iso-play (max-width:420px){.iso-play-time{display:none}.iso-play-row{flex-wrap:wrap}.iso-play-bar{flex-basis:100%;order:9}}\n";
|
|
37
|
+
export declare const PLAY_CSS = "\n.iso-play{--ip-ink:#1c2026;--ip-muted:#68707c;--ip-line:#dfe3e8;--ip-bg:#fff;--ip-code:#f2f4f7;--ip-focus:#2a64d6;container:iso-play/inline-size;display:block;color:var(--ip-ink);background:var(--ip-bg);font:14px/1.5 system-ui,-apple-system,\"Segoe UI\",sans-serif;border-radius:10px}\n.iso-play[data-mode=\"dark\"]{--ip-ink:#e6e9ee;--ip-muted:#98a1ae;--ip-line:#333a44;--ip-bg:#15181d;--ip-code:#1f242b;--ip-focus:#7aa7ff;color-scheme:dark}\n.iso-play:focus-visible,.iso-play button:focus-visible,.iso-play input:focus-visible,.iso-play summary:focus-visible{outline:2px solid var(--ip-focus);outline-offset:2px}\n.iso-play [hidden]{display:none}\n.iso-play-stage svg{display:block;width:100%;height:auto}\n.iso-play-stage [data-go]{cursor:pointer}\n.iso-play-row{display:flex;align-items:center;gap:6px;padding:8px 12px 4px}\n.iso-play-btn{font:inherit;min-width:32px;height:32px;padding:0 8px;border:1px solid var(--ip-line);border-radius:8px;background:none;color:inherit;cursor:pointer}\n.iso-play-btn:hover{border-color:var(--ip-muted)}\n.iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}\n.iso-play-btn.ambient[aria-pressed=\"false\"]{color:var(--ip-muted);text-decoration:line-through}\n.iso-play-btn.still{font-size:12px;white-space:nowrap}\n.iso-play-btn.still[aria-pressed=\"true\"]{background:var(--ip-ink);color:var(--ip-bg)}\n.iso-play-btn:disabled{opacity:.4;cursor:default}\n.iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}\n.iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}\n.iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}\n.iso-play-group{display:inline-flex;gap:0}\n.iso-play-dot{width:24px;height:24px;padding:0;border:0;background:none;cursor:pointer;display:grid;place-items:center}\n.iso-play-dot::before{content:\"\";width:9px;height:9px;border-radius:50%;background:var(--ip-line)}\n.iso-play-dot.done::before{background:var(--ip-muted)}\n.iso-play-dot.on::before{background:var(--ip-ink);width:11px;height:11px}\n.iso-play-say{padding:4px 12px 10px;min-height:5.2em}\n.iso-play-head{display:flex;align-items:baseline;gap:8px;font-weight:700}\n.iso-play-num{flex:none;display:inline-grid;place-items:center;min-width:22px;height:22px;border-radius:11px;background:var(--ip-ink);color:var(--ip-bg);font-size:11px;align-self:center}\n.iso-play-chapter,.iso-play-count{color:var(--ip-muted);font-size:12px;font-weight:500}\n.iso-play-count{margin-left:auto;white-space:nowrap}\n.iso-play-text{max-width:80ch}\n.iso-play-text a{color:inherit}\n.iso-play-code{margin:6px 0 0;padding:6px 10px;border-radius:8px;background:var(--ip-code);font:12px/1.5 ui-monospace,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}\n.iso-play-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 0;font-size:12px}\n.iso-play-facts dt{color:var(--ip-muted)}\n.iso-play-facts dd{margin:0 8px 0 -10px;font-weight:600}\n.iso-play-list{padding:0 12px 10px;font-size:13px}\n.iso-play-list summary{color:var(--ip-muted);cursor:pointer}\n.iso-play.frozen>:not(.iso-play-stage){display:none}\n@container iso-play (max-width:420px){.iso-play-time{display:none}.iso-play-row{flex-wrap:wrap}.iso-play-bar{flex-basis:100%;order:9}}\n";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Compiled, type CompiledScene } from '../iso-systems/compile.js';
|
|
2
|
+
import { type Cue, type Timeline } from '../iso-objects/timeline.js';
|
|
3
|
+
import { type MotionDoc, type Transition } from '../iso-objects/motion-doc.js';
|
|
4
|
+
/** (a type, not an interface: Remotion's Composition takes props that are a record of unknowns, and an interface isn't one) */
|
|
5
|
+
export type DrawingProps = {
|
|
6
|
+
/** the drawing's text */
|
|
7
|
+
src: string;
|
|
8
|
+
/** the theme's text */
|
|
9
|
+
theme: string;
|
|
10
|
+
/** default: the scene's own motion, else its steps */
|
|
11
|
+
motion?: MotionDoc;
|
|
12
|
+
/** the scene's id (default: the first) */
|
|
13
|
+
scene?: string;
|
|
14
|
+
mode?: 'light' | 'dark';
|
|
15
|
+
treatment?: 'mono' | 'none';
|
|
16
|
+
/** lay the text out with Arimo's widths, and ask for it (default: the system's). The video loads the font itself: isometricFonts */
|
|
17
|
+
font?: 'arimo';
|
|
18
|
+
/** the ambient clock: with the video (default), or 'off' */
|
|
19
|
+
ambient?: 'off';
|
|
20
|
+
};
|
|
21
|
+
export interface Drawing {
|
|
22
|
+
compiled: Compiled;
|
|
23
|
+
scene: CompiledScene;
|
|
24
|
+
timeline: Timeline;
|
|
25
|
+
}
|
|
26
|
+
/** Throws, with every fault, when the drawing or its motion has one: a video of half a drawing is worse than none. */
|
|
27
|
+
export declare function drawingOf(p: DrawingProps): Drawing;
|
|
28
|
+
/** a frame's moment, ms: its start. Fractional frames too (a playback rate gives them). */
|
|
29
|
+
export declare const timeOf: (frame: number, fps: number) => number;
|
|
30
|
+
/** how many frames show all of it: the last one is at its end or past it */
|
|
31
|
+
export declare const framesOf: (ms: number, fps: number) => number;
|
|
32
|
+
/** A frame's SVG, its ids with a prefix of this instance's own (a transition mounts two at once). */
|
|
33
|
+
export declare function frameSvg(d: Drawing, frame: number, fps: number, o?: {
|
|
34
|
+
prefix?: string;
|
|
35
|
+
ambient?: 'off';
|
|
36
|
+
}): string;
|
|
37
|
+
export declare const cueAt: (d: Drawing, frame: number, fps: number) => Cue | undefined;
|
|
38
|
+
/** Remotion's calculateMetadata: the video is as long as the drawing's motion. */
|
|
39
|
+
export declare const isometricMetadata: (o: {
|
|
40
|
+
fps: number;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
}) => ({ props }: {
|
|
44
|
+
props: DrawingProps;
|
|
45
|
+
}) => {
|
|
46
|
+
fps: number;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
durationInFrames: number;
|
|
50
|
+
};
|
|
51
|
+
/** What loadFont of Remotion's fonts package takes, for a font file of the host's own: `loadFont(isometricFonts({ url: staticFile('Arimo-wght.ttf') }))`.
|
|
52
|
+
* The package has no font file. */
|
|
53
|
+
export declare function isometricFonts(o: {
|
|
54
|
+
url: string;
|
|
55
|
+
format?: 'woff2' | 'woff' | 'opentype' | 'truetype';
|
|
56
|
+
}): {
|
|
57
|
+
family: string;
|
|
58
|
+
url: string;
|
|
59
|
+
weight: string;
|
|
60
|
+
format?: 'woff2' | 'woff' | 'opentype' | 'truetype';
|
|
61
|
+
};
|
|
62
|
+
/** A timing as the document's transitions have it: `{ linear: 400 }`, `{ linear: '12f' }`, `{ spring: { damping: 200 } }`. */
|
|
63
|
+
export declare function isometricTiming(timing: Transition['timing']): {
|
|
64
|
+
getDurationInFrames(o: {
|
|
65
|
+
fps: number;
|
|
66
|
+
}): number;
|
|
67
|
+
getProgress(o: {
|
|
68
|
+
frame: number;
|
|
69
|
+
fps: number;
|
|
70
|
+
}): number;
|
|
71
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { BeatInfo, Cue } from '../iso-objects/timeline.js';
|
|
3
|
+
import { type DrawingProps } from './frames.js';
|
|
4
|
+
export { cueAt, drawingOf, frameSvg, framesOf, isometricFonts, isometricMetadata, isometricTiming, timeOf } from './frames.js';
|
|
5
|
+
export type { Drawing, DrawingProps } from './frames.js';
|
|
6
|
+
export interface IsometricSceneProps extends DrawingProps {
|
|
7
|
+
width?: number | string;
|
|
8
|
+
height?: number | string;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
/** what its ids begin with (default: this instance's own): a transition mounts two copies at once */
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
/** the props a presentation's component is given by Remotion's transitions */
|
|
15
|
+
interface PresentationProps {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
presentationDirection: 'entering' | 'exiting';
|
|
18
|
+
presentationProgress: number;
|
|
19
|
+
presentationDurationInFrames?: number;
|
|
20
|
+
passedProps: IsometricPresentationProps;
|
|
21
|
+
}
|
|
22
|
+
export interface IsometricPresentationProps extends Record<string, unknown> {
|
|
23
|
+
/** what the scene going out does: fades too (default: a drawing has no ground of its own, so it would show through), or stays */
|
|
24
|
+
exiting?: 'fade' | 'stay';
|
|
25
|
+
}
|
|
26
|
+
/** The document's 'fade', between two scenes of a TransitionSeries: `presentation={isometricPresentation()}`. */
|
|
27
|
+
export declare function isometricPresentation(props?: IsometricPresentationProps): {
|
|
28
|
+
component: (p: PresentationProps) => ReactElement;
|
|
29
|
+
props: IsometricPresentationProps;
|
|
30
|
+
};
|
|
31
|
+
/** The drawing at the current frame (a Sequence's own, inside one). */
|
|
32
|
+
export declare function IsometricScene(p: IsometricSceneProps): ReactElement;
|
|
33
|
+
/** The commentary now: for a caption of the host's own. */
|
|
34
|
+
export declare function useIsometricCues(p: DrawingProps): Cue | undefined;
|
|
35
|
+
export interface IsometricSequencesProps extends DrawingProps {
|
|
36
|
+
children: (beat: BeatInfo) => ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/** A Remotion Sequence for each beat, by its name (so Studio's timeline shows them), with what the host puts in it. */
|
|
39
|
+
export declare function IsometricSequences(p: IsometricSequencesProps): ReactElement;
|