@things-factory/figure-ui 10.1.113 → 10.1.115

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 (49) hide show
  1. package/client/modeller/canvas.ts +6 -0
  2. package/client/modeller/editor.ts +40 -5
  3. package/client/modeller/face-mapping.ts +39 -0
  4. package/client/modeller/figure-face-mapping.ts +78 -0
  5. package/client/modeller/figure-preview.ts +34 -10
  6. package/client/modeller/figure-section-editor.ts +12 -4
  7. package/client/modeller/figure-section-panel.ts +5 -1
  8. package/client/modeller/preview-model.ts +8 -0
  9. package/client/pages/figure-modeller-page.ts +7 -1
  10. package/dist-client/modeller/canvas.js +7 -0
  11. package/dist-client/modeller/canvas.js.map +1 -1
  12. package/dist-client/modeller/editor.d.ts +4 -0
  13. package/dist-client/modeller/editor.js +41 -5
  14. package/dist-client/modeller/editor.js.map +1 -1
  15. package/dist-client/modeller/face-mapping.d.ts +15 -0
  16. package/dist-client/modeller/face-mapping.js +20 -0
  17. package/dist-client/modeller/face-mapping.js.map +1 -0
  18. package/dist-client/modeller/figure-face-mapping.d.ts +16 -0
  19. package/dist-client/modeller/figure-face-mapping.js +85 -0
  20. package/dist-client/modeller/figure-face-mapping.js.map +1 -0
  21. package/dist-client/modeller/figure-preview.d.ts +2 -0
  22. package/dist-client/modeller/figure-preview.js +38 -10
  23. package/dist-client/modeller/figure-preview.js.map +1 -1
  24. package/dist-client/modeller/figure-section-editor.d.ts +4 -1
  25. package/dist-client/modeller/figure-section-editor.js +14 -3
  26. package/dist-client/modeller/figure-section-editor.js.map +1 -1
  27. package/dist-client/modeller/figure-section-panel.d.ts +4 -1
  28. package/dist-client/modeller/figure-section-panel.js +6 -0
  29. package/dist-client/modeller/figure-section-panel.js.map +1 -1
  30. package/dist-client/modeller/preview-model.d.ts +5 -0
  31. package/dist-client/modeller/preview-model.js +7 -0
  32. package/dist-client/modeller/preview-model.js.map +1 -1
  33. package/dist-client/pages/figure-modeller-page.d.ts +1 -0
  34. package/dist-client/pages/figure-modeller-page.js +7 -1
  35. package/dist-client/pages/figure-modeller-page.js.map +1 -1
  36. package/dist-client/route.d.ts +1 -1
  37. package/dist-client/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +6 -6
  39. package/test/browser/acceptance-page.js +11 -0
  40. package/test/clip-consent.test.ts +1 -1
  41. package/test/face-mapping.test.ts +80 -0
  42. package/test/modeller-route.test.ts +8 -0
  43. package/test/preview.test.ts +39 -1
  44. package/test/section-panel.test.ts +1 -1
  45. package/translations/en.json +7 -1
  46. package/translations/ja.json +7 -1
  47. package/translations/ko.json +7 -1
  48. package/translations/ms.json +7 -1
  49. package/translations/zh.json +7 -1
