@jsenv/core 24.2.1 → 24.3.3

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.
Files changed (154) hide show
  1. package/dist/browser_runtime/browser_runtime-fbd309a1.js +5137 -0
  2. package/dist/browser_runtime/browser_runtime-fbd309a1.js.map +1064 -0
  3. package/dist/{jsenv_browser_system.js → browser_system/browser_system-29eda202.js} +12 -12
  4. package/dist/{jsenv_browser_system.js.map → browser_system/browser_system-29eda202.js.map} +64 -64
  5. package/dist/build_manifest.js +12 -0
  6. package/dist/compile_proxy/assets/s.js-749702e8.map +242 -0
  7. package/dist/compile_proxy/compile_proxy-405777e6.html +2074 -0
  8. package/dist/compile_proxy/compile_proxy.html__inline__20-39c0801c.js.map +385 -0
  9. package/dist/{jsenv_event_source_client.js → event_source_client/event_source_client-9f14c8b9.js} +39 -21
  10. package/dist/event_source_client/event_source_client-9f14c8b9.js.map +127 -0
  11. package/dist/redirector/assets/s.js-749702e8.map +242 -0
  12. package/dist/redirector/redirector-237cd168.html +2118 -0
  13. package/dist/redirector/redirector.html__inline__15-33acb0b9.js.map +390 -0
  14. package/dist/toolbar/assets/compilation.css-209d68b4.map +12 -0
  15. package/dist/toolbar/assets/eventsource.css-38cd0a36.map +12 -0
  16. package/dist/toolbar/assets/execution.css-0ebe522f.map +12 -0
  17. package/dist/toolbar/assets/focus.css-3f9c156d.map +12 -0
  18. package/dist/toolbar/assets/light-theme.css-78b19a80.map +12 -0
  19. package/dist/toolbar/assets/overflow-menu.css-d9688a1c.map +12 -0
  20. package/dist/toolbar/assets/s.js-749702e8.map +242 -0
  21. package/dist/toolbar/assets/settings.css-2b81b245.map +12 -0
  22. package/dist/toolbar/assets/toolbar.main.css-846920e9.map +28 -0
  23. package/dist/toolbar/assets/tooltip.css-03395ee6.map +12 -0
  24. package/dist/toolbar/toolbar-29e91dcd.html +4779 -0
  25. package/dist/toolbar/toolbar.main-53e1ab2b.js.map +795 -0
  26. package/dist/toolbar_injector/assets/jsenv-logo-188b9ca6.svg +95 -0
  27. package/dist/{jsenv_toolbar_injector.js → toolbar_injector/toolbar_injector-0af91b43.js} +87 -65
  28. package/dist/toolbar_injector/toolbar_injector-0af91b43.js.map +294 -0
  29. package/main.js +0 -1
  30. package/package.json +2 -1
  31. package/readme.md +10 -7
  32. package/src/buildProject.js +6 -2
  33. package/src/dev_server.js +26 -130
  34. package/src/execute.js +7 -10
  35. package/src/importUsingChildProcess.js +1 -1
  36. package/src/internal/{runtime/detectBrowser/detectBrowser.js → browser_detection/browser_detection.js} +0 -0
  37. package/src/internal/{runtime/detectBrowser → browser_detection}/detectAndroid.js +0 -0
  38. package/src/internal/{runtime/detectBrowser → browser_detection}/detectChrome.js +0 -0
  39. package/src/internal/{runtime/detectBrowser → browser_detection}/detectEdge.js +0 -0
  40. package/src/internal/{runtime/detectBrowser → browser_detection}/detectElectron.js +0 -0
  41. package/src/internal/{runtime/detectBrowser → browser_detection}/detectFirefox.js +0 -0
  42. package/src/internal/{runtime/detectBrowser → browser_detection}/detectIOS.js +0 -0
  43. package/src/internal/{runtime/detectBrowser → browser_detection}/detectInternetExplorer.js +0 -0
  44. package/src/internal/{runtime/detectBrowser → browser_detection}/detectOpera.js +0 -0
  45. package/src/internal/{runtime/detectBrowser → browser_detection}/detectSafari.js +0 -0
  46. package/src/internal/{runtime/detectBrowser → browser_detection}/util.js +0 -0
  47. package/src/internal/{runtime/createBrowserRuntime/scanBrowserRuntimeFeatures.js → browser_feature_detection/browser_feature_detection.js} +116 -81
  48. package/src/internal/browser_feature_detection/compile_proxy.html +27 -0
  49. package/src/internal/browser_launcher/browser_runtime_report.js +75 -0
  50. package/src/internal/{browser-launcher → browser_launcher}/createSharing.js +0 -0
  51. package/src/internal/{browser-launcher → browser_launcher}/executeHtmlFile.js +13 -16
  52. package/src/internal/{browser-launcher → browser_launcher}/trackPageToNotify.js +0 -0
  53. package/src/internal/{browser-launcher/jsenv-browser-system.js → browser_runtime/browser_runtime.js} +4 -4
  54. package/src/internal/{runtime/createBrowserRuntime/createBrowserSystem.js → browser_runtime/browser_system.js} +3 -2
  55. package/src/internal/{runtime/createBrowserRuntime → browser_runtime}/createBrowserRuntime.js +7 -5
  56. package/src/internal/{browser-launcher → browser_runtime}/displayErrorInDocument.js +0 -0
  57. package/src/internal/{browser-launcher → browser_runtime}/displayErrorNotification.js +2 -4
  58. package/src/internal/{runtime/createBrowserRuntime → browser_runtime}/evalSource.js +2 -0
  59. package/src/internal/{runtime/createBrowserRuntime → browser_runtime}/makeNamespaceTransferable.js +0 -0
  60. package/src/internal/{browser-utils → browser_utils}/fetch-browser.js +2 -0
  61. package/src/internal/{browser-utils → browser_utils}/fetchAndEvalUsingFetch.js +3 -0
  62. package/src/internal/{browser-utils → browser_utils}/fetchAndEvalUsingScript.js +2 -0
  63. package/src/internal/{browser-utils → browser_utils}/fetchJson.js +0 -0
  64. package/src/internal/{browser-utils → browser_utils}/fetchUsingXHR.js +4 -4
  65. package/src/internal/building/buildUsingRollup.js +4 -0
  66. package/src/internal/building/createJsenvRollupPlugin.js +19 -9
  67. package/src/internal/building/css/applyPostCss.js +19 -8
  68. package/src/internal/building/css/moveCssUrls.js +44 -0
  69. package/src/internal/building/css/parseCssRessource.js +67 -17
  70. package/src/internal/building/css/parseCssUrls.js +29 -23
  71. package/src/internal/building/css/postcss_plugin_url_visitor.js +11 -20
  72. package/src/internal/building/css/replaceCssUrls.js +38 -19
  73. package/src/internal/building/css_module.js +6 -10
  74. package/src/internal/building/html/parseHtmlRessource.js +37 -11
  75. package/src/internal/building/parseRessource.js +3 -0
  76. package/src/internal/building/ressource_builder.js +12 -3
  77. package/src/internal/compiling/babel_plugin_import_assertions.js +1 -2
  78. package/src/internal/compiling/html_source_file_service.js +23 -21
  79. package/src/internal/compiling/jsenvCompilerForHtml.js +15 -22
  80. package/src/internal/compiling/startCompileServer.js +37 -32
  81. package/src/internal/dev_server/event_source_client/event_source_connection.js +28 -19
  82. package/src/internal/dev_server/exploring/exploring.html +7 -2
  83. package/src/internal/dev_server/exploring/fetchExploringJson.js +4 -9
  84. package/src/internal/dev_server/redirector/redirector.html +37 -2
  85. package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +4 -7
  86. package/src/internal/dev_server/toolbar/eventsource/toolbar.eventsource.js +2 -2
  87. package/src/internal/dev_server/toolbar/notification/toolbar.notification.js +75 -44
  88. package/src/internal/dev_server/toolbar/toolbar.html +31 -5
  89. package/src/internal/dev_server/toolbar/toolbar.injector.js +55 -36
  90. package/src/internal/dev_server/toolbar/toolbar.main.js +45 -31
  91. package/src/internal/dev_server/toolbar/util/fetching.js +1 -1
  92. package/src/internal/executing/executeConcurrently.js +5 -4
  93. package/src/internal/executing/executePlan.js +1 -2
  94. package/src/internal/generateGroupMap/one_runtime_compat.js +1 -1
  95. package/src/internal/generateGroupMap/runtime_compat_composition.js +1 -1
  96. package/src/internal/generateGroupMap/runtime_support.js +1 -1
  97. package/src/internal/jsenvInternalFiles.js +0 -26
  98. package/src/internal/jsenv_builds.js +19 -0
  99. package/src/internal/{runtime/node-feature-detect/feature-detect-dynamic-import.mjs → node_feature_detection/feature_detect_dynamic_import.mjs} +0 -0
  100. package/src/internal/{runtime/node-feature-detect/feature-detect-top-level-await.mjs → node_feature_detection/feature_detect_top_level_await.mjs} +0 -0
  101. package/src/internal/{runtime/node-feature-detect → node_feature_detection}/nodeSupportsDynamicImport.js +0 -0
  102. package/src/internal/node_feature_detection/nodeSupportsTopLevelAwait.js +16 -0
  103. package/src/internal/{runtime/createNodeRuntime/scanNodeRuntimeFeatures.js → node_feature_detection/node_feature_detection.js} +12 -13
  104. package/src/internal/{node-launcher → node_launcher}/createChildProcessOptions.js +0 -0
  105. package/src/internal/{node-launcher → node_launcher}/createControllableNodeProcess.js +9 -14
  106. package/src/internal/{node-launcher → node_launcher}/kill_process_tree.js +0 -0
  107. package/src/internal/node_launcher/node_runtime_report.js +71 -0
  108. package/src/internal/{node-launcher → node_launcher}/processOptions.js +0 -0
  109. package/src/internal/{runtime/detectNode → node_runtime}/detectNode.js +0 -0
  110. package/src/internal/{runtime/createNodeRuntime → node_runtime}/evalSource.js +1 -1
  111. package/src/internal/{runtime/createNodeRuntime → node_runtime}/fetchSource.js +1 -1
  112. package/src/internal/{node-launcher → node_runtime}/nodeControllableFile.mjs +14 -11
  113. package/src/internal/{runtime/createNodeRuntime/createNodeExecutionWithDynamicImport.js → node_runtime/node_execution_dynamic_import.js} +34 -6
  114. package/src/internal/node_runtime/node_execution_performance.js +67 -0
  115. package/src/internal/{runtime/createNodeRuntime/createNodeExecutionWithSystemJs.js → node_runtime/node_execution_systemjs.js} +38 -24
  116. package/src/internal/{runtime/createNodeRuntime/createNodeSystem.js → node_runtime/node_system.js} +4 -4
  117. package/src/internal/runtime/computeCompileIdFromGroupId.js +1 -0
  118. package/src/internal/runtime/resolveGroup.js +1 -1
  119. package/src/internal/runtime/resolveRuntimeGroup.js +2 -2
  120. package/src/internal/{semantic-versioning → semantic_versioning}/findHighestVersion.js +0 -0
  121. package/src/internal/{semantic-versioning → semantic_versioning}/findLowestVersion.js +0 -0
  122. package/src/internal/{semantic-versioning → semantic_versioning}/index.js +0 -0
  123. package/src/internal/{semantic-versioning → semantic_versioning}/valueToVersion.js +0 -0
  124. package/src/internal/{semantic-versioning → semantic_versioning}/versionCompare.js +0 -0
  125. package/src/internal/{semantic-versioning → semantic_versioning}/versionIsAbove.js +0 -0
  126. package/src/internal/{semantic-versioning → semantic_versioning}/versionIsBelow.js +0 -0
  127. package/src/internal/{semantic-versioning → semantic_versioning}/versionIsEqual.js +0 -0
  128. package/src/launchBrowser.js +12 -3
  129. package/src/launchNode.js +36 -7
  130. package/src/requireUsingChildProcess.js +1 -1
  131. package/dist/jsenv_compile_proxy.js +0 -1339
  132. package/dist/jsenv_compile_proxy.js.map +0 -378
  133. package/dist/jsenv_event_source_client.js.map +0 -126
  134. package/dist/jsenv_exploring_index.js +0 -1092
  135. package/dist/jsenv_exploring_index.js.map +0 -353
  136. package/dist/jsenv_exploring_redirector.js +0 -1386
  137. package/dist/jsenv_exploring_redirector.js.map +0 -384
  138. package/dist/jsenv_redirector.js +0 -1388
  139. package/dist/jsenv_redirector.js.map +0 -384
  140. package/dist/jsenv_toolbar.js +0 -2880
  141. package/dist/jsenv_toolbar.js.map +0 -771
  142. package/dist/jsenv_toolbar_injector.js.map +0 -301
  143. package/src/internal/browser-launcher/jsenv_compile_proxy.html +0 -13
  144. package/src/internal/browser-launcher/jsenv_compile_proxy.js +0 -5
  145. package/src/internal/dev_server/event_source_client/event_source_client_file_info.js +0 -17
  146. package/src/internal/dev_server/exploring/exploring_file_info.js +0 -21
  147. package/src/internal/dev_server/redirector/redirector.js +0 -30
  148. package/src/internal/dev_server/redirector/redirector_file_info.js +0 -24
  149. package/src/internal/dev_server/toolbar/backtolist/toolbar.backtolist.js +0 -33
  150. package/src/internal/dev_server/toolbar/toolbar_file_info.js +0 -37
  151. package/src/internal/node-launcher/node-js-file.js +0 -110
  152. package/src/internal/runtime/createNodeRuntime/createNodeRuntime.js +0 -32
  153. package/src/internal/runtime/node-feature-detect/nodeSupportsTopLevelAwait.js +0 -18
  154. package/src/nodeRuntime.js +0 -5
