feat: mobile UX overhaul, theme flash prevention and build cleanup (#474)

* feat: mobile UX overhaul, theme flash prevention and build cleanup

UI/UX (mostly mobile):
- Prevent white flash on load: pre-paint inline style + script in
  index.html applies the persisted theme before first paint.
- Match browser chrome to the app background: theme-color meta kept in
  sync for Android/older iOS, and body background pinned to the Layout
  color for Safari 26+, which ignores theme-color and samples the page.
- Make the document the app's scroller instead of n-layout's nested
  container: single scrollbar, native iOS tap-status-bar-to-scroll-top,
  natural toolbar collapsing; desktop sider becomes sticky and router
  scrollBehavior restores/resets scroll on navigation.
- Full-width mobile menu that fades in under an always-visible sticky
  top bar, seamless app background without the hero gradient, closes on
  navigation (including About while already on /about), scroll-locked
  behind, symmetric spacing around the title block and icon row.
- Language selector and theme toggle become icon dropdowns; theme
  supports System/Light/Dark via useColorMode (same storage as before).
- Route-change loading spinner scoped to the page area so the nav bar
  stays visible; spinner remains cosmetic-only (350ms delay).
- Halve content padding on small screens; reduce home top padding.
- Full-width expand/collapse tools button so its width doesn't jump.
- No sticky hover styles on touch devices (hover gated behind
  @media (hover: hover)).

Build:
- Rename deprecated rolldown output.advancedChunks to codeSplitting.
- Fix unocss 'unmatched utility' warnings in the pretty-scrollbar
  shortcut; override js-sha256 to 0.11.x (drops eval); bump
  javascript-obfuscator to 5.4.6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNayL5ianBBucVapfkM8CC

* Remove unnecessary comment

* Refresh lockfile, remove releaseage ignore

Signed-off-by: Sebastian Danielsson <sebastian.danielsson@proton.me>

* chore: remove unused LocaleSelector component

Language selection moved into the NavbarButtons dropdown; nothing
references this component anymore. Its i18n keys are left in place.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNayL5ianBBucVapfkM8CC

---------

Signed-off-by: Sebastian Danielsson <sebastian.danielsson@proton.me>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
SebastianandClaude Fable 5 authored and GitHub committed 2026-07-11 23:21:34 +02:00
1 parent 74604235ad
commit 239c69ee40
20 files changed
+394 -116

No files matched your search

+19 -1
View File
@@ -2,6 +2,25 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="theme-color" content="#f1f5f9" />
<style>
html { color-scheme: light; }
html.dark { color-scheme: dark; }
html, body { background-color: #f1f5f9; }
html.dark, html.dark body { background-color: #1c1c1c; }
</style>
<script>
(function () {
try {
var mode = localStorage.getItem('vueuse-color-scheme') || 'auto';
if (mode === 'dark' || (mode === 'auto' && matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#1c1c1c');
}
}
catch (e) {}
})();
</script>
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>IT Tools - Handy online tools for developers</title>
@@ -14,7 +33,6 @@
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#18a058" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
<meta property="og:url" content="https://sharevb-it-tools.vercel.app/" />
<meta property="og:type" content="website" />
+4
View File
@@ -114,6 +114,10 @@ home:
lightMode: Light mode
mode: Toggle dark/light mode
aboutLabel: About
language: Language
themeSystem: System
themeLight: Light
themeDark: Dark
page:
text:
collection-of-handy-online-tools-for-developers-with-great-ux-it-tools-is-a-free-and-open-source-collection-of-handy-online-tools-for-developers-and-people-working-in-it: >-
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "it-tools",
"type": "module",
"version": "2026.1.4",
"packageManager": "pnpm@11.10.0+sha512.0b7f8b98060031904c017e3a41eb187a16d40eeb829b95c4f8cb03681761fc4ab53dd219115b9b447f4dce1a05a214764461e7d3703392a9f32f9511ce8c86c8",
"packageManager": "pnpm@11.11.0+sha512.4463f65fd80ed80d69bc1d4bf163ee94f605c7380fc318bb5b2ebe15f8cd12d49c51a4d59e951b401e764d3b6ca751cbf51bc50ed7001a6bcb4935e684c34882",
"description": "Collection of handy online tools for developers, with great UX. ",
"author": "Corentin Th <corentin.thomasset74+it-tools@gmail.com> (https://corentin.tech)",
"license": "GNU GPLv3",
@@ -238,7 +238,7 @@
"isbn3": "^2.0.2",
"iso-639-1": "^3.1.5",
"jasypt": "^1.0.7",
"javascript-obfuscator": "^5.1.0",
"javascript-obfuscator": "^5.4.6",
"javastack.js": "^1.0.3",
"jks-js": "^1.1.4",
"jose": "5.10.0",
+14 -13
View File
@@ -9,6 +9,7 @@ overrides:
isolated-vm: file:./stubs/empty-stub
onnxruntime-node: file:./stubs/empty-stub
elliptic: ^6.6.1
js-sha256: ^0.11.1
xlsx: https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
patchedDependencies:
@@ -600,8 +601,8 @@ importers:
specifier: ^1.0.7
version: 1.0.7
javascript-obfuscator:
specifier: ^5.1.0
version: 5.4.3
specifier: ^5.4.6
version: 5.4.6
javastack.js:
specifier: ^1.0.3
version: 1.0.3
@@ -2664,8 +2665,8 @@ packages:
'@it-tools/oggen@1.3.0':
resolution: {integrity: sha512-hvPn0mDkbJvA6jDxV3Xw+MIermq+QyrQpUq86KkZXaWLfCIDnLVp3hBmdxpxU4NIckXj5/7eeVg5CvW0kpQBTw==}
'@javascript-obfuscator/escodegen@2.4.1':
resolution: {integrity: sha512-YrEJJDr4cb+pIQKWzHFoDlDkQzatcrNB6OhAD6iTSwiKwzZUMVdobwbOuLpF4EiLxUj0qP28Xl1saTHYzIPCLg==}
'@javascript-obfuscator/escodegen@2.4.2':
resolution: {integrity: sha512-3N7EUdYxuldwvtOtZIlAxNwPW1qTUFwWt3PxNkik6hB1uSSXLXj9JMlSyUbTCXK3Osjn0Nu0s/aa4mbvkGouXQ==}
engines: {node: '>=6.0'}
'@javascript-obfuscator/estraverse@5.4.0':
@@ -7900,8 +7901,8 @@ packages:
javascript-natural-sort@0.7.1:
resolution: {integrity: sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==}
javascript-obfuscator@5.4.3:
resolution: {integrity: sha512-G5WUgh84tJa5jtk49w+nQCxQpXIvp65xhLyaFeTAdQeYqWji+SXo89k96UvYIDqojyWZEWSDKRmaWKK6bBn/2A==}
javascript-obfuscator@5.4.6:
resolution: {integrity: sha512-AkcObe46EfyF3nMUB9tSNgf612IN00gA+RhD7T5JL4vIdCfMtK+gZznl2niI5dwiwYUUfdBVjfctjHbePnz3rQ==}
engines: {node: '>=18.0.0'}
hasBin: true
@@ -7956,8 +7957,8 @@ packages:
js-cookie@3.0.8:
resolution: {integrity: sha512-yeJd4aNAdYZQjaon2bpD/Gb0B/omw7HQOsynXXcOiWVCacbBcPlgn8S/d1X6blFSaHao7ozqtW7NZW19xpCtIw==}
js-sha256@0.9.0:
resolution: {integrity: sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==}
js-sha256@0.11.1:
resolution: {integrity: sha512-o6WSo/LUvY2uC4j7mO50a2ms7E/EAdbP0swigLV+nzHKTTaYnaLIWJ02VdXrsJX0vGedDESQnLsOekr94ryfjg==}
js-string-escape@1.0.1:
resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==}
@@ -13036,12 +13037,12 @@ snapshots:
'@it-tools/bip39@0.0.4':
dependencies:
js-sha256: 0.9.0
js-sha256: 0.11.1
nanoid: 3.3.15
'@it-tools/oggen@1.3.0': {}
'@javascript-obfuscator/escodegen@2.4.1':
'@javascript-obfuscator/escodegen@2.4.2':
dependencies:
'@javascript-obfuscator/estraverse': 5.4.0
esprima: 4.0.1
@@ -18546,9 +18547,9 @@ snapshots:
javascript-natural-sort@0.7.1: {}
javascript-obfuscator@5.4.3:
javascript-obfuscator@5.4.6:
dependencies:
'@javascript-obfuscator/escodegen': 2.4.1
'@javascript-obfuscator/escodegen': 2.4.2
'@javascript-obfuscator/estraverse': 5.4.0
'@vercel/blob': 2.5.0
acorn: 8.15.0
@@ -18632,7 +18633,7 @@ snapshots:
js-cookie@3.0.8: {}
js-sha256@0.9.0: {}
js-sha256@0.11.1: {}
js-string-escape@1.0.1: {}
+3
View File
@@ -13,6 +13,9 @@ overrides:
isolated-vm: file:./stubs/empty-stub
onnxruntime-node: file:./stubs/empty-stub
elliptic: ^6.6.1
# @it-tools/bip39 pins ^0.9.0, whose Node fallback uses eval("require('crypto')")
# and triggers rolldown EVAL build warnings; 0.11.x dropped the eval.
js-sha256: ^0.11.1
xlsx: https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
patchedDependencies:
+18 -5
View File
@@ -78,6 +78,8 @@ body {
min-height: 100%;
margin: 0;
padding: 0;
/* The document scrolls vertically (see MenuLayout.vue); never horizontally */
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
}
@@ -85,10 +87,10 @@ body {
box-sizing: border-box;
}
/* No transform/contain here: they would make .app-root the containing block
for position:fixed descendants (the mobile menu), and the old inner-scroll
perf rationale no longer applies now that the document is the scroller. */
.app-root {
contain: layout style paint;
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-overflow-scrolling: touch;
}
@@ -97,13 +99,24 @@ body .vld-container {
left: 0;
top: 0;
width: 100%;
height: 100vh;
background-color: var(--loading-background-color);
z-index: 9999;
text-align: center;
pointer-events: none;
}
/* Fullscreen fallback: overlay mounted on <body> (first navigation) */
body > .vld-container {
height: 100vh;
z-index: 9999;
}
/* Route-change overlay scoped to the page area (see router.ts) */
.page-content > .vld-container {
height: 100%;
min-height: 350px;
z-index: 100;
}
body .vld-container.vl-active {
pointer-events: auto;
}
+18 -9
View File
@@ -139,8 +139,10 @@ const themeVars = useThemeVars();
</script>
<template>
<div class="top-controls" mb-12px ml-12px>
<c-button :disabled="isToggling" @click="toggleAllCategories">
<!-- Full width: the label changes between expand/collapse, and a
hug-content button would jump in width on every toggle -->
<div class="top-controls" mb-12px mx-12px>
<c-button w-full :disabled="isToggling" @click="toggleAllCategories">
<span v-if="isToggling">
{{ areAllCollapsed ? $t('collapsibleToolMenu.text.expanding') : $t('collapsibleToolMenu.text.collapsing') }}
</span>
@@ -198,9 +200,12 @@ const themeVars = useThemeVars();
text-align: left;
user-select: none;
&:hover {
background-color: v-bind('themeVars.buttonColor2Hover');
opacity: 0.8;
// Hover only on hover-capable devices; on touch it sticks after tapping
@media (hover: hover) {
&:hover {
background-color: v-bind('themeVars.buttonColor2Hover');
opacity: 0.8;
}
}
&.category-active {
@@ -208,8 +213,10 @@ const themeVars = useThemeVars();
opacity: 1;
color: white;
&:hover {
background-color: color-mix(in srgb, v-bind('themeVars.primaryColorHover') 50%, transparent);
@media (hover: hover) {
&:hover {
background-color: color-mix(in srgb, v-bind('themeVars.primaryColorHover') 50%, transparent);
}
}
}
}
@@ -264,8 +271,10 @@ const themeVars = useThemeVars();
left: 14px;
}
&:hover {
opacity: 0.5;
@media (hover: hover) {
&:hover {
opacity: 0.5;
}
}
}
}
+4 -2
View File
@@ -48,8 +48,10 @@ const { icon, title } = toRefs(props);
font-weight: bold;
transition: color ease 0.2s;
&:hover {
color: rgb(20, 20, 20);
@media (hover: hover) {
&:hover {
color: rgb(20, 20, 20);
}
}
}
}
+98 -13
View File
@@ -1,6 +1,8 @@
<script setup lang="ts">
import { useThemeVars } from 'naive-ui';
import { useStyleStore } from '@/stores/style.store';
const themeVars = useThemeVars();
const styleStore = useStyleStore();
const { isMenuCollapsed, isSmallScreen } = toRefs(styleStore);
const siderPosition = computed(() => (isSmallScreen.value ? 'absolute' : 'static'));
@@ -26,7 +28,34 @@ onUnmounted(() => {
// Use 12.5% of window width, but ensure it's at least 240px
const siderContentWidth = computed(() => Math.max(240, windowWidth.value * 0.125));
const siderWidth = computed(() => (isMenuCollapsed.value ? 0 : siderContentWidth.value));
// Small screens: the menu is a full-width panel below the top bar that fades
// in/out (see styles below) instead of naive-ui's width-collapse, which
// re-lays-out the page on every animation frame.
const siderWidth = computed(() => {
if (isSmallScreen.value) {
return windowWidth.value;
}
return isMenuCollapsed.value ? 0 : siderContentWidth.value;
});
const siderCollapsed = computed(() => (isSmallScreen.value ? false : isMenuCollapsed.value));
const isDrawerOpen = computed(() => isSmallScreen.value && !isMenuCollapsed.value);
// Native-drawer touch: lock the page scroll while the drawer is open
watchEffect(() => {
document.body.style.overflow = isDrawerOpen.value ? 'hidden' : '';
});
// Close the menu when navigating (tool links, the about button, ...) so the
// destination page is visible.
const route = useRoute();
watch(() => route.path, () => {
if (isSmallScreen.value) {
isMenuCollapsed.value = true;
}
});
onUnmounted(() => {
document.body.style.overflow = '';
});
// The scroll container is pinned to the expanded width so the sider width
// transition clips the menu instead of re-wrapping every item on each frame.
@@ -40,16 +69,16 @@ const siderContentWidthPx = computed(() => `${siderContentWidth.value}px`);
collapse-mode="width"
:collapsed-width="0"
:width="siderWidth"
:collapsed="isMenuCollapsed"
:collapsed="siderCollapsed"
:show-trigger="false"
:native-scrollbar="false"
:position="siderPosition"
:class="{ 'drawer-open': isDrawerOpen }"
>
<slot name="sider" />
</n-layout-sider>
<n-layout class="content">
<slot name="content" />
<div v-show="isSmallScreen && !isMenuCollapsed" class="overlay" @click="isMenuCollapsed = true" />
</n-layout>
</n-layout>
</template>
@@ -62,24 +91,80 @@ const siderContentWidthPx = computed(() => `${siderContentWidth.value}px`);
}
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #00000080;
cursor: pointer;
}
.content {
// background-color: #f1f5f9;
::v-deep(.n-layout-scroll-container) {
padding: 26px;
// Same breakpoint as styleStore.isSmallScreen
@media (max-width: 700px) {
padding: 13px;
}
}
}
// The document is the app's scroller: layouts grow with their content instead
// of scrolling in a nested container. A single scrollbar, and native behaviors
// (iOS tap-status-bar-to-scroll-to-top, toolbar collapsing) just work.
.n-layout {
height: auto;
min-height: 100vh;
min-height: 100dvh;
overflow: visible;
::v-deep(> .n-layout-scroll-container) {
height: auto;
min-height: 100vh;
min-height: 100dvh;
overflow: visible;
}
}
// The sider keeps its own internal menu scrollbar, pinned to the viewport
// while the document scrolls.
.n-layout-sider {
position: sticky;
top: 0;
align-self: flex-start;
height: 100vh;
height: 100dvh;
// Small screens: full-width panel fixed below the always-visible top bar
// (height exposed by base.layout.vue), fading in/out quickly. Seamless with
// the page: same background as the app, no side border.
&.n-layout-sider--absolute-positioned {
position: fixed;
top: var(--app-topbar-height, 56px);
bottom: auto;
height: calc(100dvh - var(--app-topbar-height, 56px));
z-index: 15;
background-color: v-bind('themeVars.bodyColor');
opacity: 0;
visibility: hidden;
transition:
opacity 0.2s ease,
visibility 0s 0.2s;
&.drawer-open {
opacity: 1;
visibility: visible;
transition: opacity 0.2s ease;
}
// Full-width menu content instead of the pinned desktop width
::v-deep(.n-scrollbar-content) {
width: 100%;
}
// The menu's own scroll shouldn't chain to the page behind it
::v-deep(.n-scrollbar-container) {
overscroll-behavior: contain;
}
// No side border on a full-width panel
::v-deep(.n-layout-sider__border) {
display: none;
}
}
}
</style>
+84 -7
View File
@@ -1,12 +1,83 @@
<script setup lang="ts">
import type { Component } from 'vue';
import { NIcon, useThemeVars } from 'naive-ui';
import IconBrandGithub from '~icons/tabler/brand-github';
import IconCheck from '~icons/tabler/check';
import IconDeviceDesktop from '~icons/tabler/device-desktop';
import IconInfoCircle from '~icons/tabler/info-circle';
import IconLanguage from '~icons/tabler/language';
import IconMoon from '~icons/tabler/moon';
import IconSun from '~icons/tabler/sun';
import { appLocales } from '@/plugins/i18n.plugin';
import { useStyleStore } from '@/stores/style.store';
const styleStore = useStyleStore();
const { isDarkTheme } = toRefs(styleStore);
const { isDarkTheme, themeMode } = toRefs(styleStore);
const themeVars = useThemeVars();
const { locale, t } = useI18n();
const localesLong: Record<string, string> = {
en: 'English',
de: 'Deutsch',
da: 'Dansk',
es: 'Español',
fr: 'Français',
ga: 'Gaeilge',
it: 'Italiano',
nl: 'Nederlands',
no: 'Norwegian',
pl: 'Polski',
pt: 'Português',
ru: 'Русский',
tr: 'Türkçe',
el: 'ελληνικά',
uk: 'Українська',
ko: '한국인',
zh: '中文',
vi: 'Tiếng Việt',
ar: 'عربي',
};
function renderIcon(icon: Component) {
return () => h(NIcon, null, { default: () => h(icon) });
}
function optionLabel(text: string, isActive: boolean) {
return () => h('span', { style: isActive ? { color: themeVars.value.primaryColor } : {} }, text);
}
const languageOptions = computed(() =>
appLocales.map(availableLocale => ({
key: availableLocale,
label: optionLabel(localesLong[availableLocale] ?? availableLocale, availableLocale === locale.value),
icon: availableLocale === locale.value ? renderIcon(IconCheck) : undefined,
})),
);
function onLanguageSelect(key: string) {
locale.value = key;
}
const themeOptions = computed(() => [
{ key: 'auto', label: optionLabel(t('home.nav.themeSystem', 'System'), themeMode.value === 'auto'), icon: renderIcon(IconDeviceDesktop) },
{ key: 'light', label: optionLabel(t('home.nav.themeLight', 'Light'), themeMode.value === 'light'), icon: renderIcon(IconSun) },
{ key: 'dark', label: optionLabel(t('home.nav.themeDark', 'Dark'), themeMode.value === 'dark'), icon: renderIcon(IconMoon) },
]);
const themeTriggerIcon = computed(() => (isDarkTheme.value ? IconMoon : IconSun));
function onThemeSelect(key: 'auto' | 'light' | 'dark') {
styleStore.themeMode = key;
}
// The mobile menu closes on navigation (MenuLayout watches the route), but
// clicking About while already on /about doesn't navigate — close explicitly.
function closeMenuOnSmallScreen() {
if (styleStore.isSmallScreen) {
styleStore.isMenuCollapsed = true;
}
}
</script>
<template>
@@ -24,16 +95,22 @@ const { isDarkTheme } = toRefs(styleStore);
</c-tooltip>
<c-tooltip :tooltip="$t('home.nav.about')" position="bottom">
<c-button circle variant="text" to="/about" :aria-label="$t('home.nav.aboutLabel')">
<c-button circle variant="text" to="/about" :aria-label="$t('home.nav.aboutLabel')" @click="closeMenuOnSmallScreen">
<n-icon size="25" :component="IconInfoCircle" />
</c-button>
</c-tooltip>
<c-tooltip :tooltip="isDarkTheme ? $t('home.nav.lightMode') : $t('home.nav.darkMode')" position="bottom">
<c-button circle variant="text" :aria-label="$t('home.nav.mode')" @click="() => styleStore.toggleDark()">
<n-icon v-if="isDarkTheme" size="25" :component="IconSun" />
<n-icon v-else size="25" :component="IconMoon" />
<n-dropdown :options="themeOptions" trigger="click" @select="onThemeSelect">
<c-button circle variant="text" :aria-label="t('home.nav.mode')">
<n-icon size="25" :component="themeTriggerIcon" />
</c-button>
</c-tooltip>
</n-dropdown>
<n-dropdown :options="languageOptions" trigger="click" @select="onLanguageSelect">
<c-button circle variant="text" :aria-label="t('home.nav.language', 'Language')">
<n-icon size="25" :component="IconLanguage" />
</c-button>
</n-dropdown>
</template>
<style lang="less" scoped>
+63 -10
View File
@@ -19,6 +19,14 @@ const styleStore = useStyleStore();
const version = config.app.version;
const commitSha = config.app.lastCommitSha.slice(0, 7);
// Expose the navbar height so the mobile menu (MenuLayout.vue) can position
// itself right under the always-visible top bar.
const navbarRef = ref<HTMLElement | null>(null);
const { height: navbarHeight } = useElementSize(navbarRef, undefined, { box: 'border-box' });
watchEffect(() => {
document.documentElement.style.setProperty('--app-topbar-height', `${Math.round(navbarHeight.value)}px`);
});
const { t } = useI18n();
const toolStore = useToolStore();
@@ -47,12 +55,8 @@ const tools = computed<ToolCategory[]>(() => [
</RouterLink>
<div class="sider-content">
<div v-if="styleStore.isSmallScreen" flex flex-col items-center>
<locale-selector w="90%" />
<div flex justify-center>
<NavbarButtons />
</div>
<div v-if="styleStore.isSmallScreen" mb-24px flex justify-center>
<NavbarButtons />
</div>
<CollapsibleToolMenu :tools-by-category="tools" />
@@ -88,7 +92,7 @@ const tools = computed<ToolCategory[]>(() => [
</template>
<template #content>
<div flex items-center justify-center gap-2>
<div ref="navbarRef" class="navbar" flex items-center justify-center gap-2>
<c-button
circle
variant="text"
@@ -112,8 +116,6 @@ const tools = computed<ToolCategory[]>(() => [
<command-palette />
<locale-selector v-if="!styleStore.isSmallScreen" />
<div>
<NavbarButtons v-if="!styleStore.isSmallScreen" />
</div>
@@ -132,7 +134,11 @@ const tools = computed<ToolCategory[]>(() => [
</c-button>
</c-tooltip>
</div>
<slot />
<!-- Positioned wrapper so the route-change loading overlay (see router.ts)
can cover just the page, leaving the nav bar and menu visible. -->
<div class="page-content">
<slot />
</div>
</template>
</MenuLayout>
</template>
@@ -172,6 +178,30 @@ const tools = computed<ToolCategory[]>(() => [
.sider-content {
padding-top: 20px;
padding-bottom: 50px;
@media (max-width: 700px) {
// The hero block above provides the symmetric 24px gap
padding-top: 0;
}
}
.page-content {
position: relative;
}
// Mobile: the top bar stays visible while scrolling, and the full-width menu
// (see MenuLayout.vue) opens right under it.
.navbar {
@media (max-width: 700px) {
position: sticky;
top: 0;
z-index: 20;
// Bleed over the scroll container's 13px padding so content scrolls
// under an opaque, full-width bar.
margin: -13px -13px 13px;
padding: 13px;
background-color: v-bind('themeVars.bodyColor');
}
}
.hero-wrapper {
@@ -218,5 +248,28 @@ const tools = computed<ToolCategory[]>(() => [
font-size: 16px;
}
}
// Mobile: seamless full-width menu — no green hero gradient, text follows
// the theme, and the header scrolls with the menu. Placed after the base
// rules above so these override them (same specificity, later source order).
@media (max-width: 700px) {
position: static;
height: auto;
// Symmetric spacing above and below the title block (sider-content's
// top padding is removed on mobile to keep the bottom gap equal)
padding: 24px 0;
// The hero is a router link; keep the plain-text look without the gradient
text-decoration: none;
.gradient {
display: none;
}
.text-wrapper {
position: static;
padding-top: 0;
color: v-bind('themeVars.textColor1');
}
}
}
</style>
@@ -1,43 +0,0 @@
<script setup lang="ts">
import { appLocales } from '@/plugins/i18n.plugin';
const { locale, t } = useI18n();
const localesLong: Record<string, string> = {
en: 'English',
de: 'Deutsch',
da: 'Dansk',
es: 'Español',
fr: 'Français',
ga: 'Gaeilge',
it: 'Italiano',
nl: 'Nederlands',
no: 'Norwegian',
pl: 'Polski',
pt: 'Português',
ru: 'Русский',
tr: 'Türkçe',
el: 'ελληνικά',
uk: 'Українська',
ko: '한국인',
zh: '中文',
vi: 'Tiếng Việt',
ar: 'عربي',
};
const localeOptions = computed(() =>
appLocales.map(locale => ({
label: localesLong[locale] ?? locale,
value: locale,
})),
);
</script>
<template>
<c-select
v-model:value="locale"
:options="localeOptions"
:placeholder="t('locale-selector.select-a-language')"
w-100px
/>
</template>
+9 -1
View File
@@ -126,7 +126,7 @@ onUnmounted(() => {
</script>
<template>
<div class="pt-50px">
<div class="home-content pt-50px">
<div class="grid-wrapper">
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
<ColoredCard v-if="config.showBanner" :title="$t('home.follow.title')" :icon="IconHeart">
@@ -198,6 +198,14 @@ onUnmounted(() => {
</template>
<style scoped lang="less">
// The 50px top spacing is a desktop nicety; on mobile it pushes the content
// too far below the top bar.
.home-content {
@media (max-width: 700px) {
padding-top: 0;
}
}
.height-enter-active,
.height-leave-active {
transition: all 0.5s ease-in-out;
+14
View File
@@ -29,6 +29,15 @@ const toolsRedirectRoutes = tools
const router = createRouter({
history: createWebHistory(config.app.baseUrl),
// The document is the app's scroller (see MenuLayout.vue)
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
}
if (to.path !== from.path) {
return { top: 0 };
}
},
routes: [
{
path: '/',
@@ -59,8 +68,13 @@ router.beforeEach((to, from) => {
if (to.path !== from.path) {
const theme = useAppTheme();
loaderTimeoutId = setTimeout(() => {
// Scope the overlay to the routed page so the nav bar and menu stay
// visible; on the very first navigation the layout isn't mounted yet
// and the overlay falls back to fullscreen.
const pageContainer = document.querySelector<HTMLElement>('.page-content');
loader = $loading?.show({
color: theme.value.primary.color,
...(pageContainer ? { container: pageContainer } : {}),
});
}, 350);
}
+20 -4
View File
@@ -1,18 +1,34 @@
import { useDark, useMediaQuery, useToggle } from '@vueuse/core';
import { useColorMode, useMediaQuery, usePreferredDark } from '@vueuse/core';
import { defineStore } from 'pinia';
import { type Ref, watch } from 'vue';
import { type Ref, computed, watch } from 'vue';
import { useITStorage } from '@/composable/queryParams';
import { darkThemeOverrides, lightThemeOverrides } from '@/themes';
export const useStyleStore = defineStore('style', {
state: () => {
const isDarkTheme = useDark();
const toggleDark = useToggle(isDarkTheme);
// Same storage key + values ('auto' | 'light' | 'dark') as VueUse useDark,
// which the pre-paint script in index.html reads before Vue mounts.
const themeMode = useColorMode({ emitAuto: true });
const prefersDark = usePreferredDark();
const isDarkTheme = computed(() => (themeMode.value === 'auto' ? prefersDark.value : themeMode.value === 'dark'));
const toggleDark = () => {
themeMode.value = isDarkTheme.value ? 'light' : 'dark';
};
const isSmallScreen = useMediaQuery('(max-width: 700px)');
const isMenuCollapsed = useITStorage('isMenuCollapsed', isSmallScreen.value) as Ref<boolean>;
watch(isSmallScreen, v => (isMenuCollapsed.value = v));
// Keep browser UI (iOS Safari chrome, PWA title bar) matching the app background
watch(isDarkTheme, (isDark) => {
// Cast: naive-ui's Layout override type resolves to '{}' under
// tsconfig.vitest.json, even though the value is a plain color string
const themeColor = (isDark ? darkThemeOverrides.Layout?.color : lightThemeOverrides.Layout?.color) as string | undefined;
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', themeColor ?? (isDark ? '#1c1c1c' : '#f1f5f9'));
}, { immediate: true });
return {
themeMode,
isDarkTheme,
toggleDark,
isMenuCollapsed,
+8
View File
@@ -1,6 +1,12 @@
import type { GlobalThemeOverrides } from 'naive-ui';
export const lightThemeOverrides: GlobalThemeOverrides = {
common: {
// Keep <body> the same color as the Layout background: Safari 26+ ignores
// theme-color and derives its browser chrome tint from the body background.
bodyColor: '#f1f5f9',
},
Menu: {
itemHeight: '32px',
},
@@ -20,6 +26,8 @@ export const darkThemeOverrides: GlobalThemeOverrides = {
primaryColorHover: '#36AD6AFF',
primaryColorPressed: '#0C7A43FF',
primaryColorSuppl: '#36AD6AFF',
// Match the Layout background (see lightThemeOverrides.common.bodyColor)
bodyColor: '#1c1c1c',
},
Notification: {
+6 -2
View File
@@ -99,8 +99,12 @@ const size = computed(() => theme.value.size[sizeName.value]);
}
&:not(.disabled) {
&:hover {
background-color: v-bind('variantTheme.hover.backgroundColor');
// Hover feedback only on devices that can actually hover: on touch
// screens the :hover state would stick after tapping.
@media (hover: hover) {
&:hover {
background-color: v-bind('variantTheme.hover.backgroundColor');
}
}
&:active {
+4 -2
View File
@@ -43,8 +43,10 @@ const tag = computed(() => {
outline-offset: 1px;
&:hover {
color: v-bind('theme.default.hover.textColor');
@media (hover: hover) {
&:hover {
color: v-bind('theme.default.hover.textColor');
}
}
&:active {
+5 -1
View File
@@ -21,7 +21,11 @@ export default defineConfig({
},
},
shortcuts: {
'pretty-scrollbar': 'scrollbar scrollbar-rounded scrollbar-thumb-color-gray-300 scrollbar-track-color-gray-100 dark:scrollbar-thumb-color-#424242 dark:scrollbar-track-color-#686868',
// Inlined expansion of the preset's `scrollbar` shortcut, minus `scrollbar-width-auto`
// and `scrollbar-color-[...]`: preset-scrollbar 4.0.0 only registers rules for those
// two when `compatible: true`, so they trigger "unmatched utility" build warnings, and
// enabling compatible mode would make browsers ignore the ::-webkit-scrollbar styling.
'pretty-scrollbar': 'overflow-auto scrollbar-custom-property scrollbar-track:scrollbar-background-color-[var(--scrollbar-track)] scrollbar-thumb:scrollbar-background-color-[var(--scrollbar-thumb)] scrollbar:scrollbar-width-[var(--scrollbar-width)] scrollbar:scrollbar-height-[var(--scrollbar-height)] scrollbar-rounded scrollbar-thumb-color-gray-300 scrollbar-track-color-gray-100 dark:scrollbar-thumb-color-#424242 dark:scrollbar-track-color-#686868',
'divider': 'h-1px bg-current op-10',
'bg-surface': 'bg-#ffffff dark:bg-#232323',
'bg-background': 'bg-#f1f5f9 dark:bg-#1c1c1c',
+1 -1
View File
@@ -179,7 +179,7 @@ export default defineConfig({
external: ['regex', './out/isolated_vm', 'isolated-vm', 'onnxruntime-node', 'unpdf/pdfjs'],
output: {
format: 'es',
advancedChunks: {
codeSplitting: {
// Tool icons are loaded through per-icon dynamic imports (see src/tools/*/index.ts);
// merge them into a single lazy chunk instead of ~450 tiny ones.
// includeDependenciesRecursively must stay off: with it, shared helper modules