@things-factory/figure-ui 10.1.225 → 10.1.226

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 (73) hide show
  1. package/client/modeller/consumer-capabilities.ts +15 -0
  2. package/client/modeller/editor-styles.ts +18 -1
  3. package/client/modeller/editor.ts +38 -26
  4. package/client/modeller/figure-capability-panel.ts +31 -10
  5. package/client/modeller/figure-clips.ts +2 -1
  6. package/client/modeller/figure-controls.ts +4 -3
  7. package/client/modeller/figure-data-panel.ts +24 -7
  8. package/client/modeller/figure-links.ts +5 -5
  9. package/client/modeller/figure-material-panel.ts +2 -0
  10. package/client/modeller/figure-preview.ts +69 -2
  11. package/client/modeller/figure-recipe-catalog.ts +4 -0
  12. package/client/modeller/figure-slot-layout-panel.ts +25 -8
  13. package/client/modeller/figure-verdict.ts +4 -1
  14. package/client/modeller/unit-words.ts +11 -0
  15. package/client/pages/figure-modeller-page.ts +3 -2
  16. package/dist-client/modeller/consumer-capabilities.d.ts +11 -0
  17. package/dist-client/modeller/consumer-capabilities.js +14 -0
  18. package/dist-client/modeller/consumer-capabilities.js.map +1 -1
  19. package/dist-client/modeller/editor-styles.js +18 -1
  20. package/dist-client/modeller/editor-styles.js.map +1 -1
  21. package/dist-client/modeller/editor.js +38 -26
  22. package/dist-client/modeller/editor.js.map +1 -1
  23. package/dist-client/modeller/figure-capability-panel.d.ts +3 -0
  24. package/dist-client/modeller/figure-capability-panel.js +29 -11
  25. package/dist-client/modeller/figure-capability-panel.js.map +1 -1
  26. package/dist-client/modeller/figure-clips.js +2 -1
  27. package/dist-client/modeller/figure-clips.js.map +1 -1
  28. package/dist-client/modeller/figure-controls.js +4 -3
  29. package/dist-client/modeller/figure-controls.js.map +1 -1
  30. package/dist-client/modeller/figure-data-panel.js +24 -7
  31. package/dist-client/modeller/figure-data-panel.js.map +1 -1
  32. package/dist-client/modeller/figure-links.js +5 -5
  33. package/dist-client/modeller/figure-links.js.map +1 -1
  34. package/dist-client/modeller/figure-material-panel.js +2 -0
  35. package/dist-client/modeller/figure-material-panel.js.map +1 -1
  36. package/dist-client/modeller/figure-preview.d.ts +3 -0
  37. package/dist-client/modeller/figure-preview.js +78 -2
  38. package/dist-client/modeller/figure-preview.js.map +1 -1
  39. package/dist-client/modeller/figure-recipe-catalog.js +4 -0
  40. package/dist-client/modeller/figure-recipe-catalog.js.map +1 -1
  41. package/dist-client/modeller/figure-slot-layout-panel.d.ts +1 -1
  42. package/dist-client/modeller/figure-slot-layout-panel.js +25 -8
  43. package/dist-client/modeller/figure-slot-layout-panel.js.map +1 -1
  44. package/dist-client/modeller/figure-verdict.js +4 -1
  45. package/dist-client/modeller/figure-verdict.js.map +1 -1
  46. package/dist-client/modeller/unit-words.d.ts +5 -0
  47. package/dist-client/modeller/unit-words.js +12 -0
  48. package/dist-client/modeller/unit-words.js.map +1 -0
  49. package/dist-client/pages/figure-modeller-page.js +3 -2
  50. package/dist-client/pages/figure-modeller-page.js.map +1 -1
  51. package/dist-client/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +9 -9
  53. package/test/browser/editing-page.js +3 -3
  54. package/test/browser/editing.check.mjs +5 -5
  55. package/test/browser/links-page.js +1 -1
  56. package/test/browser/links.check.mjs +2 -3
  57. package/test/browser/modeller-page.js +4 -4
  58. package/test/browser/modeller-revision.check.mjs +5 -5
  59. package/test/browser/modeller.check.mjs +5 -5
  60. package/test/browser/parts.check.mjs +2 -2
  61. package/test/browser/product-page.check.mjs +6 -0
  62. package/test/browser/props.check.mjs +3 -4
  63. package/test/browser/row-preview.check.mjs +3 -3
  64. package/test/browser/screen.check.mjs +13 -11
  65. package/test/consumer-capabilities.test.ts +7 -0
  66. package/test/links.test.ts +1 -1
  67. package/test/refusals.test.ts +1 -1
  68. package/translations/en.json +23 -12
  69. package/translations/es.json +23 -12
  70. package/translations/ja.json +24 -13
  71. package/translations/ko.json +82 -71
  72. package/translations/ms.json +23 -12
  73. package/translations/zh.json +23 -12
