-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
216 lines (199 loc) · 16 KB
/
index.html
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
</head>
<title>OpenSCD Transpower Distribution</title>
<open-scd></open-scd>
<link href="themes.css" rel="stylesheet" />
<script polyfill="" scoped-custom-element-registry="">
if (!('createElement' in ShadowRoot.prototype)) {
(function(){
/*
Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at
http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at
http://polymer.github.io/PATENTS.txt
*/
'use strict';function h(b){var c=0;return function(){return c<b.length?{done:!1,value:b[c++]}:{done:!0}}}function l(b){var c="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return c?c.call(b):{next:h(b)}}function m(b){if(!(b instanceof Array)){b=l(b);for(var c,a=[];!(c=b.next()).done;)a.push(c.value);b=a}return b}var n="function"==typeof Object.create?Object.create:function(b){function c(){}c.prototype=b;return new c};
function p(b){b=["object"==typeof globalThis&&globalThis,b,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var c=0;c<b.length;++c){var a=b[c];if(a&&a.Math==Math)return a}throw Error("Cannot find global object");}
var q=p(this),r=function(){function b(){function a(){}new a;Reflect.construct(a,[],function(){});return new a instanceof a}if("undefined"!=typeof Reflect&&Reflect.construct){if(b())return Reflect.construct;var c=Reflect.construct;return function(a,d,e){a=c(a,d);e&&Reflect.setPrototypeOf(a,e.prototype);return a}}return function(a,d,e){void 0===e&&(e=a);e=n(e.prototype||Object.prototype);return Function.prototype.apply.call(a,e,d)||e}}(),t;
if("function"==typeof Object.setPrototypeOf)t=Object.setPrototypeOf;else{var u;a:{var v={a:!0},w={};try{w.__proto__=v;u=w.a;break a}catch(b){}u=!1}t=u?function(b,c){b.__proto__=c;if(b.__proto__!==c)throw new TypeError(b+" is not extensible");return b}:null}var x=t;
if(!ShadowRoot.prototype.createElement){var y=window.HTMLElement,A=window.customElements.define,B=window.customElements.get,C=window.customElements,D=new WeakMap,E=new WeakMap,F=new WeakMap,G=new WeakMap;window.CustomElementRegistry=function(){this.l=new Map;this.o=new Map;this.i=new Map;this.h=new Map};window.CustomElementRegistry.prototype.define=function(b,c){b=b.toLowerCase();if(void 0!==this.j(b))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \""+b+'" has already been used with this registry');
if(void 0!==this.o.get(c))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");var a=c.prototype.attributeChangedCallback,d=new Set(c.observedAttributes||[]);H(c,d,a);a={g:c,connectedCallback:c.prototype.connectedCallback,disconnectedCallback:c.prototype.disconnectedCallback,adoptedCallback:c.prototype.adoptedCallback,attributeChangedCallback:a,formAssociated:c.formAssociated,formAssociatedCallback:c.prototype.formAssociatedCallback,
formDisabledCallback:c.prototype.formDisabledCallback,formResetCallback:c.prototype.formResetCallback,formStateRestoreCallback:c.prototype.formStateRestoreCallback,observedAttributes:d};this.l.set(b,a);this.o.set(c,a);d=B.call(C,b);d||(d=I(b),A.call(C,b,d));this===window.customElements&&(F.set(c,a),a.s=d);if(d=this.h.get(b)){this.h.delete(b);d=l(d);for(var e=d.next();!e.done;e=d.next())e=e.value,E.delete(e),J(e,a,!0)}a=this.i.get(b);void 0!==a&&(a.resolve(c),this.i.delete(b));return c};window.CustomElementRegistry.prototype.upgrade=
function(){K.push(this);C.upgrade.apply(C,arguments);K.pop()};window.CustomElementRegistry.prototype.get=function(b){var c;return null==(c=this.l.get(b))?void 0:c.g};window.CustomElementRegistry.prototype.j=function(b){return this.l.get(b)};window.CustomElementRegistry.prototype.whenDefined=function(b){var c=this.j(b);if(void 0!==c)return Promise.resolve(c.g);var a=this.i.get(b);void 0===a&&(a={},a.promise=new Promise(function(d){return a.resolve=d}),this.i.set(b,a));return a.promise};window.CustomElementRegistry.prototype.m=
function(b,c,a){var d=this.h.get(c);d||this.h.set(c,d=new Set);a?d.add(b):d.delete(b)};var L;window.HTMLElement=function(){var b=L;if(b)return L=void 0,b;var c=F.get(this.constructor);if(!c)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");b=Reflect.construct(y,[],c.s);Object.setPrototypeOf(b,this.constructor.prototype);D.set(b,c);return b};window.HTMLElement.prototype=y.prototype;var I=function(b){function c(){var a=
Reflect.construct(y,[],this.constructor);Object.setPrototypeOf(a,HTMLElement.prototype);a:{var d=a.getRootNode();if(!(d===document||d instanceof ShadowRoot)){d=K[K.length-1];if(d instanceof CustomElementRegistry){var e=d;break a}d=d.getRootNode();d===document||d instanceof ShadowRoot||(d=(null==(e=G.get(d))?void 0:e.getRootNode())||document)}e=d.customElements}e=e||window.customElements;(d=e.j(b))?J(a,d):E.set(a,e);return a}q.Object.defineProperty(c,"formAssociated",{configurable:!0,enumerable:!0,
get:function(){return!0}});c.prototype.connectedCallback=function(){var a=D.get(this);a?a.connectedCallback&&a.connectedCallback.apply(this,arguments):E.get(this).m(this,b,!0)};c.prototype.disconnectedCallback=function(){var a=D.get(this);a?a.disconnectedCallback&&a.disconnectedCallback.apply(this,arguments):E.get(this).m(this,b,!1)};c.prototype.adoptedCallback=function(){var a,d;null==(a=D.get(this))||null==(d=a.adoptedCallback)||d.apply(this,arguments)};c.prototype.formAssociatedCallback=function(){var a=
D.get(this);if(a&&a.formAssociated){var d;null==a||null==(d=a.formAssociatedCallback)||d.apply(this,arguments)}};c.prototype.formDisabledCallback=function(){var a=D.get(this);if(null==a?0:a.formAssociated){var d;null==a||null==(d=a.formDisabledCallback)||d.apply(this,arguments)}};c.prototype.formResetCallback=function(){var a=D.get(this);if(null==a?0:a.formAssociated){var d;null==a||null==(d=a.formResetCallback)||d.apply(this,arguments)}};c.prototype.formStateRestoreCallback=function(){var a=D.get(this);
if(null==a?0:a.formAssociated){var d;null==a||null==(d=a.formStateRestoreCallback)||d.apply(this,arguments)}};return c},H=function(b,c,a){if(0!==c.size&&void 0!==a){var d=b.prototype.setAttribute;d&&(b.prototype.setAttribute=function(f,k){f=f.toLowerCase();if(c.has(f)){var z=this.getAttribute(f);d.call(this,f,k);a.call(this,f,z,k)}else d.call(this,f,k)});var e=b.prototype.removeAttribute;e&&(b.prototype.removeAttribute=function(f){f=f.toLowerCase();if(c.has(f)){var k=this.getAttribute(f);e.call(this,
f);a.call(this,f,k,null)}else e.call(this,f)});var g=b.prototype.toggleAttribute;g&&(b.prototype.toggleAttribute=function(f,k){f=f.toLowerCase();if(c.has(f)){var z=this.getAttribute(f);g.call(this,f,k);k=this.getAttribute(f);a.call(this,f,z,k)}else g.call(this,f,k)})}},M=function(b){var c=Object.getPrototypeOf(b);if(c!==window.HTMLElement)return c===y?Object.setPrototypeOf(b,window.HTMLElement):M(c)},J=function(b,c,a){a=void 0===a?!1:a;Object.setPrototypeOf(b,c.g.prototype);D.set(b,c);L=b;try{new c.g}catch(d){M(c.g),
new c.g}c.attributeChangedCallback&&c.observedAttributes.forEach(function(d){b.hasAttribute(d)&&c.attributeChangedCallback.call(b,d,null,b.getAttribute(d))});a&&c.connectedCallback&&b.isConnected&&c.connectedCallback.call(b)},N=Element.prototype.attachShadow;Element.prototype.attachShadow=function(b){var c=N.apply(this,arguments);b.customElements&&(c.customElements=b.customElements);return c};var K=[document],O=function(b,c,a){var d=(a?Object.getPrototypeOf(a):b.prototype)[c];b.prototype[c]=function(){K.push(this);
var e=d.apply(a||this,arguments);void 0!==e&&G.set(e,this);K.pop();return e}};O(ShadowRoot,"createElement",document);O(ShadowRoot,"importNode",document);O(Element,"insertAdjacentHTML");var P=function(b){var c=Object.getOwnPropertyDescriptor(b.prototype,"innerHTML");Object.defineProperty(b.prototype,"innerHTML",Object.assign({},c,{set:function(a){K.push(this);c.set.call(this,a);K.pop()}}))};P(Element);P(ShadowRoot);Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,
writable:!0});if(window.ElementInternals&&window.ElementInternals.prototype.setFormValue){var Q=new WeakMap,R=HTMLElement.prototype.attachInternals,methods=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(b){for(var c=[],a=0;a<arguments.length;++a)c[a]=arguments[a];c=R.call.apply(R,[this].concat(m(c)));Q.set(c,this);return c};methods.forEach(function(b){var c=window.ElementInternals.prototype,a=c[b];c[b]=function(d){for(var e=[],g=0;g<
arguments.length;++g)e[g]=arguments[g];g=Q.get(this);if(!0===D.get(g).formAssociated)return null==a?void 0:a.call.apply(a,[this].concat(m(e)));throw new DOMException("Failed to execute "+a+" on 'ElementInternals': The target element is not a form-associated custom element.");}});var RadioNodeList=function(b){var c=r(Array,[].concat(m(b)),this.constructor);c.h=b;return c},S=RadioNodeList,T=Array;S.prototype=n(T.prototype);S.prototype.constructor=S;if(x)x(S,T);else for(var U in T)if("prototype"!=U)if(Object.defineProperties){var V=
Object.getOwnPropertyDescriptor(T,U);V&&Object.defineProperty(S,U,V)}else S[U]=T[U];S.u=T.prototype;q.Object.defineProperty(RadioNodeList.prototype,"value",{configurable:!0,enumerable:!0,get:function(){var b;return(null==(b=this.h.find(function(c){return!0===c.checked}))?void 0:b.value)||""}});var HTMLFormControlsCollection=function(b){var c=this,a=new Map;b.forEach(function(d,e){var g=d.getAttribute("name"),f=a.get(g)||[];c[+e]=d;f.push(d);a.set(g,f)});this.length=b.length;a.forEach(function(d,e){d&&
(c[e]=1===d.length?d[0]:new RadioNodeList(d))})};HTMLFormControlsCollection.prototype.namedItem=function(b){return this[b]};var W=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){var b=W.get.call(this,[]),c=[];b=l(b);for(var a=b.next();!a.done;a=b.next()){a=a.value;var d=D.get(a);d&&!0!==d.formAssociated||c.push(a)}return new HTMLFormControlsCollection(c)}})}};
}).call(typeof globalThis === 'object' ? globalThis : window);
}
</script>
<script>
const _customElementsDefine = window.customElements.define;
window.customElements.define = (name, cl, conf) => {
if (!customElements.get(name)) {
try {
_customElementsDefine.call(window.customElements, name, cl, conf);
} catch (e) {
console.warn(e);
}
}
};
</script>
<script type="module">
import "./open-scd-core-dev/open-scd.js";
fetch("./plugins.json")
.then((res) => res.text())
.then((plugins) => {
const openScd = document.querySelector("open-scd");
openScd.setAttribute("plugins", plugins);
const params = new URL(document.location).searchParams;
for (const [name, value] of params) {
openScd.setAttribute(name, value);
}
});
const editor = document.querySelector("open-scd");
const params = new URL(document.location).searchParams;
for (const [name, value] of params) {
editor.setAttribute(name, value);
}
const isElectron = !!window?.electronAPI;
if (isElectron) {
window.electronAPI.onFileOpen(async (fileName, filePath) => {
try {
const text = await window.electronAPI.readFile(filePath);
const doc = new DOMParser().parseFromString(text, "application/xml");
const openScd = document.querySelector("open-scd");
openScd.dispatchEvent(
new CustomEvent("oscd-open", {
bubbles: true,
composed: true,
detail: { doc, docName: fileName },
})
);
} catch (err) {
console.error("Error reading file:", err);
}
});
}
</script>
<style>
body {
height: 100%;
width: 100%;
}
html {
height: 100%;
width: 100%;
}
/* fallback */
@font-face {
font-family: "Material Symbols Outlined";
font-style: normal;
font-weight: 400;
src: url(fonts/material-symbols-outlined.woff2) format("woff2");
}
.material-symbols-outlined {
font-family: "Material Symbols Outlined";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
font-feature-settings: "liga";
-webkit-font-feature-settings: "liga";
-webkit-font-smoothing: antialiased;
}
/* roboto-300 - vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 300;
src: local(""),
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-300.woff2")
format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-300.woff")
format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* roboto-300italic - vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 300;
src: local(""),
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-300italic.woff2")
format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-300italic.woff")
format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* roboto-regular - vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: local(""),
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-regular.woff2")
format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-regular.woff")
format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* roboto-italic - vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 400;
src: local(""),
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-italic.woff2")
format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-italic.woff")
format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* roboto-500italic - vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: "Roboto";
font-style: italic;
font-weight: 500;
src: local(""),
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-500italic.woff2")
format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-500italic.woff")
format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* roboto-500 - vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: local(""),
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-500.woff2")
format("woff2"),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url("fonts/roboto-v30-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-500.woff")
format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
</style>