@johnoscott/isometric-engine 0.14.1 → 0.16.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 (81) hide show
  1. package/README.md +1 -1
  2. package/iso-editor.js +249 -203
  3. package/iso-render.js +200 -154
  4. package/iso-systems.js +210 -162
  5. package/isometric-diagram.js +389 -0
  6. package/js/iso-core/index.js +5 -0
  7. package/js/iso-core/mono.js +242 -0
  8. package/js/iso-editor/ui/canvas.js +23 -1
  9. package/js/iso-objects/ants.js +36 -0
  10. package/js/iso-objects/index.js +55 -1
  11. package/js/iso-objects/looks.js +25 -0
  12. package/js/iso-objects/mono-paint.js +96 -0
  13. package/js/iso-objects/motion-builder.js +130 -0
  14. package/js/iso-objects/motion-doc.js +421 -0
  15. package/js/iso-objects/motion-entry.js +34 -0
  16. package/js/iso-objects/motion-schema.js +83 -0
  17. package/js/iso-objects/motion.js +640 -0
  18. package/js/iso-objects/resolve.js +238 -0
  19. package/js/iso-objects/scene.js +15 -13
  20. package/js/iso-objects/timeline.js +593 -0
  21. package/js/iso-systems/compile.js +83 -1
  22. package/js/iso-systems/index.js +4 -1
  23. package/js/iso-systems/render.js +20 -0
  24. package/js/iso-systems/schema.json +40 -0
  25. package/js/iso-viewer/index.js +6 -0
  26. package/js/iso-viewer/page.js +40 -16
  27. package/js/iso-viewer/play.js +340 -0
  28. package/js/iso-viewer/player.js +149 -175
  29. package/js/iso-viewer/transport.js +289 -0
  30. package/package.json +84 -2
  31. package/src/iso-core/index.ts +1 -0
  32. package/src/iso-core/mono.ts +306 -0
  33. package/src/iso-core/theme.ts +2 -1
  34. package/src/iso-editor/ui/canvas.ts +14 -1
  35. package/src/iso-objects/ants.ts +53 -0
  36. package/src/iso-objects/compile.ts +4 -1
  37. package/src/iso-objects/index.ts +16 -1
  38. package/src/iso-objects/looks.ts +21 -0
  39. package/src/iso-objects/mono-paint.ts +97 -0
  40. package/src/iso-objects/motion-builder.ts +79 -0
  41. package/src/iso-objects/motion-doc.ts +309 -0
  42. package/src/iso-objects/motion-entry.ts +13 -0
  43. package/src/iso-objects/motion-schema.ts +55 -0
  44. package/src/iso-objects/motion.ts +617 -0
  45. package/src/iso-objects/resolve.ts +196 -0
  46. package/src/iso-objects/scene.ts +32 -13
  47. package/src/iso-objects/timeline.ts +493 -0
  48. package/src/iso-objects/types.ts +22 -2
  49. package/src/iso-systems/compile.ts +86 -4
  50. package/src/iso-systems/index.ts +4 -1
  51. package/src/iso-systems/render.ts +45 -0
  52. package/src/iso-systems/schema.json +40 -0
  53. package/src/iso-viewer/index.ts +4 -0
  54. package/src/iso-viewer/page.ts +28 -11
  55. package/src/iso-viewer/play.ts +280 -0
  56. package/src/iso-viewer/player.ts +132 -150
  57. package/src/iso-viewer/transport.ts +272 -0
  58. package/types/iso-core/index.d.ts +1 -0
  59. package/types/iso-core/mono.d.ts +61 -0
  60. package/types/iso-core/theme.d.ts +2 -0
  61. package/types/iso-objects/ants.d.ts +34 -0
  62. package/types/iso-objects/compile.d.ts +3 -0
  63. package/types/iso-objects/index.d.ts +16 -1
  64. package/types/iso-objects/looks.d.ts +4 -0
  65. package/types/iso-objects/mono-paint.d.ts +20 -0
  66. package/types/iso-objects/motion-builder.d.ts +105 -0
  67. package/types/iso-objects/motion-doc.d.ts +193 -0
  68. package/types/iso-objects/motion-entry.d.ts +11 -0
  69. package/types/iso-objects/motion-schema.d.ts +594 -0
  70. package/types/iso-objects/motion.d.ts +202 -0
  71. package/types/iso-objects/resolve.d.ts +20 -0
  72. package/types/iso-objects/scene.d.ts +14 -0
  73. package/types/iso-objects/timeline.d.ts +66 -0
  74. package/types/iso-objects/types.d.ts +34 -0
  75. package/types/iso-systems/compile.d.ts +25 -3
  76. package/types/iso-systems/index.d.ts +4 -1
  77. package/types/iso-systems/render.d.ts +25 -0
  78. package/types/iso-viewer/index.d.ts +4 -0
  79. package/types/iso-viewer/play.d.ts +37 -0
  80. package/types/iso-viewer/transport.d.ts +73 -0
  81. package/types/player/isometric-diagram.d.ts +24 -0
@@ -4,14 +4,80 @@ import { parse, type Parsed } from '../iso-core/parse.ts';
4
4
  import { validateSchema } from './validate.ts';
5
5
  import type { Diag } from '../iso-core/errors.ts';
6
6
  import { place } from '../iso-objects/place.ts';
7
- import { extendTheme, loadTheme } from '../iso-core/theme.ts';
7
+ import { extendTheme, loadTheme, type Theme } from '../iso-core/theme.ts';
8
8
  import type { RawDiagram } from '../iso-objects/types.ts';
9
9
  import { compileRaw, type Compiled } from '../iso-objects/compile.ts';
