@things-factory/figure-ui 10.1.183 → 10.1.185
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/figure-facts.ts +4 -35
- package/client/modeller/figure-fasten-dialog.ts +16 -1
- package/client/modeller/figure-properties.ts +23 -70
- package/dist-client/modeller/clips.d.ts +2 -2
- package/dist-client/modeller/figure-facts.d.ts +2 -13
- package/dist-client/modeller/figure-facts.js +2 -29
- package/dist-client/modeller/figure-facts.js.map +1 -1
- package/dist-client/modeller/figure-fasten-dialog.d.ts +6 -1
- package/dist-client/modeller/figure-fasten-dialog.js +16 -1
- package/dist-client/modeller/figure-fasten-dialog.js.map +1 -1
- package/dist-client/modeller/figure-fasten-drawing.d.ts +1 -1
- package/dist-client/modeller/figure-links.d.ts +1 -1
- package/dist-client/modeller/figure-properties.d.ts +12 -12
- package/dist-client/modeller/figure-properties.js +23 -72
- package/dist-client/modeller/figure-properties.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/test/browser/links.check.mjs +12 -0
- package/test/browser/modeller-page.js +1 -1
- package/test/browser/product-page.check.mjs +56 -6
- package/test/browser/product-page.js +11 -1
- package/test/browser/property-section.check.mjs +3 -3
- package/test/browser/screen-page.js +7 -2
- package/test/properties.test.ts +11 -19
- package/translations/en.json +1 -9
- package/translations/es.json +1 -9
- package/translations/ja.json +1 -9
- package/translations/ko.json +1 -9
- package/translations/ms.json +1 -9
- package/translations/zh.json +1 -9
- package/client/modeller/mounting-part.ts +0 -15
|
@@ -68,7 +68,7 @@ export declare class FigureLinks extends FigureLinks_base {
|
|
|
68
68
|
willUpdate(changed: Map<string, unknown>): void;
|
|
69
69
|
updated(): void;
|
|
70
70
|
disconnectedCallback(): void;
|
|
71
|
-
render():
|
|
71
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
72
72
|
/** Where things are held on this part: a seat things rest on, or a grip things are held in. */
|
|
73
73
|
private renderPlaces;
|
|
74
74
|
/** The figure holds things: `Capacity` and `Holdable`, the ladder's middle rung. One part edit, one undo step. */
|
|
@@ -5,17 +5,18 @@ declare const FigureProperties_base: (new (...args: any[]) => LitElement) & type
|
|
|
5
5
|
/**
|
|
6
6
|
* 속성 — the modeller's figure properties.
|
|
7
7
|
*
|
|
8
|
-
* The tab opens with what the figure is: its name,
|
|
9
|
-
*
|
|
8
|
+
* The tab opens with what the figure is: its name, where it stands, where the catalogue files it.
|
|
9
|
+
*
|
|
10
|
+
* Nothing here is set up before work can go on (user 2026-10-18, after a walk without it). The room the figure
|
|
11
|
+
* takes up is declared where release asks for it, from the parts -- the bar's blockers and the verdict offer it;
|
|
12
|
+
* whether the figure meets its plane is said by the release check from the parts, with no face to name. A mounting
|
|
13
|
+
* face named already (by the assistant, or before) is shown with the way to take it off, and nothing more.
|
|
10
14
|
*
|
|
11
15
|
* Two kinds of change leave this tab, and it does neither itself:
|
|
12
|
-
* - `command` carries an authoring command (rename,
|
|
13
|
-
* through the session, so it is one step of the same undo history as every other edit, and is saved with it.
|
|
16
|
+
* - `command` carries an authoring command (rename, where it stands, taking the mounting face off). The page runs
|
|
17
|
+
* it through the session, so it is one step of the same undo history as every other edit, and is saved with it.
|
|
14
18
|
* - `catalog` carries a change to the row (category, tags). Those are not in the asset; the page writes them
|
|
15
19
|
* to the saved row at once, so they need a saved figure.
|
|
16
|
-
*
|
|
17
|
-
* Not here yet, because has no place for them: editing the declared room by hand (declares it from the
|
|
18
|
-
* parts, as graph expressions), and the detail level. Both wait on a ruling.
|
|
19
20
|
*/
|
|
20
21
|
export declare class FigureProperties extends FigureProperties_base {
|
|
21
22
|
static styles: import("lit").CSSResult[];
|
|
@@ -27,9 +28,6 @@ export declare class FigureProperties extends FigureProperties_base {
|
|
|
27
28
|
/** The categories the server allows (LV figure-server design G5): chosen from, and fixed once set. Null: free text. */
|
|
28
29
|
figureCategories?: string[] | null;
|
|
29
30
|
figureTags?: string[];
|
|
30
|
-
/** The part and face picked for the mounting face, before 「이 면으로」 is pressed. */
|
|
31
|
-
private pickedPart?;
|
|
32
|
-
private pickedFace?;
|
|
33
31
|
private facts;
|
|
34
32
|
private lastDrawn?;
|
|
35
33
|
private outOfSight;
|
|
@@ -44,12 +42,14 @@ export declare class FigureProperties extends FigureProperties_base {
|
|
|
44
42
|
* again from the parts — the only way declares it — with the new face. The hint says so.
|
|
45
43
|
*/
|
|
46
44
|
private renderPlacement;
|
|
47
|
-
|
|
45
|
+
/**
|
|
46
|
+
* A mounting face named already: which, and the way to take it off. A centred figure has no plane, so the gate does
|
|
47
|
+
* not check it there; the line says so rather than show a promise that is not kept.
|
|
48
|
+
*/
|
|
48
49
|
private renderMounting;
|
|
49
50
|
/** The sections an app added (G11), after the panel's own, for the figures they are for. A section that throws says so in its place. */
|
|
50
51
|
private renderAppSections;
|
|
51
52
|
private renderCatalog;
|
|
52
|
-
private declare;
|
|
53
53
|
private command;
|
|
54
54
|
private catalog;
|
|
55
55
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@material/web/icon/icon.js';
|
|
3
3
|
import { css, html, LitElement, nothing } from 'lit';
|
|
4
|
-
import { customElement, property
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
5
|
import { live } from 'lit/directives/live.js';
|
|
6
6
|
import { i18next, localize } from '@operato/i18n';
|
|
7
|
-
import { FIGURE_FACES } from '@hatiolab/figure-model';
|
|
8
|
-
import { occupancyFromParts } from './occupancy.js';
|
|
9
7
|
import { tagsOf, figureFigureFacts } from './figure-facts.js';
|
|
10
|
-
import { offeredMountingOf } from './mounting-part.js';
|
|
11
8
|
import { figurePropertySections } from './property-sections.js';
|
|
12
9
|
import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
|
|
13
10
|
import { ScrollbarStyles } from '@operato/styles';
|
|
14
11
|
const PLACEMENTS = ['floor', 'ceiling', 'center', 'wall'];
|
|
15
|
-
const FACES = Object.keys(FIGURE_FACES);
|
|
16
12
|
/**
|
|
17
13
|
* 속성 — the modeller's figure properties.
|
|
18
14
|
*
|
|
19
|
-
* The tab opens with what the figure is: its name,
|
|
20
|
-
*
|
|
15
|
+
* The tab opens with what the figure is: its name, where it stands, where the catalogue files it.
|
|
16
|
+
*
|
|
17
|
+
* Nothing here is set up before work can go on (user 2026-10-18, after a walk without it). The room the figure
|
|
18
|
+
* takes up is declared where release asks for it, from the parts -- the bar's blockers and the verdict offer it;
|
|
19
|
+
* whether the figure meets its plane is said by the release check from the parts, with no face to name. A mounting
|
|
20
|
+
* face named already (by the assistant, or before) is shown with the way to take it off, and nothing more.
|
|
21
21
|
*
|
|
22
22
|
* Two kinds of change leave this tab, and it does neither itself:
|
|
23
|
-
* - `command` carries an authoring command (rename,
|
|
24
|
-
* through the session, so it is one step of the same undo history as every other edit, and is saved with it.
|
|
23
|
+
* - `command` carries an authoring command (rename, where it stands, taking the mounting face off). The page runs
|
|
24
|
+
* it through the session, so it is one step of the same undo history as every other edit, and is saved with it.
|
|
25
25
|
* - `catalog` carries a change to the row (category, tags). Those are not in the asset; the page writes them
|
|
26
26
|
* to the saved row at once, so they need a saved figure.
|
|
27
|
-
*
|
|
28
|
-
* Not here yet, because has no place for them: editing the declared room by hand (declares it from the
|
|
29
|
-
* parts, as graph expressions), and the detail level. Both wait on a ruling.
|
|
30
27
|
*/
|
|
31
28
|
let FigureProperties = class FigureProperties extends localize(i18next)(LitElement) {
|
|
32
29
|
constructor() {
|
|
@@ -45,16 +42,12 @@ let FigureProperties = class FigureProperties extends localize(i18next)(LitEleme
|
|
|
45
42
|
gap: 6px;
|
|
46
43
|
align-items: center;
|
|
47
44
|
}
|
|
48
|
-
|
|
45
|
+
/* What is named, then the way to take it off at the line's end, as wide as its words. */
|
|
46
|
+
div[row] > span {
|
|
49
47
|
flex: 1;
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
div[row] > button[act] {
|
|
49
|
+
div[row] > button[quiet] {
|
|
53
50
|
flex: none;
|
|
54
|
-
width: auto;
|
|
55
|
-
}
|
|
56
|
-
div[row] > span {
|
|
57
|
-
flex: 1;
|
|
58
51
|
}
|
|
59
52
|
`]; }
|
|
60
53
|
facts() {
|
|
@@ -96,11 +89,7 @@ let FigureProperties = class FigureProperties extends localize(i18next)(LitEleme
|
|
|
96
89
|
return html `<section>
|
|
97
90
|
<h3>${i18next.t('figure.label.group-figure')}</h3>
|
|
98
91
|
<slot name="type"></slot>
|
|
99
|
-
${this.renderName(facts)} ${this.renderPlacement(facts)}
|
|
100
|
-
</section>
|
|
101
|
-
<section>
|
|
102
|
-
<h3>${i18next.t('figure.label.group-standing')}</h3>
|
|
103
|
-
${this.renderSpace(facts)} ${this.renderMounting(facts)}
|
|
92
|
+
${this.renderName(facts)} ${this.renderPlacement(facts)} ${this.renderMounting(facts)}
|
|
104
93
|
</section>
|
|
105
94
|
<section>
|
|
106
95
|
<h3>${i18next.t('figure.label.group-catalog')}</h3>
|
|
@@ -153,49 +142,24 @@ let FigureProperties = class FigureProperties extends localize(i18next)(LitEleme
|
|
|
153
142
|
</div>
|
|
154
143
|
`;
|
|
155
144
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<div row>
|
|
161
|
-
<span>${i18next.t(facts.declared ? 'figure.text.declared-space-declared' : 'figure.text.declared-space-none')}</span>
|
|
162
|
-
<button act ?disabled=${!facts.parts.length} @click=${() => this.declare(facts.placement ?? 'floor')}>
|
|
163
|
-
<md-icon>fit_screen</md-icon>${i18next.t('figure.button.fit-base-to-parts')}
|
|
164
|
-
</button>
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
`;
|
|
168
|
-
}
|
|
145
|
+
/**
|
|
146
|
+
* A mounting face named already: which, and the way to take it off. A centred figure has no plane, so the gate does
|
|
147
|
+
* not check it there; the line says so rather than show a promise that is not kept.
|
|
148
|
+
*/
|
|
169
149
|
renderMounting(facts) {
|
|
170
150
|
const mounting = facts.mounting;
|
|
171
|
-
|
|
172
|
-
|
|
151
|
+
if (!mounting)
|
|
152
|
+
return nothing;
|
|
153
|
+
const said = `${mounting.part} · ${i18next.t('figure.label.face-' + mounting.face)}`;
|
|
173
154
|
return html `
|
|
174
|
-
<div field>
|
|
155
|
+
<div field mounting-face>
|
|
175
156
|
<label>${i18next.t('figure.label.mounting-face')}</label>
|
|
176
157
|
<div row>
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
</select>
|
|
180
|
-
<select ?disabled=${!facts.declared} @change=${(e) => (this.pickedFace = e.target.value)}>
|
|
181
|
-
${FACES.map(one => html `<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}
|
|
182
|
-
</select>
|
|
183
|
-
</div>
|
|
184
|
-
<div row>
|
|
185
|
-
<button act ?disabled=${!facts.declared || !part} @click=${() => this.command({ kind: 'set-mounting-face', part: part, face })}>
|
|
186
|
-
<md-icon>check</md-icon>${i18next.t('figure.button.set-mounting-face')}
|
|
187
|
-
</button>
|
|
188
|
-
<button quiet ?disabled=${!mounting} @click=${() => this.command({ kind: 'clear-mounting-face' })}>
|
|
158
|
+
<span>${facts.placement === 'center' ? `${said} · ${i18next.t('figure.text.mounting-face-unchecked-at-center')}` : said}</span>
|
|
159
|
+
<button quiet clear-mounting-face @click=${() => this.command({ kind: 'clear-mounting-face' })}>
|
|
189
160
|
<md-icon>close</md-icon>${i18next.t('figure.button.clear-mounting-face')}
|
|
190
161
|
</button>
|
|
191
162
|
</div>
|
|
192
|
-
<small>
|
|
193
|
-
${facts.declared
|
|
194
|
-
? mounting
|
|
195
|
-
? `${mounting.part} · ${i18next.t('figure.label.face-' + mounting.face)}`
|
|
196
|
-
: i18next.t('figure.label.mounting-face-none')
|
|
197
|
-
: i18next.t('figure.text.mounting-face-needs-space')}
|
|
198
|
-
</small>
|
|
199
163
|
</div>
|
|
200
164
|
`;
|
|
201
165
|
}
|
|
@@ -255,11 +219,6 @@ let FigureProperties = class FigureProperties extends localize(i18next)(LitEleme
|
|
|
255
219
|
</div>
|
|
256
220
|
`;
|
|
257
221
|
}
|
|
258
|
-
declare(placement) {
|
|
259
|
-
if (!this.revision)
|
|
260
|
-
return;
|
|
261
|
-
this.command(occupancyFromParts(this.revision.asset, placement));
|
|
262
|
-
}
|
|
263
222
|
command(action) {
|
|
264
223
|
this.dispatchEvent(new CustomEvent('command', { detail: { action }, bubbles: true, composed: true }));
|
|
265
224
|
}
|
|
@@ -287,14 +246,6 @@ __decorate([
|
|
|
287
246
|
property({ type: Array }),
|
|
288
247
|
__metadata("design:type", Array)
|
|
289
248
|
], FigureProperties.prototype, "figureTags", void 0);
|
|
290
|
-
__decorate([
|
|
291
|
-
state(),
|
|
292
|
-
__metadata("design:type", String)
|
|
293
|
-
], FigureProperties.prototype, "pickedPart", void 0);
|
|
294
|
-
__decorate([
|
|
295
|
-
state(),
|
|
296
|
-
__metadata("design:type", String)
|
|
297
|
-
], FigureProperties.prototype, "pickedFace", void 0);
|
|
298
249
|
FigureProperties = __decorate([
|
|
299
250
|
customElement('figure-properties')
|
|
300
251
|
], FigureProperties);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figure-properties.js","sourceRoot":"","sources":["../../client/modeller/figure-properties.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;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,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C;QAC3D,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClG,CAAC;;AA1O+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAA0B;AAE7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAwB;AAEnB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAAmC;AACvC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAsB;AAE/B;IAAhB,KAAK,EAAE;;oDAA4B;AACnB;IAAhB,KAAK,EAAE;;oDAAgC;AApC7B,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAsQ5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { FIGURE_FACES } from '@hatiolab/figure-model'\nimport type { FigureAuthoringAction, FigureFace } from '@hatiolab/figure-model'\n\nimport { occupancyFromParts } from './occupancy.js'\nimport { tagsOf, figureFigureFacts, type Placement, type FigureFigureFacts } from './figure-facts.js'\nimport { offeredMountingOf } from './mounting-part.js'\nimport type { FigureRevision } from './revision.js'\nimport { figurePropertySections } from './property-sections.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nconst PLACEMENTS: Placement[] = ['floor', 'ceiling', 'center', 'wall']\nconst FACES = Object.keys(FIGURE_FACES) as FigureFace[]\n\n/**\n * 속성 — the modeller's figure properties.\n *\n * The tab opens with what the figure is: its name, the face it is placed by, the room it takes up, where the\n * catalogue files it.\n *\n * Two kinds of change leave this tab, and it does neither itself:\n * - `command` carries an authoring command (rename, declare the room, the mounting face). The page runs it\n * through the session, so it is one step of the same undo history as every other edit, and is saved with it.\n * - `catalog` carries a change to the row (category, tags). Those are not in the asset; the page writes them\n * to the saved row at once, so they need a saved figure.\n *\n * Not here yet, because has no place for them: editing the declared room by hand (declares it from the\n * parts, as graph expressions), and the detail level. Both wait on a ruling.\n */\n@customElement('figure-properties')\nexport class FigureProperties extends localize(i18next)(LitElement) {\n static styles = [ScrollbarStyles, SidePanelStyles, css`\n :host {\n display: block;\n /* It stands inside the properties tab's panel, which gives the margin; a second one indented it past the type. */\n padding: 0;\n overflow: auto;\n }\n div[row] {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n div[row] > select {\n flex: 1;\n }\n /* Words as wide as themselves (side-panel-styles' action): stretched over the row, their label floated in the middle. */\n div[row] > button[act] {\n flex: none;\n width: auto;\n }\n div[row] > span {\n flex: 1;\n }\n `]\n\n /** The figure at the version on screen. */\n @property({ attribute: false }) revision?: FigureRevision\n /** The saved row, if any. Category and tags live on it. */\n @property({ type: String }) figureId?: string\n @property({ type: String }) figureCategory?: string\n /** The categories the server allows (LV figure-server design G5): chosen from, and fixed once set. Null: free text. */\n @property({ attribute: false }) figureCategories?: string[] | null\n @property({ type: Array }) figureTags?: string[]\n /** The part and face picked for the mounting face, before 「이 면으로」 is pressed. */\n @state() private pickedPart?: string\n @state() private pickedFace?: FigureFace\n\n private facts(): FigureFigureFacts | undefined {\n try {\n return this.revision ? figureFigureFacts(this.revision) : undefined\n } catch {\n /* A source the format refuses has no facts to show; the verdict tab says why. */\n return undefined\n }\n }\n\n /*\n The figure's own settings are shown while no part is picked; with one picked this is out of sight, and working out its\n facts (the figure parsed and compiled) on every edit is for nobody. Out of sight it keeps what it last drew, and it\n draws again when it comes back into view.\n */\n private lastDrawn?: unknown\n private outOfSight = false\n private watch?: ResizeObserver\n connectedCallback() {\n super.connectedCallback()\n this.watch = new ResizeObserver(() => {\n if (this.outOfSight && this.checkVisibility?.() !== false) {\n this.outOfSight = false\n this.requestUpdate()\n }\n })\n this.watch.observe(this)\n }\n disconnectedCallback() {\n this.watch?.disconnect()\n super.disconnectedCallback()\n }\n\n render() {\n if (this.hasUpdated && this.checkVisibility?.() === false) {\n this.outOfSight = true\n return this.lastDrawn ?? nothing\n }\n this.lastDrawn = this.draw()\n return this.lastDrawn\n }\n\n private draw() {\n const facts = this.facts()\n if (!facts) return nothing\n /* The figure's type is the page's (it lives on the row); it is slotted into the first section. */\n return html`<section>\n <h3>${i18next.t('figure.label.group-figure')}</h3>\n <slot name=\"type\"></slot>\n ${this.renderName(facts)} ${this.renderPlacement(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-standing')}</h3>\n ${this.renderSpace(facts)} ${this.renderMounting(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-catalog')}</h3>\n ${this.renderCatalog()}\n </section>\n ${this.renderAppSections()}`\n }\n\n private renderName(facts: FigureFigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.name')}</label>\n <input\n .value=${facts.name}\n placeholder=${i18next.t('figure.text.figure-display-name')}\n @change=${(event: Event) => {\n const input = event.target as HTMLInputElement\n if (!input.value.trim()) {\n /* The format refuses a blank name; put the old one back rather than send a command that fails. */\n input.value = facts.name\n return\n }\n if (input.value.trim() !== facts.name) this.command({ kind: 'rename', name: input.value })\n }}\n />\n </div>\n `\n }\n\n /**\n * The face the figure is placed by. In it is part of the room declaration, so choosing one declares the room\n * again from the parts — the only way declares it — with the new face. The hint says so.\n */\n private renderPlacement(facts: FigureFigureFacts) {\n const current = facts.placement ?? 'floor'\n return html`\n <div field>\n <label>${i18next.t('figure.label.figure-placement')}</label>\n <select\n .value=${live(current)}\n @change=${(event: Event) => {\n const select = event.target as HTMLSelectElement\n /* The figure's own setting (ADR-0097): chosen with no part too, and the room is left as it is declared. */\n this.command({ kind: 'set-placement', placement: select.value as Placement })\n /* Refused, the figure is placed as it was, and the list says so; taken, the figure drawn again says the new one. */\n select.value = current\n }}\n >\n ${PLACEMENTS.map(\n one => html`<option value=${one} ?selected=${one === current}>${i18next.t('figure.label.placement-' + one)}</option>`\n )}\n </select>\n </div>\n `\n }\n\n private renderSpace(facts: FigureFigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.declared-space')}</label>\n <div row>\n <span>${i18next.t(facts.declared ? 'figure.text.declared-space-declared' : 'figure.text.declared-space-none')}</span>\n <button act ?disabled=${!facts.parts.length} @click=${() => this.declare(facts.placement ?? 'floor')}>\n <md-icon>fit_screen</md-icon>${i18next.t('figure.button.fit-base-to-parts')}\n </button>\n </div>\n </div>\n `\n }\n\n private renderMounting(facts: FigureFigureFacts) {\n const mounting = facts.mounting\n /* Chosen, or what is set, or where the figure meets its plane -- not the first part listed (walk 1). */\n const { part, face } = offeredMountingOf(facts, { part: this.pickedPart, face: this.pickedFace })\n return html`\n <div field>\n <label>${i18next.t('figure.label.mounting-face')}</label>\n <div row>\n <select ?disabled=${!facts.declared} @change=${(e: Event) => (this.pickedPart = (e.target as HTMLSelectElement).value)}>\n ${facts.parts.map(one => html`<option value=${one} ?selected=${one === part}>${one}</option>`)}\n </select>\n <select ?disabled=${!facts.declared} @change=${(e: Event) => (this.pickedFace = (e.target as HTMLSelectElement).value as FigureFace)}>\n ${FACES.map(one => html`<option value=${one} ?selected=${one === face}>${i18next.t('figure.label.face-' + one)}</option>`)}\n </select>\n </div>\n <div row>\n <button act ?disabled=${!facts.declared || !part} @click=${() => this.command({ kind: 'set-mounting-face', part: part!, face })}>\n <md-icon>check</md-icon>${i18next.t('figure.button.set-mounting-face')}\n </button>\n <button quiet ?disabled=${!mounting} @click=${() => this.command({ kind: 'clear-mounting-face' })}>\n <md-icon>close</md-icon>${i18next.t('figure.button.clear-mounting-face')}\n </button>\n </div>\n <small>\n ${facts.declared\n ? mounting\n ? `${mounting.part} · ${i18next.t('figure.label.face-' + mounting.face)}`\n : i18next.t('figure.label.mounting-face-none')\n : i18next.t('figure.text.mounting-face-needs-space')}\n </small>\n </div>\n `\n }\n\n /** The sections an app added (G11), after the panel's own, for the figures they are for. A section that throws says so in its place. */\n private renderAppSections() {\n const asset = this.revision?.asset\n if (!asset) return nothing\n const figure = { id: this.figureId, category: this.figureCategory }\n return figurePropertySections().map(section => {\n try {\n if (!section.when({ asset, figure })) return nothing\n return html`<section data-section=${section.id}>\n <h3>${section.title()}</h3>\n ${section.render({ asset, figure, command: action => this.command(action) })}\n </section>`\n } catch (error) {\n console.error(`[figure-ui] the property section '${section.id}' failed`, error)\n return html`<section data-section=${section.id}>\n <p role=\"alert\">${i18next.t('figure.text.property-section-failed', { section: section.id, reason: (error as Error)?.message ?? String(error) })}</p>\n </section>`\n }\n })\n }\n\n private renderCatalog() {\n const saved = !!this.figureId\n return html`\n <div field>\n <label>${i18next.t('figure.label.category')}</label>\n ${this.figureCategories?.length\n ? html`<select\n category\n ?disabled=${!saved || !!this.figureCategory}\n @change=${(e: Event) => this.catalog({ category: (e.target as HTMLSelectElement).value })}\n >\n ${this.figureCategory ? nothing : html`<option value=\"\" selected disabled>${i18next.t('figure.text.category-choose')}</option>`}\n ${this.figureCategories.map(code => html`<option value=${code} ?selected=${code === this.figureCategory}>${code}</option>`)}\n </select>`\n : html`<input\n .value=${this.figureCategory ?? ''}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.category-placeholder')}\n @change=${(e: Event) => this.catalog({ category: (e.target as HTMLInputElement).value.trim() })}\n />`}\n </div>\n <div field>\n <label>${i18next.t('figure.label.tags')}</label>\n <input\n .value=${(this.figureTags ?? []).join(', ')}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.tags-placeholder')}\n @change=${(e: Event) => this.catalog({ tags: tagsOf((e.target as HTMLInputElement).value) })}\n />\n ${saved ? nothing : html`<small>${i18next.t('figure.text.catalog-needs-a-save')}</small>`}\n </div>\n `\n }\n\n private declare(placement: Placement) {\n if (!this.revision) return\n this.command(occupancyFromParts(this.revision.asset, placement))\n }\n\n private command(action: FigureAuthoringAction) {\n this.dispatchEvent(new CustomEvent('command', { detail: { action }, bubbles: true, composed: true }))\n }\n\n private catalog(patch: { category?: string; tags?: string[] }) {\n this.dispatchEvent(new CustomEvent('catalog', { detail: patch, bubbles: true, composed: true }))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"figure-properties.js","sourceRoot":"","sources":["../../client/modeller/figure-properties.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,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGjD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAA0C,MAAM,mBAAmB,CAAA;AAErG,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gEAAgE,CAAA;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,UAAU,GAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;AAEtE;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA5D;;QA6CG,eAAU,GAAG,KAAK,CAAA;IA6K5B,CAAC;aAzNQ,WAAM,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;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,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;IAEO,OAAO,CAAC,KAA6C;QAC3D,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClG,CAAC;;AAlM+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAA0B;AAE7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAwB;AAEnB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAAmC;AACvC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAsB;AA7BrC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA0N5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureAuthoringAction } from '@hatiolab/figure-model'\n\nimport { tagsOf, figureFigureFacts, type Placement, type FigureFigureFacts } from './figure-facts.js'\nimport type { FigureRevision } from './revision.js'\nimport { figurePropertySections } from './property-sections.js'\nimport { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nconst PLACEMENTS: Placement[] = ['floor', 'ceiling', 'center', 'wall']\n\n/**\n * 속성 — the modeller's figure properties.\n *\n * The tab opens with what the figure is: its name, where it stands, where the catalogue files it.\n *\n * Nothing here is set up before work can go on (user 2026-10-18, after a walk without it). The room the figure\n * takes up is declared where release asks for it, from the parts -- the bar's blockers and the verdict offer it;\n * whether the figure meets its plane is said by the release check from the parts, with no face to name. A mounting\n * face named already (by the assistant, or before) is shown with the way to take it off, and nothing more.\n *\n * Two kinds of change leave this tab, and it does neither itself:\n * - `command` carries an authoring command (rename, where it stands, taking the mounting face off). The page runs\n * it through the session, so it is one step of the same undo history as every other edit, and is saved with it.\n * - `catalog` carries a change to the row (category, tags). Those are not in the asset; the page writes them\n * to the saved row at once, so they need a saved figure.\n */\n@customElement('figure-properties')\nexport class FigureProperties extends localize(i18next)(LitElement) {\n static styles = [ScrollbarStyles, SidePanelStyles, css`\n :host {\n display: block;\n /* It stands inside the properties tab's panel, which gives the margin; a second one indented it past the type. */\n padding: 0;\n overflow: auto;\n }\n div[row] {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n /* What is named, then the way to take it off at the line's end, as wide as its words. */\n div[row] > span {\n flex: 1;\n }\n div[row] > button[quiet] {\n flex: none;\n }\n `]\n\n /** The figure at the version on screen. */\n @property({ attribute: false }) revision?: FigureRevision\n /** The saved row, if any. Category and tags live on it. */\n @property({ type: String }) figureId?: string\n @property({ type: String }) figureCategory?: string\n /** The categories the server allows (LV figure-server design G5): chosen from, and fixed once set. Null: free text. */\n @property({ attribute: false }) figureCategories?: string[] | null\n @property({ type: Array }) figureTags?: string[]\n private facts(): FigureFigureFacts | undefined {\n try {\n return this.revision ? figureFigureFacts(this.revision) : undefined\n } catch {\n /* A source the format refuses has no facts to show; the verdict tab says why. */\n return undefined\n }\n }\n\n /*\n The figure's own settings are shown while no part is picked; with one picked this is out of sight, and working out its\n facts (the figure parsed and compiled) on every edit is for nobody. Out of sight it keeps what it last drew, and it\n draws again when it comes back into view.\n */\n private lastDrawn?: unknown\n private outOfSight = false\n private watch?: ResizeObserver\n connectedCallback() {\n super.connectedCallback()\n this.watch = new ResizeObserver(() => {\n if (this.outOfSight && this.checkVisibility?.() !== false) {\n this.outOfSight = false\n this.requestUpdate()\n }\n })\n this.watch.observe(this)\n }\n disconnectedCallback() {\n this.watch?.disconnect()\n super.disconnectedCallback()\n }\n\n render() {\n if (this.hasUpdated && this.checkVisibility?.() === false) {\n this.outOfSight = true\n return this.lastDrawn ?? nothing\n }\n this.lastDrawn = this.draw()\n return this.lastDrawn\n }\n\n private draw() {\n const facts = this.facts()\n if (!facts) return nothing\n /* The figure's type is the page's (it lives on the row); it is slotted into the first section. */\n return html`<section>\n <h3>${i18next.t('figure.label.group-figure')}</h3>\n <slot name=\"type\"></slot>\n ${this.renderName(facts)} ${this.renderPlacement(facts)} ${this.renderMounting(facts)}\n </section>\n <section>\n <h3>${i18next.t('figure.label.group-catalog')}</h3>\n ${this.renderCatalog()}\n </section>\n ${this.renderAppSections()}`\n }\n\n private renderName(facts: FigureFigureFacts) {\n return html`\n <div field>\n <label>${i18next.t('figure.label.name')}</label>\n <input\n .value=${facts.name}\n placeholder=${i18next.t('figure.text.figure-display-name')}\n @change=${(event: Event) => {\n const input = event.target as HTMLInputElement\n if (!input.value.trim()) {\n /* The format refuses a blank name; put the old one back rather than send a command that fails. */\n input.value = facts.name\n return\n }\n if (input.value.trim() !== facts.name) this.command({ kind: 'rename', name: input.value })\n }}\n />\n </div>\n `\n }\n\n /**\n * The face the figure is placed by. In it is part of the room declaration, so choosing one declares the room\n * again from the parts — the only way declares it — with the new face. The hint says so.\n */\n private renderPlacement(facts: FigureFigureFacts) {\n const current = facts.placement ?? 'floor'\n return html`\n <div field>\n <label>${i18next.t('figure.label.figure-placement')}</label>\n <select\n .value=${live(current)}\n @change=${(event: Event) => {\n const select = event.target as HTMLSelectElement\n /* The figure's own setting (ADR-0097): chosen with no part too, and the room is left as it is declared. */\n this.command({ kind: 'set-placement', placement: select.value as Placement })\n /* Refused, the figure is placed as it was, and the list says so; taken, the figure drawn again says the new one. */\n select.value = current\n }}\n >\n ${PLACEMENTS.map(\n one => html`<option value=${one} ?selected=${one === current}>${i18next.t('figure.label.placement-' + one)}</option>`\n )}\n </select>\n </div>\n `\n }\n\n /**\n * A mounting face named already: which, and the way to take it off. A centred figure has no plane, so the gate does\n * not check it there; the line says so rather than show a promise that is not kept.\n */\n private renderMounting(facts: FigureFigureFacts) {\n const mounting = facts.mounting\n if (!mounting) return nothing\n const said = `${mounting.part} · ${i18next.t('figure.label.face-' + mounting.face)}`\n return html`\n <div field mounting-face>\n <label>${i18next.t('figure.label.mounting-face')}</label>\n <div row>\n <span>${facts.placement === 'center' ? `${said} · ${i18next.t('figure.text.mounting-face-unchecked-at-center')}` : said}</span>\n <button quiet clear-mounting-face @click=${() => this.command({ kind: 'clear-mounting-face' })}>\n <md-icon>close</md-icon>${i18next.t('figure.button.clear-mounting-face')}\n </button>\n </div>\n </div>\n `\n }\n\n /** The sections an app added (G11), after the panel's own, for the figures they are for. A section that throws says so in its place. */\n private renderAppSections() {\n const asset = this.revision?.asset\n if (!asset) return nothing\n const figure = { id: this.figureId, category: this.figureCategory }\n return figurePropertySections().map(section => {\n try {\n if (!section.when({ asset, figure })) return nothing\n return html`<section data-section=${section.id}>\n <h3>${section.title()}</h3>\n ${section.render({ asset, figure, command: action => this.command(action) })}\n </section>`\n } catch (error) {\n console.error(`[figure-ui] the property section '${section.id}' failed`, error)\n return html`<section data-section=${section.id}>\n <p role=\"alert\">${i18next.t('figure.text.property-section-failed', { section: section.id, reason: (error as Error)?.message ?? String(error) })}</p>\n </section>`\n }\n })\n }\n\n private renderCatalog() {\n const saved = !!this.figureId\n return html`\n <div field>\n <label>${i18next.t('figure.label.category')}</label>\n ${this.figureCategories?.length\n ? html`<select\n category\n ?disabled=${!saved || !!this.figureCategory}\n @change=${(e: Event) => this.catalog({ category: (e.target as HTMLSelectElement).value })}\n >\n ${this.figureCategory ? nothing : html`<option value=\"\" selected disabled>${i18next.t('figure.text.category-choose')}</option>`}\n ${this.figureCategories.map(code => html`<option value=${code} ?selected=${code === this.figureCategory}>${code}</option>`)}\n </select>`\n : html`<input\n .value=${this.figureCategory ?? ''}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.category-placeholder')}\n @change=${(e: Event) => this.catalog({ category: (e.target as HTMLInputElement).value.trim() })}\n />`}\n </div>\n <div field>\n <label>${i18next.t('figure.label.tags')}</label>\n <input\n .value=${(this.figureTags ?? []).join(', ')}\n ?disabled=${!saved}\n placeholder=${i18next.t('figure.text.tags-placeholder')}\n @change=${(e: Event) => this.catalog({ tags: tagsOf((e.target as HTMLInputElement).value) })}\n />\n ${saved ? nothing : html`<small>${i18next.t('figure.text.catalog-needs-a-save')}</small>`}\n </div>\n `\n }\n\n private command(action: FigureAuthoringAction) {\n this.dispatchEvent(new CustomEvent('command', { detail: { action }, bubbles: true, composed: true }))\n }\n\n private catalog(patch: { category?: string; tags?: string[] }) {\n this.dispatchEvent(new CustomEvent('catalog', { detail: patch, bubbles: true, composed: true }))\n }\n}\n"]}
|