@things-factory/figure-ui 10.1.40 → 10.1.43

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 (53) hide show
  1. package/client/graphql/index.ts +1 -0
  2. package/client/modeller/figure-v3-material.ts +248 -0
  3. package/client/modeller/figure-v3-parts.ts +16 -1
  4. package/client/modeller/modeller-route.ts +25 -0
  5. package/client/modeller/v3-align.ts +84 -0
  6. package/client/modeller/v3-canvas.ts +140 -2
  7. package/client/modeller/v3-editor.ts +213 -39
  8. package/client/modeller/v3-gizmo.ts +80 -0
  9. package/client/pages/figure-list-page.ts +5 -3
  10. package/client/pages/figure-modeller-page.ts +9 -0
  11. package/client/types.ts +2 -0
  12. package/dist-client/graphql/index.js +1 -0
  13. package/dist-client/graphql/index.js.map +1 -1
  14. package/dist-client/modeller/figure-v3-material.d.ts +36 -0
  15. package/dist-client/modeller/figure-v3-material.js +249 -0
  16. package/dist-client/modeller/figure-v3-material.js.map +1 -0
  17. package/dist-client/modeller/figure-v3-parts.js +16 -1
  18. package/dist-client/modeller/figure-v3-parts.js.map +1 -1
  19. package/dist-client/modeller/modeller-route.d.ts +16 -0
  20. package/dist-client/modeller/modeller-route.js +27 -0
  21. package/dist-client/modeller/modeller-route.js.map +1 -0
  22. package/dist-client/modeller/v3-align.d.ts +26 -0
  23. package/dist-client/modeller/v3-align.js +65 -0
  24. package/dist-client/modeller/v3-align.js.map +1 -0
  25. package/dist-client/modeller/v3-canvas.d.ts +18 -0
  26. package/dist-client/modeller/v3-canvas.js +154 -2
  27. package/dist-client/modeller/v3-canvas.js.map +1 -1
  28. package/dist-client/modeller/v3-editor.d.ts +29 -0
  29. package/dist-client/modeller/v3-editor.js +225 -36
  30. package/dist-client/modeller/v3-editor.js.map +1 -1
  31. package/dist-client/modeller/v3-gizmo.d.ts +48 -0
  32. package/dist-client/modeller/v3-gizmo.js +40 -0
  33. package/dist-client/modeller/v3-gizmo.js.map +1 -0
  34. package/dist-client/pages/figure-list-page.d.ts +1 -0
  35. package/dist-client/pages/figure-list-page.js +5 -3
  36. package/dist-client/pages/figure-list-page.js.map +1 -1
  37. package/dist-client/pages/figure-modeller-page.js +9 -0
  38. package/dist-client/pages/figure-modeller-page.js.map +1 -1
  39. package/dist-client/route.d.ts +1 -1
  40. package/dist-client/tsconfig.tsbuildinfo +1 -1
  41. package/dist-client/types.d.ts +2 -0
  42. package/dist-client/types.js.map +1 -1
  43. package/package.json +4 -4
  44. package/test/modeller-route.test.ts +42 -0
  45. package/test/v3-align.test.ts +64 -0
  46. package/test/v3-gizmo.test.ts +97 -0
  47. package/test/v3-material.test.ts +68 -0
  48. package/test/v3-parts-wiring.test.ts +66 -0
  49. package/translations/en.json +7 -0
  50. package/translations/ja.json +7 -0
  51. package/translations/ko.json +7 -0
  52. package/translations/ms.json +7 -0
  53. package/translations/zh.json +7 -0
@@ -1,9 +1,14 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { LitElement, html, css } from 'lit';
3
+ import { i18next } from '@operato/i18n';
3
4
  import { customElement, property, state } from 'lit/decorators.js';
4
5
  import { captureV3Thumbnail } from './v3-thumbnail.js';
5
6
  import { drawableV3Parts } from './v3-renderer.js';
6
7
  import './v3-canvas.js';
8
+ import './figure-v3-parts.js';
9
+ import './figure-v3-material.js';
10
+ import { gizmoChanges, gizmoReachOf } from './v3-gizmo.js';
11
+ import { alignChanges, canMirror, mirrorChanges } from './v3-align.js';
7
12
  const names = {
8
13
  position: '위치',
9
14
  rotation: '회전',
@@ -36,6 +41,11 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
36
41
  this.revision = 0;
37
42
  this.selected = '';
38
43
  this.error = '';
44
+ /**
45
+ * Parts hidden on the workbench — the author's view while working, not the asset's visibility. Not saved, as in
46
+ * the V2 modeller: a part hidden here is still in the figure, still checked, still drawn on a board.
47
+ */
48
+ this.hiddenParts = new Set();
39
49
  this.lastContext = null;
40
50
  }
