@things-factory/figure-ui 10.1.37 → 10.1.39

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 (62) hide show
  1. package/client/graphql/index.ts +53 -0
  2. package/client/graphql/v3-store.ts +8 -2
  3. package/client/modeller/figure-history-panel.ts +33 -87
  4. package/client/modeller/figure-v3-parts.ts +365 -0
  5. package/client/modeller/figure-v3-verdict.ts +247 -0
  6. package/client/modeller/gate-findings.ts +105 -0
  7. package/client/modeller/v3-editor.ts +11 -2
  8. package/client/modeller/v3-occupancy.ts +22 -0
  9. package/client/modeller/v3-product-session.ts +23 -4
  10. package/client/modeller/v3-renderer.ts +27 -18
  11. package/client/modeller/v3-thumbnail.ts +97 -0
  12. package/client/pages/figure-v3-modeller-page.ts +272 -12
  13. package/client/route.ts +8 -0
  14. package/dist-client/graphql/index.d.ts +8 -0
  15. package/dist-client/graphql/index.js +51 -0
  16. package/dist-client/graphql/index.js.map +1 -1
  17. package/dist-client/graphql/v3-store.js +8 -2
  18. package/dist-client/graphql/v3-store.js.map +1 -1
  19. package/dist-client/modeller/figure-history-panel.d.ts +21 -0
  20. package/dist-client/modeller/figure-history-panel.js +34 -87
  21. package/dist-client/modeller/figure-history-panel.js.map +1 -1
  22. package/dist-client/modeller/figure-v3-parts.d.ts +41 -0
  23. package/dist-client/modeller/figure-v3-parts.js +352 -0
  24. package/dist-client/modeller/figure-v3-parts.js.map +1 -0
  25. package/dist-client/modeller/figure-v3-verdict.d.ts +50 -0
  26. package/dist-client/modeller/figure-v3-verdict.js +268 -0
  27. package/dist-client/modeller/figure-v3-verdict.js.map +1 -0
  28. package/dist-client/modeller/gate-findings.d.ts +12 -0
  29. package/dist-client/modeller/gate-findings.js +102 -0
  30. package/dist-client/modeller/gate-findings.js.map +1 -0
  31. package/dist-client/modeller/v3-editor.js +11 -2
  32. package/dist-client/modeller/v3-editor.js.map +1 -1
  33. package/dist-client/modeller/v3-occupancy.d.ts +14 -0
  34. package/dist-client/modeller/v3-occupancy.js +22 -0
  35. package/dist-client/modeller/v3-occupancy.js.map +1 -0
  36. package/dist-client/modeller/v3-product-session.d.ts +44 -2
  37. package/dist-client/modeller/v3-product-session.js +13 -2
  38. package/dist-client/modeller/v3-product-session.js.map +1 -1
  39. package/dist-client/modeller/v3-renderer.d.ts +9 -0
  40. package/dist-client/modeller/v3-renderer.js +22 -30
  41. package/dist-client/modeller/v3-renderer.js.map +1 -1
  42. package/dist-client/modeller/v3-thumbnail.d.ts +3 -0
  43. package/dist-client/modeller/v3-thumbnail.js +74 -0
  44. package/dist-client/modeller/v3-thumbnail.js.map +1 -0
  45. package/dist-client/pages/figure-v3-modeller-page.d.ts +52 -1
  46. package/dist-client/pages/figure-v3-modeller-page.js +294 -12
  47. package/dist-client/pages/figure-v3-modeller-page.js.map +1 -1
  48. package/dist-client/route.d.ts +1 -1
  49. package/dist-client/route.js +7 -0
  50. package/dist-client/route.js.map +1 -1
  51. package/dist-client/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +5 -5
  53. package/test/resolve-ts-siblings.mjs +18 -0
  54. package/test/v3-product-write.test.ts +14 -2
  55. package/test/v3-release-panel.test.ts +73 -0
  56. package/test/v3-verdict.test.ts +82 -0
  57. package/things-factory.config.js +6 -1
  58. package/translations/en.json +79 -1
  59. package/translations/ja.json +79 -1
  60. package/translations/ko.json +79 -1
  61. package/translations/ms.json +79 -1
  62. package/translations/zh.json +79 -1
