@things-factory/figure-ui 10.1.38 → 10.1.40

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 (50) hide show
  1. package/client/graphql/index.ts +53 -0
  2. package/client/modeller/figure-history-panel.ts +11 -85
  3. package/client/modeller/figure-v3-properties.ts +254 -0
  4. package/client/modeller/figure-v3-verdict.ts +247 -0
  5. package/client/modeller/gate-findings.ts +105 -0
  6. package/client/modeller/v3-canvas.ts +27 -3
  7. package/client/modeller/v3-editor.ts +39 -11
  8. package/client/modeller/v3-figure-facts.ts +53 -0
  9. package/client/modeller/v3-occupancy.ts +6 -2
  10. package/client/pages/figure-v3-modeller-page.ts +250 -17
  11. package/dist-client/graphql/index.d.ts +8 -0
  12. package/dist-client/graphql/index.js +51 -0
  13. package/dist-client/graphql/index.js.map +1 -1
  14. package/dist-client/modeller/figure-history-panel.d.ts +6 -0
  15. package/dist-client/modeller/figure-history-panel.js +9 -85
  16. package/dist-client/modeller/figure-history-panel.js.map +1 -1
  17. package/dist-client/modeller/figure-v3-properties.d.ts +46 -0
  18. package/dist-client/modeller/figure-v3-properties.js +259 -0
  19. package/dist-client/modeller/figure-v3-properties.js.map +1 -0
  20. package/dist-client/modeller/figure-v3-verdict.d.ts +50 -0
  21. package/dist-client/modeller/figure-v3-verdict.js +268 -0
  22. package/dist-client/modeller/figure-v3-verdict.js.map +1 -0
  23. package/dist-client/modeller/gate-findings.d.ts +12 -0
  24. package/dist-client/modeller/gate-findings.js +102 -0
  25. package/dist-client/modeller/gate-findings.js.map +1 -0
  26. package/dist-client/modeller/v3-canvas.d.ts +6 -0
  27. package/dist-client/modeller/v3-canvas.js +27 -3
  28. package/dist-client/modeller/v3-canvas.js.map +1 -1
  29. package/dist-client/modeller/v3-editor.js +39 -11
  30. package/dist-client/modeller/v3-editor.js.map +1 -1
  31. package/dist-client/modeller/v3-figure-facts.d.ts +26 -0
  32. package/dist-client/modeller/v3-figure-facts.js +34 -0
  33. package/dist-client/modeller/v3-figure-facts.js.map +1 -0
  34. package/dist-client/modeller/v3-occupancy.d.ts +5 -1
  35. package/dist-client/modeller/v3-occupancy.js +4 -2
  36. package/dist-client/modeller/v3-occupancy.js.map +1 -1
  37. package/dist-client/pages/figure-v3-modeller-page.d.ts +40 -0
  38. package/dist-client/pages/figure-v3-modeller-page.js +264 -18
  39. package/dist-client/pages/figure-v3-modeller-page.js.map +1 -1
  40. package/dist-client/route.d.ts +1 -1
  41. package/dist-client/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +4 -4
  43. package/test/v3-properties.test.ts +93 -0
  44. package/test/v3-theme.test.ts +67 -0
  45. package/test/v3-verdict.test.ts +82 -0
  46. package/translations/en.json +12 -0
  47. package/translations/ja.json +12 -0
  48. package/translations/ko.json +12 -0
  49. package/translations/ms.json +12 -0
  50. package/translations/zh.json +12 -0
@@ -4,10 +4,14 @@ import { customElement, state } from 'lit/decorators.js';
4
4
  import { PageView } from '@operato/shell';
5
5
  import { createV3ProductSession } from '../modeller/v3-product-session.js';
6
6
  import { v3ProductStore } from '../graphql/v3-store.js';
7
- import { fetchFigure } from '../graphql/index.js';
7
+ import { i18next } from '@operato/i18n';
8
+ import { fetchFigure, updateFigure } from '../graphql/index.js';
8
9
  import { occupancyFromParts } from '../modeller/v3-occupancy.js';
9
10
  import '../modeller/v3-editor.js';
11
+ import '@material/web/icon/icon.js';
10
12
  import '../modeller/figure-history-panel.js';
13
+ import '../modeller/figure-v3-verdict.js';
14
+ import '../modeller/figure-v3-properties.js';
11
15
  /**
12
16
  * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.
13
17
  *
@@ -32,7 +36,17 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
32
36
  * 발행 판정에 막히는데 그 선언을 할 단추도 없었다(2026-09-24 확인). 서버의 문 하나가 두 형식을 다 읽으므로
33
37
  * V2 화면의 패널을 그대로 건다.
34
38
  */
35
- this.row = { version: 0 };
39
+ this.row = {
40
+ version: 0
41
+ };
42
+ this.typeError = '';
43
+ /** Why a command from the side did nothing. Shown beside the tabs — the editor stays, since nothing in it was lost. */
44
+ this.commandError = '';
45
+ /**
46
+ * Which tab the side shows. The verdict comes first: it is what the author needs while editing, and the count on
47
+ * its tab stays in sight while the history is open — as on the V2 page.
48
+ */
49
+ this.tab = 'verdict';
36
50
  this.wasDirty = false;
37
51
  this.announce = () => {
38
52
  const view = this.session.read();
@@ -50,7 +64,14 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
50
64
  };
51
65
  this.changed = () => {
52
66
  this.revision++;
67
+ /* Any edit after a failed command makes the message stale — the author has done something about it. */
68
+ this.commandError = '';
53
69
  const view = this.session.read();
70
+ /* The title bar reads the name through `context`, which the shell asks for only when told — a rename left it stale. */
71
+ if (view.name !== this.titled) {
72
+ this.titled = view.name;
73
+ this.updateContext();
74
+ }
54
75
  if (!view.saving)
55
76
  this.announce();
56
77
  /* 저장이 끝난 순간 행을 다시 읽는다 — 발행된 도형을 고쳐 저장하면 서버가 초안으로 내린다. */
@@ -58,20 +79,63 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
58
79
  this.readRow(view.id);
59
80
  this.wasDirty = !!view.dirty;
60
81
  };