10
+ import { resolveSvg, type ThemeMode } from '../iso-objects/resolve.ts';
11
+ import { monoOfDrawing, paintMono } from '../iso-objects/mono-paint.ts';
12
+ import type { MonoTable } from '../iso-core/mono.ts';
13
+ import type { CompiledScene } from '../iso-objects/compile.ts';
14
+ import { bindMotion } from '../iso-objects/timeline.ts';
15
+ import type { MotionDoc } from '../iso-objects/motion-doc.ts';
16
+ import { antsOf } from '../iso-objects/ants.ts';
17
+ import { drawLooks } from '../iso-objects/looks.ts';
18
+ import { drawingCss, GRID_CSS, MARKS_CSS } from '../iso-objects/css.ts';
10
19
  import { systems } from './catalog.ts';
11
20
  export type { Compiled, CompiledScene } from '../iso-objects/compile.ts';
12
21
 
13
- /** opts.snap overrides every scene's grid snap (the editor's snap control). */
14
- export function compile(source: string, themeText: string, opts: { snap?: number } = {}): Compiled {
22
+ export interface CompileOptions {
23
+ /** overrides every scene's grid snap (the editor's snap control) */
24
+ snap?: number;
25
+ /** which of the theme's modes a self-contained drawing is in (default: light) */
26
+ mode?: ThemeMode;
27
+ /** (0.15.0) self-contained drawings: each scene's SVG has its colours and text styles on its elements, in `mode`: no
28
+ * stylesheet, no custom properties, no hsl() or color-mix() (svgAt's frames too) */
29
+ resolveVars?: boolean;
30
+ /** (0.16.0) a self-contained drawing in black and white, in either mode: greys, patterns and line rhythms, and no hue */
31
+ treatment?: 'mono' | 'none';
32
+ /** a host's own table, over the treatment's */
33
+ mono?: MonoTable;
34
+ /** a file with an error draws nothing: `scenes` is empty (true), or it throws ('throw'). Default: what could be laid
35
+ * out is in `scenes` all the same, with `ok` false */
36
+ strict?: boolean | 'throw';
37
+ /** ms each step lasts, for a video (default: by the length of its words) */
38
+ stepMs?: number;
39
+ }
40
+ export class CompileError extends Error {
41
+ diags: Diag[];
42
+ constructor(diags: Diag[]) { super(diags.filter(d => d.severity === 'error').map(d => `line ${d.line}: ${d.message}`).join('\n')); this.name = 'CompileError'; this.diags = diags; }
43
+ }
44
+
45
+ export function compile(source: string, themeText: string, opts: CompileOptions = {}): Compiled {
46
+ const c = compileAll(source, themeText, opts);
47
+ if (!c.ok && opts.strict === 'throw') throw new CompileError(c.diags);
48
+ if (!c.ok && opts.strict) c.scenes = [];
49
+ if (opts.stepMs !== undefined) for (const s of c.scenes) for (const st of s.steps.steps) st.duration = opts.stepMs;
50
+ if (opts.treatment !== undefined && opts.treatment !== 'mono' && opts.treatment !== 'none') throw new Error(`treatment: there is "mono" (and "none"), and no ${JSON.stringify(opts.treatment)}`);
51
+ const treatment = (opts.treatment ?? c.doc?.treatment) === 'mono';
52
+ if (opts.treatment === 'mono' && !opts.resolveVars) throw new Error('treatment: a self-contained drawing\'s (resolveVars)');
53
+ const theme = c.theme;
54
+ if (opts.resolveVars) for (const s of c.scenes) {
55
+ const mode = opts.mode ?? 'light', css = drawingCss(systems) + MARKS_CSS + GRID_CSS;
56
+ if (treatment) { toMono(s, theme!, mode, css, opts.mono); continue; }
57
+ const o = { mode, theme: c.theme!, css } as const;
58
+ s.rendered.svg = resolveSvg(s.rendered.svg, o);
59
+ if (s.rendered.variants) s.rendered.variants = Object.fromEntries(Object.entries(s.rendered.variants).map(([k, v]) => [k, resolveSvg(v, o)]));
60
+ s.rendered.inks = { surface: c.theme![o.mode].surface ?? c.theme!.light.surface, control: c.theme![o.mode].control ?? c.theme!.light.control,
61
+ kinds: Object.fromEntries(Object.entries(c.theme!.kinds).map(([k, v]) => [k, c.theme![o.mode][v.color] ?? v.color])) };
62
+ }
63
+ // its connectors march in their own rhythms
64
+ if (opts.resolveVars && treatment && theme) c.theme = { ...theme, kinds: Object.fromEntries(Object.entries(theme.kinds).map(([k, v]) => { const d = c.scenes.map(s => s.rendered.mono?.kinds[k]?.dash).find(x => x && x.length > 1); return [k, d ? { ...v, ants: [d[0], d[1]] as [number, number] } : v]; })) };
65
+ return c;
66
+ }
67
+
68
+ /** a scene in black and white: its drawing and its looks alike, by one table */
69
+ function toMono(s: CompiledScene, theme: Theme, mode: ThemeMode, css: string, own?: MonoTable) {
70
+ const all = [s.rendered.svg, ...Object.values(s.rendered.variants ?? {})];
71
+ const m = monoOfDrawing(all.join(''), theme, mode, [...s.routes.map(r => r.kind), ...s.steps.kindsUsed], own);
72
+ const draw = (svg: string) => paintMono(resolveSvg(svg, { mode, theme: m.theme, css: css + m.css }), m.look, s.id);
73
+ s.rendered.svg = draw(s.rendered.svg);
74
+ if (s.rendered.variants) s.rendered.variants = Object.fromEntries(Object.entries(s.rendered.variants).map(([k, v]) => [k, draw(v)]));
75
+ s.rendered.inks = { surface: m.look.paper, control: m.look.ink, kinds: Object.fromEntries(Object.keys(theme.kinds).map(k => [k, m.look.ink])) };
76
+ s.rendered.mono = m.look;
77
+ for (const w of m.look.warnings) s.rendered.warnings.push({ path: '', message: `black and white: ${w}` });
78
+ }
79
+
80
+ function compileAll(source: string, themeText: string, opts: { snap?: number }): Compiled {
15
81
  const parsed = parse(source);
16
82
  const diags: Diag[] = [...parsed.diags];
17
83
  if (diags.some(d => d.severity === 'error')) return { ok: false, diags, catalog: systems, scenes: [] };
@@ -35,5 +101,21 @@ export function compile(source: string, themeText: string, opts: { snap?: number
35
101
  return { ok: false, diags, catalog: systems, scenes: [] };
36
102
  }
37
103
 
38
- return compileRaw(doc, themeText, systems, parsed, source, opts, diags);
104
+ const c = compileRaw(doc, themeText, systems, parsed, source, { snap: opts.snap }, diags);
105
+ // a scene's own motion document: checked here, so that its faults are said where they are in the file
106
+ let faults = 0;
107
+ const say = (path: string, message: string, hint?: string) => { const at = parsed.locate(path); c.diags.push({ severity: 'error', message, line: at.line, col: at.col, path, ...(hint ? { hint } : {}) }); faults++; };
108
+ c.scenes.forEach((s, i) => {
109
+ drawLooks(s, c.theme!);
110
+ const ants = s.raw.ants, ids = antsOf(s.raw)?.ids, known = s.routes.map(r => r.id);
111
+ (ids ?? []).forEach((id, k) => { if (!known.includes(id)) say(`/scenes/${i}/ants${Array.isArray(ants) ? '' : '/ids'}/${k}`, `no connector "${id}" in this scene`, known.length ? `its connectors: ${known.slice(0, 8).join(', ')}${known.length > 8 ? ', …' : ''}` : undefined); });
112
+ if (!s.raw.motion) return;
113
+ const motion = { isomotion: 1, ...s.raw.motion } as MotionDoc, path = `/scenes/${i}/motion`;
114
+ const said = bindMotion(s, motion, { kinds: c.theme!.kinds }).diags;
115
+ for (const d of said) { const at = parsed.locate(path + d.path); c.diags.push({ severity: d.severity, message: d.message, line: at.line, col: at.col, path: path + d.path, ...(d.hint ? { hint: d.hint } : {}) }); }
116
+ faults += said.length;
117
+ if (!said.length) s.motion = motion;
118
+ });
119
+ if (faults) { c.ok = false; c.diags.sort((a, b) => a.line - b.line || a.col - b.col); }
120
+ return c;
39
121
  }
@@ -8,5 +8,8 @@ export { NODE_ASSETS, getAsset } from './nodes.ts';
8
8
  export { REGION_KINDS, systems } from './catalog.ts';
9
9
  export { DRAWING_CSS, BASE_CSS } from './css.ts';
10
10
  export { validateSchema, schemaValidator } from './validate.ts';
11
- export { compile } from './compile.ts';
11
+ export { compile, CompileError } from './compile.ts';
12
+ export type { CompileOptions } from './compile.ts';
13
+ export { renderSvg } from './render.ts';
14
+ export type { RenderSvgOptions } from './render.ts';
12
15
  export type { Compiled, CompiledScene } from './compile.ts';
@@ -0,0 +1,45 @@
1
+ // One call for a pipeline (a static site, Markdown): a diagram's text to one SVG, as text, that needs nothing else: its colours
2
+ // and text styles on its elements, no stylesheet, no script. Node or a browser; no DOM.
3
+
4
+ import { antsOf, withAnts, type AntsOptions } from '../iso-objects/ants.ts';
5
+ import { svgAt } from '../iso-objects/motion.ts';
6
+ import { bindMotion } from '../iso-objects/timeline.ts';
7
+ import type { MotionDoc } from '../iso-objects/motion-doc.ts';
8
+ import { compile } from './compile.ts';
9
+ import type { MonoTable } from '../iso-core/mono.ts';
10
+ import type { ThemeMode } from '../iso-objects/resolve.ts';
11
+
12
+ export interface RenderSvgOptions {
13
+ /** the theme's text */
14
+ theme: string;
15
+ mode?: ThemeMode;
16
+ /** black and white, in either mode, and a host's own table for it */
17
+ treatment?: 'mono' | 'none';
18
+ mono?: MonoTable;
19
+ /** which scene: its id or its place (default: the first) */
20
+ scene?: string | number;
21
+ /** a moment of its motion, ms: the still without it */
22
+ t?: number;
23
+ /** the motion (default: the scene's own in the file) */
24
+ motion?: MotionDoc;
25
+ /** the ambient clock at that moment (default: t), or 'off': what loops stands at its start (a still's ants too) */
26
+ ambient?: number | 'off';
27
+ /** the still's connectors march, by an animation in the SVG itself (default: as the scene's `ants:` in the file says; a
28
+ * frame's are its motion's, and where that says nothing, the file's) */
29
+ ants?: boolean | Omit<AntsOptions, 'by' | 'kinds'>;
30
+ }
31
+
32
+ /** Throws, with every fault and its line, when the file or its motion has one. */
33
+ export function renderSvg(source: string, o: RenderSvgOptions): string {
34
+ const c = compile(source, o.theme, { mode: o.mode ?? 'light', resolveVars: true, strict: 'throw', treatment: o.treatment, mono: o.mono }), kinds = c.theme!.kinds;
35
+ const s = o.scene === undefined ? c.scenes[0] : typeof o.scene === 'number' ? c.scenes[o.scene] : c.scenes.find(x => x.id === o.scene);
36
+ if (!s) throw new Error(`no scene ${JSON.stringify(o.scene)} (there ${c.scenes.length === 1 ? 'is' : 'are'} ${c.scenes.map(x => x.id).join(', ')})`);
37
+ const ants = o.ants === undefined ? antsOf(s.raw) : o.ants === true ? antsOf(s.raw) ?? {} : o.ants || undefined;
38
+ if (o.t === undefined) return ants ? withAnts(s, { ...ants, by: o.ambient === 'off' ? 'none' : 'smil', kinds }) : s.rendered.svg;
39
+ if (o.ants) throw new Error('ants: at a moment they are its motion document\'s');
40
+ const doc = o.motion ?? s.motion;
41
+ if (!doc) throw new Error('t: this scene has no motion');
42
+ const tl = bindMotion(s, doc, { kinds });
43
+ if (!tl.ok) throw new Error(tl.diags.map(d => `${d.path}: ${d.message}${d.hint ? ` (${d.hint})` : ''}`).join('\n'));
44
+ return svgAt(s, tl.at(o.t, o.ambient === undefined ? {} : { ambient: o.ambient }));
45
+ }
@@ -26,9 +26,33 @@
26
26
  "grid": { "$ref": "#/$defs/grid" },
27
27
  "assemble": { "type": "boolean", "description": "draw each scene by flying its parts in from the nearest edge, then play" },
28
28
  "footer": { "type": "string" },
29
+ "treatment": { "enum": ["mono"], "description": "How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour." },
29
30
  "scenes": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/scene" } }
30
31
  },
31
32
  "$defs": {
33
+ "motion": {
34
+ "type": "object", "additionalProperties": false, "minProperties": 1,
35
+ "description": "how this piece (a region: its contents too) moves when the drawing assembles or disassembles",
36
+ "properties": {
37
+ "style": { "enum": ["edge", "drop", "rise", "fly", "pop", "scatter", "build", "fade"], "description": "how it arrives" },
38
+ "out": { "enum": ["explode", "lift-off", "sink", "scatter", "fly-out", "collapse", "fade", "reverse"], "description": "how it leaves" },
39
+ "easing": { "enum": ["linear", "ease", "ease-in", "ease-out", "settle", "spring", "bounce"] },
40
+ "from": { "enum": ["left", "right", "top", "bottom"], "description": "fly: the side it comes from" },
41
+ "delay": { "type": "number", "minimum": 0, "description": "ms after its turn" },
42
+ "duration": { "type": "number", "exclusiveMinimum": 0, "description": "ms its own move takes" }
43
+ }
44
+ },
45
+ "variants": {
46
+ "type": "object", "minProperties": 1, "propertyNames": { "$ref": "#/$defs/id" },
47
+ "description": "other looks of it, by name, for a motion to switch to (its box stays as it is)",
48
+ "additionalProperties": {
49
+ "type": "object", "additionalProperties": false, "minProperties": 1,
50
+ "properties": {
51
+ "role": { "type": "string" }, "ghost": { "type": "boolean" }, "label": { "type": "string" }, "sub": { "type": "string" },
52
+ "face": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }, "deco": { "type": "array", "items": { "$ref": "#/$defs/deco" } }
53
+ }
54
+ }
55
+ },
32
56
  "id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]*$" },
