@things-factory/figure-ui 10.1.5 → 10.1.6

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 (75) hide show
  1. package/client/graphql/index.ts +35 -3
  2. package/client/modeller/figure-ask.ts +5 -5
  3. package/client/modeller/figure-canvas.ts +1 -1
  4. package/client/modeller/figure-capabilities.ts +372 -0
  5. package/client/modeller/figure-history-panel.ts +171 -18
  6. package/client/modeller/figure-inspector.ts +392 -76
  7. package/client/modeller/figure-parts.ts +15 -15
  8. package/client/modeller/figure-preview.ts +2 -2
  9. package/client/modeller/figure-report.ts +102 -37
  10. package/client/modeller/figure-settings.ts +20 -20
  11. package/client/modeller/figure-side.ts +37 -9
  12. package/client/modeller/figure-source.test.ts +15 -1
  13. package/client/modeller/figure-source.ts +31 -15
  14. package/client/modeller/figure-thumbnail.ts +49 -4
  15. package/client/modeller/maturity.ts +10 -10
  16. package/client/pages/figure-list-page.ts +152 -66
  17. package/client/pages/figure-modeller-page.ts +260 -43
  18. package/client/types.ts +25 -0
  19. package/client/viewparts/figure-thumb.ts +172 -0
  20. package/dist-client/graphql/index.d.ts +8 -1
  21. package/dist-client/graphql/index.js +32 -3
  22. package/dist-client/graphql/index.js.map +1 -1
  23. package/dist-client/modeller/figure-ask.js +5 -5
  24. package/dist-client/modeller/figure-ask.js.map +1 -1
  25. package/dist-client/modeller/figure-canvas.js +1 -1
  26. package/dist-client/modeller/figure-canvas.js.map +1 -1
  27. package/dist-client/modeller/figure-capabilities.d.ts +42 -0
  28. package/dist-client/modeller/figure-capabilities.js +344 -0
  29. package/dist-client/modeller/figure-capabilities.js.map +1 -0
  30. package/dist-client/modeller/figure-history-panel.d.ts +15 -1
  31. package/dist-client/modeller/figure-history-panel.js +165 -18
  32. package/dist-client/modeller/figure-history-panel.js.map +1 -1
  33. package/dist-client/modeller/figure-inspector.d.ts +84 -0
  34. package/dist-client/modeller/figure-inspector.js +379 -75
  35. package/dist-client/modeller/figure-inspector.js.map +1 -1
  36. package/dist-client/modeller/figure-parts.js +15 -15
  37. package/dist-client/modeller/figure-parts.js.map +1 -1
  38. package/dist-client/modeller/figure-preview.js +2 -2
  39. package/dist-client/modeller/figure-preview.js.map +1 -1
  40. package/dist-client/modeller/figure-report.d.ts +18 -1
  41. package/dist-client/modeller/figure-report.js +105 -37
  42. package/dist-client/modeller/figure-report.js.map +1 -1
  43. package/dist-client/modeller/figure-settings.js +19 -19
  44. package/dist-client/modeller/figure-settings.js.map +1 -1
  45. package/dist-client/modeller/figure-side.d.ts +1 -0
  46. package/dist-client/modeller/figure-side.js +36 -8
  47. package/dist-client/modeller/figure-side.js.map +1 -1
  48. package/dist-client/modeller/figure-source.d.ts +15 -8
  49. package/dist-client/modeller/figure-source.js +16 -7
  50. package/dist-client/modeller/figure-source.js.map +1 -1
  51. package/dist-client/modeller/figure-thumbnail.js +40 -4
  52. package/dist-client/modeller/figure-thumbnail.js.map +1 -1
  53. package/dist-client/modeller/maturity.js +10 -10
  54. package/dist-client/modeller/maturity.js.map +1 -1
  55. package/dist-client/pages/figure-list-page.d.ts +1 -4
  56. package/dist-client/pages/figure-list-page.js +150 -63
  57. package/dist-client/pages/figure-list-page.js.map +1 -1
  58. package/dist-client/pages/figure-modeller-page.d.ts +45 -0
  59. package/dist-client/pages/figure-modeller-page.js +259 -43
  60. package/dist-client/pages/figure-modeller-page.js.map +1 -1
  61. package/dist-client/tsconfig.tsbuildinfo +1 -1
  62. package/dist-client/types.d.ts +23 -0
  63. package/dist-client/types.js.map +1 -1
  64. package/dist-client/viewparts/figure-thumb.d.ts +29 -0
  65. package/dist-client/viewparts/figure-thumb.js +168 -0
  66. package/dist-client/viewparts/figure-thumb.js.map +1 -0
  67. package/dist-server/tsconfig.tsbuildinfo +1 -1
  68. package/package.json +7 -5
  69. package/test/i18n-prefix-guard.test.ts +129 -0
  70. package/test/korean-register-guard.test.ts +83 -0
  71. package/translations/en.json +307 -264
  72. package/translations/ja.json +275 -264
  73. package/translations/ko.json +307 -264
  74. package/translations/ms.json +275 -264
  75. package/translations/zh.json +275 -264
@@ -1,10 +1,12 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@material/web/icon/icon.js';
3
3
  import { css, html, LitElement, nothing, svg } from 'lit';
4
- import { customElement, property } from 'lit/decorators.js';
4
+ import { customElement, property, state } from 'lit/decorators.js';
5
+ import { live } from 'lit/directives/live.js';
5
6
  import { i18next, localize } from '@operato/i18n';
6
7
  import { ScrollbarStyles } from '@operato/styles';
7
8
  import { EXTRUDE_PRIMITIVES, MATERIAL_PRESETS, PRIMITIVE_KINDS, SEGMENTED_PRIMITIVES, SEGMENT_PRESETS, SIZING_RULES, trianglesOf } from '@hatiolab/figure-model';
