|
| 1 | +<script context="module"> |
| 2 | + const appStarting = new Promise((resolve) => setTimeout(resolve, 300)); |
| 3 | +</script> |
| 4 | + |
1 | 5 | <script>
|
2 | 6 | import { onDestroy, onMount, createEventDispatcher } from 'svelte';
|
3 | 7 |
|
|
23 | 27 | getLeftEditor,
|
24 | 28 | codeActionProviderDisposable;
|
25 | 29 | const loadingMonaco = loadMonacoEditor();
|
| 30 | + const starting = appStarting; |
26 | 31 | // eslint-disable-next-line no-use-before-define -- TODO
|
27 |
| - $: loading = Promise.all([waiting, loadingMonaco]); |
| 32 | + $: loading = Promise.all([waiting, loadingMonaco, starting]); |
28 | 33 | $: {
|
29 | 34 | if (setLeftValue) {
|
30 | 35 | setLeftValue(code);
|
|
214 | 219 | }
|
215 | 220 | }
|
216 | 221 |
|
217 |
| - function typewriter(node, { speed = 50 }) { |
218 |
| - const valid = |
219 |
| - node.childNodes.length === 0 || |
220 |
| - (node.childNodes.length === 1 && node.childNodes[0].nodeType === Node.TEXT_NODE); |
221 |
| -
|
222 |
| - if (!valid) { |
223 |
| - throw new Error(`This transition only works on elements with a single text node child`); |
224 |
| - } |
225 |
| -
|
226 |
| - const texts = node.textContent.split(/(?=\S)/); |
227 |
| - const duration = texts.length * speed; |
| 222 | + function loadingTypewriter(node) { |
| 223 | + const text = 'Loading...'; |
| 224 | + const duration = 300; |
228 | 225 |
|
229 | 226 | return {
|
230 | 227 | duration,
|
231 | 228 | tick: (t) => {
|
232 |
| - const i = ~~(texts.length * t); |
233 |
| - node.textContent = texts.slice(0, i).join(''); |
| 229 | + const i = ~~(text.length * t); |
| 230 | + node.textContent = text.slice(0, i); |
234 | 231 | }
|
235 | 232 | };
|
236 | 233 | }
|
237 | 234 | </script>
|
238 | 235 |
|
239 | 236 | {#await loading}
|
240 | 237 | {#if started}
|
241 |
| - {#if diffEditor} |
242 |
| - <div |
243 |
| - class="eslint-editor-monaco-root eslint-editor-monaco-root--wait eslint-editor-monaco-root__flex" |
244 |
| - > |
245 |
| - <pre in:typewriter>Loading...</pre> |
246 |
| - <pre in:typewriter>Loading...</pre> |
247 |
| - </div> |
248 |
| - {:else} |
249 |
| - <pre |
250 |
| - class="eslint-editor-monaco-root eslint-editor-monaco-root--wait" |
251 |
| - in:typewriter>Loading...</pre> |
252 |
| - {/if} |
| 238 | + <pre class="eslint-editor-monaco-root eslint-editor-monaco-root--wait" in:loadingTypewriter /> |
253 | 239 | {/if}
|
254 | 240 | {:then _}
|
255 | 241 | <div bind:this={rootElement} class="eslint-editor-monaco-root" />
|
|
270 | 256 | line-height: 21px;
|
271 | 257 | padding-left: 52px;
|
272 | 258 | }
|
273 |
| - .eslint-editor-monaco-root__flex { |
274 |
| - display: flex; |
275 |
| - } |
276 |
| - .eslint-editor-monaco-root__flex > * { |
277 |
| - height: 100%; |
278 |
| - width: 50%; |
279 |
| - } |
280 | 259 | </style>
|
0 commit comments