@@ -22,6 +22,9 @@ export declare class FigureCapabilityPanel extends FigureCapabilityPanel_base {
22
22
  selected: string;
23
23
  locked: boolean;
24
24
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
25
+ private renderPlaces;
26
+ /** Whether the figure is an item: what a product capability may need first, so it stands first (sweep 2026-10-27 J4). */
27
+ private renderItem;
25
28
  /** The products' capabilities: those this modeller knows, each on or off with its settings, and those it does not know. */
26
29
  private renderConsumers;
27
30
  /** A capability's settings as its descriptor draws them, and what its check says of them. */
@@ -3,12 +3,13 @@ import { css, html, LitElement, nothing } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
4
  import { live } from 'lit/directives/live.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
+ import { unitWord } from './unit-words.js';
6
7
  import { figureBindingsOf } from '@hatiolab/figure-model';
7
8
  import { RUNGS, rungOf } from '@things-factory/figure-viewer/dist-client/capability-rung.js';
8
9
  import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
9
10
  import { placeTerms } from '@things-factory/figure-viewer/dist-client/detail-facts.js';
10
11
  import { onFigureCapabilitiesChanged } from '@hatiolab/things-scene';
11
- import { consumerDescriptors, inputTableAt, namesWith, needsMissing, partsAt, settingsIssues, settingsOf, unknownConsumerNames, withInputTable, withParts } from './consumer-capabilities.js';
12
+ import { consumerDescriptors, inputTableAt, namesWith, needsMissing, needsOffered, partsAt, settingsIssues, settingsOf, unknownConsumerNames, withInputTable, withParts } from './consumer-capabilities.js';
12
13
  /**
13
14
  * 자리·능력 — what the figure does on a board: the ladder from drawing only, to
14
15
  * holding things, to passing them on, and every place things are held, whatever part it is on. A place is not drawn,
@@ -123,7 +124,8 @@ let FigureCapabilityPanel = class FigureCapabilityPanel extends localize(i18next
123
124
  const names = asset.document.capabilities.names ?? [];
124
125
  const rung = rungOf(names);
125
126
  const places = figureBindingsOf(asset);
126
- return html `<section>
127
+ return html `${this.renderItem(asset)}
128
+ <section>
127
129
  <h3>${i18next.t('figure.label.what-this-does')}</h3>
128
130
  ${['none', 'hold', 'flow'].map(which => html `<label rung ?on=${rung === which}>
129
131
  <input type="radio" name="rung" .checked=${live(rung === which)} ?disabled=${this.locked} @change=${() => this.setRung(which)} />
@@ -133,10 +135,17 @@ let FigureCapabilityPanel = class FigureCapabilityPanel extends localize(i18next
133
135
  </span>
134
136
  </label>`)}
135
137
  ${rung === null ? html `<p hint>${i18next.t('figure.text.capability-hand-written')}</p>` : nothing}
136
- ${names.length ? html `<code>${names.join(' · ')}</code>` : nothing}
137
138
  </section>
138
139
  ${this.renderConsumers(asset)}
139
- <section>
140
+ ${places.length || !this.selected ? this.renderPlaces(places, rung) : nothing}
141
+ `;
142
+ }
143
+ /*
144
+ The figure's places. None yet, with a part picked: nothing here -- the part's own place form stands above, and 「pick a
145
+ part and add one」 under it told the author what they were doing (sweep 2026-10-27 U20).
146
+ */
147
+ renderPlaces(places, rung) {
148
+ return html `<section>
140
149
  <h3>${i18next.t('figure.label.places')}</h3>
141
150
  ${places.length
142
151
  ? places.map(one => html `<button place ?on=${one.part === this.selected} @click=${() => one.part && this.pick(one.part)}>
@@ -148,8 +157,11 @@ let FigureCapabilityPanel = class FigureCapabilityPanel extends localize(i18next
148
157
  </button>`)
149
158
  : html `<p hint>${i18next.t('figure.text.no-places')}</p>`}
150
159
  ${places.length && rung === 'none' ? html `<p hint>${i18next.t('figure.text.place-needs-holding')}</p>` : nothing}
151
- </section>
152
- <section>
160
+ </section>`;
161
+ }
162
+ /** Whether the figure is an item: what a product capability may need first, so it stands first (sweep 2026-10-27 J4). */
163
+ renderItem(asset) {
164
+ return html `<section>
153
165
  <h3>${i18next.t('figure.label.item')}</h3>
154
166
  <label item ?on=${!!asset.item}>
155
167
  <input type="checkbox" .checked=${live(!!asset.item)} ?disabled=${this.locked} @change=${(e) => this.setItem(e.target.checked)} />
@@ -158,8 +170,7 @@ let FigureCapabilityPanel = class FigureCapabilityPanel extends localize(i18next
158
170
  <em>${i18next.t('figure.text.is-item-note')}</em>
159
171
  </span>
160
172
  </label>
161
- </section>
162
- `;
173
+ </section>`;
163
174
  }
164
175
  /** The products' capabilities: those this modeller knows, each on or off with its settings, and those it does not know. */
165
176
  renderConsumers(asset) {
@@ -173,15 +184,22 @@ let FigureCapabilityPanel = class FigureCapabilityPanel extends localize(i18next
173
184
  ${known.map(d => {
174
185
  const on = names.includes(d.name);
175
186
  const missing = needsMissing(d, asset);
187
+ const offered = needsOffered(d, asset);
188
+ const needs = [
189
+ ...(offered.item ? [i18next.t('figure.label.is-item')] : []),
190
+ ...(offered.rungs.length
191
+ ? [i18next.t('figure.text.product-capability-needs-rungs', { rungs: offered.rungs.map(r => i18next.t(`figure.label.rung-${r}`)).join(i18next.t('figure.label.or-between')) })]
192
+ : []),
193
+ ...offered.names
194
+ ];
176
195
  return html `<label rung ?on=${on}>
177
196
  <input type="checkbox" .checked=${live(on)} ?disabled=${this.locked || (!on && missing.length > 0)} @change=${(e) => this.setConsumer(asset, d.name, e.target.checked)} />
178
197
  <span>
179
198
  <strong>${d.label}</strong>
180
199
  <em>${d.note}</em>
181
- <code>${d.name} · ${d.version}</code>
200
+ ${needs.length ? html `<small needs>${i18next.t('figure.text.product-capability-needs', { needs: needs.join(', ') })}</small>` : nothing}
182
201
  </span>
183
202
  </label>
184
- ${missing.length ? html `<p hint>${i18next.t('figure.text.product-capability-needs', { needs: missing.map(m => (m === 'item' ? i18next.t('figure.label.is-item') : m)).join(', ') })}</p>` : nothing}
185
203
  ${on ? this.renderSettings(asset, d) : nothing}`;
186
204
  })}
187
205
  ${unknown.map(name => html `<p hint>
@@ -215,7 +233,7 @@ let FigureCapabilityPanel = class FigureCapabilityPanel extends localize(i18next
215
233
  return html `<span>${setting.label}</span>
216
234
  <select ?disabled=${this.locked} @change=${(e) => write(withInputTable(settings, setting, e.target.value || undefined, table.values))}>
217
235
  <option value="" ?selected=${!table.input}>${i18next.t('figure.label.data-none')}</option>
218
- ${inputs.map(i => html `<option value=${i.id} ?selected=${i.id === table.input}>${asset.stateInputs?.[i.id]?.label ?? i.id}${i.unit ? ` (${i.unit} ${i.min ?? ''}~${i.max ?? ''})` : ''}</option>`)}
236
+ ${inputs.map(i => html `<option value=${i.id} ?selected=${i.id === table.input}>${asset.stateInputs?.[i.id]?.label ?? i.id}${i.unit ? ` (${unitWord(i.unit)} ${i.min ?? ''}~${i.max ?? ''})` : ''}</option>`)}
219
237
  </select>
220
238
  ${table.input
221
239
  ? html `<span></span>
@@ -1 +1 @@
1
- {"version":3,"file":"figure-capability-panel.js","sourceRoot":"","sources":["../../client/modeller/figure-capability-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAa,MAAM,8DAA8D,CAAA;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,gEAAgE,CAAA;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAA;AACtF,OAAO,EAAE,2BAA2B,EAAiE,MAAM,wBAAwB,CAAA;AAEnI,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,cAAc,EACd,SAAS,EACV,MAAM,4BAA4B,CAAA;AAEnC;;;;;;;;;;GAUG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAjE;;QAgGL,kDAAkD;QACtC,aAAQ,GAAG,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AAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC7G,CAAC;;AA3J+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;oDAAoB;AAEvC;IAAX,QAAQ,EAAE;;uDAAc;AACI;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAe;AAlGhC,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA2PjC","sourcesContent":["import { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { figureBindingsOf } from '@hatiolab/figure-model'\nimport type { FigureAsset } from '@hatiolab/figure-model'\nimport { RUNGS, rungOf, type Rung } from '@things-factory/figure-viewer/dist-client/capability-rung.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\nimport { placeTerms } from '@things-factory/figure-viewer/dist-client/detail-facts.js'\nimport { onFigureCapabilitiesChanged, type FigureCapabilityDescriptor, type FigureCapabilitySetting } from '@hatiolab/things-scene'\n\nimport {\n consumerDescriptors,\n inputTableAt,\n namesWith,\n needsMissing,\n partsAt,\n settingsIssues,\n settingsOf,\n unknownConsumerNames,\n withInputTable,\n withParts\n} from './consumer-capabilities.js'\n\n/**\n * 자리·능력 — what the figure does on a board: the ladder from drawing only, to\n * holding things, to passing them on, and every place things are held, whatever part it is on. A place is not drawn,\n * so the list is the only way to find one; choosing a row selects its part, where the place is edited. Whether the\n * figure is the look of an item a holder carries is said here too (ADR-0155 amendment 2): a tag, apart from the ladder,\n * since an item may hold things as well.\n *\n * Below the ladder, the products' capabilities this modeller has descriptors for (ADR-0167 9, 12): each put on or off,\n * what it still needs, and its settings as its descriptor draws them -- parts picked (the part chosen here by one\n * button), an input and a value per fixed key, never a row added or taken away -- with what its check says.\n */\n@customElement('figure-capability-panel')\nexport class FigureCapabilityPanel extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n label[rung],\n label[item] {\n display: flex;\n gap: 8px;\n align-items: flex-start;\n padding: 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n cursor: pointer;\n }\n /* The box keeps its size beside a long note: squeezed by the flex row it read as a dot (sweep 2026-10-27 U1). */\n label[rung] > input,\n label[item] > input {\n flex: none;\n margin: 2px 0 0;\n }\n label[rung][on],\n label[item][on] {\n border-color: var(--md-sys-color-primary);\n background: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n label[rung] span,\n label[item] span {\n display: grid;\n gap: 2px;\n }\n label[rung] em,\n label[item] em,\n p[hint],\n small {\n font-style: normal;\n margin: 0;\n color: var(--md-sys-color-on-surface-variant);\n }\n button[place] {\n display: grid;\n gap: 2px;\n text-align: left;\n padding: 6px 8px;\n font: inherit;\n color: inherit;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n background: none;\n cursor: pointer;\n }\n button[place][on] {\n border-color: var(--md-sys-color-primary);\n }\n code {\n font-size: var(--ui-t-small, 11.5px);\n color: var(--md-sys-color-on-surface-variant);\n }\n div[chips] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 10px;\n align-items: center;\n }\n div[chips] label {\n display: inline-flex;\n gap: 4px;\n align-items: center;\n }\n div[table] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);\n gap: 4px 6px;\n align-items: center;\n }\n p[warn] {\n margin: 0;\n color: var(--md-sys-color-error);\n }\n `]\n\n private unlisten?: () => void\n\n connectedCallback() {\n super.connectedCallback()\n /* A product's descriptors may be registered after the panel stands. */\n this.unlisten = onFigureCapabilitiesChanged(() => this.requestUpdate())\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.unlisten?.()\n }\n\n @property({ attribute: false }) asset?: FigureAsset\n /** The selected part, whose places are marked. */\n @property() selected = ''\n @property({ type: Boolean }) locked = false\n\n render() {\n const asset = this.asset\n if (!asset) return nothing\n const names = asset.document.capabilities.names ?? []\n const rung = rungOf(names)\n const places = figureBindingsOf(asset)\n return html`<section>\n <h3>${i18next.t('figure.label.what-this-does')}</h3>\n ${(['none', 'hold', 'flow'] as const).map(\n which => html`<label rung ?on=${rung === which}>\n <input type=\"radio\" name=\"rung\" .checked=${live(rung === which)} ?disabled=${this.locked} @change=${() => this.setRung(which)} />\n <span>\n <strong>${i18next.t(`figure.label.rung-${which}`)}</strong>\n <em>${i18next.t(`figure.text.rung-${which}-note`)}</em>\n </span>\n </label>`\n )}\n ${rung === null ? html`<p hint>${i18next.t('figure.text.capability-hand-written')}</p>` : nothing}\n ${names.length ? html`<code>${names.join(' · ')}</code>` : nothing}\n </section>\n ${this.renderConsumers(asset)}\n <section>\n <h3>${i18next.t('figure.label.places')}</h3>\n ${places.length\n ? places.map(\n one => html`<button place ?on=${one.part === this.selected} @click=${() => one.part && this.pick(one.part)}>\n <strong>${one.label}</strong>\n <small>\n ${one.part ?? '?'}${one.face ? ' · ' + i18next.t('figure.label.face-' + one.face) : ''} ·\n ${placeTerms(one, (key, params) => i18next.t(key, params))}\n </small>\n </button>`\n )\n : html`<p hint>${i18next.t('figure.text.no-places')}</p>`}\n ${places.length && rung === 'none' ? html`<p hint>${i18next.t('figure.text.place-needs-holding')}</p>` : nothing}\n </section>\n <section>\n <h3>${i18next.t('figure.label.item')}</h3>\n <label item ?on=${!!asset.item}>\n <input type=\"checkbox\" .checked=${live(!!asset.item)} ?disabled=${this.locked} @change=${(e: Event) => this.setItem((e.target as HTMLInputElement).checked)} />\n <span>\n <strong>${i18next.t('figure.label.is-item')}</strong>\n <em>${i18next.t('figure.text.is-item-note')}</em>\n </span>\n </label>\n </section>\n `\n }\n\n /** The products' capabilities: those this modeller knows, each on or off with its settings, and those it does not know. */\n private renderConsumers(asset: FigureAsset) {\n const known = consumerDescriptors()\n const unknown = unknownConsumerNames(asset)\n if (!known.length && !unknown.length) return nothing\n const names = asset.document.capabilities.names ?? []\n return html`<section>\n <h3>${i18next.t('figure.label.product-capabilities')}</h3>\n ${known.map(d => {\n const on = names.includes(d.name)\n const missing = needsMissing(d, asset)\n return html`<label rung ?on=${on}>\n <input type=\"checkbox\" .checked=${live(on)} ?disabled=${this.locked || (!on && missing.length > 0)} @change=${(e: Event) => this.setConsumer(asset, d.name, (e.target as HTMLInputElement).checked)} />\n <span>\n <strong>${d.label}</strong>\n <em>${d.note}</em>\n <code>${d.name} · ${d.version}</code>\n </span>\n </label>\n ${missing.length ? html`<p hint>${i18next.t('figure.text.product-capability-needs', { needs: missing.map(m => (m === 'item' ? i18next.t('figure.label.is-item') : m)).join(', ') })}</p>` : nothing}\n ${on ? this.renderSettings(asset, d) : nothing}`\n })}\n ${unknown.map(\n name => html`<p hint>\n ${i18next.t('figure.text.product-capability-unknown', { name })}\n <button quiet ?disabled=${this.locked} @click=${() => this.setConsumer(asset, name, false)}>${i18next.t('figure.button.product-capability-remove')}</button>\n </p>`\n )}\n </section>`\n }\n\n /** A capability's settings as its descriptor draws them, and what its check says of them. */\n private renderSettings(asset: FigureAsset, d: FigureCapabilityDescriptor) {\n const settings = settingsOf(asset, d.name)\n const write = (next: Record<string, unknown>) =>\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-capability-settings', name: d.name, settings: Object.keys(next).length ? next : null } }, bubbles: true, composed: true }))\n const parts = [...new Set(asset.appearance.map(a => a.target))]\n const inputs = asset.document.model.inputs.filter(i => i.role === 'state')\n const issues = settingsIssues(d, asset)\n return html`<div form>\n ${(d.settings ?? []).map((setting: FigureCapabilitySetting) => {\n if (setting.kind === 'parts') {\n const chosen = partsAt(settings, setting.key)\n const toggle = (part: string, on: boolean) => write(withParts(settings, setting.key, on ? [...chosen, part] : chosen.filter(p => p !== part)))\n return html`<span>${setting.label}</span>\n <div chips>\n ${parts.map(p => html`<label><input type=\"checkbox\" .checked=${live(chosen.includes(p))} ?disabled=${this.locked} @change=${(e: Event) => toggle(p, (e.target as HTMLInputElement).checked)} />${p}</label>`)}\n ${this.selected && parts.includes(this.selected) && !chosen.includes(this.selected)\n ? html`<button quiet ?disabled=${this.locked} @click=${() => toggle(this.selected, true)}>${i18next.t('figure.button.data-add-selected-part', { part: this.selected })}</button>`\n : nothing}\n </div>`\n }\n const table = inputTableAt(settings, setting)\n const input = inputs.find(i => i.id === table.input)\n return html`<span>${setting.label}</span>\n <select ?disabled=${this.locked} @change=${(e: Event) => write(withInputTable(settings, setting, (e.target as HTMLSelectElement).value || undefined, table.values))}>\n <option value=\"\" ?selected=${!table.input}>${i18next.t('figure.label.data-none')}</option>\n ${inputs.map(i => html`<option value=${i.id} ?selected=${i.id === table.input}>${asset.stateInputs?.[i.id]?.label ?? i.id}${i.unit ? ` (${i.unit} ${i.min ?? ''}~${i.max ?? ''})` : ''}</option>`)}\n </select>\n ${table.input\n ? html`<span></span>\n <div table>\n ${setting.keys.map(\n key => html`<span>${key}</span>\n <input\n type=\"number\"\n step=\"any\"\n min=${input?.min ?? ''}\n max=${input?.max ?? ''}\n .value=${String(table.values[key])}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const n = (e.target as HTMLInputElement).valueAsNumber\n if (!Number.isFinite(n)) return this.requestUpdate()\n write(withInputTable(settings, setting, table.input, { ...table.values, [key]: n }))\n }}\n />`\n )}\n </div>`\n : nothing}`\n })}\n </div>\n ${issues.map(reason => html`<p warn>${reason}</p>`)}`\n }\n\n private setConsumer(asset: FigureAsset, name: string, on: boolean) {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-capabilities', names: namesWith(asset, name, on) } }, bubbles: true, composed: true }))\n }\n\n private setRung(which: Rung) {\n /* The ladder sets the shared names; a product's capabilities stay as they are. */\n const consumers = (this.asset?.document.capabilities.names ?? []).filter(n => n.includes('.'))\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-capabilities', names: [...RUNGS[which], ...consumers] } }, bubbles: true, composed: true }))\n }\n\n private setItem(item: boolean) {\n this.dispatchEvent(new CustomEvent('command', { detail: { action: { kind: 'set-item', item } }, bubbles: true, composed: true }))\n }\n\n private pick(part: string) {\n this.dispatchEvent(new CustomEvent('select-part', { detail: { id: part }, bubbles: true, composed: true }))\n }\n}\n"]}
1
+ {"version":3,"file":"figure-capability-panel.js","sourceRoot":"","sources":["../../client/modeller/figure-capability-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAa,MAAM,8DAA8D,CAAA;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,gEAAgE,CAAA;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAA;AACtF,OAAO,EAAE,2BAA2B,EAAiE,MAAM,wBAAwB,CAAA;AAEnI,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,cAAc,EACd,SAAS,EACV,MAAM,4BAA4B,CAAA;AAEnC;;;;;;;;;;GAUG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAj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MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAC9F,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC7K,CAAC;IAEO,OAAO,CAAC,IAAa;QAC3B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACnI,CAAC;IAEO,IAAI,CAAC,IAAY;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC7G,CAAC;;AA9K+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;oDAAoB;AAEvC;IAAX,QAAQ,EAAE;;uDAAc;AACI;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAe;AAlGhC,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA8QjC","sourcesContent":["import { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { unitWord } from './unit-words.js'\nimport { figureBindingsOf } from '@hatiolab/figure-model'\nimport type { FigureAsset } from '@hatiolab/figure-model'\nimport { RUNGS, rungOf, type Rung } from '@things-factory/figure-viewer/dist-client/capability-rung.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\nimport { placeTerms } from '@things-factory/figure-viewer/dist-client/detail-facts.js'\nimport { onFigureCapabilitiesChanged, type FigureCapabilityDescriptor, type FigureCapabilitySetting } from '@hatiolab/things-scene'\n\nimport {\n consumerDescriptors,\n inputTableAt,\n namesWith,\n needsMissing,\n needsOffered,\n partsAt,\n settingsIssues,\n settingsOf,\n unknownConsumerNames,\n withInputTable,\n withParts\n} from './consumer-capabilities.js'\n\n/**\n * 자리·능력 — what the figure does on a board: the ladder from drawing only, to\n * holding things, to passing them on, and every place things are held, whatever part it is on. A place is not drawn,\n * so the list is the only way to find one; choosing a row selects its part, where the place is edited. Whether the\n * figure is the look of an item a holder carries is said here too (ADR-0155 amendment 2): a tag, apart from the ladder,\n * since an item may hold things as well.\n *\n * Below the ladder, the products' capabilities this modeller has descriptors for (ADR-0167 9, 12): each put on or off,\n * what it still needs, and its settings as its descriptor draws them -- parts picked (the part chosen here by one\n * button), an input and a value per fixed key, never a row added or taken away -- with what its check says.\n */\n@customElement('figure-capability-panel')\nexport class FigureCapabilityPanel extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n label[rung],\n label[item] {\n display: flex;\n gap: 8px;\n align-items: flex-start;\n padding: 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n cursor: pointer;\n }\n /* The box keeps its size beside a long note: squeezed by the flex row it read as a dot (sweep 2026-10-27 U1). */\n label[rung] > input,\n label[item] > input {\n flex: none;\n margin: 2px 0 0;\n }\n label[rung][on],\n label[item][on] {\n border-color: var(--md-sys-color-primary);\n background: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n label[rung] span,\n label[item] span {\n display: grid;\n gap: 2px;\n }\n label[rung] em,\n label[item] em,\n p[hint],\n small {\n font-style: normal;\n margin: 0;\n color: var(--md-sys-color-on-surface-variant);\n }\n button[place] {\n display: grid;\n gap: 2px;\n text-align: left;\n padding: 6px 8px;\n font: inherit;\n color: inherit;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n background: none;\n cursor: pointer;\n }\n button[place][on] {\n border-color: var(--md-sys-color-primary);\n }\n code {\n font-size: var(--ui-t-small, 11.5px);\n color: var(--md-sys-color-on-surface-variant);\n }\n div[chips] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 10px;\n align-items: center;\n }\n div[chips] label {\n display: inline-flex;\n gap: 4px;\n align-items: center;\n }\n div[table] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);\n gap: 4px 6px;\n align-items: center;\n }\n p[warn] {\n margin: 0;\n color: var(--md-sys-color-error);\n }\n `]\n\n private unlisten?: () => void\n\n connectedCallback() {\n super.connectedCallback()\n /* A product's descriptors may be registered after the panel stands. */\n this.unlisten = onFigureCapabilitiesChanged(() => this.requestUpdate())\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.unlisten?.()\n }\n\n @property({ attribute: false }) asset?: FigureAsset\n /** The selected part, whose places are marked. */\n @property() selected = ''\n @property({ type: Boolean }) locked = false\n\n render() {\n const asset = this.asset\n if (!asset) return nothing\n const names = asset.document.capabilities.names ?? []\n const rung = rungOf(names)\n const places = figureBindingsOf(asset)\n return html`${this.renderItem(asset)}\n <section>\n <h3>${i18next.t('figure.label.what-this-does')}</h3>\n ${(['none', 'hold', 'flow'] as const).map(\n which => html`<label rung ?on=${rung === which}>\n <input type=\"radio\" name=\"rung\" .checked=${live(rung === which)} ?disabled=${this.locked} @change=${() => this.setRung(which)} />\n <span>\n <strong>${i18next.t(`figure.label.rung-${which}`)}</strong>\n <em>${i18next.t(`figure.text.rung-${which}-note`)}</em>\n </span>\n </label>`\n )}\n ${rung === null ? html`<p hint>${i18next.t('figure.text.capability-hand-written')}</p>` : nothing}\n </section>\n ${this.renderConsumers(asset)}\n ${places.length || !this.selected ? this.renderPlaces(places, rung) : nothing}\n `\n }\n\n /*\n The figure's places. None yet, with a part picked: nothing here -- the part's own place form stands above, and 「pick a\n part and add one」 under it told the author what they were doing (sweep 2026-10-27 U20).\n */\n private renderPlaces(places: ReturnType<typeof figureBindingsOf>, rung: Rung | null) {\n return html`<section>\n <h3>${i18next.t('figure.label.places')}</h3>\n ${places.length\n ? places.map(\n one => html`<button place ?on=${one.part === this.selected} @click=${() => one.part && this.pick(one.part)}>\n <strong>${one.label}</strong>\n <small>\n ${one.part ?? '?'}${one.face ? ' · ' + i18next.t('figure.label.face-' + one.face) : ''} ·\n ${placeTerms(one, (key, params) => i18next.t(key, params))}\n </small>\n </button>`\n )\n : html`<p hint>${i18next.t('figure.text.no-places')}</p>`}\n ${places.length && rung === 'none' ? html`<p hint>${i18next.t('figure.text.place-needs-holding')}</p>` : nothing}\n </section>`\n }\n\n /** Whether the figure is an item: what a product capability may need first, so it stands first (sweep 2026-10-27 J4). */\n private renderItem(asset: FigureAsset) {\n return html`<section>\n <h3>${i18next.t('figure.label.item')}</h3>\n <label item ?on=${!!asset.item}>\n <input type=\"checkbox\" .checked=${live(!!asset.item)} ?disabled=${this.locked} @change=${(e: Event) => this.setItem((e.target as HTMLInputElement).checked)} />\n <span>\n <strong>${i18next.t('figure.label.is-item')}</strong>\n <em>${i18next.t('figure.text.is-item-note')}</em>\n </span>\n </label>\n </section>`\n }\n\n /** The products' capabilities: those this modeller knows, each on or off with its settings, and those it does not know. */\n private renderConsumers(asset: FigureAsset) {\n const known = consumerDescriptors()\n const unknown = unknownConsumerNames(asset)\n if (!known.length && !unknown.length) return nothing\n const names = asset.document.capabilities.names ?? []\n return html`<section>\n <h3>${i18next.t('figure.label.product-capabilities')}</h3>\n ${known.map(d => {\n const on = names.includes(d.name)\n const missing = needsMissing(d, asset)\n const offered = needsOffered(d, asset)\n const needs = [\n ...(offered.item ? [i18next.t('figure.label.is-item')] : []),\n ...(offered.rungs.length\n ? [i18next.t('figure.text.product-capability-needs-rungs', { rungs: offered.rungs.map(r => i18next.t(`figure.label.rung-${r}`)).join(i18next.t('figure.label.or-between')) })]\n : []),\n ...offered.names\n ]\n return html`<label rung ?on=${on}>\n <input type=\"checkbox\" .checked=${live(on)} ?disabled=${this.locked || (!on && missing.length > 0)} @change=${(e: Event) => this.setConsumer(asset, d.name, (e.target as HTMLInputElement).checked)} />\n <span>\n <strong>${d.label}</strong>\n <em>${d.note}</em>\n ${needs.length ? html`<small needs>${i18next.t('figure.text.product-capability-needs', { needs: needs.join(', ') })}</small>` : nothing}\n </span>\n </label>\n ${on ? this.renderSettings(asset, d) : nothing}`\n })}\n ${unknown.map(\n name => html`<p hint>\n ${i18next.t('figure.text.product-capability-unknown', { name })}\n <button quiet ?disabled=${this.locked} @click=${() => this.setConsumer(asset, name, false)}>${i18next.t('figure.button.product-capability-remove')}</button>\n </p>`\n )}\n </section>`\n }\n\n /** A capability's settings as its descriptor draws them, and what its check says of them. */\n private renderSettings(asset: FigureAsset, d: FigureCapabilityDescriptor) {\n const settings = settingsOf(asset, d.name)\n const write = (next: Record<string, unknown>) =>\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-capability-settings', name: d.name, settings: Object.keys(next).length ? next : null } }, bubbles: true, composed: true }))\n const parts = [...new Set(asset.appearance.map(a => a.target))]\n const inputs = asset.document.model.inputs.filter(i => i.role === 'state')\n const issues = settingsIssues(d, asset)\n return html`<div form>\n ${(d.settings ?? []).map((setting: FigureCapabilitySetting) => {\n if (setting.kind === 'parts') {\n const chosen = partsAt(settings, setting.key)\n const toggle = (part: string, on: boolean) => write(withParts(settings, setting.key, on ? [...chosen, part] : chosen.filter(p => p !== part)))\n return html`<span>${setting.label}</span>\n <div chips>\n ${parts.map(p => html`<label><input type=\"checkbox\" .checked=${live(chosen.includes(p))} ?disabled=${this.locked} @change=${(e: Event) => toggle(p, (e.target as HTMLInputElement).checked)} />${p}</label>`)}\n ${this.selected && parts.includes(this.selected) && !chosen.includes(this.selected)\n ? html`<button quiet ?disabled=${this.locked} @click=${() => toggle(this.selected, true)}>${i18next.t('figure.button.data-add-selected-part', { part: this.selected })}</button>`\n : nothing}\n </div>`\n }\n const table = inputTableAt(settings, setting)\n const input = inputs.find(i => i.id === table.input)\n return html`<span>${setting.label}</span>\n <select ?disabled=${this.locked} @change=${(e: Event) => write(withInputTable(settings, setting, (e.target as HTMLSelectElement).value || undefined, table.values))}>\n <option value=\"\" ?selected=${!table.input}>${i18next.t('figure.label.data-none')}</option>\n ${inputs.map(i => html`<option value=${i.id} ?selected=${i.id === table.input}>${asset.stateInputs?.[i.id]?.label ?? i.id}${i.unit ? ` (${unitWord(i.unit)} ${i.min ?? ''}~${i.max ?? ''})` : ''}</option>`)}\n </select>\n ${table.input\n ? html`<span></span>\n <div table>\n ${setting.keys.map(\n key => html`<span>${key}</span>\n <input\n type=\"number\"\n step=\"any\"\n min=${input?.min ?? ''}\n max=${input?.max ?? ''}\n .value=${String(table.values[key])}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const n = (e.target as HTMLInputElement).valueAsNumber\n if (!Number.isFinite(n)) return this.requestUpdate()\n write(withInputTable(settings, setting, table.input, { ...table.values, [key]: n }))\n }}\n />`\n )}\n </div>`\n : nothing}`\n })}\n </div>\n ${issues.map(reason => html`<p warn>${reason}</p>`)}`\n }\n\n private setConsumer(asset: FigureAsset, name: string, on: boolean) {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-capabilities', names: namesWith(asset, name, on) } }, bubbles: true, composed: true }))\n }\n\n private setRung(which: Rung) {\n /* The ladder sets the shared names; a product's capabilities stay as they are. */\n const consumers = (this.asset?.document.capabilities.names ?? []).filter(n => n.includes('.'))\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-capabilities', names: [...RUNGS[which], ...consumers] } }, bubbles: true, composed: true }))\n }\n\n private setItem(item: boolean) {\n this.dispatchEvent(new CustomEvent('command', { detail: { action: { kind: 'set-item', item } }, bubbles: true, composed: true }))\n }\n\n private pick(part: string) {\n this.dispatchEvent(new CustomEvent('select-part', { detail: { id: part }, bubbles: true, composed: true }))\n }\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, state } from 'lit/decorators.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
+ import { unitWord } from './unit-words.js';
6
7
  import { clipGroupsOf, clipsOf, freeGroupIdOf, groupEdit, poseAt, trackEdit, undrivenOf, withKey, withoutKey } from './clips.js';
7
8
  import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
8
9
  import { HelpToggles } from './help.js';
@@ -148,7 +149,7 @@ let FigureClips = class FigureClips extends localize(i18next)(LitElement) {
148
149
  const current = this.values[track.state];
149
150
  return html `<div track>
150
151
  <div track-head>
151
- <strong>${track.label} <small>(${track.unit})</small></strong>
152
+ <strong>${track.label} <small>(${unitWord(track.unit)})</small></strong>
152
153
  <select
153
154
  aria-label=${i18next.t('figure.label.clip-loop')}
154
155
  ?disabled=${this.locked}
@@ -1 +1 @@
1
- {"version":3,"file":"figure-clips.js","sourceRoot":"","sources":["../../client/modeller/figure-clips.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO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E,CAAC,CAAC,CAAA;YACzG,OAAM;QACR,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;IAEO,IAAI,CAAC,IAAa;QACxB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;;AAlR+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0CAAoB;AAEnB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2CAAoC;AACtC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;2CAAe;AAG1B;IAAhB,KAAK,EAAE;;uCAAwC;AAC/B;IAAhB,KAAK,EAAE;;2CAA2E;AAClE;IAAhB,KAAK,EAAE;;6CAA2C;AAlFxC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA6VvB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureAsset } from '@hatiolab/figure-model'\n\nimport { clipGroupsOf, clipsOf, freeGroupIdOf, groupEdit, poseAt, trackEdit, undrivenOf, withKey, withoutKey, type Clip, type ClipGroup, type ClipTrack } from './clips.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\nimport { HelpToggles } from './help.js'\n\n/** A value as a person reads it: at most three decimals, the float's last digits (14.399999999999999) left out. */\nconst shown = (value: number) => value.toLocaleString(undefined, { maximumFractionDigits: 3 })\n\n/**\n * 클립 — controls played by keys over time. A clip is one clock; each track plays one\n * control. Scrubbing a clip shows its pose at that moment (one batch of input changes, not saved as the default); a key\n * is added at the scrubbed moment with the control's value there, so a pose is made with the controls' sliders and\n * then kept as a key. Every change is one part edit.\n *\n * Clips of one motion group play one at a time on the same controls -- idle, walk, run (ADR-0051 §3.2): only clips of\n * one group may play the same control, so a new clip is put in a group as it is made when it is to take one.\n */\n@customElement('figure-clips')\nexport class FigureClips extends localize(i18next)(LitElement) {\n private readonly help = new HelpToggles(this)\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n section[clip] {\n display: grid;\n gap: 8px;\n padding: 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n }\n div[row] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 72px;\n gap: 6px;\n align-items: center;\n }\n div[track] {\n display: grid;\n gap: 4px;\n padding-top: 6px;\n border-top: 1px dashed var(--md-sys-color-outline-variant);\n }\n /*\n The track's name on its own line, then how it repeats and the button that removes it. A flex row let the shared\n full-width select and button squeeze the name to one letter a line (user, 2026-09-24).\n */\n div[track-head] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 30px;\n gap: 4px 6px;\n align-items: center;\n }\n div[track-head] strong {\n grid-column: 1 / -1;\n min-width: 0;\n overflow-wrap: anywhere;\n }\n div[track-head] button[act] {\n width: 30px;\n min-height: var(--figure-control-height);\n margin: 0;\n padding: 0;\n }\n div[keys] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n }\n span[key] {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 0 2px 0 8px;\n border-radius: 999em;\n background: var(--md-sys-color-surface-container);\n font-variant-numeric: tabular-nums;\n }\n span[key] button {\n width: 22px;\n height: 22px;\n padding: 0;\n border: none;\n background: none;\n }\n md-icon {\n font-size: 16px;\n width: 16px;\n height: 16px;\n }\n `]\n\n @property({ attribute: false }) asset?: FigureAsset\n /** The values the editor holds now, by input id -- what a new key takes. */\n @property({ attribute: false }) values: Record<string, number> = {}\n @property({ type: Boolean }) locked = false\n\n /** Where each clip is scrubbed to, in seconds. */\n @state() private at: Record<string, number> = {}\n @state() private adding = { state: '', clip: '', name: '', duration: 2, group: '' }\n @state() private grouping = { clip: '', label: '' }\n\n render() {\n const asset = this.asset\n if (!asset) return nothing\n const clips = clipsOf(asset)\n /* Nothing to play yet: said inside the section it belongs to, with the section's own margins. */\n const empty = !clips.length && !undrivenOf(asset).length && !asset.motionGroups?.length\n return html`\n <section>\n <h3>${i18next.t('figure.label.clips')}${this.help.button('figure.text.clips-explained')}</h3>\n ${this.help.hint('figure.text.clips-explained')}\n ${clips.map(clip => this.renderClip(clip))}\n ${empty ? html`<p hint>${i18next.t('figure.text.no-clips')}</p>` : nothing}\n </section>\n ${empty ? nothing : this.renderAdd(asset, clips)} ${this.renderGroups(asset)}\n `\n }\n\n private renderClip(clip: Clip) {\n const at = Math.min(this.at[clip.name] ?? 0, clip.duration)\n const number = (e: Event) => (e.target as HTMLInputElement).valueAsNumber\n return html`<section clip>\n <div form>\n <span>${i18next.t('figure.label.clip-name')}</span>\n <input .value=${clip.name} ?disabled=${this.locked} @change=${(e: Event) => this.edit({ kind: 'set-clip', clip: clip.name, name: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.clip-duration')}</span>\n <input type=\"number\" min=\"0.1\" step=\"any\" .value=${String(clip.duration)} ?disabled=${this.locked} @change=${(e: Event) => this.edit({ kind: 'set-clip', clip: clip.name, duration: number(e) })} />\n </div>\n <div row>\n <input\n type=\"range\"\n min=\"0\"\n max=${clip.duration}\n step=${clip.duration / 100}\n .value=${String(at)}\n ?disabled=${this.locked}\n aria-label=${i18next.t('figure.label.clip-time')}\n @input=${(e: Event) => this.scrub(clip, number(e), true)}\n @change=${(e: Event) => this.scrub(clip, number(e))}\n />\n <small>${at.toFixed(2)} s</small>\n </div>\n ${clip.tracks.map(track => this.renderTrack(clip, track, at))}\n </section>`\n }\n\n private renderTrack(clip: Clip, track: ClipTrack, at: number) {\n const current = this.values[track.state]\n return html`<div track>\n <div track-head>\n <strong>${track.label} <small>(${track.unit})</small></strong>\n <select\n aria-label=${i18next.t('figure.label.clip-loop')}\n ?disabled=${this.locked}\n @change=${(e: Event) => this.edit(trackEdit(clip, track, { loop: (e.target as HTMLSelectElement).value as 'wrap' | 'hold' }))}\n >\n <option value=\"wrap\" ?selected=${track.loop === 'wrap'}>${i18next.t('figure.label.clip-loop-wrap')}</option>\n <option value=\"hold\" ?selected=${track.loop === 'hold'}>${i18next.t('figure.label.clip-loop-hold')}</option>\n </select>\n <button act ?disabled=${this.locked} title=${i18next.t('figure.button.remove-track')} @click=${() => this.edit({ kind: 'remove-driver', state: track.state, clip: clip.name })}>\n <md-icon>close</md-icon>\n </button>\n </div>\n <div keys>\n ${track.keys.map(\n (key, i) => html`<span key\n >${key.seconds}s → ${shown(key.value)}\n <button\n ?disabled=${this.locked || !withoutKey(track.keys, i)}\n title=${i18next.t('figure.button.remove-key')}\n aria-label=${i18next.t('figure.button.remove-key')}\n @click=${() => this.edit(trackEdit(clip, track, { keys: withoutKey(track.keys, i)! }))}\n >\n <md-icon>close</md-icon>\n </button></span\n >`\n )}\n </div>\n <button\n act\n ?disabled=${this.locked || current === undefined}\n @click=${() => this.edit(trackEdit(clip, track, { keys: withKey(track.keys, { seconds: Math.round(at * 1000) / 1000, value: current! }) }))}\n >\n <md-icon>add</md-icon>${i18next.t('figure.button.add-key-here', { seconds: at.toFixed(2), value: current === undefined ? '' : shown(current) })}\n </button>\n </div>`\n }\n\n private renderAdd(asset: FigureAsset, clips: Clip[]) {\n const a = this.adding\n const joining = clips.find(c => c.name === a.clip)\n const { groups } = clipGroupsOf(asset)\n const group = joining ? undefined : groups.find(g => g.id === a.group)\n /* The controls this clip may take: not played by it yet, and by no clip outside its group. */\n const free = undrivenOf(asset, joining?.name ?? '', group?.id)\n const stateId = free.includes(a.state) ? a.state : free[0]\n const name = joining ? joining.name : a.name.trim()\n const input = asset.document.model.inputs.find(i => i.id === stateId)\n const duration = joining ? joining.duration : a.duration\n /* A new clip takes a name no clip has: the same name would rewrite that clip's track, not add one. */\n const taken = !joining && clips.some(c => c.name === name)\n const ready = !!name && !taken && duration > 0 && !!input\n return html`<section><h3>${i18next.t('figure.label.add-track')}</h3>\n <div form>\n <span>${i18next.t('figure.label.controls')}</span>\n <select ?disabled=${!free.length} @change=${(e: Event) => (this.adding = { ...a, state: (e.target as HTMLSelectElement).value })}>\n ${free.map(id => html`<option value=${id} ?selected=${id === stateId}>${asset.stateInputs?.[id]?.label ?? id}</option>`)}\n </select>\n <span>${i18next.t('figure.label.clip')}</span>\n <select @change=${(e: Event) => (this.adding = { ...a, clip: (e.target as HTMLSelectElement).value })}>\n <option value=\"\" ?selected=${!joining}>${i18next.t('figure.label.new-clip')}</option>\n ${clips.map(c => html`<option value=${c.name} ?selected=${c === joining}>${c.name}</option>`)}\n </select>\n ${joining || !groups.length\n ? nothing\n : html`<span>${i18next.t('figure.label.motion-group')}</span>\n <select @change=${(e: Event) => (this.adding = { ...a, group: (e.target as HTMLSelectElement).value })}>\n <option value=\"\" ?selected=${!group}>${i18next.t('figure.label.no-motion-group')}</option>\n ${groups.map(g => html`<option value=${g.id} ?selected=${g === group}>${g.label}</option>`)}\n </select>`}\n ${joining\n ? nothing\n : html`<span>${i18next.t('figure.label.clip-name')}</span>\n <input .value=${a.name} placeholder=\"cycle\" @input=${(e: Event) => (this.adding = { ...a, name: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.clip-duration')}</span>\n <input type=\"number\" min=\"0.1\" step=\"any\" .value=${String(a.duration)} @change=${(e: Event) => (this.adding = { ...a, duration: (e.target as HTMLInputElement).valueAsNumber })} />`}\n </div>\n <button\n act\n ?disabled=${this.locked || !ready}\n @click=${() => {\n this.edit({\n kind: 'set-driver',\n state: stateId,\n clip: name,\n ...(joining ? {} : { duration }),\n ...(group ? { group: group.id } : {}),\n keys: [\n { seconds: 0, value: input!.min },\n { seconds: duration, value: input!.max }\n ]\n })\n /* The name was this clip's; the next new clip is named again. */\n this.adding = { ...a, name: '', state: '' }\n }}\n >\n <md-icon>add</md-icon>${i18next.t('figure.button.add-track')}\n </button></section>`\n }\n\n /**\n * The motion groups: a name, the clip that plays until another is chosen, how long a change of clip blends, and the\n * clips each holds. A group is made from a clip in none; a clip in none joins one here. Every change is one edit.\n */\n private renderGroups(asset: FigureAsset) {\n const { groups, free } = clipGroupsOf(asset)\n if (!groups.length && !free.length) return nothing\n const g = this.grouping\n const first = free.includes(g.clip) ? g.clip : free[0]\n return html`<section>\n <h3>${i18next.t('figure.label.motion-groups')}${this.help.button('figure.text.motion-groups-explained')}</h3>\n ${this.help.hint('figure.text.motion-groups-explained')}\n ${groups.map(group => this.renderGroup(group, free))}\n ${free.length\n ? html`<div form>\n <span>${i18next.t('figure.label.motion-group-name')}</span>\n <input .value=${g.label} placeholder=${i18next.t('figure.label.motion-group')} @input=${(e: Event) => (this.grouping = { ...g, label: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.clip')}</span>\n <select @change=${(e: Event) => (this.grouping = { ...g, clip: (e.target as HTMLSelectElement).value })}>\n ${free.map(c => html`<option value=${c} ?selected=${c === first}>${c}</option>`)}\n </select>\n </div>\n <button\n act\n ?disabled=${this.locked || !first || !g.label.trim()}\n @click=${() => {\n this.edit({ kind: 'set-motion-group', group: { id: freeGroupIdOf(asset), label: g.label.trim(), clips: [first!], defaultClip: first!, transitionSeconds: 0.2 } })\n this.grouping = { clip: '', label: '' }\n }}\n >\n <md-icon>add</md-icon>${i18next.t('figure.button.add-motion-group')}\n </button>`\n : nothing}\n </section>`\n }\n\n private renderGroup(group: ClipGroup, free: string[]) {\n const value = (e: Event) => (e.target as HTMLInputElement | HTMLSelectElement).value\n return html`<section clip>\n <div track-head>\n <strong>${group.label}</strong>\n <button act ?disabled=${this.locked} title=${i18next.t('figure.button.remove-motion-group')} @click=${() => this.edit({ kind: 'remove-motion-group', id: group.id })}>\n <md-icon>close</md-icon>\n </button>\n </div>\n <div form>\n <span>${i18next.t('figure.label.motion-group-name')}</span>\n <input .value=${group.label} ?disabled=${this.locked} @change=${(e: Event) => value(e).trim() && this.edit(groupEdit(group, { label: value(e).trim() }))} />\n <span>${i18next.t('figure.label.motion-group-default')}</span>\n <select ?disabled=${this.locked} @change=${(e: Event) => this.edit(groupEdit(group, { defaultClip: value(e) }))}>\n ${group.clips.map(c => html`<option value=${c} ?selected=${c === group.defaultClip}>${c}</option>`)}\n </select>\n <span>${i18next.t('figure.label.motion-group-transition')}</span>\n <input\n type=\"number\"\n min=\"0\"\n step=\"any\"\n .value=${String(group.transitionSeconds)}\n ?disabled=${this.locked}\n @change=${(e: Event) => this.edit(groupEdit(group, { transitionSeconds: (e.target as HTMLInputElement).valueAsNumber }))}\n />\n </div>\n <div keys>\n ${group.clips.map(\n c => html`<span key\n >${c}\n <button\n ?disabled=${this.locked || group.clips.length < 2}\n title=${i18next.t('figure.button.remove-clip-from-group')}\n aria-label=${i18next.t('figure.button.remove-clip-from-group')}\n @click=${() => {\n const clips = group.clips.filter(x => x !== c)\n this.edit(groupEdit(group, { clips, defaultClip: group.defaultClip === c ? clips[0]! : group.defaultClip }))\n }}\n >\n <md-icon>close</md-icon>\n </button></span\n >`\n )}\n </div>\n ${free.length\n ? html`<select\n aria-label=${i18next.t('figure.button.add-clip-to-group')}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const c = value(e)\n if (c) this.edit(groupEdit(group, { clips: [...group.clips, c] }))\n ;(e.target as HTMLSelectElement).value = ''\n }}\n >\n <option value=\"\" selected>${i18next.t('figure.button.add-clip-to-group')}</option>\n ${free.map(c => html`<option value=${c}>${c}</option>`)}\n </select>`\n : nothing}\n </section>`\n }\n\n /** Show the clip's pose at a moment: one batch of input changes, not saved as the default. */\n /** Show the clip's pose at a moment. While the bar is dragged the pose is live (drawn, not recorded); the release\n * applies it as one batch of input changes. */\n private scrub(clip: Clip, seconds: number, live = false) {\n if (!this.asset || !Number.isFinite(seconds)) return\n this.at = { ...this.at, [clip.name]: seconds }\n const changes = poseAt(this.asset, clip.name, seconds)\n if (!changes.length) return\n if (live) {\n const values = Object.fromEntries(changes.map(c => [c.input, c.value]))\n this.dispatchEvent(new CustomEvent('states-live', { detail: { values }, bubbles: true, composed: true }))\n return\n }\n this.dispatchEvent(new CustomEvent('states', { detail: { changes }, bubbles: true, composed: true }))\n }\n\n private edit(edit: unknown) {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit }, bubbles: true, composed: true }))\n }\n}\n"]}
1
+ {"version":3,"file":"figure-clips.js","sourceRoot":"","sources":["../../client/modeller/figure-clips.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAG1C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAA6C,MAAM,YAAY,CAAA;AAC3K,OAAO,EAAE,eAAe,EAAE,MAAM,gEAAgE,CAAA;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,mHAAmH;AACnH,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAA;AAE9F;;;;;;;;GAQG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,QAAQ,CAAC,OAAO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AO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;;AAlR+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0CAAoB;AAEnB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2CAAoC;AACtC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;2CAAe;AAG1B;IAAhB,KAAK,EAAE;;uCAAwC;AAC/B;IAAhB,KAAK,EAAE;;2CAA2E;AAClE;IAAhB,KAAK,EAAE;;6CAA2C;AAlFxC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA6VvB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { unitWord } from './unit-words.js'\nimport type { FigureAsset } from '@hatiolab/figure-model'\n\nimport { clipGroupsOf, clipsOf, freeGroupIdOf, groupEdit, poseAt, trackEdit, undrivenOf, withKey, withoutKey, type Clip, type ClipGroup, type ClipTrack } from './clips.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\nimport { HelpToggles } from './help.js'\n\n/** A value as a person reads it: at most three decimals, the float's last digits (14.399999999999999) left out. */\nconst shown = (value: number) => value.toLocaleString(undefined, { maximumFractionDigits: 3 })\n\n/**\n * 클립 — controls played by keys over time. A clip is one clock; each track plays one\n * control. Scrubbing a clip shows its pose at that moment (one batch of input changes, not saved as the default); a key\n * is added at the scrubbed moment with the control's value there, so a pose is made with the controls' sliders and\n * then kept as a key. Every change is one part edit.\n *\n * Clips of one motion group play one at a time on the same controls -- idle, walk, run (ADR-0051 §3.2): only clips of\n * one group may play the same control, so a new clip is put in a group as it is made when it is to take one.\n */\n@customElement('figure-clips')\nexport class FigureClips extends localize(i18next)(LitElement) {\n private readonly help = new HelpToggles(this)\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n section[clip] {\n display: grid;\n gap: 8px;\n padding: 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n }\n div[row] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 72px;\n gap: 6px;\n align-items: center;\n }\n div[track] {\n display: grid;\n gap: 4px;\n padding-top: 6px;\n border-top: 1px dashed var(--md-sys-color-outline-variant);\n }\n /*\n The track's name on its own line, then how it repeats and the button that removes it. A flex row let the shared\n full-width select and button squeeze the name to one letter a line (user, 2026-09-24).\n */\n div[track-head] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 30px;\n gap: 4px 6px;\n align-items: center;\n }\n div[track-head] strong {\n grid-column: 1 / -1;\n min-width: 0;\n overflow-wrap: anywhere;\n }\n div[track-head] button[act] {\n width: 30px;\n min-height: var(--figure-control-height);\n margin: 0;\n padding: 0;\n }\n div[keys] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n }\n span[key] {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 0 2px 0 8px;\n border-radius: 999em;\n background: var(--md-sys-color-surface-container);\n font-variant-numeric: tabular-nums;\n }\n span[key] button {\n width: 22px;\n height: 22px;\n padding: 0;\n border: none;\n background: none;\n }\n md-icon {\n font-size: 16px;\n width: 16px;\n height: 16px;\n }\n `]\n\n @property({ attribute: false }) asset?: FigureAsset\n /** The values the editor holds now, by input id -- what a new key takes. */\n @property({ attribute: false }) values: Record<string, number> = {}\n @property({ type: Boolean }) locked = false\n\n /** Where each clip is scrubbed to, in seconds. */\n @state() private at: Record<string, number> = {}\n @state() private adding = { state: '', clip: '', name: '', duration: 2, group: '' }\n @state() private grouping = { clip: '', label: '' }\n\n render() {\n const asset = this.asset\n if (!asset) return nothing\n const clips = clipsOf(asset)\n /* Nothing to play yet: said inside the section it belongs to, with the section's own margins. */\n const empty = !clips.length && !undrivenOf(asset).length && !asset.motionGroups?.length\n return html`\n <section>\n <h3>${i18next.t('figure.label.clips')}${this.help.button('figure.text.clips-explained')}</h3>\n ${this.help.hint('figure.text.clips-explained')}\n ${clips.map(clip => this.renderClip(clip))}\n ${empty ? html`<p hint>${i18next.t('figure.text.no-clips')}</p>` : nothing}\n </section>\n ${empty ? nothing : this.renderAdd(asset, clips)} ${this.renderGroups(asset)}\n `\n }\n\n private renderClip(clip: Clip) {\n const at = Math.min(this.at[clip.name] ?? 0, clip.duration)\n const number = (e: Event) => (e.target as HTMLInputElement).valueAsNumber\n return html`<section clip>\n <div form>\n <span>${i18next.t('figure.label.clip-name')}</span>\n <input .value=${clip.name} ?disabled=${this.locked} @change=${(e: Event) => this.edit({ kind: 'set-clip', clip: clip.name, name: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.clip-duration')}</span>\n <input type=\"number\" min=\"0.1\" step=\"any\" .value=${String(clip.duration)} ?disabled=${this.locked} @change=${(e: Event) => this.edit({ kind: 'set-clip', clip: clip.name, duration: number(e) })} />\n </div>\n <div row>\n <input\n type=\"range\"\n min=\"0\"\n max=${clip.duration}\n step=${clip.duration / 100}\n .value=${String(at)}\n ?disabled=${this.locked}\n aria-label=${i18next.t('figure.label.clip-time')}\n @input=${(e: Event) => this.scrub(clip, number(e), true)}\n @change=${(e: Event) => this.scrub(clip, number(e))}\n />\n <small>${at.toFixed(2)} s</small>\n </div>\n ${clip.tracks.map(track => this.renderTrack(clip, track, at))}\n </section>`\n }\n\n private renderTrack(clip: Clip, track: ClipTrack, at: number) {\n const current = this.values[track.state]\n return html`<div track>\n <div track-head>\n <strong>${track.label} <small>(${unitWord(track.unit)})</small></strong>\n <select\n aria-label=${i18next.t('figure.label.clip-loop')}\n ?disabled=${this.locked}\n @change=${(e: Event) => this.edit(trackEdit(clip, track, { loop: (e.target as HTMLSelectElement).value as 'wrap' | 'hold' }))}\n >\n <option value=\"wrap\" ?selected=${track.loop === 'wrap'}>${i18next.t('figure.label.clip-loop-wrap')}</option>\n <option value=\"hold\" ?selected=${track.loop === 'hold'}>${i18next.t('figure.label.clip-loop-hold')}</option>\n </select>\n <button act ?disabled=${this.locked} title=${i18next.t('figure.button.remove-track')} @click=${() => this.edit({ kind: 'remove-driver', state: track.state, clip: clip.name })}>\n <md-icon>close</md-icon>\n </button>\n </div>\n <div keys>\n ${track.keys.map(\n (key, i) => html`<span key\n >${key.seconds}s → ${shown(key.value)}\n <button\n ?disabled=${this.locked || !withoutKey(track.keys, i)}\n title=${i18next.t('figure.button.remove-key')}\n aria-label=${i18next.t('figure.button.remove-key')}\n @click=${() => this.edit(trackEdit(clip, track, { keys: withoutKey(track.keys, i)! }))}\n >\n <md-icon>close</md-icon>\n </button></span\n >`\n )}\n </div>\n <button\n act\n ?disabled=${this.locked || current === undefined}\n @click=${() => this.edit(trackEdit(clip, track, { keys: withKey(track.keys, { seconds: Math.round(at * 1000) / 1000, value: current! }) }))}\n >\n <md-icon>add</md-icon>${i18next.t('figure.button.add-key-here', { seconds: at.toFixed(2), value: current === undefined ? '' : shown(current) })}\n </button>\n </div>`\n }\n\n private renderAdd(asset: FigureAsset, clips: Clip[]) {\n const a = this.adding\n const joining = clips.find(c => c.name === a.clip)\n const { groups } = clipGroupsOf(asset)\n const group = joining ? undefined : groups.find(g => g.id === a.group)\n /* The controls this clip may take: not played by it yet, and by no clip outside its group. */\n const free = undrivenOf(asset, joining?.name ?? '', group?.id)\n const stateId = free.includes(a.state) ? a.state : free[0]\n const name = joining ? joining.name : a.name.trim()\n const input = asset.document.model.inputs.find(i => i.id === stateId)\n const duration = joining ? joining.duration : a.duration\n /* A new clip takes a name no clip has: the same name would rewrite that clip's track, not add one. */\n const taken = !joining && clips.some(c => c.name === name)\n const ready = !!name && !taken && duration > 0 && !!input\n return html`<section><h3>${i18next.t('figure.label.add-track')}</h3>\n <div form>\n <span>${i18next.t('figure.label.controls')}</span>\n <select ?disabled=${!free.length} @change=${(e: Event) => (this.adding = { ...a, state: (e.target as HTMLSelectElement).value })}>\n ${free.map(id => html`<option value=${id} ?selected=${id === stateId}>${asset.stateInputs?.[id]?.label ?? id}</option>`)}\n </select>\n <span>${i18next.t('figure.label.clip')}</span>\n <select @change=${(e: Event) => (this.adding = { ...a, clip: (e.target as HTMLSelectElement).value })}>\n <option value=\"\" ?selected=${!joining}>${i18next.t('figure.label.new-clip')}</option>\n ${clips.map(c => html`<option value=${c.name} ?selected=${c === joining}>${c.name}</option>`)}\n </select>\n ${joining || !groups.length\n ? nothing\n : html`<span>${i18next.t('figure.label.motion-group')}</span>\n <select @change=${(e: Event) => (this.adding = { ...a, group: (e.target as HTMLSelectElement).value })}>\n <option value=\"\" ?selected=${!group}>${i18next.t('figure.label.no-motion-group')}</option>\n ${groups.map(g => html`<option value=${g.id} ?selected=${g === group}>${g.label}</option>`)}\n </select>`}\n ${joining\n ? nothing\n : html`<span>${i18next.t('figure.label.clip-name')}</span>\n <input .value=${a.name} placeholder=\"cycle\" @input=${(e: Event) => (this.adding = { ...a, name: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.clip-duration')}</span>\n <input type=\"number\" min=\"0.1\" step=\"any\" .value=${String(a.duration)} @change=${(e: Event) => (this.adding = { ...a, duration: (e.target as HTMLInputElement).valueAsNumber })} />`}\n </div>\n <button\n act\n ?disabled=${this.locked || !ready}\n @click=${() => {\n this.edit({\n kind: 'set-driver',\n state: stateId,\n clip: name,\n ...(joining ? {} : { duration }),\n ...(group ? { group: group.id } : {}),\n keys: [\n { seconds: 0, value: input!.min },\n { seconds: duration, value: input!.max }\n ]\n })\n /* The name was this clip's; the next new clip is named again. */\n this.adding = { ...a, name: '', state: '' }\n }}\n >\n <md-icon>add</md-icon>${i18next.t('figure.button.add-track')}\n </button></section>`\n }\n\n /**\n * The motion groups: a name, the clip that plays until another is chosen, how long a change of clip blends, and the\n * clips each holds. A group is made from a clip in none; a clip in none joins one here. Every change is one edit.\n */\n private renderGroups(asset: FigureAsset) {\n const { groups, free } = clipGroupsOf(asset)\n if (!groups.length && !free.length) return nothing\n const g = this.grouping\n const first = free.includes(g.clip) ? g.clip : free[0]\n return html`<section>\n <h3>${i18next.t('figure.label.motion-groups')}${this.help.button('figure.text.motion-groups-explained')}</h3>\n ${this.help.hint('figure.text.motion-groups-explained')}\n ${groups.map(group => this.renderGroup(group, free))}\n ${free.length\n ? html`<div form>\n <span>${i18next.t('figure.label.motion-group-name')}</span>\n <input .value=${g.label} placeholder=${i18next.t('figure.label.motion-group')} @input=${(e: Event) => (this.grouping = { ...g, label: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.clip')}</span>\n <select @change=${(e: Event) => (this.grouping = { ...g, clip: (e.target as HTMLSelectElement).value })}>\n ${free.map(c => html`<option value=${c} ?selected=${c === first}>${c}</option>`)}\n </select>\n </div>\n <button\n act\n ?disabled=${this.locked || !first || !g.label.trim()}\n @click=${() => {\n this.edit({ kind: 'set-motion-group', group: { id: freeGroupIdOf(asset), label: g.label.trim(), clips: [first!], defaultClip: first!, transitionSeconds: 0.2 } })\n this.grouping = { clip: '', label: '' }\n }}\n >\n <md-icon>add</md-icon>${i18next.t('figure.button.add-motion-group')}\n </button>`\n : nothing}\n </section>`\n }\n\n private renderGroup(group: ClipGroup, free: string[]) {\n const value = (e: Event) => (e.target as HTMLInputElement | HTMLSelectElement).value\n return html`<section clip>\n <div track-head>\n <strong>${group.label}</strong>\n <button act ?disabled=${this.locked} title=${i18next.t('figure.button.remove-motion-group')} @click=${() => this.edit({ kind: 'remove-motion-group', id: group.id })}>\n <md-icon>close</md-icon>\n </button>\n </div>\n <div form>\n <span>${i18next.t('figure.label.motion-group-name')}</span>\n <input .value=${group.label} ?disabled=${this.locked} @change=${(e: Event) => value(e).trim() && this.edit(groupEdit(group, { label: value(e).trim() }))} />\n <span>${i18next.t('figure.label.motion-group-default')}</span>\n <select ?disabled=${this.locked} @change=${(e: Event) => this.edit(groupEdit(group, { defaultClip: value(e) }))}>\n ${group.clips.map(c => html`<option value=${c} ?selected=${c === group.defaultClip}>${c}</option>`)}\n </select>\n <span>${i18next.t('figure.label.motion-group-transition')}</span>\n <input\n type=\"number\"\n min=\"0\"\n step=\"any\"\n .value=${String(group.transitionSeconds)}\n ?disabled=${this.locked}\n @change=${(e: Event) => this.edit(groupEdit(group, { transitionSeconds: (e.target as HTMLInputElement).valueAsNumber }))}\n />\n </div>\n <div keys>\n ${group.clips.map(\n c => html`<span key\n >${c}\n <button\n ?disabled=${this.locked || group.clips.length < 2}\n title=${i18next.t('figure.button.remove-clip-from-group')}\n aria-label=${i18next.t('figure.button.remove-clip-from-group')}\n @click=${() => {\n const clips = group.clips.filter(x => x !== c)\n this.edit(groupEdit(group, { clips, defaultClip: group.defaultClip === c ? clips[0]! : group.defaultClip }))\n }}\n >\n <md-icon>close</md-icon>\n </button></span\n >`\n )}\n </div>\n ${free.length\n ? html`<select\n aria-label=${i18next.t('figure.button.add-clip-to-group')}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const c = value(e)\n if (c) this.edit(groupEdit(group, { clips: [...group.clips, c] }))\n ;(e.target as HTMLSelectElement).value = ''\n }}\n >\n <option value=\"\" selected>${i18next.t('figure.button.add-clip-to-group')}</option>\n ${free.map(c => html`<option value=${c}>${c}</option>`)}\n </select>`\n : nothing}\n </section>`\n }\n\n /** Show the clip's pose at a moment: one batch of input changes, not saved as the default. */\n /** Show the clip's pose at a moment. While the bar is dragged the pose is live (drawn, not recorded); the release\n * applies it as one batch of input changes. */\n private scrub(clip: Clip, seconds: number, live = false) {\n if (!this.asset || !Number.isFinite(seconds)) return\n this.at = { ...this.at, [clip.name]: seconds }\n const changes = poseAt(this.asset, clip.name, seconds)\n if (!changes.length) return\n if (live) {\n const values = Object.fromEntries(changes.map(c => [c.input, c.value]))\n this.dispatchEvent(new CustomEvent('states-live', { detail: { values }, bubbles: true, composed: true }))\n return\n }\n this.dispatchEvent(new CustomEvent('states', { detail: { changes }, bubbles: true, composed: true }))\n }\n\n private edit(edit: unknown) {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit }, bubbles: true, composed: true }))\n }\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, state } from 'lit/decorators.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
+ import { unitWord } from './unit-words.js';
6
7
  import { controlsOf, poseAsDefault, poseDiffers } from '@things-factory/figure-viewer/dist-client/controls.js';
7
8
  import { dialShape } from './angle-dial.js';
8
9
  import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
@@ -118,7 +119,7 @@ let FigureControls = class FigureControls extends localize(i18next)(LitElement)
118
119
  const c = this.live[control.id] === undefined ? control : { ...control, value: this.live[control.id] };
119
120
  const open = this.open === c.id;
120
121
  return html `<div control>
121
- <span name title=${c.id}>${c.label} <em>${c.unit}</em></span>
122
+ <span name title=${c.id}>${c.label} <em>${unitWord(c.unit)}</em></span>
122
123
  ${c.unit === 'deg' ? this.renderDial(c) : html `<span></span>`}
123
124
  <input
124
125
  type="range"
@@ -167,7 +168,7 @@ let FigureControls = class FigureControls extends localize(i18next)(LitElement)
167
168
  <div form>
168
169
  <span>${i18next.t('figure.label.control-name')}</span>
169
170
  <input .value=${c.named ? c.label : ''} placeholder=${c.id} ?disabled=${this.locked} @change=${(e) => policy({ label: e.target.value })} />
170
- <span>${i18next.t('figure.label.control-range')} (${c.unit})</span>
171
+ <span>${i18next.t('figure.label.control-range')} (${unitWord(c.unit)})</span>
171
172
  <div pair>
172
173
  <input type="number" step="any" .value=${String(c.min)} ?disabled=${this.locked} @change=${(e) => policy({ min: number(e) })} />
173
174
  <input type="number" step="any" .value=${String(c.max)} ?disabled=${this.locked} @change=${(e) => policy({ max: number(e) })} />
@@ -175,7 +176,7 @@ let FigureControls = class FigureControls extends localize(i18next)(LitElement)
175
176
  <span>${i18next.t('figure.label.control-sweep')}</span>
176
177
  <input type="number" min="0" step="any" .value=${String(c.sweep)} ?disabled=${this.locked} @change=${(e) => policy({ sweep: number(e) })} />
177
178
  </div>
178
- <small>${i18next.t('figure.text.control-starts-at', { value: c.start, unit: c.unit })}</small>
179
+ <small>${i18next.t('figure.text.control-starts-at', { value: c.start, unit: unitWord(c.unit) })}</small>
179
180
  </div>`;
180
181
  }
181
182
  /** While dragging: the value is told as live -- the editor draws that pose at once and records nothing. */
@@ -1 +1 @@
1
- {"version":3,"file":"figure-controls.js","sourceRoot":"","sources":["../../client/modeller/figure-controls.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGjD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAgB,MAAM,uDAAuD,CAAA;AAC5H,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,gEAAgE,CAAA;AAEhG;;;;;;;;GAQG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA1D;;QA6EL,oDAAoD;QACpB,WAAM,GAA2B,EAAE,CAAA;QACtC,WAAM,GAAG,KAAK,CAAA;QAE3C,yCAAyC;QACxB,SAAI,GAAG,EAAE,CAAA;QAC1B,gHAAgH;QAC/F,SAAI,GAA2B,EAAE,CAAA;IAyGpD,CAAC;aA5LQ,WAAM,GAAG,CAAC,eAAe,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEpC,CAAC,AAxEW,CAwEX;IAaF,MAAM;QACJ,IAA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AAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CAAoC;AACtC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;8CAAe;AAG1B;IAAhB,KAAK,EAAE;;4CAAkB;AAET;IAAhB,KAAK,EAAE;;4CAA0C;AApFvC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA6L1B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureAsset } from '@hatiolab/figure-model'\n\nimport { controlsOf, poseAsDefault, poseDiffers, type Control } from '@things-factory/figure-viewer/dist-client/controls.js'\nimport { dialShape } from './angle-dial.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\n\n/**\n * The figure's controls and its pose tools: each value a board sets to pose the figure,\n * with a slider to try it, its name, range and travel time, and a button that keeps the pose being looked at as the\n * pose it stands in when placed.\n *\n * Trying a value is an input change (`state`, not saved as the default); naming, the range and the travel time are\n * one `set-state-input` part edit each; keeping the pose is one `set-state-defaults` edit. A control is made with\n * a motion on a part (「움직임」), which is where it gets its meaning.\n */\n@customElement('figure-controls')\nexport class FigureControls extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n /* One control, one line: its name, a dial for an angle, a thin slider, the value. */\n div[control] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 18px minmax(64px, 1.2fr) 58px 22px;\n align-items: center;\n gap: 6px;\n min-height: 28px;\n }\n div[control] > span[name] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n div[control] > span[name] em {\n font-style: normal;\n font-size: var(--ui-t-micro, 11px);\n color: var(--md-sys-color-on-surface-variant);\n }\n div[control] input[type='number'] {\n min-height: 24px;\n padding: 2px 5px;\n font-family: var(--ui-mono, ui-monospace, monospace);\n text-align: right;\n }\n svg[dial] {\n width: 18px;\n height: 18px;\n }\n svg[dial] path {\n fill: var(--md-sys-color-surface-container-high);\n }\n svg[dial] circle {\n fill: none;\n stroke: var(--md-sys-color-outline-variant);\n }\n svg[dial] line {\n stroke: var(--md-sys-color-primary);\n stroke-width: 2;\n stroke-linecap: round;\n }\n button[more] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n padding: 0;\n border: none;\n border-radius: 4px;\n background: none;\n color: var(--md-sys-color-on-surface-variant);\n cursor: pointer;\n }\n button[more][aria-expanded='true'] {\n color: var(--md-sys-color-primary);\n background: var(--md-sys-color-surface-container);\n }\n button[more] md-icon {\n font-size: 16px;\n width: 16px;\n height: 16px;\n }\n /* The rarely changed: the name, the range, the travel time -- opened per control. */\n div[settings] {\n margin: 2px 0 8px;\n padding: 6px 0 6px 8px;\n border-left: 2px solid var(--md-sys-color-outline-variant);\n }\n `]\n\n /** The asset being edited. */\n @property({ attribute: false }) asset?: FigureAsset\n /** The values the editor holds now, by input id. */\n @property({ attribute: false }) values: Record<string, number> = {}\n @property({ type: Boolean }) locked = false\n\n /** Which control's settings are open. */\n @state() private open = ''\n /** Values in hand while a slider is dragged: the dial and the number follow them before the release commits. */\n @state() private live: Record<string, number> = {}\n\n render() {\n if (!this.asset) return nothing\n const controls = controlsOf(this.asset, this.values)\n return html`<section>\n <h3>${i18next.t('figure.label.controls')}</h3>\n ${controls.length\n ? html`${controls.map(control => this.renderControl(control))}\n <button act ?disabled=${this.locked || !poseDiffers(controls)} @click=${() => this.edit(poseAsDefault(controls))}>\n <md-icon>push_pin</md-icon>${i18next.t('figure.button.keep-pose')}\n </button>`\n : html`<p hint>${i18next.t('figure.text.no-controls')}</p>`}\n </section>`\n }\n\n private renderControl(control: Control) {\n const number = (e: Event) => (e.target as HTMLInputElement).valueAsNumber\n const c = this.live[control.id] === undefined ? control : { ...control, value: this.live[control.id]! }\n const open = this.open === c.id\n return html`<div control>\n <span name title=${c.id}>${c.label} <em>${c.unit}</em></span>\n ${c.unit === 'deg' ? this.renderDial(c) : html`<span></span>`}\n <input\n type=\"range\"\n min=${c.min}\n max=${c.max}\n step=${c.step}\n .value=${String(c.value)}\n ?disabled=${this.locked}\n aria-label=${c.label}\n @input=${(e: Event) => this.drag(c, number(e))}\n @change=${(e: Event) => this.try(c, number(e))}\n />\n <input type=\"number\" step=\"any\" .value=${String(Math.round(c.value * 100) / 100)} ?disabled=${this.locked} aria-label=${c.label} @change=${(e: Event) => this.try(c, number(e))} />\n <button\n more\n aria-expanded=${String(open)}\n title=${i18next.t('figure.button.control-settings')}\n aria-label=${i18next.t('figure.button.control-settings')}\n @click=${() => (this.open = open ? '' : c.id)}\n >\n <md-icon>tune</md-icon>\n </button>\n </div>\n ${open ? this.renderSettings(c) : nothing}`\n }\n\n private renderDial(c: Control) {\n const dial = dialShape(c.min, c.max, c.value)\n const span = dial.radius * 2 + 2\n return html`<svg dial viewBox=\"0 0 ${span} ${span}\" aria-hidden=\"true\">\n <path d=${dial.sector}></path>\n <circle cx=${dial.centre.x} cy=${dial.centre.y} r=${dial.radius}></circle>\n <line x1=${dial.centre.x} y1=${dial.centre.y} x2=${dial.needle.x} y2=${dial.needle.y}></line>\n </svg>`\n }\n\n private renderSettings(c: Control) {\n const policy = (patch: Partial<{ label: string; sweep: number; min: number; max: number }>) =>\n this.edit({\n kind: 'set-state-input',\n input: c.id,\n label: patch.label ?? (c.named ? c.label : undefined),\n sweep: patch.sweep ?? c.sweep,\n ...(patch.min !== undefined ? { min: patch.min } : {}),\n ...(patch.max !== undefined ? { max: patch.max } : {})\n })\n const number = (e: Event) => (e.target as HTMLInputElement).valueAsNumber\n return html`<div settings>\n <div form>\n <span>${i18next.t('figure.label.control-name')}</span>\n <input .value=${c.named ? c.label : ''} placeholder=${c.id} ?disabled=${this.locked} @change=${(e: Event) => policy({ label: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.control-range')} (${c.unit})</span>\n <div pair>\n <input type=\"number\" step=\"any\" .value=${String(c.min)} ?disabled=${this.locked} @change=${(e: Event) => policy({ min: number(e) })} />\n <input type=\"number\" step=\"any\" .value=${String(c.max)} ?disabled=${this.locked} @change=${(e: Event) => policy({ max: number(e) })} />\n </div>\n <span>${i18next.t('figure.label.control-sweep')}</span>\n <input type=\"number\" min=\"0\" step=\"any\" .value=${String(c.sweep)} ?disabled=${this.locked} @change=${(e: Event) => policy({ sweep: number(e) })} />\n </div>\n <small>${i18next.t('figure.text.control-starts-at', { value: c.start, unit: c.unit })}</small>\n </div>`\n }\n\n /** While dragging: the value is told as live -- the editor draws that pose at once and records nothing. */\n private drag(c: Control, value: number) {\n if (!Number.isFinite(value)) return\n this.live = { ...this.live, [c.id]: value }\n this.dispatchEvent(new CustomEvent('state-live', { detail: { input: c.id, value }, bubbles: true, composed: true }))\n }\n\n /** Try a value: the pose being looked at, clamped to the range. Not saved as the default. The slider sends it on\n * release, so one drag is one step of the undo history rather than one per pixel. */\n private try(c: Control, value: number) {\n if (!Number.isFinite(value)) return\n const clamped = Math.min(Math.max(value, c.min), c.max)\n const { [c.id]: _released, ...rest } = this.live\n this.live = rest\n this.dispatchEvent(new CustomEvent('state', { detail: { input: c.id, unit: c.unit, value: clamped }, bubbles: true, composed: true }))\n }\n\n private edit(edit: unknown) {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit }, bubbles: true, composed: true }))\n }\n}\n"]}
1
+ {"version":3,"file":"figure-controls.js","sourceRoot":"","sources":["../../client/modeller/figure-controls.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EA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,GAAG,CAAC,CAAA;QACvD,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACxI,CAAC;IAEO,IAAI,CAAC,IAAa;QACxB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;;AAhH+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;6CAAoB;AAEnB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CAAoC;AACtC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;8CAAe;AAG1B;IAAhB,KAAK,EAAE;;4CAAkB;AAET;IAAhB,KAAK,EAAE;;4CAA0C;AApFvC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA6L1B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { unitWord } from './unit-words.js'\nimport type { FigureAsset } from '@hatiolab/figure-model'\n\nimport { controlsOf, poseAsDefault, poseDiffers, type Control } from '@things-factory/figure-viewer/dist-client/controls.js'\nimport { dialShape } from './angle-dial.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\n\n/**\n * The figure's controls and its pose tools: each value a board sets to pose the figure,\n * with a slider to try it, its name, range and travel time, and a button that keeps the pose being looked at as the\n * pose it stands in when placed.\n *\n * Trying a value is an input change (`state`, not saved as the default); naming, the range and the travel time are\n * one `set-state-input` part edit each; keeping the pose is one `set-state-defaults` edit. A control is made with\n * a motion on a part (「움직임」), which is where it gets its meaning.\n */\n@customElement('figure-controls')\nexport class FigureControls extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n /* One control, one line: its name, a dial for an angle, a thin slider, the value. */\n div[control] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 18px minmax(64px, 1.2fr) 58px 22px;\n align-items: center;\n gap: 6px;\n min-height: 28px;\n }\n div[control] > span[name] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n div[control] > span[name] em {\n font-style: normal;\n font-size: var(--ui-t-micro, 11px);\n color: var(--md-sys-color-on-surface-variant);\n }\n div[control] input[type='number'] {\n min-height: 24px;\n padding: 2px 5px;\n font-family: var(--ui-mono, ui-monospace, monospace);\n text-align: right;\n }\n svg[dial] {\n width: 18px;\n height: 18px;\n }\n svg[dial] path {\n fill: var(--md-sys-color-surface-container-high);\n }\n svg[dial] circle {\n fill: none;\n stroke: var(--md-sys-color-outline-variant);\n }\n svg[dial] line {\n stroke: var(--md-sys-color-primary);\n stroke-width: 2;\n stroke-linecap: round;\n }\n button[more] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n padding: 0;\n border: none;\n border-radius: 4px;\n background: none;\n color: var(--md-sys-color-on-surface-variant);\n cursor: pointer;\n }\n button[more][aria-expanded='true'] {\n color: var(--md-sys-color-primary);\n background: var(--md-sys-color-surface-container);\n }\n button[more] md-icon {\n font-size: 16px;\n width: 16px;\n height: 16px;\n }\n /* The rarely changed: the name, the range, the travel time -- opened per control. */\n div[settings] {\n margin: 2px 0 8px;\n padding: 6px 0 6px 8px;\n border-left: 2px solid var(--md-sys-color-outline-variant);\n }\n `]\n\n /** The asset being edited. */\n @property({ attribute: false }) asset?: FigureAsset\n /** The values the editor holds now, by input id. */\n @property({ attribute: false }) values: Record<string, number> = {}\n @property({ type: Boolean }) locked = false\n\n /** Which control's settings are open. */\n @state() private open = ''\n /** Values in hand while a slider is dragged: the dial and the number follow them before the release commits. */\n @state() private live: Record<string, number> = {}\n\n render() {\n if (!this.asset) return nothing\n const controls = controlsOf(this.asset, this.values)\n return html`<section>\n <h3>${i18next.t('figure.label.controls')}</h3>\n ${controls.length\n ? html`${controls.map(control => this.renderControl(control))}\n <button act ?disabled=${this.locked || !poseDiffers(controls)} @click=${() => this.edit(poseAsDefault(controls))}>\n <md-icon>push_pin</md-icon>${i18next.t('figure.button.keep-pose')}\n </button>`\n : html`<p hint>${i18next.t('figure.text.no-controls')}</p>`}\n </section>`\n }\n\n private renderControl(control: Control) {\n const number = (e: Event) => (e.target as HTMLInputElement).valueAsNumber\n const c = this.live[control.id] === undefined ? control : { ...control, value: this.live[control.id]! }\n const open = this.open === c.id\n return html`<div control>\n <span name title=${c.id}>${c.label} <em>${unitWord(c.unit)}</em></span>\n ${c.unit === 'deg' ? this.renderDial(c) : html`<span></span>`}\n <input\n type=\"range\"\n min=${c.min}\n max=${c.max}\n step=${c.step}\n .value=${String(c.value)}\n ?disabled=${this.locked}\n aria-label=${c.label}\n @input=${(e: Event) => this.drag(c, number(e))}\n @change=${(e: Event) => this.try(c, number(e))}\n />\n <input type=\"number\" step=\"any\" .value=${String(Math.round(c.value * 100) / 100)} ?disabled=${this.locked} aria-label=${c.label} @change=${(e: Event) => this.try(c, number(e))} />\n <button\n more\n aria-expanded=${String(open)}\n title=${i18next.t('figure.button.control-settings')}\n aria-label=${i18next.t('figure.button.control-settings')}\n @click=${() => (this.open = open ? '' : c.id)}\n >\n <md-icon>tune</md-icon>\n </button>\n </div>\n ${open ? this.renderSettings(c) : nothing}`\n }\n\n private renderDial(c: Control) {\n const dial = dialShape(c.min, c.max, c.value)\n const span = dial.radius * 2 + 2\n return html`<svg dial viewBox=\"0 0 ${span} ${span}\" aria-hidden=\"true\">\n <path d=${dial.sector}></path>\n <circle cx=${dial.centre.x} cy=${dial.centre.y} r=${dial.radius}></circle>\n <line x1=${dial.centre.x} y1=${dial.centre.y} x2=${dial.needle.x} y2=${dial.needle.y}></line>\n </svg>`\n }\n\n private renderSettings(c: Control) {\n const policy = (patch: Partial<{ label: string; sweep: number; min: number; max: number }>) =>\n this.edit({\n kind: 'set-state-input',\n input: c.id,\n label: patch.label ?? (c.named ? c.label : undefined),\n sweep: patch.sweep ?? c.sweep,\n ...(patch.min !== undefined ? { min: patch.min } : {}),\n ...(patch.max !== undefined ? { max: patch.max } : {})\n })\n const number = (e: Event) => (e.target as HTMLInputElement).valueAsNumber\n return html`<div settings>\n <div form>\n <span>${i18next.t('figure.label.control-name')}</span>\n <input .value=${c.named ? c.label : ''} placeholder=${c.id} ?disabled=${this.locked} @change=${(e: Event) => policy({ label: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.control-range')} (${unitWord(c.unit)})</span>\n <div pair>\n <input type=\"number\" step=\"any\" .value=${String(c.min)} ?disabled=${this.locked} @change=${(e: Event) => policy({ min: number(e) })} />\n <input type=\"number\" step=\"any\" .value=${String(c.max)} ?disabled=${this.locked} @change=${(e: Event) => policy({ max: number(e) })} />\n </div>\n <span>${i18next.t('figure.label.control-sweep')}</span>\n <input type=\"number\" min=\"0\" step=\"any\" .value=${String(c.sweep)} ?disabled=${this.locked} @change=${(e: Event) => policy({ sweep: number(e) })} />\n </div>\n <small>${i18next.t('figure.text.control-starts-at', { value: c.start, unit: unitWord(c.unit) })}</small>\n </div>`\n }\n\n /** While dragging: the value is told as live -- the editor draws that pose at once and records nothing. */\n private drag(c: Control, value: number) {\n if (!Number.isFinite(value)) return\n this.live = { ...this.live, [c.id]: value }\n this.dispatchEvent(new CustomEvent('state-live', { detail: { input: c.id, value }, bubbles: true, composed: true }))\n }\n\n /** Try a value: the pose being looked at, clamped to the range. Not saved as the default. The slider sends it on\n * release, so one drag is one step of the undo history rather than one per pixel. */\n private try(c: Control, value: number) {\n if (!Number.isFinite(value)) return\n const clamped = Math.min(Math.max(value, c.min), c.max)\n const { [c.id]: _released, ...rest } = this.live\n this.live = rest\n this.dispatchEvent(new CustomEvent('state', { detail: { input: c.id, unit: c.unit, value: clamped }, bubbles: true, composed: true }))\n }\n\n private edit(edit: unknown) {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit }, bubbles: true, composed: true }))\n }\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, state } from 'lit/decorators.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
+ import { unitWord } from './unit-words.js';
6
7
  import { FIGURE_UNITS, figureDataExample, inferFigureDataSchema } from '@hatiolab/figure-model';
7
8
  import { accessorOfRow, behaviorKeyOf, behaviorsOf, bindingDraftOf, domainOf, endlessJointsOf, fieldAt, fieldOfKind, fitsField, freeCodeOf, legendRoleOf, methodOf, methodsOf, partsOf, rotationStepsOf, sampleOf, schemaRowsOf, schemaWithField, schemaWithFieldReplaced, schemaWithoutField, schemaFollowingCodes, stateInputsOf, tableColumnsOf, tableDraftOf, tableWithKeys, tableWithLook, tableWithTargets } from './data-interface.js';
8
9
  import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
@@ -112,6 +113,17 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
112
113
  overflow-wrap: anywhere;
113
114
  cursor: pointer;
114
115
  }
116
+ /* What it reads and where on the first line, its method under it: a method wrapped alone read 「· 배율」 (sweep 2026-10-27 U11). */
117
+ div[head] button[line] small {
118
+ display: block;
119
+ color: var(--md-sys-color-on-surface-variant);
120
+ }
121
+ /* A binding a product capability takes over is marked where the list is read, folded or not (sweep 2026-10-27 U18). */
122
+ div[head] button[line] span[rests] {
123
+ padding: 0 6px;
124
+ border: 1px solid var(--md-sys-color-outline-variant);
125
+ border-radius: 999px;
126
+ }
115
127
  div[head] button[act] {
116
128
  width: 30px;
117
129
  min-height: var(--figure-control-height);
@@ -255,7 +267,7 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
255
267
  const kind = i18next.t('figure.label.data-kind-' + node.kind);
256
268
  if (node.kind === 'number') {
257
269
  const range = node.min !== undefined || node.max !== undefined ? ` ${node.min ?? ''}~${node.max ?? ''}` : '';
258
- return `${kind}${node.unit ? ` ${node.unit}` : ''}${range}`;
270
+ return `${kind}${node.unit ? ` ${unitWord(node.unit)}` : ''}${range}`;
259
271
  }
260
272
  if (node.kind === 'text' && node.values)
261
273
  return `${kind} (${node.values.join(', ')})`;
@@ -317,8 +329,8 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
317
329
  ${field.kind === 'number'
318
330
  ? html `<span>${i18next.t('figure.label.data-unit')}</span>
319
331
  <select ?disabled=${this.locked} @change=${(e) => set({ unit: value(e) || undefined })}>
320
- <option value="" ?selected=${!field.unit}>-</option>
321
- ${FIGURE_UNITS.map(u => html `<option value=${u} ?selected=${u === field.unit}>${u}</option>`)}
332
+ <option value="" ?selected=${!field.unit}>${i18next.t('figure.label.unit-none')}</option>
333
+ ${FIGURE_UNITS.map(u => html `<option value=${u} ?selected=${u === field.unit}>${unitWord(u)}</option>`)}
322
334
  </select>
323
335
  <span>${i18next.t('figure.label.data-min')}</span>
324
336
  <input type="number" step="any" .value=${field.min === undefined ? '' : String(field.min)} ?disabled=${this.locked} @change=${(e) => set({ min: number(e) })} />
@@ -453,10 +465,12 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
453
465
  const open = this.opened === b.id;
454
466
  const set = (next) => this.edit({ kind: 'set-data-binding', binding: next });
455
467
  const what = b.rule === 'table' ? this.targetsName(asset, b) : this.behaviorName(asset, choices, b.behavior);
468
+ const rests = resting.some(r => r.id === b.id);
456
469
  return html `<section item>
457
470
  <div head>
458
471
  <button line aria-expanded=${open ? 'true' : 'false'} @click=${() => (this.opened = open ? '' : b.id)}>
459
- <strong>${b.label ?? b.accessor}</strong> → ${what} <small>· ${i18next.t('figure.label.data-method-' + methodOf(b))}</small>
472
+ <strong>${b.label ?? b.accessor}</strong> → ${what}
473
+ <small>${i18next.t('figure.label.data-method-' + methodOf(b))}${rests ? html ` <span rests>${i18next.t('figure.label.data-binding-resting')}</span>` : nothing}</small>
460
474
  </button>
461
475
  <button act ?disabled=${this.locked} title=${i18next.t('figure.button.remove-data-binding')} @click=${() => this.edit({ kind: 'remove-data-binding', id: b.id })}>
462
476
  <md-icon>delete</md-icon>
@@ -814,9 +828,12 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
814
828
  <input .value=${a.name} @input=${(e) => set({ name: typed(e) })} />`
815
829
  : nothing}
816
830
  <span>${i18next.t('figure.label.data-method')}</span>
817
- <select ?disabled=${!methods.length} @change=${(e) => set({ method: typed(e) })}>
818
- ${methods.map(m => html `<option value=${m} ?selected=${m === method}>${i18next.t('figure.label.data-method-' + m)}</option>`)}
819
- </select>
831
+ ${methods.length === 1
832
+ ? /* One way only (a text is read by a code table): said, not offered as a choice of one (sweep 2026-10-27 U10). */
833
+ html `<span method>${i18next.t('figure.label.data-method-' + methods[0])}</span>`
834
+ : html `<select ?disabled=${!methods.length} @change=${(e) => set({ method: typed(e) })}>
835
+ ${methods.map(m => html `<option value=${m} ?selected=${m === method}>${i18next.t('figure.label.data-method-' + m)}</option>`)}
836
+ </select>`}
820
837
  ${!table && fitting.length
821
838
  ? html `<span>${i18next.t('figure.label.data-behavior')}</span>
822
839
  <select @change=${(e) => set({ behavior: typed(e) })}>