@operato/scene-visualizer 10.0.0-beta.10 → 10.0.0-beta.14

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.
@@ -1,112 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- *
4
- * Stocker Port Configuration Editor
5
- *
6
- * 주의: OxPropertyEditor base class가 모든 change 이벤트를 잡아서
7
- * this.value를 덮어쓰므로, 내부 input/select의 change 이벤트 버블링을 차단해야 함.
8
- */
9
- import { __decorate } from "tslib";
10
- import { css, html } from 'lit';
11
- import { customElement } from 'lit/decorators.js';
12
- import { OxPropertyEditor } from '@operato/property-editor';
13
- function parsePorts(value) {
14
- if (!value)
15
- return [];
16
- if (Array.isArray(value))
17
- return value;
18
- if (typeof value === 'string') {
19
- try {
20
- const parsed = JSON.parse(value);
21
- return Array.isArray(parsed) ? parsed : [];
22
- }
23
- catch {
24
- return [];
25
- }
26
- }
27
- return [];
28
- }
29
- let StockerPortsEditor = class StockerPortsEditor extends OxPropertyEditor {
30
- static styles = [
31
- ...OxPropertyEditor.styles,
32
- css `
33
- .port-table { width: 100%; font-size: 11px; border-collapse: collapse; }
34
- .port-table th { text-align: left; padding: 3px 4px; font-weight: 600; color: #555; border-bottom: 1px solid rgba(0,0,0,0.12); font-size: 10px; }
35
- .port-table td { padding: 2px 3px; vertical-align: middle; }
36
- .port-table select, .port-table input {
37
- width: 100%; box-sizing: border-box; font-size: 11px; padding: 3px 4px;
38
- border: 1px solid rgba(0,0,0,0.15); border-radius: 4px; background: #fff; color: #1c1b1f;
39
- }
40
- .port-table input[type="number"] { width: 50px; }
41
- .port-table input[type="text"] { width: 60px; }
42
- .btn-row { display: flex; gap: 4px; margin-top: 4px; }
43
- .btn {
44
- padding: 3px 8px; font-size: 10px; cursor: pointer;
45
- border: 1px solid rgba(0,0,0,0.15); border-radius: 4px; background: #f3edf7; color: #1c1b1f;
46
- }
47
- .btn:hover { background: #ece6f0; }
48
- .btn-remove { color: #b3261e; cursor: pointer; font-size: 14px; padding: 0 4px; background: none; border: none; }
49
- `
50
- ];
51
- editorTemplate(value, _spec) {
52
- const ports = Array.isArray(this.value) ? this.value : parsePorts(value);
53
- return html `
54
- <fieldset fullwidth>
55
- ${ports.length > 0 ? html `
56
- <table class="port-table">
57
- <thead><tr><th>Type</th><th>Side</th><th>Pos</th><th>Label</th><th></th></tr></thead>
58
- <tbody>
59
- ${ports.map((port, i) => html `
60
- <tr>
61
- <td><select @change=${(e) => { e.stopPropagation(); this._set(ports, i, 'type', e.target.value); }}>
62
- <option value="in" ?selected=${port.type === 'in'}>IN</option>
63
- <option value="out" ?selected=${port.type === 'out'}>OUT</option>
64
- </select></td>
65
- <td><select @change=${(e) => { e.stopPropagation(); this._set(ports, i, 'side', e.target.value); }}>
66
- <option value="front" ?selected=${port.side === 'front'}>Front</option>
67
- <option value="back" ?selected=${port.side === 'back'}>Back</option>
68
- </select></td>
69
- <td><input type="number" .value=${String(port.position)} min="1" step="1"
70
- @change=${(e) => { e.stopPropagation(); this._set(ports, i, 'position', Number(e.target.value)); }} /></td>
71
- <td><input type="text" .value=${port.label || ''} placeholder="auto"
72
- @change=${(e) => { e.stopPropagation(); this._set(ports, i, 'label', e.target.value || undefined); }} /></td>
73
- <td><button class="btn-remove" @click=${() => this._applyPorts(ports.filter((_, j) => j !== i))}>&times;</button></td>
74
- </tr>
75
- `)}
76
- </tbody>
77
- </table>
78
- ` : html `<div style="font-size:11px;color:#888;padding:4px">No ports</div>`}
79
- <div class="btn-row">
80
- <button class="btn" @click=${() => {
81
- const maxPos = ports.length > 0 ? Math.max(...ports.map(p => p.position)) : 0;
82
- this._applyPorts([...ports, { type: 'in', side: 'front', position: maxPos + 1 }]);
83
- }}>+ IN</button>
84
- <button class="btn" @click=${() => {
85
- const maxPos = ports.length > 0 ? Math.max(...ports.map(p => p.position)) : 0;
86
- this._applyPorts([...ports, { type: 'out', side: 'front', position: maxPos + 1 }]);
87
- }}>+ OUT</button>
88
- </div>
89
- </fieldset>
90
- `;
91
- }
92
- _set(ports, index, field, val) {
93
- this._applyPorts(ports.map((p, i) => i === index ? { ...p, [field]: val } : p));
94
- }
95
- _applyPorts(ports) {
96
- this.value = ports;
97
- this.requestUpdate();
98
- this.dispatchEvent(new CustomEvent('i-need-selected', {
99
- bubbles: true, composed: true,
100
- detail: {
101
- callback: (selected) => {
102
- selected[0]?.set('ports', JSON.stringify(ports));
103
- }
104
- }
105
- }));
106
- }
107
- };
108
- StockerPortsEditor = __decorate([
109
- customElement('property-editor-stocker-ports')
110
- ], StockerPortsEditor);
111
- export default StockerPortsEditor;
112
- //# sourceMappingURL=property-editor-stocker-ports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"property-editor-stocker-ports.js","sourceRoot":"","sources":["../../src/editors/property-editor-stocker-ports.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAA;AASzE,SAAS,UAAU,CAAC,KAAU;IAC5B,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAChC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QAC5C,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,EAAE,CAAA;QAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAGc,IAAM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G,KAAK,EAAE,EAAE,IAAI,EAAE,KAAc,EAAE,IAAI,EAAE,OAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;QACtG,CAAC;;;KAGN,CAAA;IACH,CAAC;IAEO,IAAI,CAAC,KAAkB,EAAE,KAAa,EAAE,KAAa,EAAE,GAAQ;QACrE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjF,CAAC;IAEO,WAAW,CAAC,KAAkB;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,aAAa,EAAE,CAAA;QAEpB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI;YAC7B,MAAM,EAAE;gBACN,QAAQ,EAAE,CAAC,QAAe,EAAE,EAAE;oBAC5B,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;gBAClD,CAAC;aACF;SACF,CAAC,CAAC,CAAA;IACL,CAAC;;AAlFkB,kBAAkB;IADtC,aAAa,CAAC,+BAA+B,CAAC;GAC1B,kBAAkB,CAmFtC;eAnFoB,kBAAkB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Stocker Port Configuration Editor\n *\n * 주의: OxPropertyEditor base class가 모든 change 이벤트를 잡아서\n * this.value를 덮어쓰므로, 내부 input/select의 change 이벤트 버블링을 차단해야 함.\n */\n\nimport { css, html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { OxPropertyEditor, PropertySpec } from '@operato/property-editor'\n\ninterface PortEntry {\n type: 'in' | 'out'\n side: 'front' | 'back'\n position: number\n label?: string\n}\n\nfunction parsePorts(value: any): PortEntry[] {\n if (!value) return []\n if (Array.isArray(value)) return value\n if (typeof value === 'string') {\n try {\n const parsed = JSON.parse(value)\n return Array.isArray(parsed) ? parsed : []\n } catch { return [] }\n }\n return []\n}\n\n@customElement('property-editor-stocker-ports')\nexport default class StockerPortsEditor extends OxPropertyEditor {\n static styles = [\n ...OxPropertyEditor.styles,\n css`\n .port-table { width: 100%; font-size: 11px; border-collapse: collapse; }\n .port-table th { text-align: left; padding: 3px 4px; font-weight: 600; color: #555; border-bottom: 1px solid rgba(0,0,0,0.12); font-size: 10px; }\n .port-table td { padding: 2px 3px; vertical-align: middle; }\n .port-table select, .port-table input {\n width: 100%; box-sizing: border-box; font-size: 11px; padding: 3px 4px;\n border: 1px solid rgba(0,0,0,0.15); border-radius: 4px; background: #fff; color: #1c1b1f;\n }\n .port-table input[type=\"number\"] { width: 50px; }\n .port-table input[type=\"text\"] { width: 60px; }\n .btn-row { display: flex; gap: 4px; margin-top: 4px; }\n .btn {\n padding: 3px 8px; font-size: 10px; cursor: pointer;\n border: 1px solid rgba(0,0,0,0.15); border-radius: 4px; background: #f3edf7; color: #1c1b1f;\n }\n .btn:hover { background: #ece6f0; }\n .btn-remove { color: #b3261e; cursor: pointer; font-size: 14px; padding: 0 4px; background: none; border: none; }\n `\n ]\n\n editorTemplate(value: any, _spec: PropertySpec): TemplateResult {\n const ports: PortEntry[] = Array.isArray(this.value) ? this.value : parsePorts(value)\n\n return html`\n <fieldset fullwidth>\n ${ports.length > 0 ? html`\n <table class=\"port-table\">\n <thead><tr><th>Type</th><th>Side</th><th>Pos</th><th>Label</th><th></th></tr></thead>\n <tbody>\n ${ports.map((port, i) => html`\n <tr>\n <td><select @change=${(e: Event) => { e.stopPropagation(); this._set(ports, i, 'type', (e.target as HTMLSelectElement).value) }}>\n <option value=\"in\" ?selected=${port.type === 'in'}>IN</option>\n <option value=\"out\" ?selected=${port.type === 'out'}>OUT</option>\n </select></td>\n <td><select @change=${(e: Event) => { e.stopPropagation(); this._set(ports, i, 'side', (e.target as HTMLSelectElement).value) }}>\n <option value=\"front\" ?selected=${port.side === 'front'}>Front</option>\n <option value=\"back\" ?selected=${port.side === 'back'}>Back</option>\n </select></td>\n <td><input type=\"number\" .value=${String(port.position)} min=\"1\" step=\"1\"\n @change=${(e: Event) => { e.stopPropagation(); this._set(ports, i, 'position', Number((e.target as HTMLInputElement).value)) }} /></td>\n <td><input type=\"text\" .value=${port.label || ''} placeholder=\"auto\"\n @change=${(e: Event) => { e.stopPropagation(); this._set(ports, i, 'label', (e.target as HTMLInputElement).value || undefined) }} /></td>\n <td><button class=\"btn-remove\" @click=${() => this._applyPorts(ports.filter((_, j) => j !== i))}>&times;</button></td>\n </tr>\n `)}\n </tbody>\n </table>\n ` : html`<div style=\"font-size:11px;color:#888;padding:4px\">No ports</div>`}\n <div class=\"btn-row\">\n <button class=\"btn\" @click=${() => {\n const maxPos = ports.length > 0 ? Math.max(...ports.map(p => p.position)) : 0\n this._applyPorts([...ports, { type: 'in' as const, side: 'front' as const, position: maxPos + 1 }])\n }}>+ IN</button>\n <button class=\"btn\" @click=${() => {\n const maxPos = ports.length > 0 ? Math.max(...ports.map(p => p.position)) : 0\n this._applyPorts([...ports, { type: 'out' as const, side: 'front' as const, position: maxPos + 1 }])\n }}>+ OUT</button>\n </div>\n </fieldset>\n `\n }\n\n private _set(ports: PortEntry[], index: number, field: string, val: any) {\n this._applyPorts(ports.map((p, i) => i === index ? { ...p, [field]: val } : p))\n }\n\n private _applyPorts(ports: PortEntry[]) {\n this.value = ports\n this.requestUpdate()\n\n this.dispatchEvent(new CustomEvent('i-need-selected', {\n bubbles: true, composed: true,\n detail: {\n callback: (selected: any[]) => {\n selected[0]?.set('ports', JSON.stringify(ports))\n }\n }\n }))\n }\n}\n"]}