@things-factory/figure-ui 10.1.45 → 10.1.47

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 (138) hide show
  1. package/client/modeller/angle-dial.ts +70 -0
  2. package/client/modeller/figure-settings.ts +328 -0
  3. package/client/modeller/figure-v3-capability.ts +137 -0
  4. package/client/modeller/figure-v3-clips.ts +253 -0
  5. package/client/modeller/figure-v3-controls.ts +212 -0
  6. package/client/modeller/figure-v3-links.ts +150 -79
  7. package/client/modeller/figure-v3-material.ts +108 -35
  8. package/client/modeller/figure-v3-parts.ts +96 -3
  9. package/client/modeller/figure-v3-preview.ts +326 -0
  10. package/client/modeller/figure-v3-properties.ts +29 -57
  11. package/client/modeller/figure-v3-verdict.ts +598 -60
  12. package/client/modeller/figure-view.ts +152 -0
  13. package/client/modeller/side-panel-styles.ts +326 -0
  14. package/client/modeller/v3-canvas.ts +221 -263
  15. package/client/modeller/v3-clips.ts +89 -0
  16. package/client/modeller/v3-controls.ts +54 -0
  17. package/client/modeller/v3-editor.ts +532 -223
  18. package/client/modeller/v3-fields.ts +62 -0
  19. package/client/modeller/v3-help.ts +41 -0
  20. package/client/modeller/v3-keys.ts +34 -0
  21. package/client/modeller/v3-links.ts +126 -10
  22. package/client/modeller/v3-live.ts +79 -0
  23. package/client/modeller/v3-maturity.ts +415 -0
  24. package/client/modeller/v3-palette.ts +45 -0
  25. package/client/modeller/v3-preview-model.ts +54 -0
  26. package/client/modeller/v3-stage-model.ts +159 -0
  27. package/client/pages/figure-list-page.ts +4 -4
  28. package/client/pages/figure-v3-modeller-page.ts +66 -134
  29. package/dist-client/modeller/angle-dial.d.ts +32 -0
  30. package/dist-client/modeller/angle-dial.js +41 -0
  31. package/dist-client/modeller/angle-dial.js.map +1 -0
  32. package/dist-client/modeller/figure-settings.d.ts +39 -0
  33. package/dist-client/modeller/figure-settings.js +317 -0
  34. package/dist-client/modeller/figure-settings.js.map +1 -0
  35. package/dist-client/modeller/figure-v3-capability.d.ts +22 -0
  36. package/dist-client/modeller/figure-v3-capability.js +141 -0
  37. package/dist-client/modeller/figure-v3-capability.js.map +1 -0
  38. package/dist-client/modeller/figure-v3-clips.d.ts +31 -0
  39. package/dist-client/modeller/figure-v3-clips.js +268 -0
  40. package/dist-client/modeller/figure-v3-clips.js.map +1 -0
  41. package/dist-client/modeller/figure-v3-controls.d.ts +36 -0
  42. package/dist-client/modeller/figure-v3-controls.js +226 -0
  43. package/dist-client/modeller/figure-v3-controls.js.map +1 -0
  44. package/dist-client/modeller/figure-v3-links.d.ts +10 -2
  45. package/dist-client/modeller/figure-v3-links.js +134 -79
  46. package/dist-client/modeller/figure-v3-links.js.map +1 -1
  47. package/dist-client/modeller/figure-v3-material.d.ts +5 -2
  48. package/dist-client/modeller/figure-v3-material.js +109 -35
  49. package/dist-client/modeller/figure-v3-material.js.map +1 -1
  50. package/dist-client/modeller/figure-v3-parts.d.ts +10 -0
  51. package/dist-client/modeller/figure-v3-parts.js +88 -3
  52. package/dist-client/modeller/figure-v3-parts.js.map +1 -1
  53. package/dist-client/modeller/figure-v3-preview.d.ts +34 -0
  54. package/dist-client/modeller/figure-v3-preview.js +322 -0
  55. package/dist-client/modeller/figure-v3-preview.js.map +1 -0
  56. package/dist-client/modeller/figure-v3-properties.d.ts +2 -2
  57. package/dist-client/modeller/figure-v3-properties.js +29 -57
  58. package/dist-client/modeller/figure-v3-properties.js.map +1 -1
  59. package/dist-client/modeller/figure-v3-verdict.d.ts +31 -17
  60. package/dist-client/modeller/figure-v3-verdict.js +579 -59
  61. package/dist-client/modeller/figure-v3-verdict.js.map +1 -1
  62. package/dist-client/modeller/figure-view.d.ts +118 -0
  63. package/dist-client/modeller/figure-view.js +78 -0
  64. package/dist-client/modeller/figure-view.js.map +1 -0
  65. package/dist-client/modeller/side-panel-styles.d.ts +23 -0
  66. package/dist-client/modeller/side-panel-styles.js +326 -0
  67. package/dist-client/modeller/side-panel-styles.js.map +1 -0
  68. package/dist-client/modeller/v3-canvas.d.ts +29 -37
  69. package/dist-client/modeller/v3-canvas.js +188 -260
  70. package/dist-client/modeller/v3-canvas.js.map +1 -1
  71. package/dist-client/modeller/v3-clips.d.ts +39 -0
  72. package/dist-client/modeller/v3-clips.js +58 -0
  73. package/dist-client/modeller/v3-clips.js.map +1 -0
  74. package/dist-client/modeller/v3-controls.d.ts +28 -0
  75. package/dist-client/modeller/v3-controls.js +28 -0
  76. package/dist-client/modeller/v3-controls.js.map +1 -0
  77. package/dist-client/modeller/v3-editor.d.ts +58 -1
  78. package/dist-client/modeller/v3-editor.js +556 -218
  79. package/dist-client/modeller/v3-editor.js.map +1 -1
  80. package/dist-client/modeller/v3-fields.d.ts +30 -0
  81. package/dist-client/modeller/v3-fields.js +46 -0
  82. package/dist-client/modeller/v3-fields.js.map +1 -0
  83. package/dist-client/modeller/v3-help.d.ts +18 -0
  84. package/dist-client/modeller/v3-help.js +37 -0
  85. package/dist-client/modeller/v3-help.js.map +1 -0
  86. package/dist-client/modeller/v3-keys.d.ts +14 -0
  87. package/dist-client/modeller/v3-keys.js +23 -0
  88. package/dist-client/modeller/v3-keys.js.map +1 -0
  89. package/dist-client/modeller/v3-links.d.ts +44 -2
  90. package/dist-client/modeller/v3-links.js +125 -8
  91. package/dist-client/modeller/v3-links.js.map +1 -1
  92. package/dist-client/modeller/v3-live.d.ts +31 -0
  93. package/dist-client/modeller/v3-live.js +58 -0
  94. package/dist-client/modeller/v3-live.js.map +1 -0
  95. package/dist-client/modeller/v3-maturity.d.ts +120 -0
  96. package/dist-client/modeller/v3-maturity.js +317 -0
  97. package/dist-client/modeller/v3-maturity.js.map +1 -0
  98. package/dist-client/modeller/v3-palette.d.ts +7 -0
  99. package/dist-client/modeller/v3-palette.js +42 -0
  100. package/dist-client/modeller/v3-palette.js.map +1 -0
  101. package/dist-client/modeller/v3-preview-model.d.ts +32 -0
  102. package/dist-client/modeller/v3-preview-model.js +48 -0
  103. package/dist-client/modeller/v3-preview-model.js.map +1 -0
  104. package/dist-client/modeller/v3-stage-model.d.ts +31 -0
  105. package/dist-client/modeller/v3-stage-model.js +121 -0
  106. package/dist-client/modeller/v3-stage-model.js.map +1 -0
  107. package/dist-client/pages/figure-list-page.js +4 -4
  108. package/dist-client/pages/figure-list-page.js.map +1 -1
  109. package/dist-client/pages/figure-v3-modeller-page.d.ts +2 -6
  110. package/dist-client/pages/figure-v3-modeller-page.js +64 -136
  111. package/dist-client/pages/figure-v3-modeller-page.js.map +1 -1
  112. package/dist-client/tsconfig.chk.tsbuildinfo +1 -0
  113. package/dist-client/tsconfig.scratch-fm.tsbuildinfo +1 -0
  114. package/dist-client/tsconfig.tsbuildinfo +1 -1
  115. package/package.json +6 -6
  116. package/test/v3-clips.test.ts +70 -0
  117. package/test/v3-controls.test.ts +68 -0
  118. package/test/v3-fields.test.ts +62 -0
  119. package/test/v3-gizmo.test.ts +3 -5
  120. package/test/v3-keys.test.ts +37 -0
  121. package/test/v3-layout.test.ts +78 -0
  122. package/test/v3-links.test.ts +118 -7
  123. package/test/v3-live.test.ts +99 -0
  124. package/test/v3-material.test.ts +6 -0
  125. package/test/v3-maturity.test.ts +268 -0
  126. package/test/v3-parts-wiring.test.ts +3 -1
  127. package/test/v3-preview.test.ts +42 -0
  128. package/test/v3-properties.test.ts +4 -2
  129. package/test/v3-scene-canvas.test.ts +85 -0
  130. package/test/v3-stage-model.test.ts +25 -0
  131. package/test/v3-theme.test.ts +16 -25
  132. package/test/v3-verdict.test.ts +12 -6
  133. package/test/v3-view.test.ts +20 -0
  134. package/translations/en.json +98 -5
  135. package/translations/ja.json +100 -7
  136. package/translations/ko.json +98 -5
  137. package/translations/ms.json +100 -7
  138. package/translations/zh.json +100 -7
