@jsenv/core 35.0.5 → 36.0.1
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/README.md +1 -1
- package/dist/js/inline_content.js +5 -4
- package/dist/jsenv_core.js +1127 -1497
- package/package.json +8 -8
- package/src/build/build.js +49 -41
- package/src/dev/file_service.js +7 -17
- package/src/dev/start_dev_server.js +12 -7
- package/src/kitchen/kitchen.js +38 -19
- package/src/kitchen/url_graph.js +1 -1
- package/src/plugins/autoreload/jsenv_plugin_hmr.js +2 -2
- package/src/plugins/file_urls/jsenv_plugin_file_urls.js +4 -4
- package/src/plugins/http_urls/jsenv_plugin_http_urls.js +1 -1
- package/src/plugins/importmap/jsenv_plugin_importmap.js +1 -1
- package/src/plugins/inlining/jsenv_plugin_inlining.js +1 -1
- package/src/plugins/inlining/jsenv_plugin_inlining_as_data_url.js +13 -2
- package/src/plugins/plugin_controller.js +19 -10
- package/src/plugins/plugins.js +21 -25
- package/src/plugins/{url_analysis/css/css_urls.js → reference_analysis/css/jsenv_plugin_css_reference_analysis.js} +11 -1
- package/src/plugins/{inline_content_analysis/jsenv_plugin_data_urls.js → reference_analysis/data_urls/jsenv_plugin_data_urls_analysis.js} +19 -19
- package/src/plugins/reference_analysis/directory/jsenv_plugin_directory_reference_analysis.js +51 -0
- package/src/plugins/reference_analysis/html/jsenv_plugin_html_reference_analysis.js +429 -0
- package/src/plugins/reference_analysis/inline_content.js +7 -0
- package/src/plugins/reference_analysis/js/jsenv_plugin_js_reference_analysis.js +161 -0
- package/src/plugins/reference_analysis/jsenv_plugin_reference_analysis.js +120 -0
- package/src/plugins/{url_analysis → reference_analysis}/jsenv_plugin_reference_expected_types.js +19 -12
- package/src/plugins/{url_analysis/webmanifest/webmanifest_urls.js → reference_analysis/webmanifest/jsenv_plugin_webmanifest_reference_analysis.js} +13 -1
- package/src/plugins/resolution_node_esm/jsenv_plugin_node_esm_resolution.js +74 -0
- package/src/plugins/{url_resolution → resolution_node_esm}/node_esm_resolver.js +8 -0
- package/src/plugins/resolution_web/jsenv_plugin_web_resolution.js +45 -0
- package/src/plugins/transpilation/as_js_module/jsenv_plugin_as_js_module.js +1 -1
- package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +1 -1
- package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +4 -6
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_conversion.js +1 -1
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback_inside_html.js +4 -6
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback_on_workers.js +1 -1
- package/src/plugins/url_type_from_reference.js +13 -0
- package/src/plugins/{url_version/jsenv_plugin_url_version.js → version_search_param/jsenv_plugin_version_search_param.js} +4 -4
- package/dist/html/explorer.html +0 -559
- package/dist/other/jsenv.png +0 -0
- package/src/plugins/explorer/client/explorer.html +0 -608
- package/src/plugins/explorer/client/jsenv.png +0 -0
- package/src/plugins/explorer/jsenv_plugin_explorer.js +0 -86
- package/src/plugins/inline_content_analysis/client/inline_content.js +0 -6
- package/src/plugins/inline_content_analysis/jsenv_plugin_html_inline_content_analysis.js +0 -206
- package/src/plugins/inline_content_analysis/jsenv_plugin_inline_content_analysis.js +0 -34
- package/src/plugins/inline_content_analysis/jsenv_plugin_js_inline_content_analysis.js +0 -314
- package/src/plugins/url_analysis/html/html_urls.js +0 -313
- package/src/plugins/url_analysis/js/js_urls.js +0 -65
- package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +0 -116
- package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +0 -140
package/dist/html/explorer.html
DELETED
|
@@ -1,559 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Exploring</title>
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<meta charset="utf-8">
|
|
7
|
-
<link rel="icon" href="ignore:FAVICON_HREF">
|
|
8
|
-
<style>button:focus, a:focus, input:focus, [data-contains-hidden-input] input:focus + * {
|
|
9
|
-
outline-offset: -2px;
|
|
10
|
-
outline-style: none;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
[data-contains-hidden-input] input:focus + * {
|
|
14
|
-
outline-offset: -2px;
|
|
15
|
-
outline-width: 4px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
html[data-last-interaction="keyboard"] button:focus, html[data-last-interaction="keyboard"] a:focus, html[data-last-interaction="keyboard"] input:focus, html[data-last-interaction="keyboard"] [data-contains-hidden-input] input:focus + * {
|
|
19
|
-
outline-style: auto;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
html[data-last-interaction="keyboard"] [data-contains-hidden-input] input:focus + * {
|
|
23
|
-
outline-color: #0096ff;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@-moz-document url-prefix() {
|
|
27
|
-
html[data-last-interaction="keyboard"] button:focus, html[data-last-interaction="keyboard"] a:focus, html[data-last-interaction="keyboard"] input:focus, html[data-last-interaction="keyboard"] [data-input-customized] input:focus + * {
|
|
28
|
-
outline-offset: 0;
|
|
29
|
-
outline: 2px solid #0096ff;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
::-moz-focus-inner {
|
|
34
|
-
border: 0;
|
|
35
|
-
}
|
|
36
|
-
</style>
|
|
37
|
-
<style>* {
|
|
38
|
-
box-sizing: border-box;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[data-force-hide] {
|
|
42
|
-
display: none !important;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
html, body {
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
flex: 1;
|
|
48
|
-
margin: 0;
|
|
49
|
-
padding: 0;
|
|
50
|
-
display: flex;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
html {
|
|
54
|
-
height: 100%;
|
|
55
|
-
font-family: arial, sans;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
main {
|
|
59
|
-
flex-direction: column;
|
|
60
|
-
flex: 1;
|
|
61
|
-
display: flex;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
main > * {
|
|
65
|
-
min-width: 100%;
|
|
66
|
-
flex: 1;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
hr {
|
|
70
|
-
color: #000;
|
|
71
|
-
background-color: #000;
|
|
72
|
-
border-color: #000;
|
|
73
|
-
margin: 15px 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
article[data-page="file-list"] {
|
|
77
|
-
color: #97a0a0;
|
|
78
|
-
background-color: #204143;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
nav, #explorables-message {
|
|
82
|
-
background: #1f262c;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
#explorables nav {
|
|
86
|
-
overflow: hidden;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
#explorables-message {
|
|
90
|
-
overflow: auto;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
article h2 {
|
|
94
|
-
margin: 0;
|
|
95
|
-
display: flex;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
article h2 svg {
|
|
99
|
-
margin-right: 15px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
#main_html_file {
|
|
103
|
-
padding: 25px 25px 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
#main_file_link {
|
|
107
|
-
color: #e7f2f3;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
h2 {
|
|
111
|
-
color: #24b1b0;
|
|
112
|
-
margin: 20px 0;
|
|
113
|
-
display: inline-block;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
h4 {
|
|
117
|
-
color: #97a0a0;
|
|
118
|
-
padding: 0 25px;
|
|
119
|
-
font-size: 15px;
|
|
120
|
-
font-weight: normal;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
#explorables {
|
|
124
|
-
word-break: break-word;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#explorables-header {
|
|
128
|
-
width: 100%;
|
|
129
|
-
position: sticky;
|
|
130
|
-
top: 0;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
#explorables_header_and_menu {
|
|
134
|
-
background-color: #204143;
|
|
135
|
-
padding-top: 25px;
|
|
136
|
-
padding-left: 25px;
|
|
137
|
-
padding-right: 25px;
|
|
138
|
-
position: relative;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#explorables_header_bottom_spacing {
|
|
142
|
-
height: 20px;
|
|
143
|
-
background: #1f262c;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
#directory_relative_url {
|
|
147
|
-
color: orange;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
#explorables ul {
|
|
151
|
-
margin: 0;
|
|
152
|
-
padding: 0 25px 25px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
#explorables li {
|
|
156
|
-
margin: 10px 0;
|
|
157
|
-
list-style-type: none;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
#explorables li:first-child {
|
|
161
|
-
margin-top: 0;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
#explorables li .execution-link {
|
|
165
|
-
width: 100%;
|
|
166
|
-
word-break: break-all;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.execution-link {
|
|
170
|
-
color: #e7f2f3;
|
|
171
|
-
text-decoration: unset;
|
|
172
|
-
background: #204143;
|
|
173
|
-
padding: 6px 12px;
|
|
174
|
-
font-family: monospace;
|
|
175
|
-
font-size: 14px;
|
|
176
|
-
display: inline-block;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
#main_file_icon {
|
|
180
|
-
fill: #24b1b0;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
#explorables_icon {
|
|
184
|
-
width: 25px;
|
|
185
|
-
height: 25px;
|
|
186
|
-
stroke: none;
|
|
187
|
-
fill: #24b1b0;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
#explorables fieldset {
|
|
191
|
-
border: none;
|
|
192
|
-
margin: 0;
|
|
193
|
-
padding: 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
#explorables fieldset label {
|
|
197
|
-
padding: 0;
|
|
198
|
-
display: inline-block;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
#explorables fieldset input {
|
|
202
|
-
opacity: 0;
|
|
203
|
-
position: absolute;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
#explorables fieldset label input + * {
|
|
207
|
-
min-width: 8em;
|
|
208
|
-
text-align: center;
|
|
209
|
-
background-color: #204143;
|
|
210
|
-
border-radius: .1em;
|
|
211
|
-
padding: .7em 1em;
|
|
212
|
-
display: block;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
#explorables fieldset input:checked + * {
|
|
216
|
-
color: orange;
|
|
217
|
-
background: #1f262c;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.menu-wrapper {
|
|
221
|
-
max-width: 100%;
|
|
222
|
-
margin-top: 25px;
|
|
223
|
-
transition: all .3s;
|
|
224
|
-
position: relative;
|
|
225
|
-
overflow: hidden;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.menu {
|
|
229
|
-
box-sizing: border-box;
|
|
230
|
-
white-space: nowrap;
|
|
231
|
-
-webkit-overflow-scrolling: touch;
|
|
232
|
-
overflow: auto hidden;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.menu .item {
|
|
236
|
-
height: 100%;
|
|
237
|
-
box-sizing: border-box;
|
|
238
|
-
padding: 1em;
|
|
239
|
-
display: inline-block;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.paddle {
|
|
243
|
-
height: 36px;
|
|
244
|
-
color: #1f262c;
|
|
245
|
-
background: #24b1b0;
|
|
246
|
-
border: none;
|
|
247
|
-
position: absolute;
|
|
248
|
-
bottom: 0;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.left-paddle {
|
|
252
|
-
left: 0;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.right-paddle {
|
|
256
|
-
right: 0;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.hidden {
|
|
260
|
-
display: none;
|
|
261
|
-
}
|
|
262
|
-
</style>
|
|
263
|
-
</head>
|
|
264
|
-
|
|
265
|
-
<body>
|
|
266
|
-
<main></main>
|
|
267
|
-
<div style="display: none">
|
|
268
|
-
<article data-page="file-list">
|
|
269
|
-
<!--
|
|
270
|
-
<section id="main_html_file">
|
|
271
|
-
<h2>
|
|
272
|
-
<svg id="main_file_icon" viewBox="0 0 16 16" width="25px" height="25px">
|
|
273
|
-
<path
|
|
274
|
-
d="M15.45,7L14,5.551V2c0-0.55-0.45-1-1-1h-1c-0.55,0-1,0.45-1,1v0.553L9,0.555C8.727,0.297,8.477,0,8,0S7.273,0.297,7,0.555 L0.55,7C0.238,7.325,0,7.562,0,8c0,0.563,0.432,1,1,1h1v6c0,0.55,0.45,1,1,1h3v-5c0-0.55,0.45-1,1-1h2c0.55,0,1,0.45,1,1v5h3 c0.55,0,1-0.45,1-1V9h1c0.568,0,1-0.437,1-1C16,7.562,15.762,7.325,15.45,7z"
|
|
275
|
-
/>
|
|
276
|
-
</svg>
|
|
277
|
-
<span
|
|
278
|
-
>Main html file:
|
|
279
|
-
<a id="main_file_link" href="javascript:void(0)">${mainFileRelativeUrl}</a></span
|
|
280
|
-
>
|
|
281
|
-
</h2>
|
|
282
|
-
<div>
|
|
283
|
-
<iframe id="main_file_iframe" src="about:blank"></iframe>
|
|
284
|
-
</div>
|
|
285
|
-
</section>
|
|
286
|
-
<hr />
|
|
287
|
-
!-->
|
|
288
|
-
<section id="explorables">
|
|
289
|
-
<div id="explorables-header">
|
|
290
|
-
<div id="explorables_header_and_menu">
|
|
291
|
-
<h2>
|
|
292
|
-
<svg id="explorables_icon" viewBox="0 0 24 24" width="32" height="32">
|
|
293
|
-
<path d="M0 0h24v24H0V0z" fill="none"></path>
|
|
294
|
-
<path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"></path>
|
|
295
|
-
</svg>
|
|
296
|
-
<span>File(s) to explore in
|
|
297
|
-
<span id="directory_relative_url" title="${directoryUrl}">${directoryName}</span></span>
|
|
298
|
-
</h2>
|
|
299
|
-
<div class="menu-wrapper">
|
|
300
|
-
<fieldset id="filter-group-set" class="menu"></fieldset>
|
|
301
|
-
</div>
|
|
302
|
-
<div class="paddles">
|
|
303
|
-
<button class="left-paddle paddle hidden"><</button>
|
|
304
|
-
<button class="right-paddle paddle">></button>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
<div id="explorables_header_bottom_spacing"></div>
|
|
308
|
-
</div>
|
|
309
|
-
<div>
|
|
310
|
-
<div id="explorables-message">
|
|
311
|
-
<h4 style="margin-top: 0">${message}</h4>
|
|
312
|
-
</div>
|
|
313
|
-
<nav>
|
|
314
|
-
<ul></ul>
|
|
315
|
-
</nav>
|
|
316
|
-
</div>
|
|
317
|
-
</section>
|
|
318
|
-
</article>
|
|
319
|
-
</div>
|
|
320
|
-
<script no-supervisor="">
|
|
321
|
-
// eslint-disable-next-line no-undef
|
|
322
|
-
const { rootDirectoryUrl, groups, files } = SERVER_PARAMS;
|
|
323
|
-
|
|
324
|
-
const groupPreference = {
|
|
325
|
-
has: () => localStorage.hasOwnProperty("explorer_active_group"),
|
|
326
|
-
get: () =>
|
|
327
|
-
localStorage.hasOwnProperty("explorer_active_group")
|
|
328
|
-
? JSON.parse(localStorage.getItem("explorer_active_group"))
|
|
329
|
-
: undefined,
|
|
330
|
-
set: (value) =>
|
|
331
|
-
localStorage.setItem("explorer_active_group", JSON.stringify(value)),
|
|
332
|
-
};
|
|
333
|
-
const directoryNameFromUrl = (directoryUrl) => {
|
|
334
|
-
const slashLastIndex = directoryUrl.lastIndexOf(
|
|
335
|
-
"/",
|
|
336
|
-
// ignore last slash
|
|
337
|
-
directoryUrl.length - 2,
|
|
338
|
-
);
|
|
339
|
-
if (slashLastIndex === -1) return "";
|
|
340
|
-
return directoryUrl.slice(slashLastIndex + 1);
|
|
341
|
-
};
|
|
342
|
-
const urlToVisitFromRelativeUrl = (relativeUrl) => {
|
|
343
|
-
return `${window.origin}/${relativeUrl}`;
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
const fileListElement = document
|
|
347
|
-
.querySelector(`[data-page="file-list"]`)
|
|
348
|
-
.cloneNode(true);
|
|
349
|
-
const directoryName = directoryNameFromUrl(rootDirectoryUrl);
|
|
350
|
-
const span = fileListElement.querySelector("#directory_relative_url");
|
|
351
|
-
span.title = rootDirectoryUrl;
|
|
352
|
-
span.textContent = directoryName;
|
|
353
|
-
|
|
354
|
-
const h4 = fileListElement.querySelector("h4");
|
|
355
|
-
const ul = fileListElement.querySelector("ul");
|
|
356
|
-
ul.innerHTML = files
|
|
357
|
-
.map(
|
|
358
|
-
(file) =>
|
|
359
|
-
`<li>
|
|
360
|
-
<a
|
|
361
|
-
class="execution-link"
|
|
362
|
-
data-relative-url=${file.relativeUrl}
|
|
363
|
-
href=${urlToVisitFromRelativeUrl(file.relativeUrl)}
|
|
364
|
-
>
|
|
365
|
-
${file.relativeUrl}
|
|
366
|
-
</a>
|
|
367
|
-
</li>`,
|
|
368
|
-
)
|
|
369
|
-
.join("");
|
|
370
|
-
|
|
371
|
-
const groupFieldset = fileListElement.querySelector("#filter-group-set");
|
|
372
|
-
const groupNames = Object.keys(groups);
|
|
373
|
-
groupFieldset.innerHTML = groupNames
|
|
374
|
-
.map(
|
|
375
|
-
(key) => `<label data-contains-hidden-input class="item">
|
|
376
|
-
<input type="radio" name="filter-group" value="${key}"/>
|
|
377
|
-
<span>${key}</span>
|
|
378
|
-
</label>`,
|
|
379
|
-
)
|
|
380
|
-
.join("");
|
|
381
|
-
|
|
382
|
-
const groupFromLocalStorage = groupPreference.get();
|
|
383
|
-
const currentGroup =
|
|
384
|
-
groupFromLocalStorage && groupNames.includes(groupFromLocalStorage)
|
|
385
|
-
? groupFromLocalStorage
|
|
386
|
-
: groupNames[0];
|
|
387
|
-
Array.from(groupFieldset.querySelectorAll("input")).forEach(
|
|
388
|
-
(inputRadio) => {
|
|
389
|
-
inputRadio.checked = inputRadio.value === currentGroup;
|
|
390
|
-
inputRadio.onchange = () => {
|
|
391
|
-
if (inputRadio.checked) {
|
|
392
|
-
groupPreference.set(inputRadio.value);
|
|
393
|
-
enableGroup(inputRadio.value);
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
},
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
const enableGroup = (groupName) => {
|
|
400
|
-
const arrayOfElementToShow = [];
|
|
401
|
-
const arrayOfElementToHide = [];
|
|
402
|
-
files.forEach((file) => {
|
|
403
|
-
const fileLink = fileListElement.querySelector(
|
|
404
|
-
`a[data-relative-url="${file.relativeUrl}"]`,
|
|
405
|
-
);
|
|
406
|
-
const fileLi = fileLink.parentNode;
|
|
407
|
-
if (file.meta[groupName]) {
|
|
408
|
-
arrayOfElementToShow.push(fileLi);
|
|
409
|
-
} else {
|
|
410
|
-
arrayOfElementToHide.push(fileLi);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
arrayOfElementToShow.forEach((element) => {
|
|
414
|
-
element.removeAttribute("data-force-hide");
|
|
415
|
-
});
|
|
416
|
-
arrayOfElementToHide.forEach((element) => {
|
|
417
|
-
element.setAttribute("data-force-hide", "");
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
h4.innerHTML =
|
|
421
|
-
arrayOfElementToShow.length === 0
|
|
422
|
-
? `No file found.
|
|
423
|
-
Config for this section: <pre>${JSON.stringify(
|
|
424
|
-
groups[groupName],
|
|
425
|
-
null,
|
|
426
|
-
" ",
|
|
427
|
-
)}</pre>`
|
|
428
|
-
: `${arrayOfElementToShow.length} files found. Click on the one you want to execute`;
|
|
429
|
-
};
|
|
430
|
-
enableGroup(currentGroup);
|
|
431
|
-
|
|
432
|
-
document.querySelector("main").appendChild(fileListElement);
|
|
433
|
-
</script>
|
|
434
|
-
<script no-supervisor="">
|
|
435
|
-
// make menu scrollable
|
|
436
|
-
const getMenuWrapperSize = () => {
|
|
437
|
-
return document.querySelector(".menu-wrapper").getBoundingClientRect()
|
|
438
|
-
.width;
|
|
439
|
-
};
|
|
440
|
-
const getMenuSize = () => {
|
|
441
|
-
return document.querySelector(".menu").getBoundingClientRect().width;
|
|
442
|
-
};
|
|
443
|
-
const getMenuPosition = () => {
|
|
444
|
-
return document.querySelector(".menu-wrapper").scrollLeft;
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
let menuWrapperSize = getMenuWrapperSize();
|
|
448
|
-
let menuSize = getMenuSize();
|
|
449
|
-
const menuVisibleSize = menuWrapperSize;
|
|
450
|
-
let menuInvisibleSize = menuSize - menuVisibleSize;
|
|
451
|
-
const scrollDuration = 300;
|
|
452
|
-
const leftPaddle = document.querySelector(".left-paddle");
|
|
453
|
-
const rightPaddle = document.querySelector(".right-paddle");
|
|
454
|
-
|
|
455
|
-
const handleMenuScroll = () => {
|
|
456
|
-
menuInvisibleSize = menuSize - menuWrapperSize;
|
|
457
|
-
const menuPosition = getMenuPosition();
|
|
458
|
-
const menuEndOffset = menuInvisibleSize;
|
|
459
|
-
// show & hide the paddles, depending on scroll position
|
|
460
|
-
if (menuPosition <= 0 && menuEndOffset <= 0) {
|
|
461
|
-
// hide both paddles if the window is large enough to display all tabs
|
|
462
|
-
leftPaddle.classList.add("hidden");
|
|
463
|
-
rightPaddle.classList.add("hidden");
|
|
464
|
-
} else if (menuPosition <= 0) {
|
|
465
|
-
leftPaddle.classList.add("hidden");
|
|
466
|
-
rightPaddle.classList.remove("hidden");
|
|
467
|
-
} else if (menuPosition < Math.floor(menuEndOffset)) {
|
|
468
|
-
// show both paddles in the middle
|
|
469
|
-
leftPaddle.classList.remove("hidden");
|
|
470
|
-
rightPaddle.classList.remove("hidden");
|
|
471
|
-
} else if (menuPosition >= Math.floor(menuEndOffset)) {
|
|
472
|
-
leftPaddle.classList.remove("hidden");
|
|
473
|
-
rightPaddle.classList.add("hidden");
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
handleMenuScroll();
|
|
477
|
-
|
|
478
|
-
window.onresize = () => {
|
|
479
|
-
menuWrapperSize = getMenuWrapperSize();
|
|
480
|
-
menuSize = getMenuSize();
|
|
481
|
-
handleMenuScroll();
|
|
482
|
-
};
|
|
483
|
-
// finally, what happens when we are actually scrolling the menu
|
|
484
|
-
document.querySelector(".menu-wrapper").onscroll = () => {
|
|
485
|
-
handleMenuScroll();
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
const startJavaScriptAnimation = ({
|
|
489
|
-
duration = 300,
|
|
490
|
-
timingFunction = (t) => t,
|
|
491
|
-
onProgress = () => {},
|
|
492
|
-
onCancel = () => {},
|
|
493
|
-
onComplete = () => {},
|
|
494
|
-
}) => {
|
|
495
|
-
duration = parseInt(duration, 10);
|
|
496
|
-
const startMs = performance.now();
|
|
497
|
-
let currentRequestAnimationFrameId;
|
|
498
|
-
let done = false;
|
|
499
|
-
let rawProgress = 0;
|
|
500
|
-
let progress = 0;
|
|
501
|
-
const handler = () => {
|
|
502
|
-
currentRequestAnimationFrameId = null;
|
|
503
|
-
const nowMs = performance.now();
|
|
504
|
-
rawProgress = Math.min((nowMs - startMs) / duration, 1);
|
|
505
|
-
progress = timingFunction(rawProgress);
|
|
506
|
-
done = rawProgress === 1;
|
|
507
|
-
onProgress({
|
|
508
|
-
done,
|
|
509
|
-
rawProgress,
|
|
510
|
-
progress,
|
|
511
|
-
});
|
|
512
|
-
if (done) {
|
|
513
|
-
onComplete();
|
|
514
|
-
} else {
|
|
515
|
-
currentRequestAnimationFrameId =
|
|
516
|
-
window.requestAnimationFrame(handler);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
handler();
|
|
520
|
-
const stop = () => {
|
|
521
|
-
if (currentRequestAnimationFrameId) {
|
|
522
|
-
window.cancelAnimationFrame(currentRequestAnimationFrameId);
|
|
523
|
-
currentRequestAnimationFrameId = null;
|
|
524
|
-
}
|
|
525
|
-
if (!done) {
|
|
526
|
-
done = true;
|
|
527
|
-
onCancel({
|
|
528
|
-
rawProgress,
|
|
529
|
-
progress,
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
return stop;
|
|
534
|
-
};
|
|
535
|
-
rightPaddle.onclick = () => {
|
|
536
|
-
const scrollStart = document.querySelector(".menu-wrapper").scrollLeft;
|
|
537
|
-
const scrollEnd = scrollStart + menuWrapperSize;
|
|
538
|
-
startJavaScriptAnimation({
|
|
539
|
-
duration: scrollDuration,
|
|
540
|
-
onProgress: ({ progress }) => {
|
|
541
|
-
document.querySelector(".menu-wrapper").scrollLeft =
|
|
542
|
-
scrollStart + (scrollEnd - scrollStart) * progress;
|
|
543
|
-
},
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
leftPaddle.onclick = () => {
|
|
547
|
-
const scrollStart = document.querySelector(".menu-wrapper").scrollLeft;
|
|
548
|
-
const scrollEnd = scrollStart - menuWrapperSize;
|
|
549
|
-
startJavaScriptAnimation({
|
|
550
|
-
duration: scrollDuration,
|
|
551
|
-
onProgress: ({ progress }) => {
|
|
552
|
-
document.querySelector(".menu-wrapper").scrollLeft =
|
|
553
|
-
scrollStart + (scrollEnd - scrollStart) * progress;
|
|
554
|
-
},
|
|
555
|
-
});
|
|
556
|
-
};
|
|
557
|
-
</script>
|
|
558
|
-
</body>
|
|
559
|
-
</html>
|
package/dist/other/jsenv.png
DELETED
|
Binary file
|