@things-factory/figure-ui 10.1.71 → 10.1.73

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 (44) hide show
  1. package/client/modeller/figure-v3-links.ts +12 -5
  2. package/client/modeller/figure-v3-parts.ts +1 -0
  3. package/client/modeller/figure-v3-properties.ts +3 -2
  4. package/client/modeller/figure-v3-recipe-catalog.ts +22 -4
  5. package/client/modeller/v3-editor.ts +1 -1
  6. package/client/modeller/v3-figure-facts.ts +26 -2
  7. package/client/modeller/v3-links.ts +50 -0
  8. package/client/modeller/v3-recipes.ts +16 -1
  9. package/dist-client/modeller/figure-v3-links.js +9 -3
  10. package/dist-client/modeller/figure-v3-links.js.map +1 -1
  11. package/dist-client/modeller/figure-v3-parts.js +1 -0
  12. package/dist-client/modeller/figure-v3-parts.js.map +1 -1
  13. package/dist-client/modeller/figure-v3-properties.js +3 -2
  14. package/dist-client/modeller/figure-v3-properties.js.map +1 -1
  15. package/dist-client/modeller/figure-v3-recipe-catalog.d.ts +2 -0
  16. package/dist-client/modeller/figure-v3-recipe-catalog.js +21 -4
  17. package/dist-client/modeller/figure-v3-recipe-catalog.js.map +1 -1
  18. package/dist-client/modeller/v3-editor.js +1 -1
  19. package/dist-client/modeller/v3-editor.js.map +1 -1
  20. package/dist-client/modeller/v3-figure-facts.d.ts +9 -0
  21. package/dist-client/modeller/v3-figure-facts.js +23 -2
  22. package/dist-client/modeller/v3-figure-facts.js.map +1 -1
  23. package/dist-client/modeller/v3-links.d.ts +17 -0
  24. package/dist-client/modeller/v3-links.js +38 -0
  25. package/dist-client/modeller/v3-links.js.map +1 -1
  26. package/dist-client/modeller/v3-recipes.js +21 -1
  27. package/dist-client/modeller/v3-recipes.js.map +1 -1
  28. package/dist-client/route.d.ts +1 -1
  29. package/dist-client/tsconfig.fui.tsbuildinfo +1 -1
  30. package/dist-client/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +4 -4
  32. package/test/browser/build.mjs +12 -0
  33. package/test/browser/modeller-page.js +28 -2
  34. package/test/browser/modeller.check.mjs +47 -5
  35. package/test/browser/serve.mjs +7 -1
  36. package/test/v3-fields.test.ts +2 -1
  37. package/test/v3-links.test.ts +25 -0
  38. package/test/v3-properties.test.ts +13 -0
  39. package/test/v3-recipes.test.ts +13 -1
  40. package/translations/en.json +5 -2
  41. package/translations/ja.json +4 -1
  42. package/translations/ko.json +5 -2
  43. package/translations/ms.json +4 -1
  44. package/translations/zh.json +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"figure-v3-properties.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-properties.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;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAsC,MAAM,sBAAsB,CAAA;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,UAAU,GAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;AACtE,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAa,CAAA;AAE/C;;;;;;;;;;;;;;GAcG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,QAAQ,CAAC,OAAO,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IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;sDAAsB;AAE/B;IAAhB,KAAK,EAAE;;sDAA4B;AACnB;IAAhB,KAAK,EAAE;;sDAA4B;AAlCzB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAsM9B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { V3_FACES } from '@hatiolab/figure-model'\nimport type { V3AuthoringAction, V3Face } from '@hatiolab/figure-model'\n\nimport { occupancyFromParts } from './v3-occupancy.js'\nimport { tagsOf, v3FigureFacts, type Placement, type V3FigureFacts } from './v3-figure-facts.js'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nconst PLACEMENTS: Placement[] = ['floor', 'ceiling', 'center', 'wall']\nconst FACES = Object.keys(V3_FACES) as V3Face[]\n\n/**\n * 속성 — the modeller's figure properties.\n *\n * The tab opens with what the figure is: its name, the face it is placed by, the room it takes up, where the\n * catalogue files it.\n *\n * Two kinds of change leave this tab, and it does neither itself:\n * - `v3-command` carries an authoring command (rename, declare the room, the mounting face). The page runs it\n * through the session, so it is one step of the same undo history as every other edit, and is saved with it.\n * - `v3-catalog` carries a change to the row (category, tags). Those are not in the asset; the page writes them\n * to the saved row at once, so they need a saved figure.\n *\n * Not here yet, because V3 has no place for them: editing the declared room by hand (V3 declares it from the\n * parts, as graph expressions), and the detail level. Both wait on a V3 ruling.\n */\n@customElement('figure-v3-properties')\nexport class FigureV3Properties extends localize(i18next)(LitElement) {\n static styles = [ScrollbarStyles, SidePanelStyles, css`\n :host {\n display: block;\n /* It stands inside the properties tab's panel, which gives the margin; a second one indented it past the type. */\n padding: 0;\n overflow: auto;\n }\n div[row] {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n div[row] > select {\n flex: 1;\n }\n div[row] > button[act] {\n flex: 1;\n width: auto;\n margin-top: 0;\n }\n div[row] > span {\n flex: 1;\n }\n `]\n\n /** The source being edited. */\n @property({ type: String }) source?: string\n /** The saved row, if any. Category and tags live on it. */\n @property({ type: String }) figureId?: string\n @property({ type: String }) figureCategory?: string\n @property({ type: Array }) figureTags?: string[]\n /** The part and face picked for the mounting face, before 「이 면으로」 is pressed. */\n @state() private pickedPart?: string\n @state() private pickedFace?: V3Face\n\n private facts(): V3FigureFacts | undefined {\n try {\n return this.source ? v3FigureFacts(this.source) : undefined\n } catch {\n /* A source the format refuses has no facts to show; the verdict tab says why. */\n return undefined\n }\n }\n\n render() {\n const facts = this.facts()\n if (!facts) return nothing\n /* The figure's type is the page's (it lives on the row); it is slotted into the first section. */\n return html`<section>\n <h3>${i18next.t('figure.label.group-figure')}</h3>\n <slot name=\"type\"></slot>\n ${this.renderName(facts)} ${this.renderPlacement(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-standing')}</h3>\n ${this.renderSpace(facts)} ${this.renderMounting(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-catalog')}</h3>\n ${this.renderCatalog()}\n </section>`\n }\n\n private renderName(facts: V3FigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.name')}</label>\n <input\n .value=${facts.name}\n placeholder=${i18next.t('figure.text.figure-display-name')}\n @change=${(event: Event) => {\n const input = event.target as HTMLInputElement\n if (!input.value.trim()) {\n /* The format refuses a blank name; put the old one back rather than send a command that fails. */\n input.value = facts.name\n return\n }\n if (input.value.trim() !== facts.name) this.command({ kind: 'rename', name: input.value })\n }}\n />\n </div>\n `\n }\n\n /**\n * The face the figure is placed by. In V3 it is part of the room declaration, so choosing one declares the room\n * again from the parts — the only way V3 declares it — with the new face. The hint says so.\n */\n private renderPlacement(facts: V3FigureFacts) {\n const current = facts.placement ?? 'floor'\n return html`\n <div field>\n <label>${i18next.t('figure.label.figure-placement')}</label>\n <select\n ?disabled=${!facts.parts.length}\n .value=${live(current)}\n @change=${(event: Event) => {\n const select = event.target as HTMLSelectElement\n this.declare(select.value as Placement)\n /* Refused, the figure is placed as it was, and the list says so; taken, the figure drawn again says the new one. */\n select.value = current\n }}\n >\n ${PLACEMENTS.map(\n one => html`<option value=${one} ?selected=${one === current}>${i18next.t('figure.label.placement-' + one)}</option>`\n )}\n </select>\n <small>${i18next.t(facts.parts.length ? 'figure.text.placement-redeclares' : 'figure.text.fit-needs-parts')}</small>\n </div>\n `\n }\n\n private renderSpace(facts: V3FigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.declared-space')}</label>\n <div row>\n <span>${i18next.t(facts.declared ? 'figure.text.declared-space-declared' : 'figure.text.declared-space-none')}</span>\n <button act ?disabled=${!facts.parts.length} @click=${() => this.declare(facts.placement ?? 'floor')}>\n <md-icon>fit_screen</md-icon>${i18next.t('figure.button.fit-base-to-parts')}\n </button>\n </div>\n </div>\n `\n }\n\n private renderMounting(facts: V3FigureFacts) {\n const mounting = facts.mounting\n const part = [this.pickedPart, mounting?.part, facts.parts[0]].find(one => one && facts.parts.includes(one))\n const face: V3Face = this.pickedFace ?? mounting?.face ?? 'bottom'\n return html`\n <div field>\n <label>${i18next.t('figure.label.mounting-face')}</label>\n <div row>\n <select ?disabled=${!facts.declared} @change=${(e: Event) => (this.pickedPart = (e.target as HTMLSelectElement).value)}>\n ${facts.parts.map(one => html`<option value=${one} ?selected=${one === part}>${one}</option>`)}\n </select>\n <select ?disabled=${!facts.declared} @change=${(e: Event) => (this.pickedFace = (e.target as HTMLSelectElement).value as V3Face)}>\n ${FACES.map(one => html`<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}\n </select>\n </div>\n <div row>\n <button act ?disabled=${!facts.declared || !part} @click=${() => this.command({ kind: 'set-mounting-face', part: part!, face })}>\n ${i18next.t('figure.button.set-mounting-face')}\n </button>\n <button act ?disabled=${!mounting} @click=${() => this.command({ kind: 'clear-mounting-face' })}>\n ${i18next.t('figure.button.clear-mounting-face')}\n </button>\n </div>\n <small>\n ${facts.declared\n ? mounting\n ? `${mounting.part} · ${i18next.t('figure.label.face-' + mounting.face)}`\n : i18next.t('figure.label.mounting-face-none')\n : i18next.t('figure.text.mounting-face-needs-space')}\n </small>\n </div>\n `\n }\n\n private renderCatalog() {\n const saved = !!this.figureId\n return html`\n <div field>\n <label>${i18next.t('figure.label.category')}</label>\n <input\n .value=${this.figureCategory ?? ''}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.category-placeholder')}\n @change=${(e: Event) => this.catalog({ category: (e.target as HTMLInputElement).value.trim() })}\n />\n </div>\n <div field>\n <label>${i18next.t('figure.label.tags')}</label>\n <input\n .value=${(this.figureTags ?? []).join(', ')}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.tags-placeholder')}\n @change=${(e: Event) => this.catalog({ tags: tagsOf((e.target as HTMLInputElement).value) })}\n />\n ${saved ? nothing : html`<small>${i18next.t('figure.text.catalog-needs-a-save')}</small>`}\n </div>\n `\n }\n\n private declare(placement: Placement) {\n if (!this.source) return\n this.command(occupancyFromParts(this.source, placement))\n }\n\n private command(action: V3AuthoringAction) {\n this.dispatchEvent(new CustomEvent('v3-command', { detail: { action }, bubbles: true, composed: true }))\n }\n\n private catalog(patch: { category?: string; tags?: string[] }) {\n this.dispatchEvent(new CustomEvent('v3-catalog', { detail: patch, bubbles: true, composed: true }))\n }\n}\n"]}
