@things-factory/figure-ui 10.1.147 → 10.1.149

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 (209) hide show
  1. package/client/bootstrap.ts +10 -2
  2. package/client/graphql/index.ts +20 -0
  3. package/client/modeller/canvas.ts +6 -2
  4. package/client/modeller/carrier-declaration.ts +63 -0
  5. package/client/modeller/editor.ts +62 -27
  6. package/client/modeller/figure-carrier.ts +117 -0
  7. package/client/modeller/figure-cavity-drawing.ts +3 -9
  8. package/client/modeller/figure-first-save.ts +4 -7
  9. package/client/modeller/figure-history-panel.ts +2 -3
  10. package/client/modeller/figure-links.ts +46 -60
  11. package/client/modeller/figure-material-panel.ts +4 -14
  12. package/client/modeller/figure-mesh-choice.ts +68 -0
  13. package/client/modeller/figure-parts.ts +23 -1
  14. package/client/modeller/figure-preview.ts +2 -2
  15. package/client/modeller/figure-properties.ts +5 -3
  16. package/client/modeller/figure-section-editor.ts +12 -33
  17. package/client/modeller/figure-section-panel.ts +6 -7
  18. package/client/modeller/figure-slot-layout-panel.ts +208 -0
  19. package/client/modeller/figure-verdict.ts +21 -31
  20. package/client/modeller/first-save.ts +23 -0
  21. package/client/modeller/links.ts +52 -1
  22. package/client/modeller/material-edit.ts +38 -0
  23. package/client/modeller/maturity.ts +28 -0
  24. package/client/modeller/mesh-import.ts +77 -0
  25. package/client/modeller/modeller-route.ts +9 -0
  26. package/client/modeller/mounting-part.ts +15 -0
  27. package/client/modeller/newest-answer.ts +21 -0
  28. package/client/modeller/preview-model.ts +5 -0
  29. package/client/modeller/refusals.ts +168 -82
  30. package/client/modeller/section-controls.ts +25 -1
  31. package/client/modeller/section-drawing.ts +43 -1
  32. package/client/modeller/slot-layout-host.ts +140 -0
  33. package/client/pages/figure-modeller-page.ts +6 -5
  34. package/client/viewparts/detail-route.ts +7 -0
  35. package/client/viewparts/figure-detail-dock.ts +1 -3
  36. package/dist-client/bootstrap.d.ts +1 -1
  37. package/dist-client/bootstrap.js +9 -2
  38. package/dist-client/bootstrap.js.map +1 -1
  39. package/dist-client/graphql/index.d.ts +5 -0
  40. package/dist-client/graphql/index.js +19 -0
  41. package/dist-client/graphql/index.js.map +1 -1
  42. package/dist-client/modeller/canvas.d.ts +2 -0
  43. package/dist-client/modeller/canvas.js +10 -2
  44. package/dist-client/modeller/canvas.js.map +1 -1
  45. package/dist-client/modeller/carrier-declaration.d.ts +31 -0
  46. package/dist-client/modeller/carrier-declaration.js +53 -0
  47. package/dist-client/modeller/carrier-declaration.js.map +1 -0
  48. package/dist-client/modeller/editor.d.ts +13 -0
  49. package/dist-client/modeller/editor.js +62 -27
  50. package/dist-client/modeller/editor.js.map +1 -1
  51. package/dist-client/modeller/figure-carrier.d.ts +26 -0
  52. package/dist-client/modeller/figure-carrier.js +123 -0
  53. package/dist-client/modeller/figure-carrier.js.map +1 -0
  54. package/dist-client/modeller/figure-cavity-drawing.js +3 -11
  55. package/dist-client/modeller/figure-cavity-drawing.js.map +1 -1
  56. package/dist-client/modeller/figure-first-save.d.ts +4 -0
  57. package/dist-client/modeller/figure-first-save.js +5 -8
  58. package/dist-client/modeller/figure-first-save.js.map +1 -1
  59. package/dist-client/modeller/figure-history-panel.js +2 -4
  60. package/dist-client/modeller/figure-history-panel.js.map +1 -1
  61. package/dist-client/modeller/figure-links.d.ts +4 -1
  62. package/dist-client/modeller/figure-links.js +47 -57
  63. package/dist-client/modeller/figure-links.js.map +1 -1
  64. package/dist-client/modeller/figure-material-panel.d.ts +0 -1
  65. package/dist-client/modeller/figure-material-panel.js +4 -14
  66. package/dist-client/modeller/figure-material-panel.js.map +1 -1
  67. package/dist-client/modeller/figure-mesh-choice.d.ts +16 -0
  68. package/dist-client/modeller/figure-mesh-choice.js +75 -0
  69. package/dist-client/modeller/figure-mesh-choice.js.map +1 -0
  70. package/dist-client/modeller/figure-parts.d.ts +1 -1
  71. package/dist-client/modeller/figure-parts.js +22 -0
  72. package/dist-client/modeller/figure-parts.js.map +1 -1
  73. package/dist-client/modeller/figure-preview.js +2 -2
  74. package/dist-client/modeller/figure-preview.js.map +1 -1
  75. package/dist-client/modeller/figure-properties.d.ts +2 -1
  76. package/dist-client/modeller/figure-properties.js +5 -3
  77. package/dist-client/modeller/figure-properties.js.map +1 -1
  78. package/dist-client/modeller/figure-section-editor.d.ts +2 -2
  79. package/dist-client/modeller/figure-section-editor.js +12 -33
  80. package/dist-client/modeller/figure-section-editor.js.map +1 -1
  81. package/dist-client/modeller/figure-section-panel.js +6 -7
  82. package/dist-client/modeller/figure-section-panel.js.map +1 -1
  83. package/dist-client/modeller/figure-slot-layout-panel.d.ts +36 -0
  84. package/dist-client/modeller/figure-slot-layout-panel.js +198 -0
  85. package/dist-client/modeller/figure-slot-layout-panel.js.map +1 -0
  86. package/dist-client/modeller/figure-verdict.d.ts +1 -1
  87. package/dist-client/modeller/figure-verdict.js +19 -37
  88. package/dist-client/modeller/figure-verdict.js.map +1 -1
  89. package/dist-client/modeller/first-save.d.ts +10 -0
  90. package/dist-client/modeller/first-save.js +16 -0
  91. package/dist-client/modeller/first-save.js.map +1 -1
  92. package/dist-client/modeller/links.d.ts +26 -1
  93. package/dist-client/modeller/links.js +43 -0
  94. package/dist-client/modeller/links.js.map +1 -1
  95. package/dist-client/modeller/material-edit.d.ts +11 -0
  96. package/dist-client/modeller/material-edit.js +28 -0
  97. package/dist-client/modeller/material-edit.js.map +1 -0
  98. package/dist-client/modeller/maturity.d.ts +15 -0
  99. package/dist-client/modeller/maturity.js +23 -0
  100. package/dist-client/modeller/maturity.js.map +1 -1
  101. package/dist-client/modeller/mesh-import.d.ts +47 -0
  102. package/dist-client/modeller/mesh-import.js +47 -0
  103. package/dist-client/modeller/mesh-import.js.map +1 -0
  104. package/dist-client/modeller/modeller-route.d.ts +5 -0
  105. package/dist-client/modeller/modeller-route.js +9 -0
  106. package/dist-client/modeller/modeller-route.js.map +1 -1
  107. package/dist-client/modeller/mounting-part.d.ts +14 -0
  108. package/dist-client/modeller/mounting-part.js +10 -0
  109. package/dist-client/modeller/mounting-part.js.map +1 -0
  110. package/dist-client/modeller/newest-answer.d.ts +12 -0
  111. package/dist-client/modeller/newest-answer.js +21 -0
  112. package/dist-client/modeller/newest-answer.js.map +1 -0
  113. package/dist-client/modeller/preview-model.d.ts +2 -0
  114. package/dist-client/modeller/preview-model.js +4 -0
  115. package/dist-client/modeller/preview-model.js.map +1 -1
  116. package/dist-client/modeller/refusals.d.ts +26 -5
  117. package/dist-client/modeller/refusals.js +184 -86
  118. package/dist-client/modeller/refusals.js.map +1 -1
  119. package/dist-client/modeller/section-controls.d.ts +17 -1
  120. package/dist-client/modeller/section-controls.js +18 -0
  121. package/dist-client/modeller/section-controls.js.map +1 -1
  122. package/dist-client/modeller/section-drawing.d.ts +24 -1
  123. package/dist-client/modeller/section-drawing.js +42 -0
  124. package/dist-client/modeller/section-drawing.js.map +1 -1
  125. package/dist-client/modeller/slot-layout-host.d.ts +81 -0
  126. package/dist-client/modeller/slot-layout-host.js +105 -0
  127. package/dist-client/modeller/slot-layout-host.js.map +1 -0
  128. package/dist-client/pages/figure-modeller-page.js +5 -4
  129. package/dist-client/pages/figure-modeller-page.js.map +1 -1
  130. package/dist-client/tsconfig.tsbuildinfo +1 -1
  131. package/dist-client/viewparts/detail-route.d.ts +5 -0
  132. package/dist-client/viewparts/detail-route.js +8 -0
  133. package/dist-client/viewparts/detail-route.js.map +1 -0
  134. package/dist-client/viewparts/figure-detail-dock.d.ts +0 -1
  135. package/dist-client/viewparts/figure-detail-dock.js +1 -3
  136. package/dist-client/viewparts/figure-detail-dock.js.map +1 -1
  137. package/package.json +9 -8
  138. package/test/align.test.ts +0 -9
  139. package/test/browser/assistant-stand-in.js +32 -0
  140. package/test/browser/build.mjs +6 -1
  141. package/test/browser/editing-page.js +224 -0
  142. package/test/browser/editing.check.mjs +550 -0
  143. package/test/browser/links-page.js +113 -0
  144. package/test/browser/links.check.mjs +568 -0
  145. package/test/browser/modeller.check.mjs +21 -0
  146. package/test/browser/parts-page.js +120 -0
  147. package/test/browser/parts.check.mjs +328 -0
  148. package/test/browser/places-mesh-page.js +36 -0
  149. package/test/browser/places-mesh.check.mjs +239 -0
  150. package/test/browser/product-page.check.mjs +682 -0
  151. package/test/browser/product-page.js +276 -0
  152. package/test/browser/screen-page.js +112 -0
  153. package/test/browser/screen-product-page.js +62 -0
  154. package/test/browser/screen.check.mjs +1003 -0
  155. package/test/browser/section-page.js +256 -0
  156. package/test/browser/section.check.mjs +719 -0
  157. package/test/browser/serve.mjs +20 -12
  158. package/test/carrier-declaration.test.ts +69 -0
  159. package/test/cavity-drawing.test.ts +2 -18
  160. package/test/clip-ai-proposal.test.ts +1 -5
  161. package/test/clip-consent.test.ts +0 -5
  162. package/test/clips.test.ts +0 -7
  163. package/test/command-preview.test.ts +0 -68
  164. package/test/controls.test.ts +0 -9
  165. package/test/detail-dock.test.ts +6 -25
  166. package/test/face-mapping.test.ts +1 -20
  167. package/test/fasten-drawing.test.ts +0 -23
  168. package/test/fields.test.ts +6 -33
  169. package/test/figure-assistant-surface.test.ts +32 -38
  170. package/test/first-minute.test.ts +3 -55
  171. package/test/first-save-suggest.test.ts +11 -8
  172. package/test/first-save.test.ts +4 -26
  173. package/test/gizmo.test.ts +0 -25
  174. package/test/joint-fan.test.ts +0 -10
  175. package/test/keys.test.ts +0 -7
  176. package/test/layout.test.ts +4 -73
  177. package/test/links.test.ts +48 -67
  178. package/test/live.test.ts +0 -34
  179. package/test/material.test.ts +17 -26
  180. package/test/maturity.test.ts +13 -16
  181. package/test/mesh-import.test.ts +76 -0
  182. package/test/modeller-route.test.ts +3 -19
  183. package/test/package-download.test.ts +6 -7
  184. package/test/parts-wiring.test.ts +9 -51
  185. package/test/preview.test.ts +5 -46
  186. package/test/properties.test.ts +11 -26
  187. package/test/proposal-record.test.ts +2 -19
  188. package/test/recipes.test.ts +0 -15
  189. package/test/refusals.test.ts +257 -151
  190. package/test/release-entry.test.ts +1 -9
  191. package/test/release-panel.test.ts +1 -22
  192. package/test/resize-with-placement.test.ts +0 -32
  193. package/test/revert-choice.test.ts +1 -22
  194. package/test/revert-keeping.test.ts +1 -12
  195. package/test/save-landed.test.ts +16 -14
  196. package/test/scene-canvas.test.ts +2 -13
  197. package/test/section-editor.test.ts +30 -83
  198. package/test/section-panel.test.ts +22 -17
  199. package/test/slot-layout-host.test.ts +117 -0
  200. package/test/theme.test.ts +5 -9
  201. package/test/verdict.test.ts +44 -41
  202. package/test/view.test.ts +5 -12
  203. package/translations/en.json +61 -1
  204. package/translations/es.json +61 -1
  205. package/translations/ja.json +61 -1
  206. package/translations/ko.json +61 -1
  207. package/translations/ms.json +61 -1
  208. package/translations/zh.json +61 -1
  209. package/test/thumbnail.test.ts +0 -29
