@operato/property-panel 10.29.86 → 10.29.90

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.
@@ -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 { Scene } from '@hatiolab/things-scene';
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;
@@ -11,26 +11,20 @@ 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
- const TRIGGERS = [
15
- 'click', 'dblclick',
16
- 'mouseenter', 'mouseleave',
17
- 'longpress',
18
- 'mousedown', 'mouseup'
19
- ];
20
- /** 'script' 는 action 의 한 값. */
21
- const ACTIONS = [
22
- '',
23
- 'script',
24
- 'data-toggle',
25
- 'data-tristate',
26
- 'data-spreading',
27
- 'data-set',
28
- 'partial-data-set',
29
- 'value-set',
30
- 'partial-value-set',
31
- 'info-window',
32
- 'emphasize'
33
- ];
14
+ import { GESTURE_MEANINGS, meaningOfTrigger, sceneActionNames, 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
+ const words = (text) => (String(i18next.language || '').startsWith('ko') ? text.ko : text.en);
34
28
  export class EventHandlersMapper extends LitElement {
35
29
  constructor() {
36
30
  super(...arguments);
@@ -41,12 +35,17 @@ export class EventHandlersMapper extends LitElement {
41
35
  const h = this.handler || { trigger: 'click', action: '' };
42
36
  return html `
43
37
  <div class="row">
44
- <label><ox-i18n msgid="label.trigger">Trigger</ox-i18n></label>
38
+ <label><ox-i18n msgid="label.gesture-meaning">Meaning</ox-i18n></label>
45
39
  <select
46
- .value=${h.trigger || 'click'}
47
- @change=${(e) => this._update('trigger', e.target.value)}
40
+ @change=${(e) => {
41
+ const value = e.target.value;
42
+ this._update('trigger', value.startsWith('meaning:') ? triggerOfMeaning(value.slice(8)) : value);
43
+ }}
48
44
  >
49
- ${TRIGGERS.map(t => html `<option value=${t} ?selected=${h.trigger === t}>${t}</option>`)}
45
+ ${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>`)}
46
+ <optgroup label=${i18next.t('label.low-level-gestures')}>
47
+ ${LOW_LEVEL.map(t => html `<option value=${t} ?selected=${h.trigger === t}>${t}</option>`)}
48
+ </optgroup>
50
49
  </select>
51
50
  </div>
52
51
 
@@ -56,7 +55,7 @@ export class EventHandlersMapper extends LitElement {
56
55
  .value=${(_a = h.action) !== null && _a !== void 0 ? _a : ''}
57
56
  @change=${(e) => this._update('action', e.target.value)}
58
57
  >
59
- ${ACTIONS.map(a => { var _a; return html `<option value=${a} ?selected=${((_a = h.action) !== null && _a !== void 0 ? _a : '') === a}>${a || '(none)'}</option>`; })}
58
+ ${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
59
  </select>
61
60
  </div>
62
61
 
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.86",
5
+ "version": "10.29.90",
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.86",
91
- "@operato/attachment": "^10.29.86",
90
+ "@operato/app": "^10.29.90",
91
+ "@operato/attachment": "^10.29.90",
92
92
  "@operato/i18n": "^10.29.85",
93
- "@operato/input": "^10.29.85",
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": "82d02ea4ee30d49a87017e578b74ac960098ae7f"
131
+ "gitHead": "354953417c0c6fefa2ed68da4fcfd276d95ba605"
132
132
  }
@@ -789,5 +789,7 @@
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"
793
795
  }
@@ -789,5 +789,7 @@
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"
793
795
  }
@@ -793,5 +793,7 @@
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": "低レベルのジェスチャー"
797
799
  }
@@ -793,5 +793,7 @@
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": "낮은 수준 제스처"
797
799
  }
@@ -666,5 +666,7 @@
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"
670
672
  }
@@ -792,5 +792,7 @@
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": "底层手势"
796
798
  }