forked from JakobVogelsang/oscd-publisher
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfoundation.ts
103 lines (82 loc) · 1.93 KB
/
foundation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { css } from 'lit';
import { find, identity } from '@openenergytools/scl-lib';
export function updateElementReference(
newDoc: XMLDocument,
oldElement: Element
): Element | null {
if (!oldElement || !oldElement.closest('SCL')) return null;
const id = identity(oldElement);
const newElement = find(newDoc, oldElement.tagName, id);
return newElement;
}
export function pathIdentity(element: Element): string {
const id = identity(element);
if (Number.isNaN(id)) return 'UNDEFINED';
const paths = (id as string).split('>');
paths.pop();
return paths.join('>');
}
export const styles = css`
.section {
display: flex;
height: calc(100vh - 184px);
}
.selectionlist {
flex: 35%;
margin: 4px 4px 4px 8px;
background-color: var(--mdc-theme-surface, white);
overflow-y: scroll;
}
.elementeditorcontainer {
flex: 65%;
margin: 4px 8px 4px 4px;
background-color: var(--mdc-theme-surface);
overflow-y: scroll;
display: flex;
}
.listitem.header {
font-weight: 500;
}
mwc-list-item.hidden[noninteractive] + li[divider] {
display: none;
}
mwc-list-item.hidden[slot] + li[divider] {
display: none;
}
.change.scl.element {
display: none;
}
@media (max-width: 950px) {
.elementeditorcontainer {
display: block;
}
}
@media (max-width: 599px) {
.section {
height: 100%;
}
.selectionlist {
position: absolute;
width: calc(100% - 32px);
height: auto;
top: 110px;
left: 8px;
z-index: 1;
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
}
.elementeditorcontainer {
display: block;
}
data-set-element-editor {
width: calc(100% - 16px);
}
.selectionlist.hidden {
display: none;
}
.change.scl.element {
display: flex;
margin: 4px 8px 8px;
}
}
`;