@@ -3,7 +3,7 @@ import { __decorate, __metadata } from "tslib";
3
3
  import { LitElement, html, css, nothing } from 'lit';
4
4
  import { i18next } from '@operato/i18n';
5
5
  import '@operato/layout';
6
- import { notify } from '@operato/layout';
6
+ import { notify, openPopup } from '@operato/layout';
7
7
  import { OxPrompt } from '@operato/popup';
8
8
  import { customElement, property, state } from 'lit/decorators.js';
9
9
  import { live } from 'lit/directives/live.js';
@@ -32,11 +32,16 @@ import { SidePanelStyles } from './side-panel-styles.js';
32
32
  import { ScrollbarStyles } from '@operato/styles';
33
33
  import { alignChanges, canMirror, mirrorChanges } from './align.js';
34
34
  import { paletteRecipe } from './palette.js';
35
+ import { meshChoicesOf, meshPartIdOf, meshPartOf } from './mesh-import.js';
36
+ import './figure-mesh-choice.js';
37
+ import { uploadFigureMesh } from '../graphql/index.js';
38
+ import { slotMarksOf } from './slot-layout-host.js';
39
+ const NO_MARKS = [];
35
40
  import { apexOver, drawnOf } from './section-drawing.js';
36
41
  import { END_FACE } from './section-controls.js';
