enigmatic 0.9.6 → 0.9.10
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/elements/monaco-editor.mjs +32 -0
- package/main.css +372 -0
- package/main.js +16 -2
- package/package.json +1 -4
- package/test.html +34 -24
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class MonacoEditor extends HTMLElement {
|
|
2
|
+
async connectedCallback() {
|
|
3
|
+
await loadJS('//unpkg.com/monaco-editor@0.30.1/min/vs/loader.js')
|
|
4
|
+
this.innerHTML = `<div id="m-container" style="${this.getAttribute('estyle')}"></div>`
|
|
5
|
+
require.config({ paths: { vs: 'min/vs' } })
|
|
6
|
+
const id = this.getAttribute('id'), that = this
|
|
7
|
+
require(['vs/editor/editor.main'], function () {
|
|
8
|
+
const editor = monaco.editor.create(document.getElementById('m-container'), {
|
|
9
|
+
value: $(`code[for=${id}]`).innerHTML,
|
|
10
|
+
language: 'javascript'
|
|
11
|
+
})
|
|
12
|
+
that.editor = editor
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
customElements.define('monaco-editor', MonacoEditor)
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
|
|
20
|
+
example..
|
|
21
|
+
|
|
22
|
+
<monaco-editor id='me1' estyle="width: 600px; height: 400px; border: 1px solid gray"></monaco-editor>
|
|
23
|
+
<code for='me1' hidden>
|
|
24
|
+
class HelloWorld extends HTMLElement {
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
this.innerHTML = '<div>Hello World!</div>'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
customElements.define('hello-world', HelloWorld)
|
|
30
|
+
</code>
|
|
31
|
+
|
|
32
|
+
*/
|
package/main.css
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
body {
|
|
2
|
+
margin: 0
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@font-face {
|
|
6
|
+
font-family: 'Roboto';
|
|
7
|
+
font-style: normal;
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
src: local('Roboto Regular'), local('Roboto-Regular'), url(//themes.googleusercontent.com/static/fonts/roboto/v10/2UX7WLTfW3W8TclTUvlFyQ.woff) format('woff');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.flat {
|
|
13
|
+
border: 0;
|
|
14
|
+
outline-width: 0
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.fill {
|
|
18
|
+
height: 100%;
|
|
19
|
+
width: 100%
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.border {
|
|
23
|
+
border: 1px solid black
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.fadein {
|
|
27
|
+
font-size: 21px;
|
|
28
|
+
text-align: center;
|
|
29
|
+
-webkit-animation: fadein 3s;
|
|
30
|
+
/* Safari, Chrome and Opera > 12.1 */
|
|
31
|
+
-moz-animation: fadein 3s;
|
|
32
|
+
/* Firefox < 16 */
|
|
33
|
+
-ms-animation: fadein 3s;
|
|
34
|
+
/* Internet Explorer */
|
|
35
|
+
-o-animation: fadein 3s;
|
|
36
|
+
/* Opera < 12.1 */
|
|
37
|
+
animation: fadein 3s;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes fadein {
|
|
41
|
+
from {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
to {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.roboto {
|
|
50
|
+
font-family: 'Roboto', sans-serif;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
a {
|
|
54
|
+
text-decoration: none !important
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.shadow {
|
|
58
|
+
box-shadow: 6px 6px 6px #dbdbdb
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.loading {
|
|
62
|
+
border: 4px solid #dbdbdb;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
border-top: 6px solid #000000;
|
|
65
|
+
width: 10px;
|
|
66
|
+
height: 10px;
|
|
67
|
+
-webkit-animation: spin 1s linear infinite;
|
|
68
|
+
animation: spin 1s linear infinite;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@-webkit-keyframes spin {
|
|
72
|
+
0% {
|
|
73
|
+
-webkit-transform: rotate(0deg);
|
|
74
|
+
}
|
|
75
|
+
100% {
|
|
76
|
+
-webkit-transform: rotate(360deg);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.cursor {
|
|
81
|
+
cursor: default
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
navy, .bg-navy {
|
|
85
|
+
background-color: #001f3f
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
blue, .bg-blue {
|
|
89
|
+
background-color: #0074d9
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
aqua, .bg-aqua {
|
|
93
|
+
background-color: #7fdbff
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
green, .bg-green {
|
|
97
|
+
background-color: #2ecc40
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
yellow, .bg-yellow {
|
|
101
|
+
background-color: #ffdc00
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
orange, .bg-orange {
|
|
105
|
+
background-color: #ff851b
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
red, .bg-red {
|
|
109
|
+
background-color: #ff4136
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
fuchsia, .bg-fuchsia {
|
|
113
|
+
background-color: #f012be
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
purple, .bg-purple {
|
|
117
|
+
background-color: #b10dc9
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
maroon, .bg-maroon {
|
|
121
|
+
background-color: #85144b
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
white, .bg-white {
|
|
125
|
+
background-color: #fff
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
gray, .bg-gray {
|
|
129
|
+
background-color: #aaa
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
silver, .bg-silver {
|
|
133
|
+
background-color: #ddd
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
black, .bg-black {
|
|
137
|
+
background-color: #111
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ltgray, .bg-ltgray {
|
|
141
|
+
background-color: #fcfcfc
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.navy {
|
|
145
|
+
color: #001f3f
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.blue {
|
|
149
|
+
color: #0074d9
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.aqua {
|
|
153
|
+
color: #7fdbff
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.teal {
|
|
157
|
+
color: #39cccc
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.olive {
|
|
161
|
+
color: #3d9970
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.green {
|
|
165
|
+
color: #2ecc40
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.lime {
|
|
169
|
+
color: #01ff70
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.yellow {
|
|
173
|
+
color: #ffdc00
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.orange {
|
|
177
|
+
color: #ff851b
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.red {
|
|
181
|
+
color: #ff4136
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.fuchsia {
|
|
185
|
+
color: #f012be
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.purple {
|
|
189
|
+
color: #b10dc9
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.maroon {
|
|
193
|
+
color: #85144b
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.white {
|
|
197
|
+
color: #fff !important
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.silver {
|
|
201
|
+
color: #ddd
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.gray {
|
|
205
|
+
color: #aaa
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.black {
|
|
209
|
+
color: #111
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ltgray {
|
|
213
|
+
color: #fcfcfc
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.modal {
|
|
217
|
+
position: fixed;
|
|
218
|
+
top: 0;
|
|
219
|
+
left: 0;
|
|
220
|
+
width: 100%;
|
|
221
|
+
height: 100%;
|
|
222
|
+
background: #fcfcfc;
|
|
223
|
+
opacity: 0.8;
|
|
224
|
+
filter: alpha(opacity=80);
|
|
225
|
+
z-index: 1000;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.center {
|
|
229
|
+
margin: 0 auto;
|
|
230
|
+
text-align: center
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.margins {
|
|
234
|
+
margin: 15px
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.padding {
|
|
238
|
+
padding: 15px
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.border {
|
|
242
|
+
border: 10px solid #eee
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.front {
|
|
246
|
+
z-index: 100
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
img {
|
|
250
|
+
max-width: 100%;
|
|
251
|
+
height: auto
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.ten {
|
|
255
|
+
font-size: 10px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.twelve {
|
|
259
|
+
font-size: 12px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.thirteen {
|
|
263
|
+
font-size: 13px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.fourteen {
|
|
267
|
+
font-size: 14px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.fifteen {
|
|
271
|
+
font-size: 15px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.twenty {
|
|
275
|
+
font-size: 20px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.thirty {
|
|
279
|
+
font-size: 30px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.forty {
|
|
283
|
+
font-size: 40px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.fifty {
|
|
287
|
+
font-size: 50px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.sixty {
|
|
291
|
+
font-size: 60px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.seventy {
|
|
295
|
+
font-size: 70px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.eighty {
|
|
299
|
+
font-size: 80px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.ninety {
|
|
303
|
+
font-size: 90px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.hundred {
|
|
307
|
+
font-size: 100px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.fixed {
|
|
311
|
+
position: fixed
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.hide {
|
|
315
|
+
visibility: hidden
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.show {
|
|
319
|
+
visibility: ''
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.faded {
|
|
323
|
+
opacity: 0.5
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.fade {
|
|
327
|
+
opacity: 1;
|
|
328
|
+
transition: opacity .25s ease-in-out;
|
|
329
|
+
-moz-transition: opacity .25s ease-in-out;
|
|
330
|
+
-webkit-transition: opacity .25s ease-in-out;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.fade:hover {
|
|
334
|
+
opacity: 0.5
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.unfade {
|
|
338
|
+
opacity: 0.5;
|
|
339
|
+
transition: opacity .25s ease-in-out;
|
|
340
|
+
-moz-transition: opacity .25s ease-in-out;
|
|
341
|
+
-webkit-transition: opacity .25s ease-in-out;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.unfade:hover {
|
|
345
|
+
opacity: 1
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.full-page {
|
|
349
|
+
min-height: 100%;
|
|
350
|
+
min-width: 1024px;
|
|
351
|
+
width: 100%;
|
|
352
|
+
height: auto;
|
|
353
|
+
position: fixed;
|
|
354
|
+
top: 0;
|
|
355
|
+
left: 0;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@media screen and (max-width: 1024px) {
|
|
359
|
+
/* Specific to this particular image */
|
|
360
|
+
img.full-page {
|
|
361
|
+
left: 50%;
|
|
362
|
+
margin-left: -512px;
|
|
363
|
+
/* 50% */
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.rounded {
|
|
368
|
+
-moz-border-radius: 10px;
|
|
369
|
+
-webkit-border-radius: 10px;
|
|
370
|
+
border-radius: 10px;
|
|
371
|
+
-khtml-border-radius: 10px;
|
|
372
|
+
}
|
package/main.js
CHANGED
|
@@ -2,7 +2,7 @@ window.$ = document.querySelector.bind(document)
|
|
|
2
2
|
window.$$ = document.querySelectorAll.bind(document)
|
|
3
3
|
window.body = document.body
|
|
4
4
|
|
|
5
|
-
window.
|
|
5
|
+
window.loadJS = src => {
|
|
6
6
|
return new Promise((r, j) => {
|
|
7
7
|
const s = document.createElement('script')
|
|
8
8
|
s.src = src
|
|
@@ -11,6 +11,16 @@ window.load = src => {
|
|
|
11
11
|
})
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
window.loadCSS = src => {
|
|
15
|
+
return new Promise((r, j) => {
|
|
16
|
+
const s = document.createElement('link')
|
|
17
|
+
s.rel = 'stylesheet'
|
|
18
|
+
s.href = src
|
|
19
|
+
s.addEventListener('load', r)
|
|
20
|
+
document.head.appendChild(s)
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
class Data {
|
|
15
25
|
_ = {}
|
|
16
26
|
set (name, value) {
|
|
@@ -61,4 +71,8 @@ class EnigmaticElement extends HTMLElement {
|
|
|
61
71
|
}
|
|
62
72
|
}
|
|
63
73
|
|
|
64
|
-
customElements.define ('e-e', EnigmaticElement)
|
|
74
|
+
customElements.define ('e-e', EnigmaticElement)
|
|
75
|
+
|
|
76
|
+
window.addEventListener('DOMContentLoaded', (event) => {
|
|
77
|
+
if(window.main) window.main(document)
|
|
78
|
+
})
|
package/package.json
CHANGED
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
"url": "http://github.com/digplan/enigmatic",
|
|
5
5
|
"author": "<digplan@outlook.com>",
|
|
6
6
|
"main": "main.js",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"testchrome": "*"
|
|
9
|
-
},
|
|
10
7
|
"repository": {
|
|
11
8
|
"type": "git",
|
|
12
9
|
"url": "git://github.com/digplan/enigmatic.git"
|
|
13
10
|
},
|
|
14
|
-
"version": "0.9.
|
|
11
|
+
"version": "0.9.10"
|
|
15
12
|
}
|
package/test.html
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
<script src='main.js'></script>
|
|
2
|
+
<link rel='stylesheet' href='main.css'>
|
|
2
3
|
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<button onclick='x.hide()'>Hide</button>
|
|
12
|
-
<button onclick='x.child().set(" im a child ")'>Child</button>
|
|
4
|
+
<style>
|
|
5
|
+
body {
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
8
|
+
grid-template-rows: 1fr 1fr 1fr 1fr;
|
|
9
|
+
grid-gap: 1px;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
13
12
|
|
|
14
|
-
<
|
|
13
|
+
<body>
|
|
14
|
+
<div class='bg-white'>
|
|
15
|
+
All data: <e-e data='ALL'>data</e-e>
|
|
16
|
+
<br>
|
|
17
|
+
Element data: <e-e id='ds' data='targetkey.method' class='bg-aqua'></e-e>
|
|
18
|
+
<br>
|
|
19
|
+
<button onclick='data.set("targetkey", {method: "a value"})''>set</button>
|
|
20
|
+
</div>
|
|
21
|
+
<div class='bg-green'></div>
|
|
22
|
+
<div class='bg-red'></div>
|
|
23
|
+
<div class='bg-yellow'></div>
|
|
24
|
+
<e-e id='b' class='bg-black'></e-e>
|
|
25
|
+
<div class='bg-gray'></div>
|
|
26
|
+
<div class='bg-orange'></div>
|
|
27
|
+
<div class='bg-maroon'></div>
|
|
15
28
|
|
|
16
|
-
<script>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
<script>
|
|
30
|
+
class mySubclass extends EnigmaticElement {
|
|
31
|
+
connectedCallback() {
|
|
32
|
+
this.set('<h1>This is a subclass!</h1>')
|
|
33
|
+
}
|
|
20
34
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
customElements.define('my-subclass', mySubclass);
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<my-subclass></my-subclass>
|
|
35
|
+
customElements.define('my-subclass', mySubclass);
|
|
36
|
+
</script>
|
|
37
|
+
<my-subclass class='bg-yellow'><my-subclass class='bg-yellow'></my-subclass>
|
|
29
38
|
|
|
30
|
-
<
|
|
39
|
+
<button onclick='b.hide()'>Hide</button>
|
|
40
|
+
</body>
|