9
+ import { ANCHOR_RULES, PART_ROLES, REPEAT_LIMIT, anchorOfPart, repeatPlanOfPart } from '@hatiolab/figure-model';
8
10
  import { activePalette } from '@hatiolab/things-scene';
9
11
  import { partToFigure, partFromFigure } from './figure-source.js';
10
12
  import { canMirror } from './part-edits.js';
@@ -54,6 +56,8 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
54
56
  /** 보드. 위치를 보드 중심 기준으로 바꾸려면 이것이 있어야 한다. */
55
57
  /** 도형의 표시 이름. 정본은 저작면이 들고, 여기서는 보여 주고 바꾼다(`figure-rename` 으로 알린다). */
56
58
  this.figureName = '';
59
+ /** 펴 둔 도움말. 부품을 바꿔도 유지된다 — 매번 다시 펴게 하지 않는다. */
60
+ this.opened = new Set();
57
61
  /** 보드 위의 부품들. 씬 모델 그대로다. */
58
62
  this.parts = [];
59
63
  this.selected = -1;
@@ -82,12 +86,21 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
82
86
  font-size: 0.76rem;
83
87
  }
84
88
 
89
+ /*
90
+ ── 자리를 아끼는 판 ──────────────────────────────────────────────────────
91
+ 속성은 앞으로 더 늘어난다(능력 · 포트 · 애니메이션 · 기준정보). 지금 여백을 그대로 두면
92
+ 그것들이 들어올 자리가 없다. 절 여백을 6/10 으로, 제목 아래를 4px 로 줄였다 — 글자 크기와
93
+ 칸 높이는 건드리지 않는다(작게 만드는 것이 아니라 **빈 곳을 줄이는 것**이다).
94
+ */
85
95
  section {
86
- padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);
96
+ padding: 6px 10px;
87
97
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
88
98
  }
89
99
  h3 {
90
- margin: 0 0 6px 0;
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 4px;
103
+ margin: 0 0 4px 0;
91
104
  font-size: var(--ui-t-micro, 11px);
92
105
  font-weight: 700;
93
106
  letter-spacing: 0.04em;
@@ -96,12 +109,47 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
96
109
  }
97
110
 
98
111
  label {
99
- display: block;
112
+ display: flex;
113
+ align-items: center;
114
+ gap: 3px;
100
115
  margin-bottom: 2px;
101
116
  font-size: 0.68rem;
102
117
  color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
103
118
  }
104
119
 
120
+ /*
121
+ 도움말 물음표. **글자 줄을 하나 먹지 않는다** — 라벨·제목 줄의 남는 폭에 얹힌다.
122
+ 아이콘만 두고 테두리를 안 두는 이유는 이것이 누를 것이라기보다 「더 있다」는 표시라서다.
123
+ */
124
+ button[help] {
125
+ display: inline-flex;
126
+ align-items: center;
127
+ padding: 0;
128
+ margin: 0;
129
+ color: var(--md-sys-color-outline);
130
+ background: none;
131
+ border: none;
132
+ cursor: pointer;
133
+ }
134
+ button[help] md-icon {
135
+ --md-icon-size: 13px;
136
+ font-size: 13px;
137
+ }
138
+ button[help]:hover,
139
+ button[help][aria-expanded='true'] {
140
+ color: var(--md-sys-color-primary);
141
+ }
142
+
143
+ /* 편 도움말. 라벨 아래 한 칸 들여 붙인다 — 무엇에 딸린 말인지 보이게. */
144
+ p[hint] {
145
+ margin: 2px 0 4px 0;
146
+ padding-left: 6px;
147
+ font-size: 0.68rem;
148
+ line-height: 1.5;
149
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
150
+ border-left: 2px solid var(--md-sys-color-outline-variant);
151
+ }
152
+
105
153
  input,
106
154
  select {
107
155
  width: 100%;
@@ -169,7 +217,8 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
169
217
  div[field] + div[field],
170
218
  div[triple] + div[field],
171
219
  div[field] + div[triple] {
172
- margin-top: 7px;
220
+ /* 칸 사이 7 → 5. 칸 자체는 그대로 두고 사이만 좁힌다. */
221
+ margin-top: 5px;
173
222
  }
174
223
 
175
224
  /*
@@ -484,18 +533,126 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
484
533
  return html `
485
534
  ${this.renderFigure()}
486
535
  <section>
487
- <h3>${i18next.t('label.properties')}</h3>
488
- <p quiet>${i18next.t('text.select-a-part-to-edit')}</p>
536
+ <h3>${i18next.t('figure.label.properties')}</h3>
537
+ <p quiet>${i18next.t('figure.text.select-a-part-to-edit')}</p>
489
538
  </section>
490
539
  `;
491
540
  }
492
541
  // 여기부터는 사용자 용어다 — X·Y·Z, 위치는 부품 중심, 회전은 도(degree).
493
542
  const shown = partToFigure(part, this.board);
543
+ /*
544
+ 역할을 먼저 묻는다.
545
+
546
+ 자리(slot)로 지정한 부품은 **그려지지 않는다.** 그 사실을 모른 채 재질부터 고르면 안 쓰일
547
+ 색을 고르게 된다. 그리고 자리는 도형이 능력을 질 때만 뜻이 있으므로, 능력이 없으면 이
548
+ 묶음은 아예 나오지 않는다 — 해 둬도 아무 일도 안 일어나는 칸을 보여 주지 않는다.
549
+ */
494
550
  return html `
495
- ${this.renderFigure()} ${this.renderIdentity(shown)} ${this.renderPlacement(shown)}
496
- ${this.renderShape(shown)} ${this.renderMaterial(shown)} ${this.renderBehaviour(shown)}
551
+ ${this.renderFigure()} ${this.renderIdentity(shown)} ${this.renderRole(shown)}
552
+ ${this.renderPlacement(shown)} ${this.renderShape(shown)} ${this.renderMaterial(shown)}
553
+ ${this.renderBehaviour(shown)}
497
554
  `;
498
555
  }
