Rename entrypoint to main.ts. Tweak text contrast

This commit is contained in:
2026-10-02 13:53:53 +02:00
parent 41c0481380
commit 9a7ed0a347
13 changed files with 19 additions and 27 deletions

View File

@@ -500,7 +500,7 @@ input[type="color"]:active {
/* Selected buttons get the accent colour on a shade of it. The outline shows /* Selected buttons get the accent colour on a shade of it. The outline shows
hover and keyboard focus, so it would be confusing to use it for this too */ hover and keyboard focus, so it would be confusing to use it for this too */
.button_highlight { .button_highlight {
color: var(--accent_color) !important; color: var(--link_color) !important;
background: var(--accent_shade) !important; background: var(--accent_shade) !important;
} }

View File

@@ -36,7 +36,7 @@
{{with .Node}}window.initial_node = {{.}};{{end}} {{with .Node}}window.initial_node = {{.}};{{end}}
</script> </script>
<script src="/res/svelte/wrap.js" type="module"></script> <script src="/res/svelte/main.js" type="module"></script>
</head> </head>
<body></body> <body></body>
</html> </html>

View File

@@ -42,10 +42,10 @@ onMount(() => {
return return
} }
// Custom CSS rules for the whole viewer. The MainMenu applies its // Custom CSS rules for the whole viewer. App.svelte applies its styles
// styles to the <html> element. So we apply to the <body> element, our // to the <html> element. So we apply to the <body> element, our styles
// styles take precedence since they're lower level, and we can clean it // take precedence since they're lower level, and we can clean it up
// up afterwards without overwriting global style // afterwards without overwriting global style
document.body.style = css_from_path(nav.path) document.body.style = css_from_path(nav.path)
update_favicon() update_favicon()
}) })

View File

@@ -239,9 +239,9 @@ const generate_link_color = (link_color: string, body_color: string) => {
// If the body and link colours are both dark we lighten the link, and the // If the body and link colours are both dark we lighten the link, and the
// other way around too // other way around too
if (body[2] < 50 && link[2] < 50) { if (body[2] < 50 && link[2] < 50) {
link[2] = link[2] + 40 // Dark color, add lightness link[2] = link[2] + 30 // Dark color, add lightness
} else if (body[2] > 50 && link[2] > 50) { } else if (body[2] > 50 && link[2] > 50) {
link[2] = link[2] - 40 // Light color, remove lightness link[2] = link[2] - 30 // Light color, remove lightness
} }
return rgb2hex(hsl2rgb(link)) // Convert back to hex return rgb2hex(hsl2rgb(link)) // Convert back to hex
} }

View File

@@ -144,7 +144,7 @@ onMount(() => {
<h2>Tracklist</h2> <h2>Tracklist</h2>
{#each siblings as sibling (sibling.id)} {#each siblings as sibling (sibling.id)}
{#if !sibling.is_hidden()} {#if !sibling.is_hidden()}
<a href={"/d"+fs_encode_path(sibling.path)} class="node" class:playing={sibling.path === $nav.base.path}> <a href={"/d"+fs_encode_path(sibling.path)} class="node" class:button_highlight={sibling.path === $nav.base.path}>
{#if sibling.path === $nav.base.path} {#if sibling.path === $nav.base.path}
<i class="play_arrow icon">play_arrow</i> <i class="play_arrow icon">play_arrow</i>
{:else} {:else}
@@ -185,7 +185,4 @@ onMount(() => {
.play_arrow { .play_arrow {
margin: 4px; margin: 4px;
} }
.playing {
color: var(--accent_color);
}
</style> </style>

View File

@@ -54,7 +54,7 @@ const click = (e: MouseEvent) => {
flex: 0 0 content; flex: 0 0 content;
} }
.on { .on {
color: var(--accent_color); color: var(--link_color);
} }
.off { .off {
color: var(--red_color); color: var(--red_color);

View File

@@ -280,7 +280,7 @@ const submit = async (e: SubmitEvent) => {
<style> <style>
.date { .date {
color: var(--accent_color); color: var(--link_color);
} }
/* layout.css collapses the table borders, which makes the browser ignore any /* layout.css collapses the table borders, which makes the browser ignore any
padding on the table itself. The cells line the table up with the rest of padding on the table itself. The cells line the table up with the rest of

4
svelte/src/main.ts Normal file
View File

@@ -0,0 +1,4 @@
import App from "wrap/App.svelte";
import { mount } from "svelte";
mount(App, { target: document.body });

View File

@@ -18,6 +18,6 @@ let { symbol = "€", amount = 0, precision = 2 }: {
color: var(--red_color); color: var(--red_color);
} }
.positive { .positive {
color: var(--accent_color); color: var(--link_color);
} }
</style> </style>

View File

@@ -1,9 +0,0 @@
import App from './wrap/MainMenu.svelte';
import { mount } from "svelte";
const app = mount(App, {
target: document.body,
props: {}
});
export default app;

View File

@@ -20,10 +20,10 @@ export default defineConfig({
// Compile newer syntax down to what browsers from September 2021 support // Compile newer syntax down to what browsers from September 2021 support
target: ["chrome94", "edge94", "firefox91", "safari15"], target: ["chrome94", "edge94", "firefox91", "safari15"],
rollupOptions: { rollupOptions: {
input: "src/wrap.js", input: "src/main.ts",
// The entrypoint keeps its name so the HTML template can find it, // The entrypoint keeps its name so the HTML template can find it,
// the chunks it imports get a hash in their names // the chunks it imports get a hash in their names
output: { entryFileNames: "wrap.js" }, output: { entryFileNames: "main.js" },
}, },
}, },
plugins: [ plugins: [

View File

@@ -62,7 +62,7 @@ func New(r *httprouter.Router, conf Config) (wc *WebController) {
var resourceHandler = func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { var resourceHandler = func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
// Cache resources for a year. Except the Svelte entrypoint, it keeps its // Cache resources for a year. Except the Svelte entrypoint, it keeps its
// name when it changes. The chunks it imports have a hash in their name // name when it changes. The chunks it imports have a hash in their name
if p.ByName("filepath") == "/svelte/wrap.js" { if p.ByName("filepath") == "/svelte/main.js" {
w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Cache-Control", "no-cache")
} else { } else {
w.Header().Set("Cache-Control", "public, max-age=31536000") w.Header().Set("Cache-Control", "public, max-age=31536000")