37
42
  import { nudgeOf, placementOf } from './stage-model.js';
38
43
  import { roomRefitRowsOf } from './occupancy.js';
39
- import { editRefusalOf, inDeclaredRoom, inputRangeRefusalOf, narrowingRetryOf, partRefusalOf, placementRefusalOf, recipeRefusalOf, removalNoticeOf, sizeRangeRefusalOf } from './refusals.js';
44
+ import { editRefusalOf, inDeclaredRoom, narrowingRetryOf, partNameRefusalOf, partRefusalOf, placedRefusalOf, recipeRefusalOf, removalNoticeOf } from './refusals.js';
40
45
  import { endPlaceKeyOf, fieldWordsOf, followOf, measureNow, partSummaryOf, instanceRangeOf, instanceRangeToDeclare, proportionToFollow, rangeDiffers, rangeWith, turnsAboutAJoint, valueNow } from './links.js';
41
46
  import { jointFanOf } from './joint-fan.js';
42
47
  import { derivedHeld, derivedOf } from './revision.js';
@@ -694,8 +699,7 @@ let FigureEditor = class FigureEditor extends LitElement {
694
699
  catch (error) {
695
700
  if (this.askClipLoss(error, () => this.run(action)))
696
701
  return;
697
- const say = (key, params) => i18next.t(key, params);
698
- this.error = sizeRangeRefusalOf(error, say) ?? inputRangeRefusalOf(error, say) ?? this.said(error);
702
+ this.error = this.said(error);
699
703
  }
700
704
  finally {
701
705
  /* Committed or refused, the value in hand is gone: the figure as it stands is drawn again. */
@@ -799,6 +803,41 @@ let FigureEditor = class FigureEditor extends LitElement {
799
803
  this.selected = part.id;
800
804
  });
801
805
  }
