@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.
- package/client/graphql/index.ts +35 -3
- package/client/modeller/figure-ask.ts +5 -5
- package/client/modeller/figure-canvas.ts +1 -1
- package/client/modeller/figure-capabilities.ts +372 -0
- package/client/modeller/figure-history-panel.ts +171 -18
- package/client/modeller/figure-inspector.ts +392 -76
- package/client/modeller/figure-parts.ts +15 -15
- package/client/modeller/figure-preview.ts +2 -2
- package/client/modeller/figure-report.ts +102 -37
- package/client/modeller/figure-settings.ts +20 -20
- package/client/modeller/figure-side.ts +37 -9
- package/client/modeller/figure-source.test.ts +15 -1
- package/client/modeller/figure-source.ts +31 -15
- package/client/modeller/figure-thumbnail.ts +49 -4
- package/client/modeller/maturity.ts +10 -10
- package/client/pages/figure-list-page.ts +152 -66
- package/client/pages/figure-modeller-page.ts +260 -43
- package/client/types.ts +25 -0
- package/client/viewparts/figure-thumb.ts +172 -0
- package/dist-client/graphql/index.d.ts +8 -1
- package/dist-client/graphql/index.js +32 -3
- package/dist-client/graphql/index.js.map +1 -1
- package/dist-client/modeller/figure-ask.js +5 -5
- package/dist-client/modeller/figure-ask.js.map +1 -1
- package/dist-client/modeller/figure-canvas.js +1 -1
- package/dist-client/modeller/figure-canvas.js.map +1 -1
- package/dist-client/modeller/figure-capabilities.d.ts +42 -0
- package/dist-client/modeller/figure-capabilities.js +344 -0
- package/dist-client/modeller/figure-capabilities.js.map +1 -0
- package/dist-client/modeller/figure-history-panel.d.ts +15 -1
- package/dist-client/modeller/figure-history-panel.js +165 -18
- package/dist-client/modeller/figure-history-panel.js.map +1 -1
- package/dist-client/modeller/figure-inspector.d.ts +84 -0
- package/dist-client/modeller/figure-inspector.js +379 -75
- package/dist-client/modeller/figure-inspector.js.map +1 -1
- package/dist-client/modeller/figure-parts.js +15 -15
- package/dist-client/modeller/figure-parts.js.map +1 -1
- package/dist-client/modeller/figure-preview.js +2 -2
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/modeller/figure-report.d.ts +18 -1
- package/dist-client/modeller/figure-report.js +105 -37
- package/dist-client/modeller/figure-report.js.map +1 -1
- package/dist-client/modeller/figure-settings.js +19 -19
- package/dist-client/modeller/figure-settings.js.map +1 -1
- package/dist-client/modeller/figure-side.d.ts +1 -0
- package/dist-client/modeller/figure-side.js +36 -8
- package/dist-client/modeller/figure-side.js.map +1 -1
- package/dist-client/modeller/figure-source.d.ts +15 -8
- package/dist-client/modeller/figure-source.js +16 -7
- package/dist-client/modeller/figure-source.js.map +1 -1
- package/dist-client/modeller/figure-thumbnail.js +40 -4
- package/dist-client/modeller/figure-thumbnail.js.map +1 -1
- package/dist-client/modeller/maturity.js +10 -10
- package/dist-client/modeller/maturity.js.map +1 -1
- package/dist-client/pages/figure-list-page.d.ts +1 -4
- package/dist-client/pages/figure-list-page.js +150 -63
- package/dist-client/pages/figure-list-page.js.map +1 -1
- package/dist-client/pages/figure-modeller-page.d.ts +45 -0
- package/dist-client/pages/figure-modeller-page.js +259 -43
- package/dist-client/pages/figure-modeller-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types.d.ts +23 -0
- package/dist-client/types.js.map +1 -1
- package/dist-client/viewparts/figure-thumb.d.ts +29 -0
- package/dist-client/viewparts/figure-thumb.js +168 -0
- package/dist-client/viewparts/figure-thumb.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -5
- package/test/i18n-prefix-guard.test.ts +129 -0
- package/test/korean-register-guard.test.ts +83 -0
- package/translations/en.json +307 -264
- package/translations/ja.json +275 -264
- package/translations/ko.json +307 -264
- package/translations/ms.json +275 -264
- package/translations/zh.json +275 -264
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js'
|
|
2
2
|
import '../modeller/figure-side.js'
|
|
3
3
|
import '../modeller/figure-ask.js'
|
|
4
|
+
/*
|
|
5
|
+
대화 도크. **`/client` 서브패스로 적으면 안 된다.**
|
|
6
|
+
|
|
7
|
+
그 패키지에 `exports` 맵이 없어서 `/client` 는 소스 디렉터리로 떨어지고, webpack 이 `.ts` 를 직접
|
|
8
|
+
컴파일한다. 그 경로로 나온 데코레이터가 `Reflect.metadata` 를 가드 없이 불러 **브라우저에서만**
|
|
9
|
+
죽는다(빌드 로그는 오류 0건). board-ai 와 plant 가 차례로 밟았다.
|
|
10
|
+
|
|
11
|
+
그리고 더 센 이유가 있다 — `board-ui/dist-client` 의 모델러가 같은 엘리먼트를 **빌드된 경로로**
|
|
12
|
+
등록한다. 다른 경로로 적으면 webpack 이 두 모듈로 보고, 두 곳이 같은 커스텀 엘리먼트 이름을
|
|
13
|
+
등록해 나중에 뜨는 화면이 죽는다. 즉 「어느 경로가 되나」가 아니라 **「모두 같은 경로여야 한다」**다.
|
|
14
|
+
*/
|
|
15
|
+
import '@things-factory/ai-assistant/dist-client/index.js'
|
|
4
16
|
import '../modeller/figure-canvas.js'
|
|
5
17
|
import { captureThumbnail } from '../modeller/figure-thumbnail.js'
|
|
6
18
|
import '../modeller/figure-preview.js'
|
|
@@ -13,6 +25,7 @@ import { customElement, state } from 'lit/decorators.js'
|
|
|
13
25
|
import { i18next, localize } from '@operato/i18n'
|
|
14
26
|
import { navigate, PageView } from '@operato/shell'
|
|
15
27
|
import { validate } from '@hatiolab/figure-model'
|
|
28
|
+
import { activePalette } from '@hatiolab/things-scene'
|
|
16
29
|
import type { DetailLevel, FigureSource, PrimitiveKind } from '@hatiolab/figure-model'
|
|
17
30
|
|
|
18
31
|
import * as edits from '../modeller/part-edits.js'
|
|
@@ -68,29 +81,23 @@ function rememberPanes(panes: Panes): void {
|
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
/**
|
|
71
|
-
* 새로 만든 Figure 의 시작
|
|
84
|
+
* 새로 만든 Figure 의 시작 상태 — **빈 상자 하나뿐이다.**
|
|
72
85
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
86
|
+
* 전에는 부품(300 상자)을 하나 놓아 주었다. 형식이 부품 0개를 오류로 보기 때문이다
|
|
87
|
+
* (`missing-parts` — parts 가 없다). 그래서 아무것도 안 했는데 붉은 판정이 뜨는 것을 피하려고
|
|
88
|
+
* 상자를 깔았다.
|
|
89
|
+
*
|
|
90
|
+
* **그런데 「무조건 상자」는 대개 첫 동작이 그것을 지우는 일이 된다** — 컨베이어를 만들 사람도,
|
|
91
|
+
* 시그널타워를 만들 사람도 상자부터 치운다. 그래서 비운다. 형식은 그대로 두고(부품 없는 것은
|
|
92
|
+
* 발행할 수 없는 것이 맞다) **화면이 「아직 저작 안 함」과 「형식을 어김」을 가른다.**
|
|
93
|
+
*
|
|
94
|
+
* 빈 화면이 가르치는 자리다: 부품 목록이 「위에서 도형을 골라 시작하세요」를 이미 말하고 팔레트가
|
|
95
|
+
* 바로 그 위에 있다(`figure-parts`).
|
|
76
96
|
*/
|
|
77
97
|
function startingModel(type: string): { board: BoardModel; parts: PartModel[] } {
|
|
78
98
|
return {
|
|
79
99
|
board: { width: 300, height: 300, depth: 300, figureType: type, detailLevel: 'M' },
|
|
80
|
-
parts: [
|
|
81
|
-
{
|
|
82
|
-
type: 'figure-part',
|
|
83
|
-
name: 'body',
|
|
84
|
-
primitive: 'cube',
|
|
85
|
-
left: 0,
|
|
86
|
-
top: 0,
|
|
87
|
-
width: 300,
|
|
88
|
-
height: 300,
|
|
89
|
-
zPos: 0,
|
|
90
|
-
depth: 300,
|
|
91
|
-
token: 'palette.primary'
|
|
92
|
-
}
|
|
93
|
-
]
|
|
100
|
+
parts: []
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
|
|
@@ -140,10 +147,50 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
140
147
|
div[edits] {
|
|
141
148
|
flex: 1;
|
|
142
149
|
display: grid;
|
|
143
|
-
grid-template-columns: 220px 1fr 320px;
|
|
150
|
+
grid-template-columns: 220px 1fr 320px 0;
|
|
144
151
|
min-height: 0;
|
|
145
152
|
overflow: hidden;
|
|
146
153
|
}
|
|
154
|
+
/*
|
|
155
|
+
대화 도크는 **불렀을 때만 자리를 받는다.** 저작의 주인공은 캔버스이고, 대화는 필요할 때
|
|
156
|
+
여는 것이다. 늘 열어 두면 넷으로 나뉜 화면에서 캔버스가 가장 좁아진다.
|
|
157
|
+
*/
|
|
158
|
+
div[edits][dock] {
|
|
159
|
+
grid-template-columns: 220px 1fr 320px 360px;
|
|
160
|
+
}
|
|
161
|
+
div[edits] > ox-board-ai-chat {
|
|
162
|
+
grid-column: 4;
|
|
163
|
+
min-width: 0;
|
|
164
|
+
border-left: 1px solid var(--md-sys-color-outline-variant);
|
|
165
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
166
|
+
}
|
|
167
|
+
div[edits]:not([dock]) > ox-board-ai-chat {
|
|
168
|
+
display: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* 도크를 여는 손잡이. 머리줄의 저장 단추 옆에 둔다 */
|
|
172
|
+
button[dock] {
|
|
173
|
+
flex: none;
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: 4px;
|
|
177
|
+
padding: 5px 10px;
|
|
178
|
+
font: var(--label-font, inherit);
|
|
179
|
+
font-size: 0.78rem;
|
|
180
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
181
|
+
background: none;
|
|
182
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
183
|
+
border-radius: 6px;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
}
|
|
186
|
+
button[dock][on] {
|
|
187
|
+
color: var(--md-sys-color-primary);
|
|
188
|
+
border-color: var(--md-sys-color-primary);
|
|
189
|
+
background-color: var(--md-sys-color-surface-container);
|
|
190
|
+
}
|
|
191
|
+
button[dock] md-icon {
|
|
192
|
+
font-size: 16px;
|
|
193
|
+
}
|
|
147
194
|
|
|
148
195
|
/*
|
|
149
196
|
**세 칸의 자리를 못 박는다.**
|
|
@@ -251,6 +298,23 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
251
298
|
cursor: default;
|
|
252
299
|
}
|
|
253
300
|
|
|
301
|
+
/*
|
|
302
|
+
저장이 거절된 사유. 단추 **바로 왼쪽**에 둔다 — 누른 자리에서 답을 봐야 한다. 길면 줄이지만
|
|
303
|
+
전문은 title 로 남긴다(서버 문장이 길 수 있다).
|
|
304
|
+
*/
|
|
305
|
+
span[save-failed] {
|
|
306
|
+
max-width: 280px;
|
|
307
|
+
overflow: hidden;
|
|
308
|
+
text-overflow: ellipsis;
|
|
309
|
+
white-space: nowrap;
|
|
310
|
+
padding: 4px 8px;
|
|
311
|
+
font: var(--label-font, inherit);
|
|
312
|
+
font-size: 0.72rem;
|
|
313
|
+
color: var(--md-sys-color-on-error-container, var(--md-sys-color-on-surface));
|
|
314
|
+
background-color: var(--md-sys-color-error-container);
|
|
315
|
+
border-radius: 6px;
|
|
316
|
+
}
|
|
317
|
+
|
|
254
318
|
/*
|
|
255
319
|
칸을 벡터 저작도구의 관례대로 놓는다 — 왼쪽에 무엇이 있나(레이어), 오른쪽에
|
|
256
320
|
고른 것의 속성. 쓰는 사람이 이미 아는 자리라 배울 것이 하나 줄어든다.
|
|
@@ -510,6 +574,18 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
510
574
|
@state() private dirty = false
|
|
511
575
|
@state() private saving = false
|
|
512
576
|
@state() private violations: FigureFinding[] = []
|
|
577
|
+
/**
|
|
578
|
+
* 저장이 왜 안 됐나.
|
|
579
|
+
*
|
|
580
|
+
* **`save()` 에 `catch` 가 없었다.** `try … finally` 뿐이라 서버가 거절하면(형식 위반 · 타입 이름
|
|
581
|
+
* 중복 · 권한 없음 · 네트워크) 단추만 멈추고 화면은 **아무 말도 하지 않았다.** 저작자는 눌렀는데
|
|
582
|
+
* 아무 일도 안 난 것으로 보고, 저장됐는지 아닌지도 알 수 없었다.
|
|
583
|
+
*
|
|
584
|
+
* 미저장 표시(`dirty`)는 그대로 남으므로 데이터를 잃지는 않았다. 잃은 것은 **사유**다.
|
|
585
|
+
*/
|
|
586
|
+
@state() private saveFailure = ''
|
|
587
|
+
/** 대화 도크가 열려 있나. 저작면의 보기 상태라 저장하지 않는다. */
|
|
588
|
+
@state() private dockOpen = false
|
|
513
589
|
/** 저작 보조가 낸 후보. 받기 전에는 원본 데이터가 아니다. */
|
|
514
590
|
@state() private proposal?: FigureSource
|
|
515
591
|
/** 그 후보의 셈. 무엇을 받는 것인지 숫자로도 보여 준다. */
|
|
@@ -533,7 +609,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
533
609
|
|
|
534
610
|
get context() {
|
|
535
611
|
return {
|
|
536
|
-
title: this.figure?.name ?? i18next.t('title.new-figure'),
|
|
612
|
+
title: this.figure?.name ?? i18next.t('figure.title.new-figure'),
|
|
537
613
|
/*
|
|
538
614
|
**제목 줄은 끈다.** 이름은 그대로 둔다.
|
|
539
615
|
|
|
@@ -558,7 +634,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
558
634
|
하네스 시절의 자리였다 — 앱에서는 셸이 페이지 제목으로 같은 이름을 그리므로 글자가 두 번
|
|
559
635
|
나오고, 캔버스가 주인공인 화면에서 그만큼 높이를 잃었다.
|
|
560
636
|
-->
|
|
561
|
-
${this.dirty ? html`<span dirty>${i18next.t('text.unsaved-changes')}</span>` : ''}
|
|
637
|
+
${this.dirty ? html`<span dirty>${i18next.t('figure.text.unsaved-changes')}</span>` : ''}
|
|
562
638
|
<!--
|
|
563
639
|
말로 시키는 줄이 머리줄의 남는 폭을 쓴다. 따로 두면 화면 위가 두 줄이 되고, 그 위 줄은
|
|
564
640
|
이름을 페이지 제목과 겹쳐 적는다.
|
|
@@ -568,8 +644,17 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
568
644
|
.type=${source?.type ?? ''}
|
|
569
645
|
@proposed=${(e: CustomEvent) => this.receive(e.detail.proposal)}
|
|
570
646
|
></figure-ask>
|
|
647
|
+
${this.saveFailure ? html`<span save-failed title=${this.saveFailure}>${this.saveFailure}</span>` : ''}
|
|
648
|
+
<button
|
|
649
|
+
dock
|
|
650
|
+
?on=${this.dockOpen}
|
|
651
|
+
title=${i18next.t('figure.text.dock-explained')}
|
|
652
|
+
@click=${() => (this.dockOpen = !this.dockOpen)}
|
|
653
|
+
>
|
|
654
|
+
<md-icon>forum</md-icon>${i18next.t('figure.button.dock')}
|
|
655
|
+
</button>
|
|
571
656
|
<button save ?disabled=${!this.canSave} @click=${() => this.save()}>
|
|
572
|
-
${this.saving ? i18next.t('text.saving') : i18next.t('button.save')}
|
|
657
|
+
${this.saving ? i18next.t('figure.text.saving-figure') : i18next.t('figure.button.save')}
|
|
573
658
|
</button>
|
|
574
659
|
</div>
|
|
575
660
|
|
|
@@ -577,6 +662,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
577
662
|
edits
|
|
578
663
|
?collapse-left=${this.collapsed.left}
|
|
579
664
|
?collapse-right=${this.collapsed.right}
|
|
665
|
+
?dock=${this.dockOpen}
|
|
580
666
|
@figure-rename=${(e: CustomEvent) => this.rename(e.detail.name)}
|
|
581
667
|
@figure-released=${(e: CustomEvent) => this.released(e.detail.figure)}
|
|
582
668
|
@figure-reverted=${() => this.figure?.id && this.load(this.figure.id)}
|
|
@@ -591,6 +677,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
591
677
|
@toggle-part-hidden=${(e: CustomEvent) => this.toggleHidden(e.detail.index)}
|
|
592
678
|
@set-all-parts-hidden=${(e: CustomEvent) => this.setAllHidden(e.detail.hidden)}
|
|
593
679
|
@change-detail-level=${(e: CustomEvent) => this.changeDetailLevel(e.detail.level)}
|
|
680
|
+
@update-board=${(e: CustomEvent) => this.updateBoard(e.detail.board)}
|
|
594
681
|
@part-tool=${(e: CustomEvent) => this.runTool(e.detail.index, e.detail.tool, e.detail.axis)}
|
|
595
682
|
@pick-part=${(e: CustomEvent) => this.pickPart(e.detail.name)}
|
|
596
683
|
>
|
|
@@ -607,7 +694,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
607
694
|
? html`
|
|
608
695
|
<div lanes>
|
|
609
696
|
<div lane>
|
|
610
|
-
<h4>${i18next.t('label.now')}</h4>
|
|
697
|
+
<h4>${i18next.t('figure.label.now')}</h4>
|
|
611
698
|
<figure-canvas
|
|
612
699
|
.board=${this.board}
|
|
613
700
|
.parts=${this.parts}
|
|
@@ -617,11 +704,11 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
617
704
|
</div>
|
|
618
705
|
<div lane candidate>
|
|
619
706
|
<h4>
|
|
620
|
-
${i18next.t('label.proposed')}
|
|
707
|
+
${i18next.t('figure.label.proposed')}
|
|
621
708
|
${this.proposalOf
|
|
622
709
|
? html`<small>
|
|
623
710
|
${this.proposalOf.grade} ·
|
|
624
|
-
${i18next.t('text.n-triangles', { count: this.proposalOf.triangles })}
|
|
711
|
+
${i18next.t('figure.text.n-triangles', { count: this.proposalOf.triangles })}
|
|
625
712
|
</small>`
|
|
626
713
|
: ''}
|
|
627
714
|
</h4>
|
|
@@ -651,10 +738,71 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
651
738
|
.view=${this.view}
|
|
652
739
|
@update-view=${(e: CustomEvent) => (this.view = e.detail.view)}
|
|
653
740
|
></figure-side>
|
|
741
|
+
|
|
742
|
+
<!-- 대화 도크. 무엇을 켜고 끄는지는 renderDock 위에 적어 두었다 -->
|
|
743
|
+
<ox-board-ai-chat
|
|
744
|
+
.boardTools=${false}
|
|
745
|
+
.toolCategories=${['figure-authoring']}
|
|
746
|
+
.hostContext=${this.hostContext}
|
|
747
|
+
.placeholder=${i18next.t('figure.text.dock-placeholder')}
|
|
748
|
+
@board-ai-proposal-execute=${(e: CustomEvent) => this.takeProposal(e.detail.proposal)}
|
|
749
|
+
></ox-board-ai-chat>
|
|
654
750
|
</div>
|
|
655
751
|
`
|
|
656
752
|
}
|
|
657
753
|
|
|
754
|
+
/*
|
|
755
|
+
* ── 대화 도크를 무엇으로 켜나 ───────────────────────────────────────────────
|
|
756
|
+
*
|
|
757
|
+
* board 의 컴포넌트를 그대로 쓰지만 **board 인 척하지 않는다.** `boardTools` 를 끄고 figure 의
|
|
758
|
+
* 도구 범주(`figure-authoring`)만 연다. 끄지 않으면 보드 편집 도구가 함께 들려, 모델이 이
|
|
759
|
+
* 화면에서 할 수 없는 일을 시도한다.
|
|
760
|
+
*
|
|
761
|
+
* board 모양의 인자(`currentBoard` · `knownTypes` · `componentSchemas` · `selectedRefids`)는
|
|
762
|
+
* 주지 않는다 — 전부 선택이고, 채우려면 없는 것을 지어내야 한다.
|
|
763
|
+
*/
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* 어시스턴트가 「지금 무엇을 열고 있나」를 아는 길.
|
|
767
|
+
*
|
|
768
|
+
* 도구가 대상을 안 받았을 때 이 문맥에서 해소한다 — 사용자에게 식별자를 되묻지 않는다.
|
|
769
|
+
* 팔레트도 함께 보낸다: 모르면 모델이 색을 지어내고, 그 후보는 검증을 지나 **그리는 시점에**
|
|
770
|
+
* 죽는다.
|
|
771
|
+
*/
|
|
772
|
+
private get hostContext() {
|
|
773
|
+
return {
|
|
774
|
+
surface: 'figure-modeller',
|
|
775
|
+
figureId: this.figure?.id || undefined,
|
|
776
|
+
figureType: this.board?.figureType,
|
|
777
|
+
figureName: this.figure?.name,
|
|
778
|
+
palette: Object.keys(activePalette() as Record<string, string>)
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* 도크의 후보를 받는다.
|
|
784
|
+
*
|
|
785
|
+
* **후보가 화면에 닿는 길은 하나뿐이다** — 말로 시키는 줄이든 도크든 `receive()` 로 모인다.
|
|
786
|
+
* 두 길을 두면 「지금 / 후보」 두 칸을 두 곳에서 그리게 되고, 어느 쪽이 이기는지 저작자가
|
|
787
|
+
* 매번 생각해야 한다.
|
|
788
|
+
*/
|
|
789
|
+
private takeProposal(proposal: any) {
|
|
790
|
+
const source = proposal?.source
|
|
791
|
+
if (!source) {
|
|
792
|
+
// 카드는 왔는데 후보가 없다 — 조용히 넘기지 않는다. 저작자가 눌렀으니 답이 있어야 한다.
|
|
793
|
+
this.saveFailure = i18next.t('figure.text.proposal-had-no-source')
|
|
794
|
+
return
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
this.receive({
|
|
798
|
+
source: JSON.stringify(source),
|
|
799
|
+
grade: proposal.score?.grade ?? '',
|
|
800
|
+
triangles: proposal.cost?.triangles ?? 0,
|
|
801
|
+
groups: proposal.cost?.groups ?? 0,
|
|
802
|
+
attempts: proposal.attempts ?? 1
|
|
803
|
+
})
|
|
804
|
+
}
|
|
805
|
+
|
|
658
806
|
/**
|
|
659
807
|
* 가운데 칸 위의 띠 — 무엇을 보고 있나와, 양쪽 칸을 접는 손잡이.
|
|
660
808
|
*
|
|
@@ -677,10 +825,10 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
677
825
|
<button
|
|
678
826
|
mode
|
|
679
827
|
?on=${this.mode === mode}
|
|
680
|
-
title=${i18next.t('text.mode-' + mode + '-explained')}
|
|
828
|
+
title=${i18next.t('figure.text.mode-' + mode + '-explained')}
|
|
681
829
|
@click=${() => (this.mode = mode)}
|
|
682
830
|
>
|
|
683
|
-
${i18next.t('label.mode-' + mode)}
|
|
831
|
+
${i18next.t('figure.label.mode-' + mode)}
|
|
684
832
|
</button>
|
|
685
833
|
`
|
|
686
834
|
|
|
@@ -706,7 +854,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
706
854
|
return html`
|
|
707
855
|
<button
|
|
708
856
|
collapse
|
|
709
|
-
title=${i18next.t(`text.${gone ? 'expand' : 'collapse'}-${pane}-pane`)}
|
|
857
|
+
title=${i18next.t(`figure.text.${gone ? 'expand' : 'collapse'}-${pane}-pane`)}
|
|
710
858
|
@click=${() => this.toggleCollapse(side)}
|
|
711
859
|
>
|
|
712
860
|
<md-icon>${gone ? back : shut}</md-icon>
|
|
@@ -755,11 +903,11 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
755
903
|
|
|
756
904
|
return html`
|
|
757
905
|
<div decide>
|
|
758
|
-
<span>${i18next.t('text.assistant-proposed-a-figure')}</span>
|
|
906
|
+
<span>${i18next.t('figure.text.assistant-proposed-a-figure')}</span>
|
|
759
907
|
<div spacer></div>
|
|
760
|
-
<button drop @click=${() => this.discard()}>${i18next.t('button.discard')}</button>
|
|
908
|
+
<button drop @click=${() => this.discard()}>${i18next.t('figure.button.discard')}</button>
|
|
761
909
|
<button take ?disabled=${errors.length > 0 || this.picked.size === 0} @click=${() => this.take()}>
|
|
762
|
-
${i18next.t('button.take-n-changes', { n: this.picked.size })}
|
|
910
|
+
${i18next.t('figure.button.take-n-changes', { n: this.picked.size })}
|
|
763
911
|
</button>
|
|
764
912
|
</div>
|
|
765
913
|
|
|
@@ -771,7 +919,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
771
919
|
`
|
|
772
920
|
: ''}
|
|
773
921
|
${errors.length > 0
|
|
774
|
-
? html`<p blocked>${i18next.t('text.picked-changes-do-not-validate')} — ${errors[0].message}</p>`
|
|
922
|
+
? html`<p blocked>${i18next.t('figure.text.picked-changes-do-not-validate')} — ${errors[0].message}</p>`
|
|
775
923
|
: violations.length > 0
|
|
776
924
|
? html`<p blocked warn>${violations[0].message}</p>`
|
|
777
925
|
: ''}
|
|
@@ -796,7 +944,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
796
944
|
<button
|
|
797
945
|
change
|
|
798
946
|
?on=${on}
|
|
799
|
-
title=${i18next.t('text.change-' + change.kind)}
|
|
947
|
+
title=${i18next.t('figure.text.change-' + change.kind)}
|
|
800
948
|
@click=${() => this.toggle(change.key)}
|
|
801
949
|
>
|
|
802
950
|
<md-icon>${icon}</md-icon>
|
|
@@ -866,9 +1014,18 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
866
1014
|
*
|
|
867
1015
|
* 형식을 어긴 원본 데이터로는 저장을 누를 수 없게 한다. 눌렀다가 서버가 받아주지 않는 것보다,
|
|
868
1016
|
* 누를 수 없는 이유가 판단 패널에 떠 있는 것이 낫다.
|
|
1017
|
+
*
|
|
1018
|
+
* ## 바뀐 것이 없으면 누를 수 없다
|
|
1019
|
+
*
|
|
1020
|
+
* **`dirty` 를 안 보고 있었다.** 저장한 직후에도 단추가 살아 있어 같은 정본을 몇 번이고 다시 쓸
|
|
1021
|
+
* 수 있었고, 저장마다 썸네일을 새로 찍어 20KB 를 다시 넣고 `thumbnailUpdatedAt` 을 올렸다 —
|
|
1022
|
+
* 그림 주소의 판이 바뀌므로 브라우저 캐시도 함께 버려진다. 바뀐 것이 없는데 일어날 일이 아니다.
|
|
1023
|
+
*
|
|
1024
|
+
* 새로 만드는 중인 것은 `startNew` 가 `dirty` 로 시작하므로 첫 저장이 막히지 않는다.
|
|
1025
|
+
* 저장이 거절되면 `dirty` 를 그대로 두므로 다시 누를 수 있다.
|
|
869
1026
|
*/
|
|
870
1027
|
private get canSave(): boolean {
|
|
871
|
-
if (this.saving || !this.folded || !this.figure?.name) {
|
|
1028
|
+
if (this.saving || !this.dirty || !this.folded || !this.figure?.name) {
|
|
872
1029
|
return false
|
|
873
1030
|
}
|
|
874
1031
|
return validate(this.folded).errors.length === 0
|
|
@@ -880,9 +1037,41 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
880
1037
|
}
|
|
881
1038
|
|
|
882
1039
|
const id = lifecycle?.resourceId
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1040
|
+
|
|
1041
|
+
if (id) {
|
|
1042
|
+
if (id !== this.figure?.id) {
|
|
1043
|
+
await this.load(id)
|
|
1044
|
+
}
|
|
1045
|
+
return
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/*
|
|
1049
|
+
── id 없이 들어온 것은 「새로 만든다」는 뜻이다 ─────────────────────────────
|
|
1050
|
+
전에는 `!this.figure` 일 때만 새로 시작했다. 셸은 페이지를 살려 두므로(MDI 탭) 카탈로그에서
|
|
1051
|
+
하나 열어 본 뒤에는 이 페이지가 그 도형을 계속 들고 있고, 그래서 「새 figure」가 **아무 일도
|
|
1052
|
+
하지 않았다.**
|
|
1053
|
+
|
|
1054
|
+
그것보다 나쁜 것이 있었다 — 화면에는 옛 도형이 그대로 있으니 사람은 새 것인 줄 알고 고치고
|
|
1055
|
+
저장한다. 그러면 **열려 있던 도형에 덮어쓴다.** 「안 열린다」로 보이던 것이 실은 그 문이었다.
|
|
1056
|
+
|
|
1057
|
+
들고 있는 것이 **저장된 도형이면**(id 가 있으면) 새로 시작한다. 아직 저장 안 한 새 도형을
|
|
1058
|
+
들고 있으면 그대로 둔다 — 페이지를 다시 들렀다고 저작 중인 것을 버리지 않는다.
|
|
1059
|
+
*/
|
|
1060
|
+
if (!this.figure) {
|
|
1061
|
+
this.startNew()
|
|
1062
|
+
return
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
if (this.figure.id) {
|
|
1066
|
+
/*
|
|
1067
|
+
고치던 것이 있으면 묻는다. 저작한 것을 말없이 버리지 않는다 — 되돌릴 수 없다.
|
|
1068
|
+
그만두면 보고 있던 도형의 주소로 되돌려 화면과 주소가 어긋나지 않게 한다.
|
|
1069
|
+
*/
|
|
1070
|
+
if (this.dirty && !confirm(i18next.t('figure.text.discard-changes-and-start-new'))) {
|
|
1071
|
+
navigate(`figure-modeller/${this.figure.id}`, true)
|
|
1072
|
+
return
|
|
1073
|
+
}
|
|
1074
|
+
|
|
886
1075
|
this.startNew()
|
|
887
1076
|
}
|
|
888
1077
|
}
|
|
@@ -892,8 +1081,14 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
892
1081
|
|
|
893
1082
|
this.figure = figure
|
|
894
1083
|
|
|
895
|
-
/*
|
|
896
|
-
|
|
1084
|
+
/*
|
|
1085
|
+
그림이 없으면 이 자리에서 채운다(아래 `fillThumbnail`). 기다리지 않는다 — 화면이 먼저다.
|
|
1086
|
+
|
|
1087
|
+
**`thumbnail` 이 아니라 `thumbnailUpdatedAt` 으로 판정한다.** 그림 자체는 목록·낱개 질의가
|
|
1088
|
+
가져오지 않는다(base64 라서 무겁고 캐시가 안 된다 — 주소로 부른다). 없는 칸으로 판정하면
|
|
1089
|
+
늘 「그림이 없다」가 되어 저작면을 열 때마다 다시 찍어 저장하게 된다.
|
|
1090
|
+
*/
|
|
1091
|
+
if (!figure.thumbnailUpdatedAt && figure.id) {
|
|
897
1092
|
void this.fillThumbnail(figure.id)
|
|
898
1093
|
}
|
|
899
1094
|
|
|
@@ -927,7 +1122,8 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
927
1122
|
this.figure = { id: '', type: draftType, name: '' } as Figure
|
|
928
1123
|
this.board = board
|
|
929
1124
|
this.parts = parts
|
|
930
|
-
|
|
1125
|
+
/* 고른 것이 없다 — 부품이 없으니 속성 패널도 고를 것을 기다린다. */
|
|
1126
|
+
this.selected = -1
|
|
931
1127
|
this.dirty = true
|
|
932
1128
|
this.violations = []
|
|
933
1129
|
}
|
|
@@ -973,6 +1169,17 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
973
1169
|
this.put(edits.updatePart(this.parts, index, part))
|
|
974
1170
|
}
|
|
975
1171
|
|
|
1172
|
+
/**
|
|
1173
|
+
* 판 자체의 값을 갈아 끼운다 — 능력처럼 부품보다 위에 있는 것들.
|
|
1174
|
+
*
|
|
1175
|
+
* 부품 목록은 건드리지 않는다. `put` 은 부품을 함께 받으므로 여기서 쓰면 능력 하나를
|
|
1176
|
+
* 고칠 때마다 부품 목록이 새 배열이 되고, 그리는 쪽이 전부 다시 그린다.
|
|
1177
|
+
*/
|
|
1178
|
+
private updateBoard(board: BoardModel) {
|
|
1179
|
+
this.board = board
|
|
1180
|
+
this.dirty = true
|
|
1181
|
+
}
|
|
1182
|
+
|
|
976
1183
|
/**
|
|
977
1184
|
* 디테일 등급을 바꾼다.
|
|
978
1185
|
*
|
|
@@ -1101,8 +1308,9 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
1101
1308
|
}
|
|
1102
1309
|
|
|
1103
1310
|
try {
|
|
1104
|
-
await updateFigure(id, { thumbnail })
|
|
1105
|
-
|
|
1311
|
+
const { figure } = await updateFigure(id, { thumbnail })
|
|
1312
|
+
/* 서버가 찍은 시각을 그대로 받는다 — 이 값이 그림을 부르는 주소의 판 번호가 된다. */
|
|
1313
|
+
this.figure = { ...this.figure, thumbnailUpdatedAt: figure?.thumbnailUpdatedAt }
|
|
1106
1314
|
} catch (e) {
|
|
1107
1315
|
/* 볼 권한만 있는 사람일 수 있다. 화면은 그대로 두고 조용히 넘어간다. */
|
|
1108
1316
|
console.warn(`[thumbnail] ${id} 를 채우지 못했습니다 — ${(e as Error).message}`)
|
|
@@ -1115,6 +1323,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
1115
1323
|
}
|
|
1116
1324
|
|
|
1117
1325
|
this.saving = true
|
|
1326
|
+
this.saveFailure = ''
|
|
1118
1327
|
try {
|
|
1119
1328
|
const sourceJson = JSON.stringify(this.folded)
|
|
1120
1329
|
/*
|
|
@@ -1140,7 +1349,7 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
1140
1349
|
// 만든 뒤에는 고칠 수 없으므로 여기서 걸러야 한다.
|
|
1141
1350
|
const taken = await fetchFigureTypeNames()
|
|
1142
1351
|
if (taken.includes(this.folded.type)) {
|
|
1143
|
-
throw new Error(i18next.t('text.type-name-already-taken', { type: this.folded.type }))
|
|
1352
|
+
throw new Error(i18next.t('figure.text.type-name-already-taken', { type: this.folded.type }))
|
|
1144
1353
|
}
|
|
1145
1354
|
|
|
1146
1355
|
const result = await createFigure({
|
|
@@ -1155,6 +1364,14 @@ export class FigureModellerPage extends FigureModellerPageBase {
|
|
|
1155
1364
|
}
|
|
1156
1365
|
|
|
1157
1366
|
this.dirty = false
|
|
1367
|
+
} catch (e) {
|
|
1368
|
+
/*
|
|
1369
|
+
**서버가 말한 사유를 그대로 올린다.** 여기서 문장을 다시 지으면 무엇이 걸렸는지 알 수 없다 —
|
|
1370
|
+
타입 이름이 이미 쓰였다는 것과 권한이 없다는 것은 저작자가 할 일이 다르다.
|
|
1371
|
+
|
|
1372
|
+
`dirty` 는 건드리지 않는다. 저장이 안 됐으므로 미저장인 것이 사실이다.
|
|
1373
|
+
*/
|
|
1374
|
+
this.saveFailure = (e as Error).message
|
|
1158
1375
|
} finally {
|
|
1159
1376
|
this.saving = false
|
|
1160
1377
|
}
|
package/client/types.ts
CHANGED
|
@@ -111,3 +111,28 @@ export interface FigureProposal {
|
|
|
111
111
|
/** 몇 번 만에 됐나. 진단용이다. */
|
|
112
112
|
attempts: number
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 발행 판정 한 줄.
|
|
117
|
+
*
|
|
118
|
+
* `FigureFinding` 과 달리 **`blocking` 이 있다.** 저장 쪽 발견은 정의상 막지 않는 것들이고,
|
|
119
|
+
* 발행 판정은 막는 것과 알리는 것을 함께 내므로 어느 쪽인지를 값이 스스로 말한다 — 코드를 보고
|
|
120
|
+
* 화면이 다시 분류하면 규칙이 두 벌이 된다.
|
|
121
|
+
*/
|
|
122
|
+
export interface FigureGateFinding {
|
|
123
|
+
code: string
|
|
124
|
+
message: string
|
|
125
|
+
/** 왜 그것이 문제인가 — 사람이 무엇을 보게 되나. */
|
|
126
|
+
why?: string
|
|
127
|
+
/** 무엇을 바꾸면 되나 — 부품 이름과 값으로. */
|
|
128
|
+
how?: string
|
|
129
|
+
/** 갈라진 부품 이름들, 또는 정본 안의 경로. */
|
|
130
|
+
at?: string
|
|
131
|
+
blocking: boolean
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** 발행해도 되나. `blocked` 면 서버가 거절한다. */
|
|
135
|
+
export interface FigureInspection {
|
|
136
|
+
blocked: boolean
|
|
137
|
+
findings: FigureGateFinding[]
|
|
138
|
+
}
|