41
51
  static { this.styles = css `
@@ -72,8 +82,8 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
72
82
  overflow: auto;
73
83
  background: var(--md-sys-color-surface, #fff);
74
84
  }
75
- aside:first-child {
76
- border-right: 1px solid var(--md-sys-color-outline-variant);
85
+ figure-v3-parts {
86
+ min-height: 0;
77
87
  }
78
88
  aside:last-child {
79
89
  border-left: 1px solid var(--md-sys-color-outline-variant);
@@ -110,6 +120,30 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
110
120
  color: var(--md-sys-color-on-secondary-container);
111
121
  border-color: var(--md-sys-color-primary);
112
122
  }
123
+ label[name-field] {
124
+ margin: 0 0 8px;
125
+ }
126
+ label[name-field] input {
127
+ font-weight: 600;
128
+ }
129
+ div[tools] {
130
+ display: flex;
131
+ flex-wrap: wrap;
132
+ gap: 4px;
133
+ margin: 0 0 8px;
134
+ }
135
+ div[tools] button {
136
+ display: inline-flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ width: 34px;
140
+ padding: 0;
141
+ }
142
+ div[tools] md-icon {
143
+ font-size: 18px;
144
+ width: 18px;
145
+ height: 18px;
146
+ }
113
147
  .parts {
114
148
  display: grid;
115
149
  gap: 6px;
@@ -165,7 +199,7 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
165
199
  figure-v3-canvas {
166
200
  order: -1;
167
201
  }
168
- aside:first-child {
202
+ figure-v3-parts {
169
203
  border-right: none;
170
204
  border-top: 1px solid var(--md-sys-color-outline-variant);
171
205
  }
@@ -180,6 +214,7 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
180
214
  this.lastContext = view?.context ?? null;
181
215
  this.selected = '';
182
216
  this.error = '';
217
+ this.hiddenParts = new Set();
183
218
  }
184
219
  if (view && !view.geometry.some(g => g.id === this.selected))
185
220
  this.selected = '';
@@ -255,6 +290,150 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
255
290
  this.selected = part.id;
256
291
  });
257
292
  }
293
+ /**
294
+ * The list's own operations, as V3 part edits — each one step of the session's history. The copy and the moved
295
+ * part stay selected, as they do in the V2 list.
296
+ */
297
+ duplicatePart(id) {
298
+ this.run(() => {
299
+ const before = new Set(this.session.read().geometry.map(g => g.id));
300
+ this.session.edit({ kind: 'duplicate-part', target: id });
301
+ this.selected = this.session.read().geometry.find(g => !before.has(g.id))?.id ?? id;
302
+ });
303
+ }
304
+ movePart(id, to) {
305
+ this.run(() => this.session.edit({ kind: 'move-part', target: id, to }));
306
+ }
307
+ removePart(id) {
308
+ try {
309
+ this.session.edit({ kind: 'remove-part', target: id });
310
+ this.error = '';
311
+ if (this.selected === id)
312
+ this.selected = '';
313
+ this.changed();
314
+ }
315
+ catch (error) {
316
+ /* The refusal a person meets most: another part stands on this one or follows its size. Said in their words. */
317
+ this.error =
318
+ error?.code === 'PART_REFERENCED'
319
+ ? i18next.t('figure.text.part-is-referenced', { part: id })
320
+ : error instanceof Error
321
+ ? error.message
322
+ : String(error);
323
+ }
324
+ }
325
+ toggleHiddenPart(id) {
326
+ const next = new Set(this.hiddenParts);
327
+ if (next.has(id))
328
+ next.delete(id);
329
+ else
330
+ next.add(id);
331
+ this.hiddenParts = next;
332
+ }
333
+ /** What the gizmo may write for the selected part — read off the asset being edited. */
334
+ reachOf(id) {
335
+ const none = { translate: false, rotate: false, scale: false };
336
+ if (!id || !this.session)
337
+ return none;
338
+ try {
339
+ return gizmoReachOf(JSON.parse(this.session.source()), id);
340
+ }
341
+ catch {
342
+ return none;
343
+ }
344
+ }
345
+ /** A drag, written back as the part's own inputs — one step of the history, like typing the numbers. */
346
+ transformed(id, result) {
347
+ const view = this.session.read();
348
+ const sizes = Object.fromEntries(view.fields.map(field => [field.id, field.value]));
349
+ const changes = gizmoChanges(id, this.reachOf(id), result, sizes);
350
+ if (changes.length)
351
+ this.run(() => this.session.apply(changes));
352
+ else
353
+ this.requestUpdate();
354
+ }
355
+ /** 맞추기 — one tool, one step of the history, through the same inputs as the gizmo. */
356
+ align(tool) {
357
+ this.run(() => {
358
+ const asset = JSON.parse(this.session.source());
359
+ const changes = alignChanges(asset, this.selected, this.reachOf(this.selected), tool);
360
+ if (changes.length)
361
+ this.session.apply(changes);
362
+ });
363
+ }
364
+ /** A mirrored copy: duplicate, then place the copy on the other side — two steps, as the V2 list makes it. */
365
+ mirror(axis) {
366
+ this.run(() => {
367
+ const id = this.selected;
368
+ const before = new Set(this.session.read().geometry.map(g => g.id));
369
+ this.session.edit({ kind: 'duplicate-part', target: id });
370
+ const copy = this.session.read().geometry.find(g => !before.has(g.id))?.id;
371
+ if (!copy)
372
+ return;
373
+ this.session.apply(mirrorChanges(JSON.parse(this.session.source()), id, copy, axis));
374
+ this.selected = copy;
375
+ });
376
+ }
377
+ renderTools(unavailable) {
378
+ const reach = this.reachOf(this.selected);
379
+ if (!this.selected || !reach.translate)
380
+ return null;
381
+ let asset;
382
+ try {
383
+ asset = JSON.parse(this.session.source());
384
+ }
385
+ catch {
386
+ return null;
387
+ }
388
+ const tool = (name, icon, label, title) => html `<button ?disabled=${unavailable} aria-label=${i18next.t(label)} title=${i18next.t(title)} @click=${() => this.align(name)}>
389
+ <md-icon>${icon}</md-icon>
390
+ </button>`;
391
+ return html `<div tools title=${i18next.t('figure.text.tools-explained')}>
392
+ ${tool('centre-x', 'horizontal_distribute', 'figure.button.center-x', 'figure.text.center-on-x')}
393
+ ${tool('centre-z', 'vertical_align_center', 'figure.button.center-z', 'figure.text.center-on-z')}
394
+ ${tool('floor', 'vertical_align_bottom', 'figure.button.to-floor', 'figure.text.put-on-floor')}
395
+ ${['x', 'z'].map(axis => {
396
+ const able = canMirror(asset, this.selected, axis, reach);
397
+ return html `<button
398
+ ?disabled=${unavailable || !able}
399
+ aria-label=${i18next.t('figure.button.mirror-' + axis)}
400
+ title=${i18next.t(able ? 'figure.text.mirror-explained' : 'figure.text.mirror-would-overlap')}
401
+ @click=${() => this.mirror(axis)}
402
+ >
403
+ <md-icon>${axis === 'x' ? 'flip' : 'flip_camera_android'}</md-icon>
404
+ </button>`;
405
+ })}
406
+ ${tool('snap', 'grid_on', 'figure.button.snap', 'figure.text.snap-explained')}
407
+ </div>`;
408
+ }
409
+ /**
410
+ * A part's name — the V2 part name field. It renames every value the part owns, and what refers to them follows
411
+ * (figure-model's rename-part), as one step of the history.
412
+ */
413
+ renamePart(input) {
414
+ const name = input.value.trim();
415
+ const from = this.selected;
416
+ if (!name || name === from) {
417
+ input.value = from;
418
+ return;
419
+ }
420
+ try {
421
+ this.session.edit({ kind: 'rename-part', target: from, name });
422
+ this.selected = name;
423
+ this.error = '';
424
+ this.changed();
425
+ }
426
+ catch (error) {
427
+ input.value = from;
428
+ const code = error?.code;
429
+ this.error =
430
+ code === 'PART_ID'
431
+ ? i18next.t(/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name) ? 'figure.text.part-name-taken' : 'figure.text.part-name-invalid', { name })
432
+ : error instanceof Error
433
+ ? error.message
434
+ : String(error);
435
+ }
436
+ }
258
437
  changeField(field, event) {
259
438
  const input = event.target, value = input.valueAsNumber;
260
439
  this.run(() => this.session.apply([
@@ -291,27 +470,31 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
291
470
  </header>
292
471
  ${this.error || view.error ? html `<div role="alert" class="error">${this.error || view.error}</div>` : null}
293
472
  <main>
294
- <aside>
295
- <h3>도형 추가</h3>
296
- <div class="recipes">
297
- ${['box', 'cylinder', 'rounded-box', 'portal'].map((kind, i) => html `<button ?disabled=${unavailable} @click=${() => this.add(kind)}>${['상자', '원기둥', '둥근 상자', '문틀'][i]}</button>`)}
298
- </div>
299
- <h3>부품 ${view.geometry.length}</h3>
300
- <div class="parts">
301
- ${view.geometry.map(g => html `<button
302
- aria-pressed=${g.id === this.selected}
303
- @click=${() => {
304
- this.selected = g.id;
305
- }}
306
- >
307
- ${g.id}
308
- </button>`)}
309
- </div>
310
- </aside>
473
+ <figure-v3-parts
474
+ .parts=${view.geometry.map((g) => ({
475
+ id: g.id,
476
+ provider: g.shape?.provider ?? '',
477
+ hidden: this.hiddenParts.has(g.id),
478
+ invisible: g.visible === false
479
+ }))}
480
+ .selected=${this.selected}
481
+ ?locked=${unavailable}
482
+ @add-part=${(e) => this.add(e.detail.kind)}
483
+ @select-part=${(e) => (this.selected = e.detail.id)}
484
+ @toggle-part-hidden=${(e) => this.toggleHiddenPart(e.detail.id)}
485
+ @set-all-parts-hidden=${(e) => (this.hiddenParts = e.detail.hidden ? new Set(view.geometry.map(g => g.id)) : new Set())}
486
+ @move-part-up=${(e) => this.movePart(e.detail.id, e.detail.to)}
487
+ @move-part-down=${(e) => this.movePart(e.detail.id, e.detail.to)}
488
+ @duplicate-part=${(e) => this.duplicatePart(e.detail.id)}
489
+ @remove-part=${(e) => this.removePart(e.detail.id)}
490
+ ></figure-v3-parts>
311
491
  <figure-v3-canvas
312
- .parts=${drawableV3Parts(view.geometry ?? [])}
492
+ .parts=${drawableV3Parts(view.geometry ?? []).filter(body => !this.hiddenParts.has(body.id))}
313
493
  .palette=${view.palette ?? {}}
314
494
  .context=${view.context ?? ''}
495
+ .selected=${this.selected}
496
+ .reach=${unavailable ? { translate: false, rotate: false, scale: false } : this.reachOf(this.selected)}
497
+ @part-transformed=${(e) => this.transformed(e.detail.id, e.detail.result)}
315
498
  @part-selected=${(e) => {
316
499
  this.selected = e.detail;
317
500
  }}
@@ -320,23 +503,25 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
320
503
  }}
321
504
  ></figure-v3-canvas>
322
505
  <aside>
323
- <h3>${this.selected || '모델 입력'}</h3>
506
+ ${this.selected && part
507
+ ? html `<label name-field
508
+ ><span>${i18next.t('figure.label.name')}</span
509
+ ><input
510
+ aria-label=${i18next.t('figure.label.name')}
511
+ .value=${this.selected}
512
+ ?disabled=${unavailable}
513
+ @change=${(e) => this.renamePart(e.target)}
514
+ /></label>`
515
+ : html `<h3>${this.selected || '모델 입력'}</h3>`}
516
+ ${this.renderTools(unavailable)}
324
517
  ${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) => this.changeField(field, e)} /></label>`)}