33
57
  "grid": {
34
58
  "type": "object",
@@ -88,6 +112,18 @@
88
112
  "properties": {
89
113
  "id": { "$ref": "#/$defs/id" },
90
114
  "title": { "type": "string" },
115
+ "ants": {
116
+ "description": "its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",
117
+ "anyOf": [
118
+ { "type": "boolean" },
119
+ { "type": "array", "items": { "type": "string" } },
120
+ { "type": "object", "additionalProperties": false, "properties": {
121
+ "ids": { "type": "array", "items": { "type": "string" } },
122
+ "speed": { "type": "number" },
123
+ "dash": { "type": "array", "items": { "type": "number", "exclusiveMinimum": 0 }, "minItems": 2, "maxItems": 2 } } }
124
+ ]
125
+ },
126
+ "motion": { "type": "object", "description": "the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)" },
91
127
  "caption": { "type": "string" },
92
128
  "aria": { "type": "string" },
93
129
  "gap": { "type": "number", "exclusiveMinimum": 0 },
@@ -143,6 +179,8 @@
143
179
  },
144
180
  "around": { "type": "array", "items": { "$ref": "#/$defs/id" }, "description": "tunnel: routes it wraps" },
145
181
  "regions": { "type": "array", "items": { "$ref": "#/$defs/region" } },
182
+ "motion": { "$ref": "#/$defs/motion" },
183
+ "variants": { "$ref": "#/$defs/variants" },
146
184
  "nodes": { "type": "array", "items": { "$ref": "#/$defs/node" } }
147
185
  }