@@ -47,6 +47,7 @@ export declare class FigureEditor extends LitElement {
47
47
  firstSave?: (name: string) => Promise<FirstSave | undefined>;
48
48
  private selected;
49
49
  private error;
50
+ private faceMapping?;
50
51
  /** The same link offered again with the size range narrowed, after a link the declared range could not hold. */
51
52
  private retry?;
52
53
  private tab;
@@ -210,6 +211,9 @@ export declare class FigureEditor extends LitElement {
210
211
  /** The figure's controls: try a value, name it, set its range and travel time, keep the pose. */
211
212
  private renderControls;
212
213
  /** One command, one step of the history. A refusal a person can meet here is said in their words. */
214
+ /** Where a held edit goes once the author has chosen where what stands on its lost faces goes. */
215
+ private mapFaces;
216
+ /** Runs a command; true when it was taken. */
213
217
  private linkCommand;
214
218
  private changeField;
215
219
  /** Typing or a held spinner: each number on the way is drawn; the field's change records it. */
@@ -1194,7 +1194,17 @@ let FigureEditor = class FigureEditor extends LitElement {
1194
1194
  ></figure-clips>`;
1195
1195
  }
1196
1196
  /** One command, one step of the history. A refusal a person can meet here is said in their words. */
1197
- linkCommand(action) {
1197
+ /** Where a held edit goes once the author has chosen where what stands on its lost faces goes. */
1198
+ mapFaces(remap) {
1199
+ const held = this.faceMapping;
1200
+ if (!held)
1201
+ return;
1202
+ const done = this.linkCommand({ ...held.action, remap }, held.from);
1203
+ if (done && held.from === 'section-editor')
1204
+ this.closeSectionEditor();
1205
+ }
1206
+ /** Runs a command; true when it was taken. */
1207
+ linkCommand(action, from = 'panel') {
1198
1208
  /* Committed or refused, a command in hand is let go of: the figure as it stands is drawn again. */
1199
1209
  this.holdAction(null);
1200
1210
  this.retry = undefined;
@@ -1203,6 +1213,7 @@ let FigureEditor = class FigureEditor extends LitElement {
1203
1213
  try {
1204
1214
  this.session.command(action);
1205
1215
  this.error = '';
1216
+ this.faceMapping = undefined;
1206
1217
  /* What the command did besides what was asked, in one line: the figure's size declared to follow (ADR ruling Q1). */
1207
1218
  if (action.kind === 'follow-size' && !hadSize) {
1208
1219
  const size = this.designValues();
@@ -1213,16 +1224,24 @@ let FigureEditor = class FigureEditor extends LitElement {
1213
1224
  });
1214
1225
  }
1215
1226
  this.changed();
1227
+ return true;
1216
1228
  }
1217
1229
  catch (error) {
1218
- if (this.askClipLoss(error, () => this.linkCommand(action)))
1219
- return;
1230
+ if (this.askClipLoss(error, () => this.linkCommand(action, from)))
1231
+ return false;
1220
1232
  const code = error?.code;
1233
+ /* Something stands on a face this takes away: ask where it goes, there, rather than only saying no. */
1234
+ const need = error.details;
1235
+ if (code === 'FEATURE_MAPPING_REQUIRED' && need?.lost?.length) {
1236
+ this.faceMapping = { action, need, from };
1237
+ this.error = '';
1238
+ return false;
1239
+ }
1221
1240
  const narrowing = narrowingRetryOf(action, error, (key, params) => i18next.t(key, params));
1222
1241
  if (narrowing) {
1223
1242
  this.error = narrowing.message;
1224
1243
  this.retry = { label: narrowing.label, action: narrowing.retry };
1225
- return;
1244
+ return false;
1226
1245
  }
1227
1246
  this.error =
1228
1247
  code === 'DIMENSION_CYCLE'
@@ -1232,6 +1251,7 @@ let FigureEditor = class FigureEditor extends LitElement {
1232
1251
  : sizeRangeRefusalOf(error, (key, params) => i18next.t(key, params)) ??
1233
1252
  placementRefusalOf(error, (key, params) => i18next.t(key, params)) ??
1234
1253
  this.said(error);
1254
+ return false;
1235
1255
  }
1236
1256
  }
1237
1257
  changeField(field, event) {
@@ -1779,6 +1799,7 @@ let FigureEditor = class FigureEditor extends LitElement {
1779
1799
  choose(id) {
1780
1800
  /* A copy on the canvas selects its repeat: the part the author made. */
1781
1801
  this.selected = id ? ownerOf(id) : id;
1802
+ this.faceMapping = undefined;
1782
1803
  if (id && (this.tab === 'verdict' || this.tab === 'view' || this.tab === 'history'))
1783
1804
  this.tab = 'properties';
1784
1805
  }
@@ -1842,8 +1863,15 @@ let FigureEditor = class FigureEditor extends LitElement {
1842
1863
  .kept=${kept}
1843
1864
  .pointBlocked=${this.pointBlockedOf(drawn)}
1844
1865
  .revision=${this.session?.read().revision ?? 0}
1845
- @command=${(e) => this.linkCommand(e.detail.action)}
1866
+ .faceMapping=${this.faceMapping?.from === 'section-editor' ? this.faceMapping.need : undefined}
1867
+ @command=${(e) => {
1868
+ /* Held for a choice of where things go: the editor stays open, the choice shown in it. */
1869
+ if (!this.linkCommand(e.detail.action, 'section-editor'))
1870
+ e.detail.held = true;
1871
+ }}
1846
1872
  @command-live=${(e) => this.holdAction(e.detail.action)}
1873
+ @face-mapped=${(e) => this.mapFaces(e.detail.remap)}
1874
+ @face-mapping-cancel=${() => (this.faceMapping = undefined)}
1847
1875
  @section-editor-close=${() => this.closeSectionEditor()}
1848
1876
  ></figure-section-editor>`;
1849
1877
  }
@@ -2052,6 +2080,7 @@ let FigureEditor = class FigureEditor extends LitElement {
2052
2080
  .asset=${asset}
2053
2081
  .context=${view.context ?? ''}
2054
2082
  .view=${this.view}
2083
+ .selected=${this.selected}
2055
2084
  @configure-size=${async (e) => {
2056
2085
  this.middle = 'edit';
2057
2086
  this.selected = e.detail.part;
@@ -2115,6 +2144,9 @@ let FigureEditor = class FigureEditor extends LitElement {
2115
2144
  <figure-section-panel
2116
2145
  .body=${{ ...part, id: this.selected }}
2117
2146
  ?locked=${unavailable}
2147
+ .faceMapping=${this.faceMapping?.from === 'panel' ? this.faceMapping.need : undefined}
2148
+ @face-mapped=${(e) => this.mapFaces(e.detail.remap)}
2149
+ @face-mapping-cancel=${() => (this.faceMapping = undefined)}
2118
2150
  @command=${(e) => this.linkCommand(e.detail.action)}
2119
2151
  @command-live=${(e) => this.holdAction(e.detail.action)}
2120
2152
  @section-editor-open=${() => (this.sectionEditing = this.selected)}
@@ -2363,6 +2395,10 @@ __decorate([
2363
2395
  state(),
2364
2396
  __metadata("design:type", Object)
2365
2397
  ], FigureEditor.prototype, "error", void 0);
2398
+ __decorate([
2399
+ state(),
2400
+ __metadata("design:type", Object)
2401
+ ], FigureEditor.prototype, "faceMapping", void 0);
2366
2402
  __decorate([
2367
2403
  state(),
2368
2404
  __metadata("design:type", Object)