806
+ /**
807
+ * A GLB made into a mesh part (ADR-0129): the server reads and keeps it, the author picks the whole file or one node
808
+ * of it, and the part is added as one step of the history, standing where it stood in the file. A file the server
809
+ * refuses is said in its words; nothing is added.
810
+ */
811
+ async importMesh(file) {
812
+ if (!this.session)
813
+ return;
814
+ let upload;
815
+ try {
816
+ upload = await uploadFigureMesh(file);
817
+ }
818
+ catch (error) {
819
+ this.error = this.said(error);
820
+ return;
821
+ }
822
+ const choices = meshChoicesOf(upload);
823
+ /* Only the whole file and the one node that is all of it: there is nothing to choose between. */
824
+ const choice = choices.length <= 2
825
+ ? {}
826
+ : await openPopup(html `<figure-mesh-choice .choices=${choices}></figure-mesh-choice>`, {
827
+ backdrop: true,
828
+ size: 'small',
829
+ title: i18next.t('figure.title.choose-mesh-part')
830
+ }).result;
831
+ if (!choice)
832
+ return;
833
+ const node = upload.summary.nodes.find(n => n.index === choice.node);
834
+ this.run(() => {
835
+ const taken = new Set(this.session.read().geometry.map(g => g.id));
836
+ const id = meshPartIdOf(node?.name ?? file.name.replace(/\.glb$/i, ''), taken);
837
+ this.session.add(meshPartOf(upload, choice, id));
838
+ this.selected = id;
839
+ });
840
+ }
802
841
  /**
803
842
  * The list's own operations, as part edits — each one step of the session's history. The copy and the moved
804
843
  * part stay selected.
@@ -990,12 +1029,7 @@ let FigureEditor = class FigureEditor extends LitElement {
990
1029
  this.changed();
991
1030
  }
992
1031
  catch (error) {
993
- const message = error instanceof Error ? error.message : String(error);
994
- this.error = /carried by a joint/.test(message)
995
- ? i18next.t('figure.text.gizmo-joint-places', { part: partLabelOf(id) })
996
- : /is fastened to/.test(message)
997
- ? i18next.t('figure.text.gizmo-fastening-places', { part: partLabelOf(id) })
998
- : this.said(error);
1032
+ this.error = placedRefusalOf(error, partLabelOf(id), (key, params) => i18next.t(key, params)) ?? this.said(error);
999
1033
  this.requestUpdate();
1000
1034
  }
1001
1035
  }
@@ -1119,13 +1153,8 @@ let FigureEditor = class FigureEditor extends LitElement {
1119
1153
  }
1120
1154
  catch (error) {
1121
1155
  input.value = from;
1122
- const code = error?.code;
1123
- this.error =
1124
- code === 'PART_ID'
1125
- ? i18next.t(/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name) ? 'figure.text.part-name-taken' : 'figure.text.part-name-invalid', { name })
1126
- : error instanceof Error
1127
- ? error.message
1128
- : String(error);
1156
+ /* Whether a name is a name is the kernel's rule, said from its refusal (ADR-0127), not checked again here. */
1157
+ this.error = partNameRefusalOf(error, (key, params) => i18next.t(key, params)) ?? this.said(error);
1129
1158
  }