@@ -0,0 +1,268 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import { css, html, LitElement, nothing } from 'lit';
4
+ import { customElement, property, state } from 'lit/decorators.js';
5
+ import { i18next, localize } from '@operato/i18n';
6
+ import { parseV3Asset, v3CostOf } from '@hatiolab/figure-model';
7
+ import { inspectFigureDraft } from '../graphql/index.js';
8
+ import { gateFindingStyles, renderGateFinding } from './gate-findings.js';
9
+ import { capacityFrom, MEASURED } from './scene-budget.js';
10
+ /** How long an edit settles before the server is asked again. One question per pause, not one per keystroke. */
11
+ export const VERDICT_SETTLE_MS = 400;
12
+ /**
13
+ * 판정 — the V3 modeller's verdict while editing (parity row ①).
14
+ *
15
+ * The V2 modeller shows, as the author edits, how many of the figure fit on one screen and what would stop it
16
+ * being published. The V3 page showed neither: the author learned what blocked a release only after saving, in the
17
+ * release panel. This tab answers both from the source being edited.
18
+ *
19
+ * The count is computed here, from `v3CostOf` and the same `capacityFrom` the catalogue cards use, so the tab and
20
+ * the card cannot disagree. The findings are not: they come from the server's release door (`inspectFigureDraft`),
21
+ * the same door and the same sentences as the release panel. A second judgement on the screen would say something
22
+ * different the first time either changed.
23
+ *
24
+ * No grade. V2's grade measures V2 reuse; nothing measures it for V3, so the tab shows no letter rather than one
25
+ * nothing computed.
26
+ */
27
+ let FigureV3Verdict = class FigureV3Verdict extends localize(i18next)(LitElement) {
28
+ constructor() {
29
+ super(...arguments);
30
+ /** Bodies in the asset, drawn or hidden. With none there is nothing to fit the space to, so the button is not offered. */
31
+ this.bodies = 0;
32
+ this.failure = '';
33
+ this.asking = false;
34
+ /** Answers can come back out of order; only the newest question's answer is shown. */
35
+ this.asked = 0;
36
+ this.fit = () => {
37
+ this.dispatchEvent(new CustomEvent('fit-base-to-parts', { bubbles: true, composed: true }));
38
+ };
39
+ }
40
+ static { this.styles = [
41
+ gateFindingStyles,
42
+ css `
43
+ :host {
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: 14px;
47
+ padding: 12px;
48
+ overflow: auto;
49
+ font-size: 0.76rem;
50
+ color: var(--md-sys-color-on-surface);
51
+ }
52
+ section > h3 {
53
+ margin: 0 0 6px 0;
54
+ font-size: var(--ui-t-micro, 11px);
55
+ font-weight: 700;
56
+ letter-spacing: 0.04em;
57
+ text-transform: uppercase;
58
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
59
+ }
60
+ p {
61
+ margin: 4px 0 0;
62
+ }
63
+ p[lead],
64
+ p[basis],
65
+ p[quiet] {
66
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
67
+ }
68
+ div[count] {
69
+ display: flex;
70
+ align-items: baseline;
71
+ gap: 6px;
72
+ }
73
+ span[capacity] {
74
+ font-size: 2.1rem;
75
+ font-weight: 800;
76
+ line-height: 1;
77
+ letter-spacing: -0.01em;
78
+ color: var(--md-sys-color-primary);
79
+ }
80
+ span[unit] {
81
+ font-size: 0.9rem;
82
+ font-weight: 600;
83
+ color: var(--md-sys-color-primary);
84
+ }
85
+ p[clear] {
86
+ color: var(--md-sys-color-primary);
87
+ font-weight: 600;
88
+ }
89
+ p[failed] {
90
+ color: var(--md-sys-color-error);
91
+ }
92
+ button[fit] {
93
+ align-self: flex-start;
94
+ margin-top: 4px;
95
+ padding: 4px 10px;
96
+ font: inherit;
97
+ color: var(--md-sys-color-on-secondary-container);
98
+ background: var(--md-sys-color-secondary-container);
99
+ border: none;
100
+ border-radius: 999em;
101
+ cursor: pointer;
102
+ }
103
+ `
104
+ ]; }
105
+ disconnectedCallback() {
106
+ clearTimeout(this.timer);
107
+ super.disconnectedCallback();
108
+ }
109
+ updated(changes) {
110
+ if (changes.has('source'))
111
+ this.measure();
112
+ if (changes.has('source') || changes.has('figureId') || changes.has('figureType'))
113
+ this.schedule();
114
+ }
115
+ measure() {
116
+ let capacity;
117
+ let bodies = 0;
118
+ try {
119
+ const cost = this.source ? v3CostOf(parseV3Asset(this.source)) : undefined;
120
+ capacity = cost ? capacityFrom(cost.groups, cost.triangles) : undefined;
121
+ bodies = cost ? cost.groups + cost.hidden : 0;
122
+ }
123
+ catch {
124
+ /* A source the format refuses has no count; the server's finding below says why. */
125
+ capacity = undefined;
126
+ }
127
+ this.capacity = capacity;
128
+ this.bodies = bodies;
129
+ this.dispatchEvent(new CustomEvent('capacity-changed', { detail: { instances: capacity?.instances } }));
130
+ }
131
+ schedule() {
132
+ clearTimeout(this.timer);
133
+ if (!this.source) {
134
+ this.inspection = undefined;
135
+ return;
136
+ }
137
+ this.timer = setTimeout(() => this.ask(), VERDICT_SETTLE_MS);
138
+ }
139
+ async ask() {
140
+ const question = ++this.asked;
141
+ const source = this.source;
142
+ this.asking = true;
143
+ try {
144
+ const inspection = await inspectFigureDraft(source, this.figureId);
145
+ if (question !== this.asked)
146
+ return;
147
+ this.inspection = inspection;
148
+ this.failure = '';
149
+ }
150
+ catch (error) {
151
+ if (question !== this.asked)
152
+ return;
153
+ /* The server's reason as it gave it — the screen does not make one up. The last answer is dropped with it. */
154
+ this.inspection = undefined;
155
+ this.failure = error instanceof Error ? error.message : String(error);
156
+ }
157
+ finally {
158
+ if (question === this.asked)
159
+ this.asking = false;
160
+ }
161
+ }
162
+ render() {
163
+ return html `${this.renderCount()} ${this.renderGate()}`;
164
+ }
165
+ renderCount() {
166
+ const capacity = this.capacity;
167
+ return html `
168
+ <section>
169
+ <h3>${i18next.t('figure.label.maturity')}</h3>
170
+ <p lead>${i18next.t('figure.text.how-many-fit')}</p>
171
+ ${capacity
172
+ ? html `
173
+ <div count>
174
+ <span capacity>${capacity.instances.toLocaleString()}</span>
175
+ <span unit>${i18next.t('figure.text.instances-unit')}</span>
176
+ </div>
177
+ <p basis>
178
+ ${i18next.t('figure.text.bound-by-' + capacity.bound, {
179
+ per: capacity.per.toLocaleString(),
180
+ budget: capacity.budget.toLocaleString()
181
+ })}
182
+ <em>
183
+ ${capacity.bound === 'groups'
184
+ ? i18next.t('figure.text.budget-measured-on', { gpu: MEASURED.gpu, on: MEASURED.on })
185
+ : i18next.t('figure.text.budget-not-measured-yet')}
186
+ </em>
187
+ </p>
188
+ `
189
+ : html `<p quiet>${i18next.t('figure.text.maturity-blocked-no-parts')}</p>`}
190
+ </section>
191
+ `;
192
+ }
193
+ renderGate() {
194
+ const findings = this.inspection?.findings ?? [];
195
+ const blocking = findings.filter(finding => finding.blocking);
196
+ const advisory = findings.filter(finding => !finding.blocking);
197
+ return html `
198
+ <section>
199
+ <h3>${i18next.t('figure.label.release-verdict')}</h3>
200
+ ${this.failure
201
+ ? html `<p failed role="alert">${i18next.t('figure.text.verdict-not-received', { reason: this.failure })}</p>`
202
+ : !this.inspection
203
+ ? html `<p quiet>${i18next.t(this.asking ? 'figure.text.verdict-asking' : 'figure.text.verdict-waiting')}</p>`
204
+ : blocking.length
205
+ ? html `<p>${i18next.t('figure.text.cannot-release-now')}</p>`
206
+ : html `<p clear>${i18next.t('figure.text.nothing-blocks-release')}</p>`}
207
+ ${blocking.length
208
+ ? html `<ul gate>
209
+ <li head>${i18next.t('figure.text.must-fix-to-release')}</li>
210
+ ${blocking.map(finding => renderGateFinding(finding, true, this.actionsFor(finding.code)))}
211
+ </ul>`
212
+ : nothing}
213
+ ${advisory.length
214
+ ? html `<ul gate>
215
+ <li head quiet>${i18next.t('figure.text.does-not-block')}</li>
216
+ ${advisory.map(finding => renderGateFinding(finding, false))}
217
+ </ul>`
218
+ : nothing}
219
+ </section>
220
+ `;
221
+ }
222
+ /** The same way out the release panel offers for the same two findings — declare the space from the parts. */
223
+ actionsFor(code) {
224
+ if (code !== 'part-outside-occupancy' && code !== 'occupancy-undeclared')
225
+ return nothing;
226
+ /* A new figure with no parts is refused as undeclared too, but fitting needs parts to measure (seen 2026-09-24). */
227
+ if (!this.bodies)
228
+ return nothing;
229
+ return html `<button fit @click=${this.fit}>${i18next.t('figure.button.fit-base-to-parts')}</button>`;
230
+ }
231
+ };
232
+ __decorate([
233
+ property({ type: String }),
234
+ __metadata("design:type", String)
235
+ ], FigureV3Verdict.prototype, "source", void 0);
236
+ __decorate([
237
+ property({ type: String }),
238
+ __metadata("design:type", String)
239
+ ], FigureV3Verdict.prototype, "figureId", void 0);
240
+ __decorate([
241
+ property({ type: String }),
242
+ __metadata("design:type", String)
243
+ ], FigureV3Verdict.prototype, "figureType", void 0);
244
+ __decorate([
245
+ state(),
246
+ __metadata("design:type", Object)
247
+ ], FigureV3Verdict.prototype, "capacity", void 0);
248
+ __decorate([
249
+ state(),
250
+ __metadata("design:type", Object)
251
+ ], FigureV3Verdict.prototype, "bodies", void 0);
252
+ __decorate([
253
+ state(),
254
+ __metadata("design:type", Object)
255
+ ], FigureV3Verdict.prototype, "inspection", void 0);
256
+ __decorate([
257
+ state(),
258
+ __metadata("design:type", Object)
259
+ ], FigureV3Verdict.prototype, "failure", void 0);
260
+ __decorate([
261
+ state(),
262
+ __metadata("design:type", Object)
263
+ ], FigureV3Verdict.prototype, "asking", void 0);
264
+ FigureV3Verdict = __decorate([
265
+ customElement('figure-v3-verdict')
266
+ ], FigureV3Verdict);
267
+ export { FigureV3Verdict };
268
+ //# sourceMappingURL=figure-v3-verdict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-v3-verdict.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-verdict.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG1D,gHAAgH;AAChH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC;;;;;;;;;;;;;;GAcG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA3D;;QA2EL,0HAA0H;QACzG,WAAM,GAAG,CAAC,CAAA;QAEV,YAAO,GAAG,EA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,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;kBACtF;YACR,CAAC,CAAC,OAAO;UACT,QAAQ,CAAC,MAAM;YACf,CAAC,CAAC,IAAI,CAAA;+BACe,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;gBACtD,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;kBACxD;YACR,CAAC,CAAC,OAAO;;KAEd,CAAA;IACH,CAAC;IAED,8GAA8G;IACtG,UAAU,CAAC,IAAY;QAC7B,IAAI,IAAI,KAAK,wBAAwB,IAAI,IAAI,KAAK,sBAAsB;YAAE,OAAO,OAAO,CAAA;QACxF,oHAAoH;QACpH,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,OAAO,CAAA;QAChC,OAAO,IAAI,CAAA,sBAAsB,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC,WAAW,CAAA;IACtG,CAAC;;AA5I2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAgB;AAEf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AAEjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAoB;AAE9B;IAAhB,KAAK,EAAE;;iDAAkC;AAEzB;IAAhB,KAAK,EAAE;;+CAAmB;AACV;IAAhB,KAAK,EAAE;;mDAAsC;AAC7B;IAAhB,KAAK,EAAE;;gDAAqB;AACZ;IAAhB,KAAK,EAAE;;+CAAuB;AA/EpB,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAqN3B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { parseV3Asset, v3CostOf } from '@hatiolab/figure-model'\n\nimport { inspectFigureDraft } from '../graphql/index.js'\nimport type { FigureInspection } from '../types.js'\nimport { gateFindingStyles, renderGateFinding } from './gate-findings.js'\nimport { capacityFrom, MEASURED } from './scene-budget.js'\nimport type { FigureCapacity } from './scene-budget.js'\n\n/** How long an edit settles before the server is asked again. One question per pause, not one per keystroke. */\nexport const VERDICT_SETTLE_MS = 400\n\n/**\n * 판정 — the V3 modeller's verdict while editing (parity row ①).\n *\n * The V2 modeller shows, as the author edits, how many of the figure fit on one screen and what would stop it\n * being published. The V3 page showed neither: the author learned what blocked a release only after saving, in the\n * release panel. This tab answers both from the source being edited.\n *\n * The count is computed here, from `v3CostOf` and the same `capacityFrom` the catalogue cards use, so the tab and\n * the card cannot disagree. The findings are not: they come from the server's release door (`inspectFigureDraft`),\n * the same door and the same sentences as the release panel. A second judgement on the screen would say something\n * different the first time either changed.\n *\n * No grade. V2's grade measures V2 reuse; nothing measures it for V3, so the tab shows no letter rather than one\n * nothing computed.\n */\n@customElement('figure-v3-verdict')\nexport class FigureV3Verdict extends localize(i18next)(LitElement) {\n static styles = [\n gateFindingStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n gap: 14px;\n padding: 12px;\n overflow: auto;\n font-size: 0.76rem;\n color: var(--md-sys-color-on-surface);\n }\n section > h3 {\n margin: 0 0 6px 0;\n font-size: var(--ui-t-micro, 11px);\n font-weight: 700;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n }\n p {\n margin: 4px 0 0;\n }\n p[lead],\n p[basis],\n p[quiet] {\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n }\n div[count] {\n display: flex;\n align-items: baseline;\n gap: 6px;\n }\n span[capacity] {\n font-size: 2.1rem;\n font-weight: 800;\n line-height: 1;\n letter-spacing: -0.01em;\n color: var(--md-sys-color-primary);\n }\n span[unit] {\n font-size: 0.9rem;\n font-weight: 600;\n color: var(--md-sys-color-primary);\n }\n p[clear] {\n color: var(--md-sys-color-primary);\n font-weight: 600;\n }\n p[failed] {\n color: var(--md-sys-color-error);\n }\n button[fit] {\n align-self: flex-start;\n margin-top: 4px;\n padding: 4px 10px;\n font: inherit;\n color: var(--md-sys-color-on-secondary-container);\n background: var(--md-sys-color-secondary-container);\n border: none;\n border-radius: 999em;\n cursor: pointer;\n }\n `\n ]\n\n /** The source being edited, serialised. Every change of it is a new question. */\n @property({ type: String }) source?: string\n /** The saved row, if any — the server reads its type and last release from it. */\n @property({ type: String }) figureId?: string\n /** Changing the type changes the verdict (a temporary type is refused), so it is a reason to ask again. */\n @property({ type: String }) figureType?: string\n\n @state() private capacity?: FigureCapacity\n /** Bodies in the asset, drawn or hidden. With none there is nothing to fit the space to, so the button is not offered. */\n @state() private bodies = 0\n @state() private inspection?: FigureInspection\n @state() private failure = ''\n @state() private asking = false\n\n private timer?: ReturnType<typeof setTimeout>\n /** Answers can come back out of order; only the newest question's answer is shown. */\n private asked = 0\n\n disconnectedCallback() {\n clearTimeout(this.timer)\n super.disconnectedCallback()\n }\n\n updated(changes: Map<string, unknown>) {\n if (changes.has('source')) this.measure()\n if (changes.has('source') || changes.has('figureId') || changes.has('figureType')) this.schedule()\n }\n\n private measure() {\n let capacity: FigureCapacity | undefined\n let bodies = 0\n try {\n const cost = this.source ? v3CostOf(parseV3Asset(this.source)) : undefined\n capacity = cost ? capacityFrom(cost.groups, cost.triangles) : undefined\n bodies = cost ? cost.groups + cost.hidden : 0\n } catch {\n /* A source the format refuses has no count; the server's finding below says why. */\n capacity = undefined\n }\n this.capacity = capacity\n this.bodies = bodies\n this.dispatchEvent(new CustomEvent('capacity-changed', { detail: { instances: capacity?.instances } }))\n }\n\n private schedule() {\n clearTimeout(this.timer)\n if (!this.source) {\n this.inspection = undefined\n return\n }\n this.timer = setTimeout(() => this.ask(), VERDICT_SETTLE_MS)\n }\n\n private async ask() {\n const question = ++this.asked\n const source = this.source!\n this.asking = true\n try {\n const inspection = await inspectFigureDraft(source, this.figureId)\n if (question !== this.asked) return\n this.inspection = inspection\n this.failure = ''\n } catch (error) {\n if (question !== this.asked) return\n /* The server's reason as it gave it — the screen does not make one up. The last answer is dropped with it. */\n this.inspection = undefined\n this.failure = error instanceof Error ? error.message : String(error)\n } finally {\n if (question === this.asked) this.asking = false\n }\n }\n\n render() {\n return html`${this.renderCount()} ${this.renderGate()}`\n }\n\n private renderCount() {\n const capacity = this.capacity\n return html`\n <section>\n <h3>${i18next.t('figure.label.maturity')}</h3>\n <p lead>${i18next.t('figure.text.how-many-fit')}</p>\n ${capacity\n ? html`\n <div count>\n <span capacity>${capacity.instances.toLocaleString()}</span>\n <span unit>${i18next.t('figure.text.instances-unit')}</span>\n </div>\n <p basis>\n ${i18next.t('figure.text.bound-by-' + capacity.bound, {\n per: capacity.per.toLocaleString(),\n budget: capacity.budget.toLocaleString()\n })}\n <em>\n ${capacity.bound === 'groups'\n ? i18next.t('figure.text.budget-measured-on', { gpu: MEASURED.gpu, on: MEASURED.on })\n : i18next.t('figure.text.budget-not-measured-yet')}\n </em>\n </p>\n `\n : html`<p quiet>${i18next.t('figure.text.maturity-blocked-no-parts')}</p>`}\n </section>\n `\n }\n\n private renderGate() {\n const findings = this.inspection?.findings ?? []\n const blocking = findings.filter(finding => finding.blocking)\n const advisory = findings.filter(finding => !finding.blocking)\n return html`\n <section>\n <h3>${i18next.t('figure.label.release-verdict')}</h3>\n ${this.failure\n ? html`<p failed role=\"alert\">${i18next.t('figure.text.verdict-not-received', { reason: this.failure })}</p>`\n : !this.inspection\n ? html`<p quiet>${i18next.t(this.asking ? 'figure.text.verdict-asking' : 'figure.text.verdict-waiting')}</p>`\n : blocking.length\n ? html`<p>${i18next.t('figure.text.cannot-release-now')}</p>`\n : html`<p clear>${i18next.t('figure.text.nothing-blocks-release')}</p>`}\n ${blocking.length\n ? html`<ul gate>\n <li head>${i18next.t('figure.text.must-fix-to-release')}</li>\n ${blocking.map(finding => renderGateFinding(finding, true, this.actionsFor(finding.code)))}\n </ul>`\n : nothing}\n ${advisory.length\n ? html`<ul gate>\n <li head quiet>${i18next.t('figure.text.does-not-block')}</li>\n ${advisory.map(finding => renderGateFinding(finding, false))}\n </ul>`\n : nothing}\n </section>\n `\n }\n\n /** The same way out the release panel offers for the same two findings — declare the space from the parts. */\n private actionsFor(code: string) {\n if (code !== 'part-outside-occupancy' && code !== 'occupancy-undeclared') return nothing\n /* A new figure with no parts is refused as undeclared too, but fitting needs parts to measure (seen 2026-09-24). */\n if (!this.bodies) return nothing\n return html`<button fit @click=${this.fit}>${i18next.t('figure.button.fit-base-to-parts')}</button>`\n }\n\n private fit = () => {\n this.dispatchEvent(new CustomEvent('fit-base-to-parts', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import type { FigureGateFinding } from '../types.js';
3
+ /**
4
+ * One release-gate finding as a line on screen — the measured fact, where, why it matters, and what to change.
5
+ *
6
+ * Two places draw these: the release panel (`figure-history-panel`) and the V3 modeller's verdict while editing
7
+ * (`figure-v3-verdict`). They show the same findings from the same server door, so they draw them one way; a copy
8
+ * in each would drift the first time one of them is touched. The caller passes its own action buttons, because
9
+ * what can be done about a finding depends on the screen it is shown on.
10
+ */
11
+ export declare function renderGateFinding(finding: FigureGateFinding, blocking: boolean, actions?: unknown): TemplateResult;
12
+ export declare const gateFindingStyles: import("lit").CSSResult;
@@ -0,0 +1,102 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { i18next } from '@operato/i18n';
3
+ /**
4
+ * One release-gate finding as a line on screen — the measured fact, where, why it matters, and what to change.
5
+ *
6
+ * Two places draw these: the release panel (`figure-history-panel`) and the V3 modeller's verdict while editing
7
+ * (`figure-v3-verdict`). They show the same findings from the same server door, so they draw them one way; a copy
8
+ * in each would drift the first time one of them is touched. The caller passes its own action buttons, because
9
+ * what can be done about a finding depends on the screen it is shown on.
10
+ */
11
+ export function renderGateFinding(finding, blocking, actions = nothing) {
12
+ return html `
13
+ <li finding ?blocking=${blocking}>
14
+ <span msg>${finding.message}</span>
15
+ ${finding.at
16
+ ? html `
17
+ <details affected>
18
+ <summary>${i18next.t('figure.text.show-affected-parts')}</summary>
19
+ <code where>${finding.at}</code>
20
+ </details>
21
+ `
22
+ : nothing}
23
+ ${finding.why ? html `<span why-line>${finding.why}</span>` : nothing}
24
+ ${finding.how ? html `<span how-line><md-icon>build</md-icon>${finding.how}</span>` : nothing}
25
+ ${actions}
26
+ </li>
27
+ `;
28
+ }
29
+ export const gateFindingStyles = css `
30
+ ul[gate] {
31
+ margin: var(--spacing-small, 6px) 0 0;
32
+ padding: 0;
33
+ list-style: none;
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 3px;
37
+ }
38
+
39
+ li[head] {
40
+ font: var(--label-font, inherit);
41
+ font-size: 0.72rem;
42
+ color: var(--md-sys-color-error);
43
+ }
44
+
45
+ li[head][quiet] {
46
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
47
+ }
48
+
49
+ li[finding] {
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: flex-start;
53
+ gap: 3px;
54
+ padding: 3px 6px;
55
+ font-size: 0.72rem;
56
+ line-height: 1.5;
57
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
58
+ background-color: var(--md-sys-color-surface-container);
59
+ border-radius: 4px;
60
+ }
61
+
62
+ li[finding][blocking] {
63
+ color: var(--md-sys-color-on-error-container, var(--md-sys-color-on-surface));
64
+ background-color: var(--md-sys-color-error-container);
65
+ }
66
+
67
+ li[finding] code[where] {
68
+ font-family: var(--mono-font, monospace);
69
+ font-size: 0.68rem;
70
+ opacity: 0.85;
71
+ }
72
+
73
+ li[finding] details[affected] {
74
+ width: 100%;
75
+ color: inherit;
76
+ }
77
+
78
+ li[finding] details[affected] summary {
79
+ cursor: pointer;
80
+ font-weight: 600;
81
+ }
82
+
83
+ /* 왜 나쁜지는 곁글로 — 읽어야 하지만 잰 것보다 먼저 눈에 들 필요는 없다 */
84
+ li[finding] span[why-line] {
85
+ opacity: 0.8;
86
+ }
87
+
88
+ /* 무엇을 바꾸면 되나 — 이 줄이 실제로 사람이 할 일이다. 연장 표를 달아 눈에 걸리게 한다 */
89
+ li[finding] span[how-line] {
90
+ display: flex;
91
+ align-items: flex-start;
92
+ gap: 4px;
93
+ padding-top: 2px;
94
+ font-weight: 600;
95
+ }
96
+ li[finding] span[how-line] md-icon {
97
+ --md-icon-size: 13px;
98
+ flex: none;
99
+ margin-top: 1px;
100
+ }
101
+ `;
102
+ //# sourceMappingURL=gate-findings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate-findings.js","sourceRoot":"","sources":["../../client/modeller/gate-findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIvC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA0B,EAAE,QAAiB,EAAE,UAAmB,OAAO;IACzG,OAAO,IAAI,CAAA;4BACe,QAAQ;kBAClB,OAAO,CAAC,OAAO;QACzB,OAAO,CAAC,EAAE;QACV,CAAC,CAAC,IAAI,CAAA;;yBAEW,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;4BACzC,OAAO,CAAC,EAAE;;WAE3B;QACH,CAAC,CAAC,OAAO;QACT,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA,kBAAkB,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO;QAClE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA,0CAA0C,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO;QAC1F,OAAO;;GAEZ,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEnC,CAAA","sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit'\nimport { i18next } from '@operato/i18n'\n\nimport type { FigureGateFinding } from '../types.js'\n\n/**\n * One release-gate finding as a line on screen — the measured fact, where, why it matters, and what to change.\n *\n * Two places draw these: the release panel (`figure-history-panel`) and the V3 modeller's verdict while editing\n * (`figure-v3-verdict`). They show the same findings from the same server door, so they draw them one way; a copy\n * in each would drift the first time one of them is touched. The caller passes its own action buttons, because\n * what can be done about a finding depends on the screen it is shown on.\n */\nexport function renderGateFinding(finding: FigureGateFinding, blocking: boolean, actions: unknown = nothing): TemplateResult {\n return html`\n <li finding ?blocking=${blocking}>\n <span msg>${finding.message}</span>\n ${finding.at\n ? html`\n <details affected>\n <summary>${i18next.t('figure.text.show-affected-parts')}</summary>\n <code where>${finding.at}</code>\n </details>\n `\n : nothing}\n ${finding.why ? html`<span why-line>${finding.why}</span>` : nothing}\n ${finding.how ? html`<span how-line><md-icon>build</md-icon>${finding.how}</span>` : nothing}\n ${actions}\n </li>\n `\n}\n\nexport const gateFindingStyles = css`\n ul[gate] {\n margin: var(--spacing-small, 6px) 0 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n li[head] {\n font: var(--label-font, inherit);\n font-size: 0.72rem;\n color: var(--md-sys-color-error);\n }\n\n li[head][quiet] {\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n }\n\n li[finding] {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 3px;\n padding: 3px 6px;\n font-size: 0.72rem;\n line-height: 1.5;\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n background-color: var(--md-sys-color-surface-container);\n border-radius: 4px;\n }\n\n li[finding][blocking] {\n color: var(--md-sys-color-on-error-container, var(--md-sys-color-on-surface));\n background-color: var(--md-sys-color-error-container);\n }\n\n li[finding] code[where] {\n font-family: var(--mono-font, monospace);\n font-size: 0.68rem;\n opacity: 0.85;\n }\n\n li[finding] details[affected] {\n width: 100%;\n color: inherit;\n }\n\n li[finding] details[affected] summary {\n cursor: pointer;\n font-weight: 600;\n }\n\n /* 왜 나쁜지는 곁글로 — 읽어야 하지만 잰 것보다 먼저 눈에 들 필요는 없다 */\n li[finding] span[why-line] {\n opacity: 0.8;\n }\n\n /* 무엇을 바꾸면 되나 — 이 줄이 실제로 사람이 할 일이다. 연장 표를 달아 눈에 걸리게 한다 */\n li[finding] span[how-line] {\n display: flex;\n align-items: flex-start;\n gap: 4px;\n padding-top: 2px;\n font-weight: 600;\n }\n li[finding] span[how-line] md-icon {\n --md-icon-size: 13px;\n flex: none;\n margin-top: 1px;\n }\n`\n"]}
@@ -1,6 +1,8 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { LitElement, html, css } from 'lit';
3
3
  import { customElement, property, state } from 'lit/decorators.js';