@@ -1,1092 +0,0 @@
1
- (function () {
2
- 'use strict';
3
-
4
- var memoize = function memoize(compute) {
5
- var memoized = false;
6
- var memoizedValue;
7
-
8
- var fnWithMemoization = function fnWithMemoization() {
9
- if (memoized) {
10
- return memoizedValue;
11
- } // if compute is recursive wait for it to be fully done before storing the lockValue
12
- // so set locked later
13
-
14
-
15
- memoizedValue = compute.apply(void 0, arguments);
16
- memoized = true;
17
- return memoizedValue;
18
- };
19
-
20
- fnWithMemoization.forget = function () {
21
- var value = memoizedValue;
22
- memoized = false;
23
- memoizedValue = undefined;
24
- return value;
25
- };
26
-
27
- return fnWithMemoization;
28
- };
29
-
30
- function _call$2(body, then, direct) {
31
- if (direct) {
32
- return then ? then(body()) : body();
33
- }
34
-
35
- try {
36
- var result = Promise.resolve(body());
37
- return then ? result.then(then) : result;
38
- } catch (e) {
39
- return Promise.reject(e);
40
- }
41
- }
42
-
43
- var fetchPolyfill = function fetchPolyfill() {
44
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
- args[_key] = arguments[_key];
46
- }
47
-
48
- return _call$2(loadPolyfill, function (_ref) {
49
- var fetchUsingXHR = _ref.fetchUsingXHR;
50
- return fetchUsingXHR.apply(void 0, args);
51
- });
52
- };
53
-
54
- var loadPolyfill = memoize(function () {
55
- return Promise.resolve().then(function () { return fetchUsingXHR$1; });
56
- });
57
- var fetchUrl$1 = typeof window.fetch === "function" && typeof window.AbortController === "function" ? window.fetch : fetchPolyfill;
58
-
59
- var createPreference = function createPreference(name) {
60
- return {
61
- has: function has() {
62
- return localStorage.hasOwnProperty(name);
63
- },
64
- get: function get() {
65
- return localStorage.hasOwnProperty(name) ? JSON.parse(localStorage.getItem(name)) : undefined;
66
- },
67
- set: function set(value) {
68
- return localStorage.setItem(name, JSON.stringify(value));
69
- }
70
- };
71
- };
72
-
73
- var objectWithoutPropertiesLoose = (function (source, excluded) {
74
- if (source === null) return {};
75
- var target = {};
76
- var sourceKeys = Object.keys(source);
77
- var key;
78
- var i;
79
-
80
- for (i = 0; i < sourceKeys.length; i++) {
81
- key = sourceKeys[i];
82
- if (excluded.indexOf(key) >= 0) continue;
83
- target[key] = source[key];
84
- }
85
-
86
- return target;
87
- });
88
-
89
- var _objectWithoutProperties = (function (source, excluded) {
90
- if (source === null) return {};
91
- var target = objectWithoutPropertiesLoose(source, excluded);
92
- var key;
93
- var i;
94
-
95
- if (Object.getOwnPropertySymbols) {
96
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
97
-
98
- for (i = 0; i < sourceSymbolKeys.length; i++) {
99
- key = sourceSymbolKeys[i];
100
- if (excluded.indexOf(key) >= 0) continue;
101
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
102
- target[key] = source[key];
103
- }
104
- }
105
-
106
- return target;
107
- });
108
-
109
- var startJavaScriptAnimation = function startJavaScriptAnimation(_ref6) {
110
- var _ref6$duration = _ref6.duration,
111
- duration = _ref6$duration === void 0 ? 300 : _ref6$duration,
112
- _ref6$timingFunction = _ref6.timingFunction,
113
- timingFunction = _ref6$timingFunction === void 0 ? function (t) {
114
- return t;
115
- } : _ref6$timingFunction,
116
- _ref6$onProgress = _ref6.onProgress,
117
- onProgress = _ref6$onProgress === void 0 ? function () {} : _ref6$onProgress,
118
- _ref6$onCancel = _ref6.onCancel,
119
- onCancel = _ref6$onCancel === void 0 ? function () {} : _ref6$onCancel,
120
- _ref6$onComplete = _ref6.onComplete,
121
- onComplete = _ref6$onComplete === void 0 ? function () {} : _ref6$onComplete;
122
-
123
- if (isNaN(duration)) {
124
- // console.warn(`duration must be a number, received ${duration}`)
125
- return function () {};
126
- }
127
-
128
- duration = parseInt(duration, 10);
129
- var startMs = performance.now();
130
- var currentRequestAnimationFrameId;
131
- var done = false;
132
- var rawProgress = 0;
133
- var progress = 0;
134
-
135
- var handler = function handler() {
136
- currentRequestAnimationFrameId = null;
137
- var nowMs = performance.now();
138
- rawProgress = Math.min((nowMs - startMs) / duration, 1);
139
- progress = timingFunction(rawProgress);
140
- done = rawProgress === 1;
141
- onProgress({
142
- done: done,
143
- rawProgress: rawProgress,
144
- progress: progress
145
- });
146
-
147
- if (done) {
148
- onComplete();
149
- } else {
150
- currentRequestAnimationFrameId = window.requestAnimationFrame(handler);
151
- }
152
- };
153
-
154
- handler();
155
-
156
- var stop = function stop() {
157
- if (currentRequestAnimationFrameId) {
158
- window.cancelAnimationFrame(currentRequestAnimationFrameId);
159
- currentRequestAnimationFrameId = null;
160
- }
161
-
162
- if (!done) {
163
- done = true;
164
- onCancel({
165
- rawProgress: rawProgress,
166
- progress: progress
167
- });
168
- }
169
- };
170
-
171
- return stop;
172
- };
173
-
174
- var _defineProperty = (function (obj, key, value) {
175
- // Shortcircuit the slow defineProperty path when possible.
176
- // We are trying to avoid issues where setters defined on the
177
- // prototype cause side effects under the fast path of simple
178
- // assignment. By checking for existence of the property with
179
- // the in operator, we can optimize most of this overhead away.
180
- if (key in obj) {
181
- Object.defineProperty(obj, key, {
182
- value: value,
183
- enumerable: true,
184
- configurable: true,
185
- writable: true
186
- });
187
- } else {
188
- obj[key] = value;
189
- }
190
-
191
- return obj;
192
- });
193
-
194
- var createDetailedMessage = function createDetailedMessage(message) {
195
- var details = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
196
- var string = "".concat(message);
197
- Object.keys(details).forEach(function (key) {
198
- var value = details[key];
199
- string += "\n--- ".concat(key, " ---\n").concat(Array.isArray(value) ? value.join("\n") : value);
200
- });
201
- return string;
202
- };
203
-
204
- function ownKeys(object, enumerableOnly) {
205
- var keys = Object.keys(object);
206
-
207
- if (Object.getOwnPropertySymbols) {
208
- var symbols = Object.getOwnPropertySymbols(object);
209
-
210
- if (enumerableOnly) {
211
- symbols = symbols.filter(function (sym) {
212
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
213
- });
214
- }
215
-
216
- keys.push.apply(keys, symbols);
217
- }
218
-
219
- return keys;
220
- }
221
-
222
- function _objectSpread2(target) {
223
- for (var i = 1; i < arguments.length; i++) {
224
- var source = arguments[i] != null ? arguments[i] : {};
225
-
226
- if (i % 2) {
227
- ownKeys(Object(source), true).forEach(function (key) {
228
- _defineProperty(target, key, source[key]);
229
- });
230
- } else if (Object.getOwnPropertyDescriptors) {
231
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
232
- } else {
233
- ownKeys(Object(source)).forEach(function (key) {
234
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
235
- });
236
- }
237
- }
238
-
239
- return target;
240
- }
241
-
242
- var nativeTypeOf = function nativeTypeOf(obj) {
243
- return typeof obj;
244
- };
245
-
246
- var customTypeOf = function customTypeOf(obj) {
247
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
248
- };
249
-
250
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? nativeTypeOf : customTypeOf;
251
-
252
- function _await$4(value, then, direct) {
253
- if (direct) {
254
- return then ? then(value) : value;
255
- }
256
-
257
- if (!value || !value.then) {
258
- value = Promise.resolve(value);
259
- }
260
-
261
- return then ? value.then(then) : value;
262
- }
263
-
264
- function _async$4(f) {
265
- return function () {
266
- for (var args = [], i = 0; i < arguments.length; i++) {
267
- args[i] = arguments[i];
268
- }
269
-
270
- try {
271
- return Promise.resolve(f.apply(this, args));
272
- } catch (e) {
273
- return Promise.reject(e);
274
- }
275
- };
276
- }
277
-
278
- function _call$1(body, then, direct) {
279
- if (direct) {
280
- return then ? then(body()) : body();
281
- }
282
-
283
- try {
284
- var result = Promise.resolve(body());
285
- return then ? result.then(then) : result;
286
- } catch (e) {
287
- return Promise.reject(e);
288
- }
289
- }
290
-
291
- var fetchUsingXHR = _async$4(function (url) {
292
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
293
- signal = _ref.signal,
294
- _ref$method = _ref.method,
295
- method = _ref$method === void 0 ? "GET" : _ref$method,
296
- _ref$credentials = _ref.credentials,
297
- credentials = _ref$credentials === void 0 ? "same-origin" : _ref$credentials,
298
- _ref$headers = _ref.headers,
299
- headers = _ref$headers === void 0 ? {} : _ref$headers,
300
- _ref$body = _ref.body,
301
- body = _ref$body === void 0 ? null : _ref$body;
302
-
303
- var headersPromise = createPromiseAndHooks();
304
- var bodyPromise = createPromiseAndHooks();
305
- var xhr = new XMLHttpRequest();
306
-
307
- var failure = function failure(error) {
308
- // if it was already resolved, we must reject the body promise
309
- if (headersPromise.settled) {
310
- bodyPromise.reject(error);
311
- } else {
312
- headersPromise.reject(error);
313
- }
314
- };
315
-
316
- var cleanup = function cleanup() {
317
- xhr.ontimeout = null;
318
- xhr.onerror = null;
319
- xhr.onload = null;
320
- xhr.onreadystatechange = null;
321
- };
322
-
323
- xhr.ontimeout = function () {
324
- cleanup();
325
- failure(new Error("xhr request timeout on ".concat(url, ".")));
326
- };
327
-
328
- xhr.onerror = function (error) {
329
- cleanup(); // unfortunately with have no clue why it fails
330
- // might be cors for instance
331
-
332
- failure(createRequestError(error, {
333
- url: url
334
- }));
335
- };
336
-
337
- xhr.onload = function () {
338
- cleanup();
339
- bodyPromise.resolve();
340
- };
341
-
342
- signal.addEventListener("abort", function () {
343
- xhr.abort();
344
- var abortError = new Error("aborted");
345
- abortError.name = "AbortError";
346
- failure(abortError);
347
- });
348
-
349
- xhr.onreadystatechange = function () {
350
- // https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest/readyState
351
- var readyState = xhr.readyState;
352
-
353
- if (readyState === 2) {
354
- headersPromise.resolve();
355
- } else if (readyState === 4) {
356
- cleanup();
357
- bodyPromise.resolve();
358
- }
359
- };
360
-
361
- xhr.open(method, url, true);
362
- Object.keys(headers).forEach(function (key) {
363
- xhr.setRequestHeader(key, headers[key]);
364
- });
365
- xhr.withCredentials = computeWithCredentials({
366
- credentials: credentials,
367
- url: url
368
- });
369
-
370
- if ("responseType" in xhr && hasBlob) {
371
- xhr.responseType = "blob";
372
- }
373
-
374
- xhr.send(body);
375
- return _await$4(headersPromise, function () {
376
- // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL
377
- var responseUrl = "responseURL" in xhr ? xhr.responseURL : headers["x-request-url"];
378
- var responseStatus = xhr.status;
379
- var responseStatusText = xhr.statusText;
380
- var responseHeaders = getHeadersFromXHR(xhr);
381
-
382
- var readBody = function readBody() {
383
- return _await$4(bodyPromise, function () {
384
- var status = xhr.status; // in Chrome on file:/// URLs, status is 0
385
-
386
- if (status === 0) {
387
- responseStatus = 200;
388
- }
389
-
390
- var body = "response" in xhr ? xhr.response : xhr.responseText;
391
- return {
392
- responseBody: body,
393
- responseBodyType: detectBodyType(body)
394
- };
395
- });
396
- };
397
-
398
- var text = function text() {
399
- return _call$1(readBody, function (_ref2) {
400
- var responseBody = _ref2.responseBody,
401
- responseBodyType = _ref2.responseBodyType;
402
-
403
- if (responseBodyType === "blob") {
404
- return blobToText(responseBody);
405
- }
406
-
407
- if (responseBodyType === "formData") {
408
- throw new Error("could not read FormData body as text");
409
- }
410
-
411
- return responseBodyType === "dataView" ? arrayBufferToText(responseBody.buffer) : responseBodyType === "arrayBuffer" ? arrayBufferToText(responseBody) : String(responseBody);
412
- });
413
- };
414
-
415
- var json = function json() {
416
- return _call$1(text, JSON.parse);
417
- };
418
-
419
- var blob = _async$4(function () {
420
- if (!hasBlob) {
421
- throw new Error("blob not supported");
422
- }
423
-
424
- return _call$1(readBody, function (_ref3) {
425
- var responseBody = _ref3.responseBody,
426
- responseBodyType = _ref3.responseBodyType;
427
-
428
- if (responseBodyType === "blob") {
429
- return responseBody;
430
- }
431
-
432
- if (responseBodyType === "dataView") {
433
- return new Blob([cloneBuffer(responseBody.buffer)]);
434
- }
435
-
436
- if (responseBodyType === "arrayBuffer") {
437
- return new Blob([cloneBuffer(responseBody)]);
438
- }
439
-
440
- if (responseBodyType === "formData") {
441
- throw new Error("could not read FormData body as blob");
442
- }
443
-
444
- return new Blob([String(responseBody)]);
445
- });
446
- });
447
-
448
- var arrayBuffer = function arrayBuffer() {
449
- return _call$1(readBody, function (_ref4) {
450
- var responseBody = _ref4.responseBody,
451
- responseBodyType = _ref4.responseBodyType;
452
- return responseBodyType === "arrayBuffer" ? cloneBuffer(responseBody) : _call$1(blob, blobToArrayBuffer);
453
- });
454
- };
455
-
456
- var formData = _async$4(function () {
457
- if (!hasFormData) {
458
- throw new Error("formData not supported");
459
- }
460
-
461
- return _call$1(text, textToFormData);
462
- });
463
-
464
- return {
465
- url: responseUrl,
466
- status: responseStatus,
467
- statusText: responseStatusText,
468
- headers: responseHeaders,
469
- text: text,
470
- json: json,
471
- blob: blob,
472
- arrayBuffer: arrayBuffer,
473
- formData: formData
474
- };
475
- });
476
- });
477
-
478
- var canUseBlob = function canUseBlob() {
479
- if (typeof window.FileReader !== "function") return false;
480
- if (typeof window.Blob !== "function") return false;
481
-
482
- try {
483
- // eslint-disable-next-line no-new
484
- new Blob();
485
- return true;
486
- } catch (e) {
487
- return false;
488
- }
489
- };
490
-
491
- var hasBlob = canUseBlob();
492
- var hasFormData = typeof window.FormData === "function";
493
- var hasArrayBuffer = typeof window.ArrayBuffer === "function";
494
- var hasSearchParams = typeof window.URLSearchParams === "function";
495
-
496
- var createRequestError = function createRequestError(error, _ref5) {
497
- var url = _ref5.url;
498
- return new Error(createDetailedMessage("error during xhr request on ".concat(url, "."), _defineProperty({}, "error stack", error.stack)));
499
- };
500
-
501
- var createPromiseAndHooks = function createPromiseAndHooks() {
502
- var resolve;
503
- var reject;
504
- var promise = new Promise(function (res, rej) {
505
- resolve = function resolve(value) {
506
- promise.settled = true;
507
- res(value);
508
- };
509
-
510
- reject = function reject(value) {
511
- promise.settled = true;
512
- rej(value);
513
- };
514
- });
515
- promise.resolve = resolve;
516
- promise.reject = reject;
517
- return promise;
518
- }; // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
519
-
520
-
521
- var computeWithCredentials = function computeWithCredentials(_ref6) {
522
- var credentials = _ref6.credentials,
523
- url = _ref6.url;
524
-
525
- if (credentials === "same-origin") {
526
- return originSameAsGlobalOrigin(url);
527
- }
528
-
529
- return credentials === "include";
530
- };
531
-
532
- var originSameAsGlobalOrigin = function originSameAsGlobalOrigin(url) {
533
- // if we cannot read globalOrigin from window.location.origin, let's consider it's ok
534
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== "object") return true;
535
- if (_typeof(window.location) !== "object") return true;
536
- var globalOrigin = window.location.origin;
537
- if (globalOrigin === "null") return true;
538
- return hrefToOrigin(url) === globalOrigin;
539
- };
540
-
541
- var detectBodyType = function detectBodyType(body) {
542
- if (!body) {
543
- return "";
544
- }
545
-
546
- if (typeof body === "string") {
547
- return "text";
548
- }
549
-
550
- if (hasBlob && Blob.prototype.isPrototypeOf(body)) {
551
- return "blob";
552
- }
553
-
554
- if (hasFormData && FormData.prototype.isPrototypeOf(body)) {
555
- return "formData";
556
- }
557
-
558
- if (hasArrayBuffer) {
559
- if (hasBlob && isDataView(body)) {
560
- return "dataView";
561
- }
562
-
563
- if (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body)) {
564
- return "arrayBuffer";
565
- }
566
- }
567
-
568
- if (hasSearchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
569
- return "searchParams";
570
- }
571
-
572
- return "";
573
- }; // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#Example
574
-
575
-
576
- var getHeadersFromXHR = function getHeadersFromXHR(xhr) {
577
- var headerMap = {};
578
- var headersString = xhr.getAllResponseHeaders();
579
- if (headersString === "") return headerMap;
580
- var lines = headersString.trim().split(/[\r\n]+/);
581
- lines.forEach(function (line) {
582
- var parts = line.split(": ");
583
- var name = parts.shift();
584
- var value = parts.join(": ");
585
- headerMap[name.toLowerCase()] = value;
586
- });
587
- return headerMap;
588
- };
589
-
590
- var hrefToOrigin = function hrefToOrigin(href) {
591
- var scheme = hrefToScheme(href);
592
-
593
- if (scheme === "file") {
594
- return "file://";
595
- }
596
-
597
- if (scheme === "http" || scheme === "https") {
598
- var secondProtocolSlashIndex = scheme.length + "://".length;
599
- var pathnameSlashIndex = href.indexOf("/", secondProtocolSlashIndex);
600
- if (pathnameSlashIndex === -1) return href;
601
- return href.slice(0, pathnameSlashIndex);
602
- }
603
-
604
- return href.slice(0, scheme.length + 1);
605
- };
606
-
607
- var hrefToScheme = function hrefToScheme(href) {
608
- var colonIndex = href.indexOf(":");
609
- if (colonIndex === -1) return "";
610
- return href.slice(0, colonIndex);
611
- };
612
-
613
- var isDataView = function isDataView(obj) {
614
- return obj && DataView.prototype.isPrototypeOf(obj);
615
- };
616
-
617
- var isArrayBufferView = ArrayBuffer.isView || function () {
618
- var viewClasses = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"];
619
- return function (value) {
620
- return value && viewClasses.includes(Object.prototype.toString.call(value));
621
- };
622
- }();
623
-
624
- var textToFormData = function textToFormData(text) {
625
- var form = new FormData();
626
- text.trim().split("&").forEach(function (bytes) {
627
- if (bytes) {
628
- var split = bytes.split("=");
629
- var name = split.shift().replace(/\+/g, " ");
630
- var value = split.join("=").replace(/\+/g, " ");
631
- form.append(decodeURIComponent(name), decodeURIComponent(value));
632
- }
633
- });
634
- return form;
635
- };
636
-
637
- var blobToArrayBuffer = _async$4(function (blob) {
638
- var reader = new FileReader();
639
- var promise = fileReaderReady(reader);
640
- reader.readAsArrayBuffer(blob);
641
- return promise;
642
- });
643
-
644
- var blobToText = function blobToText(blob) {
645
- var reader = new FileReader();
646
- var promise = fileReaderReady(reader);
647
- reader.readAsText(blob);
648
- return promise;
649
- };
650
-
651
- var arrayBufferToText = function arrayBufferToText(arrayBuffer) {
652
- var view = new Uint8Array(arrayBuffer);
653
- var chars = new Array(view.length);
654
- var i = 0;
655
-
656
- while (i < view.length) {
657
- chars[i] = String.fromCharCode(view[i]);
658
- i++;
659
- }
660
-
661
- return chars.join("");
662
- };
663
-
664
- var fileReaderReady = function fileReaderReady(reader) {
665
- return new Promise(function (resolve, reject) {
666
- reader.onload = function () {
667
- resolve(reader.result);
668
- };
669
-
670
- reader.onerror = function () {
671
- reject(reader.error);
672
- };
673
- });
674
- };
675
-
676
- var cloneBuffer = function cloneBuffer(buffer) {
677
- if (buffer.slice) {
678
- return buffer.slice(0);
679
- }
680
-
681
- var view = new Uint8Array(buffer.byteLength);
682
- view.set(new Uint8Array(buffer));
683
- return view.buffer;
684
- };
685
-
686
- var fetchUsingXHR$1 = /*#__PURE__*/Object.freeze({
687
- __proto__: null,
688
- fetchUsingXHR: fetchUsingXHR
689
- });
690
-
691
- var _excluded = ["mode"];
692
-
693
- function _await$3(value, then, direct) {
694
- if (direct) {
695
- return then ? then(value) : value;
696
- }
697
-
698
- if (!value || !value.then) {
699
- value = Promise.resolve(value);
700
- }
701
-
702
- return then ? value.then(then) : value;
703
- }
704
-
705
- var fetchNative = _async$3(function (url) {
706
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
707
-
708
- var _ref$mode = _ref.mode,
709
- mode = _ref$mode === void 0 ? "cors" : _ref$mode,
710
- options = _objectWithoutProperties(_ref, _excluded);
711
-
712
- return _await$3(window.fetch(url, _objectSpread2({
713
- mode: mode
714
- }, options)), function (response) {
715
- return {
716
- url: response.url,
717
- status: response.status,
718
- statusText: "",
719
- headers: responseToHeaders(response),
720
- text: function text() {
721
- return response.text();
722
- },
723
- json: function json() {
724
- return response.json();
725
- },
726
- blob: function blob() {
727
- return response.blob();
728
- },
729
- arrayBuffer: function arrayBuffer() {
730
- return response.arrayBuffer();
731
- },
732
- formData: function formData() {
733
- return response.formData();
734
- }
735
- };
736
- });
737
- });
738
-
739
- function _async$3(f) {
740
- return function () {
741
- for (var args = [], i = 0; i < arguments.length; i++) {
742
- args[i] = arguments[i];
743
- }
744
-
745
- try {
746
- return Promise.resolve(f.apply(this, args));
747
- } catch (e) {
748
- return Promise.reject(e);
749
- }
750
- };
751
- }
752
-
753
- var responseToHeaders = function responseToHeaders(response) {
754
- var headers = {};
755
- response.headers.forEach(function (value, name) {
756
- headers[name] = value;
757
- });
758
- return headers;
759
- };
760
-
761
- var fetchUrl = typeof window.fetch === "function" && typeof window.AbortController === "function" ? fetchNative : fetchUsingXHR;
762
-
763
- function _await$2(value, then, direct) {
764
- if (direct) {
765
- return then ? then(value) : value;
766
- }
767
-
768
- if (!value || !value.then) {
769
- value = Promise.resolve(value);
770
- }
771
-
772
- return then ? value.then(then) : value;
773
- }
774
-
775
- function _async$2(f) {
776
- return function () {
777
- for (var args = [], i = 0; i < arguments.length; i++) {
778
- args[i] = arguments[i];
779
- }
780
-
781
- try {
782
- return Promise.resolve(f.apply(this, args));
783
- } catch (e) {
784
- return Promise.reject(e);
785
- }
786
- };
787
- }
788
-
789
- var fetchJson = _async$2(function (url) {
790
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
791
- return _await$2(fetchUrl(url, options), function (response) {
792
- return _await$2(response.json());
793
- });
794
- });
795
-
796
- function _await$1(value, then, direct) {
797
- if (direct) {
798
- return then ? then(value) : value;
799
- }
800
-
801
- if (!value || !value.then) {
802
- value = Promise.resolve(value);
803
- }
804
-
805
- return then ? value.then(then) : value;
806
- }
807
-
808
- function _catch(body, recover) {
809
- try {
810
- var result = body();
811
- } catch (e) {
812
- return recover(e);
813
- }
814
-
815
- if (result && result.then) {
816
- return result.then(void 0, recover);
817
- }
818
-
819
- return result;
820
- }
821
-
822
- function _async$1(f) {
823
- return function () {
824
- for (var args = [], i = 0; i < arguments.length; i++) {
825
- args[i] = arguments[i];
826
- }
827
-
828
- try {
829
- return Promise.resolve(f.apply(this, args));
830
- } catch (e) {
831
- return Promise.reject(e);
832
- }
833
- };
834
- }
835
-
836
- var fetchExploringJson = _async$1(function () {
837
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
838
- signal = _ref.signal;
839
-
840
- return _catch(function () {
841
- return _await$1(fetchJson("/.jsenv/exploring.json", {
842
- signal: signal
843
- }));
844
- }, function (e) {
845
- if (signal && signal.aborted && e.name === "AbortError") {
846
- throw e;
847
- }
848
-
849
- throw new Error(createDetailedMessage("Cannot communicate with exploring server due to a network error", _defineProperty({}, "error stack", e.stack)));
850
- });
851
- });
852
-
853
- function _await(value, then, direct) {
854
- if (direct) {
855
- return then ? then(value) : value;
856
- }
857
-
858
- if (!value || !value.then) {
859
- value = Promise.resolve(value);
860
- }
861
-
862
- return then ? value.then(then) : value;
863
- }
864
-
865
- var fetchJSON = _async(function (url, options) {
866
- return _await(fetchUrl$1(url, options), function (response) {
867
- return _await(response.json());
868
- });
869
- });
870
-
871
- function _async(f) {
872
- return function () {
873
- for (var args = [], i = 0; i < arguments.length; i++) {
874
- args[i] = arguments[i];
875
- }
876
-
877
- try {
878
- return Promise.resolve(f.apply(this, args));
879
- } catch (e) {
880
- return Promise.reject(e);
881
- }
882
- };
883
- }
884
-
885
- var groupPreference = createPreference("group");
886
-
887
- function _call(body, then, direct) {
888
- if (direct) {
889
- return then ? then(body()) : body();
890
- }
891
-
892
- try {
893
- var result = Promise.resolve(body());
894
- return then ? result.then(then) : result;
895
- } catch (e) {
896
- return Promise.reject(e);
897
- }
898
- }
899
-
900
- var run = function run() {
901
- return _call(fetchExploringJson, function (_ref) {
902
- var projectDirectoryUrl = _ref.projectDirectoryUrl,
903
- explorableConfig = _ref.explorableConfig,
904
- outDirectoryRelativeUrl = _ref.outDirectoryRelativeUrl;
905
- return _await(fetchJSON("/.jsenv/explorables.json", {
906
- method: "GET"
907
- }), function (files) {
908
- var compileServerOrigin = document.location.origin;
909
- var outDirectoryUrl = String(new URL(outDirectoryRelativeUrl, compileServerOrigin));
910
- var documentUrl = document.location.href;
911
- var compileId;
912
- var outDirectoryIndex = documentUrl.indexOf(outDirectoryUrl);
913
-
914
- if (outDirectoryIndex === 0) {
915
- var afterOutDirectory = documentUrl.slice(outDirectoryUrl.length);
916
- compileId = afterOutDirectory.split("/")[0];
917
- } else {
918
- compileId = null;
919
- }
920
-
921
- var renderHtml = function renderHtml() {
922
- // const mainHtmlFileRelativeUrl = "index.html"
923
- // const mainFileLink = document.querySelector("#main_file_link")
924
- // const mainFileUrl = urlToVisitFromRelativeUrl(mainHtmlFileRelativeUrl)
925
- // mainFileLink.href = mainFileUrl
926
- // mainFileLink.textContent = `${mainHtmlFileRelativeUrl}`
927
- // const mainFileIframe = document.querySelector(`#main_file_iframe`)
928
- // mainFileIframe.src = mainFileUrl
929
- var fileListElement = document.querySelector("[data-page=\"file-list\"]").cloneNode(true);
930
- var directoryName = directoryUrlToDirectoryName(projectDirectoryUrl);
931
- var span = fileListElement.querySelector("#directory_relative_url");
932
- span.title = projectDirectoryUrl;
933
- span.textContent = directoryName;
934
- var h4 = fileListElement.querySelector("h4");
935
- var ul = fileListElement.querySelector("ul");
936
- ul.innerHTML = files.map(function (file) {
937
- return "<li>\n <a\n class=\"execution-link\"\n data-relative-url=".concat(file.relativeUrl, "\n href=").concat(urlToVisitFromRelativeUrl(file.relativeUrl), "\n >\n ").concat(file.relativeUrl, "\n </a>\n </li>");
938
- }).join("");
939
- var groupFieldset = fileListElement.querySelector("#filter-group-set");
940
- var groupNames = Object.keys(explorableConfig);
941
- groupFieldset.innerHTML = groupNames.map(function (key) {
942
- return "<label data-contains-hidden-input class=\"item\">\n <input type=\"radio\" name=\"filter-group\" value=\"".concat(key, "\"/>\n <span>").concat(key, "</span>\n</label>");
943
- }).join("");
944
- var currentGroup = groupPreference.has() ? groupPreference.get() : groupNames[0];
945
- Array.from(groupFieldset.querySelectorAll("input")).forEach(function (inputRadio) {
946
- inputRadio.checked = inputRadio.value === currentGroup;
947
-
948
- inputRadio.onchange = function () {
949
- if (inputRadio.checked) {
950
- groupPreference.set(inputRadio.value);
951
- enableGroup(inputRadio.value);
952
- }
953
- };
954
- });
955
-
956
- var enableGroup = function enableGroup(groupName) {
957
- var arrayOfElementToShow = [];
958
- var arrayOfElementToHide = [];
959
- files.forEach(function (file) {
960
- var fileLink = fileListElement.querySelector("a[data-relative-url=\"".concat(file.relativeUrl, "\"]"));
961
- var fileLi = fileLink.parentNode;
962
-
963
- if (file.meta[groupName]) {
964
- arrayOfElementToShow.push(fileLi);
965
- } else {
966
- arrayOfElementToHide.push(fileLi);
967
- }
968
- });
969
- arrayOfElementToShow.forEach(function (element) {
970
- element.removeAttribute("data-force-hide");
971
- });
972
- arrayOfElementToHide.forEach(function (element) {
973
- element.setAttribute("data-force-hide", "");
974
- });
975
- h4.innerHTML = arrayOfElementToShow.length === 0 ? "No file found.\n Config for this section: <pre>".concat(JSON.stringify(explorableConfig[groupName], null, " "), "</pre>") : "".concat(arrayOfElementToShow.length, " files found. Click on the one you want to execute");
976
- };
977
-
978
- enableGroup(currentGroup);
979
- document.querySelector("main").appendChild(fileListElement);
980
- makeMenuScrollable();
981
- };
982
-
983
- var urlToVisitFromRelativeUrl = function urlToVisitFromRelativeUrl(relativeUrl) {
984
- if (compileId) {
985
- return "".concat(compileServerOrigin, "/").concat(outDirectoryRelativeUrl).concat(compileId, "/").concat(relativeUrl);
986
- }
987
-
988
- return "".concat(compileServerOrigin, "/").concat(relativeUrl);
989
- };
990
-
991
- var makeMenuScrollable = function makeMenuScrollable() {
992
- var getMenuWrapperSize = function getMenuWrapperSize() {
993
- return document.querySelector(".menu-wrapper").getBoundingClientRect().width;
994
- };
995
-
996
- var menuWrapperSize = getMenuWrapperSize();
997
-
998
- var getMenuSize = function getMenuSize() {
999
- return document.querySelector(".menu").getBoundingClientRect().width;
1000
- };
1001
-
1002
- var menuSize = getMenuSize();
1003
- var menuVisibleSize = menuWrapperSize;
1004
- var menuInvisibleSize = menuSize - menuVisibleSize;
1005
-
1006
- var getMenuPosition = function getMenuPosition() {
1007
- return document.querySelector(".menu-wrapper").scrollLeft;
1008
- };
1009
-
1010
- var scrollDuration = 300;
1011
- var leftPaddle = document.querySelector(".left-paddle");
1012
- var rightPaddle = document.querySelector(".right-paddle");
1013
-
1014
- var handleMenuScroll = function handleMenuScroll() {
1015
- menuInvisibleSize = menuSize - menuWrapperSize;
1016
- var menuPosition = getMenuPosition();
1017
- var menuEndOffset = menuInvisibleSize; // show & hide the paddles, depending on scroll position
1018
-
1019
- if (menuPosition <= 0 && menuEndOffset <= 0) {
1020
- // hide both paddles if the window is large enough to display all tabs
1021
- leftPaddle.classList.add("hidden");
1022
- rightPaddle.classList.add("hidden");
1023
- } else if (menuPosition <= 0) {
1024
- leftPaddle.classList.add("hidden");
1025
- rightPaddle.classList.remove("hidden");
1026
- } else if (menuPosition < Math.floor(menuEndOffset)) {
1027
- // show both paddles in the middle
1028
- leftPaddle.classList.remove("hidden");
1029
- rightPaddle.classList.remove("hidden");
1030
- } else if (menuPosition >= Math.floor(menuEndOffset)) {
1031
- leftPaddle.classList.remove("hidden");
1032
- rightPaddle.classList.add("hidden");
1033
- }
1034
- };
1035
-
1036
- handleMenuScroll();
1037
-
1038
- window.onresize = function () {
1039
- menuWrapperSize = getMenuWrapperSize();
1040
- menuSize = getMenuSize();
1041
- handleMenuScroll();
1042
- }; // finally, what happens when we are actually scrolling the menu
1043
-
1044
-
1045
- document.querySelector(".menu-wrapper").onscroll = function () {
1046
- handleMenuScroll();
1047
- }; // scroll to left
1048
-
1049
-
1050
- rightPaddle.onclick = function () {
1051
- var scrollStart = document.querySelector(".menu-wrapper").scrollLeft;
1052
- var scrollEnd = scrollStart + menuWrapperSize;
1053
- startJavaScriptAnimation({
1054
- duration: scrollDuration,
1055
- onProgress: function onProgress(_ref2) {
1056
- var progress = _ref2.progress;
1057
- document.querySelector(".menu-wrapper").scrollLeft = scrollStart + (scrollEnd - scrollStart) * progress;
1058
- }
1059
- });
1060
- }; // scroll to right
1061
-
1062
-
1063
- leftPaddle.onclick = function () {
1064
- var scrollStart = document.querySelector(".menu-wrapper").scrollLeft;
1065
- var scrollEnd = scrollStart - menuWrapperSize;
1066
- startJavaScriptAnimation({
1067
- duration: scrollDuration,
1068
- onProgress: function onProgress(_ref3) {
1069
- var progress = _ref3.progress;
1070
- document.querySelector(".menu-wrapper").scrollLeft = scrollStart + (scrollEnd - scrollStart) * progress;
1071
- }
1072
- });
1073
- };
1074
- };
1075
-
1076
- var directoryUrlToDirectoryName = function directoryUrlToDirectoryName(directoryUrl) {
1077
- var slashLastIndex = directoryUrl.lastIndexOf("/", // ignore last slash
1078
- directoryUrl.length - 2);
1079
- if (slashLastIndex === -1) return "";
1080
- return directoryUrl.slice(slashLastIndex + 1);
1081
- };
1082
-
1083
- renderHtml();
1084
- });
1085
- });
1086
- };
1087
-
1088
- run();
1089
-
1090
- })();
1091
-
1092
- //# sourceMappingURL=jsenv_exploring_index.js.map