@things-factory/figure-ui 10.1.45 → 10.1.46

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.
@@ -7,7 +7,24 @@ import { i18next, localize } from '@operato/i18n'
7
7
  import { V3_FACES } from '@hatiolab/figure-model'
8
8
  import type { V3Asset, V3AuthoringAction, V3DimensionSource, V3Face } from '@hatiolab/figure-model'
9
9
 
10
- import { AXES, canFasten, canFollow, choiceOf, fastenedTo, followOf, hasInstanceSize, motionOf, positionsWorkedOut, type Axis, type Follow } from './v3-links.js'
10
+ import {
11
+ acceptsOf,
12
+ AXES,
13
+ canFasten,
14
+ canFollow,
15
+ choiceOf,
16
+ fastenedTo,
17
+ followOf,
18
+ hasInstanceSize,
19
+ holdsThings,
20
+ motionOf,
21
+ placeFacesOf,
22
+ placeIdFor,
23
+ placesOn,
24
+ positionsWorkedOut,
25
+ type Axis,
26
+ type Follow
27
+ } from './v3-links.js'
11
28
 
12
29
  const FACES = Object.keys(V3_FACES) as V3Face[]
13
30
 
@@ -107,6 +124,7 @@ export class FigureV3Links extends localize(i18next)(LitElement) {
107
124
 
108
125
  @state() private fasten = { face: 'bottom' as V3Face, toPlane: false, target: '', targetFace: 'top' as V3Face, facing: 'meet' as 'meet' | 'flush', gap: 0 }
109
126
  @state() private motion = { kind: 'slide' as 'slide' | 'turn', axis: 'x' as Axis, id: '', min: 0, max: 500 }
127
+ @state() private place = { role: 'grip' as 'seat' | 'grip', face: 'top' as V3Face, label: '', accepts: '', capacity: 1 }
110
128
 
111
129
  render() {
112
130
  const asset = this.asset
@@ -119,9 +137,82 @@ export class FigureV3Links extends localize(i18next)(LitElement) {
119
137
  ${canFasten(asset, this.partId) ? this.renderFastening(asset) : html`<p hint>${i18next.t('figure.text.links-need-a-box')}</p>`}
120
138
  <h3>${i18next.t('figure.label.motion')}</h3>
121
139
  ${this.renderMotion(asset)}
140
+ <h3>${i18next.t('figure.label.places')}</h3>
141
+ ${placeFacesOf(asset, this.partId).length ? this.renderPlaces(asset) : html`<p hint>${i18next.t('figure.text.places-need-a-box')}</p>`}
122
142
  `
123
143
  }
124
144
 
145
+ /** Where things are held on this part: a seat things rest on, or a grip things are held in (parity row ⑤). */
146
+ private renderPlaces(asset: V3Asset) {
147
+ const faces = placeFacesOf(asset, this.partId)
148
+ const p = this.place
149
+ const face = faces.includes(p.face) ? p.face : faces[0]!
150
+ const accepts = acceptsOf(p.accepts)
151
+ const capacityOk = Number.isSafeInteger(p.capacity) && p.capacity >= 1
152
+ const roleName = (role: string) => i18next.t('figure.label.place-' + role)
153
+ return html`
154
+ ${placesOn(asset, this.partId).map(
155
+ one => html`<div pair>
156
+ <span>
157
+ <b bound>${one.label}</b>
158
+ <small>${roleName(one.role)} · ${one.face ? i18next.t('figure.label.face-' + one.face) : ''} · ${one.accepts.join(', ')} · ${i18next.t('figure.label.place-holds', { count: one.capacity })}</small>
159
+ </span>
160
+ <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'remove-binding', id: one.id })}>
161
+ <md-icon>close</md-icon>${i18next.t('figure.button.remove-place')}
162
+ </button>
163
+ </div>`
164
+ )}
165
+ <p hint>${i18next.t('figure.text.place-explained')}</p>
166
+ ${holdsThings(asset)
167
+ ? nothing
168
+ : html`<p hint>${i18next.t('figure.text.place-needs-holding')}</p>
169
+ <button act ?disabled=${this.locked} @click=${() => this.declareHolding(asset)}>
170
+ <md-icon>inventory_2</md-icon>${i18next.t('figure.button.declare-holding')}
171
+ </button>`}
172
+ <div pair>
173
+ <select @change=${(e: Event) => (this.place = { ...p, role: (e.target as HTMLSelectElement).value as 'seat' | 'grip' })}>
174
+ <option value="grip" ?selected=${p.role === 'grip'}>${roleName('grip')}</option>
175
+ <option value="seat" ?selected=${p.role === 'seat'}>${roleName('seat')}</option>
176
+ </select>
177
+ <select @change=${(e: Event) => (this.place = { ...p, face: (e.target as HTMLSelectElement).value as V3Face })}>
178
+ ${faces.map(one => html`<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}
179
+ </select>
180
+ </div>
181
+ <div form>
182
+ <span>${i18next.t('figure.label.place-name')}</span>
183
+ <input .value=${p.label} placeholder=${roleName(p.role)} @change=${(e: Event) => (this.place = { ...p, label: (e.target as HTMLInputElement).value })} />
184
+ <span>${i18next.t('figure.label.place-accepts')}</span>
185
+ <input .value=${p.accepts} placeholder="BOX, TOTE" @input=${(e: Event) => (this.place = { ...p, accepts: (e.target as HTMLInputElement).value })} />
186
+ <span>${i18next.t('figure.label.place-capacity')}</span>
187
+ <input type="number" min="1" step="1" .value=${String(p.capacity)} @change=${(e: Event) => (this.place = { ...p, capacity: (e.target as HTMLInputElement).valueAsNumber })} />
188
+ </div>
189
+ ${accepts.length ? nothing : html`<small>${i18next.t('figure.text.place-accepts-needed')}</small>`}
190
+ <button
191
+ act
192
+ ?disabled=${this.locked || !accepts.length || !capacityOk}
193
+ @click=${() =>
194
+ this.command({
195
+ kind: 'add-binding',
196
+ id: placeIdFor(asset, this.partId, p.role),
197
+ label: p.label.trim() || roleName(p.role),
198
+ role: p.role,
199
+ part: this.partId,
200
+ face,
201
+ accepts,
202
+ capacity: p.capacity
203
+ })}
204
+ >
205
+ <md-icon>back_hand</md-icon>${i18next.t('figure.button.add-place')}
206
+ </button>
207
+ `
208
+ }
209
+
210
+ /** The figure holds things: `Capacity` and `Holdable`, the ladder's middle rung. One part edit, one undo step. */
211
+ private declareHolding(asset: V3Asset) {
212
+ const names = [...new Set([...(asset.document.capabilities.names ?? []), 'Capacity', 'Holdable'])]
213
+ this.dispatchEvent(new CustomEvent('v3-part-edit', { detail: { edit: { kind: 'set-capabilities', names } }, bubbles: true, composed: true }))
214
+ }
215
+
125
216
  private renderDimensions(asset: V3Asset) {
126
217
  const others = asset.appearance.map(look => look.target).filter(one => one !== this.partId && canFollow(asset, one))
127
218
  return AXES.map(axis => {
@@ -441,6 +441,7 @@ export class FigureV3Editor extends LitElement {
441
441
  .dims=${dims}
442
442
  ?locked=${unavailable}
443
443
  @v3-command=${(e: CustomEvent) => this.linkCommand(e.detail.action)}
444
+ @v3-part-edit=${(e: CustomEvent) => this.run(() => this.session!.edit(e.detail.edit))}
444
445
  ></figure-v3-links>`
445
446
  }
446
447
  /** One command, one step of the history. A refusal a person can meet here is said in their words. */
@@ -559,8 +560,8 @@ export class FigureV3Editor extends LitElement {
559
560
  }
560
561
  ${
561
562
  view.bindings.length
562
- ? html`<h3>배치 연결점</h3>
563
- ${view.bindings.map(b => html`<p>${b.label} · ${b.role}</p>`)}`
563
+ ? html`<h3>${i18next.t('figure.label.places')}</h3>
564
+ ${view.bindings.map(b => html`<p>${b.label} · ${i18next.t('figure.label.place-' + b.role)}</p>`)}`
564
565
  : null
565
566
  }
566
567
  </aside>
@@ -1,5 +1,5 @@
1
- import { v3AttachmentsOf } from '@hatiolab/figure-model'
2
- import type { V3Asset } from '@hatiolab/figure-model'
1
+ import { v3AttachmentsOf, v3BindingsOf } from '@hatiolab/figure-model'
2
+ import type { V3Asset, V3BindingPlace, V3Face } from '@hatiolab/figure-model'
3
3
 
4
4
  /*
5
5
  * What a V3 part is tied to — the readers behind the parts' size response, fastening and motion sections (parity rows
@@ -136,3 +136,35 @@ export function choiceOf(follow: Follow): string {
136
136
  return 'expression'
137
137
  }
138
138
  }
139
+
140
+ /** The faces a place can sit on for this part: a box's six, a rounded box's top and bottom, none for a round body. */
141
+ export function placeFacesOf(asset: V3Asset, part: string): V3Face[] {
142
+ const shape = modelOf(asset).nodes.find(n => n.id === `${part}.shape`)
143
+ if (shape?.op === 'box-shape@1') return ['left', 'right', 'bottom', 'top', 'back', 'front']
144
+ if (shape?.op === 'rounded-box@1') return ['bottom', 'top']
145
+ return []
146
+ }
147
+
148
+ /** The places things are held that sit on this part. */
149
+ export function placesOn(asset: V3Asset, part: string): V3BindingPlace[] {
150
+ return v3BindingsOf(asset).filter(one => one.part === part)
151
+ }
152
+
153
+ /** An id for a new place on this part, not yet taken: `<part>-<role>`, then `-2`, `-3`. */
154
+ export function placeIdFor(asset: V3Asset, part: string, role: 'seat' | 'grip'): string {
155
+ const taken = new Set(asset.document.capabilities.bindings.map(b => b.id))
156
+ const base = `${part}-${role}`
157
+ if (!taken.has(base)) return base
158
+ let n = 2
159
+ while (taken.has(`${base}-${n}`)) n++
160
+ return `${base}-${n}`
161
+ }
162
+
163
+ /**
164
+ * Whether a board will hand this figure anything: a place is a slot only on a figure that declares it holds things
165
+ * (`Capacity`, or `FlowNode`, which includes it). Without it the places are declared and nothing arrives.
166
+ */
167
+ export const holdsThings = (asset: V3Asset) => (asset.document.capabilities.names ?? []).some(n => n === 'Capacity' || n === 'FlowNode')
168
+
169
+ /** What `accepts` a person typed: names split on commas, trimmed, blanks and repeats dropped. */
170
+ export const acceptsOf = (typed: string) => [...new Set(typed.split(',').map(one => one.trim()).filter(Boolean))]
@@ -26,7 +26,12 @@ export declare class FigureV3Links extends FigureV3Links_base {
26
26
  locked: boolean;
27
27
  private fasten;
28
28
  private motion;
29
+ private place;
29
30
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
31
+ /** Where things are held on this part: a seat things rest on, or a grip things are held in (parity row ⑤). */
32
+ private renderPlaces;
33
+ /** The figure holds things: `Capacity` and `Holdable`, the ladder's middle rung. One part edit, one undo step. */
34
+ private declareHolding;
30
35
  private renderDimensions;
31
36
  private follow;
32
37
  /**
@@ -4,7 +4,7 @@ import { css, html, LitElement, nothing } from 'lit';
4
4
  import { customElement, property, state } from 'lit/decorators.js';
5
5
  import { i18next, localize } from '@operato/i18n';
6
6
  import { V3_FACES } from '@hatiolab/figure-model';
7
- import { AXES, canFasten, canFollow, choiceOf, fastenedTo, followOf, hasInstanceSize, motionOf, positionsWorkedOut } from './v3-links.js';
7
+ import { acceptsOf, AXES, canFasten, canFollow, choiceOf, fastenedTo, followOf, hasInstanceSize, holdsThings, motionOf, placeFacesOf, placeIdFor, placesOn, positionsWorkedOut } from './v3-links.js';
8
8
  const FACES = Object.keys(V3_FACES);
9
9
  /**
10
10
  * What a part is tied to — its size response, what it is fastened to, how it moves (parity rows ④ ⑤ ⑥).
@@ -27,6 +27,7 @@ let FigureV3Links = class FigureV3Links extends localize(i18next)(LitElement) {
27
27
  this.locked = false;
28
28
  this.fasten = { face: 'bottom', toPlane: false, target: '', targetFace: 'top', facing: 'meet', gap: 0 };
29
29
  this.motion = { kind: 'slide', axis: 'x', id: '', min: 0, max: 500 };
30
+ this.place = { role: 'grip', face: 'top', label: '', accepts: '', capacity: 1 };
30
31
  }
31
32
  static { this.styles = css `
32
33
  :host {
@@ -110,8 +111,76 @@ let FigureV3Links = class FigureV3Links extends localize(i18next)(LitElement) {
110
111
  ${canFasten(asset, this.partId) ? this.renderFastening(asset) : html `<p hint>${i18next.t('figure.text.links-need-a-box')}</p>`}
111
112
  <h3>${i18next.t('figure.label.motion')}</h3>
112
113
  ${this.renderMotion(asset)}
114
+ <h3>${i18next.t('figure.label.places')}</h3>
115
+ ${placeFacesOf(asset, this.partId).length ? this.renderPlaces(asset) : html `<p hint>${i18next.t('figure.text.places-need-a-box')}</p>`}
113
116
  `;
114
117
  }
118
+ /** Where things are held on this part: a seat things rest on, or a grip things are held in (parity row ⑤). */
119
+ renderPlaces(asset) {
120
+ const faces = placeFacesOf(asset, this.partId);
121
+ const p = this.place;
122
+ const face = faces.includes(p.face) ? p.face : faces[0];
123
+ const accepts = acceptsOf(p.accepts);
124
+ const capacityOk = Number.isSafeInteger(p.capacity) && p.capacity >= 1;
125
+ const roleName = (role) => i18next.t('figure.label.place-' + role);
126
+ return html `
127
+ ${placesOn(asset, this.partId).map(one => html `<div pair>
128
+ <span>
129
+ <b bound>${one.label}</b>
130
+ <small>${roleName(one.role)} · ${one.face ? i18next.t('figure.label.face-' + one.face) : ''} · ${one.accepts.join(', ')} · ${i18next.t('figure.label.place-holds', { count: one.capacity })}</small>
131
+ </span>
132
+ <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'remove-binding', id: one.id })}>
133
+ <md-icon>close</md-icon>${i18next.t('figure.button.remove-place')}
134
+ </button>
135
+ </div>`)}
136
+ <p hint>${i18next.t('figure.text.place-explained')}</p>
137
+ ${holdsThings(asset)
138
+ ? nothing
139
+ : html `<p hint>${i18next.t('figure.text.place-needs-holding')}</p>
140
+ <button act ?disabled=${this.locked} @click=${() => this.declareHolding(asset)}>
141
+ <md-icon>inventory_2</md-icon>${i18next.t('figure.button.declare-holding')}
142
+ </button>`}
143
+ <div pair>
144
+ <select @change=${(e) => (this.place = { ...p, role: e.target.value })}>
145
+ <option value="grip" ?selected=${p.role === 'grip'}>${roleName('grip')}</option>
146
+ <option value="seat" ?selected=${p.role === 'seat'}>${roleName('seat')}</option>
147
+ </select>
148
+ <select @change=${(e) => (this.place = { ...p, face: e.target.value })}>
149
+ ${faces.map(one => html `<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}
150
+ </select>
151
+ </div>
152
+ <div form>
153
+ <span>${i18next.t('figure.label.place-name')}</span>
154
+ <input .value=${p.label} placeholder=${roleName(p.role)} @change=${(e) => (this.place = { ...p, label: e.target.value })} />
155
+ <span>${i18next.t('figure.label.place-accepts')}</span>
156
+ <input .value=${p.accepts} placeholder="BOX, TOTE" @input=${(e) => (this.place = { ...p, accepts: e.target.value })} />
157
+ <span>${i18next.t('figure.label.place-capacity')}</span>
158
+ <input type="number" min="1" step="1" .value=${String(p.capacity)} @change=${(e) => (this.place = { ...p, capacity: e.target.valueAsNumber })} />
159
+ </div>
160
+ ${accepts.length ? nothing : html `<small>${i18next.t('figure.text.place-accepts-needed')}</small>`}
161
+ <button
162
+ act
163
+ ?disabled=${this.locked || !accepts.length || !capacityOk}
164
+ @click=${() => this.command({
165
+ kind: 'add-binding',
166
+ id: placeIdFor(asset, this.partId, p.role),
167
+ label: p.label.trim() || roleName(p.role),
168
+ role: p.role,
169
+ part: this.partId,
170
+ face,
171
+ accepts,
172
+ capacity: p.capacity
173
+ })}
174
+ >
175
+ <md-icon>back_hand</md-icon>${i18next.t('figure.button.add-place')}
176
+ </button>
177
+ `;
178
+ }
179
+ /** The figure holds things: `Capacity` and `Holdable`, the ladder's middle rung. One part edit, one undo step. */
180
+ declareHolding(asset) {
181
+ const names = [...new Set([...(asset.document.capabilities.names ?? []), 'Capacity', 'Holdable'])];
182
+ this.dispatchEvent(new CustomEvent('v3-part-edit', { detail: { edit: { kind: 'set-capabilities', names } }, bubbles: true, composed: true }));
183
+ }
115
184
  renderDimensions(asset) {
116
185
  const others = asset.appearance.map(look => look.target).filter(one => one !== this.partId && canFollow(asset, one));
117
186
  return AXES.map(axis => {
@@ -299,6 +368,10 @@ __decorate([
299
368
  state(),
300
369
  __metadata("design:type", Object)
301
370
  ], FigureV3Links.prototype, "motion", void 0);
371
+ __decorate([
372
+ state(),
373
+ __metadata("design:type", Object)
374
+ ], FigureV3Links.prototype, "place", void 0);
302
375
  FigureV3Links = __decorate([
303
376
  customElement('figure-v3-links')
304
377
  ], FigureV3Links);
@@ -1 +1 @@
1
- {"version":3,"file":"figure-v3-links.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-links.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAGjD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,kBAAkB,EAA0B,MAAM,eAAe,CAAA;AAEjK,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAa,CAAA;AAE/C;;;;;;;;;;;;GAYG;AAEI,IA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,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE;SAC9F,CAAC;;sCAE0B,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;;KAEtE,CAAA;IACH,CAAC;IAEO,OAAO,CAAC,IAAsB;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;IAC1H,CAAC;IAEO,OAAO,CAAC,MAAyB;QACvC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC1G,CAAC;;AAxM+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;4CAAgB;AAEnC;IAAX,QAAQ,EAAE;;6CAAY;AAES;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2CAAgC;AAClC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;6CAAe;AAE1B;IAAhB,KAAK,EAAE;;6CAAmJ;AAC1I;IAAhB,KAAK,EAAE;;6CAAoG;AAjFjG,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAkRzB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { V3_FACES } from '@hatiolab/figure-model'\nimport type { V3Asset, V3AuthoringAction, V3DimensionSource, V3Face } from '@hatiolab/figure-model'\n\nimport { AXES, canFasten, canFollow, choiceOf, fastenedTo, followOf, hasInstanceSize, motionOf, positionsWorkedOut, type Axis, type Follow } from './v3-links.js'\n\nconst FACES = Object.keys(V3_FACES) as V3Face[]\n\n/**\n * What a part is tied to — its size response, what it is fastened to, how it moves (parity rows ④ ⑤ ⑥).\n *\n * 「Build Once, Fit Anywhere」 lives here: a dimension that follows the instance size or another part is what lets\n * a figure be placed at any size, and a part fastened to the face it rests on is what keeps it there when that\n * happens. The release gate refuses a figure that falls apart when resized, and tells the author to fasten the\n * parts that come away — this is where they do it. Motion is the V2 joint: a slide or a turn driven by a control.\n *\n * The V2 inspector has these as its dimensions, placement and joint sections, in that order; so does this. Every\n * change is one figure-model authoring command, sent as `v3-command` and run by the editor through the session — one\n * step of the undo history. Choices the command would refuse (a round body fastened, a size following an instance\n * size the figure does not declare) are not offered, so the author is not sent into a refusal.\n */\n@customElement('figure-v3-links')\nexport class FigureV3Links extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: grid;\n gap: 10px;\n }\n h3 {\n font-size: var(--ui-t-body, 13px);\n margin: 12px 0 0;\n }\n div[row] {\n display: grid;\n grid-template-columns: 24px minmax(0, 1fr);\n gap: 6px;\n align-items: center;\n }\n div[form] {\n display: grid;\n grid-template-columns: 96px minmax(0, 1fr);\n gap: 6px;\n align-items: center;\n }\n div[pair] {\n display: flex;\n gap: 6px;\n }\n div[pair] > * {\n flex: 1;\n min-width: 0;\n }\n select,\n input,\n button {\n font: inherit;\n min-width: 0;\n }\n button[act] {\n justify-self: start;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 10px;\n border: none;\n border-radius: 999em;\n cursor: pointer;\n color: var(--md-sys-color-on-secondary-container);\n background: var(--md-sys-color-secondary-container);\n }\n button[act]:disabled {\n opacity: 0.5;\n cursor: default;\n }\n button[act] md-icon {\n font-size: 16px;\n width: 16px;\n height: 16px;\n }\n small,\n p[hint] {\n margin: 0;\n color: var(--md-sys-color-on-surface-variant);\n }\n b[bound] {\n font-weight: 600;\n }\n label[toggle] {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n `\n\n /** The asset being edited. */\n @property({ attribute: false }) asset?: V3Asset\n /** The selected part. */\n @property() partId = ''\n /** The part's own extent along its axes now, in mm — what a dimension is fixed at when it stops following. */\n @property({ attribute: false }) dims?: [number, number, number]\n @property({ type: Boolean }) locked = false\n\n @state() private fasten = { face: 'bottom' as V3Face, toPlane: false, target: '', targetFace: 'top' as V3Face, facing: 'meet' as 'meet' | 'flush', gap: 0 }\n @state() private motion = { kind: 'slide' as 'slide' | 'turn', axis: 'x' as Axis, id: '', min: 0, max: 500 }\n\n render() {\n const asset = this.asset\n if (!asset || !this.partId) return nothing\n return html`\n <h3>${i18next.t('figure.label.dimensions')}</h3>\n ${canFollow(asset, this.partId) ? this.renderDimensions(asset) : html`<p hint>${i18next.t('figure.text.links-need-a-box')}</p>`}\n <h3>${i18next.t('figure.label.placement')}</h3>\n ${this.renderPositions(asset)}\n ${canFasten(asset, this.partId) ? this.renderFastening(asset) : html`<p hint>${i18next.t('figure.text.links-need-a-box')}</p>`}\n <h3>${i18next.t('figure.label.motion')}</h3>\n ${this.renderMotion(asset)}\n `\n }\n\n private renderDimensions(asset: V3Asset) {\n const others = asset.appearance.map(look => look.target).filter(one => one !== this.partId && canFollow(asset, one))\n return AXES.map(axis => {\n const now = followOf(asset, this.partId, axis)\n const value = choiceOf(now)\n return html`<div row>\n <b>${axis.toUpperCase()}</b>\n <select ?disabled=${this.locked || now.of === 'expression'} @change=${(e: Event) => this.follow(axis, (e.target as HTMLSelectElement).value, now)}>\n <option value=\"own\" ?selected=${value === 'own'}>${i18next.t('figure.label.follows-nothing')}</option>\n ${AXES.filter(one => hasInstanceSize(asset, one)).map(\n one => html`<option value=${`instance:${one}`} ?selected=${value === `instance:${one}`}>\n ${i18next.t('figure.label.follows-instance')} · ${one.toUpperCase()}\n </option>`\n )}\n ${others.flatMap(other =>\n AXES.map(\n one => html`<option value=${`part:${other}:${one}`} ?selected=${value === `part:${other}:${one}`}>${other} · ${one.toUpperCase()}</option>`\n )\n )}\n ${now.of === 'expression' || now.of === 'input'\n ? html`<option value=${value} selected>${now.of === 'input' ? now.input : i18next.t('figure.label.follows-expression')}</option>`\n : nothing}\n </select>\n </div>`\n })\n }\n\n private follow(axis: Axis, choice: string, now: Follow) {\n const following = now.of !== 'own'\n if (choice === 'own') {\n if (!following) return\n const mm = Math.max(1, Math.round(this.dims?.[AXES.indexOf(axis)] ?? 100))\n this.command({ kind: 'unlink-dimension', part: this.partId, axis, mm })\n return\n }\n const [of, a, b] = choice.split(':')\n const source: V3DimensionSource = of === 'instance' ? { of: 'instance', axis: a as Axis } : { of: 'part', part: a!, axis: b as Axis }\n this.command({ kind: 'link-dimension', part: this.partId, axis, source, replace: following })\n }\n\n /**\n * Positions worked out from other values — V2's anchor rules, as the converter wrote them — each with the way to\n * keep it where it is. This is the way out the release gate names when a resize leaves a part in the air.\n */\n private renderPositions(asset: V3Asset) {\n return positionsWorkedOut(asset, this.partId).map(\n axis => html`<div pair>\n <span>${axis.toUpperCase()} · ${i18next.t('figure.label.position-worked-out')}</span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'fix-position', part: this.partId, axis })}>\n <md-icon>push_pin</md-icon>${i18next.t('figure.button.fix-position')}\n </button>\n </div>`\n )\n }\n\n private renderFastening(asset: V3Asset) {\n const to = fastenedTo(asset, this.partId)\n const f = this.fasten\n const targets = asset.appearance.map(look => look.target).filter(one => one !== this.partId && canFasten(asset, one))\n return html`\n ${to\n ? html`<div pair>\n <span>${i18next.t('figure.label.fastened-to')}: <b bound>${to}</b></span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'detach', part: this.partId })}>\n <md-icon>link_off</md-icon>${i18next.t('figure.button.detach')}\n </button>\n </div>`\n : html`<p hint>${i18next.t('figure.text.fastening-explained')}</p>`}\n <div form>\n <span>${i18next.t('figure.label.my-face')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, face: (e.target as HTMLSelectElement).value as V3Face })}>\n ${FACES.map(face => html`<option value=${face} ?selected=${face === f.face}>${i18next.t('figure.label.face-' + face)}</option>`)}\n </select>\n </div>\n <label toggle>\n <input type=\"checkbox\" .checked=${f.toPlane} @change=${(e: Event) => (this.fasten = { ...f, toPlane: (e.target as HTMLInputElement).checked })} />\n ${i18next.t('figure.label.stands-on-plane')}\n </label>\n ${f.toPlane\n ? nothing\n : html`<div form>\n <span>${i18next.t('figure.label.target-part')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, target: (e.target as HTMLSelectElement).value })}>\n <option value=\"\" ?selected=${!f.target}>—</option>\n ${targets.map(one => html`<option value=${one} ?selected=${one === f.target}>${one}</option>`)}\n </select>\n <span>${i18next.t('figure.label.target-face')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, targetFace: (e.target as HTMLSelectElement).value as V3Face })}>\n ${FACES.map(face => html`<option value=${face} ?selected=${face === f.targetFace}>${i18next.t('figure.label.face-' + face)}</option>`)}\n </select>\n <span>${i18next.t('figure.label.facing-meet')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, facing: (e.target as HTMLSelectElement).value as 'meet' | 'flush' })}>\n <option value=\"meet\" ?selected=${f.facing === 'meet'}>${i18next.t('figure.label.facing-meet')}</option>\n <option value=\"flush\" ?selected=${f.facing === 'flush'}>${i18next.t('figure.label.facing-flush')}</option>\n </select>\n </div>`}\n <div form>\n <span>${i18next.t('figure.label.gap')}</span>\n <input type=\"number\" step=\"any\" .value=${String(f.gap)} @change=${(e: Event) => (this.fasten = { ...f, gap: Number((e.target as HTMLInputElement).value) || 0 })} />\n </div>\n <button\n act\n ?disabled=${this.locked || (!f.toPlane && !f.target)}\n @click=${() =>\n this.command({\n kind: 'attach',\n part: this.partId,\n face: f.face,\n to: f.toPlane ? { plane: 'mounting-plane' } : { part: f.target, face: f.targetFace },\n ...(f.toPlane ? {} : { facing: f.facing }),\n ...(f.gap ? { gap: f.gap } : {}),\n replace: !!to\n } as V3AuthoringAction)}\n >\n <md-icon>link</md-icon>${i18next.t('figure.button.fasten')}\n </button>\n `\n }\n\n private renderMotion(asset: V3Asset) {\n const now = motionOf(asset, this.partId)\n if (now) {\n return html`<div pair>\n <span>\n ${i18next.t('figure.label.motion-' + now.kind)} · ${String(now.axis).toUpperCase()}\n ${now.control ? html`<small>${now.control.id} (${now.control.unit}) ${now.control.min} … ${now.control.max}</small>` : nothing}\n </span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'remove-motion', part: this.partId })}>\n <md-icon>close</md-icon>${i18next.t('figure.button.remove-motion')}\n </button>\n </div>`\n }\n const m = this.motion\n const unit = m.kind === 'turn' ? 'deg' : 'mm'\n return html`\n <p hint>${i18next.t('figure.text.motion-explained')}</p>\n <div pair>\n <select @change=${(e: Event) => this.setKind((e.target as HTMLSelectElement).value as 'slide' | 'turn')}>\n <option value=\"slide\" ?selected=${m.kind === 'slide'}>${i18next.t('figure.label.motion-slide')}</option>\n <option value=\"turn\" ?selected=${m.kind === 'turn'}>${i18next.t('figure.label.motion-turn')}</option>\n </select>\n <select @change=${(e: Event) => (this.motion = { ...m, axis: (e.target as HTMLSelectElement).value as Axis })}>\n ${AXES.map(a => html`<option value=${a} ?selected=${a === m.axis}>${i18next.t('figure.label.motion-axis')} ${a.toUpperCase()}</option>`)}\n </select>\n </div>\n <div form>\n <span>${i18next.t('figure.label.control-id')}</span>\n <input .value=${m.id} placeholder=${`${this.partId}-${m.kind}`} @change=${(e: Event) => (this.motion = { ...m, id: (e.target as HTMLInputElement).value.trim() })} />\n <span>${i18next.t('figure.label.control-range')} (${unit})</span>\n <div pair>\n <input type=\"number\" step=\"any\" .value=${String(m.min)} @change=${(e: Event) => (this.motion = { ...m, min: Number((e.target as HTMLInputElement).value) })} />\n <input type=\"number\" step=\"any\" .value=${String(m.max)} @change=${(e: Event) => (this.motion = { ...m, max: Number((e.target as HTMLInputElement).value) })} />\n </div>\n </div>\n <button\n act\n ?disabled=${this.locked || !(m.max > m.min)}\n @click=${() =>\n this.command({\n kind: 'add-motion',\n part: this.partId,\n motion: { kind: m.kind, axis: m.axis },\n state: { id: m.id || `${this.partId}-${m.kind}`, unit, min: m.min, max: m.max, start: m.min }\n })}\n >\n <md-icon>animation</md-icon>${i18next.t('figure.button.add-motion')}\n </button>\n `\n }\n\n private setKind(kind: 'slide' | 'turn') {\n this.motion = kind === 'turn' ? { ...this.motion, kind, min: -90, max: 90 } : { ...this.motion, kind, min: 0, max: 500 }\n }\n\n private command(action: V3AuthoringAction) {\n this.dispatchEvent(new CustomEvent('v3-command', { detail: { action }, bubbles: true, composed: true }))\n }\n}\n\n"]}
1
+ {"version":3,"file":"figure-v3-links.js","sourceRoot":"","sources":["../../client/modeller/figure-v3-links.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAGjD,OAAO,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,eAAe,EACf,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,kBAAkB,EAGnB,MAAM,eAAe,CAAA;AAEtB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAa,CAAA;AAE/C;;;;;;;;;;;;GAYG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAzD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AAa,CAAC,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC1G,CAAC;;AAlR+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;4CAAgB;AAEnC;IAAX,QAAQ,EAAE;;6CAAY;AAES;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2CAAgC;AAClC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;6CAAe;AAE1B;IAAhB,KAAK,EAAE;;6CAAmJ;AAC1I;IAAhB,KAAK,EAAE;;6CAAoG;AAC3F;IAAhB,KAAK,EAAE;;4CAAgH;AAlF7G,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA4VzB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { V3_FACES } from '@hatiolab/figure-model'\nimport type { V3Asset, V3AuthoringAction, V3DimensionSource, V3Face } from '@hatiolab/figure-model'\n\nimport {\n acceptsOf,\n AXES,\n canFasten,\n canFollow,\n choiceOf,\n fastenedTo,\n followOf,\n hasInstanceSize,\n holdsThings,\n motionOf,\n placeFacesOf,\n placeIdFor,\n placesOn,\n positionsWorkedOut,\n type Axis,\n type Follow\n} from './v3-links.js'\n\nconst FACES = Object.keys(V3_FACES) as V3Face[]\n\n/**\n * What a part is tied to — its size response, what it is fastened to, how it moves (parity rows ④ ⑤ ⑥).\n *\n * 「Build Once, Fit Anywhere」 lives here: a dimension that follows the instance size or another part is what lets\n * a figure be placed at any size, and a part fastened to the face it rests on is what keeps it there when that\n * happens. The release gate refuses a figure that falls apart when resized, and tells the author to fasten the\n * parts that come away — this is where they do it. Motion is the V2 joint: a slide or a turn driven by a control.\n *\n * The V2 inspector has these as its dimensions, placement and joint sections, in that order; so does this. Every\n * change is one figure-model authoring command, sent as `v3-command` and run by the editor through the session — one\n * step of the undo history. Choices the command would refuse (a round body fastened, a size following an instance\n * size the figure does not declare) are not offered, so the author is not sent into a refusal.\n */\n@customElement('figure-v3-links')\nexport class FigureV3Links extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: grid;\n gap: 10px;\n }\n h3 {\n font-size: var(--ui-t-body, 13px);\n margin: 12px 0 0;\n }\n div[row] {\n display: grid;\n grid-template-columns: 24px minmax(0, 1fr);\n gap: 6px;\n align-items: center;\n }\n div[form] {\n display: grid;\n grid-template-columns: 96px minmax(0, 1fr);\n gap: 6px;\n align-items: center;\n }\n div[pair] {\n display: flex;\n gap: 6px;\n }\n div[pair] > * {\n flex: 1;\n min-width: 0;\n }\n select,\n input,\n button {\n font: inherit;\n min-width: 0;\n }\n button[act] {\n justify-self: start;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 10px;\n border: none;\n border-radius: 999em;\n cursor: pointer;\n color: var(--md-sys-color-on-secondary-container);\n background: var(--md-sys-color-secondary-container);\n }\n button[act]:disabled {\n opacity: 0.5;\n cursor: default;\n }\n button[act] md-icon {\n font-size: 16px;\n width: 16px;\n height: 16px;\n }\n small,\n p[hint] {\n margin: 0;\n color: var(--md-sys-color-on-surface-variant);\n }\n b[bound] {\n font-weight: 600;\n }\n label[toggle] {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n `\n\n /** The asset being edited. */\n @property({ attribute: false }) asset?: V3Asset\n /** The selected part. */\n @property() partId = ''\n /** The part's own extent along its axes now, in mm — what a dimension is fixed at when it stops following. */\n @property({ attribute: false }) dims?: [number, number, number]\n @property({ type: Boolean }) locked = false\n\n @state() private fasten = { face: 'bottom' as V3Face, toPlane: false, target: '', targetFace: 'top' as V3Face, facing: 'meet' as 'meet' | 'flush', gap: 0 }\n @state() private motion = { kind: 'slide' as 'slide' | 'turn', axis: 'x' as Axis, id: '', min: 0, max: 500 }\n @state() private place = { role: 'grip' as 'seat' | 'grip', face: 'top' as V3Face, label: '', accepts: '', capacity: 1 }\n\n render() {\n const asset = this.asset\n if (!asset || !this.partId) return nothing\n return html`\n <h3>${i18next.t('figure.label.dimensions')}</h3>\n ${canFollow(asset, this.partId) ? this.renderDimensions(asset) : html`<p hint>${i18next.t('figure.text.links-need-a-box')}</p>`}\n <h3>${i18next.t('figure.label.placement')}</h3>\n ${this.renderPositions(asset)}\n ${canFasten(asset, this.partId) ? this.renderFastening(asset) : html`<p hint>${i18next.t('figure.text.links-need-a-box')}</p>`}\n <h3>${i18next.t('figure.label.motion')}</h3>\n ${this.renderMotion(asset)}\n <h3>${i18next.t('figure.label.places')}</h3>\n ${placeFacesOf(asset, this.partId).length ? this.renderPlaces(asset) : html`<p hint>${i18next.t('figure.text.places-need-a-box')}</p>`}\n `\n }\n\n /** Where things are held on this part: a seat things rest on, or a grip things are held in (parity row ⑤). */\n private renderPlaces(asset: V3Asset) {\n const faces = placeFacesOf(asset, this.partId)\n const p = this.place\n const face = faces.includes(p.face) ? p.face : faces[0]!\n const accepts = acceptsOf(p.accepts)\n const capacityOk = Number.isSafeInteger(p.capacity) && p.capacity >= 1\n const roleName = (role: string) => i18next.t('figure.label.place-' + role)\n return html`\n ${placesOn(asset, this.partId).map(\n one => html`<div pair>\n <span>\n <b bound>${one.label}</b>\n <small>${roleName(one.role)} · ${one.face ? i18next.t('figure.label.face-' + one.face) : ''} · ${one.accepts.join(', ')} · ${i18next.t('figure.label.place-holds', { count: one.capacity })}</small>\n </span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'remove-binding', id: one.id })}>\n <md-icon>close</md-icon>${i18next.t('figure.button.remove-place')}\n </button>\n </div>`\n )}\n <p hint>${i18next.t('figure.text.place-explained')}</p>\n ${holdsThings(asset)\n ? nothing\n : html`<p hint>${i18next.t('figure.text.place-needs-holding')}</p>\n <button act ?disabled=${this.locked} @click=${() => this.declareHolding(asset)}>\n <md-icon>inventory_2</md-icon>${i18next.t('figure.button.declare-holding')}\n </button>`}\n <div pair>\n <select @change=${(e: Event) => (this.place = { ...p, role: (e.target as HTMLSelectElement).value as 'seat' | 'grip' })}>\n <option value=\"grip\" ?selected=${p.role === 'grip'}>${roleName('grip')}</option>\n <option value=\"seat\" ?selected=${p.role === 'seat'}>${roleName('seat')}</option>\n </select>\n <select @change=${(e: Event) => (this.place = { ...p, face: (e.target as HTMLSelectElement).value as V3Face })}>\n ${faces.map(one => html`<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}\n </select>\n </div>\n <div form>\n <span>${i18next.t('figure.label.place-name')}</span>\n <input .value=${p.label} placeholder=${roleName(p.role)} @change=${(e: Event) => (this.place = { ...p, label: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.place-accepts')}</span>\n <input .value=${p.accepts} placeholder=\"BOX, TOTE\" @input=${(e: Event) => (this.place = { ...p, accepts: (e.target as HTMLInputElement).value })} />\n <span>${i18next.t('figure.label.place-capacity')}</span>\n <input type=\"number\" min=\"1\" step=\"1\" .value=${String(p.capacity)} @change=${(e: Event) => (this.place = { ...p, capacity: (e.target as HTMLInputElement).valueAsNumber })} />\n </div>\n ${accepts.length ? nothing : html`<small>${i18next.t('figure.text.place-accepts-needed')}</small>`}\n <button\n act\n ?disabled=${this.locked || !accepts.length || !capacityOk}\n @click=${() =>\n this.command({\n kind: 'add-binding',\n id: placeIdFor(asset, this.partId, p.role),\n label: p.label.trim() || roleName(p.role),\n role: p.role,\n part: this.partId,\n face,\n accepts,\n capacity: p.capacity\n })}\n >\n <md-icon>back_hand</md-icon>${i18next.t('figure.button.add-place')}\n </button>\n `\n }\n\n /** The figure holds things: `Capacity` and `Holdable`, the ladder's middle rung. One part edit, one undo step. */\n private declareHolding(asset: V3Asset) {\n const names = [...new Set([...(asset.document.capabilities.names ?? []), 'Capacity', 'Holdable'])]\n this.dispatchEvent(new CustomEvent('v3-part-edit', { detail: { edit: { kind: 'set-capabilities', names } }, bubbles: true, composed: true }))\n }\n\n private renderDimensions(asset: V3Asset) {\n const others = asset.appearance.map(look => look.target).filter(one => one !== this.partId && canFollow(asset, one))\n return AXES.map(axis => {\n const now = followOf(asset, this.partId, axis)\n const value = choiceOf(now)\n return html`<div row>\n <b>${axis.toUpperCase()}</b>\n <select ?disabled=${this.locked || now.of === 'expression'} @change=${(e: Event) => this.follow(axis, (e.target as HTMLSelectElement).value, now)}>\n <option value=\"own\" ?selected=${value === 'own'}>${i18next.t('figure.label.follows-nothing')}</option>\n ${AXES.filter(one => hasInstanceSize(asset, one)).map(\n one => html`<option value=${`instance:${one}`} ?selected=${value === `instance:${one}`}>\n ${i18next.t('figure.label.follows-instance')} · ${one.toUpperCase()}\n </option>`\n )}\n ${others.flatMap(other =>\n AXES.map(\n one => html`<option value=${`part:${other}:${one}`} ?selected=${value === `part:${other}:${one}`}>${other} · ${one.toUpperCase()}</option>`\n )\n )}\n ${now.of === 'expression' || now.of === 'input'\n ? html`<option value=${value} selected>${now.of === 'input' ? now.input : i18next.t('figure.label.follows-expression')}</option>`\n : nothing}\n </select>\n </div>`\n })\n }\n\n private follow(axis: Axis, choice: string, now: Follow) {\n const following = now.of !== 'own'\n if (choice === 'own') {\n if (!following) return\n const mm = Math.max(1, Math.round(this.dims?.[AXES.indexOf(axis)] ?? 100))\n this.command({ kind: 'unlink-dimension', part: this.partId, axis, mm })\n return\n }\n const [of, a, b] = choice.split(':')\n const source: V3DimensionSource = of === 'instance' ? { of: 'instance', axis: a as Axis } : { of: 'part', part: a!, axis: b as Axis }\n this.command({ kind: 'link-dimension', part: this.partId, axis, source, replace: following })\n }\n\n /**\n * Positions worked out from other values — V2's anchor rules, as the converter wrote them — each with the way to\n * keep it where it is. This is the way out the release gate names when a resize leaves a part in the air.\n */\n private renderPositions(asset: V3Asset) {\n return positionsWorkedOut(asset, this.partId).map(\n axis => html`<div pair>\n <span>${axis.toUpperCase()} · ${i18next.t('figure.label.position-worked-out')}</span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'fix-position', part: this.partId, axis })}>\n <md-icon>push_pin</md-icon>${i18next.t('figure.button.fix-position')}\n </button>\n </div>`\n )\n }\n\n private renderFastening(asset: V3Asset) {\n const to = fastenedTo(asset, this.partId)\n const f = this.fasten\n const targets = asset.appearance.map(look => look.target).filter(one => one !== this.partId && canFasten(asset, one))\n return html`\n ${to\n ? html`<div pair>\n <span>${i18next.t('figure.label.fastened-to')}: <b bound>${to}</b></span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'detach', part: this.partId })}>\n <md-icon>link_off</md-icon>${i18next.t('figure.button.detach')}\n </button>\n </div>`\n : html`<p hint>${i18next.t('figure.text.fastening-explained')}</p>`}\n <div form>\n <span>${i18next.t('figure.label.my-face')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, face: (e.target as HTMLSelectElement).value as V3Face })}>\n ${FACES.map(face => html`<option value=${face} ?selected=${face === f.face}>${i18next.t('figure.label.face-' + face)}</option>`)}\n </select>\n </div>\n <label toggle>\n <input type=\"checkbox\" .checked=${f.toPlane} @change=${(e: Event) => (this.fasten = { ...f, toPlane: (e.target as HTMLInputElement).checked })} />\n ${i18next.t('figure.label.stands-on-plane')}\n </label>\n ${f.toPlane\n ? nothing\n : html`<div form>\n <span>${i18next.t('figure.label.target-part')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, target: (e.target as HTMLSelectElement).value })}>\n <option value=\"\" ?selected=${!f.target}>—</option>\n ${targets.map(one => html`<option value=${one} ?selected=${one === f.target}>${one}</option>`)}\n </select>\n <span>${i18next.t('figure.label.target-face')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, targetFace: (e.target as HTMLSelectElement).value as V3Face })}>\n ${FACES.map(face => html`<option value=${face} ?selected=${face === f.targetFace}>${i18next.t('figure.label.face-' + face)}</option>`)}\n </select>\n <span>${i18next.t('figure.label.facing-meet')}</span>\n <select @change=${(e: Event) => (this.fasten = { ...f, facing: (e.target as HTMLSelectElement).value as 'meet' | 'flush' })}>\n <option value=\"meet\" ?selected=${f.facing === 'meet'}>${i18next.t('figure.label.facing-meet')}</option>\n <option value=\"flush\" ?selected=${f.facing === 'flush'}>${i18next.t('figure.label.facing-flush')}</option>\n </select>\n </div>`}\n <div form>\n <span>${i18next.t('figure.label.gap')}</span>\n <input type=\"number\" step=\"any\" .value=${String(f.gap)} @change=${(e: Event) => (this.fasten = { ...f, gap: Number((e.target as HTMLInputElement).value) || 0 })} />\n </div>\n <button\n act\n ?disabled=${this.locked || (!f.toPlane && !f.target)}\n @click=${() =>\n this.command({\n kind: 'attach',\n part: this.partId,\n face: f.face,\n to: f.toPlane ? { plane: 'mounting-plane' } : { part: f.target, face: f.targetFace },\n ...(f.toPlane ? {} : { facing: f.facing }),\n ...(f.gap ? { gap: f.gap } : {}),\n replace: !!to\n } as V3AuthoringAction)}\n >\n <md-icon>link</md-icon>${i18next.t('figure.button.fasten')}\n </button>\n `\n }\n\n private renderMotion(asset: V3Asset) {\n const now = motionOf(asset, this.partId)\n if (now) {\n return html`<div pair>\n <span>\n ${i18next.t('figure.label.motion-' + now.kind)} · ${String(now.axis).toUpperCase()}\n ${now.control ? html`<small>${now.control.id} (${now.control.unit}) ${now.control.min} … ${now.control.max}</small>` : nothing}\n </span>\n <button act ?disabled=${this.locked} @click=${() => this.command({ kind: 'remove-motion', part: this.partId })}>\n <md-icon>close</md-icon>${i18next.t('figure.button.remove-motion')}\n </button>\n </div>`\n }\n const m = this.motion\n const unit = m.kind === 'turn' ? 'deg' : 'mm'\n return html`\n <p hint>${i18next.t('figure.text.motion-explained')}</p>\n <div pair>\n <select @change=${(e: Event) => this.setKind((e.target as HTMLSelectElement).value as 'slide' | 'turn')}>\n <option value=\"slide\" ?selected=${m.kind === 'slide'}>${i18next.t('figure.label.motion-slide')}</option>\n <option value=\"turn\" ?selected=${m.kind === 'turn'}>${i18next.t('figure.label.motion-turn')}</option>\n </select>\n <select @change=${(e: Event) => (this.motion = { ...m, axis: (e.target as HTMLSelectElement).value as Axis })}>\n ${AXES.map(a => html`<option value=${a} ?selected=${a === m.axis}>${i18next.t('figure.label.motion-axis')} ${a.toUpperCase()}</option>`)}\n </select>\n </div>\n <div form>\n <span>${i18next.t('figure.label.control-id')}</span>\n <input .value=${m.id} placeholder=${`${this.partId}-${m.kind}`} @change=${(e: Event) => (this.motion = { ...m, id: (e.target as HTMLInputElement).value.trim() })} />\n <span>${i18next.t('figure.label.control-range')} (${unit})</span>\n <div pair>\n <input type=\"number\" step=\"any\" .value=${String(m.min)} @change=${(e: Event) => (this.motion = { ...m, min: Number((e.target as HTMLInputElement).value) })} />\n <input type=\"number\" step=\"any\" .value=${String(m.max)} @change=${(e: Event) => (this.motion = { ...m, max: Number((e.target as HTMLInputElement).value) })} />\n </div>\n </div>\n <button\n act\n ?disabled=${this.locked || !(m.max > m.min)}\n @click=${() =>\n this.command({\n kind: 'add-motion',\n part: this.partId,\n motion: { kind: m.kind, axis: m.axis },\n state: { id: m.id || `${this.partId}-${m.kind}`, unit, min: m.min, max: m.max, start: m.min }\n })}\n >\n <md-icon>animation</md-icon>${i18next.t('figure.button.add-motion')}\n </button>\n `\n }\n\n private setKind(kind: 'slide' | 'turn') {\n this.motion = kind === 'turn' ? { ...this.motion, kind, min: -90, max: 90 } : { ...this.motion, kind, min: 0, max: 500 }\n }\n\n private command(action: V3AuthoringAction) {\n this.dispatchEvent(new CustomEvent('v3-command', { detail: { action }, bubbles: true, composed: true }))\n }\n}\n\n"]}
@@ -457,6 +457,7 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
457
457
  .dims=${dims}
458
458
  ?locked=${unavailable}
459
459
  @v3-command=${(e) => this.linkCommand(e.detail.action)}
460
+ @v3-part-edit=${(e) => this.run(() => this.session.edit(e.detail.edit))}
460
461
  ></figure-v3-links>`;
461
462
  }
462
463
  /** One command, one step of the history. A refusal a person can meet here is said in their words. */
@@ -568,8 +569,8 @@ let FigureV3Editor = class FigureV3Editor extends LitElement {
568
569
  ></figure-v3-material>`
569
570
  : null}
570
571
  ${view.bindings.length
571
- ? html `<h3>배치 연결점</h3>
572
- ${view.bindings.map(b => html `<p>${b.label} · ${b.role}</p>`)}`
572
+ ? html `<h3>${i18next.t('figure.label.places')}</h3>
573
+ ${view.bindings.map(b => html `<p>${b.label} · ${i18next.t('figure.label.place-' + b.role)}</p>`)}`
573
574
  : null}
574
575
  </aside>
575
576
  </main>`;