@operato/property-panel 9.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.
- package/.editorconfig +29 -0
- package/.storybook/main.js +5 -0
- package/.storybook/preview.js +52 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/demo/index.html +30 -0
- package/dist/src/graphql/board.d.ts +6 -0
- package/dist/src/graphql/board.js +130 -0
- package/dist/src/graphql/board.js.map +1 -0
- package/dist/src/graphql/data-subscription.d.ts +5 -0
- package/dist/src/graphql/data-subscription.js +24 -0
- package/dist/src/graphql/data-subscription.js.map +1 -0
- package/dist/src/graphql/favorite-board.d.ts +1 -0
- package/dist/src/graphql/favorite-board.js +23 -0
- package/dist/src/graphql/favorite-board.js.map +1 -0
- package/dist/src/graphql/group.d.ts +7 -0
- package/dist/src/graphql/group.js +125 -0
- package/dist/src/graphql/group.js.map +1 -0
- package/dist/src/graphql/index.d.ts +4 -0
- package/dist/src/graphql/index.js +5 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/graphql/play-group.d.ts +13 -0
- package/dist/src/graphql/play-group.js +205 -0
- package/dist/src/graphql/play-group.js.map +1 -0
- package/dist/src/graphql/scenario.d.ts +6 -0
- package/dist/src/graphql/scenario.js +69 -0
- package/dist/src/graphql/scenario.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ox-property-panel.d.ts +46 -0
- package/dist/src/ox-property-panel.js +346 -0
- package/dist/src/ox-property-panel.js.map +1 -0
- package/dist/src/property-panel/abstract-property.d.ts +10 -0
- package/dist/src/property-panel/abstract-property.js +53 -0
- package/dist/src/property-panel/abstract-property.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding-mapper.d.ts +58 -0
- package/dist/src/property-panel/data-binding/data-binding-mapper.js +380 -0
- package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding-value-map.d.ts +6 -0
- package/dist/src/property-panel/data-binding/data-binding-value-map.js +20 -0
- package/dist/src/property-panel/data-binding/data-binding-value-map.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding-value-range.d.ts +6 -0
- package/dist/src/property-panel/data-binding/data-binding-value-range.js +20 -0
- package/dist/src/property-panel/data-binding/data-binding-value-range.js.map +1 -0
- package/dist/src/property-panel/data-binding/data-binding.d.ts +44 -0
- package/dist/src/property-panel/data-binding/data-binding.js +442 -0
- package/dist/src/property-panel/data-binding/data-binding.js.map +1 -0
- package/dist/src/property-panel/effects/effects.d.ts +24 -0
- package/dist/src/property-panel/effects/effects.js +72 -0
- package/dist/src/property-panel/effects/effects.js.map +1 -0
- package/dist/src/property-panel/effects/property-animation.d.ts +23 -0
- package/dist/src/property-panel/effects/property-animation.js +147 -0
- package/dist/src/property-panel/effects/property-animation.js.map +1 -0
- package/dist/src/property-panel/effects/property-animations.d.ts +22 -0
- package/dist/src/property-panel/effects/property-animations.js +70 -0
- package/dist/src/property-panel/effects/property-animations.js.map +1 -0
- package/dist/src/property-panel/effects/property-event-hover.d.ts +21 -0
- package/dist/src/property-panel/effects/property-event-hover.js +193 -0
- package/dist/src/property-panel/effects/property-event-hover.js.map +1 -0
- package/dist/src/property-panel/effects/property-event-tap.d.ts +36 -0
- package/dist/src/property-panel/effects/property-event-tap.js +262 -0
- package/dist/src/property-panel/effects/property-event-tap.js.map +1 -0
- package/dist/src/property-panel/effects/property-event.d.ts +22 -0
- package/dist/src/property-panel/effects/property-event.js +64 -0
- package/dist/src/property-panel/effects/property-event.js.map +1 -0
- package/dist/src/property-panel/effects/property-shadow.d.ts +23 -0
- package/dist/src/property-panel/effects/property-shadow.js +66 -0
- package/dist/src/property-panel/effects/property-shadow.js.map +1 -0
- package/dist/src/property-panel/effects/value-converter.d.ts +1 -0
- package/dist/src/property-panel/effects/value-converter.js +17 -0
- package/dist/src/property-panel/effects/value-converter.js.map +1 -0
- package/dist/src/property-panel/inspector/inspector.d.ts +27 -0
- package/dist/src/property-panel/inspector/inspector.js +357 -0
- package/dist/src/property-panel/inspector/inspector.js.map +1 -0
- package/dist/src/property-panel/shapes/shapes.d.ts +26 -0
- package/dist/src/property-panel/shapes/shapes.js +312 -0
- package/dist/src/property-panel/shapes/shapes.js.map +1 -0
- package/dist/src/property-panel/specifics/specific-properties-builder.d.ts +16 -0
- package/dist/src/property-panel/specifics/specific-properties-builder.js +138 -0
- package/dist/src/property-panel/specifics/specific-properties-builder.js.map +1 -0
- package/dist/src/property-panel/specifics/specifics.d.ts +25 -0
- package/dist/src/property-panel/specifics/specifics.js +84 -0
- package/dist/src/property-panel/specifics/specifics.js.map +1 -0
- package/dist/src/property-panel/styles/styles.d.ts +23 -0
- package/dist/src/property-panel/styles/styles.js +269 -0
- package/dist/src/property-panel/styles/styles.js.map +1 -0
- package/dist/src/types.d.ts +43 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/stories/index.stories.d.ts +22 -0
- package/dist/stories/index.stories.js +121 -0
- package/dist/stories/index.stories.js.map +1 -0
- package/dist/stories/input-table-property.stories.d.ts +21 -0
- package/dist/stories/input-table-property.stories.js +84 -0
- package/dist/stories/input-table-property.stories.js.map +1 -0
- package/dist/test/ox-property-panel.test.d.ts +1 -0
- package/dist/test/ox-property-panel.test.js +24 -0
- package/dist/test/ox-property-panel.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +108 -0
- package/src/graphql/board.ts +144 -0
- package/src/graphql/data-subscription.ts +30 -0
- package/src/graphql/favorite-board.ts +25 -0
- package/src/graphql/group.ts +138 -0
- package/src/graphql/index.ts +4 -0
- package/src/graphql/play-group.ts +225 -0
- package/src/graphql/scenario.ts +79 -0
- package/src/index.ts +8 -0
- package/src/ox-property-panel.ts +347 -0
- package/src/property-panel/abstract-property.ts +67 -0
- package/src/property-panel/data-binding/data-binding-mapper.ts +412 -0
- package/src/property-panel/data-binding/data-binding-value-map.ts +19 -0
- package/src/property-panel/data-binding/data-binding-value-range.ts +19 -0
- package/src/property-panel/data-binding/data-binding.ts +464 -0
- package/src/property-panel/effects/effects.ts +77 -0
- package/src/property-panel/effects/property-animation.ts +155 -0
- package/src/property-panel/effects/property-animations.ts +74 -0
- package/src/property-panel/effects/property-event-hover.ts +212 -0
- package/src/property-panel/effects/property-event-tap.ts +269 -0
- package/src/property-panel/effects/property-event.ts +73 -0
- package/src/property-panel/effects/property-shadow.ts +77 -0
- package/src/property-panel/effects/value-converter.ts +17 -0
- package/src/property-panel/inspector/inspector.ts +407 -0
- package/src/property-panel/shapes/shapes.ts +321 -0
- package/src/property-panel/specifics/specific-properties-builder.ts +152 -0
- package/src/property-panel/specifics/specifics.ts +81 -0
- package/src/property-panel/styles/styles.ts +287 -0
- package/src/types.ts +63 -0
- package/stories/index.stories.ts +134 -0
- package/stories/input-table-property.stories.ts +96 -0
- package/test/ox-property-panel.test.ts +32 -0
- package/themes/app-theme.css +138 -0
- package/themes/calendar-theme.css +61 -0
- package/themes/dark.css +51 -0
- package/themes/grist-theme.css +175 -0
- package/themes/help-theme.css +57 -0
- package/themes/layout-theme.css +94 -0
- package/themes/light.css +51 -0
- package/themes/material-theme.css +23 -0
- package/themes/md-typescale-styles.css +100 -0
- package/themes/oops-theme.css +22 -0
- package/themes/report-theme.css +47 -0
- package/themes/spacing.css +23 -0
- package/themes/state-color.css +6 -0
- package/themes/tooltip-theme.css +11 -0
- package/translations/en.json +723 -0
- package/translations/ja.json +727 -0
- package/translations/ko.json +727 -0
- package/translations/ms.json +609 -0
- package/translations/zh.json +726 -0
- package/tsconfig.json +25 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/input/ox-input-search.js';
|
|
3
|
+
import { css, html, unsafeCSS, LitElement } from 'lit';
|
|
4
|
+
import { property, state } from 'lit/decorators.js';
|
|
5
|
+
// TODO test Sortable
|
|
6
|
+
// import Sortable from 'sortablejs'
|
|
7
|
+
import { i18next } from '@operato/i18n';
|
|
8
|
+
const ICON_SHELL_INSPECTOR = new URL('../../../../icons/icon-shell-inspector.png', import.meta.url).href;
|
|
9
|
+
export class SceneInspector extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.searchText = '';
|
|
13
|
+
this.show = false;
|
|
14
|
+
this.count = -1;
|
|
15
|
+
}
|
|
16
|
+
disconnectScene(scene) {
|
|
17
|
+
if (scene) {
|
|
18
|
+
scene.off('selected', undefined, this);
|
|
19
|
+
scene.off('execute', undefined, this);
|
|
20
|
+
scene.off('undo', undefined, this);
|
|
21
|
+
scene.off('redo', undefined, this);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
super.disconnectedCallback();
|
|
26
|
+
this.disconnectScene(this.scene);
|
|
27
|
+
delete this._extendedMap;
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
this.count = 0;
|
|
31
|
+
return html `
|
|
32
|
+
<ox-input-search
|
|
33
|
+
.placeholder=${i18next.t('text.search with type, id or tag')}
|
|
34
|
+
autofocus
|
|
35
|
+
@change=${(e) => (this.searchText = (e.target.value || '').toLowerCase())}
|
|
36
|
+
></ox-input-search>
|
|
37
|
+
|
|
38
|
+
<div result>${!this.scene ? html `` : this.renderComponent(this.scene.root, 0)}</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
firstUpdated() {
|
|
42
|
+
dispatchEvent(new Event('resize'));
|
|
43
|
+
this.renderRoot.addEventListener('click', this._onclick.bind(this));
|
|
44
|
+
this.renderRoot.addEventListener('dblclick', this._ondblclick.bind(this));
|
|
45
|
+
}
|
|
46
|
+
refresh() {
|
|
47
|
+
var _a;
|
|
48
|
+
let selected = ((_a = this.scene) === null || _a === void 0 ? void 0 : _a.selected) || [];
|
|
49
|
+
selected.forEach(component => {
|
|
50
|
+
let parent = component.parent;
|
|
51
|
+
while (parent && !this.extendedMap.get(parent)) {
|
|
52
|
+
this.extendedMap.set(parent, true);
|
|
53
|
+
parent = parent.parent;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
this.requestUpdate();
|
|
57
|
+
}
|
|
58
|
+
updated(change) {
|
|
59
|
+
if (change.has('scene')) {
|
|
60
|
+
let oldScene = change.get('scene');
|
|
61
|
+
if (oldScene) {
|
|
62
|
+
this.disconnectScene(oldScene);
|
|
63
|
+
delete this._extendedMap;
|
|
64
|
+
}
|
|
65
|
+
if (this.scene && this.scene.root) {
|
|
66
|
+
this.scene.on('selected', this.refresh, this);
|
|
67
|
+
this.scene.on('execute', this.refresh, this);
|
|
68
|
+
this.scene.on('undo', this.refresh, this);
|
|
69
|
+
this.scene.on('redo', this.refresh, this);
|
|
70
|
+
this.refresh();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// TODO test Sortable
|
|
74
|
+
// this.updateComplete.then(() => {
|
|
75
|
+
// this.renderRoot.querySelectorAll('[sortable]').forEach(sortable => {
|
|
76
|
+
// new Sortable(sortable as HTMLElement, this.sortableConfig)
|
|
77
|
+
// })
|
|
78
|
+
// })
|
|
79
|
+
}
|
|
80
|
+
// TODO test Sortable
|
|
81
|
+
// sortableConfig: Sortable.Options = {
|
|
82
|
+
// group: 'inspector',
|
|
83
|
+
// animation: 150,
|
|
84
|
+
// draggable: '.component',
|
|
85
|
+
// swapThreshold: 1,
|
|
86
|
+
// onSort: this.onSort.bind(this)
|
|
87
|
+
// }
|
|
88
|
+
// TODO test Sortable
|
|
89
|
+
// onSort(e: Sortable.SortableEvent) {
|
|
90
|
+
// if (!this.scene) return
|
|
91
|
+
// var component = (e.item as HTMLElement & { component: Component }).component
|
|
92
|
+
// var to_container = (e.to as HTMLElement & { component: Component }).component as Container
|
|
93
|
+
// var to_index = e.newIndex! - 1
|
|
94
|
+
// this.scene.move(component, to_container, to_index)
|
|
95
|
+
// this.show = false
|
|
96
|
+
// this.updateComplete.then(() => {
|
|
97
|
+
// this.show = true
|
|
98
|
+
// })
|
|
99
|
+
// }
|
|
100
|
+
_onclick(e) {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
var targetElement = e.target;
|
|
103
|
+
var classList = targetElement.classList;
|
|
104
|
+
var component;
|
|
105
|
+
while (!component && targetElement) {
|
|
106
|
+
component = targetElement.component;
|
|
107
|
+
if (component)
|
|
108
|
+
break;
|
|
109
|
+
targetElement = targetElement.parentNode;
|
|
110
|
+
if (!targetElement || targetElement === this.renderRoot)
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (component) {
|
|
114
|
+
if (classList.contains('eye')) {
|
|
115
|
+
this.toggleHidden(component);
|
|
116
|
+
}
|
|
117
|
+
else if (classList.contains('extended') || classList.contains('collapsed')) {
|
|
118
|
+
this.toggleExtended(component);
|
|
119
|
+
}
|
|
120
|
+
this.selectComponent(component, e.shiftKey);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
if (classList.contains('inspector')) {
|
|
124
|
+
this.show = !this.show;
|
|
125
|
+
this.style.height = this.show ? '100%' : '';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
this.requestUpdate();
|
|
129
|
+
}
|
|
130
|
+
_ondblclick(e) {
|
|
131
|
+
e.stopPropagation();
|
|
132
|
+
var targetElement = e.target;
|
|
133
|
+
var component;
|
|
134
|
+
while (!component && targetElement) {
|
|
135
|
+
component = targetElement.component;
|
|
136
|
+
if (component)
|
|
137
|
+
break;
|
|
138
|
+
targetElement = targetElement.parentNode;
|
|
139
|
+
if (!targetElement || targetElement === this.renderRoot)
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
if (component && component.isContainer()) {
|
|
143
|
+
this.toggleExtended(component);
|
|
144
|
+
}
|
|
145
|
+
this.requestUpdate();
|
|
146
|
+
}
|
|
147
|
+
get extendedMap() {
|
|
148
|
+
if (!this._extendedMap) {
|
|
149
|
+
this._extendedMap = new WeakMap();
|
|
150
|
+
}
|
|
151
|
+
return this._extendedMap;
|
|
152
|
+
}
|
|
153
|
+
getNodeHandleClass(component) {
|
|
154
|
+
if (component.isContainer() && component.components.length > 0) {
|
|
155
|
+
return !!this.extendedMap.get(component) ? 'extended' : 'collapsed';
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
return 'collapsespace';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
isExtended(component) {
|
|
162
|
+
return !!this.extendedMap.get(component);
|
|
163
|
+
}
|
|
164
|
+
toggleExtended(component) {
|
|
165
|
+
var extended = this.isExtended(component);
|
|
166
|
+
if (extended) {
|
|
167
|
+
this.extendedMap.delete(component);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.extendedMap.set(component, !extended);
|
|
171
|
+
}
|
|
172
|
+
this.requestUpdate();
|
|
173
|
+
}
|
|
174
|
+
toggleHidden(component) {
|
|
175
|
+
component.set('hidden', !component.hidden);
|
|
176
|
+
this.requestUpdate();
|
|
177
|
+
}
|
|
178
|
+
selectComponent(component, append = false) {
|
|
179
|
+
const selected = this.scene.selected;
|
|
180
|
+
if (append) {
|
|
181
|
+
const idx = selected.findIndex(s => s === component);
|
|
182
|
+
if (idx != -1) {
|
|
183
|
+
selected.splice(idx, 1);
|
|
184
|
+
this.scene.selected = [...selected];
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.scene.selected = [...selected, component];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.scene.selected = [component];
|
|
192
|
+
}
|
|
193
|
+
component.trigger('reactionreset');
|
|
194
|
+
component.trigger('reaction');
|
|
195
|
+
this.requestUpdate();
|
|
196
|
+
}
|
|
197
|
+
shouldBeShown(component, counting = false) {
|
|
198
|
+
const { type, name, id, tag } = component.state;
|
|
199
|
+
const found = !this.searchText || `${type} ${name || ''} ${id || ''} ${tag || ''}`.toLowerCase().search(this.searchText) > -1;
|
|
200
|
+
if (counting && found) {
|
|
201
|
+
this.count++;
|
|
202
|
+
}
|
|
203
|
+
const foundChildren = (component.components || []).filter((child) => this.shouldBeShown(child, counting)).length;
|
|
204
|
+
return !!(found || foundChildren > 0);
|
|
205
|
+
}
|
|
206
|
+
renderComponent(component, depth) {
|
|
207
|
+
var _a;
|
|
208
|
+
if (!component) {
|
|
209
|
+
return html ``;
|
|
210
|
+
}
|
|
211
|
+
if (!this.shouldBeShown(component, depth == 0)) {
|
|
212
|
+
return html ``;
|
|
213
|
+
}
|
|
214
|
+
const children = (component.isContainer() && component.components) || [];
|
|
215
|
+
const extended = this.isExtended(component) ? children.filter(child => this.shouldBeShown(child)) : [];
|
|
216
|
+
const { type, id, tag, class: clazz } = component.state;
|
|
217
|
+
const name = (id ? `#${id}` : '') + (tag ? `@${tag}` : '') + (clazz ? `.(${clazz})` : '');
|
|
218
|
+
return html `
|
|
219
|
+
<div
|
|
220
|
+
class="component"
|
|
221
|
+
?selected=${(((_a = this.scene) === null || _a === void 0 ? void 0 : _a.selected) || []).indexOf(component) > -1}
|
|
222
|
+
.component=${component}
|
|
223
|
+
?sortable=${component.isContainer()}
|
|
224
|
+
>
|
|
225
|
+
<span>
|
|
226
|
+
${depth > 0
|
|
227
|
+
? html `
|
|
228
|
+
<md-icon class="eye">${component.get('hidden') ? 'visibility_off' : 'visibility'}</md-icon>
|
|
229
|
+
<pre>${' '.repeat(depth)}</pre>
|
|
230
|
+
`
|
|
231
|
+
: html ` <pre>${' '.repeat(depth + 2)}</pre> `}
|
|
232
|
+
|
|
233
|
+
<span class=${this.getNodeHandleClass(component)}> </span>
|
|
234
|
+
|
|
235
|
+
<span class="type">${depth == 0 ? html `ROOT(count: ${this.count})` : type}</span>
|
|
236
|
+
${name ? html ` <span class="name">${name}</span> ` : html ``}
|
|
237
|
+
</span>
|
|
238
|
+
|
|
239
|
+
${extended.map(child => this.renderComponent(child, depth + 1))}
|
|
240
|
+
</div>
|
|
241
|
+
`;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
SceneInspector.styles = [
|
|
245
|
+
css `
|
|
246
|
+
:host {
|
|
247
|
+
display: flex;
|
|
248
|
+
flex-direction: column;
|
|
249
|
+
|
|
250
|
+
color: var(--scene-inspector-color);
|
|
251
|
+
--url-icon-shell-inspector: url(${unsafeCSS(ICON_SHELL_INSPECTOR)});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
ox-input-search {
|
|
255
|
+
--input-search-padding: 3px;
|
|
256
|
+
--input-search-focus-border-bottom: none;
|
|
257
|
+
--input-search-font: normal 16px var(--theme-font);
|
|
258
|
+
|
|
259
|
+
border-radius: 999px;
|
|
260
|
+
box-sizing: border-box;
|
|
261
|
+
border: 1px solid var(--md-sys-color-on-secondary-container);
|
|
262
|
+
padding: 0 10px;
|
|
263
|
+
margin: 5px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
div[result] {
|
|
267
|
+
flex: 1;
|
|
268
|
+
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-direction: column;
|
|
271
|
+
|
|
272
|
+
overflow-y: auto;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.component {
|
|
276
|
+
display: block;
|
|
277
|
+
overflow: hidden;
|
|
278
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
279
|
+
font-size: 14px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.component[selected] {
|
|
283
|
+
background-color: var(--scene-inspector-selected-background-color);
|
|
284
|
+
border-top: var(--scene-inspector-selected-border);
|
|
285
|
+
border-bottom: var(--scene-inspector-selected-border);
|
|
286
|
+
}
|
|
287
|
+
[selected] .type {
|
|
288
|
+
font-weight: bold;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
span,
|
|
292
|
+
i {
|
|
293
|
+
display: inline-block;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
span.type {
|
|
297
|
+
text-overflow: ellipses;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
span.name {
|
|
301
|
+
background-color: var(--scene-inspector-name-background-color);
|
|
302
|
+
border-radius: var(--border-radius);
|
|
303
|
+
padding: 0 4px;
|
|
304
|
+
color: #fff;
|
|
305
|
+
font-size: 0.8em;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.eye {
|
|
309
|
+
margin: 0 0 0 5px;
|
|
310
|
+
vertical-align: middle;
|
|
311
|
+
opacity: 0.7;
|
|
312
|
+
font-size: 1.1em;
|
|
313
|
+
color: var(--scene-inspector-eye-icon-color);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.collapsed::before,
|
|
317
|
+
.extended::before,
|
|
318
|
+
.collapsespace::before {
|
|
319
|
+
background: var(--url-icon-shell-inspector) no-repeat;
|
|
320
|
+
width: 16px;
|
|
321
|
+
height: 18px;
|
|
322
|
+
display: inline-block;
|
|
323
|
+
content: '';
|
|
324
|
+
opacity: 0.6;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.collapsed::before {
|
|
328
|
+
background-position: 100% -195px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.extended::before {
|
|
332
|
+
background-position: 100% -295px;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.collapsespace::before {
|
|
336
|
+
background-position: 100% -395px;
|
|
337
|
+
opacity: 0.9;
|
|
338
|
+
width: 16px;
|
|
339
|
+
}
|
|
340
|
+
.collapsed,
|
|
341
|
+
.extended,
|
|
342
|
+
.collapsespace {
|
|
343
|
+
border-left: 1px dotted rgba(0, 0, 0, 0.1);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
pre {
|
|
347
|
+
display: inline;
|
|
348
|
+
}
|
|
349
|
+
`
|
|
350
|
+
];
|
|
351
|
+
__decorate([
|
|
352
|
+
property({ type: Object })
|
|
353
|
+
], SceneInspector.prototype, "scene", void 0);
|
|
354
|
+
__decorate([
|
|
355
|
+
state()
|
|
356
|
+
], SceneInspector.prototype, "searchText", void 0);
|
|
357
|
+
//# sourceMappingURL=inspector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector.js","sourceRoot":"","sources":["../../../../src/property-panel/inspector/inspector.ts"],"names":[],"mappings":";AAAA,OAAO,mCAAmC,CAAA;AAE1C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAkC,MAAM,KAAK,CAAA;AACtF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEnD,qBAAqB;AACrB,oCAAoC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIvC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,4CAA4C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAExG,MAAM,OAAO,cAAe,SAAQ,UAAU;IAA9C;;QA+GmB,eAAU,GAAW,EAAE,CAAA;QAGhC,SAAI,GAAY,KAAK,CAAA;QACrB,UAAK,GAAW,CAAC,CAAC,CAAA;IAsR5B,CAAC;IApRC,eAAe,CAAC,KAAa;QAC3B,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;YACtC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;YACrC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;YAClC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAA;QAE5B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChC,OAAO,IAAI,CAAC,YAAY,CAA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,KAAK,GAAG,CAAC,CAAC,CAAC;;KAElE,CAAA;IACH,CAAC;;AAvYM,qBAAM,GAAG;IACd,GAAG,CAAA;;;;;;0CAMmC,SAAS,CAAC,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkGpE;CACF,AA1GY,CA0GZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AAExB;IAAhB,KAAK,EAAE;kDAAgC","sourcesContent":["import '@operato/input/ox-input-search.js'\n\nimport { css, html, unsafeCSS, LitElement, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\n// TODO test Sortable\n// import Sortable from 'sortablejs'\nimport { i18next } from '@operato/i18n'\n\nimport { Component, Container, Scene } from '@hatiolab/things-scene'\n\nconst ICON_SHELL_INSPECTOR = new URL('../../../../icons/icon-shell-inspector.png', import.meta.url).href\n\nexport class SceneInspector extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n color: var(--scene-inspector-color);\n --url-icon-shell-inspector: url(${unsafeCSS(ICON_SHELL_INSPECTOR)});\n }\n\n ox-input-search {\n --input-search-padding: 3px;\n --input-search-focus-border-bottom: none;\n --input-search-font: normal 16px var(--theme-font);\n\n border-radius: 999px;\n box-sizing: border-box;\n border: 1px solid var(--md-sys-color-on-secondary-container);\n padding: 0 10px;\n margin: 5px;\n }\n\n div[result] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n\n overflow-y: auto;\n }\n\n .component {\n display: block;\n overflow: hidden;\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n font-size: 14px;\n }\n\n .component[selected] {\n background-color: var(--scene-inspector-selected-background-color);\n border-top: var(--scene-inspector-selected-border);\n border-bottom: var(--scene-inspector-selected-border);\n }\n [selected] .type {\n font-weight: bold;\n }\n\n span,\n i {\n display: inline-block;\n }\n\n span.type {\n text-overflow: ellipses;\n }\n\n span.name {\n background-color: var(--scene-inspector-name-background-color);\n border-radius: var(--border-radius);\n padding: 0 4px;\n color: #fff;\n font-size: 0.8em;\n }\n\n .eye {\n margin: 0 0 0 5px;\n vertical-align: middle;\n opacity: 0.7;\n font-size: 1.1em;\n color: var(--scene-inspector-eye-icon-color);\n }\n\n .collapsed::before,\n .extended::before,\n .collapsespace::before {\n background: var(--url-icon-shell-inspector) no-repeat;\n width: 16px;\n height: 18px;\n display: inline-block;\n content: '';\n opacity: 0.6;\n }\n\n .collapsed::before {\n background-position: 100% -195px;\n }\n\n .extended::before {\n background-position: 100% -295px;\n }\n\n .collapsespace::before {\n background-position: 100% -395px;\n opacity: 0.9;\n width: 16px;\n }\n .collapsed,\n .extended,\n .collapsespace {\n border-left: 1px dotted rgba(0, 0, 0, 0.1);\n }\n\n pre {\n display: inline;\n }\n `\n ]\n\n @property({ type: Object }) scene?: Scene\n\n @state() private searchText: string = ''\n\n private _extendedMap: any\n private show: boolean = false\n private count: number = -1\n\n disconnectScene(scene?: Scene) {\n if (scene) {\n scene.off('selected', undefined, this)\n scene.off('execute', undefined, this)\n scene.off('undo', undefined, this)\n scene.off('redo', undefined, this)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.disconnectScene(this.scene)\n delete this._extendedMap\n }\n\n render() {\n this.count = 0\n\n return html`\n <ox-input-search\n .placeholder=${i18next.t('text.search with type, id or tag')}\n autofocus\n @change=${(e: Event) => (this.searchText = ((e.target as HTMLInputElement).value || '').toLowerCase())}\n ></ox-input-search>\n\n <div result>${!this.scene ? html`` : this.renderComponent(this.scene.root, 0)}</div>\n `\n }\n\n firstUpdated() {\n dispatchEvent(new Event('resize'))\n\n this.renderRoot.addEventListener('click', this._onclick.bind(this) as EventListener)\n this.renderRoot.addEventListener('dblclick', this._ondblclick.bind(this) as EventListener)\n }\n\n refresh() {\n let selected = this.scene?.selected || []\n\n selected.forEach(component => {\n let parent = component.parent\n while (parent && !this.extendedMap.get(parent)) {\n this.extendedMap.set(parent, true)\n parent = parent.parent\n }\n })\n\n this.requestUpdate()\n }\n\n updated(change: PropertyValues<this>) {\n if (change.has('scene')) {\n let oldScene = change.get('scene') as Scene\n\n if (oldScene) {\n this.disconnectScene(oldScene)\n delete this._extendedMap\n }\n\n if (this.scene && this.scene.root) {\n this.scene.on('selected', this.refresh, this)\n this.scene.on('execute', this.refresh, this)\n this.scene.on('undo', this.refresh, this)\n this.scene.on('redo', this.refresh, this)\n\n this.refresh()\n }\n }\n\n // TODO test Sortable\n // this.updateComplete.then(() => {\n // this.renderRoot.querySelectorAll('[sortable]').forEach(sortable => {\n // new Sortable(sortable as HTMLElement, this.sortableConfig)\n // })\n // })\n }\n\n // TODO test Sortable\n // sortableConfig: Sortable.Options = {\n // group: 'inspector',\n // animation: 150,\n // draggable: '.component',\n // swapThreshold: 1,\n // onSort: this.onSort.bind(this)\n // }\n\n // TODO test Sortable\n // onSort(e: Sortable.SortableEvent) {\n // if (!this.scene) return\n\n // var component = (e.item as HTMLElement & { component: Component }).component\n // var to_container = (e.to as HTMLElement & { component: Component }).component as Container\n // var to_index = e.newIndex! - 1\n\n // this.scene.move(component, to_container, to_index)\n\n // this.show = false\n // this.updateComplete.then(() => {\n // this.show = true\n // })\n // }\n\n _onclick(e: MouseEvent) {\n e.stopPropagation()\n\n var targetElement = e.target as HTMLElement & { component: Component }\n var classList = targetElement.classList\n var component\n\n while (!component && targetElement) {\n component = targetElement.component\n\n if (component) break\n\n targetElement = targetElement.parentNode as HTMLElement & { component: Component }\n\n if (!targetElement || targetElement === this.renderRoot) break\n }\n\n if (component) {\n if (classList.contains('eye')) {\n this.toggleHidden(component)\n } else if (classList.contains('extended') || classList.contains('collapsed')) {\n this.toggleExtended(component)\n }\n\n this.selectComponent(component, e.shiftKey)\n } else {\n if (classList.contains('inspector')) {\n this.show = !this.show\n this.style.height = this.show ? '100%' : ''\n }\n }\n\n this.requestUpdate()\n }\n\n _ondblclick(e: MouseEvent) {\n e.stopPropagation()\n\n var targetElement = e.target as HTMLElement & { component: Component }\n var component\n\n while (!component && targetElement) {\n component = targetElement.component\n\n if (component) break\n\n targetElement = targetElement.parentNode as HTMLElement & { component: Component }\n\n if (!targetElement || targetElement === this.renderRoot) break\n }\n\n if (component && component.isContainer()) {\n this.toggleExtended(component)\n }\n\n this.requestUpdate()\n }\n\n get extendedMap() {\n if (!this._extendedMap) {\n this._extendedMap = new WeakMap()\n }\n\n return this._extendedMap\n }\n\n getNodeHandleClass(component: Component) {\n if (component.isContainer() && (component as Container).components.length > 0) {\n return !!this.extendedMap.get(component) ? 'extended' : 'collapsed'\n } else {\n return 'collapsespace'\n }\n }\n\n isExtended(component: Component) {\n return !!this.extendedMap.get(component)\n }\n\n toggleExtended(component: Component) {\n var extended = this.isExtended(component)\n\n if (extended) {\n this.extendedMap.delete(component)\n } else {\n this.extendedMap.set(component, !extended)\n }\n\n this.requestUpdate()\n }\n\n toggleHidden(component: Component) {\n component.set('hidden', !component.hidden)\n\n this.requestUpdate()\n }\n\n selectComponent(component: Component, append: boolean = false) {\n const selected = this.scene!.selected\n\n if (append) {\n const idx = selected.findIndex(s => s === component)\n if (idx != -1) {\n selected.splice(idx, 1)\n this.scene!.selected = [...selected]\n } else {\n this.scene!.selected = [...selected, component]\n }\n } else {\n this.scene!.selected = [component]\n }\n\n component.trigger('reactionreset')\n component.trigger('reaction')\n\n this.requestUpdate()\n }\n\n shouldBeShown(component: Component, counting: boolean = false): boolean {\n const { type, name, id, tag } = component.state\n const found =\n !this.searchText || `${type} ${name || ''} ${id || ''} ${tag || ''}`.toLowerCase().search(this.searchText) > -1\n\n if (counting && found) {\n this.count++\n }\n\n const foundChildren = ((component as Container).components || []).filter((child: Component) =>\n this.shouldBeShown(child, counting)\n ).length\n\n return !!(found || foundChildren > 0)\n }\n\n renderComponent(component: Component, depth: number): TemplateResult {\n if (!component) {\n return html``\n }\n\n if (!this.shouldBeShown(component, depth == 0)) {\n return html``\n }\n\n const children = (component.isContainer() && (component as Container).components) || []\n const extended = this.isExtended(component) ? children.filter(child => this.shouldBeShown(child)) : []\n const { type, id, tag, class: clazz } = component.state\n\n const name = (id ? `#${id}` : '') + (tag ? `@${tag}` : '') + (clazz ? `.(${clazz})` : '')\n\n return html`\n <div\n class=\"component\"\n ?selected=${(this.scene?.selected || []).indexOf(component) > -1}\n .component=${component}\n ?sortable=${component.isContainer()}\n >\n <span>\n ${depth > 0\n ? html`\n <md-icon class=\"eye\">${component.get('hidden') ? 'visibility_off' : 'visibility'}</md-icon>\n <pre>${' '.repeat(depth)}</pre>\n `\n : html` <pre>${' '.repeat(depth + 2)}</pre> `}\n\n <span class=${this.getNodeHandleClass(component)}> </span>\n\n <span class=\"type\">${depth == 0 ? html`ROOT(count: ${this.count})` : type}</span>\n ${name ? html` <span class=\"name\">${name}</span> ` : html``}\n </span>\n\n ${extended.map(child => this.renderComponent(child, depth + 1))}\n </div>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@operato/input/ox-input-angle.js';
|
|
5
|
+
import '@operato/input/ox-buttons-radio.js';
|
|
6
|
+
import '@material/web/icon/icon.js';
|
|
7
|
+
import '@operato/i18n/ox-i18n.js';
|
|
8
|
+
import '@operato/help/ox-title-with-help.js';
|
|
9
|
+
import { BOUNDS, Component, Properties } from '@hatiolab/things-scene';
|
|
10
|
+
import { AbstractProperty } from '../abstract-property.js';
|
|
11
|
+
export declare class PropertyShapes extends AbstractProperty {
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
value?: Properties;
|
|
14
|
+
bounds: BOUNDS | null;
|
|
15
|
+
selected: Component[];
|
|
16
|
+
private _3dExpanded;
|
|
17
|
+
firstUpdated(): void;
|
|
18
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
19
|
+
onValueChange(e: Event): void;
|
|
20
|
+
_hasTextProperty(selected: Component[]): boolean;
|
|
21
|
+
_hasProperties(selected: Component[]): boolean;
|
|
22
|
+
_isIdentifiable(selected: Component[]): boolean;
|
|
23
|
+
_isClassIdentifiable(selected: Component[]): boolean;
|
|
24
|
+
_isLine(selected: Component[]): boolean;
|
|
25
|
+
_is3dish(selected: Component[]): boolean;
|
|
26
|
+
}
|