148
186
  },
@@ -188,6 +226,8 @@
188
226
  "dy": { "type": "number" }
189
227
  }
190
228
  },
229
+ "motion": { "$ref": "#/$defs/motion" },
230
+ "variants": { "$ref": "#/$defs/variants" },
191
231
  "nodes": { "type": "array", "items": { "$ref": "#/$defs/node" }, "description": "nodes standing on top of this one" }
192
232
  }
193
233
  },
@@ -17,6 +17,10 @@ export { isoVars, scopeSelector, scope } from './view-css.ts';
17
17
  export { md, stepData, legend, renderPage } from './page.ts';
18
18
  export type { PageOpts } from './page.ts';
19
19
  export { playerScript } from './bundle.ts';
20
+ export { transport, pageClock } from './transport.ts';
21
+ export type { Transport, TransportClock, TransportEvents, TransportOptions } from './transport.ts';
22
+ export { mountPlayer, PLAY_CSS } from './play.ts';
23
+ export type { Player, PlayerOptions } from './play.ts';
20
24
  export { h } from './dom.ts';
21
25
  export { TIMELINE_VERSION, SEGMENT_NAME, SEVERITIES, BINS, BIN_MS, scopePattern } from './timeline-contract.ts';
22
26
  export type { TimelineTypes, AnyTimeline, Scope, Severity, AttrValue, TimelineEvent, Bin, MetricPoint, MetricRollup, EventBin, Match, AstTerm, SearchAst, Days, Retention, SeriesInfo, KindInfo, SourceInfo, EffectiveRetention, ScopeName, Catalog, Filters, Query, Row, Result, Batch, View as TimelineView, Recording, TimelineSource, TimelineCatalog } from './timeline-contract.ts';