556
+ /**
557
+ * ── 이 부품이 능력에서 맡는 자리 ────────────────────────────────────────────
558
+ *
559
+ * 「능력」 탭이 도형 전체가 무엇을 하는지 정하고, 어느 부품이 그것을 받쳐 주는지는 여기서
560
+ * 정한다. **부품을 고치는 곳이 한 군데여야** 하기 때문이다 — 목록을 따로 두면 같은 부품을
561
+ * 두 화면에서 고치게 되고, 저작자는 어느 쪽이 이기는지 매번 생각해야 한다.
562
+ *
563
+ * 칸 수는 `repeat` 가 있으면 받지 않는다. 반복하는 자리의 칸 수는 **인스턴스 크기**가 정한다 —
564
+ * 컨베이어가 길어지면 실을 자리가 늘어나는 것이 그것이고, 여기 적은 값은 안 쓰인다.
565
+ */
566
+ renderRole(part) {
567
+ if (!this.board?.capabilities?.length)
568
+ return nothing;
569
+ const roles = part.capability?.roles ?? [];
570
+ const repeats = part.sizing === 'repeat' && !!part.repeat;
571
+ return html `
572
+ <section>
573
+ <h3>${i18next.t('figure.label.role-in-capability')}${this.help('figure.text.anchors-are-not-drawn')}</h3>
574
+
575
+ ${PART_ROLES.map(one => html `
576
+ <label toggle>
577
+ <input
578
+ type="checkbox"
579
+ .checked=${live(roles.includes(one))}
580
+ @change=${(e) => this.toggleRole(one, e.target.checked)}
581
+ />
582
+ ${i18next.t('figure.label.role-' + one)}
583
+ </label>
584
+ `)}
585
+ ${roles.length === 0 ? html `<p quiet>${i18next.t('figure.text.role-none-means-drawn')}</p>` : nothing}
586
+
587
+ ${roles.includes('slot')
588
+ ? html `
589
+ <div field>
590
+ <label>${i18next.t('figure.label.accepts')}${this.help('figure.text.accepts-explained')}</label>
591
+ <input
592
+ .value=${(part.capability?.accepts ?? []).join(', ')}
593
+ placeholder=${i18next.t('figure.text.accepts-anything')}
594
+ @change=${(e) => this.setAccepts(e.target.value)}
595
+ />
596
+ </div>
597
+ <div field>
598
+ <label>${i18next.t('figure.label.slot-capacity')}</label>
599
+ ${repeats
600
+ ? html `<p quiet>${i18next.t('figure.text.capacity-from-repeat')}</p>`
601
+ : this.number('', part.capability?.capacity ?? 1, value => this.setCapacity(value), 1)}
602
+ </div>
603
+ `
604
+ : nothing}
605
+ </section>
606
+ `;
607
+ }
608
+ /**
609
+ * 역할 하나를 켜고 끈다.
610
+ *
611
+ * **여럿을 함께 맡을 수 있다.** AGV 의 상판은 물건을 놓는 자리이면서 그 자리로 물건이
612
+ * 들어오고 나간다. 그래서 하나를 고르는 선택 상자가 아니라 확인 상자다.
613
+ *
614
+ * 마지막 역할을 끄면 `capability` 를 통째로 지운다. 빈 배열을 남기면 형식이 오류로 보고,
615
+ * 저작자가 보기에는 아무 역할도 없는 평범한 부품인데 발행이 막힌다.
616
+ */
617
+ toggleRole(role, on) {
618
+ this.change(part => {
619
+ const roles = (part.capability?.roles ?? []).filter(one => one !== role);
620
+ if (on)
621
+ roles.push(role);
622
+ if (roles.length === 0) {
623
+ const { capability, ...rest } = part;
624
+ return rest;
625
+ }
626
+ // 형식이 적은 순서를 지킨다 — 켠 순서대로 두면 같은 뜻이 다른 값으로 저장된다.
627
+ const ordered = PART_ROLES.filter(one => roles.includes(one));
628
+ return { ...part, capability: { ...part.capability, roles: ordered } };
629
+ });
630
+ }
631
+ setAccepts(raw) {
632
+ const accepts = raw
633
+ .split(',')
634
+ .map(one => one.trim())
635
+ .filter(one => one.length > 0);
636
+ this.change(part => {
637
+ const spec = { ...part.capability, roles: part.capability?.roles ?? ['slot'] };
638
+ // 빈 목록은 제한하지 않는다는 뜻이다. 빈 배열을 저장하면 아무것도 못 받는 것으로 읽힌다.
639
+ if (accepts.length > 0)
640
+ spec.accepts = accepts;
641
+ else
642
+ delete spec.accepts;
643
+ return { ...part, capability: spec };
644
+ });
645
+ }
646
+ setCapacity(value) {
647
+ this.change(part => {
648
+ const spec = { ...part.capability, roles: part.capability?.roles ?? ['slot'] };
649
+ if (Number.isFinite(value) && value >= 1)
650
+ spec.capacity = Math.floor(value);
651
+ else
652
+ delete spec.capacity;
653
+ return { ...part, capability: spec };
654
+ });
655
+ }
499
656
  /**
500
657
  * 도형 자체 — 이름과 타입.
501
658
  *
@@ -512,12 +669,12 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
512
669
  renderFigure() {
513
670
  return html `
514
671
  <section>
515
- <h3>${i18next.t('label.figure')}</h3>
672
+ <h3>${i18next.t('figure.label.figure')}</h3>
516
673
  <div field>
517
- <label>${i18next.t('label.name')}</label>
674
+ <label>${i18next.t('figure.label.name')}</label>
518
675
  <input
519
676
  .value=${this.figureName}
520
- placeholder=${i18next.t('text.figure-display-name')}
677
+ placeholder=${i18next.t('figure.text.figure-display-name')}
521
678
  @change=${(e) => this.dispatchEvent(new CustomEvent('figure-rename', {
522
679
  detail: { name: e.target.value },
523
680
  bubbles: true,
@@ -526,8 +683,8 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
526
683
  />
527
684
  </div>
528
685
  <div field>
529
- <label>${i18next.t('label.type')}</label>
530
- <code fixed title=${i18next.t('text.type-name-cannot-change')}>
686
+ <label>${i18next.t('figure.label.figure-type')}${this.help('figure.text.type-name-cannot-change')}</label>
687
+ <code fixed title=${i18next.t('figure.text.type-name-cannot-change')}>
531
688
  <md-icon>lock</md-icon>${this.board?.figureType ?? ''}
532
689
  </code>
533
690
  </div>
@@ -535,28 +692,26 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
535
692
  왜 못 고치는지 **적어 둔다.** 전에는 tooltip 에만 있었고, 그러면 눌러 보고 안 되는 것을
536
693
  알게 된다 — 화면이 안 되는 이유를 말하지 않으면 사용자가 자기 실수라고 생각한다.
537
694
  -->
538
- <p quiet>${i18next.t('text.type-name-cannot-change')}</p>
539
695
  </section>
540
696
  `;
541
697
  }
542
698
  renderIdentity(part) {
543
699
  return html `
544
700
  <section>
545
- <h3>${i18next.t('label.part')}</h3>
701
+ <h3>${i18next.t('figure.label.part')}</h3>
546
702
  <div field>
547
- <label>${i18next.t('label.name')}</label>
703
+ <label>${i18next.t('figure.label.name')}${this.help('figure.text.renaming-a-part-breaks-bindings')}</label>
548
704
  <input
549
705
  .value=${part.name}
550
706
  @change=${(e) => this.put({ name: e.target.value })}
551
707
  />
552
- <p warn>${i18next.t('text.renaming-a-part-breaks-bindings')}</p>
553
708
  </div>
554
709
  <div field>
555
- <label>${i18next.t('label.shape')}</label>
710
+ <label>${i18next.t('figure.label.shape')}</label>
556
711
  <select @change=${(e) => this.changePrimitive(e.target.value)}>
557
712
  ${PRIMITIVE_KINDS.map(kind => html `
558
713
  <option value=${kind} ?selected=${kind === part.primitive}>
559
- ${i18next.t('label.primitive-' + kind)}
714
+ ${i18next.t('figure.label.primitive-' + kind)}
560
715
  </option>
561
716
  `)}
562
717
  </select>
@@ -569,31 +724,31 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
569
724
  const rotation = t.rotation ?? {};
570
725
  return html `
571
726
  <section>
572
- <h3>${i18next.t('label.placement')}</h3>
727
+ <h3>${i18next.t('figure.label.placement')}</h3>
573
728
 
574
- <label>${i18next.t('label.position')}</label>
729
+ <label>${i18next.t('figure.label.part-position')}</label>
575
730
  <div triple>
576
731
  ${['x', 'y', 'z'].map(axis => this.number(axis.toUpperCase(), t.position[axis], value => this.putTransform({ position: { ...t.position, [axis]: value } })))}
577
732
  </div>
578
733
 
579
734
  <div field>
580
- <label>${i18next.t('label.size')}</label>
735
+ <label>${i18next.t('figure.label.part-size')}</label>
581
736
  <div triple>
582
737
  ${['x', 'y', 'z'].map(axis => this.number(axis.toUpperCase(), t.size[axis], value => this.putTransform({ size: { ...t.size, [axis]: value } }), 1))}
583
738
  </div>
584
739
  </div>
585
740
 
586
741
  <div field>
587
- <label>${i18next.t('label.tools')}</label>
742
+ <label>${i18next.t('figure.label.tools')}</label>
588
743
  <div tools>
589
- <button title=${i18next.t('text.center-on-x')} @click=${() => this.ask('center', 'x')}>
590
- ${i18next.t('button.center-x')}
744
+ <button title=${i18next.t('figure.text.center-on-x')} @click=${() => this.ask('center', 'x')}>
745
+ ${i18next.t('figure.button.center-x')}
591
746
  </button>
592
- <button title=${i18next.t('text.center-on-z')} @click=${() => this.ask('center', 'z')}>
593
- ${i18next.t('button.center-z')}
747
+ <button title=${i18next.t('figure.text.center-on-z')} @click=${() => this.ask('center', 'z')}>
748
+ ${i18next.t('figure.button.center-z')}
594
749
  </button>
595
- <button title=${i18next.t('text.put-on-floor')} @click=${() => this.ask('floor', 'y')}>
596
- ${i18next.t('button.to-floor')}
750
+ <button title=${i18next.t('figure.text.put-on-floor')} @click=${() => this.ask('floor', 'y')}>
751
+ ${i18next.t('figure.button.to-floor')}
597
752
  </button>
598
753
  <span sep></span>
599
754
  ${['x', 'z'].map(axis => {
@@ -602,22 +757,22 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
602
757
  return html `
603
758
  <button
604
759
  ?disabled=${!able}
605
- title=${i18next.t(able ? 'text.mirror-explained' : 'text.mirror-would-overlap')}
760
+ title=${i18next.t(able ? 'figure.text.mirror-explained' : 'figure.text.mirror-would-overlap')}
606
761
  @click=${() => this.ask('mirror', axis)}
607
762
  >
608
- ${i18next.t('button.mirror-' + axis)}
763
+ ${i18next.t('figure.button.mirror-' + axis)}
609
764
  </button>
610
765
  `;
611
766
  })}
612
767
  <span sep></span>
613
- <button title=${i18next.t('text.snap-explained')} @click=${() => this.ask('snap', 'x')}>
614
- ${i18next.t('button.snap')}
768
+ <button title=${i18next.t('figure.text.snap-explained')} @click=${() => this.ask('snap', 'x')}>
769
+ ${i18next.t('figure.button.snap')}
615
770
  </button>
616
771
  </div>
617
772
  </div>
618
773
 
619
774
  <div field>
620
- <label>${i18next.t('label.rotation-degrees')}</label>
775
+ <label>${i18next.t('figure.label.rotation-degrees')}</label>
621
776
  <div triple>
622
777
  ${['x', 'y', 'z'].map(axis => this.number(axis.toUpperCase(), rotation[axis] ?? 0, value => this.putTransform({ rotation: { ...rotation, [axis]: value } })))}
623
778
  </div>
@@ -633,7 +788,7 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
633
788
  return nothing;
634
789
  return html `
635
790
  <section>
636
- <h3>${i18next.t('label.shape-detail')}</h3>
791
+ <h3>${i18next.t('figure.label.shape-detail')}</h3>
637
792
  ${segmented ? this.renderSegments(part) : nothing}
638
793
  ${segmented ? this.renderKeepRound(part) : nothing}
639
794
  ${extruded ? this.renderExtruded(part) : nothing}
@@ -653,17 +808,17 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
653
808
  const reshape = (over) => this.put({ shape: { ...(part.shape ?? {}), ...over } });
654
809
  return html `
655
810
  <div field>
656
- <label>${i18next.t('label.corner-round')}</label>
811
+ <label>${i18next.t('figure.label.corner-round')}</label>
657
812
  ${this.number('', part.shape?.round ?? 0, value => reshape({ round: value }))}
658
813
  </div>
659
814
  <div field>
660
- <label>${i18next.t('label.hollow-wall')}</label>
815
+ <label>${i18next.t('figure.label.hollow-wall')}</label>
661
816
  ${this.number('', wall, value => reshape({ hollow: value > 0 ? { ...(hollow ?? {}), wall: value } : undefined }))}
662
817
  </div>
663
818
  ${wall > 0
664
819
  ? html `
665
820
  <div field>
666
- <label>${i18next.t('label.hollow-floor')}</label>
821
+ <label>${i18next.t('figure.label.hollow-floor')}</label>
667
822
  ${this.number('', hollow?.floor ?? wall, value => reshape({ hollow: { ...hollow, wall, floor: value } }))}
668
823
  </div>
669
824
  `
@@ -688,15 +843,15 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
688
843
  const on = part.keepRound !== false;
689
844
  return html `
690
845
  <div field>
691
- <label>${i18next.t('label.keep-round')}</label>
846
+ <label>${i18next.t('figure.label.keep-round')}</label>
692
847
  <div choices>
693
848
  <button choice ?on=${on} @click=${() => this.put({ keepRound: undefined })}>
694
- <b>${i18next.t('text.keep-round-on')}</b>
695
- <small>${i18next.t('text.keep-round-cost')}</small>
849
+ <b>${i18next.t('figure.text.keep-round-on')}</b>
850
+ <small>${i18next.t('figure.text.keep-round-cost')}</small>
696
851
  </button>
697
852
  <button choice ?on=${!on} @click=${() => this.put({ keepRound: false })}>
698
- <b>${i18next.t('text.keep-round-off')}</b>
699
- <small>${i18next.t('text.keep-round-merged')}</small>
853
+ <b>${i18next.t('figure.text.keep-round-off')}</b>
854
+ <small>${i18next.t('figure.text.keep-round-merged')}</small>
700
855
  </button>
701
856
  </div>
702
857
  </div>
@@ -706,7 +861,7 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
706
861
  const current = part.segments ?? SEGMENT_PRESETS[1];
707
862
  return html `
708
863
  <div field>
709
- <label>${i18next.t('label.segments')}</label>
864
+ <label>${i18next.t('figure.label.segments')}</label>
710
865
  <div segments>
711
866
  ${SEGMENT_PRESETS.map(preset => {
712
867
  const triangles = trianglesOf({ ...part, segments: preset });
@@ -714,14 +869,14 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
714
869
  <button seg ?on=${current === preset} @click=${() => this.put({ segments: preset })}>
715
870
  ${this.silhouette(preset)}
716
871
  <b>${preset}</b>
717
- <small>${i18next.t('text.n-triangles', { count: triangles })}</small>
872
+ <small>${i18next.t('figure.text.n-triangles', { count: triangles })}</small>
718
873
  </button>
719
874
  `;
720
875
  })}
721
876
  </div>
722
877
 
723
878
  <details free>
724
- <summary>${i18next.t('text.other-segment-count')}</summary>
879
+ <summary>${i18next.t('figure.text.other-segment-count')}</summary>
725
880
  ${this.number('', current, value => this.put({ segments: value }), 3)}
726
881
  </details>
727
882
  </div>
@@ -775,36 +930,36 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
775
930
  const glow = material.emissive;
776
931
  return html `
777
932
  <section>
778
- <h3>${i18next.t('label.material')}</h3>
933
+ <h3>${i18next.t('figure.label.part-material')}</h3>
779
934
 
780
935
  <div field>
781
- <label>${i18next.t('label.palette-token')}</label>
936
+ <label>${i18next.t('figure.label.palette-token')}</label>
782
937
  <div swatches>
783
938
  ${this.swatches(painted, material.token)}
784
939
  </div>
785
940
  ${lit.length
786
941
  ? html `
787
- <label group>${i18next.t('label.status-colors')}</label>
942
+ <label group>${i18next.t('figure.label.status-colors')}</label>
788
943
  <div swatches>
789
944
  ${this.swatches(lit, material.token)}
790
945
  </div>
791
946
  `
792
947
  : ''}
793
- <span token>${material.token ?? i18next.t('label.no-color-chosen')}</span>
948
+ <span token>${material.token ?? i18next.t('figure.label.no-color-chosen')}</span>
794
949
  </div>
795
950
 
796
951
  <div field>
797
- <label>${i18next.t('label.preset')}</label>
952
+ <label>${i18next.t('figure.label.preset')}</label>
798
953
  <select
799
954
  @change=${(e) => {
800
955
  const value = e.target.value;
801
956
  this.putMaterial({ preset: (value || undefined) });
802
957
  }}
803
958
  >
804
- <option value="" ?selected=${!material.preset}>${i18next.t('label.none')}</option>
959
+ <option value="" ?selected=${!material.preset}>${i18next.t('figure.label.none')}</option>
805
960
  ${MATERIAL_PRESETS.map(preset => html `
806
961
  <option value=${preset} ?selected=${preset === material.preset}>
807
- ${i18next.t('label.preset-' + preset)}
962
+ ${i18next.t('figure.label.preset-' + preset)}
808
963
  </option>
809
964
  `)}
810
965
  </select>
@@ -817,7 +972,7 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
817
972
  .checked=${material.flatShading ?? true}
818
973
  @change=${(e) => this.putMaterial({ flatShading: e.target.checked })}
819
974
  />
820
- ${i18next.t('label.flat-shading')}
975
+ ${i18next.t('figure.label.flat-shading')}
821
976
  </label>
822
977
  <label toggle>
823
978
  <input
@@ -825,12 +980,11 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
825
980
  .checked=${!!material.transparent}
826
981
  @change=${(e) => this.putMaterial({ transparent: e.target.checked })}
827
982
  />
828
- ${i18next.t('label.transparent')}
983
+ ${i18next.t('figure.label.transparent')}
829
984
  </label>
830
985
 
831
986
  <div field>
832
- <label>${i18next.t('label.emissive')}</label>
833
- <p cost>${i18next.t('text.emissive-explained')}</p>
987
+ <label>${i18next.t('figure.label.emissive')}${this.help('figure.text.emissive-explained')}</label>
834
988
 
835
989
  <div slider>
836
990
  <input
@@ -848,13 +1002,13 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
848
1002
  ${glow
849
1003
  ? html `
850
1004
  <div field>
851
- <label>${i18next.t('label.emissive-color')}</label>
1005
+ <label>${i18next.t('figure.label.emissive-color')}</label>
852
1006
  <div swatches>
853
1007
  <button
854
1008
  swatch
855
1009
  same
856
1010
  ?on=${!glow.token}
857
- title=${i18next.t('label.same-as-off')}
1011
+ title=${i18next.t('figure.label.same-as-off')}
858
1012
  style="--swatch:${(material.token && palette[material.token]) || palette['palette.neutral']}"
859
1013
  @click=${() => this.putMaterial({ emissive: { ...glow, token: undefined } })}
860
1014
  ></button>
@@ -868,7 +1022,7 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
868
1022
  ></button>
869
1023
  `)}
870
1024
  </div>
871
- <span token>${glow.token ?? i18next.t('label.same-as-off')}</span>
1025
+ <span token>${glow.token ?? i18next.t('figure.label.same-as-off')}</span>
872
1026
  </div>
873
1027
 
874
1028
  <label toggle>
@@ -877,9 +1031,9 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
877
1031
  .checked=${!!glow.on}
878
1032
  @change=${(e) => this.putMaterial({ emissive: { ...glow, on: e.target.checked } })}
879
1033
  />
880
- ${i18next.t('label.on-by-default')}
1034
+ ${i18next.t('figure.label.on-by-default')}
881
1035
  </label>
882
- <p cost>${i18next.t('text.on-by-default-explained')}</p>
1036
+ ${this.help('figure.text.on-by-default-explained')}
883
1037
  `
884
1038
  : ''}
885
1039
 
@@ -908,25 +1062,21 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
908
1062
  const repeat = part.repeat ?? { axis: 'x', pitch: 0 };
909
1063
  return html `
910
1064
  <section>
911
- <h3>${i18next.t('label.sizing-rule')}</h3>
1065
+ <h3>${i18next.t('figure.label.sizing-rule')}${this.help('figure.text.sizing-' + sizing + '-explained')}</h3>
912
1066
  <select @change=${(e) => this.put({ sizing: e.target.value })}>
913
1067
  ${SIZING_RULES.map(rule => html `
914
- <option value=${rule} ?selected=${rule === sizing}>${i18next.t('label.sizing-' + rule)}</option>
1068
+ <option value=${rule} ?selected=${rule === sizing}>${i18next.t('figure.label.sizing-' + rule)}</option>
915
1069
  `)}
916
1070
  </select>
917
- <p warn>${i18next.t('text.sizing-' + sizing + '-explained')}</p>
1071
+ ${sizing === 'scale' ? nothing : this.help('figure.text.sizing-costs-one-draw-call')}
1072
+ ${sizing === 'repeat' ? this.help('figure.text.repeat-edits-the-unit') : nothing}
918
1073
 
919
- ${sizing === 'scale'
920
- ? nothing
921
- : html `<p cost>${i18next.t('text.sizing-costs-one-draw-call')}</p>`}
922
- ${sizing === 'repeat'
923
- ? html `<p cost>${i18next.t('text.repeat-edits-the-unit')}</p>`
924
- : nothing}
1074
+ ${this.renderAnchors(part)}
925
1075
 
926
1076
  ${sizing === 'repeat'
927
1077
  ? html `
928
1078
  <div field>
929
- <label>${i18next.t('label.repeat-axis')}</label>
1079
+ <label>${i18next.t('figure.label.repeat-axis')}</label>
930
1080
  <select
931
1081
  @change=${(e) => this.put({ repeat: { ...repeat, axis: e.target.value } })}
932
1082
  >
@@ -934,15 +1084,165 @@ let FigureInspector = class FigureInspector extends localize(i18next)(LitElement
934
1084
  </select>
935
1085
  </div>
936
1086
  <div field>
937
- <label>${i18next.t('label.repeat-pitch')}</label>
1087
+ <label>${i18next.t('figure.label.repeat-pitch')}${this.help('figure.text.repeat-pitch-explained')}</label>
938
1088
  ${this.number('', repeat.pitch, value => this.put({ repeat: { ...repeat, pitch: value } }), 1)}
939
- <p cost>${i18next.t('text.repeat-pitch-explained')}</p>
940
1089
  </div>
1090
+ ${this.renderRepeatCount(part)}
941
1091
  `
942
1092
  : nothing}
943
1093
  </section>
944
1094
  `;
945
1095
  }
1096
+ /**
1097
+ * ── 몇 개가 되나 ──────────────────────────────────────────────────────────
1098
+ *
1099
+ * 저작 화면은 축과 피치만 받고 있었다. 형식이 가진 반복 설정이 그 둘뿐이므로 편집할 것은
1100
+ * 다 있었는데, **결과인 개수를 어디에도 표시하지 않았다.** 피치 300 을 적은 저작자가 몇 개가
1101
+ * 되는지 알려면 미리보기를 세어야 했다.
1102
+ *
1103
+ * 개수는 그리는 쪽이 쓰는 `repeatPlan` 을 그대로 불러 얻는다. 여기서 다시 계산하면 화면이
1104
+ * 말하는 개수와 실제로 그려지는 개수가 달라진다.
1105
+ *
1106
+ * ## 두 가지 반복이 있다
1107
+ *
1108
+ * 컨베이어의 롤러는 길어지면 **개수가 늘고** 한 칸 간격은 그대로다. 셀트레이의 셀은 커지면
1109
+ * **셀이 커지고** 개수는 그대로다 — 몇 셀짜리 트레이냐는 화면 크기와 무관하다. 그 갈림을
1110
+ * 이 축의 anchor 가 정하는데 화면에는 그 말이 없었다. 그래서 어느 쪽인지 함께 적는다.
1111
+ */
1112
+ renderRepeatCount(part) {
1113
+ const board = this.board;
1114
+ if (!board)
1115
+ return nothing;
1116
+ const base = { x: board.width, y: board.depth, z: board.height };
1117
+ const plan = repeatPlanOfPart(part, { x: 1, y: 1, z: 1 }, base);
1118
+ if (!plan)
1119
+ return nothing;
1120
+ const grows = anchorOfPart(part, base, plan.axis) !== 'scale';
1121
+ return html `
1122
+ <div field>
1123
+ <label>${i18next.t('figure.label.repeat-count')}</label>
1124
+ <p quiet>
1125
+ ${i18next.t('figure.text.repeat-count-now', { count: plan.count })}
1126
+ ${plan.count >= REPEAT_LIMIT
1127
+ ? html `<br />${i18next.t('figure.text.repeat-count-capped', { limit: REPEAT_LIMIT })}`
1128
+ : ''}
1129
+ <br />${i18next.t(grows ? 'figure.text.repeat-grows-with-instance' : 'figure.text.repeat-keeps-count')}
1130
+ </p>
1131
+ </div>
1132
+ `;
1133
+ }
1134
+ /**
1135
+ * ── 어느 면을 붙잡나 ──────────────────────────────────────────────────────
1136
+ *
1137
+ * **이 자리가 없었다.** 형식은 축마다 `anchor` 를 지고 다니고(`figure-source.ts` 가 왕복시킨다),
1138
+ * 발행 게이트는 「valve-wheel 의 anchor.z 를 max 로 두라」고 사유까지 말하는데, 저작면에는 그
1139
+ * 값을 바꿀 자리가 없었다 — 고치라는 말만 있고 고칠 문이 없었다.
1140
+ *
1141
+ * ## 「자동」이 기본이다
1142
+ *
1143
+ * 형식에서 `anchor` 는 적지 않아도 된다. 안 적으면 **가까운 면**을 붙잡고, 표본 열넷 중 어느
1144
+ * 것도 이 값을 적지 않고 제대로 선다. 그래서 축마다 첫 항목이 「자동」이고, 지금 자동이 무엇으로
1145
+ * 읽히는지를 **함께 보여 준다** — 그것을 모르면 무엇을 바꾸는지 모른 채 고르게 된다.
1146
+ *
1147
+ * 자동이 무엇인지는 형식에게 묻는다(`anchorOfPart`). 여기서 「위 절반이면 max」를 다시 세면
1148
+ * 화면이 말하는 면과 실제로 그려지는 면이 갈린다.
1149
+ *
1150
+ * ## `scale` 인 부품에도 보여 준다
1151
+ *
1152
+ * 처음에는 감췄다 — 형식 주석에 「`sizing` 이 `scale` 인 부품에는 뜻이 없다」고 적혀 있어서다.
1153
+ * **그 문장은 기본값에 대한 것이다.** `anchorOf` 는 적힌 값을 가장 먼저 보고(`if (said) return
1154
+ * said`), 그 뒤에야 `sizing` 을 본다. 즉 `scale` 부품에도 면을 적으면 그것이 이긴다.
1155
+ *
1156
+ * 감춰 두면 어긋남이 난다: 발행 게이트가 막는 MIXER 의 `valve-wheel` 이 `scale` 부품이고,
1157
+ * 게이트의 사유는 「그 부품의 anchor.z 를 max 로 두라」다. 고치라는 자리에 문을 닫아 둔 셈이었다.
1158
+ *
1159
+ * 대신 `scale` 일 때는 자동이 무엇인지가 「함께 커진다」로 보이므로, 저작자가 그것을 바꾸는
1160
+ * 것임을 알 수 있다.
1161
+ */
1162
+ /**
1163
+ * ── 도움말은 자리를 먹지 않는다 ─────────────────────────────────────────────
1164
+ *
1165
+ * 설명 문단이 열 줄 있었고 그 줄들이 패널 높이의 상당 부분이었다. 속성은 앞으로 더 늘어난다
1166
+ * (능력 · 포트 · 애니메이션 · 기준정보) — 늘 보이는 설명은 그 자리를 먼저 먹는다.
1167
+ *
1168
+ * 그래서 물음표로 접는다. **지우지 않는다** — 그 문장들은 「이걸 고르면 무엇이 달라지나」를
1169
+ * 말하는 것이고, 없으면 닫힌 목록을 고를 수 없다. 한 번 읽으면 되는 것이라 접어 두는 것이 맞다.
1170
+ *
1171
+ * 편 것은 **부품을 바꿔도 그대로 둔다**(`opened` 는 부품에 딸린 상태가 아니다). 같은 것을
1172
+ * 계속 고치는 사람이 매번 다시 펴야 하면 접은 것이 되레 방해가 된다.
1173
+ */
1174
+ help(key) {
1175
+ const shown = this.opened.has(key);
1176
+ return html `
1177
+ <button
1178
+ help
1179
+ aria-label=${i18next.t('figure.label.help')}
1180
+ aria-expanded=${shown ? 'true' : 'false'}
1181
+ @click=${() => {
1182
+ shown ? this.opened.delete(key) : this.opened.add(key);
1183
+ this.requestUpdate();
1184
+ }}
1185
+ >
1186
+ <md-icon>${shown ? 'help' : 'help_outline'}</md-icon>
1187
+ </button>
1188
+ ${shown ? html `<p hint>${i18next.t(key)}</p>` : nothing}
1189
+ `;
1190
+ }
1191
+ renderAnchors(part) {
1192
+ const base = this.board
1193
+ ? { x: this.board.width, y: this.board.height, z: this.board.depth }
1194
+ : { x: 0, y: 0, z: 0 };
1195
+ return html `
1196
+ <div field>
1197
+ <!-- 「anchor.x」로 적힌 사유를 화면에서 찾을 수 있게 칸 이름에 그 낱말을 남긴다 -->
1198
+ <label>${i18next.t('figure.label.anchor')} (anchor)${this.help('figure.text.anchor-explained')}</label>
1199
+ ${['x', 'y', 'z'].map(axis => {
1200
+ const said = part.anchor?.[axis];
1201
+ const auto = anchorOfPart(part, base, axis);
1202
+ /*
1203
+ **면 이름은 축마다 다르다.** 처음에는 min 을 「아래·왼쪽·뒤 면」으로 한 줄에 다 적었는데,
1204
+ x 줄에서 「아래」와 「뒤」는 관계가 없어 읽는 사람이 무엇을 고르는지 몰랐다.
1205
+
1206
+ 그리고 이름씨가 아니라 **동작**으로 적는다 — 「오른쪽 면」이 아니라 「오른쪽 면에 붙어
1207
+ 있는다」다. 「anchor.x 를 max 로 둔다」가 무슨 뜻인지 모르겠다는 말이 그 자리에서 나왔다.
1208
+ */
1209
+ /*
1210
+ **값 이름을 함께 보인다.** 동작만 적었더니(「오른쪽 면에 붙어 있는다») 발행 게이트가
1211
+ 「anchor.x 를 max 로 두라」고 말할 때 화면에서 그 낱말을 찾을 수 없었다 — 사용자가
1212
+ 그 자리에서 지적했다.
1213
+
1214
+ `max` 는 정본에 저장되는 이름이고 서버 오류·형식 문서·게이트 사유가 다 그 이름을 쓴다.
1215
+ 숨기면 안 되는 종류다. 동작이 먼저고 이름이 괄호로 따라온다.
1216
+ */
1217
+ const nameOf = (rule) => `${i18next.t(rule === 'min' || rule === 'max' ? `figure.label.anchor-${rule}-${axis}` : `figure.label.anchor-${rule}`)} (${rule})`;
1218
+ return html `
1219
+ <div cell>
1220
+ <span axis>${axis}</span>
1221
+ <select
1222
+ @change=${(e) => {
1223
+ const value = e.target.value;
1224
+ const anchor = { ...(part.anchor ?? {}) };
1225
+ /* 「자동」은 칸을 지우는 것이다 — 빈 값을 넣어 두면 형식이 그것을 값으로 읽는다. */
1226
+ if (value) {
1227
+ anchor[axis] = value;
1228
+ }
1229
+ else {
1230
+ delete anchor[axis];
1231
+ }
1232
+ this.put({ anchor: Object.keys(anchor).length ? anchor : undefined });
1233
+ }}
1234
+ >
1235
+ <option value="" ?selected=${!said}>
1236
+ ${i18next.t('figure.label.anchor-auto', { rule: nameOf(auto) })}
1237
+ </option>
1238
+ ${ANCHOR_RULES.map(rule => html `<option value=${rule} ?selected=${rule === said}>${nameOf(rule)}</option>`)}
1239
+ </select>
1240
+ </div>
1241
+ `;
1242
+ })}
1243
+ </div>
1244
+ `;
1245
+ }
946
1246
  /**
947
1247
  * 숫자 칸.
948
1248
  *
@@ -1047,6 +1347,10 @@ __decorate([
1047
1347
  property({ type: String }),
1048
1348
  __metadata("design:type", Object)
1049
1349
  ], FigureInspector.prototype, "figureName", void 0);
1350
+ __decorate([
1351
+ state(),
1352
+ __metadata("design:type", Object)
1353
+ ], FigureInspector.prototype, "opened", void 0);
1050
1354
  __decorate([
1051
1355
  property({ type: Object }),
1052
1356
  __metadata("design:type", Object)