1130
1159
  }
1131
1160
  previewWordsNow() {
@@ -1255,9 +1284,7 @@ let FigureEditor = class FigureEditor extends LitElement {
1255
1284
  ? i18next.t('figure.text.follow-would-loop')
1256
1285
  : code === 'FASTEN_CYCLE' || code === 'ATTACH_CYCLE'
1257
1286
  ? i18next.t('figure.text.fasten-would-loop')
1258
- : sizeRangeRefusalOf(error, (key, params) => i18next.t(key, params)) ??
1259
- placementRefusalOf(error, (key, params) => i18next.t(key, params)) ??
1260
- this.said(error);
1287
+ : this.said(error);
1261
1288
  return false;
1262
1289
  }
1263
1290
  }
@@ -1620,13 +1647,7 @@ let FigureEditor = class FigureEditor extends LitElement {
1620
1647
  }
1621
1648
  catch (error) {
1622
1649
  input.value = String(field.value);
1623
- const code = error?.code;
1624
- const message = error instanceof Error ? error.message : String(error);
1625
- const found = /\((\d[\d.]*) mm\) a pitch under ([\d.]+) mm makes more than (\d+)/.exec(message);
1626
- this.error =
1627
- code === 'INPUT_RANGE' && found
1628
- ? i18next.t('figure.text.repeat-pitch-too-small', { length: Number(found[1]).toLocaleString(), min: found[2], limit: found[3] })
1629
- : this.said(error);
1650
+ this.error = this.said(error);
1630
1651
  }