@@ -1,5 +1,7 @@
1
1
  // The HTML page around the scenes: header, one section per scene, theme toggle. One file, no network.
2
2
 
3
+ import { bindMotion, motionOfSteps, motionSource } from '../iso-objects/timeline.ts';
4
+ import type { StepData } from '../iso-objects/steps.ts';
3
5
  import { esc } from '../iso-core/kernel.ts';
4
6
  import type { Compiled } from '../iso-objects/compile.ts';
5
7
  import { themeCss } from '../iso-core/theme.ts';
@@ -25,14 +27,29 @@ const paras = (s: string | undefined) => (s ?? '').split(/\n\s*\n/).filter(Boole
25
27
 
26
28
  export interface PageOpts { runtime?: string; extraHead?: string; extraBody?: string }
27
29
 
30
+ /** a scene's own motion, where it has any that binds: what its page plays, in place of its steps */
31
+ const ownMotion = (c: Compiled, s: CompiledScene) => !!s.motion && bindMotion(s, s.motion, { kinds: c.theme!.kinds }).ok;
32
+ /** what the page steps through: the scene's steps, or the beats of its own motion */
33
+ function stepsOf(c: Compiled, s: CompiledScene): StepData[] {
34
+ if (!ownMotion(c, s)) return s.steps.steps;
35
+ return bindMotion(s, s.motion!, { kinds: c.theme!.kinds }).beats.map(b => ({
36
+ n: b.index + 1, num: b.index + 1, kind: 'control', color: b.say?.color ?? colorRef(c.theme!, c.theme!.kinds.control?.color ?? 'control'),
37
+ heading: b.say?.title ?? b.name, caption: b.say?.text ?? '', command: b.say?.code ?? '', phases: [], pulses: [], lit: [], duration: b.end - b.start,
38
+ }));
39
+ }
40
+
28
41
  /** The data the player runs on, for every scene with steps. */
29
42
  export function stepData(c: Compiled): string {
30
43
  return JSON.stringify({
31
- scenes: c.scenes.map(s => ({
32
- id: s.id, loop: s.raw.loop ?? true, dim: s.raw.dim ?? 'flows', vis: s.steps.vis,
33
- steps: s.steps.steps.map(st => ({ ...st, caption: md(st.caption) })),
34
- assemble: s.assemble, grid: !!s.grid.show, assembly: s.rendered.assembly,
35
- })),
44
+ scenes: c.scenes.map(s => {
45
+ const own = ownMotion(c, s), steps = stepsOf(c, s), doc = own ? s.motion : s.steps.steps.length ? motionOfSteps(s) : undefined;
46
+ return {
47
+ id: s.id, loop: s.raw.loop ?? true, dim: s.raw.dim ?? 'flows', vis: s.steps.vis,
48
+ // (where a step's view goes is its document's camera)
49
+ steps: steps.map(({ focus: _, ...st }) => ({ ...st, caption: md(st.caption) })),
50
+ assemble: s.assemble, grid: !!s.grid.show, source: motionSource(s), ...(doc ? { doc } : {}), ...(own ? { own } : {}),
51
+ };
52
+ }),
36
53
  });
37
54
  }
38
55
 
@@ -57,8 +74,8 @@ export function legend(c: Compiled, s: CompiledScene): string {
57
74
  return items.join('');
58
75
  }
59
76
 
60
- function player(s: CompiledScene): string {
61
- const st = s.steps.steps;
77
+ function player(c: Compiled, s: CompiledScene): string {
78
+ const st = stepsOf(c, s);
62
79
  const tools = `<div class="tools">
63
80
  <button class="pbtn small" type="button" data-a="grid" aria-pressed="${s.grid.show ? 'true' : 'false'}" title="Show the floor grid">Grid</button>
64
81
  <button class="pbtn small" type="button" data-a="assemble" title="Draw the diagram again, piece by piece">Assemble</button>
@@ -82,8 +99,8 @@ function player(s: CompiledScene): string {
82
99
  </div>`;
83
100
  }
84
101
 
85
- function stepList(s: CompiledScene): string {
86
- const st = s.steps.steps;
102
+ function stepList(c: Compiled, s: CompiledScene): string {
103
+ const st = stepsOf(c, s);
87
104
  if (!st.length) return '';
88
105
  return `<details class="steps"><summary>All ${st.length} steps as text</summary><ol>${st.map(x =>
89
106
  `<li value="${x.num}"><b>${esc(x.heading)}.</b> ${md(x.caption)}${x.command ? `<br><code>${esc(x.command)}</code>` : ''}</li>`).join('')}</ol></details>`;
@@ -98,10 +115,10 @@ export function renderPage(c: Compiled, opts: PageOpts = {}): string {
98
115
  ${paras(s.raw.caption)}
99
116
  <div class="figure" tabindex="-1">
100
117
  <div class="scroller">${s.grid.show ? s.rendered.svg.replace('<svg ', '<svg class="show-grid" ') : s.rendered.svg}</div>
101
- ${player(s)}
118
+ ${player(c, s)}
102
119
  <div class="legend">${legend(c, s)}</div>
103
120
  </div>
104
- ${stepList(s)}
121
+ ${stepList(c, s)}
105
122
  ${s.raw.after ? `<div class="after">${paras(s.raw.after)}</div>` : ''}
106
123
  </section>`).join('\n');
107
124
  return `<!doctype html>
@@ -0,0 +1,280 @@
1
+ // The player (docs/design/MOTION.md, 6.2): a skin over a transport. The drawing, play and pause, back and next, the beats as dots by
2
+ // chapter, a scrubber, the commentary with its facts, the ambient switch, a text list of the beats. It owns no clock (transport.ts does)
3
+ // and draws nothing of its own: what shows is paint(svg, timeline.at(…)). Built as DOM (no HTML text but the commentary's own small
4
+ // Markdown, escaped), no style attributes, no storage, nothing fetched, so it runs under a strict CSP; its stylesheet is the host's to add
5
+ // (PLAY_CSS, in a page or a shadow root). The drawing is a self-contained one (compile's resolveVars), so no theme's CSS is needed.
6
+
7
+ import { paint, type SceneState } from '../iso-objects/motion.ts';
8
+ import type { CompiledScene } from '../iso-objects/compile.ts';
9
+ import type { BeatInfo, Timeline } from '../iso-objects/timeline.ts';
10
+ import { h } from './dom.ts';
11
+ import { md } from './page.ts';
12
+ import { transport, type Transport, type TransportClock } from './transport.ts';
13
+
14
+ export interface PlayerOptions {
15
+ scene: Pick<CompiledScene, 'rendered' | 'id'>;
16
+ /** none: the drawing alone, with nothing to play */
17
+ timeline?: Timeline;
18
+ /** what a screen reader calls it */
19
+ label?: string;
20
+ /** the controls and the commentary (default true): without them, the drawing alone */
21
+ controls?: boolean;
22
+ /** start at once, or each time most of it is in view (default: neither) */
23
+ autoplay?: boolean | 'visible';
24
+ loop?: boolean;
25
+ rate?: number;
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 */
28
+ reducedMotion?: 'ignore' | 'respect';
29
+ mode?: 'light' | 'dark';
30
+ /** the timeline is the drawing's own steps (motionOfSteps): its callouts and marks show at their step, and the other steps' numbers dim */
31
+ steps?: boolean;
32
+ clock?: TransportClock;
33
+ }
34
+ export interface Player {
35
+ readonly root: HTMLElement;
36
+ readonly transport: Transport;
37
+ /** another drawing, or another document: the place is kept (transport's rebind). Faults are refused, and what plays goes on */
38
+ set(scene: Pick<CompiledScene, 'rendered' | 'id'>, timeline?: Timeline, mode?: 'light' | 'dark'): boolean;
39
+ /** show one moment, still: no clock, no controls (a screenshot, a link) */
40
+ freeze(ms: number): void;
41
+ /** to a beat and through it, stopping before the next */
42
+ step(beat: number): void;
43
+ dispose(): void;
44
+ }
45
+
46
+ /** which of the page's players plays: the one most in view (an autoplaying one that is not stops) */
47
+ const mounted = new Map<HTMLElement, { seen: number; auto(on: boolean): void; wants: boolean }>();
48
+ function pick() {
49
+ let best: HTMLElement | undefined, most = 0.35;
50
+ for (const [el, m] of mounted) if (m.wants && m.seen >= most && (m.seen > most || !best)) { best = el; most = m.seen; }
51
+ for (const [el, m] of mounted) if (m.wants) m.auto(el === best);
52
+ }
53
+
54
+ const svgOf = (text: string): SVGSVGElement => {
55
+ const doc = new DOMParser().parseFromString(text, 'image/svg+xml');
56
+ if (doc.documentElement.localName !== 'svg') throw new Error('the drawing is not SVG');
57
+ return document.importNode(doc.documentElement, true) as unknown as SVGSVGElement;
58
+ };
59
+ const clockText = (ms: number) => { const s = Math.round(ms / 1000); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`; };
60
+ /** a drawing with nothing to play */
61
+ const NOTHING: Timeline = { ok: true, diags: [], duration: 0, beats: [], markers: {}, ambient: 'on', loops: false, at: () => ({}), cues: () => undefined, beatAt: () => undefined, startOf: () => undefined };
62
+ /** everything still hidden stays hidden; what is only dimmed is lit */
63
+ function lit(S: SceneState): SceneState {
64
+ const out: SceneState = { ...(S.camera ? { camera: S.camera } : {}), ...(S.variants ? { variants: S.variants } : {}) };
65
+ for (const k of ['items', 'labels', 'routes'] as const) {
66
+ const gone = Object.entries(S[k] ?? {}).filter(([, v]) => v.opacity === 0).map(([id]) => [id, { opacity: 0 }]);
67
+ if (gone.length) out[k] = Object.fromEntries(gone);
68
+ }
69
+ return out;
70
+ }
71
+
72
+ export function mountPlayer(host: HTMLElement | ShadowRoot, o: PlayerOptions): Player {
73
+ if (o.timeline && !o.timeline.ok) throw new Error(`the motion has faults: ${o.timeline.diags.map(d => `${d.path}: ${d.message}`).join('; ')}`);
74
+ let scene = o.scene, svg = svgOf(scene.rendered.svg), frozen: number | undefined, stepTo: number | undefined, userPaused = false, gone = false;
75
+ const tr = transport(o.timeline ?? NOTHING, { loop: o.loop, rate: o.rate, ambient: o.ambient, clock: o.clock });
76
+ const controls = o.controls ?? true;
77
+ const calm = o.reducedMotion === 'respect' && typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
78
+ let resting = calm;
79
+
80
+ // ---- the parts ----
81
+ 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);
82
+ const stage = h('div', { class: 'iso-play-stage' }, svg as unknown as Node);
83
+ const back = btn('back', 'Back', '‹', () => byHand(() => step(Math.max(0, at() - 1))));
84
+ const play = btn('play', 'Play', '▶', () => toggle());
85
+ 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 amb = btn('ambient', 'Ambient motion', '∿', () => { wake(); tr.ambient = !tr.ambient; show(); });
88
+ 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
+ const time = h('span', { class: 'iso-play-time' });
90
+ const dots = h('div', { class: 'iso-play-dots' });
91
+ const num = h('span', { class: 'iso-play-num' }), title = h('span', { class: 'iso-play-title' }), chapter = h('span', { class: 'iso-play-chapter' }), count = h('span', { class: 'iso-play-count' });
92
+ const text = h('div', { class: 'iso-play-text' }), code = h('pre', { class: 'iso-play-code' }), facts = h('dl', { class: 'iso-play-facts' });
93
+ 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
+ const list = h('details', { class: 'iso-play-list' });
95
+ const row = h('div', { class: 'iso-play-row' }, back, play, next, again, amb, bar, time);
96
+ 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 && row, controls && dots, controls && say, controls && list);
98
+ host.append(root);
99
+
100
+ // ---- what there is to show: the beats ----
101
+ let dotOf: HTMLButtonElement[] = [];
102
+ function beats() {
103
+ const all = tr.timeline.beats, some = all.length > 0, said = all.some(b => b.say);
104
+ dotOf = [];
105
+ dots.replaceChildren();
106
+ let group: HTMLElement | undefined, last: string | undefined;
107
+ for (const b of all) {
108
+ if (!group || b.say?.chapter !== last) { group = h('span', { class: 'iso-play-group', role: 'group', 'aria-label': b.say?.chapter, title: b.say?.chapter }); dots.append(group); last = b.say?.chapter; }
109
+ const d = h('button', { type: 'button', class: 'iso-play-dot', 'aria-label': `Step ${b.index + 1}: ${b.say?.title ?? b.name}`, title: b.say?.title ?? b.name, on: { click: (() => byHand(() => step(b.index))) as EventListener } });
110
+ group.append(d); dotOf.push(d);
111
+ }
112
+ list.replaceChildren(h('summary', null, `All ${all.length} steps as text`), h('ol', null, ...all.map(b => h('li', null, ...words(b)))));
113
+ for (const el of [back, next, dots]) el.hidden = !some;
114
+ say.hidden = !said; list.hidden = !said;
115
+ amb.hidden = !tr.timeline.loops;
116
+ bar.max = String(Math.round(tr.duration));
117
+ for (const el of [play, again, bar, time]) el.hidden = tr.duration <= 0;
118
+ told = undefined;
119
+ }
120
+ function words(b: BeatInfo): Node[] {
121
+ const s = b.say, out: Node[] = [h('b', null, s?.title ?? b.name)];
122
+ if (s?.text) { const p = h('div', null); p.innerHTML = md(s.text); out.push(p); }
123
+ if (s?.code) out.push(h('code', null, s.code));
124
+ if (s?.facts?.length) out.push(h('span', null, s.facts.map(([k, v]) => `${k}: ${v}`).join(' · ')));
125
+ return out;
126
+ }
127
+ let told: BeatInfo | undefined;
128
+ /** what is drawn for one step alone: the rest of it is the Timeline's */
129
+ function marks(b: BeatInfo | undefined) {
130
+ const n = String((b?.index ?? -1) + 1);
131
+ for (const e of svg.querySelectorAll('[data-badge]')) {
132
+ e.classList.toggle('on', e.getAttribute('data-badge') === n);
133
+ if (o.steps) { if (e.getAttribute('data-badge') === n || resting) e.removeAttribute('opacity'); else e.setAttribute('opacity', '0.14'); }
134
+ }
135
+ if (o.steps) for (const e of svg.querySelectorAll('[data-step]')) e.setAttribute('visibility', e.getAttribute('data-step') === n && !resting ? 'visible' : 'hidden');
136
+ }
137
+ function caption() {
138
+ const b = tr.beat;
139
+ if (b === told) return;
140
+ told = b;
141
+ marks(b);
142
+ if (!controls) return;
143
+ const s = b?.say;
144
+ num.textContent = b ? String(b.index + 1) : '';
145
+ num.style.backgroundColor = s?.color ?? '';
146
+ title.textContent = s?.title ?? b?.name ?? '';
147
+ chapter.textContent = s?.chapter ?? '';
148
+ count.textContent = b ? `${b.index + 1} / ${tr.timeline.beats.length}` : '';
149
+ text.innerHTML = md(s?.text);
150
+ code.textContent = s?.code ?? '';
151
+ facts.replaceChildren(...(s?.facts ?? []).flatMap(([k, v]) => [h('dt', null, k), h('dd', null, v)]));
152
+ code.hidden = !s?.code; facts.hidden = !s?.facts?.length;
153
+ 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
+ }
155
+ function show() {
156
+ const S = frozen !== undefined ? tr.timeline.at(frozen, { ambient: frozen }) : resting ? lit(tr.timeline.at(tr.duration, { ambient: 'off' })) : tr.state();
157
+ paint(svg, S, scene.rendered, { styles: 'cssom' });
158
+ root.dataset.time = String(Math.round(frozen ?? tr.time));
159
+ if (frozen !== undefined) marks(tr.timeline.beatAt(frozen)); else caption();
160
+ if (!controls) return;
161
+ bar.value = String(Math.round(tr.time));
162
+ bar.setAttribute('aria-valuetext', `${clockText(tr.time)} of ${clockText(tr.duration)}${tr.beat ? `, ${tr.beat.say?.title ?? tr.beat.name}` : ''}`);
163
+ time.textContent = `${clockText(tr.time)} / ${clockText(tr.duration)}`;
164
+ }
165
+ function buttons() {
166
+ const on = going();
167
+ play.textContent = on ? '❚❚' : '▶';
168
+ play.setAttribute('aria-label', on ? 'Pause' : 'Play'); play.title = on ? 'Pause' : 'Play';
169
+ amb.setAttribute('aria-pressed', String(tr.ambient));
170
+ say.setAttribute('aria-live', on ? 'off' : 'polite');
171
+ root.dataset.playing = String(on);
172
+ }
173
+
174
+ // ---- playing ----
175
+ /** playing on and on, not only through one step */
176
+ const going = () => tr.playing && stepTo === undefined;
177
+ const at = () => tr.beat?.index ?? 0;
178
+ /** a reader who asked for less motion has asked for some */
179
+ function wake() { if (resting) { resting = false; told = undefined; } }
180
+ /** the reader did it: an autoplay doesn't start again by itself */
181
+ function byHand(f: () => void) { wake(); userPaused = true; f(); buttons(); show(); }
182
+ function stop() { stepTo = undefined; tr.pause(); }
183
+ function step(i: number) {
184
+ const b = tr.timeline.beats[i];
185
+ if (!b || gone) return;
186
+ tr.pause();
187
+ tr.seek(b.start, { join: true });
188
+ const nextStart = tr.timeline.beats[i + 1]?.start ?? Infinity;
189
+ // through the beat, and to a stop within it (its end is the next one's start)
190
+ stepTo = Math.max(b.start, Math.min(b.end, nextStart, tr.duration) - 1);
191
+ tr.play({ until: stepTo });
192
+ }
193
+ function toggle() {
194
+ wake();
195
+ if (going()) { userPaused = true; stop(); } else { userPaused = false; stepTo = undefined; tr.pause(); tr.play(); }
196
+ buttons(); show();
197
+ }
198
+ tr.on('time', show);
199
+ tr.on('play', buttons); tr.on('ambient', buttons);
200
+ tr.on('pause', () => { stepTo = undefined; buttons(); });
201
+ root.addEventListener('keydown', e => {
202
+ const k = e.key, t = e.target as Element;
203
+ if (e.altKey || e.ctrlKey || e.metaKey || t === bar) return;
204
+ if (k === 'ArrowRight' || k === 'ArrowLeft') { e.preventDefault(); (k === 'ArrowRight' ? next : back).click(); }
205
+ else if (k === 'Home') { e.preventDefault(); again.click(); }
206
+ else if ((k === ' ' || k === 'k') && t === root) { e.preventDefault(); toggle(); }
207
+ });
208
+ const onBadge = (e: Event) => {
209
+ const b = (e.target as Element).closest?.('[data-go]'), key = (e as KeyboardEvent).key;
210
+ if (!b || (e.type === 'keydown' && key !== 'Enter' && key !== ' ')) return;
211
+ e.preventDefault(); e.stopPropagation();
212
+ byHand(() => step(Number(b.getAttribute('data-go')) - 1));
213
+ };
214
+ stage.addEventListener('click', onBadge); stage.addEventListener('keydown', onBadge);
215
+
216
+ // ---- in view: neither clock moves for a player nobody can see; one that autoplays in view is one at a time ----
217
+ const me = {
218
+ 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(); } },
220
+ };
221
+ 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 = e.isIntersecting; } pick(); }, { threshold: [0, 0.2, 0.35, 0.5, 0.7, 0.9, 1] }) : undefined;
223
+ io?.observe(root);
224
+
225
+ beats(); buttons(); show();
226
+ if (o.autoplay === true && !calm) tr.play();
227
+ return {
228
+ root, transport: tr, step: i => byHand(() => step(i)),
229
+ set(s, tl = NOTHING, mode) {
230
+ if (gone || !tl.ok) return false;
231
+ const fresh = svgOf(s.rendered.svg);
232
+ scene = s; svg.replaceWith(fresh); svg = fresh;
233
+ if (mode) root.dataset.mode = mode;
234
+ if (stepTo !== undefined) stop();
235
+ tr.rebind(tl);
236
+ beats(); buttons(); show();
237
+ return true;
238
+ },
239
+ freeze(ms) { frozen = ms; tr.pause(); tr.active = false; root.classList.add('frozen'); show(); },
240
+ dispose() { gone = true; io?.disconnect(); mounted.delete(root); tr.dispose(); root.remove(); pick(); },
241
+ };
242
+ }
243
+
244
+ /** The player's stylesheet: its own, under one class; the colours are custom properties a host may set. */
245
+ export const PLAY_CSS = `
246
+ .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}
247
+ .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}
248
+ .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}
249
+ .iso-play [hidden]{display:none}
250
+ .iso-play-stage svg{display:block;width:100%;height:auto}
251
+ .iso-play-stage [data-go]{cursor:pointer}
252
+ .iso-play-row{display:flex;align-items:center;gap:6px;padding:8px 12px 4px}
253
+ .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}
254
+ .iso-play-btn:hover{border-color:var(--ip-muted)}
255
+ .iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}
256
+ .iso-play-btn.ambient[aria-pressed="false"]{color:var(--ip-muted);text-decoration:line-through}
257
+ .iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}
258
+ .iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
259
+ .iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}
260
+ .iso-play-group{display:inline-flex;gap:0}
261
+ .iso-play-dot{width:24px;height:24px;padding:0;border:0;background:none;cursor:pointer;display:grid;place-items:center}
262
+ .iso-play-dot::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--ip-line)}
263
+ .iso-play-dot.done::before{background:var(--ip-muted)}
264
+ .iso-play-dot.on::before{background:var(--ip-ink);width:11px;height:11px}
265
+ .iso-play-say{padding:4px 12px 10px;min-height:5.2em}
266
+ .iso-play-head{display:flex;align-items:baseline;gap:8px;font-weight:700}
267
+ .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}
268
+ .iso-play-chapter,.iso-play-count{color:var(--ip-muted);font-size:12px;font-weight:500}
269
+ .iso-play-count{margin-left:auto;white-space:nowrap}
270
+ .iso-play-text{max-width:80ch}
271
+ .iso-play-text a{color:inherit}
272
+ .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}
273
+ .iso-play-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 0;font-size:12px}
274
+ .iso-play-facts dt{color:var(--ip-muted)}
275
+ .iso-play-facts dd{margin:0 8px 0 -10px;font-weight:600}
276
+ .iso-play-list{padding:0 12px 10px;font-size:13px}
277
+ .iso-play-list summary{color:var(--ip-muted);cursor:pointer}
278
+ .iso-play.frozen>:not(.iso-play-stage){display:none}
279
+ @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}}
280
+ `;