@operato/property-panel 10.29.87 → 10.29.92
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/dist/src/property-panel/event-handlers/event-handlers-mapper.d.ts +2 -1
- package/dist/src/property-panel/event-handlers/event-handlers-mapper.js +78 -25
- package/package.json +5 -5
- package/translations/en.json +7 -1
- package/translations/es.json +7 -1
- package/translations/ja.json +7 -1
- package/translations/ko.json +7 -1
- package/translations/ms.json +7 -1
- package/translations/zh.json +7 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import '@operato/input/ox-input-code.js';
|
|
10
10
|
import '@operato/i18n/ox-i18n.js';
|
|
11
11
|
import { LitElement } from 'lit';
|
|
12
|
-
import type
|
|
12
|
+
import { type Scene } from '@hatiolab/things-scene';
|
|
13
13
|
/** EventHandler model — things-scene 의 EventHandler interface 와 호환. */
|
|
14
14
|
export type EventHandlerSpec = {
|
|
15
15
|
trigger: string;
|
|
@@ -25,6 +25,7 @@ export declare class EventHandlersMapper extends LitElement {
|
|
|
25
25
|
handler: EventHandlerSpec;
|
|
26
26
|
scene?: Scene;
|
|
27
27
|
render(): import("lit-html").TemplateResult<1>;
|
|
28
|
+
private _renderGiven;
|
|
28
29
|
private _renderScriptFields;
|
|
29
30
|
private _renderActionFields;
|
|
30
31
|
private _update;
|
|
@@ -11,26 +11,29 @@ import '@operato/input/ox-input-code.js';
|
|
|
11
11
|
import '@operato/i18n/ox-i18n.js';
|
|
12
12
|
import { css, html, LitElement } from 'lit';
|
|
13
13
|
import { property } from 'lit/decorators.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'
|
|
33
|
-
|
|
14
|
+
import { GESTURE_MEANINGS, capabilityText, figureCapabilityDescriptorOf, hasOwnHandlerOf, meaningOfTrigger, sceneActionNames, sceneInteractionsOf, triggerOfMeaning } from '@hatiolab/things-scene';
|
|
15
|
+
import { i18next } from '@operato/i18n';
|
|
16
|
+
/*
|
|
17
|
+
A handler is put on a meaning, not a gesture (ADR-0209 decision 2): the four meanings of things-scene's table, then the
|
|
18
|
+
low-level gestures a saved board may hold (shown so it can still be edited). The trigger written is the meaning's
|
|
19
|
+
gesture; the handler format does not change.
|
|
20
|
+
*/
|
|
21
|
+
const LOW_LEVEL = ['mouseleave', 'mousedown', 'mouseup', 'pressed'];
|
|
22
|
+
/** The actions this scene has: 'script', then every registered action (the scene's own and the products'). */
|
|
23
|
+
const actionsOf = (current) => {
|
|
24
|
+
const names = ['', 'script', ...sceneActionNames().filter(n => n !== 'script').sort()];
|
|
25
|
+
return current && !names.includes(current) ? [...names, current] : names;
|
|
26
|
+
};
|
|
27
|
+
/* Words in the user's language, by the one rule (figure-model `capabilityText`): the gesture table's and a capability's. */
|
|
28
|
+
const words = (text) => capabilityText(text, i18next.language);
|
|
29
|
+
/* An interaction a capability gives, in words: whose, what (its own words, else the action's name) and on which part. */
|
|
30
|
+
const interactionWords = (one) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const whose = one.capability ? words((_a = figureCapabilityDescriptorOf(one.capability)) === null || _a === void 0 ? void 0 : _a.label) || one.capability : '';
|
|
33
|
+
const what = words(one.label) || one.action;
|
|
34
|
+
const part = one.part ? ` (${i18next.t('text.capability-interaction-part', { part: one.part })})` : '';
|
|
35
|
+
return `${whose ? whose + ' · ' : ''}${what}${part}`;
|
|
36
|
+
};
|
|
34
37
|
export class EventHandlersMapper extends LitElement {
|
|
35
38
|
constructor() {
|
|
36
39
|
super(...arguments);
|
|
@@ -41,22 +44,29 @@ export class EventHandlersMapper extends LitElement {
|
|
|
41
44
|
const h = this.handler || { trigger: 'click', action: '' };
|
|
42
45
|
return html `
|
|
43
46
|
<div class="row">
|
|
44
|
-
<label><ox-i18n msgid="label.
|
|
47
|
+
<label><ox-i18n msgid="label.gesture-meaning">Meaning</ox-i18n></label>
|
|
45
48
|
<select
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
@change=${(e) => {
|
|
50
|
+
const value = e.target.value;
|
|
51
|
+
this._update('trigger', value.startsWith('meaning:') ? triggerOfMeaning(value.slice(8)) : value);
|
|
52
|
+
}}
|
|
48
53
|
>
|
|
49
|
-
${
|
|
54
|
+
${GESTURE_MEANINGS.map(m => html `<option value=${'meaning:' + m.meaning} title=${words(m.note)} ?selected=${meaningOfTrigger(h.trigger || 'click') === m.meaning}>${words(m.label)}</option>`)}
|
|
55
|
+
<optgroup label=${i18next.t('label.low-level-gestures')}>
|
|
56
|
+
${LOW_LEVEL.map(t => html `<option value=${t} ?selected=${h.trigger === t}>${t}</option>`)}
|
|
57
|
+
</optgroup>
|
|
50
58
|
</select>
|
|
51
59
|
</div>
|
|
52
60
|
|
|
61
|
+
${this._renderGiven(h)}
|
|
62
|
+
|
|
53
63
|
<div class="row">
|
|
54
64
|
<label><ox-i18n msgid="label.action">Action</ox-i18n></label>
|
|
55
65
|
<select
|
|
56
66
|
.value=${(_a = h.action) !== null && _a !== void 0 ? _a : ''}
|
|
57
67
|
@change=${(e) => this._update('action', e.target.value)}
|
|
58
68
|
>
|
|
59
|
-
${
|
|
69
|
+
${actionsOf(h.action).map(a => { var _a; return html `<option value=${a} ?selected=${((_a = h.action) !== null && _a !== void 0 ? _a : '') === a}>${a || '(none)'}</option>`; })}
|
|
60
70
|
</select>
|
|
61
71
|
</div>
|
|
62
72
|
|
|
@@ -65,6 +75,30 @@ export class EventHandlersMapper extends LitElement {
|
|
|
65
75
|
: (h.action ? this._renderActionFields(h) : null)}
|
|
66
76
|
`;
|
|
67
77
|
}
|
|
78
|
+
/*
|
|
79
|
+
What the selected component's capabilities already do on the handler's meaning (ADR-0209 decision 7), and that a
|
|
80
|
+
handler of that meaning runs in their place -- the scene's one rule, `hasOwnHandlerOf`, asked of this handler.
|
|
81
|
+
*/
|
|
82
|
+
_renderGiven(h) {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
const meaning = meaningOfTrigger(h.trigger || 'click');
|
|
85
|
+
const component = (_b = (_a = this.scene) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b[0];
|
|
86
|
+
if (!meaning || !component)
|
|
87
|
+
return null;
|
|
88
|
+
const given = sceneInteractionsOf(component).filter(one => one.meaning === meaning);
|
|
89
|
+
if (!given.length)
|
|
90
|
+
return null;
|
|
91
|
+
const replaces = hasOwnHandlerOf({ eventHandlers: [h] }, meaning);
|
|
92
|
+
return html `
|
|
93
|
+
<div class="row">
|
|
94
|
+
<label><ox-i18n msgid="label.capability-interactions">Capability actions</ox-i18n></label>
|
|
95
|
+
<div given>
|
|
96
|
+
${given.map(one => html `<span>${interactionWords(one)}</span>`)}
|
|
97
|
+
<small>${i18next.t(replaces ? 'text.handler-replaces-capability' : 'text.disabled-handler-keeps-capability')}</small>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
68
102
|
_renderScriptFields(h) {
|
|
69
103
|
return html `
|
|
70
104
|
<div class="row">
|
|
@@ -246,6 +280,25 @@ EventHandlersMapper.styles = [
|
|
|
246
280
|
flex: 1;
|
|
247
281
|
}
|
|
248
282
|
|
|
283
|
+
/* A list of several lines: its label stands at the first line, not in the middle. */
|
|
284
|
+
.row:has(> [given]) {
|
|
285
|
+
align-items: start;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
[given] {
|
|
289
|
+
display: flex;
|
|
290
|
+
flex-direction: column;
|
|
291
|
+
gap: 2px;
|
|
292
|
+
min-width: 0;
|
|
293
|
+
font-size: 0.74rem;
|
|
294
|
+
color: var(--md-sys-color-on-surface);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
[given] small {
|
|
298
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
299
|
+
line-height: 1.35;
|
|
300
|
+
}
|
|
301
|
+
|
|
249
302
|
label {
|
|
250
303
|
font-size: 12px;
|
|
251
304
|
color: var(--md-sys-color-on-surface-variant, #49454f);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/property-panel",
|
|
3
3
|
"description": "Webcomponent property-panel following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "10.29.
|
|
5
|
+
"version": "10.29.92",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@material/web": "^2.0.0",
|
|
90
|
-
"@operato/app": "^10.29.
|
|
91
|
-
"@operato/attachment": "^10.29.
|
|
90
|
+
"@operato/app": "^10.29.90",
|
|
91
|
+
"@operato/attachment": "^10.29.90",
|
|
92
92
|
"@operato/i18n": "^10.29.85",
|
|
93
|
-
"@operato/input": "^10.29.
|
|
93
|
+
"@operato/input": "^10.29.90",
|
|
94
94
|
"@operato/styles": "^10.29.83",
|
|
95
95
|
"@operato/utils": "^10.29.85",
|
|
96
96
|
"lit": "^3.1.2"
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"prettier --write"
|
|
129
129
|
]
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "70ab0f0b03aebb9e14c37e5216bd1116961786c8"
|
|
132
132
|
}
|
package/translations/en.json
CHANGED
|
@@ -789,5 +789,11 @@
|
|
|
789
789
|
"label.ceiling-height": "ceiling height",
|
|
790
790
|
"text.scale-unknown": "scale unknown",
|
|
791
791
|
"button.calibrate-scale": "fit to a real length",
|
|
792
|
-
"label.calibrate-width": "the real length of the drawing width {width}"
|
|
792
|
+
"label.calibrate-width": "the real length of the drawing width {width}",
|
|
793
|
+
"label.gesture-meaning": "meaning",
|
|
794
|
+
"label.low-level-gestures": "low-level gestures",
|
|
795
|
+
"label.capability-interactions": "capability actions",
|
|
796
|
+
"text.capability-interaction-part": "part {part}",
|
|
797
|
+
"text.handler-replaces-capability": "With this handler, it runs instead of the actions above.",
|
|
798
|
+
"text.disabled-handler-keeps-capability": "This handler is off, so the actions above still run."
|
|
793
799
|
}
|
package/translations/es.json
CHANGED
|
@@ -789,5 +789,11 @@
|
|
|
789
789
|
"label.ceiling-height": "altura del techo",
|
|
790
790
|
"text.scale-unknown": "escala desconocida",
|
|
791
791
|
"button.calibrate-scale": "ajustar a una longitud real",
|
|
792
|
-
"label.calibrate-width": "longitud real del ancho del plano {width}"
|
|
792
|
+
"label.calibrate-width": "longitud real del ancho del plano {width}",
|
|
793
|
+
"label.gesture-meaning": "significado",
|
|
794
|
+
"label.low-level-gestures": "gestos de bajo nivel",
|
|
795
|
+
"label.capability-interactions": "acciones de la capacidad",
|
|
796
|
+
"text.capability-interaction-part": "pieza {part}",
|
|
797
|
+
"text.handler-replaces-capability": "Con este controlador, se ejecuta este en lugar de las acciones anteriores.",
|
|
798
|
+
"text.disabled-handler-keeps-capability": "Este controlador está desactivado, así que las acciones anteriores se siguen ejecutando."
|
|
793
799
|
}
|
package/translations/ja.json
CHANGED
|
@@ -793,5 +793,11 @@
|
|
|
793
793
|
"label.ceiling-height": "天井の高さ",
|
|
794
794
|
"text.scale-unknown": "縮尺未確認",
|
|
795
795
|
"button.calibrate-scale": "実際の長さに合わせる",
|
|
796
|
-
"label.calibrate-width": "図面の幅 {width} の実際の長さ"
|
|
796
|
+
"label.calibrate-width": "図面の幅 {width} の実際の長さ",
|
|
797
|
+
"label.gesture-meaning": "意味",
|
|
798
|
+
"label.low-level-gestures": "低レベルのジェスチャー",
|
|
799
|
+
"label.capability-interactions": "機能による操作",
|
|
800
|
+
"text.capability-interaction-part": "部品 {part}",
|
|
801
|
+
"text.handler-replaces-capability": "このハンドラーを置くと、上の操作の代わりにこのハンドラーが実行されます。",
|
|
802
|
+
"text.disabled-handler-keeps-capability": "このハンドラーはオフのため、上の操作がそのまま実行されます。"
|
|
797
803
|
}
|
package/translations/ko.json
CHANGED
|
@@ -793,5 +793,11 @@
|
|
|
793
793
|
"label.ceiling-height": "천장 높이",
|
|
794
794
|
"text.scale-unknown": "축척 미확인",
|
|
795
795
|
"button.calibrate-scale": "실제 길이로 맞추기",
|
|
796
|
-
"label.calibrate-width": "도면 너비 {width} 의 실제 길이"
|
|
796
|
+
"label.calibrate-width": "도면 너비 {width} 의 실제 길이",
|
|
797
|
+
"label.gesture-meaning": "뜻",
|
|
798
|
+
"label.low-level-gestures": "낮은 수준 제스처",
|
|
799
|
+
"label.capability-interactions": "능력이 주는 동작",
|
|
800
|
+
"text.capability-interaction-part": "{part} 부품",
|
|
801
|
+
"text.handler-replaces-capability": "이 핸들러를 두면 위 동작 대신 이 핸들러가 실행됩니다.",
|
|
802
|
+
"text.disabled-handler-keeps-capability": "이 핸들러는 꺼져 있으므로 위 동작이 그대로 실행됩니다."
|
|
797
803
|
}
|
package/translations/ms.json
CHANGED
|
@@ -666,5 +666,11 @@
|
|
|
666
666
|
"label.ceiling-height": "tinggi siling",
|
|
667
667
|
"text.scale-unknown": "skala tidak diketahui",
|
|
668
668
|
"button.calibrate-scale": "padankan dengan panjang sebenar",
|
|
669
|
-
"label.calibrate-width": "panjang sebenar lebar lukisan {width}"
|
|
669
|
+
"label.calibrate-width": "panjang sebenar lebar lukisan {width}",
|
|
670
|
+
"label.gesture-meaning": "maksud",
|
|
671
|
+
"label.low-level-gestures": "gerak isyarat aras rendah",
|
|
672
|
+
"label.capability-interactions": "tindakan keupayaan",
|
|
673
|
+
"text.capability-interaction-part": "bahagian {part}",
|
|
674
|
+
"text.handler-replaces-capability": "Dengan pengendali ini, pengendali ini dijalankan sebagai ganti tindakan di atas.",
|
|
675
|
+
"text.disabled-handler-keeps-capability": "Pengendali ini dimatikan, jadi tindakan di atas masih dijalankan."
|
|
670
676
|
}
|
package/translations/zh.json
CHANGED
|
@@ -792,5 +792,11 @@
|
|
|
792
792
|
"label.ceiling-height": "天花板高度",
|
|
793
793
|
"text.scale-unknown": "比例未确认",
|
|
794
794
|
"button.calibrate-scale": "按实际长度校准",
|
|
795
|
-
"label.calibrate-width": "图纸宽度 {width} 的实际长度"
|
|
795
|
+
"label.calibrate-width": "图纸宽度 {width} 的实际长度",
|
|
796
|
+
"label.gesture-meaning": "含义",
|
|
797
|
+
"label.low-level-gestures": "底层手势",
|
|
798
|
+
"label.capability-interactions": "功能提供的操作",
|
|
799
|
+
"text.capability-interaction-part": "部件 {part}",
|
|
800
|
+
"text.handler-replaces-capability": "设置此处理程序后,将执行此处理程序,而不执行上述操作。",
|
|
801
|
+
"text.disabled-handler-keeps-capability": "此处理程序已关闭,上述操作仍会执行。"
|
|
796
802
|
}
|