@things-factory/figure-ui 10.1.159 → 10.1.161

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 (35) hide show
  1. package/client/graphql/index.ts +38 -0
  2. package/client/index.ts +1 -0
  3. package/client/modeller/figure-links.ts +21 -6
  4. package/client/modeller/links.ts +13 -0
  5. package/client/pages/figure-list-page.ts +5 -72
  6. package/client/setting-let/figure-namespace-setting-let.ts +85 -0
  7. package/client/viewparts/figure-thumb.ts +10 -37
  8. package/dist-client/graphql/index.d.ts +13 -0
  9. package/dist-client/graphql/index.js +24 -0
  10. package/dist-client/graphql/index.js.map +1 -1
  11. package/dist-client/index.d.ts +1 -0
  12. package/dist-client/index.js +1 -0
  13. package/dist-client/index.js.map +1 -1
  14. package/dist-client/modeller/figure-links.js +21 -7
  15. package/dist-client/modeller/figure-links.js.map +1 -1
  16. package/dist-client/modeller/links.d.ts +13 -0
  17. package/dist-client/modeller/links.js +11 -0
  18. package/dist-client/modeller/links.js.map +1 -1
  19. package/dist-client/pages/figure-list-page.js +5 -72
  20. package/dist-client/pages/figure-list-page.js.map +1 -1
  21. package/dist-client/setting-let/figure-namespace-setting-let.d.ts +18 -0
  22. package/dist-client/setting-let/figure-namespace-setting-let.js +94 -0
  23. package/dist-client/setting-let/figure-namespace-setting-let.js.map +1 -0
  24. package/dist-client/tsconfig.tsbuildinfo +1 -1
  25. package/dist-client/viewparts/figure-thumb.d.ts +3 -1
  26. package/dist-client/viewparts/figure-thumb.js +10 -37
  27. package/dist-client/viewparts/figure-thumb.js.map +1 -1
  28. package/package.json +5 -4
  29. package/test/links.test.ts +29 -0
  30. package/translations/en.json +8 -1
  31. package/translations/es.json +8 -1
  32. package/translations/ja.json +8 -1
  33. package/translations/ko.json +8 -1
  34. package/translations/ms.json +8 -1
  35. package/translations/zh.json +8 -1
@@ -6,7 +6,7 @@ import './figure-slot-layout-panel.js';
6
6
  import { customElement, property, state } from 'lit/decorators.js';
7
7
  import { i18next, localize } from '@operato/i18n';
8
8
  import { FIGURE_FACES, figureFaceOverhangOf } from '@hatiolab/figure-model';
9
- import { acceptsOf, alignOf, AXES, canFasten, facesOf, canFollow, followCommandOf, followableAxes, positionIsShare, choiceOf, heldBy, followOf, hangsFrom, shownWhenOf, visibilityControlsOf, placeKeptOf, fasteningOf, hasInstanceSize, holdsThings, leadersFor, motionOf, motionFormOf, motionFormRefusalOf, endPlaceKeyOf, motionJoint, placeFacesOf, placeIdFor, placesOn, rowAxesOf, rowBlockOf, fixedJointOf, rowOf, positionsWorkedOut, fieldWordsOf, measureNow, ownFacesOf, alignRowsOf } from './links.js';
9
+ import { acceptsOf, alignOf, AXES, canFasten, facesOf, canFollow, followCommandOf, followableAxes, positionIsShare, choiceOf, heldBy, followOf, hangsFrom, shownWhenOf, visibilityControlsOf, placeKeptOf, fasteningOf, fastenGapOf, hasInstanceSize, holdsThings, leadersFor, motionOf, motionFormOf, motionFormRefusalOf, endPlaceKeyOf, motionJoint, placeFacesOf, placeIdFor, placesOn, rowAxesOf, rowBlockOf, fixedJointOf, rowOf, positionsWorkedOut, fieldWordsOf, measureNow, ownFacesOf, alignRowsOf } from './links.js';
10
10
  import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
11
11
  import './figure-fasten-drawing.js';
12
12
  import { faceViewOf, insideAlignmentOf, modeOf, myFaceFor, turnsInPlace } from './fasten-geometry.js';