82
+ /**
83
+ * 타입을 정한다 — 보드가 도형을 부르는 이름이고, 발행하면 굳는다(ADR-0063 결정 4).
84
+ *
85
+ * 새 V3 도형은 저장할 때 임시 타입을 받는데, 이 화면에는 그것을 바꿀 칸이 없어서 임시 타입 그대로 발행됐다.
86
+ * 행만 바뀐다 — V3 자산은 타입을 원본에 적지 않으므로(적으면 형식이 거절한다) 편집 중인 원본과 부딪히지 않는다.
87
+ * 서버의 거절(이미 쓰는 타입 · 발행 뒤)은 그 문장 그대로 칸 아래에 둔다.
88
+ */
89
+ this.renameType = async (event) => {
90
+ const input = event.target;
91
+ const id = this.session.read().id;
92
+ const wanted = input.value.trim().replace(/[^A-Za-z0-9_]/g, '_').toUpperCase();
93
+ input.value = wanted;
94
+ if (!id || !wanted || wanted === this.row.type)
95
+ return;
96
+ try {
97
+ const result = await updateFigure(id, { type: wanted });
98
+ this.typeError = '';
99
+ this.row = { ...this.row, type: result.figure.type };
100
+ }
101
+ catch (error) {
102
+ this.typeError = error instanceof Error ? error.message : String(error);
103
+ input.value = this.row.type ?? '';
104
+ }
105
+ };
61
106
  /** 「부품에 맞추기」 — 공간을 지금 부품에서 다시 선언한다. 저장은 저작자가 따로 한다. */
62
107
  this.fitToParts = () => {
108
+ this.runCommand(() => occupancyFromParts(this.session.source()));
109
+ };
110
+ /** A command from the properties tab — rename, declare the room, the mounting face. */
111
+ this.onCommand = (event) => {
112
+ const action = event.detail?.action;
113
+ if (action)
114
+ this.runCommand(() => action);
115
+ };
116
+ /**
117
+ * Category and tags — the catalogue's, kept on the row, not in the asset. Written at once, as the V2 page does;
118
+ * the server's refusal is shown as it gave it.
119
+ */
120
+ this.onCatalog = async (event) => {
121
+ const patch = event.detail;
122
+ const id = this.session.read().id;
123
+ if (!id || !patch)
124
+ return;
63
125
  try {
64
- this.session.command(occupancyFromParts(this.session.source()));
65
- this.changed();
126
+ const result = await updateFigure(id, patch);
127
+ this.commandError = '';
128
+ this.row = { ...this.row, category: result.figure.category ?? undefined, tags: result.figure.tags ?? undefined };
66
129
  }
67
130
  catch (error) {
68
- this.error = error instanceof Error ? error.message : String(error);
131
+ this.commandError = error instanceof Error ? error.message : String(error);
69
132
  }
70
133
  };
71
134
  this.released = (event) => {
72
135
  const figure = event.detail?.figure;
136
+ /* Keep the rest of the row: rebuilding it from these two dropped the type, and the locked type field went blank. */
73
137
  if (figure?.id && figure.id === this.session.read().id)
74
- this.row = { state: figure.state, version: figure.version ?? 0 };
138
+ this.row = { ...this.row, state: figure.state, version: figure.version ?? 0 };
75
139
  };
76
140
  /** 과거 판으로 되돌렸으면 서버의 원본이 바뀐 것이다 — 다시 연다. 패널은 저장 안 된 것이 있으면 되돌리기를 막는다. */
77
141
  this.reverted = async () => {
@@ -116,28 +180,145 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
116
180
  min-width: 0;
117
181
  min-height: 0;
118
182
  }
