@things-factory/figure-viewer 10.1.165 → 10.1.166

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.
@@ -6,8 +6,9 @@ export function parametersForClip(asset: FigureAsset, values: Record<string, num
6
6
  return Object.fromEntries(Object.entries(values).filter(([id]) => !driven.has(id)))
7
7
  }
8
8
 
9
- export function clipForControl(asset: FigureAsset, id: string) {
10
- return asset.drivers?.find(d => d.state === id)?.clip
9
+ /** The clips that move an input. A clip can move many inputs, so it plays on its own row, never on an input's. */
10
+ export function clipsDriving(asset: FigureAsset, id: string) {
11
+ return [...new Set((asset.drivers ?? []).filter(d => d.state === id).map(d => d.clip))]
11
12
  }
12
13
 
13
14
  /**
@@ -2,6 +2,7 @@ import '@material/web/icon/icon.js'
2
2
  import { css, html, LitElement, nothing, type PropertyValues } from 'lit'
3
3
  import { customElement, property, query, state } from 'lit/decorators.js'
4
4
  import { i18next, localize } from '@operato/i18n'
5
+ import { ScrollbarStyles } from '@operato/styles'
5
6
  import { SurfaceStyles } from '@things-factory/styles'
6
7
  import { compileFigureAsset, FIGURE_INSTANCE_SIZE_INPUTS, type FigureAsset } from '@hatiolab/figure-model'
7
8
  import { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene'
@@ -9,7 +10,7 @@ import { authoredSizeOf } from './preview-model.js'
9
10
  import { controlsOf } from './controls.js'
10
11
  import { DEFAULT_VIEW, previewBoardDepth, sceneLook } from './figure-view.js'
11
12
  import { SidePanelStyles } from './side-panel-styles.js'
12
- import { clipForControl, clipPlayOf, parametersForClip, playSettingsOf } from './detail-motion.js'
13
+ import { clipPlayOf, clipsDriving, parametersForClip, playSettingsOf } from './detail-motion.js'
13
14
 
14
15
  type Axis = 'x' | 'y' | 'z'
15
16
  /** What the view's tabs show under it: the figure's facts, its size, its motion. */
@@ -39,10 +40,10 @@ interface Scene {
39
40
  @customElement('figure-asset-viewer')
40
41
  export class FigureAssetViewer extends localize(i18next)(LitElement) {
41
42
  /*
42
- The modeller's side panel look (SidePanelStyles) and the suite's tab strip (SurfaceStyles' .ui-tabs); only the
43
- viewport, the tab body and the slider rows are this element's.
43
+ The modeller's side panel look (SidePanelStyles), the suite's tab strip (SurfaceStyles' .ui-tabs) and its scrollbar
44
+ for the tab body (ScrollbarStyles); only the viewport, the tab body and the slider rows are this element's.
44
45
  */
45
- static styles = [SidePanelStyles, SurfaceStyles, css`
46
+ static styles = [SidePanelStyles, SurfaceStyles, ScrollbarStyles, css`
46
47
  :host { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
47
48
  /* The card's own 4:3, so the picture taken is what is seen. */
48
49
  [viewport] { flex: none; aspect-ratio: 4 / 3; position: relative; background: #858585; }
@@ -63,13 +64,14 @@ export class FigureAssetViewer extends localize(i18next)(LitElement) {
63
64
  section + section { border-top: 1px solid var(--md-sys-color-outline-variant); }
64
65
  section:last-child { border-bottom: none; }
65
66
  h3 { justify-content: space-between; margin: 0 0 2px; }
66
- /* A slider row: its name, the line to drag, and the number -- one 22px line, the number read as text. */
67
67
  /*
68
- A slider row: its name, the line to drag, the number, and a play mark. The name column is wide enough for a joint's
69
- name and unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name.
68
+ A slider row: its name, the line to drag, and the number. The name column is wide enough for a joint's name and
69
+ unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name. A clip's row is its name
70
+ and its play mark.
70
71
  */
71
72
  div[slide] { display: grid; grid-template-columns: 120px minmax(64px, 1fr) 52px 22px; align-items: center; gap: 8px; min-height: 22px; }
72
73
  div[slide] > span { color: var(--md-sys-color-on-surface-variant); overflow-wrap: anywhere; line-height: 1.3; }
74
+ div[slide][clip] > span { grid-column: 1 / 4; }
73
75
  div[slide] input[type='number'] { min-height: 0; height: 20px; padding: 0 2px; border: none; border-bottom: 1px solid transparent; border-radius: 0;
74
76
  background: none; text-align: right; font-family: var(--mono-font, monospace); -moz-appearance: textfield; }
75
77
  div[slide] input[type='number']::-webkit-inner-spin-button, div[slide] input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
@@ -201,24 +203,28 @@ export class FigureAssetViewer extends localize(i18next)(LitElement) {
201
203
  </section>`
202
204
  }
203
205
 
206
+ /*
207
+ The inputs, then the clips. A clip can move many inputs -- the robot dog's walk moves all eight leg joints -- so it
208
+ plays on its own row (user 2026-10-15: a play mark on fl-thigh played the walk and every leg moved). An input the
209
+ clip playing moves cannot be dragged; one a clip played and let go of stands where the clip left it, so its number
210
+ is not shown until it is dragged.
211
+ */
204
212
  private renderMotion(asset: FigureAsset, controls: ReturnType<typeof controlsOf>, clips: string[]) {
205
213
  return html`<section>
206
214
  ${controls.map(c => {
207
- const clip = clipForControl(asset, c.id)
208
- const on = !!clip && this.playing === clip
215
+ const driving = clipsDriving(asset, c.id)
216
+ const moving = driving.includes(this.playing)
217
+ const held = moving || (driving.some(clip => this.played.has(clip)) && !(c.id in this.values))
209
218
  return html`<div slide><span title=${`${c.label} · ${c.unit}`}>${c.label} · ${c.unit}</span>
210
- <input type="range" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${on}
219
+ <input type="range" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${moving}
211
220
  @input=${(e: Event) => this.pose(c.id, (e.target as HTMLInputElement).valueAsNumber)}>
212
- <output>${on ? i18next.t('figure.text.detail-playing')
213
- : this.played.has(clip ?? '') && !(c.id in this.values) ? i18next.t('figure.text.detail-paused') : Math.round(c.value * 100) / 100}</output>
214
- ${clip ? this.playButton(clip) : html`<span></span>`}</div>`
221
+ <output>${held ? '' : Math.round(c.value * 100) / 100}</output><span></span></div>`
215
222
  })}
216
- ${/* A clip that drives no control shown here still gets its line. */ ''}
217
- ${clips.filter(name => !controls.some(c => clipForControl(asset, c.id) === name)).map(name => html`<div slide>
218
- <span title=${name}>${name}</span><span></span>
219
- <output>${this.playing === name ? i18next.t('figure.text.detail-playing') : ''}</output>${this.playButton(name)}</div>`)}
220
223
  ${!controls.length && !clips.length ? html`<p hint>${i18next.t('figure.text.detail-no-motion')}</p>` : nothing}
221
- </section>`
224
+ </section>
225
+ ${clips.length ? html`<section>
226
+ ${clips.map(name => html`<div slide clip><span title=${name}>${name}</span>${this.playButton(name)}</div>`)}
227
+ </section>` : nothing}`
222
228
  }
223
229
 
224
230
  /**
@@ -3,7 +3,8 @@ import { type FigureAsset, type FigureDataValue } from '@hatiolab/figure-model';
3
3
  export declare function parametersForClip(asset: FigureAsset, values: Record<string, number>, clip: string): {
4
4
  [k: string]: number;
5
5
  };
6
- export declare function clipForControl(asset: FigureAsset, id: string): string | undefined;
6
+ /** The clips that move an input. A clip can move many inputs, so it plays on its own row, never on an input's. */
7
+ export declare function clipsDriving(asset: FigureAsset, id: string): string[];
7
8
  /**
8
9
  * How the detail view plays a clip (ADR-0051 §3.2, §8). A clip in no motion group plays at its own speed (the board's
9
10
  * `clips`). A clip of a group is the group's selection (the board's `motion`); and when the figure's data chooses that
@@ -4,8 +4,9 @@ export function parametersForClip(asset, values, clip) {
4
4
  const driven = new Set((asset.drivers ?? []).filter(d => d.clip === clip).map(d => d.state));
5
5
  return Object.fromEntries(Object.entries(values).filter(([id]) => !driven.has(id)));
6
6
  }
7
- export function clipForControl(asset, id) {
8
- return asset.drivers?.find(d => d.state === id)?.clip;
7
+ /** The clips that move an input. A clip can move many inputs, so it plays on its own row, never on an input's. */
8
+ export function clipsDriving(asset, id) {
9
+ return [...new Set((asset.drivers ?? []).filter(d => d.state === id).map(d => d.clip))];
9
10
  }
10
11
  export function clipPlayOf(asset, clip) {
11
12
  const group = (asset.motionGroups ?? []).find(g => g.clips.includes(clip));
@@ -1 +1 @@
1
- {"version":3,"file":"detail-motion.js","sourceRoot":"","sources":["../client/detail-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAA0C,MAAM,wBAAwB,CAAA;AAE3G,4FAA4F;AAC5F,MAAM,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AAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACxM,MAAM,MAAM,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9I,MAAM,YAAY,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACjF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;AACxC,CAAC","sourcesContent":["import { compileFigureDataInterface, type FigureAsset, type FigureDataValue } from '@hatiolab/figure-model'\n\n/** External values win over drivers; release only the controls owned by the chosen clip. */\nexport function parametersForClip(asset: FigureAsset, values: Record<string, number>, clip: string) {\n const driven = new Set((asset.drivers ?? []).filter(d => d.clip === clip).map(d => d.state))\n return Object.fromEntries(Object.entries(values).filter(([id]) => !driven.has(id)))\n}\n\nexport function clipForControl(asset: FigureAsset, id: string) {\n return asset.drivers?.find(d => d.state === id)?.clip\n}\n\n/**\n * How the detail view plays a clip (ADR-0051 §3.2, §8). A clip in no motion group plays at its own speed (the board's\n * `clips`). A clip of a group is the group's selection (the board's `motion`); and when the figure's data chooses that\n * group's clip, the data wins -- its default too -- so the clip is chosen through a data value the figure's own binding\n * turns into it, given as a saved value (`figureValues`), the way a board would. A clip no data value turns into (a\n * range, a scale, or only another value's fallback of an open field) cannot be chosen here.\n */\nexport type ClipPlay =\n | { kind: 'free' }\n | { kind: 'group'; group: string }\n | { kind: 'data'; group: string; accessor: string; value: FigureDataValue }\n | { kind: 'unreachable'; group: string }\n\nexport function clipPlayOf(asset: FigureAsset, clip: string): ClipPlay {\n const group = (asset.motionGroups ?? []).find(g => g.clips.includes(clip))\n if (!group) return { kind: 'free' }\n const plan = asset.dataInterface ? compileFigureDataInterface(asset) : null\n const ready = plan?.bindings.find(r => r.binding.behavior.kind === 'motion-clip' && r.binding.behavior.group === group.id)\n if (!ready) return { kind: 'group', group: group.id }\n const { binding, node } = ready\n const reached = (value: FigureDataValue): ClipPlay => ({ kind: 'data', group: group.id, accessor: binding.accessor, value })\n const unreachable: ClipPlay = { kind: 'unreachable', group: group.id }\n const closed = node.kind === 'boolean' ? ['false', 'true'] : node.kind === 'text' && node.values ? node.values : null\n const typed = (key: string): FigureDataValue => (node.kind === 'boolean' ? key === 'true' : node.kind === 'number' ? Number(key) : key)\n if (binding.rule === 'value') return node.kind === 'text' && (!closed || closed.includes(clip)) ? reached(clip) : unreachable\n if (binding.rule !== 'map') return unreachable\n const param = binding.param ?? {}\n const key = Object.keys(param).find(k => k !== 'default' && param[k] === clip)\n if (key !== undefined) return reached(typed(key))\n /* Only the fallback turns into it: a value of a closed field the map does not name. */\n const spare = param.default === clip ? closed?.find(v => !Object.hasOwn(param, v)) : undefined\n return spare !== undefined ? reached(typed(spare)) : unreachable\n}\n\n/**\n * What the board is told for the clip playing (none: ''): the free clips' speeds, the group's selection, and the saved\n * data value that chooses it. Every key is written whole, so the clip played before is let go.\n */\nexport function playSettingsOf(asset: FigureAsset, playing: string) {\n const play = playing ? clipPlayOf(asset, playing) : null\n const clips = Object.fromEntries([...new Set((asset.drivers ?? []).filter(d => !(asset.motionGroups ?? []).some(g => g.clips.includes(d.clip))).map(d => d.clip))].map(c => [c, c === playing ? 1 : 0]))\n const motion = play && play.kind !== 'free' && play.kind !== 'unreachable' ? { [play.group]: { clip: playing, speed: 1, paused: false } } : {}\n const figureValues = play?.kind === 'data' ? { [play.accessor]: play.value } : {}\n return { clips, motion, figureValues }\n}\n"]}
1
+ {"version":3,"file":"detail-motion.js","sourceRoot":"","sources":["../client/detail-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAA0C,MAAM,wBAAwB,CAAA;AAE3G,4FAA4F;AAC5F,MAAM,UAAU,iBAAiB,CAAC,KAAkB,EAAE,MAA8B,EAAE,IAAY;IAChG,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5F,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACrF,CAAC;AAED,kHAAkH;AAClH,MAAM,UAAU,YAAY,CAAC,KAAkB,EAAE,EAAU;IACzD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACzF,CAAC;AAeD,MAAM,UAAU,UAAU,CAAC,KAAkB,EAAE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,EAAE,CAAA;IACjF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;AACxC,CAAC","sourcesContent":["import { compileFigureDataInterface, type FigureAsset, type FigureDataValue } from '@hatiolab/figure-model'\n\n/** External values win over drivers; release only the controls owned by the chosen clip. */\nexport function parametersForClip(asset: FigureAsset, values: Record<string, number>, clip: string) {\n const driven = new Set((asset.drivers ?? []).filter(d => d.clip === clip).map(d => d.state))\n return Object.fromEntries(Object.entries(values).filter(([id]) => !driven.has(id)))\n}\n\n/** The clips that move an input. A clip can move many inputs, so it plays on its own row, never on an input's. */\nexport function clipsDriving(asset: FigureAsset, id: string) {\n return [...new Set((asset.drivers ?? []).filter(d => d.state === id).map(d => d.clip))]\n}\n\n/**\n * How the detail view plays a clip (ADR-0051 §3.2, §8). A clip in no motion group plays at its own speed (the board's\n * `clips`). A clip of a group is the group's selection (the board's `motion`); and when the figure's data chooses that\n * group's clip, the data wins -- its default too -- so the clip is chosen through a data value the figure's own binding\n * turns into it, given as a saved value (`figureValues`), the way a board would. A clip no data value turns into (a\n * range, a scale, or only another value's fallback of an open field) cannot be chosen here.\n */\nexport type ClipPlay =\n | { kind: 'free' }\n | { kind: 'group'; group: string }\n | { kind: 'data'; group: string; accessor: string; value: FigureDataValue }\n | { kind: 'unreachable'; group: string }\n\nexport function clipPlayOf(asset: FigureAsset, clip: string): ClipPlay {\n const group = (asset.motionGroups ?? []).find(g => g.clips.includes(clip))\n if (!group) return { kind: 'free' }\n const plan = asset.dataInterface ? compileFigureDataInterface(asset) : null\n const ready = plan?.bindings.find(r => r.binding.behavior.kind === 'motion-clip' && r.binding.behavior.group === group.id)\n if (!ready) return { kind: 'group', group: group.id }\n const { binding, node } = ready\n const reached = (value: FigureDataValue): ClipPlay => ({ kind: 'data', group: group.id, accessor: binding.accessor, value })\n const unreachable: ClipPlay = { kind: 'unreachable', group: group.id }\n const closed = node.kind === 'boolean' ? ['false', 'true'] : node.kind === 'text' && node.values ? node.values : null\n const typed = (key: string): FigureDataValue => (node.kind === 'boolean' ? key === 'true' : node.kind === 'number' ? Number(key) : key)\n if (binding.rule === 'value') return node.kind === 'text' && (!closed || closed.includes(clip)) ? reached(clip) : unreachable\n if (binding.rule !== 'map') return unreachable\n const param = binding.param ?? {}\n const key = Object.keys(param).find(k => k !== 'default' && param[k] === clip)\n if (key !== undefined) return reached(typed(key))\n /* Only the fallback turns into it: a value of a closed field the map does not name. */\n const spare = param.default === clip ? closed?.find(v => !Object.hasOwn(param, v)) : undefined\n return spare !== undefined ? reached(typed(spare)) : unreachable\n}\n\n/**\n * What the board is told for the clip playing (none: ''): the free clips' speeds, the group's selection, and the saved\n * data value that chooses it. Every key is written whole, so the clip played before is let go.\n */\nexport function playSettingsOf(asset: FigureAsset, playing: string) {\n const play = playing ? clipPlayOf(asset, playing) : null\n const clips = Object.fromEntries([...new Set((asset.drivers ?? []).filter(d => !(asset.motionGroups ?? []).some(g => g.clips.includes(d.clip))).map(d => d.clip))].map(c => [c, c === playing ? 1 : 0]))\n const motion = play && play.kind !== 'free' && play.kind !== 'unreachable' ? { [play.group]: { clip: playing, speed: 1, paused: false } } : {}\n const figureValues = play?.kind === 'data' ? { [play.accessor]: play.value } : {}\n return { clips, motion, figureValues }\n}\n"]}
@@ -3,6 +3,7 @@ import '@material/web/icon/icon.js';
3
3
  import { css, html, LitElement, nothing } from 'lit';
4
4
  import { customElement, property, query, state } from 'lit/decorators.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
+ import { ScrollbarStyles } from '@operato/styles';
6
7
  import { SurfaceStyles } from '@things-factory/styles';
7
8
  import { compileFigureAsset, FIGURE_INSTANCE_SIZE_INPUTS } from '@hatiolab/figure-model';
8
9
  import { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene';
@@ -10,7 +11,7 @@ import { authoredSizeOf } from './preview-model.js';
10
11
  import { controlsOf } from './controls.js';
11
12
  import { DEFAULT_VIEW, previewBoardDepth, sceneLook } from './figure-view.js';
12
13
  import { SidePanelStyles } from './side-panel-styles.js';
13
- import { clipForControl, clipPlayOf, parametersForClip, playSettingsOf } from './detail-motion.js';
14
+ import { clipPlayOf, clipsDriving, parametersForClip, playSettingsOf } from './detail-motion.js';
14
15
  export const FIGURE_VIEWER_TABS = ['info', 'size', 'motion'];
15
16
  /**
16
17
  * A single board instance. Sizes and poses are transient, and never change the asset or call a mutation.
@@ -37,10 +38,10 @@ let FigureAssetViewer = class FigureAssetViewer extends localize(i18next)(LitEle
37
38
  this.board = { x: 0, z: 0 };
38
39
  }
39
40
  /*
40
- The modeller's side panel look (SidePanelStyles) and the suite's tab strip (SurfaceStyles' .ui-tabs); only the
41
- viewport, the tab body and the slider rows are this element's.
41
+ The modeller's side panel look (SidePanelStyles), the suite's tab strip (SurfaceStyles' .ui-tabs) and its scrollbar
42
+ for the tab body (ScrollbarStyles); only the viewport, the tab body and the slider rows are this element's.
42
43
  */
43
- static { this.styles = [SidePanelStyles, SurfaceStyles, css `
44
+ static { this.styles = [SidePanelStyles, SurfaceStyles, ScrollbarStyles, css `
44
45
  :host { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
45
46
  /* The card's own 4:3, so the picture taken is what is seen. */
46
47
  [viewport] { flex: none; aspect-ratio: 4 / 3; position: relative; background: #858585; }
@@ -61,13 +62,14 @@ let FigureAssetViewer = class FigureAssetViewer extends localize(i18next)(LitEle
61
62
  section + section { border-top: 1px solid var(--md-sys-color-outline-variant); }
62
63
  section:last-child { border-bottom: none; }
63
64
  h3 { justify-content: space-between; margin: 0 0 2px; }
64
- /* A slider row: its name, the line to drag, and the number -- one 22px line, the number read as text. */
65
65
  /*
66
- A slider row: its name, the line to drag, the number, and a play mark. The name column is wide enough for a joint's
67
- name and unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name.
66
+ A slider row: its name, the line to drag, and the number. The name column is wide enough for a joint's name and
67
+ unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name. A clip's row is its name
68
+ and its play mark.
68
69
  */
69
70
  div[slide] { display: grid; grid-template-columns: 120px minmax(64px, 1fr) 52px 22px; align-items: center; gap: 8px; min-height: 22px; }
70
71
  div[slide] > span { color: var(--md-sys-color-on-surface-variant); overflow-wrap: anywhere; line-height: 1.3; }
72
+ div[slide][clip] > span { grid-column: 1 / 4; }
71
73
  div[slide] input[type='number'] { min-height: 0; height: 20px; padding: 0 2px; border: none; border-bottom: 1px solid transparent; border-radius: 0;
72
74
  background: none; text-align: right; font-family: var(--mono-font, monospace); -moz-appearance: textfield; }
73
75
  div[slide] input[type='number']::-webkit-inner-spin-button, div[slide] input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
@@ -178,24 +180,28 @@ let FigureAssetViewer = class FigureAssetViewer extends localize(i18next)(LitEle
178
180
  })}
179
181
  </section>`;
180
182
  }
183
+ /*
184
+ The inputs, then the clips. A clip can move many inputs -- the robot dog's walk moves all eight leg joints -- so it
185
+ plays on its own row (user 2026-10-15: a play mark on fl-thigh played the walk and every leg moved). An input the
186
+ clip playing moves cannot be dragged; one a clip played and let go of stands where the clip left it, so its number
187
+ is not shown until it is dragged.
188
+ */
181
189
  renderMotion(asset, controls, clips) {
182
190
  return html `<section>
183
191
  ${controls.map(c => {
184
- const clip = clipForControl(asset, c.id);
185
- const on = !!clip && this.playing === clip;
192
+ const driving = clipsDriving(asset, c.id);
193
+ const moving = driving.includes(this.playing);
194
+ const held = moving || (driving.some(clip => this.played.has(clip)) && !(c.id in this.values));
186
195
  return html `<div slide><span title=${`${c.label} · ${c.unit}`}>${c.label} · ${c.unit}</span>
187
- <input type="range" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${on}
196
+ <input type="range" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${moving}
188
197
  @input=${(e) => this.pose(c.id, e.target.valueAsNumber)}>
189
- <output>${on ? i18next.t('figure.text.detail-playing')
190
- : this.played.has(clip ?? '') && !(c.id in this.values) ? i18next.t('figure.text.detail-paused') : Math.round(c.value * 100) / 100}</output>
191
- ${clip ? this.playButton(clip) : html `<span></span>`}</div>`;
198
+ <output>${held ? '' : Math.round(c.value * 100) / 100}</output><span></span></div>`;
192
199
  })}
193
- ${ /* A clip that drives no control shown here still gets its line. */''}
194
- ${clips.filter(name => !controls.some(c => clipForControl(asset, c.id) === name)).map(name => html `<div slide>
195
- <span title=${name}>${name}</span><span></span>
196
- <output>${this.playing === name ? i18next.t('figure.text.detail-playing') : ''}</output>${this.playButton(name)}</div>`)}
197
200
  ${!controls.length && !clips.length ? html `<p hint>${i18next.t('figure.text.detail-no-motion')}</p>` : nothing}
198
- </section>`;
201
+ </section>
202
+ ${clips.length ? html `<section>
203
+ ${clips.map(name => html `<div slide clip><span title=${name}>${name}</span>${this.playButton(name)}</div>`)}
204
+ </section>` : nothing}`;
199
205
  }
200
206
  /**
201
207
  * The view as it stands -- turned, zoomed and sized by the person -- as the card's picture, at the size and in the
@@ -1 +1 @@
1
- {"version":3,"file":"figure-asset-viewer.js","sourceRoot":"","sources":["../client/figure-asset-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAoB,MAAM,wBAAwB,CAAA;AAC1G,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EA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,KAAK,EAAE;;+CAAsD;AAC7C;IAAhB,KAAK,EAAE;;gDAA2D;AAClD;IAAhB,KAAK,EAAE;;iDAA4C;AACnC;IAAhB,KAAK,EAAE;;kDAAqB;AACZ;IAAhB,KAAK,EAAE;;gDAAmB;AA1DhB,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAkT7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport { css, html, LitElement, nothing, type PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { i18next, localize } from '@operato/i18n'\nimport { SurfaceStyles } from '@things-factory/styles'\nimport { compileFigureAsset, FIGURE_INSTANCE_SIZE_INPUTS, type FigureAsset } from '@hatiolab/figure-model'\nimport { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene'\nimport { authoredSizeOf } from './preview-model.js'\nimport { controlsOf } from './controls.js'\nimport { DEFAULT_VIEW, previewBoardDepth, sceneLook } from './figure-view.js'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { clipForControl, clipPlayOf, parametersForClip, playSettingsOf } from './detail-motion.js'\n\ntype Axis = 'x' | 'y' | 'z'\n/** What the view's tabs show under it: the figure's facts, its size, its motion. */\nexport type FigureViewerTab = 'info' | 'size' | 'motion'\nexport const FIGURE_VIEWER_TABS: readonly FigureViewerTab[] = ['info', 'size', 'motion']\ninterface Scene {\n dispose?(): void\n resize?(): void\n fit?(type?: string): void\n root?: {\n fitCameraToModel?(): void\n snapshot3d?(width?: number, height?: number, type?: string, quality?: number): Promise<string | undefined>\n\n components?: Array<{ model?: { width?: number; height?: number }; set(props: string | Record<string, unknown>, value?: unknown): void }>\n }\n}\n\n/**\n * A single board instance. Sizes and poses are transient, and never change the asset or call a mutation.\n *\n * The canvas stands at the top and never scrolls away; under it, tabs show the facts, the size or the motion one at a\n * time, and only that body scrolls (user 2026-10-15: the motion sat so far down that playing a clip scrolled the\n * figure out of view). Given a bounded height, the element fills it; without one, it is as tall as what it shows.\n * `tab` is the one shown; choosing another fires `tab-change` (detail `{ tab }`), so a screen showing two can keep them\n * on the same tab.\n */\n@customElement('figure-asset-viewer')\nexport class FigureAssetViewer extends localize(i18next)(LitElement) {\n /*\n The modeller's side panel look (SidePanelStyles) and the suite's tab strip (SurfaceStyles' .ui-tabs); only the\n viewport, the tab body and the slider rows are this element's.\n */\n static styles = [SidePanelStyles, SurfaceStyles, css`\n :host { display: flex; flex-direction: column; min-width: 0; min-height: 0; }\n /* The card's own 4:3, so the picture taken is what is seen. */\n [viewport] { flex: none; aspect-ratio: 4 / 3; position: relative; background: #858585; }\n nav.ui-tabs { flex: none; padding: 0 16px; }\n [tab-body] { flex: 1; min-height: 0; overflow: auto; }\n [stage] { position: absolute; inset: 0; width: 100%; height: 100%; }\n /*\n The view's own marks in its corner, not buttons beside it: fit the whole figure in view (the modeller's fit, the\n same icon and words), and taking the picture when the screen keeps one.\n */\n div[marks] { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }\n div[marks] button { display: inline-grid; place-items: center; width: 28px; height: 28px;\n padding: 0; border: none; border-radius: 50%; background: rgb(0 0 0 / 22%); color: rgb(255 255 255 / 85%); cursor: pointer; }\n div[marks] button:hover:not(:disabled) { background: rgb(0 0 0 / 45%); color: #fff; }\n div[marks] button:disabled { cursor: default; }\n div[marks] md-icon { --md-icon-size: 16px; }\n section { gap: 4px; padding: 10px 16px; }\n section + section { border-top: 1px solid var(--md-sys-color-outline-variant); }\n section:last-child { border-bottom: none; }\n h3 { justify-content: space-between; margin: 0 0 2px; }\n /* A slider row: its name, the line to drag, and the number -- one 22px line, the number read as text. */\n /*\n A slider row: its name, the line to drag, the number, and a play mark. The name column is wide enough for a joint's\n name and unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name.\n */\n div[slide] { display: grid; grid-template-columns: 120px minmax(64px, 1fr) 52px 22px; align-items: center; gap: 8px; min-height: 22px; }\n div[slide] > span { color: var(--md-sys-color-on-surface-variant); overflow-wrap: anywhere; line-height: 1.3; }\n div[slide] input[type='number'] { min-height: 0; height: 20px; padding: 0 2px; border: none; border-bottom: 1px solid transparent; border-radius: 0;\n background: none; text-align: right; font-family: var(--mono-font, monospace); -moz-appearance: textfield; }\n div[slide] input[type='number']::-webkit-inner-spin-button, div[slide] input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }\n div[slide] input[type='number']:hover:not(:disabled) { border-bottom-color: var(--md-sys-color-outline-variant); }\n div[slide] input[type='number']:focus { outline: none; border-bottom-color: var(--md-sys-color-primary); }\n div[slide] input:disabled { opacity: 0.45; }\n div[slide] output { text-align: right; color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }\n button[icon] { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: none; border-radius: 4px;\n background: transparent; color: var(--md-sys-color-on-surface-variant); cursor: pointer; }\n button[icon]:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }\n button[icon] md-icon { --md-icon-size: 16px; }\n button[icon][aria-pressed='true'] { color: var(--md-sys-color-primary); }\n p[hint] { margin: 0; }\n p[error] { margin: 0; padding: 8px 16px; color: var(--md-sys-color-error); }\n `]\n @property({ attribute: false }) asset?: FigureAsset\n /** Keeps a picture of the view as the figure's thumbnail. Without it there is no picture to take. */\n @property({ attribute: false }) keepShot?: (dataUrl: string) => Promise<unknown>\n /** The tab shown under the view. */\n @property({ reflect: true }) tab: FigureViewerTab = 'info'\n @query('[stage]') private stage!: HTMLElement\n @state() private shot: '' | 'saving' | 'saved' | 'failed' = ''\n @state() private sizes: Record<Axis, number> = { x: 1, y: 1, z: 1 }\n @state() private values: Record<string, number> = {}\n @state() private playing = ''\n @state() private error = ''\n private scene?: Scene\n private registered?: string\n private observer?: ResizeObserver\n private needsScene = false\n private played = new Set<string>()\n /** The board the instance stands on, set when the scene is built; its centre is the grid's origin. */\n private board = { x: 0, z: 0 }\n\n connectedCallback() {\n super.connectedCallback()\n this.needsScene = true\n if (this.hasUpdated) this.observer?.observe(this.stage)\n this.requestUpdate()\n }\n\n protected updated(changed: PropertyValues) {\n // Reconnection and a new asset can arrive in the same update. Build exactly once.\n if (changed.has('asset') || this.needsScene) {\n this.needsScene = false\n this.standUp()\n }\n }\n firstUpdated() {\n this.observer = new ResizeObserver(() => this.scene?.resize?.())\n this.observer.observe(this.stage)\n }\n disconnectedCallback() {\n super.disconnectedCallback()\n this.observer?.disconnect()\n this.teardown()\n }\n\n render() {\n const asset = this.asset\n const clips = asset ? [...new Set((asset.drivers ?? []).map(d => d.clip))] : []\n const controls = asset ? controlsOf(asset, this.values) : []\n const shotLabel = this.shot === 'saved' ? i18next.t('figure.text.detail-thumbnail-saved') : i18next.t('figure.button.detail-save-thumbnail')\n const fitLabel = i18next.t('button.fit-view')\n return html`<div viewport><div stage></div>\n ${this.asset && !this.error\n ? html`<div marks>\n <button fit aria-label=${fitLabel} title=${fitLabel} @click=${() => this.fit()}><md-icon>fit_screen</md-icon></button>\n ${this.keepShot\n ? html`<button shoot aria-label=${shotLabel} title=${shotLabel} ?disabled=${this.shot === 'saving'}\n @click=${() => this.takeShot()}><md-icon>${this.shot === 'saved' ? 'check' : 'photo_camera'}</md-icon></button>`\n : nothing}\n </div>`\n : nothing}\n </div>\n ${this.error ? html`<p error role=\"alert\">${this.error}</p>` : nothing}\n ${this.shot === 'failed' ? html`<p error role=\"alert\">${i18next.t('figure.text.detail-thumbnail-failed')}</p>` : nothing}\n ${this.renderTabs()}\n <div tab-body role=\"tabpanel\" aria-labelledby=${`tab-${this.tab}`}>\n ${this.tab === 'info' ? html`<slot name=\"facts\"></slot>` : nothing}\n ${asset && this.tab === 'size' ? this.renderSize(asset) : nothing}\n ${asset && this.tab === 'motion' ? this.renderMotion(asset, controls, clips) : nothing}\n </div>`\n }\n\n /** The tab strip: the facts, the size, the motion. Arrow keys move along it, as the suite's tabs do. */\n private renderTabs() {\n return html`<nav class=\"ui-tabs\" role=\"tablist\" @keydown=${(e: KeyboardEvent) => this.stepTab(e)}>\n ${FIGURE_VIEWER_TABS.map(tab => {\n const on = this.tab === tab\n return html`<button role=\"tab\" id=${`tab-${tab}`} data-tab=${tab} ?data-selected=${on} aria-selected=${String(on)}\n tabindex=${on ? 0 : -1} @click=${() => this.choose(tab)}>${i18next.t(`figure.label.detail-tab-${tab}`)}</button>`\n })}\n </nav>`\n }\n private choose(tab: FigureViewerTab) {\n if (tab === this.tab) return\n this.tab = tab\n this.dispatchEvent(new CustomEvent('tab-change', { detail: { tab }, bubbles: true, composed: true }))\n }\n private stepTab(e: KeyboardEvent) {\n const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0\n if (!step) return\n e.preventDefault()\n const at = FIGURE_VIEWER_TABS.indexOf(this.tab)\n const next = FIGURE_VIEWER_TABS[(at + step + FIGURE_VIEWER_TABS.length) % FIGURE_VIEWER_TABS.length]\n this.choose(next)\n this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>(`button[data-tab=\"${next}\"]`)?.focus())\n }\n\n private renderSize(asset: FigureAsset) {\n return html`<section>\n <h3>${i18next.t('figure.label.detail-size')} · mm\n <button icon reset aria-label=${i18next.t('figure.button.detail-reset')} title=${i18next.t('figure.button.detail-reset')}\n @click=${() => this.reset()}><md-icon>restart_alt</md-icon></button></h3>\n ${(['x', 'y', 'z'] as const).map(axis => {\n const input = asset.document.model.inputs.find(input => input.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n const fixed = !input || input.min === input.max\n return html`<div slide><span>${axis.toUpperCase()}</span>\n <input type=\"range\" aria-label=${`${axis.toUpperCase()} mm`} min=${input?.min ?? this.sizes[axis]} max=${input?.max ?? this.sizes[axis]} step=\"any\"\n .value=${String(this.sizes[axis])} ?disabled=${fixed}\n @input=${(e: Event) => this.resize(axis, (e.target as HTMLInputElement).valueAsNumber)}>\n <input type=\"number\" aria-label=${`${axis.toUpperCase()} mm value`} min=${input?.min ?? this.sizes[axis]} max=${input?.max ?? this.sizes[axis]} step=\"any\"\n .value=${String(this.sizes[axis])} ?disabled=${fixed}\n @change=${(e: Event) => this.resize(axis, (e.target as HTMLInputElement).valueAsNumber)}>\n <span></span>\n </div>`\n })}\n </section>`\n }\n\n private renderMotion(asset: FigureAsset, controls: ReturnType<typeof controlsOf>, clips: string[]) {\n return html`<section>\n ${controls.map(c => {\n const clip = clipForControl(asset, c.id)\n const on = !!clip && this.playing === clip\n return html`<div slide><span title=${`${c.label} · ${c.unit}`}>${c.label} · ${c.unit}</span>\n <input type=\"range\" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${on}\n @input=${(e: Event) => this.pose(c.id, (e.target as HTMLInputElement).valueAsNumber)}>\n <output>${on ? i18next.t('figure.text.detail-playing')\n : this.played.has(clip ?? '') && !(c.id in this.values) ? i18next.t('figure.text.detail-paused') : Math.round(c.value * 100) / 100}</output>\n ${clip ? this.playButton(clip) : html`<span></span>`}</div>`\n })}\n ${/* A clip that drives no control shown here still gets its line. */ ''}\n ${clips.filter(name => !controls.some(c => clipForControl(asset, c.id) === name)).map(name => html`<div slide>\n <span title=${name}>${name}</span><span></span>\n <output>${this.playing === name ? i18next.t('figure.text.detail-playing') : ''}</output>${this.playButton(name)}</div>`)}\n ${!controls.length && !clips.length ? html`<p hint>${i18next.t('figure.text.detail-no-motion')}</p>` : nothing}\n </section>`\n }\n\n /**\n * The view as it stands -- turned, zoomed and sized by the person -- as the card's picture, at the size and in the\n * format the modeller's own picture uses (`thumbnail.ts`). Nothing is taken when the view cannot be drawn.\n */\n private async takeShot() {\n const layer = this.scene?.root\n if (!this.keepShot || !layer?.snapshot3d) return\n this.shot = 'saving'\n try {\n const url = await layer.snapshot3d(480, 360, 'image/webp', 0.85)\n if (typeof url !== 'string' || !url.startsWith('data:')) throw Error('no picture')\n await this.keepShot(url)\n this.shot = 'saved'\n setTimeout(() => this.shot === 'saved' && (this.shot = ''), 1500)\n } catch {\n this.shot = 'failed'\n }\n }\n /** The whole figure in view: the board's fit, then the 3D camera's own (as the modeller canvas fits). */\n fit() {\n this.scene?.fit?.('ratio')\n this.scene?.root?.fitCameraToModel?.()\n }\n /** Play or pause a clip, at the end of the line it moves. */\n private playButton(clip: string) {\n const on = this.playing === clip\n /* A clip the figure's data never turns into cannot be chosen here; it says so instead of pressing to no effect. */\n const unreachable = !!this.asset && clipPlayOf(this.asset, clip).kind === 'unreachable'\n const title = unreachable ? i18next.t('figure.text.detail-clip-by-data', { clip }) : clip\n return html`<button icon play aria-pressed=${String(on)} aria-label=${clip} title=${title} ?disabled=${unreachable} @click=${() => this.play(clip)}>\n <md-icon>${on ? 'pause' : 'play_arrow'}</md-icon></button>`\n }\n private tell(key: string, value: unknown) {\n this.scene?.root?.components?.[0]?.set(key, value)\n }\n private resize(axis: Axis, value: number) {\n const input = this.asset?.document.model.inputs.find(input => input.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n if (!input || !Number.isFinite(value)) { this.requestUpdate(); return }\n const used = Math.min(input.max, Math.max(input.min, value))\n this.sizes = { ...this.sizes, [axis]: used }\n /*\n The model grows about its own centre, which stays on the board's centre -- the origin of the ground grid. A\n board instance is placed by its corner, so the corner moves with the size. The camera stays where the person\n turned it: refitting on every step slid the grid under the model as if the axes had moved.\n */\n this.scene?.root?.components?.[0]?.set(axis === 'x' ? { width: used } : axis === 'y' ? { depth: used } : { height: used })\n this.centre()\n }\n /**\n * The instance's box on the board's centre. The figure fits its box to the room it declares (its motion included),\n * which can be wider than the size asked, so the box is read back rather than computed here.\n */\n private centre() {\n const instance = this.scene?.root?.components?.[0]\n if (!instance?.model) return\n const { width = 0, height = 0 } = instance.model\n instance.set({ left: this.board.x / 2 - width / 2, top: this.board.z / 2 - height / 2 })\n }\n private pose(id: string, value: number) {\n if (!Number.isFinite(value)) return\n this.values = { ...this.values, [id]: value }\n this.tell('parameters', this.values)\n }\n private play(name: string) {\n this.playing = this.playing === name ? '' : name\n if (this.playing && this.asset) {\n this.played.add(name)\n this.values = parametersForClip(this.asset, this.values, name)\n this.tell('parameters', this.values)\n }\n if (!this.asset) return\n /* A clip of a motion group is the group's to choose -- through the data when the data chooses it (detail-motion). */\n const { clips, motion, figureValues } = playSettingsOf(this.asset, this.playing)\n this.tell('clips', clips)\n this.tell('motion', motion)\n this.tell('figureValues', figureValues)\n }\n private reset() {\n if (!this.asset) return\n // A new instance also resets driver clocks. Clearing speeds alone freezes the last pose.\n this.standUp()\n }\n private standUp() {\n this.teardown()\n this.error = ''\n const asset = this.asset\n if (!asset) return\n this.values = {}\n this.playing = ''\n this.shot = ''\n this.played.clear()\n try {\n compileFigureAsset(asset)\n if (!asset.appearance.length) throw Error(i18next.t('figure.text.preview-needs-a-part'))\n this.sizes = authoredSizeOf(asset)\n const type = `figure-detail-${crypto.randomUUID()}`\n registerFigure(type, asset)\n this.registered = type\n const size = this.sizes\n this.board = { x: size.x * 2, z: size.z * 2 }\n this.scene = create({ target: this.stage, mode: 0, model: {\n type: 'model-layer', width: size.x * 2, height: size.z * 2,\n depth: previewBoardDepth({ placement: asset.placement, base: { y: size.y } }, DEFAULT_VIEW.ceilingHeight, 1),\n threed: true, sky: 'color', ...sceneLook(DEFAULT_VIEW),\n placement: DEFAULT_VIEW.placement, heights: { floor: 0, ceiling: DEFAULT_VIEW.ceilingHeight },\n pixelRatio: Math.min(3, (window.devicePixelRatio || 1) * 2),\n components: [{ type, id: 'detail-instance', left: size.x / 2, top: size.z / 2, width: size.x, height: size.z, depth: size.y }]\n } }) as Scene\n this.centre()\n this.scene.resize?.()\n this.fit()\n } catch (error) {\n this.error = (error as Error).message\n this.teardown()\n }\n }\n private teardown() {\n this.scene?.dispose?.()\n this.scene = undefined\n if (this.registered) unregisterFigure(this.registered)\n this.registered = undefined\n }\n}\n"]}
1
+ {"version":3,"file":"figure-asset-viewer.js","sourceRoot":"","sources":["../client/figure-asset-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,U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EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;mDAAiD;AAEnD;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CAA8B;AAChC;IAAzB,KAAK,CAAC,SAAS,CAAC;8BAAiB,WAAW;gDAAA;AAC5B;IAAhB,KAAK,EAAE;;+CAAsD;AAC7C;IAAhB,KAAK,EAAE;;gDAA2D;AAClD;IAAhB,KAAK,EAAE;;iDAA4C;AACnC;IAAhB,KAAK,EAAE;;kDAAqB;AACZ;IAAhB,KAAK,EAAE;;gDAAmB;AA3DhB,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAuT7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport { css, html, LitElement, nothing, type PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { SurfaceStyles } from '@things-factory/styles'\nimport { compileFigureAsset, FIGURE_INSTANCE_SIZE_INPUTS, type FigureAsset } from '@hatiolab/figure-model'\nimport { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene'\nimport { authoredSizeOf } from './preview-model.js'\nimport { controlsOf } from './controls.js'\nimport { DEFAULT_VIEW, previewBoardDepth, sceneLook } from './figure-view.js'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { clipPlayOf, clipsDriving, parametersForClip, playSettingsOf } from './detail-motion.js'\n\ntype Axis = 'x' | 'y' | 'z'\n/** What the view's tabs show under it: the figure's facts, its size, its motion. */\nexport type FigureViewerTab = 'info' | 'size' | 'motion'\nexport const FIGURE_VIEWER_TABS: readonly FigureViewerTab[] = ['info', 'size', 'motion']\ninterface Scene {\n dispose?(): void\n resize?(): void\n fit?(type?: string): void\n root?: {\n fitCameraToModel?(): void\n snapshot3d?(width?: number, height?: number, type?: string, quality?: number): Promise<string | undefined>\n\n components?: Array<{ model?: { width?: number; height?: number }; set(props: string | Record<string, unknown>, value?: unknown): void }>\n }\n}\n\n/**\n * A single board instance. Sizes and poses are transient, and never change the asset or call a mutation.\n *\n * The canvas stands at the top and never scrolls away; under it, tabs show the facts, the size or the motion one at a\n * time, and only that body scrolls (user 2026-10-15: the motion sat so far down that playing a clip scrolled the\n * figure out of view). Given a bounded height, the element fills it; without one, it is as tall as what it shows.\n * `tab` is the one shown; choosing another fires `tab-change` (detail `{ tab }`), so a screen showing two can keep them\n * on the same tab.\n */\n@customElement('figure-asset-viewer')\nexport class FigureAssetViewer extends localize(i18next)(LitElement) {\n /*\n The modeller's side panel look (SidePanelStyles), the suite's tab strip (SurfaceStyles' .ui-tabs) and its scrollbar\n for the tab body (ScrollbarStyles); only the viewport, the tab body and the slider rows are this element's.\n */\n static styles = [SidePanelStyles, SurfaceStyles, ScrollbarStyles, css`\n :host { display: flex; flex-direction: column; min-width: 0; min-height: 0; }\n /* The card's own 4:3, so the picture taken is what is seen. */\n [viewport] { flex: none; aspect-ratio: 4 / 3; position: relative; background: #858585; }\n nav.ui-tabs { flex: none; padding: 0 16px; }\n [tab-body] { flex: 1; min-height: 0; overflow: auto; }\n [stage] { position: absolute; inset: 0; width: 100%; height: 100%; }\n /*\n The view's own marks in its corner, not buttons beside it: fit the whole figure in view (the modeller's fit, the\n same icon and words), and taking the picture when the screen keeps one.\n */\n div[marks] { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }\n div[marks] button { display: inline-grid; place-items: center; width: 28px; height: 28px;\n padding: 0; border: none; border-radius: 50%; background: rgb(0 0 0 / 22%); color: rgb(255 255 255 / 85%); cursor: pointer; }\n div[marks] button:hover:not(:disabled) { background: rgb(0 0 0 / 45%); color: #fff; }\n div[marks] button:disabled { cursor: default; }\n div[marks] md-icon { --md-icon-size: 16px; }\n section { gap: 4px; padding: 10px 16px; }\n section + section { border-top: 1px solid var(--md-sys-color-outline-variant); }\n section:last-child { border-bottom: none; }\n h3 { justify-content: space-between; margin: 0 0 2px; }\n /*\n A slider row: its name, the line to drag, and the number. The name column is wide enough for a joint's name and\n unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name. A clip's row is its name\n and its play mark.\n */\n div[slide] { display: grid; grid-template-columns: 120px minmax(64px, 1fr) 52px 22px; align-items: center; gap: 8px; min-height: 22px; }\n div[slide] > span { color: var(--md-sys-color-on-surface-variant); overflow-wrap: anywhere; line-height: 1.3; }\n div[slide][clip] > span { grid-column: 1 / 4; }\n div[slide] input[type='number'] { min-height: 0; height: 20px; padding: 0 2px; border: none; border-bottom: 1px solid transparent; border-radius: 0;\n background: none; text-align: right; font-family: var(--mono-font, monospace); -moz-appearance: textfield; }\n div[slide] input[type='number']::-webkit-inner-spin-button, div[slide] input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }\n div[slide] input[type='number']:hover:not(:disabled) { border-bottom-color: var(--md-sys-color-outline-variant); }\n div[slide] input[type='number']:focus { outline: none; border-bottom-color: var(--md-sys-color-primary); }\n div[slide] input:disabled { opacity: 0.45; }\n div[slide] output { text-align: right; color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }\n button[icon] { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: none; border-radius: 4px;\n background: transparent; color: var(--md-sys-color-on-surface-variant); cursor: pointer; }\n button[icon]:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }\n button[icon] md-icon { --md-icon-size: 16px; }\n button[icon][aria-pressed='true'] { color: var(--md-sys-color-primary); }\n p[hint] { margin: 0; }\n p[error] { margin: 0; padding: 8px 16px; color: var(--md-sys-color-error); }\n `]\n @property({ attribute: false }) asset?: FigureAsset\n /** Keeps a picture of the view as the figure's thumbnail. Without it there is no picture to take. */\n @property({ attribute: false }) keepShot?: (dataUrl: string) => Promise<unknown>\n /** The tab shown under the view. */\n @property({ reflect: true }) tab: FigureViewerTab = 'info'\n @query('[stage]') private stage!: HTMLElement\n @state() private shot: '' | 'saving' | 'saved' | 'failed' = ''\n @state() private sizes: Record<Axis, number> = { x: 1, y: 1, z: 1 }\n @state() private values: Record<string, number> = {}\n @state() private playing = ''\n @state() private error = ''\n private scene?: Scene\n private registered?: string\n private observer?: ResizeObserver\n private needsScene = false\n private played = new Set<string>()\n /** The board the instance stands on, set when the scene is built; its centre is the grid's origin. */\n private board = { x: 0, z: 0 }\n\n connectedCallback() {\n super.connectedCallback()\n this.needsScene = true\n if (this.hasUpdated) this.observer?.observe(this.stage)\n this.requestUpdate()\n }\n\n protected updated(changed: PropertyValues) {\n // Reconnection and a new asset can arrive in the same update. Build exactly once.\n if (changed.has('asset') || this.needsScene) {\n this.needsScene = false\n this.standUp()\n }\n }\n firstUpdated() {\n this.observer = new ResizeObserver(() => this.scene?.resize?.())\n this.observer.observe(this.stage)\n }\n disconnectedCallback() {\n super.disconnectedCallback()\n this.observer?.disconnect()\n this.teardown()\n }\n\n render() {\n const asset = this.asset\n const clips = asset ? [...new Set((asset.drivers ?? []).map(d => d.clip))] : []\n const controls = asset ? controlsOf(asset, this.values) : []\n const shotLabel = this.shot === 'saved' ? i18next.t('figure.text.detail-thumbnail-saved') : i18next.t('figure.button.detail-save-thumbnail')\n const fitLabel = i18next.t('button.fit-view')\n return html`<div viewport><div stage></div>\n ${this.asset && !this.error\n ? html`<div marks>\n <button fit aria-label=${fitLabel} title=${fitLabel} @click=${() => this.fit()}><md-icon>fit_screen</md-icon></button>\n ${this.keepShot\n ? html`<button shoot aria-label=${shotLabel} title=${shotLabel} ?disabled=${this.shot === 'saving'}\n @click=${() => this.takeShot()}><md-icon>${this.shot === 'saved' ? 'check' : 'photo_camera'}</md-icon></button>`\n : nothing}\n </div>`\n : nothing}\n </div>\n ${this.error ? html`<p error role=\"alert\">${this.error}</p>` : nothing}\n ${this.shot === 'failed' ? html`<p error role=\"alert\">${i18next.t('figure.text.detail-thumbnail-failed')}</p>` : nothing}\n ${this.renderTabs()}\n <div tab-body role=\"tabpanel\" aria-labelledby=${`tab-${this.tab}`}>\n ${this.tab === 'info' ? html`<slot name=\"facts\"></slot>` : nothing}\n ${asset && this.tab === 'size' ? this.renderSize(asset) : nothing}\n ${asset && this.tab === 'motion' ? this.renderMotion(asset, controls, clips) : nothing}\n </div>`\n }\n\n /** The tab strip: the facts, the size, the motion. Arrow keys move along it, as the suite's tabs do. */\n private renderTabs() {\n return html`<nav class=\"ui-tabs\" role=\"tablist\" @keydown=${(e: KeyboardEvent) => this.stepTab(e)}>\n ${FIGURE_VIEWER_TABS.map(tab => {\n const on = this.tab === tab\n return html`<button role=\"tab\" id=${`tab-${tab}`} data-tab=${tab} ?data-selected=${on} aria-selected=${String(on)}\n tabindex=${on ? 0 : -1} @click=${() => this.choose(tab)}>${i18next.t(`figure.label.detail-tab-${tab}`)}</button>`\n })}\n </nav>`\n }\n private choose(tab: FigureViewerTab) {\n if (tab === this.tab) return\n this.tab = tab\n this.dispatchEvent(new CustomEvent('tab-change', { detail: { tab }, bubbles: true, composed: true }))\n }\n private stepTab(e: KeyboardEvent) {\n const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0\n if (!step) return\n e.preventDefault()\n const at = FIGURE_VIEWER_TABS.indexOf(this.tab)\n const next = FIGURE_VIEWER_TABS[(at + step + FIGURE_VIEWER_TABS.length) % FIGURE_VIEWER_TABS.length]\n this.choose(next)\n this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>(`button[data-tab=\"${next}\"]`)?.focus())\n }\n\n private renderSize(asset: FigureAsset) {\n return html`<section>\n <h3>${i18next.t('figure.label.detail-size')} · mm\n <button icon reset aria-label=${i18next.t('figure.button.detail-reset')} title=${i18next.t('figure.button.detail-reset')}\n @click=${() => this.reset()}><md-icon>restart_alt</md-icon></button></h3>\n ${(['x', 'y', 'z'] as const).map(axis => {\n const input = asset.document.model.inputs.find(input => input.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n const fixed = !input || input.min === input.max\n return html`<div slide><span>${axis.toUpperCase()}</span>\n <input type=\"range\" aria-label=${`${axis.toUpperCase()} mm`} min=${input?.min ?? this.sizes[axis]} max=${input?.max ?? this.sizes[axis]} step=\"any\"\n .value=${String(this.sizes[axis])} ?disabled=${fixed}\n @input=${(e: Event) => this.resize(axis, (e.target as HTMLInputElement).valueAsNumber)}>\n <input type=\"number\" aria-label=${`${axis.toUpperCase()} mm value`} min=${input?.min ?? this.sizes[axis]} max=${input?.max ?? this.sizes[axis]} step=\"any\"\n .value=${String(this.sizes[axis])} ?disabled=${fixed}\n @change=${(e: Event) => this.resize(axis, (e.target as HTMLInputElement).valueAsNumber)}>\n <span></span>\n </div>`\n })}\n </section>`\n }\n\n /*\n The inputs, then the clips. A clip can move many inputs -- the robot dog's walk moves all eight leg joints -- so it\n plays on its own row (user 2026-10-15: a play mark on fl-thigh played the walk and every leg moved). An input the\n clip playing moves cannot be dragged; one a clip played and let go of stands where the clip left it, so its number\n is not shown until it is dragged.\n */\n private renderMotion(asset: FigureAsset, controls: ReturnType<typeof controlsOf>, clips: string[]) {\n return html`<section>\n ${controls.map(c => {\n const driving = clipsDriving(asset, c.id)\n const moving = driving.includes(this.playing)\n const held = moving || (driving.some(clip => this.played.has(clip)) && !(c.id in this.values))\n return html`<div slide><span title=${`${c.label} · ${c.unit}`}>${c.label} · ${c.unit}</span>\n <input type=\"range\" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${moving}\n @input=${(e: Event) => this.pose(c.id, (e.target as HTMLInputElement).valueAsNumber)}>\n <output>${held ? '' : Math.round(c.value * 100) / 100}</output><span></span></div>`\n })}\n ${!controls.length && !clips.length ? html`<p hint>${i18next.t('figure.text.detail-no-motion')}</p>` : nothing}\n </section>\n ${clips.length ? html`<section>\n ${clips.map(name => html`<div slide clip><span title=${name}>${name}</span>${this.playButton(name)}</div>`)}\n </section>` : nothing}`\n }\n\n /**\n * The view as it stands -- turned, zoomed and sized by the person -- as the card's picture, at the size and in the\n * format the modeller's own picture uses (`thumbnail.ts`). Nothing is taken when the view cannot be drawn.\n */\n private async takeShot() {\n const layer = this.scene?.root\n if (!this.keepShot || !layer?.snapshot3d) return\n this.shot = 'saving'\n try {\n const url = await layer.snapshot3d(480, 360, 'image/webp', 0.85)\n if (typeof url !== 'string' || !url.startsWith('data:')) throw Error('no picture')\n await this.keepShot(url)\n this.shot = 'saved'\n setTimeout(() => this.shot === 'saved' && (this.shot = ''), 1500)\n } catch {\n this.shot = 'failed'\n }\n }\n /** The whole figure in view: the board's fit, then the 3D camera's own (as the modeller canvas fits). */\n fit() {\n this.scene?.fit?.('ratio')\n this.scene?.root?.fitCameraToModel?.()\n }\n /** Play or pause a clip, at the end of the line it moves. */\n private playButton(clip: string) {\n const on = this.playing === clip\n /* A clip the figure's data never turns into cannot be chosen here; it says so instead of pressing to no effect. */\n const unreachable = !!this.asset && clipPlayOf(this.asset, clip).kind === 'unreachable'\n const title = unreachable ? i18next.t('figure.text.detail-clip-by-data', { clip }) : clip\n return html`<button icon play aria-pressed=${String(on)} aria-label=${clip} title=${title} ?disabled=${unreachable} @click=${() => this.play(clip)}>\n <md-icon>${on ? 'pause' : 'play_arrow'}</md-icon></button>`\n }\n private tell(key: string, value: unknown) {\n this.scene?.root?.components?.[0]?.set(key, value)\n }\n private resize(axis: Axis, value: number) {\n const input = this.asset?.document.model.inputs.find(input => input.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n if (!input || !Number.isFinite(value)) { this.requestUpdate(); return }\n const used = Math.min(input.max, Math.max(input.min, value))\n this.sizes = { ...this.sizes, [axis]: used }\n /*\n The model grows about its own centre, which stays on the board's centre -- the origin of the ground grid. A\n board instance is placed by its corner, so the corner moves with the size. The camera stays where the person\n turned it: refitting on every step slid the grid under the model as if the axes had moved.\n */\n this.scene?.root?.components?.[0]?.set(axis === 'x' ? { width: used } : axis === 'y' ? { depth: used } : { height: used })\n this.centre()\n }\n /**\n * The instance's box on the board's centre. The figure fits its box to the room it declares (its motion included),\n * which can be wider than the size asked, so the box is read back rather than computed here.\n */\n private centre() {\n const instance = this.scene?.root?.components?.[0]\n if (!instance?.model) return\n const { width = 0, height = 0 } = instance.model\n instance.set({ left: this.board.x / 2 - width / 2, top: this.board.z / 2 - height / 2 })\n }\n private pose(id: string, value: number) {\n if (!Number.isFinite(value)) return\n this.values = { ...this.values, [id]: value }\n this.tell('parameters', this.values)\n }\n private play(name: string) {\n this.playing = this.playing === name ? '' : name\n if (this.playing && this.asset) {\n this.played.add(name)\n this.values = parametersForClip(this.asset, this.values, name)\n this.tell('parameters', this.values)\n }\n if (!this.asset) return\n /* A clip of a motion group is the group's to choose -- through the data when the data chooses it (detail-motion). */\n const { clips, motion, figureValues } = playSettingsOf(this.asset, this.playing)\n this.tell('clips', clips)\n this.tell('motion', motion)\n this.tell('figureValues', figureValues)\n }\n private reset() {\n if (!this.asset) return\n // A new instance also resets driver clocks. Clearing speeds alone freezes the last pose.\n this.standUp()\n }\n private standUp() {\n this.teardown()\n this.error = ''\n const asset = this.asset\n if (!asset) return\n this.values = {}\n this.playing = ''\n this.shot = ''\n this.played.clear()\n try {\n compileFigureAsset(asset)\n if (!asset.appearance.length) throw Error(i18next.t('figure.text.preview-needs-a-part'))\n this.sizes = authoredSizeOf(asset)\n const type = `figure-detail-${crypto.randomUUID()}`\n registerFigure(type, asset)\n this.registered = type\n const size = this.sizes\n this.board = { x: size.x * 2, z: size.z * 2 }\n this.scene = create({ target: this.stage, mode: 0, model: {\n type: 'model-layer', width: size.x * 2, height: size.z * 2,\n depth: previewBoardDepth({ placement: asset.placement, base: { y: size.y } }, DEFAULT_VIEW.ceilingHeight, 1),\n threed: true, sky: 'color', ...sceneLook(DEFAULT_VIEW),\n placement: DEFAULT_VIEW.placement, heights: { floor: 0, ceiling: DEFAULT_VIEW.ceilingHeight },\n pixelRatio: Math.min(3, (window.devicePixelRatio || 1) * 2),\n components: [{ type, id: 'detail-instance', left: size.x / 2, top: size.z / 2, width: size.x, height: size.z, depth: size.y }]\n } }) as Scene\n this.centre()\n this.scene.resize?.()\n this.fit()\n } catch (error) {\n this.error = (error as Error).message\n this.teardown()\n }\n }\n private teardown() {\n this.scene?.dispose?.()\n this.scene = undefined\n if (this.registered) unregisterFigure(this.registered)\n this.registered = undefined\n }\n}\n"]}