@@ -23,6 +23,7 @@ const freshFasten = () => ({
23
23
  targetFace: 'top',
24
24
  facing: 'meet',
25
25
  gap: 0,
26
+ gapKept: undefined,
26
27
  twist: 0,
27
28
  align: {},
28
29
  alignMm: {},
@@ -397,11 +398,14 @@ let FigureLinks = class FigureLinks extends localize(i18next)(LitElement) {
397
398
  heldWords(asset) {
398
399
  const joint = (asset.joints ?? []).find(j => j.body1.part === this.partId);
399
400
  const face = joint ? i18next.t(endPlaceKeyOf(joint.body1)) : '';
400
- const gap = typeof joint?.origin?.gap === 'number' ? joint.origin.gap : 0;
401
+ const gap = joint?.origin?.gap ?? 0;
402
+ const place = i18next.t(`figure.label.resize-place-${asset.placement ?? 'floor'}`);
401
403
  const where = !joint
402
404
  ? i18next.t('figure.text.held-by-rule')
403
405
  : 'plane' in joint.body0
404
- ? i18next.t('figure.text.held-on-plane', { face, place: i18next.t(`figure.label.resize-place-${asset.placement ?? 'floor'}`), gap: String(gap) })
406
+ ? typeof gap === 'number'
407
+ ? i18next.t('figure.text.held-on-plane', { face, place, gap: String(gap) })
408
+ : i18next.t('figure.text.held-on-plane-worked-out', { face, place })
405
409
  : i18next.t('figure.text.held-on-part', { face, other: joint.body0.part, otherFace: i18next.t(endPlaceKeyOf(joint.body0)) });
406
410
  return where;
407
411
  }
@@ -483,7 +487,7 @@ let FigureLinks = class FigureLinks extends localize(i18next)(LitElement) {
483
487
  face: myFace,
484
488
  to: f.toPlane ? { plane: 'mounting-plane' } : { part: f.target, face: targetFace },
485
489
  ...(f.toPlane ? {} : { facing: f.facing }),
486
- ...(f.gap ? { gap: f.gap } : {}),
490
+ ...fastenGapOf(f),
487
491
  twist: f.twist,
488
492
  ...(align ? { align } : {}),
489
493
  replace: !!held
@@ -497,7 +501,11 @@ let FigureLinks = class FigureLinks extends localize(i18next)(LitElement) {
497
501
  for the default.
498
502
  */
499
503
  const detail = [
500
- ...(f.gap ? [i18next.t('figure.text.fasten-summary-gap', { mm: String(f.gap) })] : []),
504
+ ...(f.gapKept !== undefined
505
+ ? [i18next.t('figure.text.fasten-summary-gap-worked-out')]
506
+ : f.gap
507
+ ? [i18next.t('figure.text.fasten-summary-gap', { mm: String(f.gap) })]
508
+ : []),
501
509
  ...(f.twist ? [i18next.t('figure.text.fasten-summary-twist', { degrees: String(f.twist) })] : [])
502
510
  ];
503
511
  /* Across the face, a row only where the drawing cannot set it: no drawing of the face, or a share or a field to follow. */
@@ -582,7 +590,13 @@ let FigureLinks = class FigureLinks extends localize(i18next)(LitElement) {
582
590
  ${alignRows.length ? this.renderAlignment(alignRows, settle) : nothing}
583
591
  <div form>
584
592
  <span>${i18next.t('figure.label.gap')}</span>
585
- <input type="number" step="any" .value=${String(f.gap)} @change=${(e) => ((this.fasten = { ...f, gap: Number(e.target.value) || 0 }), settle())} />
593
+ <input
594
+ type="number"
595
+ step="any"
596
+ .value=${f.gapKept !== undefined ? '' : String(f.gap)}
597
+ placeholder=${f.gapKept !== undefined ? i18next.t('figure.label.follows-expression') : ''}
598
+ @change=${(e) => ((this.fasten = { ...f, gap: Number(e.target.value) || 0, gapKept: undefined }), settle())}
599
+ />
586
600
  <span>${i18next.t('figure.label.twist')}</span>
587
601
  <input type="number" step="any" .value=${String(f.twist)} @change=${(e) => ((this.fasten = { ...f, twist: Number(e.target.value) || 0 }), settle())} />
588
602
  </div>
@@ -607,7 +621,7 @@ let FigureLinks = class FigureLinks extends localize(i18next)(LitElement) {
607
621
  else if ('mode' in c)
608
622
  this.fasten = { ...f, face: c.mode === 'centre' ? 'centre' : f.face === 'centre' ? 'bottom' : f.face, facing: c.mode === 'flush' ? 'flush' : 'meet' };
609
623
  else if ('gap' in c)
610
- this.fasten = { ...f, gap: c.gap };
624
+ this.fasten = { ...f, gap: c.gap, gapKept: undefined };
611
625
  else
612
626
  this.fasten = {
613
627
  ...f,