Compare commits

...
2 Commits
13 changed files with 63 additions and 30 deletions

No files matched your search

+1 -1
View File
@@ -500,7 +500,7 @@ input[type="color"]:active {
/* 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 */
.button_highlight {
color: var(--accent_color) !important;
color: var(--link_color) !important;
background: var(--accent_shade) !important;
}
+1 -1
View File
@@ -36,7 +36,7 @@
{{with .Node}}window.initial_node = {{.}};{{end}}
</script>
<script src="/res/svelte/wrap.js" type="module"></script>
<script src="/res/svelte/main.js" type="module"></script>
</head>
<body></body>
</html>
+4 -4
View File
@@ -42,10 +42,10 @@ onMount(() => {
return
}
// Custom CSS rules for the whole viewer. The MainMenu applies its
// styles to the <html> element. So we apply to the <body> element, our
// styles take precedence since they're lower level, and we can clean it
// up afterwards without overwriting global style
// Custom CSS rules for the whole viewer. App.svelte applies its styles
// to the <html> element. So we apply to the <body> element, our styles
// take precedence since they're lower level, and we can clean it up
// afterwards without overwriting global style
document.body.style = css_from_path(nav.path)
update_favicon()
})
@@ -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
// other way around too
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) {
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
}
+1 -4
View File
@@ -144,7 +144,7 @@ onMount(() => {
<h2>Tracklist</h2>
{#each siblings as sibling (sibling.id)}
{#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}
<i class="play_arrow icon">play_arrow</i>
{:else}
@@ -185,7 +185,4 @@ onMount(() => {
.play_arrow {
margin: 4px;
}
.playing {
color: var(--accent_color);
}
</style>
+1 -1
View File
@@ -54,7 +54,7 @@ const click = (e: MouseEvent) => {
flex: 0 0 content;
}
.on {
color: var(--accent_color);
color: var(--link_color);
}
.off {
color: var(--red_color);
+1 -1
View File
@@ -280,7 +280,7 @@ const submit = async (e: SubmitEvent) => {
<style>
.date {
color: var(--accent_color);
color: var(--link_color);
}
/* 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
+4
View File
@@ -0,0 +1,4 @@
import App from "wrap/App.svelte";
import { mount } from "svelte";
mount(App, { target: document.body });
+1 -1
View File
@@ -18,6 +18,6 @@ let { symbol = "€", amount = 0, precision = 2 }: {
color: var(--red_color);
}
.positive {
color: var(--accent_color);
color: var(--link_color);
}
</style>
-9
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;
@@ -30,6 +30,15 @@ const min_screen_size_fullscreen_menu = 500
// If the screen is smaller than this the menu will be closed by default
const min_screen_size_menu_open = 800
// The two background glows get a random position on each page load, in percent
// of the viewport. The second one is rerolled until it's at least 40% away from
// the first
const glow = [Math.random() * 100, Math.random() * 100, 0, 0]
do {
glow[2] = Math.random() * 100
glow[3] = Math.random() * 100
} while (Math.hypot(glow[0] - glow[2], glow[1] - glow[3]) < 40)
onMount(async () => {
if (document.documentElement.clientWidth < min_screen_size_menu_open) {
menu_close()
@@ -163,7 +172,13 @@ const set_offset = (off: number) => {
<svelte:window ontouchstart={touchstart} ontouchmove={touchmove} ontouchend={touchend}/>
<div class="wrap">
<div
class="wrap"
style:--glow1_x="{glow[0]}%"
style:--glow1_y="{glow[1]}%"
style:--glow2_x="{glow[2]}%"
style:--glow2_y="{glow[3]}%"
>
<div class="nav_container" bind:this={menu}>
<div class="scroll_container">
<nav class="nav bubble" bind:this={nav}>
@@ -320,8 +335,34 @@ const set_offset = (off: number) => {
position: fixed;
inset: 0;
z-index: -1;
/* Without a branding image there's a faint glow in the accent colour */
background-image: var(--background_image, radial-gradient(ellipse 70% 60% at 15% 0%, color-mix(in srgb, var(--accent_color) 7%, transparent), transparent));
/* Without a branding image there are two faint glows in the accent colour,
at positions which are randomized on each page load */
--glow: color-mix(in srgb, var(--accent_color) 7%, transparent);
/* Browsers don't dither gradients, so the glows show up as bands of a
single colour step each. A tile of black and white noise on top, at an
opacity of two colour steps, hides the edges of the bands */
--noise: url("data:image/svg+xml,\
<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'>\
<filter id='n' color-interpolation-filters='sRGB'>\
<feTurbulence type='fractalNoise' baseFrequency='.9' stitchTiles='stitch'/>\
<feColorMatrix values='4 0 0 0 -1.5 4 0 0 0 -1.5 4 0 0 0 -1.5 0 0 0 0 1'/>\
</filter>\
<rect width='128' height='128' filter='url(%23n)' opacity='.008'/>\
</svg>");
background-image: var(
--background_image,
var(--noise),
radial-gradient(
ellipse 70% 60% at var(--glow1_x) var(--glow1_y),
var(--glow),
transparent
),
radial-gradient(
ellipse 70% 60% at var(--glow2_x) var(--glow2_y),
var(--glow),
transparent
)
);
background-color: var(--background_color);
background-size: var(--background_image_size, initial);
background-position: var(--background_image_position, initial);
+2 -2
View File
@@ -20,10 +20,10 @@ export default defineConfig({
// Compile newer syntax down to what browsers from September 2021 support
target: ["chrome94", "edge94", "firefox91", "safari15"],
rollupOptions: {
input: "src/wrap.js",
input: "src/main.ts",
// The entrypoint keeps its name so the HTML template can find it,
// the chunks it imports get a hash in their names
output: { entryFileNames: "wrap.js" },
output: { entryFileNames: "main.js" },
},
},
plugins: [
+1 -1
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) {
// 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
if p.ByName("filepath") == "/svelte/wrap.js" {
if p.ByName("filepath") == "/svelte/main.js" {
w.Header().Set("Cache-Control", "no-cache")
} else {
w.Header().Set("Cache-Control", "public, max-age=31536000")