@things-factory/figure-ui 10.1.113 → 10.1.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/modeller/canvas.ts +6 -0
- package/client/modeller/editor.ts +40 -5
- package/client/modeller/face-mapping.ts +39 -0
- package/client/modeller/figure-face-mapping.ts +78 -0
- package/client/modeller/figure-preview.ts +34 -10
- package/client/modeller/figure-section-editor.ts +12 -4
- package/client/modeller/figure-section-panel.ts +5 -1
- package/client/modeller/preview-model.ts +8 -0
- package/client/pages/figure-modeller-page.ts +7 -1
- package/dist-client/modeller/canvas.js +7 -0
- package/dist-client/modeller/canvas.js.map +1 -1
- package/dist-client/modeller/editor.d.ts +4 -0
- package/dist-client/modeller/editor.js +41 -5
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/face-mapping.d.ts +15 -0
- package/dist-client/modeller/face-mapping.js +20 -0
- package/dist-client/modeller/face-mapping.js.map +1 -0
- package/dist-client/modeller/figure-face-mapping.d.ts +16 -0
- package/dist-client/modeller/figure-face-mapping.js +85 -0
- package/dist-client/modeller/figure-face-mapping.js.map +1 -0
- package/dist-client/modeller/figure-preview.d.ts +2 -0
- package/dist-client/modeller/figure-preview.js +38 -10
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/modeller/figure-section-editor.d.ts +4 -1
- package/dist-client/modeller/figure-section-editor.js +14 -3
- package/dist-client/modeller/figure-section-editor.js.map +1 -1
- package/dist-client/modeller/figure-section-panel.d.ts +4 -1
- package/dist-client/modeller/figure-section-panel.js +6 -0
- package/dist-client/modeller/figure-section-panel.js.map +1 -1
- package/dist-client/modeller/preview-model.d.ts +5 -0
- package/dist-client/modeller/preview-model.js +7 -0
- package/dist-client/modeller/preview-model.js.map +1 -1
- package/dist-client/pages/figure-modeller-page.d.ts +1 -0
- package/dist-client/pages/figure-modeller-page.js +7 -1
- package/dist-client/pages/figure-modeller-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/test/browser/acceptance-page.js +11 -0
- package/test/clip-consent.test.ts +1 -1
- package/test/face-mapping.test.ts +80 -0
- package/test/modeller-route.test.ts +8 -0
- package/test/preview.test.ts +39 -1
- package/test/section-panel.test.ts +1 -1
- package/translations/en.json +7 -1
- package/translations/ja.json +7 -1
- package/translations/ko.json +7 -1
- package/translations/ms.json +7 -1
- package/translations/zh.json +7 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FigureFaceMappingNeed, FigureFaceReference, FigureFaceRemap } from '@hatiolab/figure-model';
|
|
2
|
+
export interface FaceMappingRow {
|
|
3
|
+
ref: FigureFaceReference;
|
|
4
|
+
/** The face it is on now, which the edit takes away. */
|
|
5
|
+
lost: string;
|
|
6
|
+
/** The faces it may go to: those that remain, looking the way the lost one did. */
|
|
7
|
+
faces: string[];
|
|
8
|
+
/** Whether it may be let go where it stands: a joint may, a named face may not. */
|
|
9
|
+
detach: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const DETACH = "__detach";
|
|
12
|
+
export declare function faceMappingRowsOf(need: FigureFaceMappingNeed): FaceMappingRow[];
|
|
13
|
+
/** The remap a command takes, once every row is chosen; undefined while one is not. */
|
|
14
|
+
export declare function remapOf(rows: readonly FaceMappingRow[], picks: Readonly<Record<string, string>>): FigureFaceRemap[] | undefined;
|
|
15
|
+
export declare const rowKey: (row: FaceMappingRow) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const DETACH = '__detach';
|
|
2
|
+
export function faceMappingRowsOf(need) {
|
|
3
|
+
return need.lost.flatMap(lost => {
|
|
4
|
+
const faces = need.remain.filter(r => lost.axis === undefined || (r.axis === lost.axis && r.normal === lost.normal)).map(r => r.face);
|
|
5
|
+
return lost.refs.map(ref => ({ ref, lost: lost.face, faces, detach: ref.kind === 'joint' }));
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
/** The remap a command takes, once every row is chosen; undefined while one is not. */
|
|
9
|
+
export function remapOf(rows, picks) {
|
|
10
|
+
const out = [];
|
|
11
|
+
for (const row of rows) {
|
|
12
|
+
const pick = picks[rowKey(row)];
|
|
13
|
+
if (!pick)
|
|
14
|
+
return undefined;
|
|
15
|
+
out.push({ ref: { kind: row.ref.kind, id: row.ref.id }, to: pick === DETACH ? 'detach' : { face: pick } });
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
export const rowKey = (row) => `${row.ref.kind}:${row.ref.id}:${row.lost}`;
|
|
20
|
+
//# sourceMappingURL=face-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"face-mapping.js","sourceRoot":"","sources":["../../client/modeller/face-mapping.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAA;AAEhC,MAAM,UAAU,iBAAiB,CAAC,IAA2B;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QACrI,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,CAAA;IAC9F,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,OAAO,CAAC,IAA+B,EAAE,KAAuC;IAC9F,MAAM,GAAG,GAAsB,EAAE,CAAA;IACjC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAA;QAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IAC5G,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAmB,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA","sourcesContent":["import type { FigureFaceMappingNeed, FigureFaceReference, FigureFaceRemap } from '@hatiolab/figure-model'\n\n/*\n * Where what stands on a face an edit takes away goes instead (ADR-0100 A8, user 2026-10-02): one row per thing that\n * refers to a lost face, its choices the faces that remain looking the same way, and -- for a joint, never a named\n * face -- let go where it stands. Nothing is chosen for the author: where it goes only they know.\n */\n\nexport interface FaceMappingRow {\n ref: FigureFaceReference\n /** The face it is on now, which the edit takes away. */\n lost: string\n /** The faces it may go to: those that remain, looking the way the lost one did. */\n faces: string[]\n /** Whether it may be let go where it stands: a joint may, a named face may not. */\n detach: boolean\n}\n\nexport const DETACH = '__detach'\n\nexport function faceMappingRowsOf(need: FigureFaceMappingNeed): FaceMappingRow[] {\n return need.lost.flatMap(lost => {\n const faces = need.remain.filter(r => lost.axis === undefined || (r.axis === lost.axis && r.normal === lost.normal)).map(r => r.face)\n return lost.refs.map(ref => ({ ref, lost: lost.face, faces, detach: ref.kind === 'joint' }))\n })\n}\n\n/** The remap a command takes, once every row is chosen; undefined while one is not. */\nexport function remapOf(rows: readonly FaceMappingRow[], picks: Readonly<Record<string, string>>): FigureFaceRemap[] | undefined {\n const out: FigureFaceRemap[] = []\n for (const row of rows) {\n const pick = picks[rowKey(row)]\n if (!pick) return undefined\n out.push({ ref: { kind: row.ref.kind, id: row.ref.id }, to: pick === DETACH ? 'detach' : { face: pick } })\n }\n return out\n}\n\nexport const rowKey = (row: FaceMappingRow) => `${row.ref.kind}:${row.ref.id}:${row.lost}`\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, nothing, type PropertyValues } from 'lit';
|
|
2
|
+
import type { FigureFaceMappingNeed } from '@hatiolab/figure-model';
|
|
3
|
+
declare const FigureFaceMapping_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
4
|
+
/**
|
|
5
|
+
* 없어지는 면에 붙은 것을 옮길 곳 (ADR-0100 A8): shown where the edit was made, under it. Each thing on a lost face
|
|
6
|
+
* is a row; apply is held until every row is chosen, and then the same edit goes again with the remap, one step.
|
|
7
|
+
*/
|
|
8
|
+
export declare class FigureFaceMapping extends FigureFaceMapping_base {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
need?: FigureFaceMappingNeed;
|
|
11
|
+
private picks;
|
|
12
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
13
|
+
private face;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
3
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
+
import { i18next, localize } from '@operato/i18n';
|
|
5
|
+
import { SidePanelStyles } from './side-panel-styles.js';
|
|
6
|
+
import { DETACH, faceMappingRowsOf, remapOf, rowKey } from './face-mapping.js';
|
|
7
|
+
/**
|
|
8
|
+
* 없어지는 면에 붙은 것을 옮길 곳 (ADR-0100 A8): shown where the edit was made, under it. Each thing on a lost face
|
|
9
|
+
* is a row; apply is held until every row is chosen, and then the same edit goes again with the remap, one step.
|
|
10
|
+
*/
|
|
11
|
+
let FigureFaceMapping = class FigureFaceMapping extends localize(i18next)(LitElement) {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.picks = {};
|
|
15
|
+
this.face = (face) => i18next.t('figure.label.face-' + face, { defaultValue: face });
|
|
16
|
+
}
|
|
17
|
+
static { this.styles = [
|
|
18
|
+
SidePanelStyles,
|
|
19
|
+
css `
|
|
20
|
+
:host {
|
|
21
|
+
display: grid;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
padding: 10px 12px;
|
|
24
|
+
border: 1px solid var(--md-sys-color-error);
|
|
25
|
+
border-radius: 8px;
|
|
26
|
+
}
|
|
27
|
+
div[row] {
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
30
|
+
gap: 8px;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
div[buttons] {
|
|
34
|
+
display: flex;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
justify-content: flex-end;
|
|
37
|
+
}
|
|
38
|
+
`
|
|
39
|
+
]; }
|
|
40
|
+
willUpdate(changed) {
|
|
41
|
+
/* Another refusal is another question: what was chosen for the last one does not carry over. */
|
|
42
|
+
if (changed.has('need'))
|
|
43
|
+
this.picks = {};
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
if (!this.need)
|
|
47
|
+
return nothing;
|
|
48
|
+
const rows = faceMappingRowsOf(this.need);
|
|
49
|
+
const remap = remapOf(rows, this.picks);
|
|
50
|
+
const lost = [...new Set(this.need.lost.map(l => this.face(l.face)))].join(', ');
|
|
51
|
+
return html `<p>${i18next.t('figure.text.face-mapping-lost', { faces: lost })}</p>
|
|
52
|
+
${rows.map(row => html `<div row>
|
|
53
|
+
<span>${row.ref.part ?? row.ref.id} · ${this.face(row.lost)}</span>
|
|
54
|
+
<select
|
|
55
|
+
aria-label=${i18next.t('figure.label.face-mapping-to', { part: row.ref.part ?? row.ref.id })}
|
|
56
|
+
@change=${(e) => (this.picks = { ...this.picks, [rowKey(row)]: e.target.value })}
|
|
57
|
+
>
|
|
58
|
+
<option value="" ?selected=${!this.picks[rowKey(row)]}>${i18next.t('figure.label.face-mapping-choose')}</option>
|
|
59
|
+
${row.faces.map(f => html `<option value=${f}>${this.face(f)}</option>`)}
|
|
60
|
+
${row.detach ? html `<option value=${DETACH}>${i18next.t('figure.label.face-mapping-detach')}</option>` : nothing}
|
|
61
|
+
</select>
|
|
62
|
+
</div>`)}
|
|
63
|
+
<div buttons>
|
|
64
|
+
<button @click=${() => this.dispatchEvent(new CustomEvent('face-mapping-cancel', { bubbles: true, composed: true }))}>
|
|
65
|
+
${i18next.t('figure.button.face-mapping-cancel')}
|
|
66
|
+
</button>
|
|
67
|
+
<button act ?disabled=${!remap} @click=${() => remap && this.dispatchEvent(new CustomEvent('face-mapped', { detail: { remap }, bubbles: true, composed: true }))}>
|
|
68
|
+
${i18next.t('figure.button.face-mapping-apply')}
|
|
69
|
+
</button>
|
|
70
|
+
</div>`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ attribute: false }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], FigureFaceMapping.prototype, "need", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
state(),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], FigureFaceMapping.prototype, "picks", void 0);
|
|
81
|
+
FigureFaceMapping = __decorate([
|
|
82
|
+
customElement('figure-face-mapping')
|
|
83
|
+
], FigureFaceMapping);
|
|
84
|
+
export { FigureFaceMapping };
|
|
85
|
+
//# sourceMappingURL=figure-face-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure-face-mapping.js","sourceRoot":"","sources":["../../client/modeller/figure-face-mapping.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE9E;;;GAGG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA7D;;QA0BY,UAAK,GAA2B,EAAE,CAAA;QAO3C,SAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,GAAG,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;IA8BjG,CAAC;aA9DQ,WAAM,GAAG;QACd,eAAe;QACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;KAmBF;KACF,AAtBY,CAsBZ;IAKS,UAAU,CAAC,OAA6B;QAChD,gGAAgG;QAChG,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;IAC1C,CAAC;IAID,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,OAAO,CAAA;QAC9B,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,C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,CAAC,CAAC,CAAC,IAAI,CAAA,iBAAiB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO;;eAE7G,CACR;;yBAEkB,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAChH,OAAO,CAAC,CAAC,CAAC,mCAAmC,CAAC;;gCAE1B,CAAC,KAAK,WAAW,GAAG,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5J,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC;;aAE5C,CAAA;IACX,CAAC;;AArC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;+CAA6B;AAC3C;IAAhB,KAAK,EAAE;;gDAA2C;AA1BxC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA+D7B","sourcesContent":["import { css, html, LitElement, nothing, type PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureFaceMappingNeed } from '@hatiolab/figure-model'\n\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { DETACH, faceMappingRowsOf, remapOf, rowKey } from './face-mapping.js'\n\n/**\n * 없어지는 면에 붙은 것을 옮길 곳 (ADR-0100 A8): shown where the edit was made, under it. Each thing on a lost face\n * is a row; apply is held until every row is chosen, and then the same edit goes again with the remap, one step.\n */\n@customElement('figure-face-mapping')\nexport class FigureFaceMapping extends localize(i18next)(LitElement) {\n static styles = [\n SidePanelStyles,\n css`\n :host {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--md-sys-color-error);\n border-radius: 8px;\n }\n div[row] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);\n gap: 8px;\n align-items: center;\n }\n div[buttons] {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n }\n `\n ]\n\n @property({ attribute: false }) need?: FigureFaceMappingNeed\n @state() private picks: Record<string, string> = {}\n\n protected willUpdate(changed: PropertyValues<this>) {\n /* Another refusal is another question: what was chosen for the last one does not carry over. */\n if (changed.has('need')) this.picks = {}\n }\n\n private face = (face: string) => i18next.t('figure.label.face-' + face, { defaultValue: face })\n\n render() {\n if (!this.need) return nothing\n const rows = faceMappingRowsOf(this.need)\n const remap = remapOf(rows, this.picks)\n const lost = [...new Set(this.need.lost.map(l => this.face(l.face)))].join(', ')\n return html`<p>${i18next.t('figure.text.face-mapping-lost', { faces: lost })}</p>\n ${rows.map(\n row => html`<div row>\n <span>${row.ref.part ?? row.ref.id} · ${this.face(row.lost)}</span>\n <select\n aria-label=${i18next.t('figure.label.face-mapping-to', { part: row.ref.part ?? row.ref.id })}\n @change=${(e: Event) => (this.picks = { ...this.picks, [rowKey(row)]: (e.target as HTMLSelectElement).value })}\n >\n <option value=\"\" ?selected=${!this.picks[rowKey(row)]}>${i18next.t('figure.label.face-mapping-choose')}</option>\n ${row.faces.map(f => html`<option value=${f}>${this.face(f)}</option>`)}\n ${row.detach ? html`<option value=${DETACH}>${i18next.t('figure.label.face-mapping-detach')}</option>` : nothing}\n </select>\n </div>`\n )}\n <div buttons>\n <button @click=${() => this.dispatchEvent(new CustomEvent('face-mapping-cancel', { bubbles: true, composed: true }))}>\n ${i18next.t('figure.button.face-mapping-cancel')}\n </button>\n <button act ?disabled=${!remap} @click=${() => remap && this.dispatchEvent(new CustomEvent('face-mapped', { detail: { remap }, bubbles: true, composed: true }))}>\n ${i18next.t('figure.button.face-mapping-apply')}\n </button>\n </div>`\n }\n}\n"]}
|
|
@@ -14,6 +14,8 @@ export declare class FigurePreview extends FigurePreview_base {
|
|
|
14
14
|
/** Clip speeds and control values given here -- the preview's, not the figure's. */
|
|
15
15
|
private driving;
|
|
16
16
|
private giving;
|
|
17
|
+
/** The part chosen in the editor. The size help starts on it, so the help speaks of the part the author was working on. */
|
|
18
|
+
selected: string;
|
|
17
19
|
private setupPart;
|
|
18
20
|
/** What is being tried here now -- clip speeds and control values -- for the AI dock to hear with a request; none when nothing is. */
|
|
19
21
|
tried(): {
|
|
@@ -6,7 +6,7 @@ import { compileFigureAsset } from '@hatiolab/figure-model';
|
|
|
6
6
|
import { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene';
|
|
7
7
|
import { DEFAULT_VIEW, previewBoardDepth, sceneLook, WORKBENCH } from './figure-view.js';
|
|
8
8
|
import { dialShape } from './angle-dial.js';
|
|
9
|
-
import { authoredSizeOf, PREVIEW_FACTOR, PREVIEW_WAYS, previewClampsOf, previewInstances } from './preview-model.js';
|
|
9
|
+
import { authoredSizeOf, PREVIEW_FACTOR, PREVIEW_WAYS, previewClampsOf, previewInstances, setupPartOf } from './preview-model.js';
|
|
10
10
|
let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
@@ -17,6 +17,8 @@ let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
17
17
|
/** Clip speeds and control values given here -- the preview's, not the figure's. */
|
|
18
18
|
this.driving = {};
|
|
19
19
|
this.giving = {};
|
|
20
|
+
/** The part chosen in the editor. The size help starts on it, so the help speaks of the part the author was working on. */
|
|
21
|
+
this.selected = '';
|
|
20
22
|
this.setupPart = '';
|
|
21
23
|
}
|
|
22
24
|
static { this.styles = css `
|
|
@@ -35,7 +37,25 @@ let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
35
37
|
width: 100%;
|
|
36
38
|
height: 100%;
|
|
37
39
|
}
|
|
38
|
-
|
|
40
|
+
/*
|
|
41
|
+
The size help and the posing controls share the stage's bottom edge. Each stood in its own corner, so on a narrow
|
|
42
|
+
stage (the 1024 width, both side panels open) the controls lay over the help's button. One row that wraps keeps both
|
|
43
|
+
whole: side by side when there is room, the controls above the help when there is not.
|
|
44
|
+
*/
|
|
45
|
+
div[foot] {
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 8px;
|
|
48
|
+
right: 8px;
|
|
49
|
+
bottom: 8px;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-wrap: wrap-reverse;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
align-items: flex-end;
|
|
54
|
+
gap: 8px;
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
}
|
|
57
|
+
div[foot] > * { pointer-events: auto; }
|
|
58
|
+
div[setup] { max-width: min(320px, 100%); padding: 12px; border-radius: 8px; background: rgba(28,28,30,.9); color: #fff; display: grid; gap: 8px; }
|
|
39
59
|
div[setup] p { margin: 0; line-height: 1.5; }
|
|
40
60
|
div[setup] select, div[setup] button { font: inherit; padding: 8px; min-width: 0; }
|
|
41
61
|
/* Which is which: side by side means nothing without a legend. */
|
|
@@ -59,9 +79,7 @@ let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
59
79
|
color: #ffcc80;
|
|
60
80
|
}
|
|
61
81
|
div[clips] {
|
|
62
|
-
|
|
63
|
-
right: 8px;
|
|
64
|
-
bottom: 8px;
|
|
82
|
+
margin-left: auto;
|
|
65
83
|
display: flex;
|
|
66
84
|
flex-direction: column;
|
|
67
85
|
gap: 6px;
|
|
@@ -150,6 +168,8 @@ let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
150
168
|
catch {
|
|
151
169
|
clampsByWay = {};
|
|
152
170
|
}
|
|
171
|
+
/* The part the help speaks of: the one picked in it, else the one chosen in the editor, else the first. */
|
|
172
|
+
const setupPart = setupPartOf(this.setupPart, this.selected, asset?.appearance.map(p => p.target) ?? []);
|
|
153
173
|
return html `<div stage></div>
|
|
154
174
|
${this.cannot
|
|
155
175
|
? html `<div cannot>${this.cannot}</div>`
|
|
@@ -164,14 +184,14 @@ let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
164
184
|
</span>`;
|
|
165
185
|
})}
|
|
166
186
|
</div>
|
|
167
|
-
|
|
187
|
+
<div foot>${asset?.appearance.length ? html `<div setup>
|
|
168
188
|
<p>${i18next.t('figure.text.preview-setup')}</p>
|
|
169
189
|
<select aria-label=${i18next.t('figure.label.resize-part')} @change=${(e) => this.setupPart = e.target.value}>
|
|
170
|
-
${asset.appearance.map(p => html `<option value=${p.target} ?selected=${p.target ===
|
|
190
|
+
${asset.appearance.map(p => html `<option value=${p.target} ?selected=${p.target === setupPart}>${p.target}</option>`)}
|
|
171
191
|
</select>
|
|
172
|
-
<button @click=${() => this.dispatchEvent(new CustomEvent('configure-size', { detail: { part:
|
|
192
|
+
<button @click=${() => this.dispatchEvent(new CustomEvent('configure-size', { detail: { part: setupPart }, bubbles: true, composed: true }))}>${i18next.t('figure.button.configure-size')}</button>
|
|
173
193
|
</div>` : nothing}
|
|
174
|
-
${controls.length + clips.length ? this.renderDrivers(asset, controls, clips) : nothing}
|
|
194
|
+
${controls.length + clips.length ? this.renderDrivers(asset, controls, clips) : nothing}</div>`}`;
|
|
175
195
|
}
|
|
176
196
|
renderDrivers(asset, controls, clips) {
|
|
177
197
|
const changed = controls.filter(c => this.giving[c.id] !== undefined && this.giving[c.id] !== asset.stateDefaults[c.id]);
|
|
@@ -200,7 +220,11 @@ let FigurePreview = class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
200
220
|
</label>`;
|
|
201
221
|
})}
|
|
202
222
|
${clips.map(clip => {
|
|
203
|
-
|
|
223
|
+
/*
|
|
224
|
+
A clip nothing has driven stands still, here as on a board: the instances get a speed only from `drive`. The
|
|
225
|
+
slider showed 1.00 over rollers that did not turn (2026-10-03). It shows what plays -- 0 until moved.
|
|
226
|
+
*/
|
|
227
|
+
const value = this.driving[clip] ?? 0;
|
|
204
228
|
return html `<label>
|
|
205
229
|
<span>${clip} <span drive>${i18next.t('figure.label.playback-speed')}</span></span>
|
|
206
230
|
<span></span>
|
|
@@ -356,6 +380,10 @@ __decorate([
|
|
|
356
380
|
state(),
|
|
357
381
|
__metadata("design:type", Object)
|
|
358
382
|
], FigurePreview.prototype, "giving", void 0);
|
|
383
|
+
__decorate([
|
|
384
|
+
property(),
|
|
385
|
+
__metadata("design:type", Object)
|
|
386
|
+
], FigurePreview.prototype, "selected", void 0);
|
|
359
387
|
__decorate([
|
|
360
388
|
state(),
|
|
361
389
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figure-preview.js","sourceRoot":"","sources":["../../client/modeller/figure-preview.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEjF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAqB,MAAM,kBAAkB,CAAA;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AA2B7G,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAzD;;QAsHL,4G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AAC;;AAnN+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;4CAAoB;AAEvC;IAAX,QAAQ,EAAE;;8CAAa;AACQ;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2CAAkC;AAEpC;IAA5B,KAAK,CAAC,YAAY,CAAC;8BAAiB,cAAc;4CAAA;AAClC;IAAhB,KAAK,EAAE;;6CAAoB;AAEX;IAAhB,KAAK,EAAE;;8CAA6C;AACpC;IAAhB,KAAK,EAAE;;6CAA4C;AACnC;IAAhB,KAAK,EAAE;;gDAAuB;AA/HpB,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAyUzB","sourcesContent":["import { css, html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { compileFigureAsset } from '@hatiolab/figure-model'\nimport type { FigureAsset } from '@hatiolab/figure-model'\nimport { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene'\n\nimport { DEFAULT_VIEW, previewBoardDepth, sceneLook, WORKBENCH, type ViewSettings } from './figure-view.js'\nimport { dialShape } from './angle-dial.js'\nimport { authoredSizeOf, PREVIEW_FACTOR, PREVIEW_WAYS, previewClampsOf, previewInstances } from './preview-model.js'\n\n/**\n * The figure placed on a board.\n *\n * The editing canvas shows the figure at the size it was made. Half of what a figure is lies in how it answers a\n * different size, so here the figure being authored is registered as a board registers it and placed as\n * `FigureInstance`s: the size it was made, and each of the seven ways of growing one, two or three axes twice as\n * large, side by side at one scale, four to a row. The board draws them as it will on a real board --\n * placement, lights, environment, the same renderer.\n *\n * The controls: each value that poses the figure with a slider (and a dial for an angle), each clip's\n * speed, and 「이 자세를 기본으로」 to keep the pose as the one it stands in. Nothing here is edited; the canvas edits.\n */\n\ninterface SceneHandle {\n dispose?: () => void\n resize?: () => void\n fit?: (type?: string) => void\n root?: {\n set?: (patch: Record<string, unknown>) => void\n fitCameraToModel?: () => void\n components?: { set?: (property: string, value: unknown) => void }[]\n }\n}\n\n@customElement('figure-preview')\nexport class FigurePreview extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n position: relative;\n display: flex;\n min-width: 0;\n min-height: 0;\n overflow: hidden;\n background-color: ${unsafeCSS(WORKBENCH)};\n font-size: 0.76rem;\n }\n div[stage] {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n }\n div[setup] { position: absolute; bottom: 8px; left: 8px; max-width: min(320px, calc(100% - 16px)); padding: 12px; border-radius: 8px; background: rgba(28,28,30,.9); color: #fff; display: grid; gap: 8px; }\n div[setup] p { margin: 0; line-height: 1.5; }\n div[setup] select, div[setup] button { font: inherit; padding: 8px; min-width: 0; }\n /* Which is which: side by side means nothing without a legend. */\n div[legend] {\n position: absolute;\n top: 8px;\n left: 8px;\n display: flex;\n gap: 6px;\n padding: 4px 8px;\n color: rgba(255, 255, 255, 0.9);\n background-color: rgba(28, 28, 30, 0.6);\n border-radius: 6px;\n font-size: 0.72rem;\n flex-wrap: wrap;\n max-width: calc(100% - 16px);\n }\n /* A variant drawn at another size than it asks: the figure does not declare that size. */\n div[legend] small[clamp] {\n margin-left: 4px;\n color: #ffcc80;\n }\n div[clips] {\n position: absolute;\n right: 8px;\n bottom: 8px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 8px 10px;\n color: rgba(255, 255, 255, 0.92);\n background-color: rgba(28, 28, 30, 0.72);\n border-radius: 8px;\n font-size: 0.72rem;\n }\n div[clips] label {\n display: grid;\n grid-template-columns: auto 20px 96px 34px;\n align-items: center;\n gap: 8px;\n }\n div[clips] svg[dial] {\n width: 20px;\n height: 20px;\n }\n div[clips] svg[dial] path {\n fill: rgba(255, 255, 255, 0.22);\n }\n div[clips] svg[dial] line {\n stroke: var(--md-sys-color-primary, #7cc6ff);\n stroke-width: 2;\n stroke-linecap: round;\n }\n div[clips] svg[dial] circle {\n fill: none;\n stroke: rgba(255, 255, 255, 0.35);\n }\n div[clips] button[pose] {\n align-self: stretch;\n padding: 4px 8px;\n font: inherit;\n font-size: 0.7rem;\n color: rgba(255, 255, 255, 0.92);\n background-color: rgba(255, 255, 255, 0.14);\n border: 1px solid rgba(255, 255, 255, 0.22);\n border-radius: 5px;\n cursor: pointer;\n }\n div[clips] button[pose]:hover {\n background-color: rgba(255, 255, 255, 0.24);\n }\n div[clips] span[drive] {\n opacity: 0.6;\n font-size: 0.66rem;\n }\n div[clips] input {\n width: 96px;\n accent-color: var(--md-sys-color-primary);\n }\n div[clips] output {\n font-variant-numeric: tabular-nums;\n text-align: right;\n opacity: 0.85;\n }\n div[cannot] {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 12px;\n text-align: center;\n line-height: 1.6;\n color: #f4f4f4;\n background-color: ${unsafeCSS(WORKBENCH)};\n }\n `\n\n /** The figure being authored, as the editor holds it now. */\n @property({ attribute: false }) asset?: FigureAsset\n /** Which figure: the type it is registered under here is this one's own, never a real type a board uses. */\n @property() context = ''\n @property({ attribute: false }) view: ViewSettings = DEFAULT_VIEW\n\n @query('div[stage]') private stage!: HTMLDivElement\n @state() private cannot = ''\n /** Clip speeds and control values given here -- the preview's, not the figure's. */\n @state() private driving: Record<string, number> = {}\n @state() private giving: Record<string, number> = {}\n @state() private setupPart = ''\n\n /** What is being tried here now -- clip speeds and control values -- for the AI dock to hear with a request; none when nothing is. */\n tried(): { clips?: Record<string, number>; controls?: Record<string, number> } | undefined {\n const clips = Object.keys(this.driving).length ? { ...this.driving } : undefined\n const controls = Object.keys(this.giving).length ? { ...this.giving } : undefined\n return clips || controls ? { ...(clips ? { clips } : {}), ...(controls ? { controls } : {}) } : undefined\n }\n\n private scene?: SceneHandle\n private standing?: string\n private registered?: string\n private watcher?: ResizeObserver\n\n render() {\n const asset = this.asset\n const controls = asset ? asset.document.model.inputs.filter(i => i.role === 'state') : []\n const clips = asset ? [...new Set((asset.drivers ?? []).map(d => d.clip))] : []\n let clampsByWay: ReturnType<typeof previewClampsOf> = {}\n try {\n clampsByWay = asset ? previewClampsOf(asset, authoredSizeOf(asset)) : {}\n } catch {\n clampsByWay = {}\n }\n return html`<div stage></div>\n ${this.cannot\n ? html`<div cannot>${this.cannot}</div>`\n : html`<div legend>\n ${PREVIEW_WAYS.map(way => {\n const clamps = clampsByWay[way.name] ?? []\n return html`<span>\n ${way.axes.length ? way.name : i18next.t('figure.label.preview-base')}\n ${clamps.length\n ? html`<small clamp>${clamps.map(c => i18next.t('figure.text.preview-clamped', { axis: c.axis.toUpperCase(), asked: c.asked.toLocaleString(), used: c.used.toLocaleString() })).join(' · ')}</small>`\n : nothing}\n </span>`\n })}\n </div>\n ${asset?.appearance.length ? html`<div setup>\n <p>${i18next.t('figure.text.preview-setup')}</p>\n <select aria-label=${i18next.t('figure.label.resize-part')} @change=${(e: Event) => this.setupPart = (e.target as HTMLSelectElement).value}>\n ${asset.appearance.map(p => html`<option value=${p.target} ?selected=${p.target === this.setupPart}>${p.target}</option>`)}\n </select>\n <button @click=${() => this.dispatchEvent(new CustomEvent('configure-size', { detail: { part: asset.appearance.some(p => p.target === this.setupPart) ? this.setupPart : asset.appearance[0]!.target }, bubbles: true, composed: true }))}>${i18next.t('figure.button.configure-size')}</button>\n </div>` : nothing}\n ${controls.length + clips.length ? this.renderDrivers(asset!, controls, clips) : nothing}`}`\n }\n\n private renderDrivers(asset: FigureAsset, controls: FigureAsset['document']['model']['inputs'], clips: string[]) {\n const changed = controls.filter(c => this.giving[c.id] !== undefined && this.giving[c.id] !== asset.stateDefaults[c.id])\n return html`<div clips>\n ${changed.length\n ? html`<button pose title=${i18next.t('figure.text.pose-as-default-explained')} @click=${() => this.poseAsDefault()}>\n ${i18next.t('figure.button.pose-as-default')}\n </button>`\n : nothing}\n ${controls.map(control => {\n const value = this.giving[control.id] ?? asset.stateDefaults[control.id] ?? control.min\n const step = Math.max((control.max - control.min) / 100, 0.01)\n const label = asset.stateInputs?.[control.id]?.label ?? control.id\n return html`<label>\n <span>${label} <span drive>${control.unit}</span></span>\n ${this.renderDial(control, value)}\n <input\n type=\"range\"\n min=${control.min}\n max=${control.max}\n step=${step}\n .value=${String(value)}\n @input=${(e: Event) => this.give(control.id, Number((e.target as HTMLInputElement).value))}\n />\n <output>${Math.round(value)}</output>\n </label>`\n })}\n ${clips.map(clip => {\n const value = this.driving[clip] ?? 1\n return html`<label>\n <span>${clip} <span drive>${i18next.t('figure.label.playback-speed')}</span></span>\n <span></span>\n <input type=\"range\" min=\"0\" max=\"3\" step=\"0.05\" .value=${String(value)} @input=${(e: Event) => this.drive(clip, Number((e.target as HTMLInputElement).value))} />\n <output>${value.toFixed(2)}</output>\n </label>`\n })}\n </div>`\n }\n\n private renderDial(control: { unit: string; min: number; max: number }, value: number) {\n if (control.unit !== 'deg') return html`<span></span>`\n const dial = dialShape(control.min, control.max, 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 drive(clip: string, value: number) {\n this.driving = { ...this.driving, [clip]: value }\n this.tellInstances('clips', this.driving)\n }\n\n private give(id: string, value: number) {\n this.giving = { ...this.giving, [id]: value }\n this.tellInstances('parameters', this.giving)\n }\n\n private poseAsDefault() {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-state-defaults', values: { ...this.giving } } }, bubbles: true, composed: true }))\n this.giving = {}\n }\n\n private tellInstances(key: 'clips' | 'parameters', values: Record<string, number>) {\n for (const component of this.scene?.root?.components ?? []) component.set?.(key, { ...values })\n }\n\n willUpdate(changed: Map<string, unknown>) {\n if (!this.hasUpdated) return\n if (changed.has('asset') || changed.has('context')) {\n this.standUp()\n return\n }\n if (!changed.has('view')) return\n const before = changed.get('view') as ViewSettings | undefined\n const now = this.view ?? DEFAULT_VIEW\n if (before?.placement !== now.placement || before?.ceilingHeight !== now.ceilingHeight) this.standUp()\n else this.scene?.root?.set?.(sceneLook(now))\n }\n\n firstUpdated() {\n this.standUp()\n this.watcher = new ResizeObserver(() => this.scene?.resize?.())\n this.watcher.observe(this)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.watcher?.disconnect()\n this.watcher = undefined\n this.teardown()\n }\n\n private standUp() {\n const asset = this.asset\n const view = this.view ?? DEFAULT_VIEW\n if (!asset || !asset.appearance.length) {\n this.cannot = i18next.t('figure.text.preview-needs-a-part')\n this.teardown()\n return\n }\n const signature = JSON.stringify([asset, view.placement, view.ceilingHeight])\n if (this.scene && this.standing === signature) return\n try {\n compileFigureAsset(asset)\n } catch {\n this.cannot = i18next.t('figure.text.preview-blocked-by-errors')\n this.teardown()\n return\n }\n this.teardown()\n this.driving = {}\n try {\n /* Registered as a board registers it, under a type of this preview's own: a real type's drawings stay as they are. */\n const type = `figure-preview-${this.context || 'new'}`\n registerFigure(type, asset)\n this.registered = type\n const size = authoredSizeOf(asset)\n const { components, board } = previewInstances(type, size)\n this.scene = create({\n target: this.stage,\n model: {\n type: 'model-layer',\n width: board.width,\n height: board.height,\n depth: previewBoardDepth({ placement: asset.placement, base: { y: size.y } }, view.ceilingHeight, PREVIEW_FACTOR),\n threed: true,\n sky: 'color',\n ...sceneLook(view),\n placement: view.placement,\n heights: { floor: 0, ceiling: view.ceilingHeight },\n pixelRatio: Math.min(3, (window.devicePixelRatio || 1) * 2),\n components\n },\n mode: 0\n }) as SceneHandle\n this.standing = signature\n this.scene.resize?.()\n this.scene.fit?.('ratio')\n this.scene.root?.fitCameraToModel?.()\n this.cannot = ''\n } catch (error) {\n this.cannot = (error as Error).message\n }\n }\n\n private teardown() {\n this.scene?.dispose?.()\n this.scene = undefined\n this.standing = undefined\n if (this.registered) unregisterFigure(this.registered)\n this.registered = undefined\n }\n}\n"]}
|
|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KAAK,EAAE;;6CAA4C;AAExC;IAAX,QAAQ,EAAE;;+CAAc;AACR;IAAhB,KAAK,EAAE;;gDAAuB;AAjJpB,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAiWzB","sourcesContent":["import { css, html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { compileFigureAsset } from '@hatiolab/figure-model'\nimport type { FigureAsset } from '@hatiolab/figure-model'\nimport { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene'\n\nimport { DEFAULT_VIEW, previewBoardDepth, sceneLook, WORKBENCH, type ViewSettings } from './figure-view.js'\nimport { dialShape } from './angle-dial.js'\nimport { authoredSizeOf, PREVIEW_FACTOR, PREVIEW_WAYS, previewClampsOf, previewInstances, setupPartOf } from './preview-model.js'\n\n/**\n * The figure placed on a board.\n *\n * The editing canvas shows the figure at the size it was made. Half of what a figure is lies in how it answers a\n * different size, so here the figure being authored is registered as a board registers it and placed as\n * `FigureInstance`s: the size it was made, and each of the seven ways of growing one, two or three axes twice as\n * large, side by side at one scale, four to a row. The board draws them as it will on a real board --\n * placement, lights, environment, the same renderer.\n *\n * The controls: each value that poses the figure with a slider (and a dial for an angle), each clip's\n * speed, and 「이 자세를 기본으로」 to keep the pose as the one it stands in. Nothing here is edited; the canvas edits.\n */\n\ninterface SceneHandle {\n dispose?: () => void\n resize?: () => void\n fit?: (type?: string) => void\n root?: {\n set?: (patch: Record<string, unknown>) => void\n fitCameraToModel?: () => void\n components?: { set?: (property: string, value: unknown) => void }[]\n }\n}\n\n@customElement('figure-preview')\nexport class FigurePreview extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n position: relative;\n display: flex;\n min-width: 0;\n min-height: 0;\n overflow: hidden;\n background-color: ${unsafeCSS(WORKBENCH)};\n font-size: 0.76rem;\n }\n div[stage] {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n }\n /*\n The size help and the posing controls share the stage's bottom edge. Each stood in its own corner, so on a narrow\n stage (the 1024 width, both side panels open) the controls lay over the help's button. One row that wraps keeps both\n whole: side by side when there is room, the controls above the help when there is not.\n */\n div[foot] {\n position: absolute;\n left: 8px;\n right: 8px;\n bottom: 8px;\n display: flex;\n flex-wrap: wrap-reverse;\n justify-content: space-between;\n align-items: flex-end;\n gap: 8px;\n pointer-events: none;\n }\n div[foot] > * { pointer-events: auto; }\n div[setup] { max-width: min(320px, 100%); padding: 12px; border-radius: 8px; background: rgba(28,28,30,.9); color: #fff; display: grid; gap: 8px; }\n div[setup] p { margin: 0; line-height: 1.5; }\n div[setup] select, div[setup] button { font: inherit; padding: 8px; min-width: 0; }\n /* Which is which: side by side means nothing without a legend. */\n div[legend] {\n position: absolute;\n top: 8px;\n left: 8px;\n display: flex;\n gap: 6px;\n padding: 4px 8px;\n color: rgba(255, 255, 255, 0.9);\n background-color: rgba(28, 28, 30, 0.6);\n border-radius: 6px;\n font-size: 0.72rem;\n flex-wrap: wrap;\n max-width: calc(100% - 16px);\n }\n /* A variant drawn at another size than it asks: the figure does not declare that size. */\n div[legend] small[clamp] {\n margin-left: 4px;\n color: #ffcc80;\n }\n div[clips] {\n margin-left: auto;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 8px 10px;\n color: rgba(255, 255, 255, 0.92);\n background-color: rgba(28, 28, 30, 0.72);\n border-radius: 8px;\n font-size: 0.72rem;\n }\n div[clips] label {\n display: grid;\n grid-template-columns: auto 20px 96px 34px;\n align-items: center;\n gap: 8px;\n }\n div[clips] svg[dial] {\n width: 20px;\n height: 20px;\n }\n div[clips] svg[dial] path {\n fill: rgba(255, 255, 255, 0.22);\n }\n div[clips] svg[dial] line {\n stroke: var(--md-sys-color-primary, #7cc6ff);\n stroke-width: 2;\n stroke-linecap: round;\n }\n div[clips] svg[dial] circle {\n fill: none;\n stroke: rgba(255, 255, 255, 0.35);\n }\n div[clips] button[pose] {\n align-self: stretch;\n padding: 4px 8px;\n font: inherit;\n font-size: 0.7rem;\n color: rgba(255, 255, 255, 0.92);\n background-color: rgba(255, 255, 255, 0.14);\n border: 1px solid rgba(255, 255, 255, 0.22);\n border-radius: 5px;\n cursor: pointer;\n }\n div[clips] button[pose]:hover {\n background-color: rgba(255, 255, 255, 0.24);\n }\n div[clips] span[drive] {\n opacity: 0.6;\n font-size: 0.66rem;\n }\n div[clips] input {\n width: 96px;\n accent-color: var(--md-sys-color-primary);\n }\n div[clips] output {\n font-variant-numeric: tabular-nums;\n text-align: right;\n opacity: 0.85;\n }\n div[cannot] {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 12px;\n text-align: center;\n line-height: 1.6;\n color: #f4f4f4;\n background-color: ${unsafeCSS(WORKBENCH)};\n }\n `\n\n /** The figure being authored, as the editor holds it now. */\n @property({ attribute: false }) asset?: FigureAsset\n /** Which figure: the type it is registered under here is this one's own, never a real type a board uses. */\n @property() context = ''\n @property({ attribute: false }) view: ViewSettings = DEFAULT_VIEW\n\n @query('div[stage]') private stage!: HTMLDivElement\n @state() private cannot = ''\n /** Clip speeds and control values given here -- the preview's, not the figure's. */\n @state() private driving: Record<string, number> = {}\n @state() private giving: Record<string, number> = {}\n /** The part chosen in the editor. The size help starts on it, so the help speaks of the part the author was working on. */\n @property() selected = ''\n @state() private setupPart = ''\n\n /** What is being tried here now -- clip speeds and control values -- for the AI dock to hear with a request; none when nothing is. */\n tried(): { clips?: Record<string, number>; controls?: Record<string, number> } | undefined {\n const clips = Object.keys(this.driving).length ? { ...this.driving } : undefined\n const controls = Object.keys(this.giving).length ? { ...this.giving } : undefined\n return clips || controls ? { ...(clips ? { clips } : {}), ...(controls ? { controls } : {}) } : undefined\n }\n\n private scene?: SceneHandle\n private standing?: string\n private registered?: string\n private watcher?: ResizeObserver\n\n render() {\n const asset = this.asset\n const controls = asset ? asset.document.model.inputs.filter(i => i.role === 'state') : []\n const clips = asset ? [...new Set((asset.drivers ?? []).map(d => d.clip))] : []\n let clampsByWay: ReturnType<typeof previewClampsOf> = {}\n try {\n clampsByWay = asset ? previewClampsOf(asset, authoredSizeOf(asset)) : {}\n } catch {\n clampsByWay = {}\n }\n /* The part the help speaks of: the one picked in it, else the one chosen in the editor, else the first. */\n const setupPart = setupPartOf(this.setupPart, this.selected, asset?.appearance.map(p => p.target) ?? [])\n return html`<div stage></div>\n ${this.cannot\n ? html`<div cannot>${this.cannot}</div>`\n : html`<div legend>\n ${PREVIEW_WAYS.map(way => {\n const clamps = clampsByWay[way.name] ?? []\n return html`<span>\n ${way.axes.length ? way.name : i18next.t('figure.label.preview-base')}\n ${clamps.length\n ? html`<small clamp>${clamps.map(c => i18next.t('figure.text.preview-clamped', { axis: c.axis.toUpperCase(), asked: c.asked.toLocaleString(), used: c.used.toLocaleString() })).join(' · ')}</small>`\n : nothing}\n </span>`\n })}\n </div>\n <div foot>${asset?.appearance.length ? html`<div setup>\n <p>${i18next.t('figure.text.preview-setup')}</p>\n <select aria-label=${i18next.t('figure.label.resize-part')} @change=${(e: Event) => this.setupPart = (e.target as HTMLSelectElement).value}>\n ${asset.appearance.map(p => html`<option value=${p.target} ?selected=${p.target === setupPart}>${p.target}</option>`)}\n </select>\n <button @click=${() => this.dispatchEvent(new CustomEvent('configure-size', { detail: { part: setupPart }, bubbles: true, composed: true }))}>${i18next.t('figure.button.configure-size')}</button>\n </div>` : nothing}\n ${controls.length + clips.length ? this.renderDrivers(asset!, controls, clips) : nothing}</div>`}`\n }\n\n private renderDrivers(asset: FigureAsset, controls: FigureAsset['document']['model']['inputs'], clips: string[]) {\n const changed = controls.filter(c => this.giving[c.id] !== undefined && this.giving[c.id] !== asset.stateDefaults[c.id])\n return html`<div clips>\n ${changed.length\n ? html`<button pose title=${i18next.t('figure.text.pose-as-default-explained')} @click=${() => this.poseAsDefault()}>\n ${i18next.t('figure.button.pose-as-default')}\n </button>`\n : nothing}\n ${controls.map(control => {\n const value = this.giving[control.id] ?? asset.stateDefaults[control.id] ?? control.min\n const step = Math.max((control.max - control.min) / 100, 0.01)\n const label = asset.stateInputs?.[control.id]?.label ?? control.id\n return html`<label>\n <span>${label} <span drive>${control.unit}</span></span>\n ${this.renderDial(control, value)}\n <input\n type=\"range\"\n min=${control.min}\n max=${control.max}\n step=${step}\n .value=${String(value)}\n @input=${(e: Event) => this.give(control.id, Number((e.target as HTMLInputElement).value))}\n />\n <output>${Math.round(value)}</output>\n </label>`\n })}\n ${clips.map(clip => {\n /*\n A clip nothing has driven stands still, here as on a board: the instances get a speed only from `drive`. The\n slider showed 1.00 over rollers that did not turn (2026-10-03). It shows what plays -- 0 until moved.\n */\n const value = this.driving[clip] ?? 0\n return html`<label>\n <span>${clip} <span drive>${i18next.t('figure.label.playback-speed')}</span></span>\n <span></span>\n <input type=\"range\" min=\"0\" max=\"3\" step=\"0.05\" .value=${String(value)} @input=${(e: Event) => this.drive(clip, Number((e.target as HTMLInputElement).value))} />\n <output>${value.toFixed(2)}</output>\n </label>`\n })}\n </div>`\n }\n\n private renderDial(control: { unit: string; min: number; max: number }, value: number) {\n if (control.unit !== 'deg') return html`<span></span>`\n const dial = dialShape(control.min, control.max, 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 drive(clip: string, value: number) {\n this.driving = { ...this.driving, [clip]: value }\n this.tellInstances('clips', this.driving)\n }\n\n private give(id: string, value: number) {\n this.giving = { ...this.giving, [id]: value }\n this.tellInstances('parameters', this.giving)\n }\n\n private poseAsDefault() {\n this.dispatchEvent(new CustomEvent('part-edit', { detail: { edit: { kind: 'set-state-defaults', values: { ...this.giving } } }, bubbles: true, composed: true }))\n this.giving = {}\n }\n\n private tellInstances(key: 'clips' | 'parameters', values: Record<string, number>) {\n for (const component of this.scene?.root?.components ?? []) component.set?.(key, { ...values })\n }\n\n willUpdate(changed: Map<string, unknown>) {\n if (!this.hasUpdated) return\n if (changed.has('asset') || changed.has('context')) {\n this.standUp()\n return\n }\n if (!changed.has('view')) return\n const before = changed.get('view') as ViewSettings | undefined\n const now = this.view ?? DEFAULT_VIEW\n if (before?.placement !== now.placement || before?.ceilingHeight !== now.ceilingHeight) this.standUp()\n else this.scene?.root?.set?.(sceneLook(now))\n }\n\n firstUpdated() {\n this.standUp()\n this.watcher = new ResizeObserver(() => this.scene?.resize?.())\n this.watcher.observe(this)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.watcher?.disconnect()\n this.watcher = undefined\n this.teardown()\n }\n\n private standUp() {\n const asset = this.asset\n const view = this.view ?? DEFAULT_VIEW\n if (!asset || !asset.appearance.length) {\n this.cannot = i18next.t('figure.text.preview-needs-a-part')\n this.teardown()\n return\n }\n const signature = JSON.stringify([asset, view.placement, view.ceilingHeight])\n if (this.scene && this.standing === signature) return\n try {\n compileFigureAsset(asset)\n } catch {\n this.cannot = i18next.t('figure.text.preview-blocked-by-errors')\n this.teardown()\n return\n }\n this.teardown()\n this.driving = {}\n try {\n /* Registered as a board registers it, under a type of this preview's own: a real type's drawings stay as they are. */\n const type = `figure-preview-${this.context || 'new'}`\n registerFigure(type, asset)\n this.registered = type\n const size = authoredSizeOf(asset)\n const { components, board } = previewInstances(type, size)\n this.scene = create({\n target: this.stage,\n model: {\n type: 'model-layer',\n width: board.width,\n height: board.height,\n depth: previewBoardDepth({ placement: asset.placement, base: { y: size.y } }, view.ceilingHeight, PREVIEW_FACTOR),\n threed: true,\n sky: 'color',\n ...sceneLook(view),\n placement: view.placement,\n heights: { floor: 0, ceiling: view.ceilingHeight },\n pixelRatio: Math.min(3, (window.devicePixelRatio || 1) * 2),\n components\n },\n mode: 0\n }) as SceneHandle\n this.standing = signature\n this.scene.resize?.()\n this.scene.fit?.('ratio')\n this.scene.root?.fitCameraToModel?.()\n this.cannot = ''\n } catch (error) {\n this.cannot = (error as Error).message\n }\n }\n\n private teardown() {\n this.scene?.dispose?.()\n this.scene = undefined\n this.standing = undefined\n if (this.registered) unregisterFigure(this.registered)\n this.registered = undefined\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, nothing } from 'lit';
|
|
2
|
-
import type { FigureEvaluatedShape, FigureSectionMeasure } from '@hatiolab/figure-model';
|
|
2
|
+
import type { FigureEvaluatedShape, FigureFaceMappingNeed, FigureSectionMeasure } from '@hatiolab/figure-model';
|
|
3
3
|
import './figure-cavity-drawing.js';
|
|
4
|
+
import './figure-face-mapping.js';
|
|
4
5
|
import './figure-section-close-choice.js';
|
|
5
6
|
type Axis = 'x' | 'y' | 'z';
|
|
6
7
|
/** The editor's width and room for the solid beside it: below this the two take turns. */
|
|
@@ -49,6 +50,8 @@ export declare class FigureSectionEditor extends FigureSectionEditor_base {
|
|
|
49
50
|
pointBlocked: string;
|
|
50
51
|
/** The figure's revision now; the editor remembers the one it opened at. */
|
|
51
52
|
revision: number;
|
|
53
|
+
/** What stands on the faces the last apply takes away (ADR-0100 A8): asked here, where the edit was made. */
|
|
54
|
+
faceMapping?: FigureFaceMappingNeed;
|
|
52
55
|
/** Narrow: the outline or the solid behind. */
|
|
53
56
|
show: 'outline' | 'solid';
|
|
54
57
|
/** Set when the space the editor stands in leaves too little beside it to see the solid. */
|
|
@@ -8,6 +8,7 @@ import { SidePanelStyles } from './side-panel-styles.js';
|
|
|
8
8
|
import { apexOver, drawnOf, insertAfter, markedBy, movePoint, pointLabel, removePoint, sectionOf, workingIssuesOf, workingOf, workingShapeOf } from './section-drawing.js';
|
|
9
9
|
import { cavityDepthOf, cavityRequestOf, cavityResultOf, END_FACE, sameOf, sidesOf } from './section-controls.js';
|
|
10
10
|
import './figure-cavity-drawing.js';
|
|
11
|
+
import './figure-face-mapping.js';
|
|
11
12
|
import { openPopup } from '@operato/layout';
|
|
12
13
|
import './figure-section-close-choice.js';
|
|
13
14
|
/** How the section is laid on the screen, by the axis it is pushed along: across to the right, then down. */
|
|
@@ -405,8 +406,11 @@ let FigureSectionEditor = class FigureSectionEditor extends localize(i18next)(Li
|
|
|
405
406
|
apply() {
|
|
406
407
|
if (this.stale || !this.valid(this.working))
|
|
407
408
|
return;
|
|
408
|
-
|
|
409
|
-
this.
|
|
409
|
+
const detail = { action: this.action(this.working) };
|
|
410
|
+
this.dispatchEvent(new CustomEvent('command', { detail, bubbles: true, composed: true }));
|
|
411
|
+
/* Held for a choice of where what stands on a lost face goes: stays open, the choice shown below. */
|
|
412
|
+
if (!detail.held)
|
|
413
|
+
this.close();
|
|
410
414
|
}
|
|
411
415
|
/** Whether anything was changed since the editor opened. */
|
|
412
416
|
get dirty() {
|
|
@@ -495,7 +499,10 @@ let FigureSectionEditor = class FigureSectionEditor extends localize(i18next)(Li
|
|
|
495
499
|
</nav>
|
|
496
500
|
<div body>
|
|
497
501
|
<div outline>${this.drawing(issues, words.length > 0)}</div>
|
|
498
|
-
<aside
|
|
502
|
+
<aside>
|
|
503
|
+
${this.faceMapping ? html `<figure-face-mapping .need=${this.faceMapping}></figure-face-mapping>` : nothing}
|
|
504
|
+
${this.list(issues, words)}
|
|
505
|
+
</aside>
|
|
499
506
|
</div>
|
|
500
507
|
<footer>
|
|
501
508
|
<button ?disabled=${!this.history.length} @click=${() => this.back()}>${i18next.t('figure.button.section-editor-back')}</button>
|
|
@@ -839,6 +846,10 @@ __decorate([
|
|
|
839
846
|
property({ type: Number }),
|
|
840
847
|
__metadata("design:type", Object)
|
|
841
848
|
], FigureSectionEditor.prototype, "revision", void 0);
|
|
849
|
+
__decorate([
|
|
850
|
+
property({ attribute: false }),
|
|
851
|
+
__metadata("design:type", Object)
|
|
852
|
+
], FigureSectionEditor.prototype, "faceMapping", void 0);
|
|
842
853
|
__decorate([
|
|
843
854
|
property({ reflect: true }),
|
|
844
855
|
__metadata("design:type", String)
|