@things-factory/figure-ui 10.1.70 → 10.1.71
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 +28 -69
- package/client/modeller/figure-v3-parts.ts +16 -136
- package/client/modeller/figure-v3-recipe-catalog.ts +348 -0
- package/client/modeller/v3-editor.ts +25 -5
- package/client/modeller/v3-fields.ts +21 -16
- package/client/modeller/v3-gizmo.ts +1 -1
- package/client/modeller/v3-links.ts +7 -66
- package/client/modeller/v3-palette.ts +3 -0
- package/client/modeller/v3-recipe-source.ts +15 -0
- package/client/modeller/v3-recipes.ts +50 -27
- package/client/pages/figure-v3-modeller-page.ts +16 -13
- package/client/route.ts +0 -4
- package/dist-client/graphql/index.d.ts +11 -18
- package/dist-client/graphql/index.js +18 -59
- package/dist-client/graphql/index.js.map +1 -1
- package/dist-client/modeller/figure-v3-parts.d.ts +5 -12
- package/dist-client/modeller/figure-v3-parts.js +17 -147
- package/dist-client/modeller/figure-v3-parts.js.map +1 -1
- package/dist-client/modeller/figure-v3-recipe-catalog.d.ts +36 -0
- package/dist-client/modeller/figure-v3-recipe-catalog.js +382 -0
- package/dist-client/modeller/figure-v3-recipe-catalog.js.map +1 -0
- package/dist-client/modeller/v3-editor.d.ts +8 -3
- package/dist-client/modeller/v3-editor.js +35 -6
- package/dist-client/modeller/v3-editor.js.map +1 -1
- package/dist-client/modeller/v3-fields.d.ts +2 -2
- package/dist-client/modeller/v3-fields.js +20 -18
- package/dist-client/modeller/v3-fields.js.map +1 -1
- package/dist-client/modeller/v3-gizmo.js +1 -1
- package/dist-client/modeller/v3-gizmo.js.map +1 -1
- package/dist-client/modeller/v3-links.d.ts +8 -25
- package/dist-client/modeller/v3-links.js +4 -66
- package/dist-client/modeller/v3-links.js.map +1 -1
- package/dist-client/modeller/v3-palette.js +3 -0
- package/dist-client/modeller/v3-palette.js.map +1 -1
- package/dist-client/modeller/v3-recipe-source.d.ts +8 -0
- package/dist-client/modeller/v3-recipe-source.js +14 -0
- package/dist-client/modeller/v3-recipe-source.js.map +1 -0
- package/dist-client/modeller/v3-recipes.d.ts +25 -14
- package/dist-client/modeller/v3-recipes.js +42 -28
- package/dist-client/modeller/v3-recipes.js.map +1 -1
- package/dist-client/pages/figure-v3-modeller-page.d.ts +5 -3
- package/dist-client/pages/figure-v3-modeller-page.js +16 -13
- package/dist-client/pages/figure-v3-modeller-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +0 -3
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.fui.tsbuildinfo +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/scripts/template-thumbnails.mjs +53 -0
- package/test/browser/build.mjs +3 -3
- package/test/browser/modeller-page.js +25 -3
- package/test/browser/modeller.check.mjs +57 -47
- package/test/browser/thumbnail-page.js +14 -0
- package/test/v3-fields.test.ts +5 -1
- package/test/v3-links.test.ts +12 -0
- package/test/v3-recipes.test.ts +42 -25
- package/things-factory.config.js +0 -1
- package/translations/en.json +38 -23
- package/translations/ja.json +38 -23
- package/translations/ko.json +38 -23
- package/translations/ms.json +38 -23
- package/translations/zh.json +38 -23
- package/client/pages/figure-recipe-page.ts +0 -338
- package/dist-client/pages/figure-recipe-page.d.ts +0 -41
- package/dist-client/pages/figure-recipe-page.js +0 -352
- package/dist-client/pages/figure-recipe-page.js.map +0 -1
package/translations/ja.json
CHANGED
|
@@ -202,30 +202,45 @@
|
|
|
202
202
|
"figure.text.size-declared-to-follow": "the figure size to follow was set from its parts: {x} × {y} × {z} mm.",
|
|
203
203
|
"figure.label.recipes": "recipes",
|
|
204
204
|
"figure.text.recipe-needs-a-part": "choose the part to put it on first.",
|
|
205
|
-
"figure.text.recipe-onto": "onto {part}.",
|
|
206
205
|
"figure.button.insert-recipe": "put in",
|
|
207
|
-
"figure.
|
|
208
|
-
"figure.text.
|
|
209
|
-
"figure.label.recipe-
|
|
210
|
-
"figure.label.recipe-
|
|
211
|
-
"figure.
|
|
212
|
-
"figure.
|
|
213
|
-
"figure.
|
|
214
|
-
"figure.
|
|
215
|
-
"figure.label.recipe-
|
|
216
|
-
"figure.label.recipe-
|
|
217
|
-
"figure.label.recipe-
|
|
218
|
-
"figure.label.
|
|
219
|
-
"figure.label.
|
|
220
|
-
"figure.
|
|
221
|
-
"figure.
|
|
222
|
-
"figure.
|
|
223
|
-
"figure.
|
|
224
|
-
"figure.
|
|
225
|
-
"figure.text.recipe-
|
|
226
|
-
"figure.text.recipe-
|
|
227
|
-
"figure.text.recipe-
|
|
228
|
-
"figure.
|
|
206
|
+
"figure.label.recipe-catalog": "recipe catalog",
|
|
207
|
+
"figure.text.recipe-search": "find by name, description or tag",
|
|
208
|
+
"figure.label.recipe-all": "all",
|
|
209
|
+
"figure.label.recipe-category-door": "doors and openings",
|
|
210
|
+
"figure.label.recipe-category-conveyor": "conveying",
|
|
211
|
+
"figure.label.recipe-category-support": "supports and structure",
|
|
212
|
+
"figure.label.recipe-category-safety": "safety",
|
|
213
|
+
"figure.label.recipe-category-signal": "signals and lights",
|
|
214
|
+
"figure.label.recipe-category-control": "controls and electrical",
|
|
215
|
+
"figure.label.recipe-category-handling": "handling",
|
|
216
|
+
"figure.label.recipe-category-storage": "storage and containers",
|
|
217
|
+
"figure.label.recipe-category-utility": "piping and utilities",
|
|
218
|
+
"figure.label.recipe-category-space": "space and building",
|
|
219
|
+
"figure.label.recipe-category-other": "other",
|
|
220
|
+
"figure.label.recipe-adds": "what it puts in",
|
|
221
|
+
"figure.text.recipe-parts": "{parts} parts",
|
|
222
|
+
"figure.text.recipe-slides": "{part}: slides",
|
|
223
|
+
"figure.text.recipe-turns": "{part}: turns",
|
|
224
|
+
"figure.text.recipe-moves-with": "{part}: moves with {leader}",
|
|
225
|
+
"figure.text.recipe-controls": "moved by {count} control(s)",
|
|
226
|
+
"figure.text.recipe-shown-by-control": "{parts}: shown by a control",
|
|
227
|
+
"figure.text.recipe-row": "{part}: a row along the part's length",
|
|
228
|
+
"figure.text.recipe-onto-chosen": "fastened to the chosen part, following its size",
|
|
229
|
+
"figure.text.recipe-onto-figure": "put onto the whole figure",
|
|
230
|
+
"figure.label.recipe-values": "values",
|
|
231
|
+
"figure.button.insert-recipe-onto": "put onto {part}",
|
|
232
|
+
"figure.button.open-recipe-catalog": "recipe catalog ({count})",
|
|
233
|
+
"figure.label.primitive-hollow-box": "tote",
|
|
234
|
+
"figure.label.field-roundX": "corner X",
|
|
235
|
+
"figure.label.field-roundZ": "corner Z",
|
|
236
|
+
"figure.label.field-wallX": "wall X",
|
|
237
|
+
"figure.label.field-wallZ": "wall Z",
|
|
238
|
+
"figure.label.field-floor": "floor",
|
|
239
|
+
"figure.label.face-inside-bottom": "inside bottom",
|
|
240
|
+
"figure.label.face-inside-left": "inside left",
|
|
241
|
+
"figure.label.face-inside-right": "inside right",
|
|
242
|
+
"figure.label.face-inside-back": "inside back",
|
|
243
|
+
"figure.label.face-inside-front": "inside front",
|
|
229
244
|
"figure.label.placement": "取り付け",
|
|
230
245
|
"figure.label.placement-ceiling": "天井基準 (ceiling)",
|
|
231
246
|
"figure.label.placement-center": "中心基準 (center)",
|
package/translations/ko.json
CHANGED
|
@@ -202,30 +202,45 @@
|
|
|
202
202
|
"figure.text.size-declared-to-follow": "따라갈 도형 크기를 부품에 맞춰 {x} × {y} × {z} mm 로 정했습니다.",
|
|
203
203
|
"figure.label.recipes": "조각",
|
|
204
204
|
"figure.text.recipe-needs-a-part": "붙일 부품을 먼저 고르세요.",
|
|
205
|
-
"figure.text.recipe-onto": "{part} 에 넣습니다.",
|
|
206
205
|
"figure.button.insert-recipe": "넣기",
|
|
207
|
-
"figure.
|
|
208
|
-
"figure.text.
|
|
209
|
-
"figure.label.recipe-
|
|
210
|
-
"figure.label.recipe-
|
|
211
|
-
"figure.
|
|
212
|
-
"figure.
|
|
213
|
-
"figure.
|
|
214
|
-
"figure.
|
|
215
|
-
"figure.label.recipe-
|
|
216
|
-
"figure.label.recipe-
|
|
217
|
-
"figure.label.recipe-
|
|
218
|
-
"figure.label.
|
|
219
|
-
"figure.label.
|
|
220
|
-
"figure.
|
|
221
|
-
"figure.
|
|
222
|
-
"figure.
|
|
223
|
-
"figure.
|
|
224
|
-
"figure.
|
|
225
|
-
"figure.text.recipe-
|
|
226
|
-
"figure.text.recipe-
|
|
227
|
-
"figure.text.recipe-
|
|
228
|
-
"figure.
|
|
206
|
+
"figure.label.recipe-catalog": "조각 카탈로그",
|
|
207
|
+
"figure.text.recipe-search": "이름 · 설명 · 태그로 찾기",
|
|
208
|
+
"figure.label.recipe-all": "전체",
|
|
209
|
+
"figure.label.recipe-category-door": "문 · 개구부",
|
|
210
|
+
"figure.label.recipe-category-conveyor": "반송",
|
|
211
|
+
"figure.label.recipe-category-support": "받침 · 구조",
|
|
212
|
+
"figure.label.recipe-category-safety": "안전",
|
|
213
|
+
"figure.label.recipe-category-signal": "표시 · 조명",
|
|
214
|
+
"figure.label.recipe-category-control": "조작 · 전기",
|
|
215
|
+
"figure.label.recipe-category-handling": "이송 장치",
|
|
216
|
+
"figure.label.recipe-category-storage": "저장 · 용기",
|
|
217
|
+
"figure.label.recipe-category-utility": "배관 · 유틸리티",
|
|
218
|
+
"figure.label.recipe-category-space": "공간 · 건축",
|
|
219
|
+
"figure.label.recipe-category-other": "기타",
|
|
220
|
+
"figure.label.recipe-adds": "넣는 것",
|
|
221
|
+
"figure.text.recipe-parts": "부품 {parts}개",
|
|
222
|
+
"figure.text.recipe-slides": "{part}: 미끄러짐",
|
|
223
|
+
"figure.text.recipe-turns": "{part}: 회전",
|
|
224
|
+
"figure.text.recipe-moves-with": "{part}: {leader} 를 따라 움직임",
|
|
225
|
+
"figure.text.recipe-controls": "조작값 {count}개로 움직임",
|
|
226
|
+
"figure.text.recipe-shown-by-control": "{parts}: 조작값에 따라 보임",
|
|
227
|
+
"figure.text.recipe-row": "{part}: 부품 길이를 따라 줄로 늘어섬",
|
|
228
|
+
"figure.text.recipe-onto-chosen": "고른 부품에 붙고, 그 크기를 따라감",
|
|
229
|
+
"figure.text.recipe-onto-figure": "도형 전체에 넣음",
|
|
230
|
+
"figure.label.recipe-values": "고를 값",
|
|
231
|
+
"figure.button.insert-recipe-onto": "{part} 에 넣기",
|
|
232
|
+
"figure.button.open-recipe-catalog": "조각 카탈로그 ({count})",
|
|
233
|
+
"figure.label.primitive-hollow-box": "통",
|
|
234
|
+
"figure.label.field-roundX": "모서리 X",
|
|
235
|
+
"figure.label.field-roundZ": "모서리 Z",
|
|
236
|
+
"figure.label.field-wallX": "벽 두께 X",
|
|
237
|
+
"figure.label.field-wallZ": "벽 두께 Z",
|
|
238
|
+
"figure.label.field-floor": "바닥 두께",
|
|
239
|
+
"figure.label.face-inside-bottom": "안쪽 바닥",
|
|
240
|
+
"figure.label.face-inside-left": "안쪽 왼쪽",
|
|
241
|
+
"figure.label.face-inside-right": "안쪽 오른쪽",
|
|
242
|
+
"figure.label.face-inside-back": "안쪽 뒤",
|
|
243
|
+
"figure.label.face-inside-front": "안쪽 앞",
|
|
229
244
|
"figure.label.placement": "붙이기",
|
|
230
245
|
"figure.label.placement-ceiling": "천장 기반 (ceiling)",
|
|
231
246
|
"figure.label.placement-center": "중심 기반 (center)",
|
package/translations/ms.json
CHANGED
|
@@ -202,30 +202,45 @@
|
|
|
202
202
|
"figure.text.size-declared-to-follow": "the figure size to follow was set from its parts: {x} × {y} × {z} mm.",
|
|
203
203
|
"figure.label.recipes": "recipes",
|
|
204
204
|
"figure.text.recipe-needs-a-part": "choose the part to put it on first.",
|
|
205
|
-
"figure.text.recipe-onto": "onto {part}.",
|
|
206
205
|
"figure.button.insert-recipe": "put in",
|
|
207
|
-
"figure.
|
|
208
|
-
"figure.text.
|
|
209
|
-
"figure.label.recipe-
|
|
210
|
-
"figure.label.recipe-
|
|
211
|
-
"figure.
|
|
212
|
-
"figure.
|
|
213
|
-
"figure.
|
|
214
|
-
"figure.
|
|
215
|
-
"figure.label.recipe-
|
|
216
|
-
"figure.label.recipe-
|
|
217
|
-
"figure.label.recipe-
|
|
218
|
-
"figure.label.
|
|
219
|
-
"figure.label.
|
|
220
|
-
"figure.
|
|
221
|
-
"figure.
|
|
222
|
-
"figure.
|
|
223
|
-
"figure.
|
|
224
|
-
"figure.
|
|
225
|
-
"figure.text.recipe-
|
|
226
|
-
"figure.text.recipe-
|
|
227
|
-
"figure.text.recipe-
|
|
228
|
-
"figure.
|
|
206
|
+
"figure.label.recipe-catalog": "recipe catalog",
|
|
207
|
+
"figure.text.recipe-search": "find by name, description or tag",
|
|
208
|
+
"figure.label.recipe-all": "all",
|
|
209
|
+
"figure.label.recipe-category-door": "doors and openings",
|
|
210
|
+
"figure.label.recipe-category-conveyor": "conveying",
|
|
211
|
+
"figure.label.recipe-category-support": "supports and structure",
|
|
212
|
+
"figure.label.recipe-category-safety": "safety",
|
|
213
|
+
"figure.label.recipe-category-signal": "signals and lights",
|
|
214
|
+
"figure.label.recipe-category-control": "controls and electrical",
|
|
215
|
+
"figure.label.recipe-category-handling": "handling",
|
|
216
|
+
"figure.label.recipe-category-storage": "storage and containers",
|
|
217
|
+
"figure.label.recipe-category-utility": "piping and utilities",
|
|
218
|
+
"figure.label.recipe-category-space": "space and building",
|
|
219
|
+
"figure.label.recipe-category-other": "other",
|
|
220
|
+
"figure.label.recipe-adds": "what it puts in",
|
|
221
|
+
"figure.text.recipe-parts": "{parts} parts",
|
|
222
|
+
"figure.text.recipe-slides": "{part}: slides",
|
|
223
|
+
"figure.text.recipe-turns": "{part}: turns",
|
|
224
|
+
"figure.text.recipe-moves-with": "{part}: moves with {leader}",
|
|
225
|
+
"figure.text.recipe-controls": "moved by {count} control(s)",
|
|
226
|
+
"figure.text.recipe-shown-by-control": "{parts}: shown by a control",
|
|
227
|
+
"figure.text.recipe-row": "{part}: a row along the part's length",
|
|
228
|
+
"figure.text.recipe-onto-chosen": "fastened to the chosen part, following its size",
|
|
229
|
+
"figure.text.recipe-onto-figure": "put onto the whole figure",
|
|
230
|
+
"figure.label.recipe-values": "values",
|
|
231
|
+
"figure.button.insert-recipe-onto": "put onto {part}",
|
|
232
|
+
"figure.button.open-recipe-catalog": "recipe catalog ({count})",
|
|
233
|
+
"figure.label.primitive-hollow-box": "tote",
|
|
234
|
+
"figure.label.field-roundX": "corner X",
|
|
235
|
+
"figure.label.field-roundZ": "corner Z",
|
|
236
|
+
"figure.label.field-wallX": "wall X",
|
|
237
|
+
"figure.label.field-wallZ": "wall Z",
|
|
238
|
+
"figure.label.field-floor": "floor",
|
|
239
|
+
"figure.label.face-inside-bottom": "inside bottom",
|
|
240
|
+
"figure.label.face-inside-left": "inside left",
|
|
241
|
+
"figure.label.face-inside-right": "inside right",
|
|
242
|
+
"figure.label.face-inside-back": "inside back",
|
|
243
|
+
"figure.label.face-inside-front": "inside front",
|
|
229
244
|
"figure.label.placement": "lekatan",
|
|
230
245
|
"figure.label.placement-ceiling": "berasaskan siling (ceiling)",
|
|
231
246
|
"figure.label.placement-center": "berasaskan pusat (center)",
|
package/translations/zh.json
CHANGED
|
@@ -202,30 +202,45 @@
|
|
|
202
202
|
"figure.text.size-declared-to-follow": "the figure size to follow was set from its parts: {x} × {y} × {z} mm.",
|
|
203
203
|
"figure.label.recipes": "recipes",
|
|
204
204
|
"figure.text.recipe-needs-a-part": "choose the part to put it on first.",
|
|
205
|
-
"figure.text.recipe-onto": "onto {part}.",
|
|
206
205
|
"figure.button.insert-recipe": "put in",
|
|
207
|
-
"figure.
|
|
208
|
-
"figure.text.
|
|
209
|
-
"figure.label.recipe-
|
|
210
|
-
"figure.label.recipe-
|
|
211
|
-
"figure.
|
|
212
|
-
"figure.
|
|
213
|
-
"figure.
|
|
214
|
-
"figure.
|
|
215
|
-
"figure.label.recipe-
|
|
216
|
-
"figure.label.recipe-
|
|
217
|
-
"figure.label.recipe-
|
|
218
|
-
"figure.label.
|
|
219
|
-
"figure.label.
|
|
220
|
-
"figure.
|
|
221
|
-
"figure.
|
|
222
|
-
"figure.
|
|
223
|
-
"figure.
|
|
224
|
-
"figure.
|
|
225
|
-
"figure.text.recipe-
|
|
226
|
-
"figure.text.recipe-
|
|
227
|
-
"figure.text.recipe-
|
|
228
|
-
"figure.
|
|
206
|
+
"figure.label.recipe-catalog": "recipe catalog",
|
|
207
|
+
"figure.text.recipe-search": "find by name, description or tag",
|
|
208
|
+
"figure.label.recipe-all": "all",
|
|
209
|
+
"figure.label.recipe-category-door": "doors and openings",
|
|
210
|
+
"figure.label.recipe-category-conveyor": "conveying",
|
|
211
|
+
"figure.label.recipe-category-support": "supports and structure",
|
|
212
|
+
"figure.label.recipe-category-safety": "safety",
|
|
213
|
+
"figure.label.recipe-category-signal": "signals and lights",
|
|
214
|
+
"figure.label.recipe-category-control": "controls and electrical",
|
|
215
|
+
"figure.label.recipe-category-handling": "handling",
|
|
216
|
+
"figure.label.recipe-category-storage": "storage and containers",
|
|
217
|
+
"figure.label.recipe-category-utility": "piping and utilities",
|
|
218
|
+
"figure.label.recipe-category-space": "space and building",
|
|
219
|
+
"figure.label.recipe-category-other": "other",
|
|
220
|
+
"figure.label.recipe-adds": "what it puts in",
|
|
221
|
+
"figure.text.recipe-parts": "{parts} parts",
|
|
222
|
+
"figure.text.recipe-slides": "{part}: slides",
|
|
223
|
+
"figure.text.recipe-turns": "{part}: turns",
|
|
224
|
+
"figure.text.recipe-moves-with": "{part}: moves with {leader}",
|
|
225
|
+
"figure.text.recipe-controls": "moved by {count} control(s)",
|
|
226
|
+
"figure.text.recipe-shown-by-control": "{parts}: shown by a control",
|
|
227
|
+
"figure.text.recipe-row": "{part}: a row along the part's length",
|
|
228
|
+
"figure.text.recipe-onto-chosen": "fastened to the chosen part, following its size",
|
|
229
|
+
"figure.text.recipe-onto-figure": "put onto the whole figure",
|
|
230
|
+
"figure.label.recipe-values": "values",
|
|
231
|
+
"figure.button.insert-recipe-onto": "put onto {part}",
|
|
232
|
+
"figure.button.open-recipe-catalog": "recipe catalog ({count})",
|
|
233
|
+
"figure.label.primitive-hollow-box": "tote",
|
|
234
|
+
"figure.label.field-roundX": "corner X",
|
|
235
|
+
"figure.label.field-roundZ": "corner Z",
|
|
236
|
+
"figure.label.field-wallX": "wall X",
|
|
237
|
+
"figure.label.field-wallZ": "wall Z",
|
|
238
|
+
"figure.label.field-floor": "floor",
|
|
239
|
+
"figure.label.face-inside-bottom": "inside bottom",
|
|
240
|
+
"figure.label.face-inside-left": "inside left",
|
|
241
|
+
"figure.label.face-inside-right": "inside right",
|
|
242
|
+
"figure.label.face-inside-back": "inside back",
|
|
243
|
+
"figure.label.face-inside-front": "inside front",
|
|
229
244
|
"figure.label.placement": "附着",
|
|
230
245
|
"figure.label.placement-ceiling": "天花板基准 (ceiling)",
|
|
231
246
|
"figure.label.placement-center": "中心基准 (center)",
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
import '../modeller/figure-v3-preview.js'
|
|
3
|
-
|
|
4
|
-
import { css, html, nothing } from 'lit'
|
|
5
|
-
import { customElement, state } from 'lit/decorators.js'
|
|
6
|
-
|
|
7
|
-
import { i18next, localize } from '@operato/i18n'
|
|
8
|
-
import { PageView } from '@operato/shell'
|
|
9
|
-
import { OxPrompt } from '@operato/popup'
|
|
10
|
-
import { ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'
|
|
11
|
-
import { applyV3Recipe, parseV3Recipe, v3RecipeTestRoom } from '@hatiolab/figure-model'
|
|
12
|
-
import type { V3Asset, V3Recipe } from '@hatiolab/figure-model'
|
|
13
|
-
|
|
14
|
-
import { deleteFigureRecipe, fetchFigureRecipeRows, saveFigureRecipe, setFigureRecipeState, type FigureRecipeRow } from '../graphql/index.js'
|
|
15
|
-
import { paramRangeOf, recipeFieldOf, recipeIsOwn, recipesOf, recipeWord, subdomainOf } from '../modeller/v3-recipes.js'
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The recipes (ADR-0095): what each one puts in, shown put into a room at several sizes, and whose it is.
|
|
19
|
-
*
|
|
20
|
-
* A recipe of this domain's own can be released, taken back to draft, changed or deleted. A parent's -- the ones the
|
|
21
|
-
* system domain ships -- is copied in under its name to be changed, and the copy stands in for it. Figures a recipe was
|
|
22
|
-
* put into keep their parts whatever happens here.
|
|
23
|
-
*/
|
|
24
|
-
@customElement('figure-recipe-page')
|
|
25
|
-
export class FigureRecipePage extends localize(i18next)(PageView) {
|
|
26
|
-
static styles = [
|
|
27
|
-
WorkSurfacePageStyles,
|
|
28
|
-
ScrollbarStyles,
|
|
29
|
-
css`
|
|
30
|
-
:host {
|
|
31
|
-
display: grid;
|
|
32
|
-
grid-template-columns: minmax(220px, 280px) 1fr;
|
|
33
|
-
background-color: var(--md-sys-color-surface);
|
|
34
|
-
color: var(--md-sys-color-on-surface);
|
|
35
|
-
font-size: 0.85rem;
|
|
36
|
-
}
|
|
37
|
-
@container (max-width: 640px) {
|
|
38
|
-
:host {
|
|
39
|
-
grid-template-columns: 1fr;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
nav {
|
|
43
|
-
overflow: auto;
|
|
44
|
-
border-right: 1px solid var(--md-sys-color-outline-variant);
|
|
45
|
-
padding: 8px;
|
|
46
|
-
}
|
|
47
|
-
nav p[intro] {
|
|
48
|
-
margin: 4px 4px 10px;
|
|
49
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
50
|
-
line-height: 1.5;
|
|
51
|
-
}
|
|
52
|
-
button[row] {
|
|
53
|
-
display: grid;
|
|
54
|
-
gap: 2px;
|
|
55
|
-
width: 100%;
|
|
56
|
-
padding: 8px 10px;
|
|
57
|
-
text-align: left;
|
|
58
|
-
font: inherit;
|
|
59
|
-
color: inherit;
|
|
60
|
-
background: none;
|
|
61
|
-
border: none;
|
|
62
|
-
border-radius: 8px;
|
|
63
|
-
cursor: pointer;
|
|
64
|
-
}
|
|
65
|
-
button[row][on] {
|
|
66
|
-
background: var(--md-sys-color-secondary-container);
|
|
67
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
68
|
-
}
|
|
69
|
-
button[row] small {
|
|
70
|
-
display: flex;
|
|
71
|
-
gap: 6px;
|
|
72
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
73
|
-
}
|
|
74
|
-
span[chip] {
|
|
75
|
-
padding: 0 6px;
|
|
76
|
-
border-radius: 999em;
|
|
77
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
78
|
-
font-size: 0.7rem;
|
|
79
|
-
}
|
|
80
|
-
span[chip][draft] {
|
|
81
|
-
color: var(--md-sys-color-tertiary);
|
|
82
|
-
border-color: var(--md-sys-color-tertiary);
|
|
83
|
-
}
|
|
84
|
-
main {
|
|
85
|
-
overflow: auto;
|
|
86
|
-
padding: 12px 16px;
|
|
87
|
-
display: grid;
|
|
88
|
-
gap: 12px;
|
|
89
|
-
align-content: start;
|
|
90
|
-
}
|
|
91
|
-
main h2 {
|
|
92
|
-
margin: 0;
|
|
93
|
-
font-size: var(--ui-t-title, 16px);
|
|
94
|
-
}
|
|
95
|
-
main p {
|
|
96
|
-
margin: 0;
|
|
97
|
-
line-height: 1.5;
|
|
98
|
-
}
|
|
99
|
-
p[muted] {
|
|
100
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
101
|
-
}
|
|
102
|
-
table {
|
|
103
|
-
border-collapse: collapse;
|
|
104
|
-
width: 100%;
|
|
105
|
-
max-width: 720px;
|
|
106
|
-
}
|
|
107
|
-
th,
|
|
108
|
-
td {
|
|
109
|
-
text-align: left;
|
|
110
|
-
padding: 4px 8px;
|
|
111
|
-
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
112
|
-
}
|
|
113
|
-
figure-v3-preview {
|
|
114
|
-
height: 420px;
|
|
115
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
116
|
-
border-radius: 8px;
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
}
|
|
119
|
-
div[actions] {
|
|
120
|
-
display: flex;
|
|
121
|
-
flex-wrap: wrap;
|
|
122
|
-
gap: 8px;
|
|
123
|
-
}
|
|
124
|
-
div[actions] button {
|
|
125
|
-
display: inline-flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
gap: 4px;
|
|
128
|
-
padding: 6px 12px;
|
|
129
|
-
font: inherit;
|
|
130
|
-
color: var(--md-sys-color-on-surface);
|
|
131
|
-
background: none;
|
|
132
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
133
|
-
border-radius: 999em;
|
|
134
|
-
cursor: pointer;
|
|
135
|
-
}
|
|
136
|
-
div[actions] button[primary] {
|
|
137
|
-
color: var(--md-sys-color-on-primary);
|
|
138
|
-
background: var(--md-sys-color-primary);
|
|
139
|
-
border-color: transparent;
|
|
140
|
-
}
|
|
141
|
-
div[actions] button[danger] {
|
|
142
|
-
color: var(--md-sys-color-error);
|
|
143
|
-
border-color: var(--md-sys-color-error);
|
|
144
|
-
}
|
|
145
|
-
p[role='alert'] {
|
|
146
|
-
padding: 8px;
|
|
147
|
-
white-space: pre-wrap;
|
|
148
|
-
color: var(--md-sys-color-on-error-container);
|
|
149
|
-
background: var(--md-sys-color-error-container);
|
|
150
|
-
border-radius: 8px;
|
|
151
|
-
}
|
|
152
|
-
textarea {
|
|
153
|
-
width: 100%;
|
|
154
|
-
min-height: 320px;
|
|
155
|
-
font: 0.78rem/1.4 monospace;
|
|
156
|
-
box-sizing: border-box;
|
|
157
|
-
}
|
|
158
|
-
`
|
|
159
|
-
]
|
|
160
|
-
|
|
161
|
-
@state() private rows: FigureRecipeRow[] = []
|
|
162
|
-
@state() private chosen = ''
|
|
163
|
-
@state() private error = ''
|
|
164
|
-
@state() private editing = false
|
|
165
|
-
@state() private text = ''
|
|
166
|
-
|
|
167
|
-
get context() {
|
|
168
|
-
return { title: i18next.t('figure.title.recipes') }
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async pageUpdated(_changes: Record<string, unknown>, _lifecycle: unknown, before: { active?: boolean }) {
|
|
172
|
-
if (this.active && !before?.active) await this.read()
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
private async read() {
|
|
176
|
-
try {
|
|
177
|
-
this.rows = await fetchFigureRecipeRows()
|
|
178
|
-
if (!this.rows.some(r => r.name === this.chosen)) this.chosen = this.rows[0]?.name ?? ''
|
|
179
|
-
this.error = ''
|
|
180
|
-
} catch (error) {
|
|
181
|
-
this.error = error instanceof Error ? error.message : String(error)
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
private get subdomain() {
|
|
186
|
-
return subdomainOf(location.pathname)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
render() {
|
|
190
|
-
const language = i18next.language || 'en'
|
|
191
|
-
const recipes = recipesOf(this.rows)
|
|
192
|
-
const row = this.rows.find(r => r.name === this.chosen)
|
|
193
|
-
const recipe = recipes.find(r => r.name === this.chosen)
|
|
194
|
-
return html`
|
|
195
|
-
<nav>
|
|
196
|
-
<p intro>${i18next.t('figure.text.recipes-intro')}</p>
|
|
197
|
-
${this.rows.map(one => {
|
|
198
|
-
const r = recipes.find(x => x.name === one.name)
|
|
199
|
-
return html`<button row ?on=${one.name === this.chosen} @click=${() => this.choose(one.name)}>
|
|
200
|
-
<span>${r ? recipeWord(r.title, language) : one.name}</span>
|
|
201
|
-
<small>
|
|
202
|
-
<span>${one.name}</span>
|
|
203
|
-
${one.state === 'draft' ? html`<span chip draft>${i18next.t('figure.label.recipe-draft')}</span>` : nothing}
|
|
204
|
-
${recipeIsOwn(one, this.subdomain) ? nothing : html`<span chip>${i18next.t('figure.label.recipe-inherited')}</span>`}
|
|
205
|
-
</small>
|
|
206
|
-
</button>`
|
|
207
|
-
})}
|
|
208
|
-
</nav>
|
|
209
|
-
<main>
|
|
210
|
-
${this.error ? html`<p role="alert">${this.error}</p>` : nothing}
|
|
211
|
-
${row && recipe ? this.renderRecipe(row, recipe, language) : html`<p muted>${i18next.t('figure.text.recipes-empty')}</p>`}
|
|
212
|
-
</main>
|
|
213
|
-
`
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
private renderRecipe(row: FigureRecipeRow, recipe: V3Recipe, language: string) {
|
|
217
|
-
const own = recipeIsOwn(row, this.subdomain)
|
|
218
|
-
return html`
|
|
219
|
-
<h2>${recipeWord(recipe.title, language)}</h2>
|
|
220
|
-
<p>${recipeWord(recipe.description, language)}</p>
|
|
221
|
-
<p muted>
|
|
222
|
-
${i18next.t(recipe.target === 'part' ? 'figure.text.recipe-target-part' : 'figure.text.recipe-target-figure')} ·
|
|
223
|
-
${i18next.t(own ? 'figure.text.recipe-own' : 'figure.text.recipe-inherited', { domain: row.domain?.subdomain ?? '' })}
|
|
224
|
-
</p>
|
|
225
|
-
<table>
|
|
226
|
-
<thead>
|
|
227
|
-
<tr>
|
|
228
|
-
<th>${i18next.t('figure.label.recipe-param')}</th>
|
|
229
|
-
<th>${i18next.t('figure.label.recipe-default')}</th>
|
|
230
|
-
<th>${i18next.t('figure.label.recipe-range')}</th>
|
|
231
|
-
</tr>
|
|
232
|
-
</thead>
|
|
233
|
-
<tbody>
|
|
234
|
-
${recipe.params.map(
|
|
235
|
-
p => html`<tr>
|
|
236
|
-
<td>${recipeWord(p.label, language) || p.name}</td>
|
|
237
|
-
<td>${p.kind === 'flag' ? i18next.t(p.default ? 'figure.label.yes' : 'figure.label.no') : recipeFieldOf(p, p.default)}${p.kind === 'ratio' ? ' %' : ''}</td>
|
|
238
|
-
<td>${paramRangeOf(p)}</td>
|
|
239
|
-
</tr>`
|
|
240
|
-
)}
|
|
241
|
-
</tbody>
|
|
242
|
-
</table>
|
|
243
|
-
${this.renderPreview(recipe)}
|
|
244
|
-
<div actions>
|
|
245
|
-
${own
|
|
246
|
-
? html`${row.state === 'draft'
|
|
247
|
-
? html`<button primary @click=${() => this.setState(row.name, 'released')}>${i18next.t('figure.button.recipe-release')}</button>`
|
|
248
|
-
: html`<button @click=${() => this.setState(row.name, 'draft')}>${i18next.t('figure.button.recipe-to-draft')}</button>`}
|
|
249
|
-
<button danger @click=${() => this.deleteRecipe(row.name)}><md-icon>delete</md-icon>${i18next.t('figure.button.recipe-delete')}</button>`
|
|
250
|
-
: html`<button primary @click=${() => this.copyIn(row)}>${i18next.t('figure.button.recipe-copy-in')}</button>`}
|
|
251
|
-
<button @click=${() => this.edit(row)}><md-icon>data_object</md-icon>${i18next.t('figure.button.recipe-edit-source')}</button>
|
|
252
|
-
</div>
|
|
253
|
-
${this.editing
|
|
254
|
-
? html`<p muted>${i18next.t('figure.text.recipe-edit-source')}</p>
|
|
255
|
-
<textarea .value=${this.text} @input=${(e: Event) => (this.text = (e.target as HTMLTextAreaElement).value)}></textarea>
|
|
256
|
-
<div actions>
|
|
257
|
-
<button primary @click=${() => this.saveText(own ? row.state : 'draft')}>${i18next.t('figure.button.save')}</button>
|
|
258
|
-
<button @click=${() => (this.editing = false)}>${i18next.t('figure.button.close')}</button>
|
|
259
|
-
</div>`
|
|
260
|
-
: nothing}
|
|
261
|
-
`
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/** The recipe put into the room it is checked in, with its defaults: what it makes, at several sizes. */
|
|
265
|
-
private renderPreview(recipe: V3Recipe) {
|
|
266
|
-
let asset: V3Asset
|
|
267
|
-
try {
|
|
268
|
-
const room = v3RecipeTestRoom()
|
|
269
|
-
asset = applyV3Recipe(room.asset, parseV3Recipe(recipe), recipe.target === 'part' ? { target: room.target } : {}).asset
|
|
270
|
-
} catch (error) {
|
|
271
|
-
return html`<p role="alert">${error instanceof Error ? error.message : String(error)}</p>`
|
|
272
|
-
}
|
|
273
|
-
return html`<p muted>${i18next.t('figure.text.recipe-preview')}</p>
|
|
274
|
-
<figure-v3-preview .asset=${asset} .context=${`recipe:${recipe.name}`}></figure-v3-preview>`
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
private choose(name: string) {
|
|
278
|
-
this.chosen = name
|
|
279
|
-
this.editing = false
|
|
280
|
-
this.error = ''
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
private edit(row: FigureRecipeRow) {
|
|
284
|
-
this.editing = !this.editing
|
|
285
|
-
try {
|
|
286
|
-
this.text = JSON.stringify(JSON.parse(row.source), null, 2)
|
|
287
|
-
} catch {
|
|
288
|
-
this.text = row.source
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private async run(action: () => Promise<unknown>) {
|
|
293
|
-
try {
|
|
294
|
-
await action()
|
|
295
|
-
this.error = ''
|
|
296
|
-
await this.read()
|
|
297
|
-
} catch (error) {
|
|
298
|
-
this.error = error instanceof Error ? error.message : String(error)
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
private setState(name: string, state: 'draft' | 'released') {
|
|
303
|
-
return this.run(() => setFigureRecipeState(name, state))
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/* The app's own prompt, as every operato screen asks -- not the browser's confirm box (user, 2026-09-24). */
|
|
307
|
-
private async deleteRecipe(name: string) {
|
|
308
|
-
const sure = await OxPrompt.open({
|
|
309
|
-
type: 'warning',
|
|
310
|
-
title: i18next.t('figure.button.recipe-delete'),
|
|
311
|
-
text: i18next.t('figure.text.recipe-delete-confirm', { name }),
|
|
312
|
-
confirmButton: { text: i18next.t('figure.button.recipe-delete') },
|
|
313
|
-
cancelButton: { text: i18next.t('figure.button.close') }
|
|
314
|
-
})
|
|
315
|
-
if (sure) await this.run(() => deleteFigureRecipe(name))
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/** A parent's recipe copied into this domain as a draft, to be changed here. */
|
|
319
|
-
private copyIn(row: FigureRecipeRow) {
|
|
320
|
-
return this.run(() => saveFigureRecipe(row.source, 'draft'))
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/** The source as typed: checked by the server in the test room; a new name is a new recipe. */
|
|
324
|
-
private async saveText(state: 'draft' | 'released') {
|
|
325
|
-
let name = ''
|
|
326
|
-
try {
|
|
327
|
-
name = JSON.parse(this.text).name ?? ''
|
|
328
|
-
} catch (error) {
|
|
329
|
-
this.error = error instanceof Error ? error.message : String(error)
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
await this.run(async () => {
|
|
333
|
-
await saveFigureRecipe(this.text, state)
|
|
334
|
-
this.chosen = name
|
|
335
|
-
this.editing = false
|
|
336
|
-
})
|
|
337
|
-
}
|
|
338
|
-
}
|