refactor(client): get rid of runtime in favor of bootstrap script

This commit is contained in:
Elian Doran 2026-01-07 21:08:19 +02:00
parent ac3ae0dbbe
commit 2e845a9faa
No known key found for this signature in database
3 changed files with 20 additions and 17 deletions

View File

@ -1,9 +1,16 @@
import $ from "jquery";
async function bootstrap() {
(window as any).$ = $;
(window as any).jQuery = $;
await setupGlob();
await loadBootstrapCss();
loadStylesheets();
loadIcons();
setBodyAttributes();
await loadScripts();
hideSplash();
}
async function setupGlob() {
@ -17,6 +24,15 @@ async function setupGlob() {
};
}
async function loadBootstrapCss() {
// We have to selectively import Bootstrap CSS based on text direction.
if (document.body.dir === "rtl") {
await import("bootstrap/dist/css/bootstrap.rtl.min.css");
} else {
await import("bootstrap/dist/css/bootstrap.min.css");
}
}
function loadStylesheets() {
const { assetPath, themeCssUrl, themeUseNextAsBase } = window.glob;
const cssToLoad: string[] = [];
@ -70,7 +86,6 @@ function setBodyAttributes() {
}
async function loadScripts() {
await import("./runtime.js");
if (glob.device === "mobile") {
await import("./mobile.js");
} else {
@ -78,4 +93,8 @@ async function loadScripts() {
}
}
function hideSplash() {
$("body").show();
}
bootstrap();

View File

@ -1,15 +0,0 @@
import $ from "jquery";
async function loadBootstrap() {
if (document.body.dir === "rtl") {
await import("bootstrap/dist/css/bootstrap.rtl.min.css");
} else {
await import("bootstrap/dist/css/bootstrap.min.css");
}
}
(window as any).$ = $;
(window as any).jQuery = $;
await loadBootstrap();
$("body").show();

View File

@ -74,7 +74,6 @@ export default defineConfig(() => ({
login: join(__dirname, "src", "login.ts"),
setup: join(__dirname, "src", "setup.ts"),
set_password: join(__dirname, "src", "set_password.ts"),
runtime: join(__dirname, "src", "runtime.ts"),
print: join(__dirname, "src", "print.tsx")
},
output: {