325
518
  ${part
326
- ? html `<h3>재질</h3>
327
- <label
328
- ><span>색 역할</span
329
- ><select
330
- .value=${part.material.token}
331
- ?disabled=${unavailable}
332
- @change=${(e) => this.run(() => this.session.edit({ kind: 'set-material', target: this.selected, material: { ...part.material, token: e.target.value } }))}
333
- >
334
- ${Object.keys(view.palette ?? {}).map(token => html `<option value=${token}>${token === 'palette.primary' ? '기본 몸체' : token}</option>`)}
335
- </select></label
336
- >
337
- <p class="hint">
338
- 도형과 위치를 결정하는 입력을 편집합니다. 다른 부품과 공유하는 입력은 함께 영향을 줄 수 있습니다.
339
- </p>`
519
+ ? html `<figure-v3-material
520
+ .body=${part}
521
+ .palette=${view.palette ?? {}}
522
+ ?locked=${unavailable}
523
+ @v3-part-edit=${(e) => this.run(() => this.session.edit(e.detail.edit))}
524
+ ></figure-v3-material>`
340
525
  : null}
341
526
  ${view.bindings.length
342
527
  ? html `<h3>배치 연결점</h3>
@@ -362,6 +547,10 @@ __decorate([
362
547
  state(),
363
548
  __metadata("design:type", Object)
364
549
  ], FigureV3Editor.prototype, "error", void 0);
550
+ __decorate([
551
+ state(),
552
+ __metadata("design:type", Object)
553
+ ], FigureV3Editor.prototype, "hiddenParts", void 0);
365
554
  FigureV3Editor = __decorate([
366
555
  customElement('figure-v3-editor')
367
556
  ], FigureV3Editor);
@@ -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,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB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C;GACrB,cAAc,CA4T1B","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 /*\n The editor folds by the width it is given, not the window's. The rail (208 open, 56 closed) and the page's\n 320 side take their share first, so a window rule was wrong whenever either was there: at 945 with the rail\n open the editor had 417 and still drew its 660 of columns, over the side (UX ruling, 2026-09-24).\n */\n container-type: inline-size;\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 var(--md-sys-color-outline-variant);\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 var(--md-sys-color-outline-variant);\n }\n aside:last-child {\n border-left: 1px solid var(--md-sys-color-outline-variant);\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 var(--md-sys-color-outline-variant);\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: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n border-color: var(--md-sys-color-primary);\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: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n white-space: pre-wrap;\n }\n .status {\n margin-left: auto;\n }\n .hint {\n color: var(--md-sys-color-on-surface-variant);\n line-height: 1.5;\n }\n /* 660 and over: parts | canvas | inputs. Below that the sum of the columns' least widths no longer fits. */\n @container (max-width: 659px) {\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-left: none;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n }\n /* Under 420: one column. The canvas first — seeing what is being made comes before the lists — and main scrolls. */\n @container (max-width: 419px) {\n main {\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(240px, 45%);\n grid-auto-rows: auto;\n overflow-y: auto;\n }\n figure-v3-canvas {\n order: -1;\n }\n aside:first-child {\n border-right: none;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n aside:last-child {\n max-height: none;\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"]}
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,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAA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a,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAoe1B","sourcesContent":["import { LitElement, html, css, type PropertyValues } from 'lit'\nimport { i18next } from '@operato/i18n'\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 './figure-v3-parts.js'\nimport './figure-v3-material.js'\nimport { gizmoChanges, gizmoReachOf, type GizmoReach, type GizmoResult } from './v3-gizmo.js'\nimport { alignChanges, canMirror, mirrorChanges, type AlignTool } from './v3-align.js'\nimport type { V3PartRow } from './figure-v3-parts.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 /*\n The editor folds by the width it is given, not the window's. The rail (208 open, 56 closed) and the page's\n 320 side take their share first, so a window rule was wrong whenever either was there: at 945 with the rail\n open the editor had 417 and still drew its 660 of columns, over the side (UX ruling, 2026-09-24).\n */\n container-type: inline-size;\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 var(--md-sys-color-outline-variant);\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 figure-v3-parts {\n min-height: 0;\n }\n aside:last-child {\n border-left: 1px solid var(--md-sys-color-outline-variant);\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 var(--md-sys-color-outline-variant);\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: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n border-color: var(--md-sys-color-primary);\n }\n label[name-field] {\n margin: 0 0 8px;\n }\n label[name-field] input {\n font-weight: 600;\n }\n div[tools] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n margin: 0 0 8px;\n }\n div[tools] button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 34px;\n padding: 0;\n }\n div[tools] md-icon {\n font-size: 18px;\n width: 18px;\n height: 18px;\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: var(--md-sys-color-error-container);\n color: var(--md-sys-color-on-error-container);\n white-space: pre-wrap;\n }\n .status {\n margin-left: auto;\n }\n .hint {\n color: var(--md-sys-color-on-surface-variant);\n line-height: 1.5;\n }\n /* 660 and over: parts | canvas | inputs. Below that the sum of the columns' least widths no longer fits. */\n @container (max-width: 659px) {\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-left: none;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n }\n /* Under 420: one column. The canvas first — seeing what is being made comes before the lists — and main scrolls. */\n @container (max-width: 419px) {\n main {\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(240px, 45%);\n grid-auto-rows: auto;\n overflow-y: auto;\n }\n figure-v3-canvas {\n order: -1;\n }\n figure-v3-parts {\n border-right: none;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n aside:last-child {\n max-height: none;\n }\n }\n `\n @property({ attribute: false }) session?: V3ProductSession\n @property({ type: Number }) revision = 0\n @state() private selected = ''\n @state() private error = ''\n /**\n * Parts hidden on the workbench — the author's view while working, not the asset's visibility. Not saved, as in\n * the V2 modeller: a part hidden here is still in the figure, still checked, still drawn on a board.\n */\n @state() private hiddenParts = new Set<string>()\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 this.hiddenParts = new Set()\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 /**\n * The list's own operations, as V3 part edits — each one step of the session's history. The copy and the moved\n * part stay selected, as they do in the V2 list.\n */\n private duplicatePart(id: string) {\n this.run(() => {\n const before = new Set(this.session!.read().geometry.map(g => g.id))\n this.session!.edit({ kind: 'duplicate-part', target: id })\n this.selected = this.session!.read().geometry.find(g => !before.has(g.id))?.id ?? id\n })\n }\n private movePart(id: string, to: number) {\n this.run(() => this.session!.edit({ kind: 'move-part', target: id, to }))\n }\n private removePart(id: string) {\n try {\n this.session!.edit({ kind: 'remove-part', target: id })\n this.error = ''\n if (this.selected === id) this.selected = ''\n this.changed()\n } catch (error) {\n /* The refusal a person meets most: another part stands on this one or follows its size. Said in their words. */\n this.error =\n (error as { code?: string })?.code === 'PART_REFERENCED'\n ? i18next.t('figure.text.part-is-referenced', { part: id })\n : error instanceof Error\n ? error.message\n : String(error)\n }\n }\n private toggleHiddenPart(id: string) {\n const next = new Set(this.hiddenParts)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n this.hiddenParts = next\n }\n /** What the gizmo may write for the selected part — read off the asset being edited. */\n private reachOf(id: string): GizmoReach {\n const none = { translate: false, rotate: false, scale: false }\n if (!id || !this.session) return none\n try {\n return gizmoReachOf(JSON.parse(this.session.source()), id)\n } catch {\n return none\n }\n }\n /** A drag, written back as the part's own inputs — one step of the history, like typing the numbers. */\n private transformed(id: string, result: GizmoResult) {\n const view = this.session!.read()\n const sizes = Object.fromEntries(view.fields.map(field => [field.id, field.value as number]))\n const changes = gizmoChanges(id, this.reachOf(id), result, sizes)\n if (changes.length) this.run(() => this.session!.apply(changes))\n else this.requestUpdate()\n }\n /** 맞추기 — one tool, one step of the history, through the same inputs as the gizmo. */\n private align(tool: AlignTool) {\n this.run(() => {\n const asset = JSON.parse(this.session!.source())\n const changes = alignChanges(asset, this.selected, this.reachOf(this.selected), tool)\n if (changes.length) this.session!.apply(changes)\n })\n }\n /** A mirrored copy: duplicate, then place the copy on the other side — two steps, as the V2 list makes it. */\n private mirror(axis: 'x' | 'z') {\n this.run(() => {\n const id = this.selected\n const before = new Set(this.session!.read().geometry.map(g => g.id))\n this.session!.edit({ kind: 'duplicate-part', target: id })\n const copy = this.session!.read().geometry.find(g => !before.has(g.id))?.id\n if (!copy) return\n this.session!.apply(mirrorChanges(JSON.parse(this.session!.source()), id, copy, axis))\n this.selected = copy\n })\n }\n private renderTools(unavailable: boolean) {\n const reach = this.reachOf(this.selected)\n if (!this.selected || !reach.translate) return null\n let asset: unknown\n try {\n asset = JSON.parse(this.session!.source())\n } catch {\n return null\n }\n const tool = (name: AlignTool, icon: string, label: string, title: string) =>\n html`<button ?disabled=${unavailable} aria-label=${i18next.t(label)} title=${i18next.t(title)} @click=${() => this.align(name)}>\n <md-icon>${icon}</md-icon>\n </button>`\n return html`<div tools title=${i18next.t('figure.text.tools-explained')}>\n ${tool('centre-x', 'horizontal_distribute', 'figure.button.center-x', 'figure.text.center-on-x')}\n ${tool('centre-z', 'vertical_align_center', 'figure.button.center-z', 'figure.text.center-on-z')}\n ${tool('floor', 'vertical_align_bottom', 'figure.button.to-floor', 'figure.text.put-on-floor')}\n ${(['x', 'z'] as const).map(axis => {\n const able = canMirror(asset as never, this.selected, axis, reach)\n return html`<button\n ?disabled=${unavailable || !able}\n aria-label=${i18next.t('figure.button.mirror-' + axis)}\n title=${i18next.t(able ? 'figure.text.mirror-explained' : 'figure.text.mirror-would-overlap')}\n @click=${() => this.mirror(axis)}\n >\n <md-icon>${axis === 'x' ? 'flip' : 'flip_camera_android'}</md-icon>\n </button>`\n })}\n ${tool('snap', 'grid_on', 'figure.button.snap', 'figure.text.snap-explained')}\n </div>`\n }\n /**\n * A part's name — the V2 part name field. It renames every value the part owns, and what refers to them follows\n * (figure-model's rename-part), as one step of the history.\n */\n private renamePart(input: HTMLInputElement) {\n const name = input.value.trim()\n const from = this.selected\n if (!name || name === from) {\n input.value = from\n return\n }\n try {\n this.session!.edit({ kind: 'rename-part', target: from, name })\n this.selected = name\n this.error = ''\n this.changed()\n } catch (error) {\n input.value = from\n const code = (error as { code?: string })?.code\n this.error =\n code === 'PART_ID'\n ? i18next.t(/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name) ? 'figure.text.part-name-taken' : 'figure.text.part-name-invalid', { name })\n : error instanceof Error\n ? error.message\n : String(error)\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 <figure-v3-parts\n .parts=${view.geometry.map(\n (g): V3PartRow => ({\n id: g.id,\n provider: (g as { shape?: { provider?: string } }).shape?.provider ?? '',\n hidden: this.hiddenParts.has(g.id),\n invisible: (g as { visible?: boolean }).visible === false\n })\n )}\n .selected=${this.selected}\n ?locked=${unavailable}\n @add-part=${(e: CustomEvent) => this.add(e.detail.kind)}\n @select-part=${(e: CustomEvent) => (this.selected = e.detail.id)}\n @toggle-part-hidden=${(e: CustomEvent) => this.toggleHiddenPart(e.detail.id)}\n @set-all-parts-hidden=${(e: CustomEvent) =>\n (this.hiddenParts = e.detail.hidden ? new Set(view.geometry.map(g => g.id)) : new Set())}\n @move-part-up=${(e: CustomEvent) => this.movePart(e.detail.id, e.detail.to)}\n @move-part-down=${(e: CustomEvent) => this.movePart(e.detail.id, e.detail.to)}\n @duplicate-part=${(e: CustomEvent) => this.duplicatePart(e.detail.id)}\n @remove-part=${(e: CustomEvent) => this.removePart(e.detail.id)}\n ></figure-v3-parts>\n <figure-v3-canvas\n .parts=${drawableV3Parts(view.geometry ?? []).filter(body => !this.hiddenParts.has((body as { id: string }).id))}\n .palette=${view.palette ?? {}}\n .context=${view.context ?? ''}\n .selected=${this.selected}\n .reach=${unavailable ? { translate: false, rotate: false, scale: false } : this.reachOf(this.selected)}\n @part-transformed=${(e: CustomEvent) => this.transformed(e.detail.id, e.detail.result)}\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 ${this.selected && part\n ? html`<label name-field\n ><span>${i18next.t('figure.label.name')}</span\n ><input\n aria-label=${i18next.t('figure.label.name')}\n .value=${this.selected}\n ?disabled=${unavailable}\n @change=${(e: Event) => this.renamePart(e.target as HTMLInputElement)}\n /></label>`\n : html`<h3>${this.selected || '모델 입력'}</h3>`}\n ${this.renderTools(unavailable)}\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`<figure-v3-material\n .body=${part}\n .palette=${view.palette ?? {}}\n ?locked=${unavailable}\n @v3-part-edit=${(e: CustomEvent) => this.run(() => this.session!.edit(e.detail.edit))}\n ></figure-v3-material>`\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,48 @@
1
+ import type { V3InputChange } from '@hatiolab/figure-model';
2
+ /**
3
+ * What the gizmo may write for a part — the V2 gizmo's move · turn · size, on a V3 asset (parity row ③).
4
+ *
5
+ * A drag can only be written back where the part is placed by its own numbers. A part the create commands made is:
6
+ * its pose is `rigid@1` into the asset frame from `<part>.position.*` and `<part>.rotation.*`, and a box's shape
7
+ * (`box-shape@1` or `rounded-box@1`) takes its width, height and depth from inputs of its own — `<part>.size.*` from
8
+ * `addV3Box`, `<part>.dimension.*` from the editor's shape palette. A part fastened to another, following an instance size or made by the
9
+ * converter from expressions has no such numbers; the gizmo does not offer what it could not write back, rather
10
+ * than move something the next evaluation would put back.
11
+ */
12
+ export interface GizmoReach {
13
+ translate: boolean;
14
+ rotate: boolean;
15
+ scale: boolean;
16
+ /** The inputs sizing the part along X, Y and Z, when it can be sized. */
17
+ sizes?: [string, string, string];
18
+ }
19
+ interface Node {
20
+ id: string;
21
+ op: string;
22
+ args: string[];
23
+ params?: Record<string, unknown>;
24
+ }
25
+ interface AssetLike {
26
+ document: {
27
+ model: {
28
+ nodes: Node[];
29
+ inputs: Array<{
30
+ id: string;
31
+ role?: string;
32
+ }>;
33
+ };
34
+ };
35
+ }
36
+ export declare function gizmoReachOf(asset: AssetLike, part: string): GizmoReach;
37
+ /** Where a drag left the part, in the asset frame: millimetres, degrees and per-axis scale. */
38
+ export interface GizmoResult {
39
+ position?: [number, number, number];
40
+ rotation?: [number, number, number];
41
+ scale?: [number, number, number];
42
+ }
43
+ /**
44
+ * The input changes a drag makes — one list, applied as one step. Millimetres to the millimetre and degrees to a
45
+ * tenth, as the V2 gizmo rounds (a drag otherwise stores 722.4180046035418 mm). A size never goes below 1 mm.
46
+ */
47
+ export declare function gizmoChanges(part: string, reach: GizmoReach, result: GizmoResult, sizes: Record<string, number>): V3InputChange[];
48
+ export {};
@@ -0,0 +1,40 @@
1
+ /** Shapes whose first three arguments are the extent along X, Y and Z. */
2
+ const BOXES = new Set(['box-shape@1', 'rounded-box@1']);
3
+ const AXES = ['x', 'y', 'z'];
4
+ export function gizmoReachOf(asset, part) {
5
+ const { nodes, inputs } = asset.document.model;
6
+ const design = new Set(inputs.filter(input => input.role === 'design').map(input => input.id));
7
+ const own = (name) => AXES.map(axis => `${part}.${name}.${axis}`);
8
+ const allDesign = (ids) => ids.every(id => design.has(id));
9
+ const pose = nodes.find(node => node.id === `${part}.pose`);
10
+ const placed = nodes.find(node => node.id === part && node.op === 'place@1');
11
+ const posed = !!pose && pose.op === 'rigid@1' && pose.params?.to === 'asset' && placed?.args[1] === `${part}.poseValue`;
12
+ const shape = nodes.find(node => node.id === `${part}.shape`);
13
+ const extent = shape && BOXES.has(shape.op) ? shape.args.slice(0, 3) : [];
14
+ const sizes = extent.length === 3 && extent.every(id => id.startsWith(`${part}.`) && design.has(id)) ? extent : undefined;
15
+ return {
16
+ translate: posed && allDesign(own('position')) && own('position').every((id, i) => pose.args[i] === id),
17
+ rotate: posed && allDesign(own('rotation')) && own('rotation').every((id, i) => pose.args[3 + i] === id),
18
+ scale: !!sizes,
19
+ ...(sizes ? { sizes } : {})
20
+ };
21
+ }
22
+ /**
23
+ * The input changes a drag makes — one list, applied as one step. Millimetres to the millimetre and degrees to a
24
+ * tenth, as the V2 gizmo rounds (a drag otherwise stores 722.4180046035418 mm). A size never goes below 1 mm.
25
+ */
26
+ export function gizmoChanges(part, reach, result, sizes) {
27
+ const changes = [];
28
+ const put = (input, unit, value) => changes.push({ kind: 'set-design', input, unit, value });
29
+ if (result.position && reach.translate)
30
+ AXES.forEach((axis, i) => put(`${part}.position.${axis}`, 'mm', Math.round(result.position[i])));
31
+ if (result.rotation && reach.rotate)
32
+ AXES.forEach((axis, i) => put(`${part}.rotation.${axis}`, 'deg', Math.round(result.rotation[i] * 10) / 10));
33
+ if (result.scale && reach.scale && reach.sizes)
34
+ reach.sizes.forEach((id, i) => {
35
+ if (sizes[id] !== undefined)
36
+ put(id, 'mm', Math.max(1, Math.round(sizes[id] * result.scale[i])));
37
+ });
38
+ return changes;
39
+ }
40
+ //# sourceMappingURL=v3-gizmo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3-gizmo.js","sourceRoot":"","sources":["../../client/modeller/v3-gizmo.ts"],"names":[],"mappings":"AAoBA,0EAA0E;AAC1E,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC,CAAA;AAYv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O,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import type { V3InputChange } from '@hatiolab/figure-model'\n\n/**\n * What the gizmo may write for a part — the V2 gizmo's move · turn · size, on a V3 asset (parity row ③).\n *\n * A drag can only be written back where the part is placed by its own numbers. A part the create commands made is:\n * its pose is `rigid@1` into the asset frame from `<part>.position.*` and `<part>.rotation.*`, and a box's shape\n * (`box-shape@1` or `rounded-box@1`) takes its width, height and depth from inputs of its own — `<part>.size.*` from\n * `addV3Box`, `<part>.dimension.*` from the editor's shape palette. A part fastened to another, following an instance size or made by the\n * converter from expressions has no such numbers; the gizmo does not offer what it could not write back, rather\n * than move something the next evaluation would put back.\n */\nexport interface GizmoReach {\n translate: boolean\n rotate: boolean\n scale: boolean\n /** The inputs sizing the part along X, Y and Z, when it can be sized. */\n sizes?: [string, string, string]\n}\n\n/** Shapes whose first three arguments are the extent along X, Y and Z. */\nconst BOXES = new Set(['box-shape@1', 'rounded-box@1'])\n\ninterface Node {\n id: string\n op: string\n args: string[]\n params?: Record<string, unknown>\n}\ninterface AssetLike {\n document: { model: { nodes: Node[]; inputs: Array<{ id: string; role?: string }> } }\n}\n\nconst AXES = ['x', 'y', 'z'] as const\n\nexport function gizmoReachOf(asset: AssetLike, part: string): GizmoReach {\n const { nodes, inputs } = asset.document.model\n const design = new Set(inputs.filter(input => input.role === 'design').map(input => input.id))\n const own = (name: string) => AXES.map(axis => `${part}.${name}.${axis}`)\n const allDesign = (ids: string[]) => ids.every(id => design.has(id))\n const pose = nodes.find(node => node.id === `${part}.pose`)\n const placed = nodes.find(node => node.id === part && node.op === 'place@1')\n const posed = !!pose && pose.op === 'rigid@1' && pose.params?.to === 'asset' && placed?.args[1] === `${part}.poseValue`\n const shape = nodes.find(node => node.id === `${part}.shape`)\n const extent = shape && BOXES.has(shape.op) ? shape.args.slice(0, 3) : []\n const sizes =\n extent.length === 3 && extent.every(id => id.startsWith(`${part}.`) && design.has(id)) ? (extent as [string, string, string]) : undefined\n return {\n translate: posed && allDesign(own('position')) && own('position').every((id, i) => pose!.args[i] === id),\n rotate: posed && allDesign(own('rotation')) && own('rotation').every((id, i) => pose!.args[3 + i] === id),\n scale: !!sizes,\n ...(sizes ? { sizes } : {})\n }\n}\n\n/** Where a drag left the part, in the asset frame: millimetres, degrees and per-axis scale. */\nexport interface GizmoResult {\n position?: [number, number, number]\n rotation?: [number, number, number]\n scale?: [number, number, number]\n}\n\n/**\n * The input changes a drag makes — one list, applied as one step. Millimetres to the millimetre and degrees to a\n * tenth, as the V2 gizmo rounds (a drag otherwise stores 722.4180046035418 mm). A size never goes below 1 mm.\n */\nexport function gizmoChanges(part: string, reach: GizmoReach, result: GizmoResult, sizes: Record<string, number>): V3InputChange[] {\n const changes: V3InputChange[] = []\n const put = (input: string, unit: V3InputChange['unit'], value: number) =>\n changes.push({ kind: 'set-design', input, unit, value } as V3InputChange)\n if (result.position && reach.translate)\n AXES.forEach((axis, i) => put(`${part}.position.${axis}`, 'mm', Math.round(result.position![i]!)))\n if (result.rotation && reach.rotate)\n AXES.forEach((axis, i) => put(`${part}.rotation.${axis}`, 'deg', Math.round(result.rotation![i]! * 10) / 10))\n if (result.scale && reach.scale && reach.sizes)\n reach.sizes.forEach((id, i) => {\n if (sizes[id] !== undefined) put(id, 'mm', Math.max(1, Math.round(sizes[id]! * result.scale![i]!)))\n })\n return changes\n}\n"]}
@@ -68,6 +68,7 @@ export declare class FigureListPage extends FigureListPageBase {
68
68
  total: number;
69
69
  records: Figure[];
70
70
  }>;
71
+ /** The modeller that can edit this figure, by its format; a new figure starts in V3 (`modeller-route.ts`). */
71
72
  private openModeller;
72
73
  /** `remove` 는 HTMLElement 의 메서드다 — 가리면 조용한 결함이 된다. */
73
74
  private removeFigure;
@@ -11,6 +11,7 @@ import { navigate, PageView } from '@operato/shell';
11
11
  import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
12
12
  import { capacityFrom } from '../modeller/scene-budget.js';
13
13
  import { deleteFigure, fetchFigureList } from '../graphql/index.js';
14
+ import { modellerPathOf } from '../modeller/modeller-route.js';
14
15
  /**
15
16
  * 이 값 아래면 점수를 색으로 눈에 띄게 한다.
16
17
  *
@@ -502,7 +503,7 @@ let FigureListPage = class FigureListPage extends FigureListPageBase {
502
503
  handlers: {
503
504
  click: (_columns, _data, _column, record) => {
504
505
  if (record?.id) {
505
- this.openModeller(record.id);
506
+ this.openModeller(record);
506
507
  }
507
508
  }
508
509
  }
@@ -549,8 +550,9 @@ let FigureListPage = class FigureListPage extends FigureListPageBase {
549
550
  const { items, total } = await fetchFigureList({ page, limit, filters, sortings });
550
551
  return { total: total || 0, records: items || [] };
551
552
  }
552
- openModeller(id) {
553
- navigate(id ? `figure-modeller/${id}` : 'figure-modeller');
553
+ /** The modeller that can edit this figure, by its format; a new figure starts in V3 (`modeller-route.ts`). */
554
+ openModeller(figure) {
555
+ navigate(modellerPathOf(figure));
554
556
  }
555
557
  /** `remove` 는 HTMLElement 의 메서드다 — 가리면 조용한 결함이 된다. */
556
558
  async removeFigure(figure) {