@things-factory/figure-ui 10.1.250 → 10.1.253
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/data-interface.ts +3 -3
- package/client/modeller/figure-data-panel.ts +9 -27
- package/client/modeller/refusals.ts +64 -4
- package/client/modeller/unit-words.ts +2 -11
- package/dist-client/modeller/data-interface.d.ts +4 -4
- package/dist-client/modeller/data-interface.js +3 -1
- package/dist-client/modeller/data-interface.js.map +1 -1
- package/dist-client/modeller/figure-data-panel.d.ts +2 -2
- package/dist-client/modeller/figure-data-panel.js +10 -28
- package/dist-client/modeller/figure-data-panel.js.map +1 -1
- package/dist-client/modeller/refusals.d.ts +2 -0
- package/dist-client/modeller/refusals.js +82 -4
- package/dist-client/modeller/refusals.js.map +1 -1
- package/dist-client/modeller/unit-words.d.ts +1 -5
- package/dist-client/modeller/unit-words.js +2 -11
- package/dist-client/modeller/unit-words.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/test/data-motion.test.ts +2 -1
- package/test/refusals.test.ts +118 -0
- package/translations/en.json +26 -38
- package/translations/es.json +26 -38
- package/translations/ja.json +26 -38
- package/translations/ko.json +26 -38
- package/translations/ms.json +26 -38
- package/translations/zh.json +26 -38
|
@@ -5,8 +5,10 @@ import { customElement, property, state } from 'lit/decorators.js';
|
|
|
5
5
|
import { i18next, localize } from '@operato/i18n';
|
|
6
6
|
import { unitWord } from './unit-words.js';
|
|
7
7
|
import { FIGURE_UNITS, figureDataExample, inferFigureDataSchema } from '@hatiolab/figure-model';
|
|
8
|
-
import { accessorOfRow,
|
|
8
|
+
import { accessorOfRow, behaviorsOf, bindingDraftOf, domainOf, endlessJointsOf, fieldAt, fieldOfKind, fitsField, freeCodeOf, legendRoleOf, methodOf, methodsOf, partsOf, rotationStepsOf, sampleOf, schemaRowsOf, schemaWithField, schemaWithFieldReplaced, schemaWithoutField, schemaFollowingCodes, stateInputsOf, tableColumnsOf, tableDraftOf, tableWithKeys, tableWithLook, tableWithTargets } from './data-interface.js';
|
|
9
9
|
import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-panel-styles.js';
|
|
10
|
+
import { dataMoveOf } from '@things-factory/figure-viewer/dist-client/data-connection.js';
|
|
11
|
+
import { kindWords, moveWords } from '@things-factory/figure-viewer/dist-client/data-words.js';
|
|
10
12
|
import { figureBindingsTakenOver, figureCapabilityDescriptorOf } from '@hatiolab/things-scene';
|
|
11
13
|
import { consumerDescriptors } from './consumer-capabilities.js';
|
|
12
14
|
import { HelpToggles } from './help.js';
|
|
@@ -263,17 +265,9 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
|
|
|
263
265
|
${this.renderAddField(schema, '')} ${this.renderFromSample(schema)}
|
|
264
266
|
</section>`;
|
|
265
267
|
}
|
|
268
|
+
/** A field's kind in the words every screen says it in (figure-viewer kindWords). */
|
|
266
269
|
kindWord(node) {
|
|
267
|
-
|
|
268
|
-
if (node.kind === 'number') {
|
|
269
|
-
const range = node.min !== undefined || node.max !== undefined ? ` ${node.min ?? ''}~${node.max ?? ''}` : '';
|
|
270
|
-
return `${kind}${node.unit ? ` ${unitWord(node.unit)}` : ''}${range}`;
|
|
271
|
-
}
|
|
272
|
-
if (node.kind === 'text' && node.values)
|
|
273
|
-
return `${kind} (${node.values.join(', ')})`;
|
|
274
|
-
if (node.kind === 'list')
|
|
275
|
-
return `${kind} · ${i18next.t('figure.label.data-kind-' + node.item.kind)}`;
|
|
276
|
-
return kind;
|
|
270
|
+
return kindWords(node);
|
|
277
271
|
}
|
|
278
272
|
/** The chosen field's own settings, and a field added under it when it holds fields. */
|
|
279
273
|
renderField(asset, schema, row) {
|
|
@@ -433,21 +427,9 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
|
|
|
433
427
|
</details>`;
|
|
434
428
|
}
|
|
435
429
|
/* ---------------------------------------------------------------- the bindings */
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
const name = b.kind === 'pose' ? i18next.t('figure.label.data-axis-' + b.axis) : (choice?.name ?? key.slice(key.indexOf(':') + 1));
|
|
440
|
-
return i18next.t('figure.label.data-behavior-' + b.kind, { name });
|
|
441
|
-
}
|
|
442
|
-
/** What a table shows on, as one line: its parts, the controls it sets, its motion group. */
|
|
443
|
-
targetsName(asset, b) {
|
|
444
|
-
const inputs = stateInputsOf(asset);
|
|
445
|
-
const group = (asset.motionGroups ?? []).find(g => g.id === b.targets.group);
|
|
446
|
-
return [
|
|
447
|
-
...(b.targets.parts ?? []),
|
|
448
|
-
...(b.targets.inputs ?? []).map(id => inputs.find(i => i.id === id)?.label ?? id),
|
|
449
|
-
...(group ? [group.label] : [])
|
|
450
|
-
].join(', ');
|
|
430
|
+
/** What a behavior moves, in the words every screen says it in (figure-viewer dataMoveOf · moveWords). */
|
|
431
|
+
behaviorName(asset, b) {
|
|
432
|
+
return moveWords(dataMoveOf(asset, b));
|
|
451
433
|
}
|
|
452
434
|
renderBindings(asset, rows) {
|
|
453
435
|
const bindings = asset.dataInterface?.bindings ?? [];
|
|
@@ -464,7 +446,7 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
|
|
|
464
446
|
renderBinding(asset, choices, b, resting) {
|
|
465
447
|
const open = this.opened === b.id;
|
|
466
448
|
const set = (next) => this.edit({ kind: 'set-data-binding', binding: next });
|
|
467
|
-
const what = b.rule === 'table' ?
|
|
449
|
+
const what = moveWords(dataMoveOf(asset, b.rule === 'table' ? { kind: 'table', targets: b.targets } : b.behavior));
|
|
468
450
|
const rests = resting.some(r => r.id === b.id);
|
|
469
451
|
return html `<section item>
|
|
470
452
|
<div head>
|
|
@@ -837,7 +819,7 @@ let FigureDataPanel = class FigureDataPanel extends localize(i18next)(LitElement
|
|
|
837
819
|
${!table && fitting.length
|
|
838
820
|
? html `<span>${i18next.t('figure.label.data-behavior')}</span>
|
|
839
821
|
<select @change=${(e) => set({ behavior: typed(e) })}>
|
|
840
|
-
${fitting.map(c => html `<option value=${c.key} ?selected=${c === choice}>${this.behaviorName(asset,
|
|
822
|
+
${fitting.map(c => html `<option value=${c.key} ?selected=${c === choice}>${this.behaviorName(asset, c.behavior)}</option>`)}
|
|
841
823
|
</select>`
|
|
842
824
|
: nothing}
|
|
843
825
|
</div>
|