@@ -1,34 +1,52 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@material/web/icon/icon.js';
3
- import { css, html, LitElement, nothing } from 'lit';
3
+ import { css, html, LitElement, nothing, svg } from 'lit';
4
4
  import { customElement, property, state } from 'lit/decorators.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
- import { parseV3Asset, v3CostOf } from '@hatiolab/figure-model';
6
+ import { ScrollbarStyles } from '@operato/styles';
7
+ import { LIMITS, parseV3Asset, V3_PER_INSTANCE, v3CostOf } from '@hatiolab/figure-model';
7
8
  import { inspectFigureDraft } from '../graphql/index.js';
8
9
  import { gateFindingStyles, renderGateFinding } from './gate-findings.js';
9
- import { capacityFrom, MEASURED } from './scene-budget.js';
10
+ import { MEASURED } from './scene-budget.js';
11
+ import { SidePanelStyles } from './side-panel-styles.js';
12
+ import { budgetOf, CURVE_SIZE, curveLayout, GRADE_SCALE, shortNumber, v3ReportOf } from './v3-maturity.js';
10
13
  /** How long an edit settles before the server is asked again. One question per pause, not one per keystroke. */
11
14
  export const VERDICT_SETTLE_MS = 400;
12
15
  /**
13
- * 판정 — the V3 modeller's verdict while editing (parity row ①).
16
+ * 성숙도 — the V3 modeller's verdict while editing (parity row ①), laid out as V2's report (`figure-report.ts`).
14
17
  *
15
- * The V2 modeller shows, as the author edits, how many of the figure fit on one screen and what would stop it
16
- * being published. The V3 page showed neither: the author learned what blocked a release only after saving, in the
17
- * release panel. This tab answers both from the source being edited.
18
+ * V2's report showed, as the author edits: how many fit on one screen with the grade beside it and the budget that
19
+ * decided the grade, the grade scale, six maturity axes as a radar and a list, the budget bars, the drawing cost,
20
+ * the reuse trend, and the findings. The first V3 tab kept only the count and the findings (user, 2026-09-24:
21
+ * 「분석부분도 많이 부족하고, 왜 이렇게 너프되었는지」). This is V2's report again, over V3 numbers.
18
22
  *
19
- * The count is computed here, from `v3CostOf` and the same `capacityFrom` the catalogue cards use, so the tab and
20
- * the card cannot disagree. The findings are not: they come from the server's release door (`inspectFigureDraft`),
21
- * the same door and the same sentences as the release panel. A second judgement on the screen would say something
22
- * different the first time either changed.
23
+ * ## What is computed where
23
24
  *
24
- * No grade. V2's grade measures V2 reuse; nothing measures it for V3, so the tab shows no letter rather than one
25
- * nothing computed.
25
+ * The numbers come from `v3-maturity.ts`, which reads the evaluated asset the way the V3 renderer draws it — the
26
+ * screen calls and shows, it does not count. The count uses the same `capacityFrom` the catalogue cards use, so the
27
+ * tab and the card cannot disagree.
28
+ *
29
+ * The findings do not come from here: they come from the server's release door (`inspectFigureDraft`), the same
30
+ * door and the same sentences as the release panel. A second judgement on the screen would say something different
31
+ * the first time either changed. V2's report drew its findings from `validate`; V3's release judgement is the
32
+ * server's, so that section is the server's answer.
33
+ *
34
+ * ## The grade
35
+ *
36
+ * figure-model's `v3ScoreOf`, which the catalogue uses too: headroom against placing `LIMITS.screenInstances` of the
37
+ * figure on one screen (chief architect, 2026-09-24) -- the screen's measured groups and its triangle target shared
38
+ * per instance -- and V2's rule limits for independently moved parts and transparent materials, decided by the
39
+ * tightest, on V2's scale. The two V2 budgets V3 has no field for are left out and the tab says so.
26
40
  */