4
+ import { captureV3Thumbnail } from './v3-thumbnail.js';
5
+ import { drawableV3Parts } from './v3-renderer.js';
4
6
  import './v3-canvas.js';
5
7
  const names = {
6
8
  position: '위치',
@@ -172,7 +174,14 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
172
174
  if (!this.session)
173
175
  return;
174
176
  try {
175
- const promise = this.session.save();
177
+ /*
178
+ The card's picture is taken before the save starts, from a canvas of its own at the card's size —
179
+ not from the one on screen, which stands wherever the author left it turned. A picture that cannot
180
+ be taken is not an error: the save goes on without it (see `v3-thumbnail.ts`).
181
+ */
182
+ const view = this.session.read();
183
+ const thumbnail = await captureV3Thumbnail(drawableV3Parts(view.geometry ?? []), view.palette ?? {});
184
+ const promise = this.session.save({ thumbnail });
176
185
  this.changed();
177
186
  await promise;
178
187
  this.error = '';
@@ -272,7 +281,7 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
272
281
  </div>
273
282
  </aside>
274
283
  <figure-v3-canvas
275
- .parts=${view.geometry}
284
+ .parts=${drawableV3Parts(view.geometry ?? [])}
276
285
  .palette=${view.palette ?? {}}
277
286
  .context=${view.context ?? ''}
278
287
  @part-selected=${(e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"v3-editor.js","sourceRoot":"","sources":["../../client/modeller/v3-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAuB,MAAM,KAAK,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGlE,OAAO,gBAAgB,CAAA;AAGvB,MAAM,KAAK,GAA2B;IACpC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,IAAI;IACT,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,QAAQ;CACrB,CAAA;AACD,SAAS,UAAU,CAAC,EAAU;IAC5B,OAAO,EAAE;SACN,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;SACrC,IAAI,CAAC,KAAK,CAAC,CAAA;AAChB,CAAC;AAED,kGAAkG;AAE3F,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QA8GuB,aAAQ,GAAG,CAAC,CAAA;QACvB,aAAQ,GAAG,EAAE,CAAA;QACb,UAAK,GAAG,EAAE,CAAA;QACnB,gBAAW,GAAkB,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c;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAyR1B","sourcesContent":["import { LitElement, html, css, type PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport type { V3InputChange, V3PrimitiveCreation } from '@hatiolab/figure-model'\nimport type { V3ProductSession } from './v3-product-session.js'\nimport './v3-canvas.js'\nimport type { FigureV3Canvas } from './v3-canvas.js'\n\nconst names: Record<string, string> = {\n position: '위치',\n rotation: '회전',\n size: '크기',\n dimension: '치수',\n width: '너비',\n height: '높이',\n depth: '깊이',\n radius: '반지름',\n length: '길이',\n round: '모서리 반경',\n left: '왼쪽',\n right: '오른쪽',\n bottom: '아랫면',\n top: '윗면',\n openingLeft: '개구부 왼쪽',\n openingRight: '개구부 오른쪽',\n openingTop: '개구부 윗면'\n}\nfunction fieldLabel(id: string) {\n return id\n .split('.')\n .map(p => names[p] ?? p.toUpperCase())\n .join(' · ')\n}\n\n/** Product editor surface. The injected session is shared by page persistence and AI commands. */\n@customElement('figure-v3-editor')\nexport class FigureV3Editor extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n min-height: 0;\n height: 100%;\n font: 13px sans-serif;\n color: var(--md-sys-color-on-surface, #22343f);\n }\n header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px;\n border-bottom: 1px solid #d4dde2;\n flex-wrap: wrap;\n }\n main {\n flex: 1;\n min-height: 0;\n display: grid;\n grid-template-columns: 180px minmax(180px, 1fr) 300px;\n }\n aside {\n padding: 12px;\n overflow: auto;\n background: var(--md-sys-color-surface, #fff);\n }\n aside:first-child {\n border-right: 1px solid #d4dde2;\n }\n aside:last-child {\n border-left: 1px solid #d4dde2;\n }\n h3 {\n font-size: var(--ui-t-body, 13px);\n margin: 22px 0 10px;\n }\n h3:first-child {\n margin-top: 0;\n }\n button,\n input,\n select {\n font: inherit;\n box-sizing: border-box;\n height: 34px;\n border: 1px solid #cbd5dc;\n border-radius: 6px;\n background: var(--md-sys-color-surface, #fff);\n color: inherit;\n padding: 0 8px;\n min-width: 0;\n }\n button {\n cursor: pointer;\n }\n button:disabled {\n opacity: 0.45;\n cursor: default;\n }\n button[aria-pressed='true'] {\n background: #d6edf0;\n border-color: #337783;\n }\n .parts {\n display: grid;\n gap: 6px;\n }\n .recipes {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 6px;\n }\n label {\n display: grid;\n grid-template-columns: 112px minmax(0, 1fr);\n align-items: center;\n gap: 8px;\n margin: 8px 0;\n }\n label span {\n overflow-wrap: anywhere;\n }\n .error {\n padding: 10px;\n background: #fff0eb;\n color: #922716;\n white-space: pre-wrap;\n }\n .status {\n margin-left: auto;\n }\n .hint {\n color: #637783;\n line-height: 1.5;\n }\n @media (max-width: 800px) {\n main {\n grid-template-columns: 140px minmax(160px, 1fr);\n }\n aside:last-child {\n grid-column: 1/-1;\n max-height: 260px;\n border-top: 1px solid #d4dde2;\n }\n }\n `\n @property({ attribute: false }) session?: V3ProductSession\n @property({ type: Number }) revision = 0\n @state() private selected = ''\n @state() private error = ''\n private lastContext: string | null = null\n protected willUpdate(_changed: PropertyValues) {\n const view = this.session?.read()\n if (view?.context !== this.lastContext) {\n this.lastContext = view?.context ?? null\n this.selected = ''\n this.error = ''\n }\n if (view && !view.geometry.some(g => g.id === this.selected)) this.selected = ''\n }\n private run(action: () => unknown) {\n try {\n action()\n this.error = ''\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n private changed() {\n this.requestUpdate()\n this.dispatchEvent(new CustomEvent('v3-changed', { bubbles: true, composed: true }))\n }\n private async save() {\n if (!this.session) return\n try {\n const promise = this.session.save()\n this.changed()\n await promise\n this.error = ''\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n } finally {\n this.changed()\n }\n }\n private add(kind: V3PrimitiveCreation['kind']) {\n if (!this.session) return\n this.run(() => {\n const ids = new Set(this.session!.read().geometry.map(g => g.id))\n let n = 1\n while (ids.has(`${kind}-${n}`)) n++\n const common = { id: `${kind}-${n}`, position: { x: 0, y: 50, z: 0 } }\n const part: V3PrimitiveCreation =\n kind === 'box'\n ? { ...common, kind, dimensions: { width: 100, height: 100, depth: 100 } }\n : kind === 'cylinder'\n ? { ...common, kind, dimensions: { radius: 50, length: 100 } }\n : kind === 'rounded-box'\n ? { ...common, kind, dimensions: { width: 100, height: 100, depth: 100, round: 10 } }\n : {\n ...common,\n position: { x: 0, y: 0, z: 0 },\n kind: 'portal',\n dimensions: {\n left: -100,\n right: 100,\n bottom: 0,\n top: 200,\n openingLeft: -70,\n openingRight: 70,\n openingTop: 170,\n depth: 30\n }\n }\n this.session!.add(part)\n this.selected = part.id\n })\n }\n private changeField(field: { id: string; unit: V3InputChange['unit']; role?: string }, event: Event) {\n const input = event.target as HTMLInputElement,\n value = input.valueAsNumber\n this.run(() =>\n this.session!.apply([\n { kind: field.role === 'state' ? 'set-state' : 'set-design', input: field.id, unit: field.unit, value }\n ])\n )\n // Rejected edits must also restore the displayed numeric value.\n input.value = String(this.session!.read().fields.find(i => i.id === field.id)!.value)\n }\n render() {\n const view = this.session?.read()\n if (!view) return html`<p>모델을 여는 중입니다.</p>`\n const unavailable = view.loading || !!view.error || view.saving || !view.context\n const part = view.geometry.find(g => g.id === this.selected)\n // Shared/root parameters remain available even when a part is selected.\n const own = view.fields.filter(i => this.selected && i.id.startsWith(this.selected + '.'))\n const common = view.fields.filter(i => !view.geometry.some(g => i.id.startsWith(g.id + '.')))\n const fields = this.selected ? [...own, ...common] : view.fields\n return html` <header>\n <strong>V3 모델링</strong>\n <button ?disabled=${unavailable || !view.canUndo} @click=${() => this.run(() => this.session!.undo())}>\n 실행 취소\n </button>\n <button ?disabled=${unavailable || !view.canRedo} @click=${() => this.run(() => this.session!.redo())}>\n 다시 실행\n </button>\n <button @click=${() => this.renderRoot.querySelector<FigureV3Canvas>('figure-v3-canvas')?.fit()}>\n 전체 보기\n </button>\n <span class=\"status\" role=\"status\"\n >${view.loading ? '불러오는 중' : view.saving ? '저장 중' : view.dirty || !view.id ? '저장 안 됨' : '저장됨'}</span\n >\n <button ?disabled=${unavailable || (!view.dirty && !!view.id)} @click=${this.save}>저장</button>\n </header>\n ${this.error || view.error ? html`<div role=\"alert\" class=\"error\">${this.error || view.error}</div>` : null}\n <main>\n <aside>\n <h3>도형 추가</h3>\n <div class=\"recipes\">\n ${(['box', 'cylinder', 'rounded-box', 'portal'] as const).map((kind, i) => html`<button ?disabled=${unavailable} @click=${() => this.add(kind)}>${['상자', '원기둥', '둥근 상자', '문틀'][i]}</button>`)}\n </div>\n <h3>부품 ${view.geometry.length}</h3>\n <div class=\"parts\">\n ${view.geometry.map(\n g =>\n html`<button\n aria-pressed=${g.id === this.selected}\n @click=${() => {\n this.selected = g.id\n }}\n >\n ${g.id}\n </button>`\n )}\n </div>\n </aside>\n <figure-v3-canvas\n .parts=${view.geometry}\n .palette=${view.palette ?? {}}\n .context=${view.context ?? ''}\n @part-selected=${(e: CustomEvent<string>) => {\n this.selected = e.detail\n }}\n @render-error=${(e: CustomEvent<Error>) => {\n this.error = e.detail.message\n }}\n ></figure-v3-canvas>\n <aside>\n <h3>${this.selected || '모델 입력'}</h3>\n ${fields.map(field => html`<label><span>${fieldLabel(field.id)} (${field.unit})${field.role === 'state' ? ' · 동작' : ''}</span><input aria-label=${field.id} type=\"number\" step=\"any\" .value=${String(field.value)} ?disabled=${unavailable} @change=${(e: Event) => this.changeField(field, e)} /></label>`)}\n ${\n part\n ? html`<h3>재질</h3>\n <label\n ><span>색 역할</span\n ><select\n .value=${part.material.token}\n ?disabled=${unavailable}\n @change=${(e: Event) => this.run(() => this.session!.edit({ kind: 'set-material', target: this.selected, material: { ...part.material, token: (e.target as HTMLSelectElement).value } }))}\n >\n ${Object.keys(view.palette ?? {}).map(token => html`<option value=${token}>${token === 'palette.primary' ? '기본 몸체' : token}</option>`)}\n </select></label\n >\n <p class=\"hint\">\n 도형과 위치를 결정하는 입력을 편집합니다. 다른 부품과 공유하는 입력은 함께 영향을 줄 수 있습니다.\n </p>`\n : null\n }\n ${\n view.bindings.length\n ? html`<h3>배치 연결점</h3>\n ${view.bindings.map(b => html`<p>${b.label} · ${b.role}</p>`)}`\n : null\n }\n </aside>\n </main>`\n }\n}\n"]}
1
+ {"version":3,"file":"v3-editor.js","sourceRoot":"","sources":["../../client/modeller/v3-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAuB,MAAM,KAAK,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,gBAAgB,CAAA;AAGvB,MAAM,KAAK,GAA2B;IACpC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,IAAI;IACT,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,QAAQ;CACrB,CAAA;AACD,SAAS,UAAU,CAAC,EAAU;IAC5B,OAAO,EAAE;SACN,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;SACrC,IAAI,CAAC,KAAK,CAAC,CAAA;AAChB,CAAC;AAED,kGAAkG;AAE3F,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ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AAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAA,MAAM,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE;YACnE,CAAC,CAAC,IACN;;cAEI,CAAA;IACZ,CAAC;;AAlL+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;+CAA2B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAa;AACvB;IAAhB,KAAK,EAAE;;gDAAsB;AACb;IAAhB,KAAK,EAAE;;6CAAmB;AAhHhB,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAgS1B","sourcesContent":["import { LitElement, html, css, type PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport type { V3InputChange, V3PrimitiveCreation } from '@hatiolab/figure-model'\nimport type { V3ProductSession } from './v3-product-session.js'\nimport { captureV3Thumbnail } from './v3-thumbnail.js'\nimport { drawableV3Parts } from './v3-renderer.js'\nimport './v3-canvas.js'\nimport type { FigureV3Canvas } from './v3-canvas.js'\n\nconst names: Record<string, string> = {\n position: '위치',\n rotation: '회전',\n size: '크기',\n dimension: '치수',\n width: '너비',\n height: '높이',\n depth: '깊이',\n radius: '반지름',\n length: '길이',\n round: '모서리 반경',\n left: '왼쪽',\n right: '오른쪽',\n bottom: '아랫면',\n top: '윗면',\n openingLeft: '개구부 왼쪽',\n openingRight: '개구부 오른쪽',\n openingTop: '개구부 윗면'\n}\nfunction fieldLabel(id: string) {\n return id\n .split('.')\n .map(p => names[p] ?? p.toUpperCase())\n .join(' · ')\n}\n\n/** Product editor surface. The injected session is shared by page persistence and AI commands. */\n@customElement('figure-v3-editor')\nexport class FigureV3Editor extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n min-height: 0;\n height: 100%;\n font: 13px sans-serif;\n color: var(--md-sys-color-on-surface, #22343f);\n }\n header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px;\n border-bottom: 1px solid #d4dde2;\n flex-wrap: wrap;\n }\n main {\n flex: 1;\n min-height: 0;\n display: grid;\n grid-template-columns: 180px minmax(180px, 1fr) 300px;\n }\n aside {\n padding: 12px;\n overflow: auto;\n background: var(--md-sys-color-surface, #fff);\n }\n aside:first-child {\n border-right: 1px solid #d4dde2;\n }\n aside:last-child {\n border-left: 1px solid #d4dde2;\n }\n h3 {\n font-size: var(--ui-t-body, 13px);\n margin: 22px 0 10px;\n }\n h3:first-child {\n margin-top: 0;\n }\n button,\n input,\n select {\n font: inherit;\n box-sizing: border-box;\n height: 34px;\n border: 1px solid #cbd5dc;\n border-radius: 6px;\n background: var(--md-sys-color-surface, #fff);\n color: inherit;\n padding: 0 8px;\n min-width: 0;\n }\n button {\n cursor: pointer;\n }\n button:disabled {\n opacity: 0.45;\n cursor: default;\n }\n button[aria-pressed='true'] {\n background: #d6edf0;\n border-color: #337783;\n }\n .parts {\n display: grid;\n gap: 6px;\n }\n .recipes {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 6px;\n }\n label {\n display: grid;\n grid-template-columns: 112px minmax(0, 1fr);\n align-items: center;\n gap: 8px;\n margin: 8px 0;\n }\n label span {\n overflow-wrap: anywhere;\n }\n .error {\n padding: 10px;\n background: #fff0eb;\n color: #922716;\n white-space: pre-wrap;\n }\n .status {\n margin-left: auto;\n }\n .hint {\n color: #637783;\n line-height: 1.5;\n }\n @media (max-width: 800px) {\n main {\n grid-template-columns: 140px minmax(160px, 1fr);\n }\n aside:last-child {\n grid-column: 1/-1;\n max-height: 260px;\n border-top: 1px solid #d4dde2;\n }\n }\n `\n @property({ attribute: false }) session?: V3ProductSession\n @property({ type: Number }) revision = 0\n @state() private selected = ''\n @state() private error = ''\n private lastContext: string | null = null\n protected willUpdate(_changed: PropertyValues) {\n const view = this.session?.read()\n if (view?.context !== this.lastContext) {\n this.lastContext = view?.context ?? null\n this.selected = ''\n this.error = ''\n }\n if (view && !view.geometry.some(g => g.id === this.selected)) this.selected = ''\n }\n private run(action: () => unknown) {\n try {\n action()\n this.error = ''\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n private changed() {\n this.requestUpdate()\n this.dispatchEvent(new CustomEvent('v3-changed', { bubbles: true, composed: true }))\n }\n private async save() {\n if (!this.session) return\n try {\n /*\n The card's picture is taken before the save starts, from a canvas of its own at the card's size —\n not from the one on screen, which stands wherever the author left it turned. A picture that cannot\n be taken is not an error: the save goes on without it (see `v3-thumbnail.ts`).\n */\n const view = this.session.read()\n const thumbnail = await captureV3Thumbnail(drawableV3Parts(view.geometry ?? []), view.palette ?? {})\n const promise = this.session.save({ thumbnail })\n this.changed()\n await promise\n this.error = ''\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n } finally {\n this.changed()\n }\n }\n private add(kind: V3PrimitiveCreation['kind']) {\n if (!this.session) return\n this.run(() => {\n const ids = new Set(this.session!.read().geometry.map(g => g.id))\n let n = 1\n while (ids.has(`${kind}-${n}`)) n++\n const common = { id: `${kind}-${n}`, position: { x: 0, y: 50, z: 0 } }\n const part: V3PrimitiveCreation =\n kind === 'box'\n ? { ...common, kind, dimensions: { width: 100, height: 100, depth: 100 } }\n : kind === 'cylinder'\n ? { ...common, kind, dimensions: { radius: 50, length: 100 } }\n : kind === 'rounded-box'\n ? { ...common, kind, dimensions: { width: 100, height: 100, depth: 100, round: 10 } }\n : {\n ...common,\n position: { x: 0, y: 0, z: 0 },\n kind: 'portal',\n dimensions: {\n left: -100,\n right: 100,\n bottom: 0,\n top: 200,\n openingLeft: -70,\n openingRight: 70,\n openingTop: 170,\n depth: 30\n }\n }\n this.session!.add(part)\n this.selected = part.id\n })\n }\n private changeField(field: { id: string; unit: V3InputChange['unit']; role?: string }, event: Event) {\n const input = event.target as HTMLInputElement,\n value = input.valueAsNumber\n this.run(() =>\n this.session!.apply([\n { kind: field.role === 'state' ? 'set-state' : 'set-design', input: field.id, unit: field.unit, value }\n ])\n )\n // Rejected edits must also restore the displayed numeric value.\n input.value = String(this.session!.read().fields.find(i => i.id === field.id)!.value)\n }\n render() {\n const view = this.session?.read()\n if (!view) return html`<p>모델을 여는 중입니다.</p>`\n const unavailable = view.loading || !!view.error || view.saving || !view.context\n const part = view.geometry.find(g => g.id === this.selected)\n // Shared/root parameters remain available even when a part is selected.\n const own = view.fields.filter(i => this.selected && i.id.startsWith(this.selected + '.'))\n const common = view.fields.filter(i => !view.geometry.some(g => i.id.startsWith(g.id + '.')))\n const fields = this.selected ? [...own, ...common] : view.fields\n return html` <header>\n <strong>V3 모델링</strong>\n <button ?disabled=${unavailable || !view.canUndo} @click=${() => this.run(() => this.session!.undo())}>\n 실행 취소\n </button>\n <button ?disabled=${unavailable || !view.canRedo} @click=${() => this.run(() => this.session!.redo())}>\n 다시 실행\n </button>\n <button @click=${() => this.renderRoot.querySelector<FigureV3Canvas>('figure-v3-canvas')?.fit()}>\n 전체 보기\n </button>\n <span class=\"status\" role=\"status\"\n >${view.loading ? '불러오는 중' : view.saving ? '저장 중' : view.dirty || !view.id ? '저장 안 됨' : '저장됨'}</span\n >\n <button ?disabled=${unavailable || (!view.dirty && !!view.id)} @click=${this.save}>저장</button>\n </header>\n ${this.error || view.error ? html`<div role=\"alert\" class=\"error\">${this.error || view.error}</div>` : null}\n <main>\n <aside>\n <h3>도형 추가</h3>\n <div class=\"recipes\">\n ${(['box', 'cylinder', 'rounded-box', 'portal'] as const).map((kind, i) => html`<button ?disabled=${unavailable} @click=${() => this.add(kind)}>${['상자', '원기둥', '둥근 상자', '문틀'][i]}</button>`)}\n </div>\n <h3>부품 ${view.geometry.length}</h3>\n <div class=\"parts\">\n ${view.geometry.map(\n g =>\n html`<button\n aria-pressed=${g.id === this.selected}\n @click=${() => {\n this.selected = g.id\n }}\n >\n ${g.id}\n </button>`\n )}\n </div>\n </aside>\n <figure-v3-canvas\n .parts=${drawableV3Parts(view.geometry ?? [])}\n .palette=${view.palette ?? {}}\n .context=${view.context ?? ''}\n @part-selected=${(e: CustomEvent<string>) => {\n this.selected = e.detail\n }}\n @render-error=${(e: CustomEvent<Error>) => {\n this.error = e.detail.message\n }}\n ></figure-v3-canvas>\n <aside>\n <h3>${this.selected || '모델 입력'}</h3>\n ${fields.map(field => html`<label><span>${fieldLabel(field.id)} (${field.unit})${field.role === 'state' ? ' · 동작' : ''}</span><input aria-label=${field.id} type=\"number\" step=\"any\" .value=${String(field.value)} ?disabled=${unavailable} @change=${(e: Event) => this.changeField(field, e)} /></label>`)}\n ${\n part\n ? html`<h3>재질</h3>\n <label\n ><span>색 역할</span\n ><select\n .value=${part.material.token}\n ?disabled=${unavailable}\n @change=${(e: Event) => this.run(() => this.session!.edit({ kind: 'set-material', target: this.selected, material: { ...part.material, token: (e.target as HTMLSelectElement).value } }))}\n >\n ${Object.keys(view.palette ?? {}).map(token => html`<option value=${token}>${token === 'palette.primary' ? '기본 몸체' : token}</option>`)}\n </select></label\n >\n <p class=\"hint\">\n 도형과 위치를 결정하는 입력을 편집합니다. 다른 부품과 공유하는 입력은 함께 영향을 줄 수 있습니다.\n </p>`\n : null\n }\n ${\n view.bindings.length\n ? html`<h3>배치 연결점</h3>\n ${view.bindings.map(b => html`<p>${b.label} · ${b.role}</p>`)}`\n : null\n }\n </aside>\n </main>`\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { type V3AuthoringAction } from '@hatiolab/figure-model';
2
+ /**
3
+ * 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.
4
+ *
5
+ * figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인
6
+ * (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인
7
+ * 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한
8
+ * 번에 만든다.
9
+ *
10
+ * 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시
11
+ * 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의
12
+ * 모델러 기본이 바닥이다.
13
+ */
14
+ export declare function occupancyFromParts(source: string): V3AuthoringAction;
@@ -0,0 +1,22 @@
1
+ import { parseV3Asset, proposeV3Occupancy } from '@hatiolab/figure-model';
2
+ /**
3
+ * 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.
4
+ *
5
+ * figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인
6
+ * (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인
7
+ * 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한
8
+ * 번에 만든다.
9
+ *
10
+ * 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시
11
+ * 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의
12
+ * 모델러 기본이 바닥이다.
13
+ */
14
+ export function occupancyFromParts(source) {
15
+ const asset = parseV3Asset(source);
16
+ return {
17
+ kind: 'declare-occupancy',
18
+ proposal: proposeV3Occupancy(asset, { over: 'range' }),
19
+ placement: asset.occupancy?.placement ?? 'floor'
20
+ };
21
+ }
22
+ //# sourceMappingURL=v3-occupancy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3-occupancy.js","sourceRoot":"","sources":["../../client/modeller/v3-occupancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAA0B,MAAM,wBAAwB,CAAA;AAEjG;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAA;IAClC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,kBAAkB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACtD,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,OAAO;KACjD,CAAA;AACH,CAAC","sourcesContent":["import { parseV3Asset, proposeV3Occupancy, type V3AuthoringAction } from '@hatiolab/figure-model'\n\n/**\n * 「부품에 맞추기」의 V3 짝 — 공간을 지금 부품에서 다시 선언하는 한 걸음.\n *\n * figure-model 은 이것을 둘로 나눠 두었다: 제안(`proposeV3Occupancy`)은 무엇이 선언될지를 보여 주고, 확인\n * (`declare-occupancy`)은 그 제안이 읽은 모양 그대로일 때만 받는다. 저작자가 누른 단추가 그 확인이다. 제안과 확인\n * 사이에 모델이 바뀌면 figure-model 이 `OCCUPANCY_STALE` 로 거절하므로, 여기서는 누른 순간의 원본으로 둘을 한\n * 번에 만든다.\n *\n * 범위는 움직임 전체다(`over: 'range'`). 쉬는 자세만 담으면 움직이는 부품이 선언한 공간을 넘어 발행 판정이 다시\n * 막는다. 배치 기준은 이미 선언된 것을 지키고, 처음 선언하는 도형은 바닥에 선다고 둔다 — 새로 만든 도형의\n * 모델러 기본이 바닥이다.\n */\nexport function occupancyFromParts(source: string): V3AuthoringAction {\n const asset = parseV3Asset(source)\n return {\n kind: 'declare-occupancy',\n proposal: proposeV3Occupancy(asset, { over: 'range' }),\n placement: asset.occupancy?.placement ?? 'floor'\n }\n}\n"]}