@fmsim/layout-view 1.0.83 → 2.0.0-beta.2
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-client/board-provider.d.ts +3 -3
- package/dist-client/board-provider.js.map +1 -1
- package/dist-client/data-grist/animation-map-editor.d.ts +8 -2
- package/dist-client/data-grist/animation-map-editor.js +78 -3
- package/dist-client/data-grist/animation-map-editor.js.map +1 -1
- package/dist-client/data-grist/ox-input-animation-config.d.ts +31 -0
- package/dist-client/data-grist/ox-input-animation-config.js +190 -0
- package/dist-client/data-grist/ox-input-animation-config.js.map +1 -0
- package/dist-client/data-grist/ox-input-animation-map.d.ts +49 -0
- package/dist-client/data-grist/ox-input-animation-map.js +231 -0
- package/dist-client/data-grist/ox-input-animation-map.js.map +1 -0
- package/dist-client/pages/board-modeller-page.d.ts +1 -2
- package/dist-client/pages/board-modeller-page.js +1 -2
- package/dist-client/pages/board-modeller-page.js.map +1 -1
- package/dist-client/pages/board-viewer-page.d.ts +1 -2
- package/dist-client/pages/board-viewer-page.js +1 -2
- package/dist-client/pages/board-viewer-page.js.map +1 -1
- package/dist-client/pages/fmb-unit-info.d.ts +1 -2
- package/dist-client/pages/fmb-unit-info.js +4 -5
- package/dist-client/pages/fmb-unit-info.js.map +1 -1
- package/dist-client/pages/theme/theme-editors.d.ts +1 -1
- package/dist-client/pages/theme/theme-list-page.d.ts +1 -2
- package/dist-client/pages/theme/theme-list-page.js +6 -7
- package/dist-client/pages/theme/theme-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReferenceMap
|
|
2
|
-
export declare function createBoardProvider(): ReferenceMap
|
|
3
|
-
export declare const provider: ReferenceMap
|
|
1
|
+
import { ReferenceMap } from '@hatiolab/things-scene';
|
|
2
|
+
export declare function createBoardProvider(): ReferenceMap;
|
|
3
|
+
export declare const provider: ReferenceMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-provider.js","sourceRoot":"","sources":["../client/board-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAS,MAAM,wBAAwB,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,UAAU,mBAAmB;IACjC,IAAI,SAAS,GAAG,IAAI,YAAY,CAC9B,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAgB,EAAE;QAC/C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAA;YAC7C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAA;YAC1E,MAAM,KAAK,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBAClD,IAAI,CAAC;oBACH,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,KAAK,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAA;gBAC5F,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAA;gBAC1C,CAAC;gBACD,OAAO,KAAK,CAAA;YACd,CAAC,EAAE,EAAE,CAAC,CAAA;YAEN,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAA;gBACvD,OAAM;YACR,CAAC;YAED,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAEnC,IAAI,KAAY,CAAA;YAEhB,IAAI,CAAC;gBACH,KAAK,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBACnC,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAA;YACzD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,KAAK,GAAG,MAAM,CAAC;oBACb,KAAK;oBACL,KAAK;oBACL,IAAI,EAAE,CAAC;oBACP,WAAW,EAAE,QAAe;oBAC5B,WAAW,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC;oBACrC,QAAQ,EAAE,CAAC,mBAAmB,EAAE,cAAc,EAAE,eAAe,CAAC;oBAChE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC;iBACrF,CAAC,CAAA;gBAEF,6BAA6B;YAC/B,CAAC;YAED,OAAO,CAAC,KAAK,CAAC,CAAA;QAChB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,KAAK,CAAC,CAAC,CAAC,CAAA;YACR,MAAM,CAAC,CAAC,CAAC,CAAA;QACX,CAAC;IACH,CAAC,EACD,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;QAChB,GAAG,CAAC,OAAO,EAAE,CAAA;IACf,CAAC,CACF,CAAA;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAA","sourcesContent":["import { create, error, ReferenceMap, Scene } from '@hatiolab/things-scene'\nimport { DataStorage } from '@fmsim/board'\nimport { fetchBoardById } from '@fmsim/api'\n\nexport function createBoardProvider()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AA;gBACvD,OAAM;YACR,CAAC;YAED,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAEnC,IAAI,KAAY,CAAA;YAEhB,IAAI,CAAC;gBACH,KAAK,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBACnC,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAA;YACzD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,KAAK,GAAG,MAAM,CAAC;oBACb,KAAK;oBACL,KAAK;oBACL,IAAI,EAAE,CAAC;oBACP,WAAW,EAAE,QAAe;oBAC5B,WAAW,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC;oBACrC,QAAQ,EAAE,CAAC,mBAAmB,EAAE,cAAc,EAAE,eAAe,CAAC;oBAChE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC;iBACrF,CAAC,CAAA;gBAEF,6BAA6B;YAC/B,CAAC;YAED,OAAO,CAAC,KAAK,CAAC,CAAA;QAChB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,KAAK,CAAC,CAAC,CAAC,CAAA;YACR,MAAM,CAAC,CAAC,CAAC,CAAA;QACX,CAAC;IACH,CAAC,EACD,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;QAChB,GAAG,CAAC,OAAO,EAAE,CAAA;IACf,CAAC,CACF,CAAA;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAA","sourcesContent":["import { create, error, ReferenceMap, Scene } from '@hatiolab/things-scene'\nimport { DataStorage } from '@fmsim/board'\nimport { fetchBoardById } from '@fmsim/api'\n\nexport function createBoardProvider() {\n var _provider = new ReferenceMap(\n async (boardId, resolve, reject): Promise<any> => {\n try {\n const fetched = await fetchBoardById(boardId)\n const { board, themes } = 'data' in fetched ? fetched.data : fetched || {}\n const style = themes?.items.reduce((style, theme) => {\n try {\n style[theme.name] = typeof theme.value == 'string' ? JSON.parse(theme.value) : theme.value\n } catch (err) {\n console.error('themes parse error', err)\n }\n return style\n }, {})\n\n if (!board) {\n reject(new Error('Failed to get the requested board.'))\n return\n }\n\n var model = JSON.parse(board.model)\n\n var scene: Scene\n\n try {\n scene = await provider.get(boardId)\n console.warn('Board fetched more than twice.', boardId)\n } catch (e) {\n scene = create({\n model,\n style,\n mode: 0,\n refProvider: provider as any,\n dataStorage: new DataStorage(boardId),\n handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler'],\n layers: [{ type: 'scroll-layer' }, { type: 'movement-layer', id: 'movement-layer' }]\n })\n\n // s.app.baseUrl = undefined;\n }\n\n resolve(scene)\n } catch (e) {\n error(e)\n reject(e)\n }\n },\n async (id, ref) => {\n ref.dispose()\n }\n )\n\n return _provider\n}\n\nexport const provider = createBoardProvider()\n"]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import './ox-input-animation-map.js';
|
|
2
|
+
import { OxGristEditor } from '@operato/data-grist';
|
|
3
|
+
export declare class AnimationMapEditor extends OxGristEditor {
|
|
4
|
+
private popup?;
|
|
3
5
|
get options(): any;
|
|
6
|
+
get editorTemplate(): import("lit-html").TemplateResult<1>;
|
|
7
|
+
_onclick(e: Event): void;
|
|
8
|
+
_onkeydown(e: KeyboardEvent): void;
|
|
9
|
+
openSelector(): Promise<void>;
|
|
4
10
|
}
|
|
@@ -1,11 +1,86 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import './ox-input-animation-map.js';
|
|
3
|
+
import { html } from 'lit';
|
|
2
4
|
import { customElement } from 'lit/decorators.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
+
import { cloneDeep } from 'lodash-es';
|
|
6
|
+
import { OxGristEditor } from '@operato/data-grist';
|
|
7
|
+
import { i18next } from '@operato/i18n';
|
|
8
|
+
import { openPopup } from '@operato/popup';
|
|
9
|
+
let AnimationMapEditor = class AnimationMapEditor extends OxGristEditor {
|
|
5
10
|
get options() {
|
|
6
11
|
var _a;
|
|
7
12
|
const overidable = ((_a = this.column.record) === null || _a === void 0 ? void 0 : _a.options) || {};
|
|
8
|
-
return Object.assign({ name: `Animation : ${this.record.name}`,
|
|
13
|
+
return Object.assign({ name: `Animation : ${this.record.name}`, objectified: false }, overidable);
|
|
14
|
+
}
|
|
15
|
+
get editorTemplate() {
|
|
16
|
+
const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value;
|
|
17
|
+
return html `<div tabindex="0">${value || ''}</div>`;
|
|
18
|
+
}
|
|
19
|
+
_onclick(e) {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
this.openSelector();
|
|
22
|
+
}
|
|
23
|
+
_onkeydown(e) {
|
|
24
|
+
if (e.key === 'Enter') {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
this.openSelector();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async openSelector() {
|
|
30
|
+
if (this.popup) {
|
|
31
|
+
delete this.popup;
|
|
32
|
+
}
|
|
33
|
+
const { name, objectified = false } = this.options || {};
|
|
34
|
+
const confirmCallback = (newval) => {
|
|
35
|
+
this.dispatchEvent(new CustomEvent('field-change', {
|
|
36
|
+
bubbles: true,
|
|
37
|
+
composed: true,
|
|
38
|
+
detail: {
|
|
39
|
+
before: this.value,
|
|
40
|
+
after: !objectified ? JSON.stringify(newval) : newval,
|
|
41
|
+
record: this.record,
|
|
42
|
+
column: this.column,
|
|
43
|
+
row: this.row
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
let value;
|
|
48
|
+
try {
|
|
49
|
+
value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {});
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
value = {};
|
|
53
|
+
}
|
|
54
|
+
let latestValue = value;
|
|
55
|
+
const onConfirm = () => {
|
|
56
|
+
var _a;
|
|
57
|
+
confirmCallback(latestValue);
|
|
58
|
+
(_a = this.popup) === null || _a === void 0 ? void 0 : _a.close();
|
|
59
|
+
};
|
|
60
|
+
const template = html `
|
|
61
|
+
<div style="display:flex;flex-direction:column;height:100%;padding:12px;box-sizing:border-box;">
|
|
62
|
+
<ox-input-animation-map
|
|
63
|
+
.value=${value}
|
|
64
|
+
@change=${(e) => { latestValue = e.detail; }}
|
|
65
|
+
style="flex:1;overflow:auto;"
|
|
66
|
+
></ox-input-animation-map>
|
|
67
|
+
<div style="display:flex;justify-content:flex-end;gap:8px;margin-top:12px;">
|
|
68
|
+
<button @click=${onConfirm}
|
|
69
|
+
style="padding:6px 16px;background:var(--md-sys-color-primary,#1976d2);color:#fff;border:none;border-radius:4px;cursor:pointer;">
|
|
70
|
+
${i18next.t('button.confirm') || 'Confirm'}
|
|
71
|
+
</button>
|
|
72
|
+
<button @click=${() => { var _a; return (_a = this.popup) === null || _a === void 0 ? void 0 : _a.close(); }}
|
|
73
|
+
style="padding:6px 16px;background:var(--md-sys-color-surface-variant,#e0e0e0);color:#333;border:none;border-radius:4px;cursor:pointer;">
|
|
74
|
+
${i18next.t('button.cancel') || 'Cancel'}
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
79
|
+
this.popup = openPopup(template, {
|
|
80
|
+
backdrop: true,
|
|
81
|
+
size: 'large',
|
|
82
|
+
title: `${(name === null || name === void 0 ? void 0 : name.toUpperCase()) || 'ANIMATION MAP'}`
|
|
83
|
+
});
|
|
9
84
|
}
|
|
10
85
|
};
|
|
11
86
|
AnimationMapEditor = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-map-editor.js","sourceRoot":"","sources":["../../client/data-grist/animation-map-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"animation-map-editor.js","sourceRoot":"","sources":["../../client/data-grist/animation-map-editor.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAA;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAe,MAAM,gBAAgB,CAAA;AAGhD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,aAAa;IAGnD,IAAI,OAAO;;QACT,MAAM,UAAU,GAAG,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,MAAM,0CAAE,OAAO,KAAI,EAAE,CAAA;QAEpD,uBACE,IAAI,EAAE,eAAe,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EACvC,WAAW,EAAE,KAAK,IACf,UAAU,EACd;IACH,CAAC;IAED,IAAI,cAAc;QAChB,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACtF,OAAO,IAAI,CAAA,qBAAqB,KAAK,IAAI,EAAE,QAAQ,CAAA;IACrD,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;IAED,UAAU,CAAC,CAAgB;QACzB,IAAI,CAAC,CAAC,GAAG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,WAAW,CAAC,CAAA;YAC5B,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,EAAE,CAAA;QACrB,CAAC,CAAA;QAED,MAAM,QAAQ,GAAG,IAAI,CAAA;;;mBAGN,KAAK;oBACJ,CAAC,CAAc,EAAE,EAAE,GAAG,WAAW,GAAG,CAAC,CAAC,MAAM,CAAA,CAAC,CAAC;;;;2BAIvC,SAAS;;cAEtB,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,SAAS;;2BAE3B,GAAG,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,EAAE,CAAA,EAAA;;cAEtC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,QAAQ;;;;KAI/C,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,KAAI,eAAe,EAAE;SACnD,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA7FY,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA6F9B","sourcesContent":["import './ox-input-animation-map.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { cloneDeep } from 'lodash-es'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup, PopupHandle } from '@operato/popup'\n\n@customElement('animation-map-editor')\nexport class AnimationMapEditor extends OxGristEditor {\n private popup?: PopupHandle\n\n get options() {\n const overidable = this.column.record?.options || {}\n\n return {\n name: `Animation : ${this.record.name}`,\n objectified: false,\n ...overidable\n }\n }\n\n get editorTemplate() {\n const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value\n return html`<div tabindex=\"0\">${value || ''}</div>`\n }\n\n _onclick(e: Event): void {\n e.stopPropagation()\n this.openSelector()\n }\n\n _onkeydown(e: KeyboardEvent): void {\n if (e.key === 'Enter') {\n e.stopPropagation()\n this.openSelector()\n }\n }\n\n async openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const { name, objectified = false } = this.options || {}\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: !objectified ? JSON.stringify(newval) : newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n let value: any\n try {\n value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})\n } catch (e) {\n value = {}\n }\n\n let latestValue = value\n\n const onConfirm = () => {\n confirmCallback(latestValue)\n this.popup?.close()\n }\n\n const template = html`\n <div style=\"display:flex;flex-direction:column;height:100%;padding:12px;box-sizing:border-box;\">\n <ox-input-animation-map\n .value=${value}\n @change=${(e: CustomEvent) => { latestValue = e.detail }}\n style=\"flex:1;overflow:auto;\"\n ></ox-input-animation-map>\n <div style=\"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;\">\n <button @click=${onConfirm}\n style=\"padding:6px 16px;background:var(--md-sys-color-primary,#1976d2);color:#fff;border:none;border-radius:4px;cursor:pointer;\">\n ${i18next.t('button.confirm') || 'Confirm'}\n </button>\n <button @click=${() => this.popup?.close()}\n style=\"padding:6px 16px;background:var(--md-sys-color-surface-variant,#e0e0e0);color:#333;border:none;border-radius:4px;cursor:pointer;\">\n ${i18next.t('button.cancel') || 'Cancel'}\n </button>\n </div>\n </div>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${name?.toUpperCase() || 'ANIMATION MAP'}`\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 단일 애니메이션 설정 폼 컴포넌트
|
|
3
|
+
*
|
|
4
|
+
* AnimationConfig 객체 하나를 폼으로 편집한다.
|
|
5
|
+
* type 선택에 따라 관련 필드만 표시된다.
|
|
6
|
+
*/
|
|
7
|
+
import { LitElement } from 'lit';
|
|
8
|
+
type AnimationConfig = {
|
|
9
|
+
type?: string;
|
|
10
|
+
delay?: number;
|
|
11
|
+
duration?: number;
|
|
12
|
+
interval?: number;
|
|
13
|
+
theta?: number;
|
|
14
|
+
scale?: number;
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
startAlpha?: number;
|
|
18
|
+
endAlpha?: number;
|
|
19
|
+
repeat?: boolean;
|
|
20
|
+
autoplay?: boolean;
|
|
21
|
+
delta?: string;
|
|
22
|
+
ease?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare class OxInputAnimationConfig extends LitElement {
|
|
25
|
+
static styles: import("lit").CSSResult;
|
|
26
|
+
value: AnimationConfig;
|
|
27
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
28
|
+
firstUpdated(): void;
|
|
29
|
+
private _onChange;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 단일 애니메이션 설정 폼 컴포넌트
|
|
3
|
+
*
|
|
4
|
+
* AnimationConfig 객체 하나를 폼으로 편집한다.
|
|
5
|
+
* type 선택에 따라 관련 필드만 표시된다.
|
|
6
|
+
*/
|
|
7
|
+
import { __decorate, __metadata } from "tslib";
|
|
8
|
+
import { css, html, LitElement } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
let OxInputAnimationConfig = class OxInputAnimationConfig extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.value = {};
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
17
|
+
const v = this.value || {};
|
|
18
|
+
return html `
|
|
19
|
+
<div class="form">
|
|
20
|
+
<label>Type</label>
|
|
21
|
+
<select value-key="type" .value=${v.type || ''}>
|
|
22
|
+
<option value="">None</option>
|
|
23
|
+
<option value="rotation">Rotation</option>
|
|
24
|
+
<option value="vibration">Vibration</option>
|
|
25
|
+
<option value="heartbeat">Heartbeat</option>
|
|
26
|
+
<option value="moving">Moving</option>
|
|
27
|
+
<option value="fade">Fade</option>
|
|
28
|
+
</select>
|
|
29
|
+
|
|
30
|
+
<label>Delay</label>
|
|
31
|
+
<input type="number" value-key="delay" .value=${String((_a = v.delay) !== null && _a !== void 0 ? _a : '')} placeholder="ms" />
|
|
32
|
+
|
|
33
|
+
<label>Duration</label>
|
|
34
|
+
<input type="number" value-key="duration" .value=${String((_b = v.duration) !== null && _b !== void 0 ? _b : '')} placeholder="ms" />
|
|
35
|
+
|
|
36
|
+
<label>Interval</label>
|
|
37
|
+
<input type="number" value-key="interval" .value=${String((_c = v.interval) !== null && _c !== void 0 ? _c : '')} placeholder="ms" />
|
|
38
|
+
|
|
39
|
+
${v.type === 'rotation' || v.type === 'vibration'
|
|
40
|
+
? html `
|
|
41
|
+
<label>Theta</label>
|
|
42
|
+
<input type="number" value-key="theta" .value=${String((_d = v.theta) !== null && _d !== void 0 ? _d : '')} />
|
|
43
|
+
`
|
|
44
|
+
: ''}
|
|
45
|
+
${v.type === 'heartbeat'
|
|
46
|
+
? html `
|
|
47
|
+
<label>Scale</label>
|
|
48
|
+
<input type="number" value-key="scale" .value=${String((_e = v.scale) !== null && _e !== void 0 ? _e : '')} />
|
|
49
|
+
`
|
|
50
|
+
: ''}
|
|
51
|
+
${v.type === 'moving'
|
|
52
|
+
? html `
|
|
53
|
+
<label>X</label>
|
|
54
|
+
<input type="number" value-key="x" .value=${String((_f = v.x) !== null && _f !== void 0 ? _f : '')} />
|
|
55
|
+
<label>Y</label>
|
|
56
|
+
<input type="number" value-key="y" .value=${String((_g = v.y) !== null && _g !== void 0 ? _g : '')} />
|
|
57
|
+
`
|
|
58
|
+
: ''}
|
|
59
|
+
${v.type === 'fade'
|
|
60
|
+
? html `
|
|
61
|
+
<label>Start α</label>
|
|
62
|
+
<input type="number" value-key="startAlpha" .value=${String((_h = v.startAlpha) !== null && _h !== void 0 ? _h : '')} />
|
|
63
|
+
<label>End α</label>
|
|
64
|
+
<input type="number" value-key="endAlpha" .value=${String((_j = v.endAlpha) !== null && _j !== void 0 ? _j : '')} />
|
|
65
|
+
`
|
|
66
|
+
: ''}
|
|
67
|
+
|
|
68
|
+
<label>Delta</label>
|
|
69
|
+
<select value-key="delta" .value=${v.delta || 'linear'}>
|
|
70
|
+
<option value="linear">linear</option>
|
|
71
|
+
<option value="quad">quad</option>
|
|
72
|
+
<option value="circ">circ</option>
|
|
73
|
+
<option value="back">back</option>
|
|
74
|
+
<option value="bounce">bounce</option>
|
|
75
|
+
<option value="elastic">elastic</option>
|
|
76
|
+
</select>
|
|
77
|
+
|
|
78
|
+
<label>Ease</label>
|
|
79
|
+
<select value-key="ease" .value=${v.ease || 'in'}>
|
|
80
|
+
<option value="in">in</option>
|
|
81
|
+
<option value="out">out</option>
|
|
82
|
+
<option value="inout">inout</option>
|
|
83
|
+
</select>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div class="checkbox-row">
|
|
87
|
+
<label>
|
|
88
|
+
<input type="checkbox" value-key="repeat" .checked=${!!v.repeat} />
|
|
89
|
+
Repeat
|
|
90
|
+
</label>
|
|
91
|
+
<label>
|
|
92
|
+
<input type="checkbox" value-key="autoplay" .checked=${(_k = v.autoplay) !== null && _k !== void 0 ? _k : true} />
|
|
93
|
+
Autoplay
|
|
94
|
+
</label>
|
|
95
|
+
</div>
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
firstUpdated() {
|
|
99
|
+
this.renderRoot.addEventListener('change', this._onChange.bind(this));
|
|
100
|
+
}
|
|
101
|
+
_onChange(e) {
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
const el = e.target;
|
|
104
|
+
const key = el.getAttribute('value-key');
|
|
105
|
+
if (!key)
|
|
106
|
+
return;
|
|
107
|
+
let val;
|
|
108
|
+
if (el instanceof HTMLInputElement) {
|
|
109
|
+
if (el.type === 'checkbox')
|
|
110
|
+
val = el.checked;
|
|
111
|
+
else if (el.type === 'number')
|
|
112
|
+
val = el.value ? Number(el.value) : undefined;
|
|
113
|
+
else
|
|
114
|
+
val = el.value;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
val = el.value;
|
|
118
|
+
}
|
|
119
|
+
this.value = Object.assign(Object.assign({}, this.value), { [key]: val });
|
|
120
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
OxInputAnimationConfig.styles = css `
|
|
124
|
+
:host {
|
|
125
|
+
display: block;
|
|
126
|
+
font-size: var(--fontsize-default, 12px);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.form {
|
|
130
|
+
display: grid;
|
|
131
|
+
grid-template-columns: auto 1fr;
|
|
132
|
+
gap: 2px 6px;
|
|
133
|
+
align-items: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
label {
|
|
137
|
+
font-size: 11px;
|
|
138
|
+
color: var(--md-sys-color-on-surface-variant, #555);
|
|
139
|
+
text-align: right;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
input,
|
|
144
|
+
select {
|
|
145
|
+
border: 0;
|
|
146
|
+
border-bottom: 1px solid transparent;
|
|
147
|
+
padding: 3px 4px;
|
|
148
|
+
font: var(--input-font, 12px sans-serif);
|
|
149
|
+
color: var(--md-sys-color-on-primary-container, #333);
|
|
150
|
+
background: transparent;
|
|
151
|
+
box-sizing: border-box;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
input:focus,
|
|
155
|
+
select:focus {
|
|
156
|
+
outline: none;
|
|
157
|
+
border-bottom-color: var(--md-sys-color-primary, #1976d2);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
input[type='number'] {
|
|
161
|
+
width: 80px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.checkbox-row {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
gap: 12px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.checkbox-row label {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
gap: 3px;
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
input[type='checkbox'] {
|
|
178
|
+
width: auto;
|
|
179
|
+
margin: 0;
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
__decorate([
|
|
183
|
+
property({ type: Object }),
|
|
184
|
+
__metadata("design:type", Object)
|
|
185
|
+
], OxInputAnimationConfig.prototype, "value", void 0);
|
|
186
|
+
OxInputAnimationConfig = __decorate([
|
|
187
|
+
customElement('ox-input-animation-config')
|
|
188
|
+
], OxInputAnimationConfig);
|
|
189
|
+
export { OxInputAnimationConfig };
|
|
190
|
+
//# sourceMappingURL=ox-input-animation-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-input-animation-config.js","sourceRoot":"","sources":["../../client/data-grist/ox-input-animation-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAoBpD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU;IAA/C;;QA6DuB,UAAK,GAAoB,EAAE,CAAA;IA6GzD,CAAC;IA3GC,MAAM;;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAE1B,OAAO,IAAI,CAAA;;;0CAG2B,CAAC,CAAC,IAAI,IAAI,EAAE;;;;;;;;;;wDAUE,MAAM,CAAC,MAAA,CAAC,CAA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DAA4B;AA7D5C,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA0KlC","sourcesContent":["/**\n * 단일 애니메이션 설정 폼 컴포넌트\n *\n * AnimationConfig 객체 하나를 폼으로 편집한다.\n * type 선택에 따라 관련 필드만 표시된다.\n */\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\ntype AnimationConfig = {\n type?: string\n delay?: number\n duration?: number\n interval?: number\n theta?: number\n scale?: number\n x?: number\n y?: number\n startAlpha?: number\n endAlpha?: number\n repeat?: boolean\n autoplay?: boolean\n delta?: string\n ease?: string\n}\n\n@customElement('ox-input-animation-config')\nexport class OxInputAnimationConfig extends LitElement {\n static styles = css`\n :host {\n display: block;\n font-size: var(--fontsize-default, 12px);\n }\n\n .form {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 2px 6px;\n align-items: center;\n }\n\n label {\n font-size: 11px;\n color: var(--md-sys-color-on-surface-variant, #555);\n text-align: right;\n white-space: nowrap;\n }\n\n input,\n select {\n border: 0;\n border-bottom: 1px solid transparent;\n padding: 3px 4px;\n font: var(--input-font, 12px sans-serif);\n color: var(--md-sys-color-on-primary-container, #333);\n background: transparent;\n box-sizing: border-box;\n }\n\n input:focus,\n select:focus {\n outline: none;\n border-bottom-color: var(--md-sys-color-primary, #1976d2);\n }\n\n input[type='number'] {\n width: 80px;\n }\n\n .checkbox-row {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .checkbox-row label {\n display: flex;\n align-items: center;\n gap: 3px;\n cursor: pointer;\n }\n\n input[type='checkbox'] {\n width: auto;\n margin: 0;\n }\n `\n\n @property({ type: Object }) value: AnimationConfig = {}\n\n render() {\n const v = this.value || {}\n\n return html`\n <div class=\"form\">\n <label>Type</label>\n <select value-key=\"type\" .value=${v.type || ''}>\n <option value=\"\">None</option>\n <option value=\"rotation\">Rotation</option>\n <option value=\"vibration\">Vibration</option>\n <option value=\"heartbeat\">Heartbeat</option>\n <option value=\"moving\">Moving</option>\n <option value=\"fade\">Fade</option>\n </select>\n\n <label>Delay</label>\n <input type=\"number\" value-key=\"delay\" .value=${String(v.delay ?? '')} placeholder=\"ms\" />\n\n <label>Duration</label>\n <input type=\"number\" value-key=\"duration\" .value=${String(v.duration ?? '')} placeholder=\"ms\" />\n\n <label>Interval</label>\n <input type=\"number\" value-key=\"interval\" .value=${String(v.interval ?? '')} placeholder=\"ms\" />\n\n ${v.type === 'rotation' || v.type === 'vibration'\n ? html`\n <label>Theta</label>\n <input type=\"number\" value-key=\"theta\" .value=${String(v.theta ?? '')} />\n `\n : ''}\n ${v.type === 'heartbeat'\n ? html`\n <label>Scale</label>\n <input type=\"number\" value-key=\"scale\" .value=${String(v.scale ?? '')} />\n `\n : ''}\n ${v.type === 'moving'\n ? html`\n <label>X</label>\n <input type=\"number\" value-key=\"x\" .value=${String(v.x ?? '')} />\n <label>Y</label>\n <input type=\"number\" value-key=\"y\" .value=${String(v.y ?? '')} />\n `\n : ''}\n ${v.type === 'fade'\n ? html`\n <label>Start α</label>\n <input type=\"number\" value-key=\"startAlpha\" .value=${String(v.startAlpha ?? '')} />\n <label>End α</label>\n <input type=\"number\" value-key=\"endAlpha\" .value=${String(v.endAlpha ?? '')} />\n `\n : ''}\n\n <label>Delta</label>\n <select value-key=\"delta\" .value=${v.delta || 'linear'}>\n <option value=\"linear\">linear</option>\n <option value=\"quad\">quad</option>\n <option value=\"circ\">circ</option>\n <option value=\"back\">back</option>\n <option value=\"bounce\">bounce</option>\n <option value=\"elastic\">elastic</option>\n </select>\n\n <label>Ease</label>\n <select value-key=\"ease\" .value=${v.ease || 'in'}>\n <option value=\"in\">in</option>\n <option value=\"out\">out</option>\n <option value=\"inout\">inout</option>\n </select>\n </div>\n\n <div class=\"checkbox-row\">\n <label>\n <input type=\"checkbox\" value-key=\"repeat\" .checked=${!!v.repeat} />\n Repeat\n </label>\n <label>\n <input type=\"checkbox\" value-key=\"autoplay\" .checked=${v.autoplay ?? true} />\n Autoplay\n </label>\n </div>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n private _onChange(e: Event) {\n e.stopPropagation()\n\n const el = e.target as HTMLElement\n const key = el.getAttribute('value-key')\n if (!key) return\n\n let val: any\n if (el instanceof HTMLInputElement) {\n if (el.type === 'checkbox') val = el.checked\n else if (el.type === 'number') val = el.value ? Number(el.value) : undefined\n else val = el.value\n } else {\n val = (el as HTMLSelectElement).value\n }\n\n this.value = { ...this.value, [key]: val }\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Map 에디터
|
|
3
|
+
*
|
|
4
|
+
* key-value 맵에서 value가 애니메이션 설정 객체인 경우를 위한 편집기.
|
|
5
|
+
* 각 행은 key 입력 + ox-input-animation-config 폼으로 구성된다.
|
|
6
|
+
*
|
|
7
|
+
* value 구조:
|
|
8
|
+
* {
|
|
9
|
+
* "1001": { type: "rotation", duration: 1000, delay: 0, theta: 360, repeat: true, delta: "linear", ease: "in" },
|
|
10
|
+
* "1007": { type: "vibration", duration: 500, ... },
|
|
11
|
+
* "default": ""
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
import '@material/web/icon/icon.js';
|
|
15
|
+
import './ox-input-animation-config.js';
|
|
16
|
+
import { LitElement } from 'lit';
|
|
17
|
+
type AnimationConfig = {
|
|
18
|
+
type?: string;
|
|
19
|
+
delay?: number;
|
|
20
|
+
duration?: number;
|
|
21
|
+
interval?: number;
|
|
22
|
+
theta?: number;
|
|
23
|
+
scale?: number;
|
|
24
|
+
x?: number;
|
|
25
|
+
y?: number;
|
|
26
|
+
startAlpha?: number;
|
|
27
|
+
endAlpha?: number;
|
|
28
|
+
repeat?: boolean;
|
|
29
|
+
autoplay?: boolean;
|
|
30
|
+
delta?: string;
|
|
31
|
+
ease?: string;
|
|
32
|
+
};
|
|
33
|
+
type AnimationMap = {
|
|
34
|
+
default?: any;
|
|
35
|
+
[key: string]: AnimationConfig | any;
|
|
36
|
+
};
|
|
37
|
+
export declare class OxInputAnimationMap extends LitElement {
|
|
38
|
+
static styles: import("lit").CSSResult;
|
|
39
|
+
value: AnimationMap;
|
|
40
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
41
|
+
private _onConfigChange;
|
|
42
|
+
private _onNewKeyChange;
|
|
43
|
+
firstUpdated(): void;
|
|
44
|
+
private _build;
|
|
45
|
+
private _add;
|
|
46
|
+
private _delete;
|
|
47
|
+
private _toArray;
|
|
48
|
+
}
|
|
49
|
+
export {};
|