Skip to content

Commit fc1d293

Browse files
André DietrichAndré Dietrich
authored andcommitted
update initial load
1 parent 8fed2cc commit fc1d293

3 files changed

Lines changed: 20 additions & 52 deletions

File tree

src/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,9 @@
4848

4949
<body>
5050
<noscript> This page requires JavaScript to be enabled! </noscript>
51+
<div id="app-loader" style="display:flex;align-items:center;justify-content:center;height:100vh;background:#fff">
52+
<div style="width:48px;height:48px;border:5px solid #dee2e6;border-top-color:#0d6efd;border-radius:50%;animation:lia-spin 0.8s linear infinite"></div>
53+
</div>
54+
<style>@keyframes lia-spin{to{transform:rotate(360deg)}}</style>
5155
</body>
5256
</html>

src/index.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ import { createApp } from 'vue'
1717
},
1818
}
1919

20-
import Index from './views/Index.vue'
21-
import Edit from './views/Edit.vue'
22-
import File from './views/File.vue'
23-
import Zip from './views/Zip.vue'
24-
import GitHubExporter from './views/Export/GitHub.vue'
2520
import AudioRecorder from 'vue3-mic-recorder'
2621
import { randomString } from './ts/utils'
2722

@@ -74,32 +69,32 @@ const router = async () => {
7469
}
7570

7671
const routes = [
77-
{ path: '/', view: Index },
72+
{ path: '/', view: () => import('./views/Index.vue') },
7873
{ path: '/edit', redirect: '?/edit/' + randomString(24) },
79-
{ path: '/edit/:storageId/:connection', view: Edit },
80-
{ path: '/edit/:storageId', view: Edit },
74+
{ path: '/edit/:storageId/:connection', view: () => import('./views/Edit.vue') },
75+
{ path: '/edit/:storageId', view: () => import('./views/Edit.vue') },
8176
{
8277
path: '/embed/code/edit/:zipCode',
83-
view: Zip,
78+
view: () => import('./views/Zip.vue'),
8479
params: { embed: true, mode: -1 },
8580
},
8681
{
8782
path: '/embed/code/preview/:zipCode',
88-
view: Zip,
83+
view: () => import('./views/Zip.vue'),
8984
params: { embed: true, mode: 1 },
9085
},
91-
{ path: '/embed/code/:zipCode', view: Zip, params: { embed: true } },
92-
{ path: '/embed/file/:fileUrl', view: File, params: { embed: true } },
86+
{ path: '/embed/code/:zipCode', view: () => import('./views/Zip.vue'), params: { embed: true } },
87+
{ path: '/embed/file/:fileUrl', view: () => import('./views/File.vue'), params: { embed: true } },
9388

94-
{ path: '/show/code/:zipCode', view: Zip },
95-
{ path: '/show/file/:fileUrl', view: File },
89+
{ path: '/show/code/:zipCode', view: () => import('./views/Zip.vue') },
90+
{ path: '/show/file/:fileUrl', view: () => import('./views/File.vue') },
9691
{
9792
path: '/export/github/&code=:code&state=:stepId2',
98-
view: GitHubExporter,
93+
view: () => import('./views/Export/GitHub.vue'),
9994
},
10095
{
10196
path: '/export/github/:stepId1',
102-
view: GitHubExporter,
97+
view: () => import('./views/Export/GitHub.vue'),
10398
},
10499
]
105100

@@ -131,11 +126,12 @@ const router = async () => {
131126
}
132127

133128
const params = getParams(match)
134-
const view = match.route.view as any
129+
const loader = match.route.view as () => Promise<{ default: any }>
135130

136131
app?.unmount()
137132

138-
app = createApp(view, params)
133+
const ViewModule = await loader()
134+
app = createApp(ViewModule.default, params)
139135
app.use(AudioRecorder)
140136

141137
app.mount(document.body)

src/views/LiaScript.vue

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,12 @@ import JSZip from "jszip";
1313
import { Splitpanes, Pane } from "splitpanes";
1414
import "splitpanes/dist/splitpanes.css";
1515
16+
import { defineAsyncComponent } from "vue";
1617
import { LiaScriptURL } from "../ts/utils";
17-
import NostrModal from "./Export/Nostr.vue";
18-
19-
// @ts-ignore
20-
// import JSONWorker from "url:monaco-editor/esm/vs/language/json/json.worker.js";
21-
// @ts-ignore
22-
// import CSSWorker from "url:monaco-editor/esm/vs/language/css/css.worker.js";
23-
// @ts-ignore
24-
// import HTMLWorker from "url:monaco-editor/esm/vs/language/html/html.worker.js";
25-
// @ts-ignore
26-
// import TSWorker from "url:monaco-editor/esm/vs/language/typescript/ts.worker.js";
27-
// @ts-ignore
28-
import EditorWorker from "url:monaco-editor/esm/vs/editor/editor.worker.js";
29-
import { editor } from "monaco-editor";
18+
const NostrModal = defineAsyncComponent(() => import("./Export/Nostr.vue"));
3019
3120
import logoImg from "url:../../assets/logo.png";
3221
33-
// @ts-ignore
34-
window.MonacoEnvironment = {
35-
getWorkerUrl: function (moduleId, label) {
36-
/*
37-
if (label === "json") {
38-
return JSONWorker;
39-
}
40-
if (label === "css" || label === "scss" || label === "less") {
41-
return CSSWorker;
42-
}
43-
if (label === "html" || label === "handlebars" || label === "razor") {
44-
return HTMLWorker;
45-
}
46-
if (label === "typescript" || label === "javascript") {
47-
return TSWorker;
48-
}
49-
*/
50-
return EditorWorker;
51-
},
52-
};
53-
5422
export default {
5523
name: "LiaScript",
5624

0 commit comments

Comments
 (0)