1
+ {"version":3,"file":"figure-v3-properties.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-properties.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;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;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AAE,SAAS,CAAC,CAAC,CAAA;IAC1D,CAAC;IAEO,OAAO,CAAC,MAAyB;QACvC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC1G,CAAC;IAEO,OAAO,CAAC,KAA6C;QAC3D,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACrG,CAAC;;AA3K2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAgB;AAEf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DAAwB;AACxB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;sDAAsB;AAE/B;IAAhB,KAAK,EAAE;;sDAA4B;AACnB;IAAhB,KAAK,EAAE;;sDAA4B;AAlCzB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAuM9B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { V3_FACES } from '@hatiolab/figure-model'\nimport type { V3AuthoringAction, V3Face } from '@hatiolab/figure-model'\n\nimport { occupancyFromParts } from './v3-occupancy.js'\nimport { tagsOf, v3FigureFacts, type Placement, type V3FigureFacts } from './v3-figure-facts.js'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nconst PLACEMENTS: Placement[] = ['floor', 'ceiling', 'center', 'wall']\nconst FACES = Object.keys(V3_FACES) as V3Face[]\n\n/**\n * 속성 — the modeller's figure properties.\n *\n * The tab opens with what the figure is: its name, the face it is placed by, the room it takes up, where the\n * catalogue files it.\n *\n * Two kinds of change leave this tab, and it does neither itself:\n * - `v3-command` carries an authoring command (rename, declare the room, the mounting face). The page runs it\n * through the session, so it is one step of the same undo history as every other edit, and is saved with it.\n * - `v3-catalog` carries a change to the row (category, tags). Those are not in the asset; the page writes them\n * to the saved row at once, so they need a saved figure.\n *\n * Not here yet, because V3 has no place for them: editing the declared room by hand (V3 declares it from the\n * parts, as graph expressions), and the detail level. Both wait on a V3 ruling.\n */\n@customElement('figure-v3-properties')\nexport class FigureV3Properties extends localize(i18next)(LitElement) {\n static styles = [ScrollbarStyles, SidePanelStyles, css`\n :host {\n display: block;\n /* It stands inside the properties tab's panel, which gives the margin; a second one indented it past the type. */\n padding: 0;\n overflow: auto;\n }\n div[row] {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n div[row] > select {\n flex: 1;\n }\n div[row] > button[act] {\n flex: 1;\n width: auto;\n margin-top: 0;\n }\n div[row] > span {\n flex: 1;\n }\n `]\n\n /** The source being edited. */\n @property({ type: String }) source?: string\n /** The saved row, if any. Category and tags live on it. */\n @property({ type: String }) figureId?: string\n @property({ type: String }) figureCategory?: string\n @property({ type: Array }) figureTags?: string[]\n /** The part and face picked for the mounting face, before 「이 면으로」 is pressed. */\n @state() private pickedPart?: string\n @state() private pickedFace?: V3Face\n\n private facts(): V3FigureFacts | undefined {\n try {\n return this.source ? v3FigureFacts(this.source) : undefined\n } catch {\n /* A source the format refuses has no facts to show; the verdict tab says why. */\n return undefined\n }\n }\n\n render() {\n const facts = this.facts()\n if (!facts) return nothing\n /* The figure's type is the page's (it lives on the row); it is slotted into the first section. */\n return html`<section>\n <h3>${i18next.t('figure.label.group-figure')}</h3>\n <slot name=\"type\"></slot>\n ${this.renderName(facts)} ${this.renderPlacement(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-standing')}</h3>\n ${this.renderSpace(facts)} ${this.renderMounting(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-catalog')}</h3>\n ${this.renderCatalog()}\n </section>`\n }\n\n private renderName(facts: V3FigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.name')}</label>\n <input\n .value=${facts.name}\n placeholder=${i18next.t('figure.text.figure-display-name')}\n @change=${(event: Event) => {\n const input = event.target as HTMLInputElement\n if (!input.value.trim()) {\n /* The format refuses a blank name; put the old one back rather than send a command that fails. */\n input.value = facts.name\n return\n }\n if (input.value.trim() !== facts.name) this.command({ kind: 'rename', name: input.value })\n }}\n />\n </div>\n `\n }\n\n /**\n * The face the figure is placed by. In V3 it is part of the room declaration, so choosing one declares the room\n * again from the parts — the only way V3 declares it — with the new face. The hint says so.\n */\n private renderPlacement(facts: V3FigureFacts) {\n const current = facts.placement ?? 'floor'\n return html`\n <div field>\n <label>${i18next.t('figure.label.figure-placement')}</label>\n <select\n ?disabled=${!facts.parts.length}\n .value=${live(current)}\n @change=${(event: Event) => {\n const select = event.target as HTMLSelectElement\n this.declare(select.value as Placement)\n /* Refused, the figure is placed as it was, and the list says so; taken, the figure drawn again says the new one. */\n select.value = current\n }}\n >\n ${PLACEMENTS.map(\n one => html`<option value=${one} ?selected=${one === current}>${i18next.t('figure.label.placement-' + one)}</option>`\n )}\n </select>\n <small>${i18next.t(facts.parts.length ? 'figure.text.placement-redeclares' : 'figure.text.fit-needs-parts')}</small>\n </div>\n `\n }\n\n private renderSpace(facts: V3FigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.declared-space')}</label>\n <div row>\n <span>${i18next.t(facts.declared ? 'figure.text.declared-space-declared' : 'figure.text.declared-space-none')}</span>\n <button act ?disabled=${!facts.parts.length} @click=${() => this.declare(facts.placement ?? 'floor')}>\n <md-icon>fit_screen</md-icon>${i18next.t('figure.button.fit-base-to-parts')}\n </button>\n </div>\n </div>\n `\n }\n\n private renderMounting(facts: V3FigureFacts) {\n const mounting = facts.mounting\n /* Chosen, or what is set, or where the figure meets its plane -- not the first part listed (walk 1). */\n const part = [this.pickedPart, mounting?.part, facts.suggested?.part, facts.parts[0]].find(one => one && facts.parts.includes(one))\n const face: V3Face = this.pickedFace ?? mounting?.face ?? facts.suggested?.face ?? 'bottom'\n return html`\n <div field>\n <label>${i18next.t('figure.label.mounting-face')}</label>\n <div row>\n <select ?disabled=${!facts.declared} @change=${(e: Event) => (this.pickedPart = (e.target as HTMLSelectElement).value)}>\n ${facts.parts.map(one => html`<option value=${one} ?selected=${one === part}>${one}</option>`)}\n </select>\n <select ?disabled=${!facts.declared} @change=${(e: Event) => (this.pickedFace = (e.target as HTMLSelectElement).value as V3Face)}>\n ${FACES.map(one => html`<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}\n </select>\n </div>\n <div row>\n <button act ?disabled=${!facts.declared || !part} @click=${() => this.command({ kind: 'set-mounting-face', part: part!, face })}>\n ${i18next.t('figure.button.set-mounting-face')}\n </button>\n <button act ?disabled=${!mounting} @click=${() => this.command({ kind: 'clear-mounting-face' })}>\n ${i18next.t('figure.button.clear-mounting-face')}\n </button>\n </div>\n <small>\n ${facts.declared\n ? mounting\n ? `${mounting.part} · ${i18next.t('figure.label.face-' + mounting.face)}`\n : i18next.t('figure.label.mounting-face-none')\n : i18next.t('figure.text.mounting-face-needs-space')}\n </small>\n </div>\n `\n }\n\n private renderCatalog() {\n const saved = !!this.figureId\n return html`\n <div field>\n <label>${i18next.t('figure.label.category')}</label>\n <input\n .value=${this.figureCategory ?? ''}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.category-placeholder')}\n @change=${(e: Event) => this.catalog({ category: (e.target as HTMLInputElement).value.trim() })}\n />\n </div>\n <div field>\n <label>${i18next.t('figure.label.tags')}</label>\n <input\n .value=${(this.figureTags ?? []).join(', ')}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.tags-placeholder')}\n @change=${(e: Event) => this.catalog({ tags: tagsOf((e.target as HTMLInputElement).value) })}\n />\n ${saved ? nothing : html`<small>${i18next.t('figure.text.catalog-needs-a-save')}</small>`}\n </div>\n `\n }\n\n private declare(placement: Placement) {\n if (!this.source) return\n this.command(occupancyFromParts(this.source, placement))\n }\n\n private command(action: V3AuthoringAction) {\n this.dispatchEvent(new CustomEvent('v3-command', { detail: { action }, bubbles: true, composed: true }))\n }\n\n private catalog(patch: { category?: string; tags?: string[] }) {\n this.dispatchEvent(new CustomEvent('v3-catalog', { detail: patch, bubbles: true, composed: true }))\n }\n}\n"]}
@@ -26,6 +26,8 @@ export declare class FigureV3RecipeCatalog extends FigureV3RecipeCatalog_base {
26
26
  private chosen;
27
27
  private values;
28
28
  private guide;
29
+ private set guideText(value);
30
+ disconnectedCallback(): void;
29
31
  render(): import("lit-html").TemplateResult<1>;
30
32
  private choose;
31
33
  protected willUpdate(): void;
@@ -26,6 +26,11 @@ let FigureV3RecipeCatalog = class FigureV3RecipeCatalog extends localize(i18next
26
26
  this.query = '';
27
27
  this.chosen = '';
28
28
  this.values = {};
29
+ /*
30
+ The guide as a page \`ox-markdown\` can read: it renders what its src points to, not text, and given the text it
31
+ fetched it as a path and drew the app's own page in its place (seen on :3300, 2026-09-26). A blob of type
32
+ text/markdown is read as markdown.
33
+ */
29
34
  this.guide = '';
30
35
  }
31
36
  static { this.styles = [
@@ -232,6 +237,15 @@ let FigureV3RecipeCatalog = class FigureV3RecipeCatalog extends localize(i18next
232
237
  }
233
238
  `
234
239
  ]; }
240
+ set guideText(text) {
241
+ if (this.guide)
242
+ URL.revokeObjectURL(this.guide);
243
+ this.guide = text ? URL.createObjectURL(new Blob([text], { type: 'text/markdown' })) : '';
244
+ }
245
+ disconnectedCallback() {
246
+ super.disconnectedCallback();
247
+ this.guideText = '';
248
+ }
235
249
  render() {
236
250
  const language = i18next.language || 'en';
237
251
  const categories = [...new Set(this.templates.map(t => t.category))].sort();
@@ -270,15 +284,18 @@ let FigureV3RecipeCatalog = class FigureV3RecipeCatalog extends localize(i18next
270
284
  return;
271
285
  this.chosen = t.name;
272
286
  this.values = Object.fromEntries(t.recipe.params.map(p => [p.name, p.default]));
273
- this.guide = '';
287
+ this.guideText = '';
274
288
  this.guideOf?.(t.name)
275
- .then(text => this.chosen === t.name && (this.guide = text))
289
+ .then(text => this.chosen === t.name && (this.guideText = text))
276
290
  .catch(() => { });
277
291
  }
278
292
  willUpdate() {
279
- /* The first card is chosen while nothing is, so the detail is never empty. */
293
+ /*
294
+ The first card shown is chosen while none of those shown is, so the detail is never empty and never of a card the
295
+ search or the category has taken away (the air cylinder stayed told under a search for rollers, :3300, 2026-09-26).
296
+ */
280
297
  const shown = recipesMatching(this.templates, this.category, this.query);
281
- if (!this.templates.some(t => t.name === this.chosen) && shown[0])
298
+ if (!shown.some(t => t.name === this.chosen) && shown[0])
282
299
  this.choose(shown[0]);
283
300
  }
284
301
  renderDetail(t, language) {
@@ -1 +1 @@
1
- {"version":3,"file":"figure-v3-recipe-catalog.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-recipe-catalog.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,mBAAmB,CAAA;AAE1B,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,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAuB,MAAM,iBAAiB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;IAAhB,KAAK,EAAE;;oDAAmB;AACV;IAAhB,KAAK,EAAE;;qDAAoB;AACX;IAAhB,KAAK,EAAE;;qDAAmD;AAC1C;IAAhB,KAAK,EAAE;;oDAAmB;AA7NhB,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAuUjC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/markdown'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { describeV3Recipe } from '@hatiolab/figure-model'\nimport type { V3Recipe, V3RecipeValue } from '@hatiolab/figure-model'\n\nimport { recipeFieldOf, recipeReady, recipeValueOf, recipeWord, recipeWorkings, recipesMatching, type RecipeTemplate } from './v3-recipes.js'\n\n/**\n * The recipe catalog (ADR-0095): the templates the product ships, by category, found by words, each told in full --\n * what it puts in, how many parts, how they move, what each value does, and how to use it -- and put onto the chosen\n * part in one step. The numbers and the ways of moving are worked out from the recipe (`describeV3Recipe`), so they say\n * what it does; only the descriptions and the guide are written.\n */\n@customElement('figure-v3-recipe-catalog')\nexport class FigureV3RecipeCatalog extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n position: fixed;\n inset: 0;\n z-index: 20;\n display: grid;\n place-items: center;\n background: color-mix(in srgb, var(--md-sys-color-scrim, #000) 32%, transparent);\n font-size: 0.82rem;\n color: var(--md-sys-color-on-surface);\n }\n div[panel] {\n display: grid;\n grid-template-rows: auto 1fr;\n width: min(1100px, calc(100vw - 32px));\n height: min(720px, calc(100vh - 32px));\n background: var(--md-sys-color-surface);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n }\n header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n header h2 {\n margin: 0;\n font-size: var(--ui-t-title, 16px);\n flex: 1;\n }\n header input {\n width: 220px;\n padding: 4px 8px;\n font: inherit;\n }\n button[close] {\n display: inline-grid;\n place-items: center;\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 8px;\n background: none;\n color: var(--md-sys-color-on-surface-variant);\n cursor: pointer;\n }\n div[body] {\n display: grid;\n grid-template-columns: 170px minmax(0, 1fr) minmax(300px, 380px);\n min-height: 0;\n }\n @media (max-width: 760px) {\n div[body] {\n grid-template-columns: 1fr;\n overflow: auto;\n }\n }\n nav,\n section[list],\n section[detail] {\n overflow: auto;\n min-height: 0;\n padding: 8px;\n }\n nav {\n border-right: 1px solid var(--md-sys-color-outline-variant);\n }\n section[detail] {\n border-left: 1px solid var(--md-sys-color-outline-variant);\n display: grid;\n gap: 10px;\n align-content: start;\n }\n button[category] {\n display: flex;\n justify-content: space-between;\n width: 100%;\n padding: 6px 8px;\n font: inherit;\n color: inherit;\n background: none;\n border: none;\n border-radius: 6px;\n text-align: left;\n cursor: pointer;\n }\n button[category][on],\n button[card][on] {\n background: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n section[list] {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));\n gap: 8px;\n align-content: start;\n }\n button[card] {\n display: grid;\n gap: 4px;\n padding: 8px;\n font: inherit;\n color: inherit;\n text-align: left;\n background: none;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n cursor: pointer;\n }\n button[card] img {\n width: 100%;\n aspect-ratio: 4 / 3;\n object-fit: contain;\n background: var(--md-sys-color-surface-container);\n border-radius: 4px;\n }\n button[card] small,\n p[muted] {\n color: var(--md-sys-color-on-surface-variant);\n }\n h3 {\n margin: 0;\n font-size: var(--ui-t-body, 14px);\n }\n p {\n margin: 0;\n line-height: 1.5;\n }\n ul {\n margin: 0;\n padding-left: 18px;\n line-height: 1.6;\n }\n table {\n border-collapse: collapse;\n width: 100%;\n }\n th,\n td {\n text-align: left;\n vertical-align: top;\n padding: 3px 4px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n td small {\n display: block;\n color: var(--md-sys-color-on-surface-variant);\n }\n div[form] {\n display: grid;\n gap: 6px;\n padding: 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n }\n div[form] label {\n display: grid;\n gap: 2px;\n }\n div[form] label[toggle] {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n div[form] input,\n div[form] select {\n font: inherit;\n min-width: 0;\n }\n button[insert] {\n justify-self: start;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 6px 14px;\n font: inherit;\n white-space: nowrap;\n color: var(--md-sys-color-on-primary);\n background: var(--md-sys-color-primary);\n border: none;\n border-radius: 999em;\n cursor: pointer;\n }\n button[insert]:disabled {\n opacity: 0.38;\n cursor: default;\n }\n p[role='alert'] {\n padding: 6px;\n white-space: pre-wrap;\n color: var(--md-sys-color-on-error-container);\n background: var(--md-sys-color-error-container);\n border-radius: 6px;\n }\n ox-markdown {\n display: block;\n }\n `\n ]\n\n @property({ attribute: false }) templates: RecipeTemplate[] = []\n /** The part it would be put onto. */\n @property({ type: String }) selected = ''\n @property({ type: Boolean }) locked = false\n /** Why the last one put in was refused, in the kernel's words. */\n @property({ type: String }) error = ''\n /** Reads a template's guide; absent, no guide is shown. */\n @property({ attribute: false }) guideOf?: (name: string) => Promise<string>\n /** Where a template's thumbnail is read from; absent, cards show no picture. */\n @property({ attribute: false }) thumbnailOf?: (name: string) => string\n\n @state() private category = ''\n @state() private query = ''\n @state() private chosen = ''\n @state() private values: Record<string, V3RecipeValue> = {}\n @state() private guide = ''\n\n render() {\n const language = i18next.language || 'en'\n const categories = [...new Set(this.templates.map(t => t.category))].sort()\n const shown = recipesMatching(this.templates, this.category, this.query)\n const chosen = this.templates.find(t => t.name === this.chosen) ?? shown[0]\n return html`<div panel role=\"dialog\" aria-modal=\"true\" aria-label=${i18next.t('figure.label.recipe-catalog')}>\n <header>\n <h2>${i18next.t('figure.label.recipe-catalog')}</h2>\n <input search type=\"search\" placeholder=${i18next.t('figure.text.recipe-search')} .value=${this.query} @input=${(e: Event) => (this.query = (e.target as HTMLInputElement).value)} />\n <button close aria-label=${i18next.t('figure.button.close')} @click=${() => this.dispatchEvent(new CustomEvent('close-catalog', { bubbles: true, composed: true }))}>\n <md-icon>close</md-icon>\n </button>\n </header>\n <div body>\n <nav>\n <button category ?on=${!this.category} @click=${() => (this.category = '')}>\n <span>${i18next.t('figure.label.recipe-all')}</span><small>${this.templates.length}</small>\n </button>\n ${categories.map(\n c => html`<button category=${c} ?on=${this.category === c} @click=${() => (this.category = c)}>\n <span>${i18next.t('figure.label.recipe-category-' + c)}</span><small>${this.templates.filter(t => t.category === c).length}</small>\n </button>`\n )}\n </nav>\n <section list>\n ${shown.map(\n t => html`<button card=${t.name} ?on=${t.name === chosen?.name} @click=${() => this.choose(t)}>\n ${t.hasThumbnail && this.thumbnailOf ? html`<img alt=\"\" loading=\"lazy\" src=${this.thumbnailOf(t.name)} />` : nothing}\n <b>${t.title}</b>\n <small>${t.description}</small>\n </button>`\n )}\n </section>\n <section detail>${chosen ? this.renderDetail(chosen, language) : nothing}</section>\n </div>\n </div>`\n }\n\n private choose(t: RecipeTemplate) {\n if (this.chosen === t.name) return\n this.chosen = t.name\n this.values = Object.fromEntries(t.recipe.params.map(p => [p.name, p.default]))\n this.guide = ''\n this.guideOf?.(t.name)\n .then(text => this.chosen === t.name && (this.guide = text))\n .catch(() => {})\n }\n\n protected willUpdate() {\n /* The first card is chosen while nothing is, so the detail is never empty. */\n const shown = recipesMatching(this.templates, this.category, this.query)\n if (!this.templates.some(t => t.name === this.chosen) && shown[0]) this.choose(shown[0])\n }\n\n private renderDetail(t: RecipeTemplate, language: string) {\n const d = describeV3Recipe(t.recipe)\n const count = d.parts.min === d.parts.max ? String(d.parts.min) : `${d.parts.min}–${d.parts.max}`\n const ready = recipeReady(t.recipe, this.selected)\n return html`\n <h3>${t.title}</h3>\n <p>${t.description}</p>\n <div>\n <h3>${i18next.t('figure.label.recipe-adds')}</h3>\n <ul>\n <li parts=${count}>${i18next.t(\"figure.text.recipe-parts\", { parts: count })}</li>\n ${recipeWorkings(t.recipe).map(line => html`<li>${i18next.t(line.key, line.words)}</li>`)}\n <li>${i18next.t(t.recipe.target === 'part' ? 'figure.text.recipe-onto-chosen' : 'figure.text.recipe-onto-figure')}</li>\n </ul>\n </div>\n ${t.recipe.params.length ? this.renderForm(t.recipe, language) : nothing}\n ${this.error ? html`<p role=\"alert\">${this.error}</p>` : nothing}\n ${ready ? nothing : html`<p muted>${i18next.t('figure.text.recipe-needs-a-part')}</p>`}\n <button insert ?disabled=${this.locked || !ready} @click=${() => this.dispatchEvent(new CustomEvent('insert-recipe', { detail: { recipe: t.recipe, values: this.values }, bubbles: true, composed: true }))}>\n <md-icon>add</md-icon>${this.selected && t.recipe.target === 'part' ? i18next.t('figure.button.insert-recipe-onto', { part: this.selected }) : i18next.t('figure.button.insert-recipe')}\n </button>\n ${this.guide ? html`<ox-markdown .src=${this.guide}></ox-markdown>` : nothing}\n `\n }\n\n /** Each value: its name, what it does, and the field to set it -- a share typed as a percentage. */\n private renderForm(recipe: V3Recipe, language: string) {\n const set = (name: string, value: V3RecipeValue) => (this.values = { ...this.values, [name]: value })\n return html`<div form>\n <h3>${i18next.t('figure.label.recipe-values')}</h3>\n ${recipe.params.map(param => {\n const label = recipeWord(param.label, language) || param.name\n const hint = recipeWord(param.hint, language)\n const value = this.values[param.name] ?? param.default\n const help = hint ? html`<small>${hint}</small>` : nothing\n if (param.kind === 'flag')\n return html`<label toggle><input type=\"checkbox\" param=${param.name} .checked=${value === true} @change=${(e: Event) => set(param.name, (e.target as HTMLInputElement).checked)} />${label}</label>${help}`\n if (param.kind === 'choice' || param.kind === 'face')\n return html`<label><span>${label}</span>\n <select param=${param.name} @change=${(e: Event) => set(param.name, recipeValueOf(param, (e.target as HTMLSelectElement).value))}>\n ${(param.options ?? []).map(o => html`<option value=${String(o)} ?selected=${o === value}>${String(o)}</option>`)}\n </select></label\n >${help}`\n const range = param.kind === 'ratio' ? `${recipeFieldOf(param, param.min ?? 0)}–${recipeFieldOf(param, param.max ?? 1)} %` : `${param.min ?? ''}–${param.max ?? ''} mm`\n return html`<label><span>${label} (${range})</span>\n <input type=\"number\" step=\"any\" param=${param.name} .value=${recipeFieldOf(param, value)} @change=${(e: Event) => set(param.name, recipeValueOf(param, (e.target as HTMLInputElement).value))} /></label\n >${help}`\n })}\n </div>`\n }\n}\n"]}
1
+ {"version":3,"file":"figure-v3-recipe-catalog.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-recipe-catalog.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,mBAAmB,CAAA;AAE1B,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,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAuB,MAAM,iBAAiB,CAAA;AAE7I;;;;;GAKG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAjE;;QA8M2B,cAAS,GAAqB,EAAE,CAAA;QAChE,qCAAqC;QACT,aAAQ,GAAG,EAAE,CAAA;QACZ,WAAM,GAAG,KAAK,CAAA;QAC3C,kEAAkE;QACtC,UAAK,GAAG,EAAE,CAAA;QAMrB,aAAQ,GAAG,EAAE,CAAA;QACb,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4C;AAE3C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAAuC;AAErD;IAAhB,KAAK,EAAE;;uDAAsB;AACb;IAAhB,KAAK,EAAE;;oDAAmB;AACV;IAAhB,KAAK,EAAE;;qDAAoB;AACX;IAAhB,KAAK,EAAE;;qDAAmD;AAM1C;IAAhB,KAAK,EAAE;;oDAAmB;AAlOhB,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAyVjC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/markdown'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { describeV3Recipe } from '@hatiolab/figure-model'\nimport type { V3Recipe, V3RecipeValue } from '@hatiolab/figure-model'\n\nimport { recipeFieldOf, recipeReady, recipeValueOf, recipeWord, recipeWorkings, recipesMatching, type RecipeTemplate } from './v3-recipes.js'\n\n/**\n * The recipe catalog (ADR-0095): the templates the product ships, by category, found by words, each told in full --\n * what it puts in, how many parts, how they move, what each value does, and how to use it -- and put onto the chosen\n * part in one step. The numbers and the ways of moving are worked out from the recipe (`describeV3Recipe`), so they say\n * what it does; only the descriptions and the guide are written.\n */\n@customElement('figure-v3-recipe-catalog')\nexport class FigureV3RecipeCatalog extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n position: fixed;\n inset: 0;\n z-index: 20;\n display: grid;\n place-items: center;\n background: color-mix(in srgb, var(--md-sys-color-scrim, #000) 32%, transparent);\n font-size: 0.82rem;\n color: var(--md-sys-color-on-surface);\n }\n div[panel] {\n display: grid;\n grid-template-rows: auto 1fr;\n width: min(1100px, calc(100vw - 32px));\n height: min(720px, calc(100vh - 32px));\n background: var(--md-sys-color-surface);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n }\n header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n header h2 {\n margin: 0;\n font-size: var(--ui-t-title, 16px);\n flex: 1;\n }\n header input {\n width: 220px;\n padding: 4px 8px;\n font: inherit;\n }\n button[close] {\n display: inline-grid;\n place-items: center;\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 8px;\n background: none;\n color: var(--md-sys-color-on-surface-variant);\n cursor: pointer;\n }\n div[body] {\n display: grid;\n grid-template-columns: 170px minmax(0, 1fr) minmax(300px, 380px);\n min-height: 0;\n }\n @media (max-width: 760px) {\n div[body] {\n grid-template-columns: 1fr;\n overflow: auto;\n }\n }\n nav,\n section[list],\n section[detail] {\n overflow: auto;\n min-height: 0;\n padding: 8px;\n }\n nav {\n border-right: 1px solid var(--md-sys-color-outline-variant);\n }\n section[detail] {\n border-left: 1px solid var(--md-sys-color-outline-variant);\n display: grid;\n gap: 10px;\n align-content: start;\n }\n button[category] {\n display: flex;\n justify-content: space-between;\n width: 100%;\n padding: 6px 8px;\n font: inherit;\n color: inherit;\n background: none;\n border: none;\n border-radius: 6px;\n text-align: left;\n cursor: pointer;\n }\n button[category][on],\n button[card][on] {\n background: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n section[list] {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));\n gap: 8px;\n align-content: start;\n }\n button[card] {\n display: grid;\n gap: 4px;\n padding: 8px;\n font: inherit;\n color: inherit;\n text-align: left;\n background: none;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n cursor: pointer;\n }\n button[card] img {\n width: 100%;\n aspect-ratio: 4 / 3;\n object-fit: contain;\n background: var(--md-sys-color-surface-container);\n border-radius: 4px;\n }\n button[card] small,\n p[muted] {\n color: var(--md-sys-color-on-surface-variant);\n }\n h3 {\n margin: 0;\n font-size: var(--ui-t-body, 14px);\n }\n p {\n margin: 0;\n line-height: 1.5;\n }\n ul {\n margin: 0;\n padding-left: 18px;\n line-height: 1.6;\n }\n table {\n border-collapse: collapse;\n width: 100%;\n }\n th,\n td {\n text-align: left;\n vertical-align: top;\n padding: 3px 4px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n td small {\n display: block;\n color: var(--md-sys-color-on-surface-variant);\n }\n div[form] {\n display: grid;\n gap: 6px;\n padding: 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n }\n div[form] label {\n display: grid;\n gap: 2px;\n }\n div[form] label[toggle] {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n div[form] input,\n div[form] select {\n font: inherit;\n min-width: 0;\n }\n button[insert] {\n justify-self: start;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 6px 14px;\n font: inherit;\n white-space: nowrap;\n color: var(--md-sys-color-on-primary);\n background: var(--md-sys-color-primary);\n border: none;\n border-radius: 999em;\n cursor: pointer;\n }\n button[insert]:disabled {\n opacity: 0.38;\n cursor: default;\n }\n p[role='alert'] {\n padding: 6px;\n white-space: pre-wrap;\n color: var(--md-sys-color-on-error-container);\n background: var(--md-sys-color-error-container);\n border-radius: 6px;\n }\n ox-markdown {\n display: block;\n }\n `\n ]\n\n @property({ attribute: false }) templates: RecipeTemplate[] = []\n /** The part it would be put onto. */\n @property({ type: String }) selected = ''\n @property({ type: Boolean }) locked = false\n /** Why the last one put in was refused, in the kernel's words. */\n @property({ type: String }) error = ''\n /** Reads a template's guide; absent, no guide is shown. */\n @property({ attribute: false }) guideOf?: (name: string) => Promise<string>\n /** Where a template's thumbnail is read from; absent, cards show no picture. */\n @property({ attribute: false }) thumbnailOf?: (name: string) => string\n\n @state() private category = ''\n @state() private query = ''\n @state() private chosen = ''\n @state() private values: Record<string, V3RecipeValue> = {}\n /*\n The guide as a page \\`ox-markdown\\` can read: it renders what its src points to, not text, and given the text it\n fetched it as a path and drew the app's own page in its place (seen on :3300, 2026-09-26). A blob of type\n text/markdown is read as markdown.\n */\n @state() private guide = ''\n\n private set guideText(text: string) {\n if (this.guide) URL.revokeObjectURL(this.guide)\n this.guide = text ? URL.createObjectURL(new Blob([text], { type: 'text/markdown' })) : ''\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.guideText = ''\n }\n\n render() {\n const language = i18next.language || 'en'\n const categories = [...new Set(this.templates.map(t => t.category))].sort()\n const shown = recipesMatching(this.templates, this.category, this.query)\n const chosen = this.templates.find(t => t.name === this.chosen) ?? shown[0]\n return html`<div panel role=\"dialog\" aria-modal=\"true\" aria-label=${i18next.t('figure.label.recipe-catalog')}>\n <header>\n <h2>${i18next.t('figure.label.recipe-catalog')}</h2>\n <input search type=\"search\" placeholder=${i18next.t('figure.text.recipe-search')} .value=${this.query} @input=${(e: Event) => (this.query = (e.target as HTMLInputElement).value)} />\n <button close aria-label=${i18next.t('figure.button.close')} @click=${() => this.dispatchEvent(new CustomEvent('close-catalog', { bubbles: true, composed: true }))}>\n <md-icon>close</md-icon>\n </button>\n </header>\n <div body>\n <nav>\n <button category ?on=${!this.category} @click=${() => (this.category = '')}>\n <span>${i18next.t('figure.label.recipe-all')}</span><small>${this.templates.length}</small>\n </button>\n ${categories.map(\n c => html`<button category=${c} ?on=${this.category === c} @click=${() => (this.category = c)}>\n <span>${i18next.t('figure.label.recipe-category-' + c)}</span><small>${this.templates.filter(t => t.category === c).length}</small>\n </button>`\n )}\n </nav>\n <section list>\n ${shown.map(\n t => html`<button card=${t.name} ?on=${t.name === chosen?.name} @click=${() => this.choose(t)}>\n ${t.hasThumbnail && this.thumbnailOf ? html`<img alt=\"\" loading=\"lazy\" src=${this.thumbnailOf(t.name)} />` : nothing}\n <b>${t.title}</b>\n <small>${t.description}</small>\n </button>`\n )}\n </section>\n <section detail>${chosen ? this.renderDetail(chosen, language) : nothing}</section>\n </div>\n </div>`\n }\n\n private choose(t: RecipeTemplate) {\n if (this.chosen === t.name) return\n this.chosen = t.name\n this.values = Object.fromEntries(t.recipe.params.map(p => [p.name, p.default]))\n this.guideText = ''\n this.guideOf?.(t.name)\n .then(text => this.chosen === t.name && (this.guideText = text))\n .catch(() => {})\n }\n\n protected willUpdate() {\n /*\n The first card shown is chosen while none of those shown is, so the detail is never empty and never of a card the\n search or the category has taken away (the air cylinder stayed told under a search for rollers, :3300, 2026-09-26).\n */\n const shown = recipesMatching(this.templates, this.category, this.query)\n if (!shown.some(t => t.name === this.chosen) && shown[0]) this.choose(shown[0])\n }\n\n private renderDetail(t: RecipeTemplate, language: string) {\n const d = describeV3Recipe(t.recipe)\n const count = d.parts.min === d.parts.max ? String(d.parts.min) : `${d.parts.min}–${d.parts.max}`\n const ready = recipeReady(t.recipe, this.selected)\n return html`\n <h3>${t.title}</h3>\n <p>${t.description}</p>\n <div>\n <h3>${i18next.t('figure.label.recipe-adds')}</h3>\n <ul>\n <li parts=${count}>${i18next.t(\"figure.text.recipe-parts\", { parts: count })}</li>\n ${recipeWorkings(t.recipe).map(line => html`<li>${i18next.t(line.key, line.words)}</li>`)}\n <li>${i18next.t(t.recipe.target === 'part' ? 'figure.text.recipe-onto-chosen' : 'figure.text.recipe-onto-figure')}</li>\n </ul>\n </div>\n ${t.recipe.params.length ? this.renderForm(t.recipe, language) : nothing}\n ${this.error ? html`<p role=\"alert\">${this.error}</p>` : nothing}\n ${ready ? nothing : html`<p muted>${i18next.t('figure.text.recipe-needs-a-part')}</p>`}\n <button insert ?disabled=${this.locked || !ready} @click=${() => this.dispatchEvent(new CustomEvent('insert-recipe', { detail: { recipe: t.recipe, values: this.values }, bubbles: true, composed: true }))}>\n <md-icon>add</md-icon>${this.selected && t.recipe.target === 'part' ? i18next.t('figure.button.insert-recipe-onto', { part: this.selected }) : i18next.t('figure.button.insert-recipe')}\n </button>\n ${this.guide ? html`<ox-markdown .src=${this.guide}></ox-markdown>` : nothing}\n `\n }\n\n /** Each value: its name, what it does, and the field to set it -- a share typed as a percentage. */\n private renderForm(recipe: V3Recipe, language: string) {\n const set = (name: string, value: V3RecipeValue) => (this.values = { ...this.values, [name]: value })\n return html`<div form>\n <h3>${i18next.t('figure.label.recipe-values')}</h3>\n ${recipe.params.map(param => {\n const label = recipeWord(param.label, language) || param.name\n const hint = recipeWord(param.hint, language)\n const value = this.values[param.name] ?? param.default\n const help = hint ? html`<small>${hint}</small>` : nothing\n if (param.kind === 'flag')\n return html`<label toggle><input type=\"checkbox\" param=${param.name} .checked=${value === true} @change=${(e: Event) => set(param.name, (e.target as HTMLInputElement).checked)} />${label}</label>${help}`\n if (param.kind === 'choice' || param.kind === 'face')\n return html`<label><span>${label}</span>\n <select param=${param.name} @change=${(e: Event) => set(param.name, recipeValueOf(param, (e.target as HTMLSelectElement).value))}>\n ${(param.options ?? []).map(o => html`<option value=${String(o)} ?selected=${o === value}>${String(o)}</option>`)}\n </select></label\n >${help}`\n const range = param.kind === 'ratio' ? `${recipeFieldOf(param, param.min ?? 0)}–${recipeFieldOf(param, param.max ?? 1)} %` : `${param.min ?? ''}–${param.max ?? ''} mm`\n return html`<label><span>${label} (${range})</span>\n <input type=\"number\" step=\"any\" param=${param.name} .value=${recipeFieldOf(param, value)} @change=${(e: Event) => set(param.name, recipeValueOf(param, (e.target as HTMLInputElement).value))} /></label\n >${help}`\n })}\n </div>`\n }\n}\n"]}
@@ -1241,7 +1241,7 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
1241
1241
  name-field
1242
1242
  aria-label=${i18next.t('figure.label.name')}
1243
1243
  .value=${partLabelOf(this.selected)}
1244
- ?disabled=${unavailable || !!repeatOf(this.selected, view.geometry)}
1244
+ ?disabled=${unavailable || !!repeatOf(this.selected, view.geometry)?.index}
1245
1245
  @change=${(e) => this.renamePart(e.target)}
1246
1246
  />
1247
1247
  </div>