1631
1652
  }
1632
1653
  /** Choose a part, from the list, the canvas or a place row. A figure-level tab gives way to the part's properties. */
@@ -1828,6 +1849,18 @@ let FigureEditor = class FigureEditor extends LitElement {
1828
1849
  const trying = this.middle === 'preview' ? this.renderRoot.querySelector('figure-preview')?.tried?.() : undefined;
1829
1850
  return { ...(this.selected ? { part: this.selected } : {}), ...(trying ? { trying } : {}) };
1830
1851
  }
1852
+ /**
1853
+ * The slots the figure's slot layout unfolds to, where they fall now (ADR-0118): drawn while the places are being
1854
+ * edited. Made again only when the evaluation is new, so the canvas is not stood up again for nothing.
1855
+ */
1856
+ slotMarks(view, asset) {
1857
+ const places = view.bindings ?? [];
1858
+ if (this.slotMarksDrawn?.of !== places) {
1859
+ const layout = asset?.document?.capabilities?.slotLayout?.layout;
1860
+ this.slotMarksDrawn = { of: places, marks: slotMarksOf(places, layout) };
1861
+ }
1862
+ return this.slotMarksDrawn.marks;
1863
+ }
1831
1864
  choose(id) {
1832
1865
  /* A copy on the canvas selects its repeat: the part the author made. */
1833
1866
  this.selected = id ? ownerOf(id) : id;
@@ -2092,6 +2125,7 @@ let FigureEditor = class FigureEditor extends LitElement {
2092
2125
  @show-model-settings=${() => this.showModelSettings()}
2093
2126
  ?locked=${unavailable}
2094
2127
  @add-part=${(e) => this.add(e.detail.kind)}
2128
+ @import-mesh=${(e) => this.importMesh(e.detail.file)}
2095
2129
  .recipeCount=${this.templates.length}
2096
2130
  @open-recipe-catalog=${() => ((this.catalogOpen = true), (this.recipeError = ''))}
2097
2131
  @select-part=${(e) => this.choose(e.detail.id)}
@@ -2130,6 +2164,7 @@ let FigureEditor = class FigureEditor extends LitElement {
2130
2164
  .fan=${this.fanOf(shown, live)}
2131
2165
  .ghost=${this.previewShown().ghost}
2132
2166
  .highlight=${this.previewShown().highlight}
2167
+ .marks=${this.tab === 'capability' ? this.slotMarks(view, asset) : NO_MARKS}
2133
2168
  .palette=${view.palette ?? {}}
2134
2169
  .context=${view.context ?? ''}
2135
2170
  .selected=${this.selected}