119
- figure-history-panel {
183
+ aside {
120
184
  width: 320px;
121
185
  flex: none;
122
186
  min-height: 0;
123
187
  overflow: auto;
188
+ display: flex;
189
+ flex-direction: column;
124
190
  border-left: 1px solid var(--md-sys-color-outline-variant);
125
191
  }
192
+ label[type-field] {
193
+ display: grid;
194
+ gap: 4px;
195
+ padding: 12px 12px 8px;
196
+ font-size: 12px;
197
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
198
+ }
199
+ label[type-field] input,
200
+ label[type-field] code {
201
+ font: inherit;
202
+ font-family: monospace;
203
+ padding: 6px 8px;
204
+ border: 1px solid var(--md-sys-color-outline-variant);
205
+ border-radius: 4px;
206
+ background: var(--md-sys-color-surface);
207
+ color: var(--md-sys-color-on-surface);
208
+ }
209
+ label[type-field] small {
210
+ color: var(--md-sys-color-on-surface-variant);
211
+ }
212
+ p[fit-error] {
213
+ margin: 0;
214
+ padding: 8px 12px;
215
+ font-size: 12px;
216
+ color: var(--md-sys-color-error);
217
+ }
218
+ label[type-field] small[role='alert'] {
219
+ color: var(--md-sys-color-error);
220
+ }
221
+ /* The V2 side panel's tabs, drawn the same way: one icon per tab, the name in title and aria-label. */
222
+ div[tabs] {
223
+ display: flex;
224
+ flex: none;
225
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
226
+ }
227
+ button[tab] {
228
+ flex: 1;
229
+ position: relative;
230
+ display: flex;
231
+ align-items: center;
232
+ justify-content: center;
233
+ padding: 7px 6px;
234
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
235
+ background: none;
236
+ border: none;
237
+ border-bottom: 2px solid transparent;
238
+ cursor: pointer;
239
+ }
240
+ button[tab]:hover:not([on]) {
241
+ background-color: var(--md-sys-color-surface-container);
242
+ }
243
+ button[tab][on] {
244
+ color: var(--md-sys-color-primary);
245
+ border-bottom-color: var(--md-sys-color-primary);
246
+ }
247
+ button[tab] md-icon {
248
+ font-size: 20px;
249
+ width: 20px;
250
+ height: 20px;
251
+ }
252
+ span[badge] {
253
+ position: absolute;
254
+ top: 5px;
255
+ right: 2px;
256
+ padding: 0 5px;
257
+ font-size: 0.62rem;
258
+ font-weight: 700;
259
+ line-height: 1.5;
260
+ color: var(--md-sys-color-on-primary-container);
261
+ background-color: var(--md-sys-color-primary-container);
262
+ border-radius: 999em;
263
+ pointer-events: none;
264
+ }
265
+ /* Hidden, not removed: the verdict keeps its last answer and the panel its list while the other tab is open. */
266
+ [off] {
267
+ display: none;
268
+ }
126
269
  .error {
127
270
  padding: 16px;
128
271
  color: #922716;
129
272
  }
130
273
  `; }
274
+ draftSource() {
275
+ try {
276
+ this.draft = this.session.source();
277
+ }
278
+ catch {
279
+ /* loading or saving — keep the last source */
280
+ }
281
+ return this.draft;
282
+ }
131
283
  async readRow(id) {
132
284
  try {
133
285
  const figure = await fetchFigure(id);
134
286
  if (this.session.read().id === id)
135
- this.row = { state: figure.state, version: figure.version ?? 0 };
287
+ this.row = {
288
+ state: figure.state,
289
+ version: figure.version ?? 0,
290
+ type: figure.type,
291
+ category: figure.category ?? undefined,
292
+ tags: figure.tags ?? undefined
293
+ };
136
294
  }
137
295
  catch {
138
296
  /* 행을 못 읽으면 패널은 판 번호 0 으로 보인다 — 발행 문이 서버에서 다시 판단하므로 여기서 지어내지 않는다. */
139
297
  }
140
298
  }
299
+ /**
300
+ * One step of the session's history, whichever part of the side asked for it — so undo takes it back like any
301
+ * other edit, and it is saved with the figure.
302
+ */
303
+ runCommand(actionOf) {
304
+ try {
305
+ this.session.command(actionOf());
306
+ this.commandError = '';
307
+ this.changed();
308
+ }
309
+ catch (error) {
310
+ /*
311
+ This used to set the page error, which replaces the whole editor with one raw line — for a figure with no
312
+ parts that line was 「OCCUPANCY_NO_PARTS: occupancy: no part could be measured」 (2026-09-24).
313
+ */
314
+ this.commandError =
315
+ error?.code === 'OCCUPANCY_NO_PARTS'
316
+ ? i18next.t('figure.text.fit-needs-parts')
317
+ : error instanceof Error
318
+ ? error.message
319
+ : String(error);
320
+ }
321
+ }
141
322
  connectedCallback() {
142
323
  super.connectedCallback();
143
324
  window.addEventListener('figure-ai-context-request', this.announce);
@@ -172,6 +353,7 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
172
353
  const discard = this.discardApproved;
173
354
  this.discardApproved = false;
174
355
  if (id) {
356
+ this.draft = undefined;
175
357
  const opening = this.session.open(id, { discard });
176
358
  this.changed();
177
359
  await opening;
@@ -179,7 +361,9 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
179
361
  }
180
362
  else {
181
363
  this.session.startNew({ discard });
364
+ this.draft = undefined;
182
365
  this.row = { version: 0 };
366
+ this.typeError = '';
183
367
  }
184
368
  this.routeId = id;
185
369
  this.error = '';
@@ -201,16 +385,62 @@ let FigureV3ModellerPage = class FigureV3ModellerPage extends PageView {
201
385
  .revision=${this.revision}
202
386
  @v3-changed=${this.changed}
203
387
  ></figure-v3-editor>
204
- <figure-history-panel
205
- format="v3"
206
- .figureId=${view.id}
207
- .figureState=${this.row.state}
208
- .figureVersion=${this.row.version}
209
- .dirty=${!!view.dirty}
210
- @fit-base-to-parts=${this.fitToParts}
211
- @figure-released=${this.released}
212
- @figure-reverted=${this.reverted}
213
- ></figure-history-panel>`;
388
+ <aside>
389
+ <label type-field>
390
+ <span>${i18next.t('figure.label.figure-type')}</span>
391
+ ${this.row.version > 0
392
+ ? html `<code>${this.row.type}</code><small>${i18next.t('figure.text.type-name-cannot-change')}</small>`
393
+ : html `<input
394
+ .value=${this.row.type ?? ''}
395
+ placeholder=${i18next.t('figure.text.figure-type-placeholder')}
396
+ ?disabled=${!view.id}
397
+ @change=${this.renameType}
398
+ />`}
399
+ ${this.typeError ? html `<small role="alert">${this.typeError}</small>` : ''}
400
+ </label>
401
+ ${this.commandError ? html `<p fit-error role="alert">${this.commandError}</p>` : ''}
402
+ <div tabs>
403
+ ${this.renderTab('properties', 'tune', i18next.t('figure.label.properties'))}
404
+ ${this.renderTab('verdict', 'insights', i18next.t('figure.label.maturity'), this.instances)}
405
+ ${this.renderTab('history', 'history', i18next.t('figure.label.history'))}
406
+ </div>
407
+ <figure-v3-properties
408
+ ?off=${this.tab !== 'properties'}
409
+ .source=${this.draftSource()}
410
+ .figureId=${view.id}
411
+ .figureCategory=${this.row.category}
412
+ .figureTags=${this.row.tags}
413
+ @v3-command=${this.onCommand}
414
+ @v3-catalog=${this.onCatalog}
415
+ ></figure-v3-properties>
416
+ <figure-v3-verdict
417
+ ?off=${this.tab !== 'verdict'}
418
+ .source=${this.draftSource()}
419
+ .figureId=${view.id}
420
+ .figureType=${this.row.type}
421
+ @capacity-changed=${(event) => (this.instances = event.detail.instances)}
422
+ @fit-base-to-parts=${this.fitToParts}
423
+ ></figure-v3-verdict>
424
+ <figure-history-panel
425
+ ?off=${this.tab !== 'history'}
426
+ format="v3"
427
+ .figureId=${view.id}
428
+ .figureState=${this.row.state}
429
+ .figureVersion=${this.row.version}
430
+ .figureType=${this.row.type}
431
+ .dirty=${!!view.dirty}
432
+ @fit-base-to-parts=${this.fitToParts}
433
+ @figure-released=${this.released}
434
+ @figure-reverted=${this.reverted}
435
+ ></figure-history-panel>
436
+ </aside>`;
437
+ }
438
+ renderTab(tab, icon, label, badge) {
439
+ return html `
440
+ <button tab ?on=${this.tab === tab} title=${label} aria-label=${label} @click=${() => (this.tab = tab)}>
441
+ <md-icon>${icon}</md-icon>${badge == null ? '' : html `<span badge>${badge.toLocaleString()}</span>`}
442
+ </button>
443
+ `;
214
444
  }
215
445
  };
216
446
  __decorate([
@@ -225,6 +455,22 @@ __decorate([
225
455
  state(),
226
456
  __metadata("design:type", Object)
227
457
  ], FigureV3ModellerPage.prototype, "row", void 0);
458
+ __decorate([
459
+ state(),
460
+ __metadata("design:type", Object)
461
+ ], FigureV3ModellerPage.prototype, "typeError", void 0);
462
+ __decorate([
463
+ state(),
464
+ __metadata("design:type", Object)
465
+ ], FigureV3ModellerPage.prototype, "commandError", void 0);
466
+ __decorate([
467
+ state(),
468
+ __metadata("design:type", String)
469
+ ], FigureV3ModellerPage.prototype, "tab", void 0);
470
+ __decorate([
471
+ state(),
472
+ __metadata("design:type", Number)
473
+ ], FigureV3ModellerPage.prototype, "instances", void 0);
228
474
  FigureV3ModellerPage = __decorate([
229
475
  customElement('figure-v3-modeller-page')
230
476
  ], FigureV3ModellerPage);
@@ -1 +1 @@
1
- {"version":3,"file":"figure-v3-modeller-page.js","sourceRoot":"","sources":["../../client/pages/figure-v3-modeller-page.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,0BAA0B,CAAA;AACjC,OAAO,qCAAqC,CAAA;AAE5C;;;;;;;;GAQG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ;IAA3C;;QA+BY,YAAO,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAA;QAEzD,oBAAe,GAAG,KAAK,CAAA;QACd,aAAQ,GAAG,CAAC,CAAA;QACZ,UAAK,GAAG,EAAE,CAAA;QAC3B;;;;;;;WAOG;QACc,QAAG,GAAsD,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;QAChF,aAAQ,GAAG,KAAK,CAAA;QAChB,aAAQ,GAAG,GAAG,EAAE;YACtB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,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K,EAAE;;mDAAmB;AASV;IAAhB,KAAK,EAAE;;iDAAgF;AA5C7E,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAkLhC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { createV3ProductSession } from '../modeller/v3-product-session.js'\nimport { v3ProductStore } from '../graphql/v3-store.js'\nimport { fetchFigure } from '../graphql/index.js'\nimport { occupancyFromParts } from '../modeller/v3-occupancy.js'\nimport '../modeller/v3-editor.js'\nimport '../modeller/figure-history-panel.js'\n\n/**\n * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.\n *\n * It answers to `figure-v3-modeller` while the catalogue's assets are still V2. The designer's order switches\n * the production data and the consuming paths together (ADR-0087, step 5): until the assets are converted, a\n * `figure-modeller` that opened this page would fail on every figure in the catalogue. Having its own route\n * is what makes steps 3 and 4 — the conversion on a recoverable copy, and the canvas check — possible at all.\n * At step 5 the V2 page goes, and this one takes the `figure-modeller` name and route.\n */\n@customElement('figure-v3-modeller-page')\nexport class FigureV3ModellerPage extends PageView {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n height: 100%;\n min-height: 0;\n /*\n The page must fit the width it is given. Without this the shell sizes it to its content — the editor's\n 660 plus the 320 release panel — and the panel runs off the right edge (seen at 945 px, 2026-09-24). The\n V2 page does the same.\n */\n overflow: hidden;\n }\n figure-v3-editor {\n flex: 1;\n min-width: 0;\n min-height: 0;\n }\n figure-history-panel {\n width: 320px;\n flex: none;\n min-height: 0;\n overflow: auto;\n border-left: 1px solid var(--md-sys-color-outline-variant);\n }\n .error {\n padding: 16px;\n color: #922716;\n }\n `\n private readonly session = createV3ProductSession(v3ProductStore)\n private routeId: string | undefined\n private discardApproved = false\n @state() private revision = 0\n @state() private error = ''\n /**\n * 발행 패널이 읽는 행의 사실 — 상태와 발행 판 번호. 원본은 세션이 들고, 이 둘은 행에 있다.\n *\n * 이 화면에는 발행 패널이 없었다. 저장은 되고 발행 · 판본 · 복원 · 판정을 볼 자리가 없어서, ADR-0087 5단계에서\n * `figure-modeller` 가 이 화면으로 바뀌면 저작자는 발행을 할 수 없었다. 새 V3 도형은 공간을 선언하기 전에는 전부\n * 발행 판정에 막히는데 그 선언을 할 단추도 없었다(2026-09-24 확인). 서버의 문 하나가 두 형식을 다 읽으므로\n * V2 화면의 패널을 그대로 건다.\n */\n @state() private row: { state?: 'draft' | 'released'; version: number } = { version: 0 }\n private wasDirty = false\n private announce = () => {\n const view = this.session.read()\n if (!this.active || view.loading || view.saving || view.error || !view.context) return\n window.dispatchEvent(\n new CustomEvent('figure-ai-context', {\n detail: {\n figureId: view.id,\n source: JSON.parse(this.session.source()),\n context: view.context,\n revision: view.revision,\n format: 'v3'\n }\n })\n )\n }\n private changed = () => {\n this.revision++\n const view = this.session.read()\n if (!view.saving) this.announce()\n /* 저장이 끝난 순간 행을 다시 읽는다 — 발행된 도형을 고쳐 저장하면 서버가 초안으로 내린다. */\n if (this.wasDirty && !view.dirty && !view.saving && view.id) this.readRow(view.id)\n this.wasDirty = !!view.dirty\n }\n private async readRow(id: string) {\n try {\n const figure = await fetchFigure(id)\n if (this.session.read().id === id) this.row = { state: figure.state as 'draft' | 'released', version: figure.version ?? 0 }\n } catch {\n /* 행을 못 읽으면 패널은 판 번호 0 으로 보인다 — 발행 문이 서버에서 다시 판단하므로 여기서 지어내지 않는다. */\n }\n }\n /** 「부품에 맞추기」 — 공간을 지금 부품에서 다시 선언한다. 저장은 저작자가 따로 한다. */\n private fitToParts = () => {\n try {\n this.session.command(occupancyFromParts(this.session.source()))\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n private released = (event: Event) => {\n const figure = (event as CustomEvent).detail?.figure\n if (figure?.id && figure.id === this.session.read().id) this.row = { state: figure.state, version: figure.version ?? 0 }\n }\n /** 과거 판으로 되돌렸으면 서버의 원본이 바뀐 것이다 — 다시 연다. 패널은 저장 안 된 것이 있으면 되돌리기를 막는다. */\n private reverted = async () => {\n const id = this.session.read().id\n if (!id) return\n await this.session.open(id, { discard: true })\n this.changed()\n this.readRow(id)\n }\n /** The dock must explicitly use this checked transaction contract, never an unversioned overwrite. */\n private applyAI = (event: Event) => {\n const detail = (event as CustomEvent).detail\n if (!this.active || !detail) return\n try {\n this.session.apply(detail.changes, 'ai', detail.revision, detail.context)\n detail.applied = true\n this.changed()\n } catch (error) {\n detail.applied = false\n detail.error = error instanceof Error ? error.message : String(error)\n }\n }\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener('figure-ai-context-request', this.announce)\n window.addEventListener('figure-v3-apply', this.applyAI)\n }\n disconnectedCallback() {\n window.removeEventListener('figure-ai-context-request', this.announce)\n window.removeEventListener('figure-v3-apply', this.applyAI)\n super.disconnectedCallback()\n }\n async canDeactivate() {\n const view = this.session.read()\n if (view.saving) return false\n if (!view.dirty) return true\n // The shell invokes this while the edited model is still visible, before navigating away.\n this.discardApproved = window.confirm('저장하지 않은 변경을 버리고 이동하시겠습니까?')\n return this.discardApproved\n }\n async pageUpdated(changes: Record<string, unknown>, lifecycle: { resourceId?: string }) {\n if (!this.active) {\n if (this.session.read().loading) this.session.close()\n window.dispatchEvent(new CustomEvent('figure-ai-context', { detail: undefined }))\n return\n }\n const id = lifecycle?.resourceId\n if (this.session.read().context && id === this.routeId && !changes.active) return\n try {\n const discard = this.discardApproved\n this.discardApproved = false\n if (id) {\n const opening = this.session.open(id, { discard })\n this.changed()\n await opening\n this.readRow(id)\n } else {\n this.session.startNew({ discard })\n this.row = { version: 0 }\n }\n this.routeId = id\n this.error = ''\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n get context() {\n return { title: this.session.read().name ?? 'Figure', actions: [] }\n }\n render() {\n if (this.error) return html`<p role=\"alert\" class=\"error\">${this.error}</p>`\n const view = this.session.read()\n return html`<figure-v3-editor\n .session=${this.session}\n .revision=${this.revision}\n @v3-changed=${this.changed}\n ></figure-v3-editor>\n <figure-history-panel\n format=\"v3\"\n .figureId=${view.id}\n .figureState=${this.row.state}\n .figureVersion=${this.row.version}\n .dirty=${!!view.dirty}\n @fit-base-to-parts=${this.fitToParts}\n @figure-released=${this.released}\n @figure-reverted=${this.reverted}\n ></figure-history-panel>`\n }\n}\n"]}
1
+ {"version":3,"file":"figure-v3-modeller-page.js","sourceRoot":"","sources":["../../client/pages/figure-v3-modeller-page.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,0BAA0B,CAAA;AACjC,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,kCAAkC,CAAA;AACzC,OAAO,qCAAqC,CAAA;AAE5C;;;;;;;;GAQG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ;IAA3C;;QA8GY,YAAO,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAA;QAEzD,oBAAe,GAAG,KAAK,CAAA;QACd,aAAQ,GAAG,CAAC,CAAA;QACZ,UAAK,GAAG,EAAE,CAAA;QAC3B;;;;;;;WAOG;QACc,QAAG,GAAyG;YAC3H,OAAO,EAAE,CAAC;SACX,CAAA;QACgB,cAAS,GAAG,EAAE,CAAA;QAC/B,uHAAuH;QACtG,iBAAY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G,KAAK,GAAG,UAAU,KAAK,eAAe,KAAK,WAAW,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;mBACzF,IAAI,aAAa,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA,eAAe,KAAK,CAAC,cAAc,EAAE,SAAS;;KAEtG,CAAA;IACH,CAAC;;AApSgB;IAAhB,KAAK,EAAE;;sDAAqB;AACZ;IAAhB,KAAK,EAAE;;mDAAmB;AASV;IAAhB,KAAK,EAAE;;iDAEP;AACgB;IAAhB,KAAK,EAAE;;uDAAuB;AAEd;IAAhB,KAAK,EAAE;;0DAA0B;AAKjB;IAAhB,KAAK,EAAE;;iDAA8D;AACrD;IAAhB,KAAK,EAAE;;uDAA2B;AAtIxB,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAsZhC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { createV3ProductSession } from '../modeller/v3-product-session.js'\nimport { v3ProductStore } from '../graphql/v3-store.js'\nimport { i18next } from '@operato/i18n'\nimport { fetchFigure, updateFigure } from '../graphql/index.js'\nimport { occupancyFromParts } from '../modeller/v3-occupancy.js'\nimport type { V3AuthoringAction } from '@hatiolab/figure-model'\nimport '../modeller/v3-editor.js'\nimport '@material/web/icon/icon.js'\nimport '../modeller/figure-history-panel.js'\nimport '../modeller/figure-v3-verdict.js'\nimport '../modeller/figure-v3-properties.js'\n\n/**\n * The V3 product page has exactly one authoritative workspace for UI and AI input transactions.\n *\n * It answers to `figure-v3-modeller` while the catalogue's assets are still V2. The designer's order switches\n * the production data and the consuming paths together (ADR-0087, step 5): until the assets are converted, a\n * `figure-modeller` that opened this page would fail on every figure in the catalogue. Having its own route\n * is what makes steps 3 and 4 — the conversion on a recoverable copy, and the canvas check — possible at all.\n * At step 5 the V2 page goes, and this one takes the `figure-modeller` name and route.\n */\n@customElement('figure-v3-modeller-page')\nexport class FigureV3ModellerPage extends PageView {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n height: 100%;\n min-height: 0;\n /*\n The page must fit the width it is given. Without this the shell sizes it to its content — the editor's\n 660 plus the 320 release panel — and the panel runs off the right edge (seen at 945 px, 2026-09-24). The\n V2 page does the same.\n */\n overflow: hidden;\n }\n figure-v3-editor {\n flex: 1;\n min-width: 0;\n min-height: 0;\n }\n aside {\n width: 320px;\n flex: none;\n min-height: 0;\n overflow: auto;\n display: flex;\n flex-direction: column;\n border-left: 1px solid var(--md-sys-color-outline-variant);\n }\n label[type-field] {\n display: grid;\n gap: 4px;\n padding: 12px 12px 8px;\n font-size: 12px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n label[type-field] input,\n label[type-field] code {\n font: inherit;\n font-family: monospace;\n padding: 6px 8px;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 4px;\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n label[type-field] small {\n color: var(--md-sys-color-on-surface-variant);\n }\n p[fit-error] {\n margin: 0;\n padding: 8px 12px;\n font-size: 12px;\n color: var(--md-sys-color-error);\n }\n label[type-field] small[role='alert'] {\n color: var(--md-sys-color-error);\n }\n /* The V2 side panel's tabs, drawn the same way: one icon per tab, the name in title and aria-label. */\n div[tabs] {\n display: flex;\n flex: none;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n button[tab] {\n flex: 1;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 7px 6px;\n color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n cursor: pointer;\n }\n button[tab]:hover:not([on]) {\n background-color: var(--md-sys-color-surface-container);\n }\n button[tab][on] {\n color: var(--md-sys-color-primary);\n border-bottom-color: var(--md-sys-color-primary);\n }\n button[tab] md-icon {\n font-size: 20px;\n width: 20px;\n height: 20px;\n }\n span[badge] {\n position: absolute;\n top: 5px;\n right: 2px;\n padding: 0 5px;\n font-size: 0.62rem;\n font-weight: 700;\n line-height: 1.5;\n color: var(--md-sys-color-on-primary-container);\n background-color: var(--md-sys-color-primary-container);\n border-radius: 999em;\n pointer-events: none;\n }\n /* Hidden, not removed: the verdict keeps its last answer and the panel its list while the other tab is open. */\n [off] {\n display: none;\n }\n .error {\n padding: 16px;\n color: #922716;\n }\n `\n private readonly session = createV3ProductSession(v3ProductStore)\n private routeId: string | undefined\n private discardApproved = false\n @state() private revision = 0\n @state() private error = ''\n /**\n * 발행 패널이 읽는 행의 사실 — 상태와 발행 판 번호. 원본은 세션이 들고, 이 둘은 행에 있다.\n *\n * 이 화면에는 발행 패널이 없었다. 저장은 되고 발행 · 판본 · 복원 · 판정을 볼 자리가 없어서, ADR-0087 5단계에서\n * `figure-modeller` 가 이 화면으로 바뀌면 저작자는 발행을 할 수 없었다. 새 V3 도형은 공간을 선언하기 전에는 전부\n * 발행 판정에 막히는데 그 선언을 할 단추도 없었다(2026-09-24 확인). 서버의 문 하나가 두 형식을 다 읽으므로\n * V2 화면의 패널을 그대로 건다.\n */\n @state() private row: { state?: 'draft' | 'released'; version: number; type?: string; category?: string; tags?: string[] } = {\n version: 0\n }\n @state() private typeError = ''\n /** Why a command from the side did nothing. Shown beside the tabs — the editor stays, since nothing in it was lost. */\n @state() private commandError = ''\n /**\n * Which tab the side shows. The verdict comes first: it is what the author needs while editing, and the count on\n * its tab stays in sight while the history is open — as on the V2 page.\n */\n @state() private tab: 'properties' | 'verdict' | 'history' = 'verdict'\n @state() private instances?: number\n /**\n * The source the verdict judges. The session refuses to export while it loads or saves, so the last one read is\n * kept rather than blanked — the verdict would otherwise flicker to 「waiting」 on every save.\n */\n private draft?: string\n private draftSource(): string | undefined {\n try {\n this.draft = this.session.source()\n } catch {\n /* loading or saving — keep the last source */\n }\n return this.draft\n }\n private wasDirty = false\n private titled?: string | null\n private announce = () => {\n const view = this.session.read()\n if (!this.active || view.loading || view.saving || view.error || !view.context) return\n window.dispatchEvent(\n new CustomEvent('figure-ai-context', {\n detail: {\n figureId: view.id,\n source: JSON.parse(this.session.source()),\n context: view.context,\n revision: view.revision,\n format: 'v3'\n }\n })\n )\n }\n private changed = () => {\n this.revision++\n /* Any edit after a failed command makes the message stale — the author has done something about it. */\n this.commandError = ''\n const view = this.session.read()\n /* The title bar reads the name through `context`, which the shell asks for only when told — a rename left it stale. */\n if (view.name !== this.titled) {\n this.titled = view.name\n this.updateContext()\n }\n if (!view.saving) this.announce()\n /* 저장이 끝난 순간 행을 다시 읽는다 — 발행된 도형을 고쳐 저장하면 서버가 초안으로 내린다. */\n if (this.wasDirty && !view.dirty && !view.saving && view.id) this.readRow(view.id)\n this.wasDirty = !!view.dirty\n }\n private async readRow(id: string) {\n try {\n const figure = await fetchFigure(id)\n if (this.session.read().id === id)\n this.row = {\n state: figure.state as 'draft' | 'released',\n version: figure.version ?? 0,\n type: figure.type,\n category: figure.category ?? undefined,\n tags: figure.tags ?? undefined\n }\n } catch {\n /* 행을 못 읽으면 패널은 판 번호 0 으로 보인다 — 발행 문이 서버에서 다시 판단하므로 여기서 지어내지 않는다. */\n }\n }\n /**\n * 타입을 정한다 — 보드가 도형을 부르는 이름이고, 발행하면 굳는다(ADR-0063 결정 4).\n *\n * 새 V3 도형은 저장할 때 임시 타입을 받는데, 이 화면에는 그것을 바꿀 칸이 없어서 임시 타입 그대로 발행됐다.\n * 행만 바뀐다 — V3 자산은 타입을 원본에 적지 않으므로(적으면 형식이 거절한다) 편집 중인 원본과 부딪히지 않는다.\n * 서버의 거절(이미 쓰는 타입 · 발행 뒤)은 그 문장 그대로 칸 아래에 둔다.\n */\n private renameType = async (event: Event) => {\n const input = event.target as HTMLInputElement\n const id = this.session.read().id\n const wanted = input.value.trim().replace(/[^A-Za-z0-9_]/g, '_').toUpperCase()\n input.value = wanted\n if (!id || !wanted || wanted === this.row.type) return\n try {\n const result = await updateFigure(id, { type: wanted })\n this.typeError = ''\n this.row = { ...this.row, type: result.figure.type }\n } catch (error) {\n this.typeError = error instanceof Error ? error.message : String(error)\n input.value = this.row.type ?? ''\n }\n }\n /** 「부품에 맞추기」 — 공간을 지금 부품에서 다시 선언한다. 저장은 저작자가 따로 한다. */\n private fitToParts = () => {\n this.runCommand(() => occupancyFromParts(this.session.source()))\n }\n /** A command from the properties tab — rename, declare the room, the mounting face. */\n private onCommand = (event: Event) => {\n const action = (event as CustomEvent).detail?.action as V3AuthoringAction | undefined\n if (action) this.runCommand(() => action)\n }\n /**\n * One step of the session's history, whichever part of the side asked for it — so undo takes it back like any\n * other edit, and it is saved with the figure.\n */\n private runCommand(actionOf: () => V3AuthoringAction) {\n try {\n this.session.command(actionOf())\n this.commandError = ''\n this.changed()\n } catch (error) {\n /*\n This used to set the page error, which replaces the whole editor with one raw line — for a figure with no\n parts that line was 「OCCUPANCY_NO_PARTS: occupancy: no part could be measured」 (2026-09-24).\n */\n this.commandError =\n (error as { code?: string })?.code === 'OCCUPANCY_NO_PARTS'\n ? i18next.t('figure.text.fit-needs-parts')\n : error instanceof Error\n ? error.message\n : String(error)\n }\n }\n /**\n * Category and tags — the catalogue's, kept on the row, not in the asset. Written at once, as the V2 page does;\n * the server's refusal is shown as it gave it.\n */\n private onCatalog = async (event: Event) => {\n const patch = (event as CustomEvent).detail as { category?: string; tags?: string[] }\n const id = this.session.read().id\n if (!id || !patch) return\n try {\n const result = await updateFigure(id, patch)\n this.commandError = ''\n this.row = { ...this.row, category: result.figure.category ?? undefined, tags: result.figure.tags ?? undefined }\n } catch (error) {\n this.commandError = error instanceof Error ? error.message : String(error)\n }\n }\n private released = (event: Event) => {\n const figure = (event as CustomEvent).detail?.figure\n /* Keep the rest of the row: rebuilding it from these two dropped the type, and the locked type field went blank. */\n if (figure?.id && figure.id === this.session.read().id) this.row = { ...this.row, state: figure.state, version: figure.version ?? 0 }\n }\n /** 과거 판으로 되돌렸으면 서버의 원본이 바뀐 것이다 — 다시 연다. 패널은 저장 안 된 것이 있으면 되돌리기를 막는다. */\n private reverted = async () => {\n const id = this.session.read().id\n if (!id) return\n await this.session.open(id, { discard: true })\n this.changed()\n this.readRow(id)\n }\n /** The dock must explicitly use this checked transaction contract, never an unversioned overwrite. */\n private applyAI = (event: Event) => {\n const detail = (event as CustomEvent).detail\n if (!this.active || !detail) return\n try {\n this.session.apply(detail.changes, 'ai', detail.revision, detail.context)\n detail.applied = true\n this.changed()\n } catch (error) {\n detail.applied = false\n detail.error = error instanceof Error ? error.message : String(error)\n }\n }\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener('figure-ai-context-request', this.announce)\n window.addEventListener('figure-v3-apply', this.applyAI)\n }\n disconnectedCallback() {\n window.removeEventListener('figure-ai-context-request', this.announce)\n window.removeEventListener('figure-v3-apply', this.applyAI)\n super.disconnectedCallback()\n }\n async canDeactivate() {\n const view = this.session.read()\n if (view.saving) return false\n if (!view.dirty) return true\n // The shell invokes this while the edited model is still visible, before navigating away.\n this.discardApproved = window.confirm('저장하지 않은 변경을 버리고 이동하시겠습니까?')\n return this.discardApproved\n }\n async pageUpdated(changes: Record<string, unknown>, lifecycle: { resourceId?: string }) {\n if (!this.active) {\n if (this.session.read().loading) this.session.close()\n window.dispatchEvent(new CustomEvent('figure-ai-context', { detail: undefined }))\n return\n }\n const id = lifecycle?.resourceId\n if (this.session.read().context && id === this.routeId && !changes.active) return\n try {\n const discard = this.discardApproved\n this.discardApproved = false\n if (id) {\n this.draft = undefined\n const opening = this.session.open(id, { discard })\n this.changed()\n await opening\n this.readRow(id)\n } else {\n this.session.startNew({ discard })\n this.draft = undefined\n this.row = { version: 0 }\n this.typeError = ''\n }\n this.routeId = id\n this.error = ''\n this.changed()\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error)\n }\n }\n get context() {\n return { title: this.session.read().name ?? 'Figure', actions: [] }\n }\n render() {\n if (this.error) return html`<p role=\"alert\" class=\"error\">${this.error}</p>`\n const view = this.session.read()\n return html`<figure-v3-editor\n .session=${this.session}\n .revision=${this.revision}\n @v3-changed=${this.changed}\n ></figure-v3-editor>\n <aside>\n <label type-field>\n <span>${i18next.t('figure.label.figure-type')}</span>\n ${this.row.version > 0\n ? html`<code>${this.row.type}</code><small>${i18next.t('figure.text.type-name-cannot-change')}</small>`\n : html`<input\n .value=${this.row.type ?? ''}\n placeholder=${i18next.t('figure.text.figure-type-placeholder')}\n ?disabled=${!view.id}\n @change=${this.renameType}\n />`}\n ${this.typeError ? html`<small role=\"alert\">${this.typeError}</small>` : ''}\n </label>\n ${this.commandError ? html`<p fit-error role=\"alert\">${this.commandError}</p>` : ''}\n <div tabs>\n ${this.renderTab('properties', 'tune', i18next.t('figure.label.properties'))}\n ${this.renderTab('verdict', 'insights', i18next.t('figure.label.maturity'), this.instances)}\n ${this.renderTab('history', 'history', i18next.t('figure.label.history'))}\n </div>\n <figure-v3-properties\n ?off=${this.tab !== 'properties'}\n .source=${this.draftSource()}\n .figureId=${view.id}\n .figureCategory=${this.row.category}\n .figureTags=${this.row.tags}\n @v3-command=${this.onCommand}\n @v3-catalog=${this.onCatalog}\n ></figure-v3-properties>\n <figure-v3-verdict\n ?off=${this.tab !== 'verdict'}\n .source=${this.draftSource()}\n .figureId=${view.id}\n .figureType=${this.row.type}\n @capacity-changed=${(event: CustomEvent) => (this.instances = event.detail.instances)}\n @fit-base-to-parts=${this.fitToParts}\n ></figure-v3-verdict>\n <figure-history-panel\n ?off=${this.tab !== 'history'}\n format=\"v3\"\n .figureId=${view.id}\n .figureState=${this.row.state}\n .figureVersion=${this.row.version}\n .figureType=${this.row.type}\n .dirty=${!!view.dirty}\n @fit-base-to-parts=${this.fitToParts}\n @figure-released=${this.released}\n @figure-reverted=${this.reverted}\n ></figure-history-panel>\n </aside>`\n }\n private renderTab(tab: 'properties' | 'verdict' | 'history', icon: string, label: string, badge?: number) {\n return html`\n <button tab ?on=${this.tab === tab} title=${label} aria-label=${label} @click=${() => (this.tab = tab)}>\n <md-icon>${icon}</md-icon>${badge == null ? '' : html`<span badge>${badge.toLocaleString()}</span>`}\n </button>\n `\n }\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "figure-list" | "figure-modeller" | "figure-v3-modeller" | undefined;
1
+ export default function route(page: string): "figure-modeller" | "figure-list" | "figure-v3-modeller" | undefined;