41
+ /** A per-instance share of the screen is not a whole number; what an instance may draw is the whole part of it. */
42
+ const limitOf = (use) => Math.floor(use.limit).toLocaleString();
27
43
  let FigureV3Verdict = class FigureV3Verdict extends localize(i18next)(LitElement) {
28
44
  constructor() {
29
45
  super(...arguments);
30
46
  /** Bodies in the asset, drawn or hidden. With none there is nothing to fit the space to, so the button is not offered. */
31
47
  this.bodies = 0;
48
+ /** Whether the trend chart is open at its own size. */
49
+ this.expanded = false;
32
50
  this.failure = '';
33
51
  this.asking = false;
34
52
  /** Answers can come back out of order; only the newest question's answer is shown. */
@@ -38,34 +56,34 @@ let FigureV3Verdict = class FigureV3Verdict extends localize(i18next)(LitElement
38
56
  };
39
57
  }
40
58
  static { this.styles = [
59
+ ScrollbarStyles,
60
+ SidePanelStyles,
41
61
  gateFindingStyles,
42
62
  css `
43
63
  :host {
44
64
  display: flex;
45
65
  flex-direction: column;
46
- gap: 14px;
47
- padding: 12px;
48
- overflow: auto;
49
- font-size: 0.76rem;
50
- color: var(--md-sys-color-on-surface);
66
+ overflow-y: auto;
51
67
  }
52
- section > h3 {
53
- margin: 0 0 6px 0;
54
- font-size: var(--ui-t-micro, 11px);
55
- font-weight: 700;
56
- letter-spacing: 0.04em;
57
- text-transform: uppercase;
58
- color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
59
- }
60
- p {
61
- margin: 4px 0 0;
68
+ section p {
69
+ margin: 0;
62
70
  }
71
+
72
+ /* ── How many fit ───────────────────────────────────────────────
73
+ The value of low poly is how many can stand on one screen, so that answer leads. The grade says whether
74
+ the shape keeps inside its declared limits, so it is the small badge beside it. */
63
75
  p[lead],
64
76
  p[basis],
65
77
  p[quiet] {
78
+ font-size: 0.74rem;
79
+ line-height: 1.55;
66
80
  color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
67
81
  }
68
- div[count] {
82
+ p[basis] em {
83
+ font-style: normal;
84
+ color: var(--md-sys-color-tertiary);
85
+ }
86
+ div[verdict] {
69
87
  display: flex;
70
88
  align-items: baseline;
71
89
  gap: 6px;
@@ -82,6 +100,268 @@ let FigureV3Verdict = class FigureV3Verdict extends localize(i18next)(LitElement
82
100
  font-weight: 600;
83
101
  color: var(--md-sys-color-primary);
84
102
  }
103
+ /* The badge says what it measures (headroom), so its number is not read as a score out of 100. */
104
+ span[grade] {
105
+ display: flex;
106
+ align-items: baseline;
107
+ gap: 5px;
108
+ margin-left: auto;
109
+ padding: 3px 10px;
110
+ font-size: 0.76rem;
111
+ font-weight: 700;
112
+ color: var(--md-sys-color-on-primary-container);
113
+ background-color: var(--md-sys-color-primary-container);
114
+ border-radius: 999em;
115
+ }
116
+ span[grade] small {
117
+ display: inline;
118
+ margin: 0;
119
+ font-size: 0.68rem;
120
+ font-weight: 500;
121
+ color: inherit;
122
+ }
123
+ /* C keeps within the limit. Red is for over it (D) only; red on a kept limit asks for a fix nothing needs. */
124
+ span[grade][tight] {
125
+ color: var(--md-sys-color-on-tertiary-container);
126
+ background-color: var(--md-sys-color-tertiary-container);
127
+ }
128
+ span[grade][over] {
129
+ color: var(--md-sys-color-on-error-container);
130
+ background-color: var(--md-sys-color-error-container);
131
+ }
132
+ p[because] {
133
+ font-size: 0.78rem;
134
+ line-height: 1.6;
135
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
136
+ }
137
+ p[because] strong {
138
+ color: var(--md-sys-color-on-surface);
139
+ }
140
+ /* The grade scale. Not folded away: it is compared against every time, not learned once. */
141
+ p[scale] {
142
+ display: flex;
143
+ flex-wrap: wrap;
144
+ gap: 2px 10px;
145
+ font-size: 0.7rem;
146
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
147
+ }
148
+ p[scale] b {
149
+ font-weight: 700;
150
+ }
151
+ p[scale] span[now] {
152
+ color: var(--md-sys-color-on-surface);
153
+ }
154
+ p[scale] span[now] b {
155
+ color: var(--md-sys-color-primary);
156
+ }
157
+
158
+ /* ── Maturity radar ─────────────────────────────────────────────
159
+ Only the measured axes are drawn; an unmeasured one drawn as a spoke reads as a dent, which is a zero. */
160
+ div[radar] {
161
+ display: flex;
162
+ justify-content: center;
163
+ padding: 2px 0 6px 0;
164
+ color: var(--md-sys-color-primary);
165
+ }
166
+ div[radar] svg {
167
+ width: 100%;
168
+ max-width: 240px;
169
+ height: auto;
170
+ }
171
+ div[radar] polygon[web] {
172
+ fill: none;
173
+ stroke: var(--md-sys-color-outline-variant);
174
+ stroke-width: 0.6;
175
+ }
176
+ div[radar] line[spoke] {
177
+ stroke: var(--md-sys-color-outline-variant);
178
+ stroke-width: 0.6;
179
+ }
180
+ div[radar] polygon[shape] {
181
+ fill: color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
182
+ stroke: var(--md-sys-color-primary);
183
+ stroke-width: 1.4;
184
+ stroke-linejoin: round;
185
+ }
186
+ div[radar] circle[dot] {
187
+ fill: var(--md-sys-color-primary);
188
+ }
189
+ div[radar] text {
190
+ font-size: 5.2px;
191
+ fill: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
192
+ }
193
+ p[unmeasured] {
194
+ font-size: 0.7rem;
195
+ line-height: 1.5;
196
+ color: var(--md-sys-color-tertiary);
197
+ }
198
+
199
+ /* ── Axes and budgets ───────────────────────────────────────────
200
+ Not merged into one number: merged, 「what to fix」 disappears. */
201
+ ul[axes],
202
+ ul[budgets] {
203
+ margin: 0;
204
+ padding: 0;
205
+ list-style: none;
206
+ display: flex;
207
+ flex-direction: column;
208
+ gap: 7px;
209
+ }
210
+ ul[axes] li,
211
+ ul[budgets] li {
212
+ display: grid;
213
+ grid-template-columns: 1fr auto;
214
+ gap: 2px 8px;
215
+ font-size: 0.75rem;
216
+ }
217
+ ul[axes] li[blocked] {
218
+ opacity: 0.7;
219
+ }
220
+ ul[axes] em {
221
+ grid-column: 1 / -1;
222
+ font-style: normal;
223
+ font-size: 0.68rem;
224
+ line-height: 1.5;
225
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
226
+ }
227
+ ul[axes] li[blocked] em {
228
+ color: var(--md-sys-color-tertiary);
229
+ }
230
+ span[reading] {
231
+ font-family: var(--mono-font, monospace);
232
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
233
+ }
234
+ div[bar] {
235
+ grid-column: 1 / -1;
236
+ height: 4px;
237
+ background-color: var(--md-sys-color-surface-container-highest);
238
+ border-radius: 2px;
239
+ overflow: hidden;
240
+ }
241
+ div[bar] > i {
242
+ display: block;
243
+ height: 100%;
244
+ background-color: var(--md-sys-color-primary);
245
+ }
246
+ div[bar] > i[tight] {
247
+ background-color: var(--md-sys-color-error);
248
+ }
249
+
250
+ /* ── Drawing cost ─────────────────────────────────────────────── */
251
+ dl[metrics] {
252
+ margin: 0;
253
+ display: grid;
254
+ grid-template-columns: 1fr auto;
255
+ gap: 4px 8px;
256
+ font-size: 0.78rem;
257
+ }
258
+ dl[metrics] dt {
259
+ color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
260
+ }
261
+ dl[metrics] dd {
262
+ margin: 0;
263
+ text-align: right;
264
+ font-family: var(--mono-font, monospace);
265
+ }
266
+
267
+ /* ── Trend ──────────────────────────────────────────────────────
268
+ The chart's natural size is 680px; in a 300px side its words are 4px. The side holds a button, the chart
269
+ opens at its own size. */
270
+ button[expand] {
271
+ justify-self: start;
272
+ padding: 4px 10px;
273
+ font: inherit;
274
+ font-size: 0.74rem;
275
+ color: var(--md-sys-color-on-surface);
276
+ background: none;
277
+ border: 1px solid var(--md-sys-color-outline-variant);
278
+ border-radius: 6px;
279
+ cursor: pointer;
280
+ }
281
+ button[expand]:hover {
282
+ background-color: var(--md-sys-color-surface-container);
283
+ }
284
+ div[sheet] {
285
+ position: fixed;
286
+ inset: 0;
287
+ z-index: 10;
288
+ display: flex;
289
+ align-items: center;
290
+ justify-content: center;
291
+ padding: 12px;
292
+ background-color: color-mix(in srgb, var(--md-sys-color-scrim, black) 32%, transparent);
293
+ }
294
+ div[sheet] > figure {
295
+ max-width: 100%;
296
+ max-height: 100%;
297
+ margin: 0;
298
+ padding: 12px;
299
+ overflow: auto;
300
+ color: var(--md-sys-color-on-surface);
301
+ background-color: var(--md-sys-color-surface-container-lowest);
302
+ border-radius: 6px;
303
+ box-shadow: 0 8px 32px color-mix(in srgb, var(--md-sys-color-shadow, black) 28%, transparent);
304
+ }
305
+ div[sheet] svg {
306
+ display: block;
307
+ /* Not shrunk below its natural size — a narrow window scrolls instead. */
308
+ min-width: 680px;
309
+ font-family: inherit;
310
+ font-size: 11px;
311
+ fill: currentColor;
312
+ }
313
+ div[sheet] svg [grid] {
314
+ stroke: currentColor;
315
+ stroke-opacity: 0.12;
316
+ }
317
+ div[sheet] svg [muted] {
318
+ opacity: 0.55;
319
+ }
320
+ div[sheet] svg path[series] {
321
+ fill: none;
322
+ stroke-width: 2;
323
+ stroke-linejoin: round;
324
+ }
325
+ div[sheet] svg [series='triangles'] {
326
+ stroke: var(--md-sys-color-error);
327
+ fill: var(--md-sys-color-error);
328
+ }
329
+ div[sheet] svg [series='drawCalls'] {
330
+ stroke: var(--md-sys-color-tertiary);
331
+ fill: var(--md-sys-color-tertiary);
332
+ }
333
+ div[sheet] svg [series='geometries'] {
334
+ stroke: var(--md-sys-color-primary);
335
+ fill: var(--md-sys-color-primary);
336
+ }
337
+ div[sheet] svg [series='materials'] {
338
+ stroke: var(--md-sys-color-secondary);
339
+ fill: var(--md-sys-color-secondary);
340
+ }
341
+ div[sheet] svg path[series],
342
+ div[sheet] svg line[series] {
343
+ fill: none;
344
+ }
345
+ /* A legend value is written in its line's colour, not outlined in it. */
346
+ div[sheet] svg text[series] {
347
+ stroke: none;
348
+ }
349
+ div[sheet] figcaption {
350
+ display: flex;
351
+ align-items: center;
352
+ justify-content: flex-end;
353
+ }
354
+ div[sheet] button[close] {
355
+ padding: 5px 14px;
356
+ font: inherit;
357
+ color: var(--md-sys-color-on-surface);
358
+ background: none;
359
+ border: 1px solid var(--md-sys-color-outline-variant);
360
+ border-radius: 999em;
361
+ cursor: pointer;
362
+ }
363
+
364
+ /* ── Release verdict ───────────────────────────────────────────── */
85
365
  p[clear] {
86
366
  color: var(--md-sys-color-primary);
87
367
  font-weight: 600;
@@ -113,20 +393,23 @@ let FigureV3Verdict = class FigureV3Verdict extends localize(i18next)(LitElement
113
393
  this.schedule();
114
394
  }
115
395
  measure() {
116
- let capacity;
396
+ let report;
117
397
  let bodies = 0;
118
398
  try {
119
- const cost = this.source ? v3CostOf(parseV3Asset(this.source)) : undefined;
120
- capacity = cost ? capacityFrom(cost.groups, cost.triangles) : undefined;
399
+ const asset = this.source ? parseV3Asset(this.source) : undefined;
400
+ const cost = asset ? v3CostOf(asset) : undefined;
121
401
  bodies = cost ? cost.groups + cost.hidden : 0;
402
+ report = asset ? v3ReportOf(asset) : undefined;
122
403
  }
123
404
  catch {
124
- /* A source the format refuses has no count; the server's finding below says why. */
125
- capacity = undefined;
405
+ /* A source the format refuses has no report; the server's finding below says why. */
406
+ report = undefined;
126
407
  }
127
- this.capacity = capacity;
408
+ this.report = report;
128
409
  this.bodies = bodies;
129
- this.dispatchEvent(new CustomEvent('capacity-changed', { detail: { instances: capacity?.instances } }));
410
+ if (!report)
411
+ this.expanded = false;
412
+ this.dispatchEvent(new CustomEvent('capacity-changed', { detail: { instances: report?.capacity.instances, budget: budgetOf(report) } }));
130
413
  }
131
414
  schedule() {
132
415
  clearTimeout(this.timer);
@@ -160,36 +443,269 @@ let FigureV3Verdict = class FigureV3Verdict extends localize(i18next)(LitElement
160
443
  }
161
444
  }
162
445
  render() {
163
- return html `${this.renderCount()} ${this.renderGate()}`;
446
+ /*
447
+ With nothing drawn the report is guidance, not a verdict: the sections below have meaning only over parts,
448
+ and a number drawn from nothing reads as zero, which reads as bad. The release verdict stays — a new figure
449
+ is already refused for its undeclared space, and the way out is offered there.
450
+ */
451
+ const report = this.report;
452
+ if (!report) {
453
+ return html `
454
+ <section>
455
+ <h3>${i18next.t('figure.label.maturity')}</h3>
456
+ <p quiet>${i18next.t('figure.text.report-appears-when-you-add-a-part')}</p>
457
+ </section>
458
+ ${this.renderGate()}
459
+ `;
460
+ }
461
+ return html `
462
+ ${this.renderVerdict(report)} ${this.renderAxes(report)} ${this.renderBudgets(report)} ${this.renderMetrics(report)}
463
+ ${this.renderCurve()} ${this.renderGate()} ${this.renderSheet(report)}
464
+ `;
164
465
  }
165
- renderCount() {
166
- const capacity = this.capacity;
466
+ /**
467
+ * The head — how many fit, with the grade beside it, the budget that decided it, the scale, and the basis.
468
+ *
469
+ * The count's denominator is measured (2026-09-18, Apple M5) and says so with the machine and the date; the
470
+ * triangle side is still the design document's target and says that.
471
+ */
472
+ renderVerdict(report) {
473
+ const { capacity, score } = report;
167
474
  return html `
168
475
  <section>
169
476
  <h3>${i18next.t('figure.label.maturity')}</h3>
170
- <p lead>${i18next.t('figure.text.how-many-fit')}</p>
171
- ${capacity
172
- ? html `
173
- <div count>
174
- <span capacity>${capacity.instances.toLocaleString()}</span>
175
- <span unit>${i18next.t('figure.text.instances-unit')}</span>
176
- </div>
177
- <p basis>
178
- ${i18next.t('figure.text.bound-by-' + capacity.bound, {
179
- per: capacity.per.toLocaleString(),
180
- budget: capacity.budget.toLocaleString()
477
+ <p lead>${i18next.t('figure.label.axis-scale')} — ${i18next.t('figure.text.how-many-fit')}</p>
478
+ <div verdict>
479
+ <span capacity>${capacity.instances.toLocaleString()}</span>
480
+ <span unit>${i18next.t('figure.text.instances-unit')}</span>
481
+ <span
482
+ grade
483
+ ?tight=${score.grade === 'C'}
484
+ ?over=${score.grade === 'D'}
485
+ title=${i18next.t('figure.text.grade-explained', { target: LIMITS.screenInstances })}
486
+ >
487
+ ${score.grade}
488
+ <small>${i18next.t('figure.text.headroom-percent', { percent: score.score })}</small>
489
+ </span>
490
+ </div>
491
+ <p because>
492
+ ${i18next.t('figure.text.grade-decided-by')}
493
+ <strong>${i18next.t('figure.label.budget-' + score.tightest.key)}</strong>
494
+ — ${score.tightest.used.toLocaleString()} / ${limitOf(score.tightest)} (${Math.round(score.tightest.ratio * 100)}%)
495
+ </p>
496
+ <p basis>
497
+ ${i18next.t('figure.text.grade-target', {
498
+ target: LIMITS.screenInstances,
499
+ groups: Math.floor(V3_PER_INSTANCE.groups),
500
+ triangles: Math.floor(V3_PER_INSTANCE.triangles).toLocaleString()
501
+ })}
502
+ </p>
503
+ ${this.renderGradeScale(score.grade)}
504
+ <p basis>
505
+ ${i18next.t('figure.text.bound-by-' + capacity.bound, {
506
+ per: capacity.per.toLocaleString(),
507
+ budget: capacity.budget.toLocaleString()
508
+ })}
509
+ <em>
510
+ ${capacity.bound === 'groups'
511
+ ? i18next.t('figure.text.budget-measured-on', { gpu: MEASURED.gpu, on: MEASURED.on })
512
+ : i18next.t('figure.text.budget-not-measured-yet')}
513
+ </em>
514
+ </p>
515
+ </section>
516
+ `;
517
+ }
518
+ /** A · B · C · D and where this figure stands, drawn from the bounds the grade is computed with. */
519
+ renderGradeScale(now) {
520
+ const bounds = [...GRADE_SCALE.map(([grade, bound]) => [grade, `≤ ${bound * 100}%`]), ['D', '> 100%']];
521
+ return html `
522
+ <p scale>
523
+ <span>${i18next.t('figure.text.grade-scale-lead')}</span>
524
+ ${bounds.map(([grade, bound]) => html `<span ?now=${grade === now}><b>${grade}</b> ${bound}</span>`)}
525
+ </p>
526
+ `;
527
+ }
528
+ /**
529
+ * Maturity by axis — a radar of the measured axes, a line naming the unmeasured ones, and the list.
530
+ *
531
+ * Scale is left out of the list: it leads the tab, and the same number twice reads as two different things.
532
+ */
533
+ renderAxes(report) {
534
+ const measured = report.axes.filter(axis => axis.ratio !== undefined);
535
+ const unmeasured = report.axes.filter(axis => axis.ratio === undefined);
536
+ return html `
537
+ <section>
538
+ <h3>${i18next.t('figure.label.by-axis')}</h3>
539
+ <div radar>${this.renderRadar(measured)}</div>
540
+ ${unmeasured.length
541
+ ? html `<p unmeasured>
542
+ ${i18next.t('figure.text.axes-not-measurable-yet', {
543
+ axes: unmeasured.map(axis => i18next.t('figure.label.axis-' + axis.key)).join(' · ')
181
544
  })}
182
- <em>
183
- ${capacity.bound === 'groups'
184
- ? i18next.t('figure.text.budget-measured-on', { gpu: MEASURED.gpu, on: MEASURED.on })
185
- : i18next.t('figure.text.budget-not-measured-yet')}
186
- </em>
187
- </p>
188
- `
189
- : html `<p quiet>${i18next.t('figure.text.maturity-blocked-no-parts')}</p>`}
545
+ </p>`
546
+ : nothing}
547
+ <ul axes>
548
+ ${report.axes.filter(axis => axis.key !== 'scale').map(axis => this.renderAxis(axis))}
549
+ </ul>
190
550
  </section>
191
551
  `;
192
552
  }
553
+ /** V2's radar: rings at a third, two thirds and full, short names so the left edge is not cut. */
554
+ renderRadar(axes) {
555
+ const cx = 60;
556
+ const cy = 46;
557
+ const r = 28;
558
+ const at = (index, ratio) => {
559
+ const angle = -Math.PI / 2 + (index * 2 * Math.PI) / axes.length;
560
+ return [cx + r * ratio * Math.cos(angle), cy + r * ratio * Math.sin(angle)];
561
+ };
562
+ const clamp = (ratio) => Math.max(0.04, Math.min(1, ratio ?? 0));
563
+ const points = axes.map((axis, index) => at(index, clamp(axis.ratio)).map(n => n.toFixed(1)).join(',')).join(' ');
564
+ return svg `
565
+ <svg viewBox="0 0 120 96" aria-hidden="true">
566
+ ${[0.33, 0.66, 1].map(ring => svg `<polygon web points=${axes.map((_, i) => at(i, ring).map(n => n.toFixed(1)).join(',')).join(' ')}></polygon>`)}
567
+ ${axes.map((_, index) => {
568
+ const [x, y] = at(index, 1);
569
+ return svg `<line spoke x1=${cx} y1=${cy} x2=${x.toFixed(1)} y2=${y.toFixed(1)}></line>`;
570
+ })}
571
+ <polygon shape points=${points}></polygon>
572
+ ${axes.map((axis, index) => {
573
+ const [x, y] = at(index, clamp(axis.ratio));
574
+ return svg `<circle dot cx=${x.toFixed(1)} cy=${y.toFixed(1)} r="1.4"></circle>`;
575
+ })}
576
+ ${axes.map((axis, index) => {
577
+ const [x, y] = at(index, 1.28);
578
+ const anchor = x < cx - 3 ? 'end' : x > cx + 3 ? 'start' : 'middle';
579
+ return svg `<text x=${x.toFixed(1)} y=${(y + 1.8).toFixed(1)} text-anchor=${anchor}>${i18next.t('figure.label.axis-' + axis.key + '-short')}</text>`;
580
+ })}
581
+ </svg>
582
+ `;
583
+ }
584
+ renderAxis(axis) {
585
+ const name = i18next.t('figure.label.axis-' + axis.key);
586
+ if (axis.blocked) {
587
+ return html `
588
+ <li blocked>
589
+ <span>${name}</span>
590
+ <span reading>${i18next.t('figure.text.not-measurable-yet')}</span>
591
+ <em>${i18next.t(axis.blocked)}</em>
592
+ </li>
593
+ `;
594
+ }
595
+ const ratio = Math.max(0, Math.min(1, axis.ratio ?? 0));
596
+ return html `
597
+ <li>
598
+ <span>${name}</span>
599
+ <span reading>${axis.readingKey ? i18next.t(axis.readingKey) : (axis.reading ?? '')}</span>
600
+ <div bar><i style="width:${Math.round(ratio * 100)}%"></i></div>
601
+ ${axis.because ? html `<em>${i18next.t(axis.because)}</em>` : nothing}
602
+ </li>
603
+ `;
604
+ }
605
+ /** The budget bars. The one closest to its limit is coloured — it decided the grade. */
606
+ renderBudgets(report) {
607
+ const { score } = report;
608
+ return html `
609
+ <section>
610
+ <h3>${i18next.t('figure.label.budgets')}</h3>
611
+ <ul budgets>
612
+ ${score.budgets.map(use => html `
613
+ <li>
614
+ <span>${i18next.t('figure.label.budget-' + use.key)}</span>
615
+ <span>${use.used.toLocaleString()} / ${limitOf(use)}</span>
616
+ <div bar><i ?tight=${use.key === score.tightest.key} style="width:${Math.round(Math.min(1, use.ratio) * 100)}%"></i></div>
617
+ </li>
618
+ `)}
619
+ </ul>
620
+ <p quiet>${i18next.t('figure.text.budgets-not-in-v3')}</p>
621
+ </section>
622
+ `;
623
+ }
624
+ renderMetrics(report) {
625
+ return html `
626
+ <section>
627
+ <h3>${i18next.t('figure.label.weight')}</h3>
628
+ <dl metrics>
629
+ <dt>${i18next.t('figure.label.triangles')}</dt>
630
+ <dd>${report.cost.triangles.toLocaleString()}</dd>
631
+ <dt>${i18next.t('figure.label.distinct-shapes')}</dt>
632
+ <dd>${report.distinctShapes}</dd>
633
+ <dt>${i18next.t('figure.label.distinct-materials')}</dt>
634
+ <dd>${report.distinctMaterials}</dd>
635
+ </dl>
636
+ </section>
637
+ `;
638
+ }
639
+ renderCurve() {
640
+ return html `
641
+ <section>
642
+ <h3>${i18next.t('figure.label.reuse-trend')}</h3>
643
+ <button expand @click=${() => (this.expanded = true)}>${i18next.t('figure.button.see-the-trend-chart')}</button>
644
+ </section>
645
+ `;
646
+ }
647
+ /**
648
+ * The trend at its own size — V2's chart: both axes logarithmic, the growing lines against the flat ones, and a
649
+ * legend with each line's value at the last count.
650
+ */
651
+ renderSheet(report) {
652
+ if (!this.expanded)
653
+ return nothing;
654
+ const layout = curveLayout(report.curve);
655
+ if (!layout)
656
+ return nothing;
657
+ const { width, height, pad } = CURVE_SIZE;
658
+ const plotW = width - pad.left - pad.right;
659
+ const plotH = height - pad.top - pad.bottom;
660
+ const last = report.curve[report.curve.length - 1];
661
+ const label = (key) => i18next.t({
662
+ triangles: 'figure.label.triangles',
663
+ drawCalls: 'figure.label.draw-calls',
664
+ geometries: 'figure.label.vertex-buffers',
665
+ materials: 'figure.label.distinct-materials'
666
+ }[key]);
667
+ return html `
668
+ <div sheet @click=${() => (this.expanded = false)}>
669
+ <figure @click=${(e) => e.stopPropagation()}>
670
+ ${svg `
671
+ <svg viewBox="0 0 ${width} ${height}" width=${width} height=${height} role="img">
672
+ <text x=${pad.left} y="22" font-size="13" font-weight="600">${i18next.t('figure.text.trend-chart-title')}</text>
673
+ <text x=${pad.left} y="38" muted>${i18next.t('figure.text.trend-chart-lead')}</text>
674
+ ${layout.yTicks.map(tick => svg `
675
+ <line grid x1=${pad.left} y1=${tick.y.toFixed(1)} x2=${(pad.left + plotW).toFixed(1)} y2=${tick.y.toFixed(1)}></line>
676
+ <text muted x=${pad.left - 8} y=${(tick.y + 3.5).toFixed(1)} text-anchor="end">${tick.label}</text>
677
+ `)}
678
+ ${layout.xTicks.map(tick => svg `
679
+ <line grid x1=${tick.x.toFixed(1)} y1=${pad.top} x2=${tick.x.toFixed(1)} y2=${(pad.top + plotH).toFixed(1)}></line>
680
+ <text muted x=${tick.x.toFixed(1)} y=${(pad.top + plotH + 16).toFixed(1)} text-anchor="middle">${tick.label}</text>
681
+ `)}
682
+ <text muted x=${(pad.left + plotW / 2).toFixed(1)} y=${height - 8} text-anchor="middle">${i18next.t('figure.label.instance-count')}</text>
683
+ ${layout.lines.map(line => svg `<path series=${line.key} d=${line.d} stroke-dasharray=${line.dashed ? '3 7' : 'none'}></path>`)}
684
+ <g transform="translate(${width - pad.right + 14}, ${pad.top - 6})">
685
+ <text x="0" y="0" font-weight="600">${i18next.t('figure.text.trend-at-count', { n: shortNumber(last.instances) })}</text>
686
+ ${layout.lines.map((line, i) => {
687
+ const y = 24 + i * 34;
688
+ return svg `
689
+ <line series=${line.key} x1="0" y1=${y - 4} x2="18" y2=${y - 4} stroke-width="2" stroke-dasharray=${line.dashed ? '3 7' : 'none'}></line>
690
+ <text x="24" y=${y}>${label(line.key)}</text>
691
+ <text series=${line.key} x="24" y=${y + 12} font-weight="600">
692
+ ${line.last.toLocaleString()}${line.flat ? ` · ${i18next.t('figure.text.trend-stays')}` : ''}
693
+ </text>
694
+ `;
695
+ })}
696
+ ${layout.overlap !== undefined
697
+ ? svg `<text muted x="0" y=${24 + layout.lines.length * 34 + 6}>${i18next.t('figure.text.trend-flat-lines-overlap', { value: layout.overlap.toLocaleString() })}</text>`
698
+ : nothing}
699
+ </g>
700
+ </svg>
701
+ `}
702
+ <figcaption>
703
+ <button close @click=${() => (this.expanded = false)}>${i18next.t('figure.button.close')}</button>
704
+ </figcaption>
705
+ </figure>
706
+ </div>
707
+ `;
708
+ }
193
709
  renderGate() {
194
710
  const findings = this.inspection?.findings ?? [];
195
711
  const blocking = findings.filter(finding => finding.blocking);
@@ -244,11 +760,15 @@ __decorate([
244
760
  __decorate([
245
761
  state(),
246
762
  __metadata("design:type", Object)
247
- ], FigureV3Verdict.prototype, "capacity", void 0);
763
+ ], FigureV3Verdict.prototype, "report", void 0);
248
764
  __decorate([
249
765
  state(),
250
766
  __metadata("design:type", Object)
251
767
  ], FigureV3Verdict.prototype, "bodies", void 0);
768
+ __decorate([
769
+ state(),
770
+ __metadata("design:type", Object)
771
+ ], FigureV3Verdict.prototype, "expanded", void 0);
252
772
  __decorate([
253
773
  state(),
254
774
  __metadata("design:type", Object)