@things-factory/figure-ui 10.1.56 → 10.1.58
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/modeller/v3-editor.ts +18 -2
- package/client/modeller/v3-links.ts +12 -0
- package/dist-client/modeller/figure-v3-capability.d.ts +1 -1
- package/dist-client/modeller/figure-v3-clips.d.ts +1 -1
- package/dist-client/modeller/figure-v3-controls.d.ts +1 -1
- package/dist-client/modeller/figure-v3-links.d.ts +1 -1
- package/dist-client/modeller/figure-v3-material.d.ts +1 -1
- package/dist-client/modeller/figure-v3-properties.d.ts +1 -1
- package/dist-client/modeller/v3-editor.js +17 -2
- package/dist-client/modeller/v3-editor.js.map +1 -1
- package/dist-client/modeller/v3-links.d.ts +6 -0
- package/dist-client/modeller/v3-links.js +12 -0
- package/dist-client/modeller/v3-links.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/test/browser/modeller.check.mjs +33 -0
- package/test/v3-links.test.ts +20 -1
|
@@ -3,6 +3,7 @@ import { i18next } from '@operato/i18n'
|
|
|
3
3
|
import type { OxThreePane } from '@operato/layout'
|
|
4
4
|
import '@operato/layout'
|
|
5
5
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
6
|
+
import { live } from 'lit/directives/live.js'
|
|
6
7
|
import { PART_LIMIT, v3PartCountOf } from '@hatiolab/figure-model'
|
|
7
8
|
import type { V3Asset, V3AuthoringAction, V3InputChange, V3PartEdit, V3PrimitiveCreation } from '@hatiolab/figure-model'
|
|
8
9
|
import type { V3ProductSession } from './v3-product-session.js'
|
|
@@ -31,7 +32,7 @@ import { nudgeOf } from './v3-stage-model.js'
|
|
|
31
32
|
import { narrowingRetryOf, partRefusalOf, sizeRangeRefusalOf } from './v3-refusals.js'
|
|
32
33
|
import type { V3RenderPart } from './v3-renderer.js'
|
|
33
34
|
import type { V3BudgetLine } from './v3-maturity.js'
|
|
34
|
-
import { instanceRangeOf, instanceRangeToDeclare, rangeDiffers, turnsAboutAJoint } from './v3-links.js'
|
|
35
|
+
import { instanceRangeOf, instanceRangeToDeclare, rangeDiffers, rangeWith, turnsAboutAJoint } from './v3-links.js'
|
|
35
36
|
import { jointFanOf } from './v3-joint-fan.js'
|
|
36
37
|
import { jointDragOf } from './v3-joint-drag.js'
|
|
37
38
|
import type { FirstSave } from './v3-first-save.js'
|
|
@@ -764,7 +765,22 @@ export class FigureV3Editor extends LitElement {
|
|
|
764
765
|
<h3>${i18next.t('figure.label.instance-range')}</h3>
|
|
765
766
|
${(['x', 'y', 'z'] as const).map(
|
|
766
767
|
axis => html`<div inline-field>
|
|
767
|
-
<label>${axis.toUpperCase()}
|
|
768
|
+
<label>${axis.toUpperCase()} <span unit>mm</span></label>
|
|
769
|
+
<div pair>
|
|
770
|
+
${(['min', 'max'] as const).map(
|
|
771
|
+
bound => html`<input
|
|
772
|
+
aria-label=${`size.${axis}.${bound}`}
|
|
773
|
+
type="number"
|
|
774
|
+
step="any"
|
|
775
|
+
.value=${live(String(Math.round(range.declared[axis][bound])))}
|
|
776
|
+
?disabled=${unavailable}
|
|
777
|
+
@change=${(e: Event) => {
|
|
778
|
+
const next = rangeWith(range.declared, axis, bound, (e.target as HTMLInputElement).valueAsNumber)
|
|
779
|
+
if (next) this.linkCommand({ kind: 'declare-instance-size', range: next, replace: true })
|
|
780
|
+
}}
|
|
781
|
+
/>`
|
|
782
|
+
)}
|
|
783
|
+
</div>
|
|
768
784
|
</div>`
|
|
769
785
|
)}
|
|
770
786
|
${differs
|
|
@@ -442,6 +442,18 @@ export function instanceRangeToDeclare(asset: V3Asset): { range: V3SizeRange; at
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
/** Whether measuring again would change the declared range (to a micrometre). */
|
|
445
|
+
/**
|
|
446
|
+
* The declared range with one end typed by the author: the sizes a figure may be placed at are a claim about the
|
|
447
|
+
* product (a gantry spans metres, not 30 cm to 29 m), and measuring only ever widens them. Nothing when the typed
|
|
448
|
+
* value is not a number; whether the figure holds there is the command's to say.
|
|
449
|
+
*/
|
|
450
|
+
export function rangeWith(declared: V3SizeRange, axis: Axis, bound: 'min' | 'max', value: number): V3SizeRange | undefined {
|
|
451
|
+
if (!Number.isFinite(value)) return undefined
|
|
452
|
+
const next = structuredClone(declared)
|
|
453
|
+
next[axis][bound] = value
|
|
454
|
+
return next
|
|
455
|
+
}
|
|
456
|
+
|
|
445
457
|
export function rangeDiffers(a: V3SizeRange, b: V3SizeRange): boolean {
|
|
446
458
|
return AXES.some(axis => Math.abs(a[axis].min - b[axis].min) > 1e-3 || Math.abs(a[axis].max - b[axis].max) > 1e-3)
|
|
447
459
|
}
|
|
@@ -15,7 +15,7 @@ export declare class FigureV3Capability extends FigureV3Capability_base {
|
|
|
15
15
|
/** The selected part, whose places are marked. */
|
|
16
16
|
selected: string;
|
|
17
17
|
locked: boolean;
|
|
18
|
-
render():
|
|
18
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
19
19
|
private setRung;
|
|
20
20
|
private pick;
|
|
21
21
|
}
|
|
@@ -18,7 +18,7 @@ export declare class FigureV3Clips extends FigureV3Clips_base {
|
|
|
18
18
|
/** Where each clip is scrubbed to, in seconds. */
|
|
19
19
|
private at;
|
|
20
20
|
private adding;
|
|
21
|
-
render():
|
|
21
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
22
22
|
private renderClip;
|
|
23
23
|
private renderTrack;
|
|
24
24
|
private renderAdd;
|
|
@@ -22,7 +22,7 @@ export declare class FigureV3Controls extends FigureV3Controls_base {
|
|
|
22
22
|
private open;
|
|
23
23
|
/** Values in hand while a slider is dragged: the dial and the number follow them before the release commits. */
|
|
24
24
|
private live;
|
|
25
|
-
render():
|
|
25
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
26
26
|
private renderControl;
|
|
27
27
|
private renderDial;
|
|
28
28
|
private renderSettings;
|
|
@@ -34,7 +34,7 @@ export declare class FigureV3Links extends FigureV3Links_base {
|
|
|
34
34
|
/** The motion form is open over the part's own motion, to change it where it is. */
|
|
35
35
|
private editingMotion;
|
|
36
36
|
willUpdate(changed: Map<string, unknown>): void;
|
|
37
|
-
render():
|
|
37
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
38
38
|
/** Where things are held on this part: a seat things rest on, or a grip things are held in (parity row ⑤). */
|
|
39
39
|
private renderPlaces;
|
|
40
40
|
/** The figure holds things: `Capacity` and `Holdable`, the ladder's middle rung. One part edit, one undo step. */
|
|
@@ -26,7 +26,7 @@ export declare class FigureV3Material extends FigureV3Material_base {
|
|
|
26
26
|
locked: boolean;
|
|
27
27
|
/** The glow while its slider is dragged: shown beside it and drawn on the canvas, recorded on release. */
|
|
28
28
|
private glowing?;
|
|
29
|
-
render():
|
|
29
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
30
30
|
private renderSegments;
|
|
31
31
|
private swatches;
|
|
32
32
|
private offered;
|
|
@@ -29,7 +29,7 @@ export declare class FigureV3Properties extends FigureV3Properties_base {
|
|
|
29
29
|
private pickedPart?;
|
|
30
30
|
private pickedFace?;
|
|
31
31
|
private facts;
|
|
32
|
-
render():
|
|
32
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
33
33
|
private renderName;
|
|
34
34
|
/**
|
|
35
35
|
* The face the figure is placed by. In V3 it is part of the room declaration, so choosing one declares the room
|
|
@@ -4,6 +4,7 @@ import { LitElement, html, css, nothing } from 'lit';
|
|
|
4
4
|
import { i18next } from '@operato/i18n';
|
|
5
5
|
import '@operato/layout';
|
|
6
6
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
7
|
+
import { live } from 'lit/directives/live.js';
|
|
7
8
|
import { PART_LIMIT, v3PartCountOf } from '@hatiolab/figure-model';
|
|
8
9
|
import { captureV3Thumbnail } from './v3-thumbnail.js';
|
|
9
10
|
import { drawableV3Parts } from './v3-renderer.js';
|
|
@@ -26,7 +27,7 @@ import { alignChanges, boxOf, canMirror, mirrorChanges } from './v3-align.js';
|
|
|
26
27
|
import { paletteRecipe } from './v3-palette.js';
|
|
27
28
|
import { nudgeOf } from './v3-stage-model.js';
|
|
28
29
|
import { narrowingRetryOf, partRefusalOf, sizeRangeRefusalOf } from './v3-refusals.js';
|
|
29
|
-
import { instanceRangeOf, instanceRangeToDeclare, rangeDiffers, turnsAboutAJoint } from './v3-links.js';
|
|
30
|
+
import { instanceRangeOf, instanceRangeToDeclare, rangeDiffers, rangeWith, turnsAboutAJoint } from './v3-links.js';
|
|
30
31
|
import { jointFanOf } from './v3-joint-fan.js';
|
|
31
32
|
import { jointDragOf } from './v3-joint-drag.js';
|
|
32
33
|
import { liveOverSession, NOTHING_LIVE, scrubbed, scrubStep } from './v3-live.js';
|
|
@@ -778,7 +779,21 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
|
|
|
778
779
|
return html `<section>
|
|
779
780
|
<h3>${i18next.t('figure.label.instance-range')}</h3>
|
|
780
781
|
${['x', 'y', 'z'].map(axis => html `<div inline-field>
|
|
781
|
-
<label>${axis.toUpperCase()}
|
|
782
|
+
<label>${axis.toUpperCase()} <span unit>mm</span></label>
|
|
783
|
+
<div pair>
|
|
784
|
+
${['min', 'max'].map(bound => html `<input
|
|
785
|
+
aria-label=${`size.${axis}.${bound}`}
|
|
786
|
+
type="number"
|
|
787
|
+
step="any"
|
|
788
|
+
.value=${live(String(Math.round(range.declared[axis][bound])))}
|
|
789
|
+
?disabled=${unavailable}
|
|
790
|
+
@change=${(e) => {
|
|
791
|
+
const next = rangeWith(range.declared, axis, bound, e.target.valueAsNumber);
|
|
792
|
+
if (next)
|
|
793
|
+
this.linkCommand({ kind: 'declare-instance-size', range: next, replace: true });
|
|
794
|
+
}}
|
|
795
|
+
/>`)}
|
|
796
|
+
</div>
|
|
782
797
|
</div>`)}
|
|
783
798
|
${differs
|
|
784
799
|
? html `<p hint>
|