diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a67c06..e2ed6ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: node-version-file: .nvmrc cache: pnpm - run: pnpm install --frozen-lockfile + - run: pnpm lint + - run: pnpm format:check - run: pnpm check - run: pnpm build - run: pnpm exec playwright install --with-deps chromium diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..e137f35 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,24 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "singleQuote": true, + "ignorePatterns": [ + "dist", + ".astro", + "pnpm-lock.yaml", + "public", + "*.astro", + "docs", + "_features", + "_data", + "_includes", + "_layouts", + "_posts", + "_sass", + "*.md", + "*.yml", + "index.html", + "netlify.toml", + "renovate.json", + "*.yaml" + ] +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..2ad85ae --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["typescript"], + "categories": { + "correctness": "error" + }, + "ignorePatterns": ["dist", ".astro", "public"], + "rules": { + "curly": ["error", "all"] + } +} diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..14a66ab --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "plugins": ["prettier-plugin-astro"], + "overrides": [{ "files": "*.astro", "options": { "parser": "astro" } }] +} diff --git a/astro.config.mjs b/astro.config.mjs index f77d548..5f30a46 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -2,15 +2,71 @@ import { defineConfig } from 'astro/config'; import starlight from '@astrojs/starlight'; +// Material themes that have a matching bundled Shiki theme (code blocks follow these 5 only); +// every other theme falls back to github-dark/light by its light/dark type. +/** @type {Record} */ +const CODE_THEMES = { + 'material-theme': 'oceanic', + 'material-theme-darker': 'darker', + 'material-theme-lighter': 'lighter', + 'material-theme-palenight': 'palenight', + 'material-theme-ocean': 'deepocean', +}; + export default defineConfig({ - site: 'https://material-theme.com', - trailingSlash: 'always', - build: { format: 'directory' }, - integrations: [ - starlight({ - title: 'Material Theme UI', - social: [{ icon: 'github', label: 'GitHub', href: 'https://github.com/mallowigi/material-theme-docs' }], - sidebar: [], - }), - ], + site: 'https://material-theme.com', + trailingSlash: 'always', + build: { format: 'directory' }, + integrations: [ + starlight({ + title: 'Material Theme UI', + customCss: ['./src/styles/custom.css'], + head: [ + { tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.googleapis.com' } }, + { + tag: 'link', + attrs: { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }, + }, + { + tag: 'link', + attrs: { + rel: 'stylesheet', + href: 'https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&family=Source+Code+Pro:wght@400;500&display=swap', + }, + }, + ], + social: [ + { + icon: 'github', + label: 'GitHub', + href: 'https://github.com/mallowigi/material-theme-docs', + }, + ], + sidebar: [], + components: { + ThemeProvider: './src/components/overrides/ThemeProvider.astro', + ThemeSelect: './src/components/overrides/ThemeSelect.astro', + PageTitle: './src/components/overrides/PageTitle.astro', + Footer: './src/components/overrides/Footer.astro', + }, + expressiveCode: { + themes: /** @type {any} */ (['github-dark', 'github-light', ...Object.keys(CODE_THEMES)]), + themeCssSelector: (theme) => + CODE_THEMES[theme.name] + ? `[data-material-theme='${CODE_THEMES[theme.name]}']` + : `[data-theme='${theme.type}']`, + styleOverrides: { + codeBackground: 'var(--mt-code-bg, var(--sl-color-gray-6))', + borderColor: 'var(--sl-color-hairline-light)', + frames: { + editorTabBarBackground: 'var(--sl-color-bg-nav)', + editorActiveTabBackground: 'var(--mt-code-bg, var(--sl-color-gray-6))', + editorActiveTabIndicatorTopColor: 'var(--sl-color-accent)', + terminalTitlebarBackground: 'var(--sl-color-bg-nav)', + terminalBackground: 'var(--mt-code-bg, var(--sl-color-gray-6))', + }, + }, + }, + }), + ], }); diff --git a/e2e/not-found.spec.ts b/e2e/not-found.spec.ts index d52297f..3cd65df 100644 --- a/e2e/not-found.spec.ts +++ b/e2e/not-found.spec.ts @@ -1,8 +1,8 @@ import { expect, test } from '@playwright/test'; test('an unknown URL returns 404 with the Starlight 404 page', async ({ page }) => { - const response = await page.goto('/this-page-does-not-exist/'); - expect(response?.status()).toBe(404); - await expect(page.getByRole('heading', { level: 1 })).toHaveText('404'); - await expect(page.locator('main')).toContainText(/couldn.t find|not found/i); + const response = await page.goto('/this-page-does-not-exist/'); + expect(response?.status()).toBe(404); + await expect(page.getByRole('heading', { level: 1 })).toHaveText('404'); + await expect(page.locator('main')).toContainText(/couldn.t find|not found/i); }); diff --git a/e2e/themes.spec.ts b/e2e/themes.spec.ts new file mode 100644 index 0000000..552eee1 --- /dev/null +++ b/e2e/themes.spec.ts @@ -0,0 +1,69 @@ +import { expect, test, type Page } from '@playwright/test'; + +const KEY = 'material-theme'; +const html = (page: Page) => page.locator('html'); + +async function openPicker(page: Page) { + await page.getByRole('button', { name: 'Open theme switcher' }).click(); + await expect(page.getByRole('dialog', { name: /theme/i })).toBeVisible(); +} + +test('the saved theme is on before the body is parsed (no flash)', async ({ page }) => { + await page.addInitScript((key) => { + localStorage.setItem(key, 'dracula'); + new MutationObserver((_, observer) => { + if (!document.body) { + return; + } + + (window as any).__themeAtBody = document.documentElement.dataset.materialTheme; + observer.disconnect(); + }).observe(document, { childList: true, subtree: true }); + }, KEY); + await page.goto('/'); + expect(await page.evaluate(() => (window as any).__themeAtBody)).toBe('dracula'); +}); + +test('a picked theme persists across reload and navigation', async ({ page }) => { + await page.goto('/'); + await openPicker(page); + await page.locator('[data-mt-theme="dracula"]').click(); + await expect(html(page)).toHaveAttribute('data-material-theme', 'dracula'); + + await page.reload(); + await expect(html(page)).toHaveAttribute('data-material-theme', 'dracula'); + + await page.goto('/another-page-that-404s/'); + await expect(html(page)).toHaveAttribute('data-material-theme', 'dracula'); +}); + +test('?theme= overrides the saved theme without replacing it', async ({ page }) => { + await page.addInitScript((key) => localStorage.setItem(key, 'dracula'), KEY); + await page.goto('/?theme=monokai'); + await expect(html(page)).toHaveAttribute('data-material-theme', 'monokai'); + expect(await page.evaluate((key) => localStorage.getItem(key), KEY)).toBe('dracula'); +}); + +test('all 32 themes can be picked and set light or dark accordingly', async ({ page }) => { + await page.goto('/'); + await openPicker(page); + const cards = page.locator('[data-mt-theme]'); + await expect(cards).toHaveCount(32); + + for (const name of await cards.evaluateAll((els) => + els.map((e) => (e as HTMLElement).dataset.mtTheme!), + )) { + await page.locator(`[data-mt-theme="${name}"]`).click(); + await expect(html(page)).toHaveAttribute('data-material-theme', name); + const { scheme, theme } = await html(page).evaluate((el) => ({ + scheme: getComputedStyle(el).colorScheme, + theme: el.dataset.theme, + })); + expect(scheme, name).toBe(theme); + } +}); + +test('there is no light/dark toggle', async ({ page }) => { + await page.goto('/'); + await expect(page.locator('starlight-theme-select')).toHaveCount(0); +}); diff --git a/package.json b/package.json index bb167b4..aed46a9 100644 --- a/package.json +++ b/package.json @@ -1,29 +1,38 @@ { "name": "material-theme-docs", - "type": "module", "version": "2.0.0", "private": true, - "packageManager": "pnpm@10.26.1", - "engines": { - "node": ">=26" - }, + "type": "module", "scripts": { "dev": "astro dev", "build": "astro build", "preview": "astro preview", "check": "astro check", "serve": "netlify serve", - "test:e2e": "playwright test" + "test:e2e": "playwright test", + "lint": "oxlint", + "format": "oxfmt && prettier --write \"src/**/*.astro\"", + "format:check": "oxfmt --check && prettier --check \"src/**/*.astro\"" }, "dependencies": { "@astrojs/starlight": "^0.43.1", "astro": "^7.3.6", + "js-yaml": "5.5.0", "sharp": "^0.35.3" }, "devDependencies": { "@astrojs/check": "latest", "@playwright/test": "latest", + "@types/js-yaml": "4.0.9", "netlify-cli": "latest", + "oxfmt": "0.79.0", + "oxlint": "1.94.0", + "prettier": "3.10.1", + "prettier-plugin-astro": "1.1.2", "typescript": "^6.0.3" - } + }, + "engines": { + "node": ">=26" + }, + "packageManager": "pnpm@10.26.1" } diff --git a/playwright.config.ts b/playwright.config.ts index a2bccb3..bf8898d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -4,19 +4,19 @@ import { defineConfig } from '@playwright/test'; const baseURL = process.env.BASE_URL ?? 'http://localhost:8888'; export default defineConfig({ - testDir: './e2e', - fullyParallel: true, - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 1 : 0, - reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list', - use: { baseURL }, - // `netlify serve` builds the site and serves it with the same redirect/header rules as production. - webServer: process.env.BASE_URL - ? undefined - : { - command: 'BROWSER=none pnpm exec netlify serve --offline --port 8888', - url: baseURL, - reuseExistingServer: !process.env.CI, - timeout: 180_000, - }, + testDir: './e2e', + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 1 : 0, + reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list', + use: { baseURL }, + // `netlify serve` builds the site and serves it with the same redirect/header rules as production. + webServer: process.env.BASE_URL + ? undefined + : { + command: 'BROWSER=none pnpm exec netlify serve --offline --port 8888', + url: baseURL, + reuseExistingServer: !process.env.CI, + timeout: 180_000, + }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d57945..465f7cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,19 +14,37 @@ importers: astro: specifier: ^7.3.6 version: 7.4.12(@netlify/blobs@11.1.9)(@types/node@26.6.6)(esbuild@0.28.1)(yaml@2.9.1) + js-yaml: + specifier: 5.5.0 + version: 5.5.0 sharp: specifier: ^0.35.3 version: 0.35.5(@types/node@26.6.6) devDependencies: '@astrojs/check': specifier: latest - version: 0.9.12(prettier@3.10.1)(typescript@6.0.3) + version: 0.9.12(prettier-plugin-astro@1.1.2(prettier@3.10.1))(prettier@3.10.1)(typescript@6.0.3) '@playwright/test': specifier: latest version: 1.65.1 + '@types/js-yaml': + specifier: 4.0.9 + version: 4.0.9 netlify-cli: specifier: latest version: 27.20.0(@types/node@26.6.6)(bare-buffer@3.7.3)(picomatch@4.0.7)(unstorage@1.17.6(@netlify/blobs@11.1.9)) + oxfmt: + specifier: 0.79.0 + version: 0.79.0(@astrojs/compiler-rs@0.5.3) + oxlint: + specifier: 1.94.0 + version: 1.94.0 + prettier: + specifier: 3.10.1 + version: 3.10.1 + prettier-plugin-astro: + specifier: 1.1.2 + version: 1.1.2(prettier@3.10.1) typescript: specifier: ^6.0.3 version: 6.0.3 @@ -1337,6 +1355,234 @@ packages: '@oxc-project/types@0.156.0': resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==} + '@oxfmt/binding-android-arm-eabi@0.79.0': + resolution: {integrity: sha512-xOCQ/rvokUXs8SxOQY5Wy2ukPaZJZ0PmdJovN0ryB1c8DVEtbcvliLdYtINUYh8QOTpmBOctIisSJk9tvh+J6w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxfmt/binding-android-arm64@0.79.0': + resolution: {integrity: sha512-WMLDvCjjchUYtI6zXKOdzTDGm72BaYZiz1/VhB1rrxdakUZRlJh1aMr3CT6ui51uHcWVBycULIXSZHpw6u2pTQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxfmt/binding-darwin-arm64@0.79.0': + resolution: {integrity: sha512-+LzSN7w7tULz96ntS1Uqe5oI00XZ0o/m/t3+eSfiQp3aTPnj2eGUafqEWryMLk84j7x9NiF+GEP2YT4/BfClgA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxfmt/binding-darwin-x64@0.79.0': + resolution: {integrity: sha512-KFiMRhKeiiooaS1dKc4r8AZgOrfOhwVe1yf/aRef+8BajJwtVjMtlsQl/BNRxtkFbq13GjEo/4Q+9YhFGU4o6g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxfmt/binding-freebsd-x64@0.79.0': + resolution: {integrity: sha512-lHVIp0g8ZOFKiqVscvttp+3HJkkRH6XkGgfAA0lVexIlE1mMFVp4V7RBdxz/P9p7T8pSNsYdapFWvdT21Mib9w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxfmt/binding-linux-arm-gnueabihf@0.79.0': + resolution: {integrity: sha512-Pt35GoxiMUfnr+23cuzk07XQVvISDFxxPcp/aFVB87+RQvJoQaBo/XN7Re9XxgElvbELdyxTLnV9XM2aTfJeUA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm-musleabihf@0.79.0': + resolution: {integrity: sha512-zPi9Dni58VKp3r1QUcFvnbJNfBr49qyecq0vlM4SaX/MSjmguq77VngirghDua5tyhIDfqdUMTCK2KRlnZFp/g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm64-gnu@0.79.0': + resolution: {integrity: sha512-XhRehATEWjwX7VVEgDUD+7pfHYncQIJaEU0qsHvEKtu9XX0QYzcKvXhU9+URfiGX9WRh3wy2Ow+YCc3EeHtImg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxfmt/binding-linux-arm64-musl@0.79.0': + resolution: {integrity: sha512-gbVjFZYug0MEyqvuTAzXGNxFJmBqBO32o1Fud1lG8bGs6oVz48ZtNQyEcAzqrOwaaG+Sxtv4gVzcsfht9aqmkg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxfmt/binding-linux-ppc64-gnu@0.79.0': + resolution: {integrity: sha512-0N0sD3vnllyuiNh1r6zKvNXWE/CakcPKJAespg7XE2+sfvxpz5Q1iFah8sF5aedsOmVvbZaOPZcSHVmMosT1fA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@oxfmt/binding-linux-riscv64-gnu@0.79.0': + resolution: {integrity: sha512-YtjqUHolcX6cv0ZMZuKQCM4H0ae/okcowy0wGcPHJk4O+8zjy3TvNhzDQ1/KGCkMJO8Fwulm1JcPJsraVJ3p+w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxfmt/binding-linux-riscv64-musl@0.79.0': + resolution: {integrity: sha512-H2gb9bEBr5tcdP5FU8JYTfgOavXDorWcAAlwci/zEKF2jzgh/oEr/SAw6aHB9n3FLEvnKvOh0A1fjku+vgYoUA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxfmt/binding-linux-s390x-gnu@0.79.0': + resolution: {integrity: sha512-aZUbyWW5dSOxT/u6suWc4S9GVDt7YPPNMKQon+z79M8dpXmosadcFHAb7jBhpU7Hdsd2GN6/y3nd0JFTsGddZw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@oxfmt/binding-linux-x64-gnu@0.79.0': + resolution: {integrity: sha512-5pW/ZHYfjjQ71gQR+EKzDz8ZzWIDHlTUtWtxVFNgZbKxVZnRxiSXVrllbjpJtx1q8VtSPZ+Lyg9BLny3yw+PTA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxfmt/binding-linux-x64-musl@0.79.0': + resolution: {integrity: sha512-3IVUerTDB7Dvd90c1EurAzlVnlE9Azl7Wn8e33qX3wL/IqnslF+P7HvwkD+VeMbHxRtuw0EEBGSArZFXpUAZrQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxfmt/binding-openharmony-arm64@0.79.0': + resolution: {integrity: sha512-C5QDgJBtu9+/2BQScoP7ynv54PLOqfoSqhRWwI0D0RPOwYD4tYj0TUdJbXMO1fNegL/5zJiSOxkq6II2xvttWg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxfmt/binding-win32-arm64-msvc@0.79.0': + resolution: {integrity: sha512-zlW1m8M49vNGgqQF/ze80KW8pZMicnW2XDZGBHuYtXTRYn4ewvgpqN9wwoqb6uLZZfb1R1zaQWKEB8cs7KYjwA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxfmt/binding-win32-ia32-msvc@0.79.0': + resolution: {integrity: sha512-wbb7hFv2wK3SCTfu8dl1ydNsXM5dmH+PJMU3sojCkfKcG29VDpITL5/AtouCzXjkOc90QRkcAZcg36gP0KqoHA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxfmt/binding-win32-x64-msvc@0.79.0': + resolution: {integrity: sha512-JLaeaQ+4LkQiVXY06JIV1dBFEDJzssvDieK/3Poi6CsY+c4UxghZVrrsfcKGJ5R/0F2Sw3C5Lf5Hu0sM5qJfPw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxlint/binding-android-arm-eabi@1.94.0': + resolution: {integrity: sha512-730FKSBsKg/NawYnpI3gXRroXptOVqY32iYBPLUZaSx0vgYzOeiNtwojZL4gJdzo9wDvHUlstShmGRHrWcbRYg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.94.0': + resolution: {integrity: sha512-8v8TICIiZpXLot1HSq5+vsG9NEKQ5czQBYlUqJR75OVfFDr3cGOmRU/CtHDWnS4tm8nW+Z4Y357qGToSfYqFvA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.94.0': + resolution: {integrity: sha512-NePcRMO/ltt1Pnytohl6pl0bd/QyRX8HbpptuDz9LK7FTsFD4lKxDMBt7di9k6IFLO0J05jO2nm7wGqIh6dRHA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.94.0': + resolution: {integrity: sha512-QV+m+OaEgLmYyillvP1wKXhMm6tDZEWx3vG7Wjmx9ybg15+6YMfqzvp6e+uPukC6zNywuule0vMn0fZgihZzZA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.94.0': + resolution: {integrity: sha512-KVZjca581nrV6P71kZ9M1otBib9LH0IMn9rr4mrnbRp18V0HiZhBHbU26gji/Ieq2G34qMacnMc3zrmKmvWqWA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.94.0': + resolution: {integrity: sha512-AMQtgQJk8DgdIV+qaQ5sFoHAko4iKa8zo+gYqELy2grtU8hXWB08DAGB3u90aQL1YSxbd3zqHjgcODBHDFyzBQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.94.0': + resolution: {integrity: sha512-ZLzoGVGAmQkp9leeB5rNxAXLcvlmkmd/GY71LKd5uikk+28NEApY3S2FB3pq6MkfOCFFnFg6QgD9lJIjd07D0Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.94.0': + resolution: {integrity: sha512-N1dW6o7cY90hLVkDsvz8nWIFOwbO+n272pvW7uLYB7u47HagJVnLChfK6QA9dWFdiPudud9zfksVUOciHc5PNA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxlint/binding-linux-arm64-musl@1.94.0': + resolution: {integrity: sha512-7tCF4OV/bGDQ2xxgb+sDI97SpmmDrUII4JxTG553voJVA9cnkbXSGSXzo78Ax73BuhEOPoQc2Qi6VrfT0cDG2A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxlint/binding-linux-ppc64-gnu@1.94.0': + resolution: {integrity: sha512-B5vUHE4wNisVEuaYxwFUn6tY+vw7A+9APxxqGKI+UmP3yKLpkhnt0qsaCrzjpX55F8rCRHBaTvIDdYo32NE36g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@oxlint/binding-linux-riscv64-gnu@1.94.0': + resolution: {integrity: sha512-/U0b15+c4hTodo8YhEqDlQ6OjnGKvc8igjM/mh23ukqqCUBKiBCaxqUV8bcaofK9uZ+f8wCygkyXLS6LN25YSA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxlint/binding-linux-riscv64-musl@1.94.0': + resolution: {integrity: sha512-ba94Vwl0qOnwXIXNDR33AEbLXuX++ckM74t+9Te7CiPSPAHivhOYyeEkUAicrvOEei1pxXkWggLbFeBFFBTuHA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxlint/binding-linux-s390x-gnu@1.94.0': + resolution: {integrity: sha512-GVwwwms3O8pdgbCiPavwq2vltyB4661GkDz6kJduZ0E5nsSJUDJ0svaP+ePYpuDVYi4+K1qhCKnWa/Ec8I4LUA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@oxlint/binding-linux-x64-gnu@1.94.0': + resolution: {integrity: sha512-iUfCFJN8ZIresSnpTfiIkhF3s8X+XA4I9KJ249QwR2QYTMwh0+pla1pj1xaFi+HtR9McjM4Jaemf70HzX7ilOQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxlint/binding-linux-x64-musl@1.94.0': + resolution: {integrity: sha512-RqWVeWpDACS4Oh0m21OBmy+CQ50CbbhuHFmNNPVS2P/4R3d188MjEuEuV7So82/tAM8UAT+UuMDtRDESd9NJ7g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxlint/binding-openharmony-arm64@1.94.0': + resolution: {integrity: sha512-K/2DHOUoypwYVqzxJMRPdMuBKjAetZEAsGPP7rHimd+2+5J1TxM+17pG8kw+ayH4+rqBXiPd+H9wgPcU+fF77A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.94.0': + resolution: {integrity: sha512-hYOCaOJiB4ZCGswBWKl3JQrhqu6mnC5DCUw/1UMNzRXgsHIJ0V226J43LAVICVIDGlhFUZTYShFW+wHWpt6qCQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.94.0': + resolution: {integrity: sha512-1l1FDlzbPmAeDoZ8UGspOE2dOmz1ZL6SlDsvOmRCmWSQjCdTy5LzUepS8mO/SGpAoz4D6WAt/yNZAUyHqbkmkQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.94.0': + resolution: {integrity: sha512-I3eZdd4bemIJQDNv9XDV/FEofDxIoN32tzCv98wIgLdW05EqxZb5hF4AwPrRzHD/dQhl0n7KgPy5AQPfM0HWrA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@pagefind/darwin-arm64@1.6.0': resolution: {integrity: sha512-611gl64aqN12UcMyKPtZ8+vRWBKlJFSh2JgO8uScxa1Eyjo1dXz9r4wZuRno0yCUE/KN0FauEoKZ3KEwUYHCCg==} cpu: [arm64] @@ -1399,6 +1645,9 @@ packages: resolution: {integrity: sha512-bWLDlHsBlgKY/05wDN/V3ETcn5G2SV/SiA2ZmNvKGGlmVX4G5li7GRDhHcgYvHJHyJ8TUStqg2xtHmCs0UbAbg==} engines: {node: '>=18'} + '@prettier/parse-srcset@3.1.0': + resolution: {integrity: sha512-FIRv2rZotO9NP/r66taYqD1zICpPiBbrECqjKV/xqNotqDxF7fLzzUeK+1RSRx9Tenk0DajR/GcRmTJ2qtHaKQ==} + '@rolldown/binding-android-arm-eabi@1.2.19': resolution: {integrity: sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1578,6 +1827,9 @@ packages: '@types/http-proxy@1.17.17': resolution: {integrity: sha512-ED6LB+Z1AVylNTu7hdzuBqOgMnvG/ld6wGCG8wFnAzKX5uyW2K3WD52v0gnLCTK/VLpXtKckgWuyScYK6cSPaw==} + '@types/js-yaml@4.0.9': + resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} + '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} @@ -1839,6 +2091,9 @@ packages: arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + argparse@3.0.4: + resolution: {integrity: sha512-fwWK3Zq22l4XJJjx5mcBHGikIk+hJqO+32dPm0Jur7+rtG5x1scOjSfdT9ZKeWHPpsya/l0HHK4tDImBkTrtvA==} + aria-query@5.3.2: resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} engines: {node: '>= 0.4'} @@ -3351,6 +3606,10 @@ packages: js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + js-yaml@5.5.0: + resolution: {integrity: sha512-paNr4LFIFPjeeSmwNYdrb8FafLLG/Cr2Af3GjbsHJ5CxIjH4r0c2emlmRdAtpPAieP1gRVzk6buBbVP5gBMGAg==} + hasBin: true + json-schema-ref-resolver@3.0.1: resolution: {integrity: sha512-w+HwgljXpVwZ3IidoUR1qPZxSOQ+NRQWuVe6a5pe8XbHsNZE4UAwVPUvzZagn7yBKbJtt6UJnRFYbNTRPZI45Q==} @@ -3962,6 +4221,35 @@ packages: resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==} engines: {node: '>= 0.4'} + oxfmt@0.79.0: + resolution: {integrity: sha512-92iLHGxAgtYk6jLp/1ZBnEeABveNduHZgMDQj7tyqO9iafuJG3q+YHJq0R5Aa4YT+E6xswMQXdmPZYMwynS8ig==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@astrojs/compiler-rs': ^0.5.0 + svelte: ^5.0.0 + vite-plus: '*' + peerDependenciesMeta: + '@astrojs/compiler-rs': + optional: true + svelte: + optional: true + vite-plus: + optional: true + + oxlint@1.94.0: + resolution: {integrity: sha512-Fnt+3wSKRhtLmvgRfxgRX0excSPCoyiXRol4eWKZLtXxWMQtwQ3KjKQUYXOw5loyinfnZfGzh4RCYf7opfL0vw==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=7.0.2007' + vite-plus: '*' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + vite-plus: + optional: true + p-event@6.0.1: resolution: {integrity: sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w==} engines: {node: '>=16.17'} @@ -4210,6 +4498,12 @@ packages: resolution: {integrity: sha512-QCYG84SgGyGzqJ/vlMsxeXd/pgL/I94ixdNFyh1PusWmTCyVfPJjZ1K1jvHtsbfnXQs2TSkEP2fR7QiMZAnKFQ==} engines: {node: '>= 0.6'} + prettier-plugin-astro@1.1.2: + resolution: {integrity: sha512-vKyJW7Bb/QcIPUebEehbG+Tn+3yTIhoJ8ecm6NyJgcOj5T2xP+eF1IxY4zv809YyA69nV4ZFj+H9mdpC5cTaQA==} + engines: {node: '>=22.12.0'} + peerDependencies: + prettier: ^3.5.3 + prettier@3.10.1: resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==} engines: {node: '>=14'} @@ -4447,6 +4741,9 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + s.color@0.0.15: + resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + safe-array-concat@1.1.4: resolution: {integrity: sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==} engines: {node: '>=0.4'} @@ -4479,6 +4776,10 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + sass-formatter@0.8.0: + resolution: {integrity: sha512-Nf4eMGE2O5vnJG7KPCRyksWS9gVKSYoUWtPeMXRRxwZSPVQhSGtL602xVYS65LvMkHmkvKa7xpauF0+/5pPwrg==} + hasBin: true + satteri@0.10.5: resolution: {integrity: sha512-Ao1LKpAEa9Wdg0otgbVKViZHEq9ebdXe4DMrp3s9vQAU0HNIuHnFEuMuOcm0ZIXyV0Yzxj91NvhLpvXZJO/5ZQ==} @@ -4722,6 +5023,9 @@ packages: stubborn-utils@1.0.2: resolution: {integrity: sha512-zOh9jPYI+xrNOyisSelgym4tolKTJCQd5GBhK0+0xJvcYDcwlOoxF/rnFKQ2KRZknXSG9jWAp66fwP6AxN9STg==} + suf-log@2.5.3: + resolution: {integrity: sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==} + supports-color@10.2.2: resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} engines: {node: '>=18'} @@ -4801,6 +5105,10 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} + tinypool@2.2.0: + resolution: {integrity: sha512-jBrmx4lYmaC9k/mgPbylxs7kBUxHtD8256up+HjLaDFfXScKJQyil+SWXSvhAtT7XHo+yTVlpB81PGmHP8oLSQ==} + engines: {node: ^20.0.0 || >=22.0.0} + tinyps@0.5.2: resolution: {integrity: sha512-sYhvdbpuo2rGE7u/jPUMiZz4H2LCaOodUtRD9ot4DLNFQbr884g9zozoJnxLI+1r4hXqWkmdHUl8Yig2Rllxxw==} @@ -5411,9 +5719,9 @@ snapshots: '@emnapi/runtime': 1.11.3 '@napi-rs/wasm-runtime': 1.2.4(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3) - '@astrojs/check@0.9.12(prettier@3.10.1)(typescript@6.0.3)': + '@astrojs/check@0.9.12(prettier-plugin-astro@1.1.2(prettier@3.10.1))(prettier@3.10.1)(typescript@6.0.3)': dependencies: - '@astrojs/language-server': 2.17.3(prettier@3.10.1)(typescript@6.0.3) + '@astrojs/language-server': 2.17.3(prettier-plugin-astro@1.1.2(prettier@3.10.1))(prettier@3.10.1)(typescript@6.0.3) chokidar: 5.0.0 kleur: 4.1.5 typescript: 6.0.3 @@ -5484,7 +5792,7 @@ snapshots: unified: 11.0.5 yaml: 2.9.1 - '@astrojs/language-server@2.17.3(prettier@3.10.1)(typescript@6.0.3)': + '@astrojs/language-server@2.17.3(prettier-plugin-astro@1.1.2(prettier@3.10.1))(prettier@3.10.1)(typescript@6.0.3)': dependencies: '@astrojs/astro2tsx': 0.1.4 '@astrojs/yaml2ts': 0.2.4 @@ -5505,6 +5813,7 @@ snapshots: vscode-uri: 3.2.0 optionalDependencies: prettier: 3.10.1 + prettier-plugin-astro: 1.1.2(prettier@3.10.1) transitivePeerDependencies: - typescript @@ -6812,6 +7121,120 @@ snapshots: '@oxc-project/types@0.156.0': {} + '@oxfmt/binding-android-arm-eabi@0.79.0': + optional: true + + '@oxfmt/binding-android-arm64@0.79.0': + optional: true + + '@oxfmt/binding-darwin-arm64@0.79.0': + optional: true + + '@oxfmt/binding-darwin-x64@0.79.0': + optional: true + + '@oxfmt/binding-freebsd-x64@0.79.0': + optional: true + + '@oxfmt/binding-linux-arm-gnueabihf@0.79.0': + optional: true + + '@oxfmt/binding-linux-arm-musleabihf@0.79.0': + optional: true + + '@oxfmt/binding-linux-arm64-gnu@0.79.0': + optional: true + + '@oxfmt/binding-linux-arm64-musl@0.79.0': + optional: true + + '@oxfmt/binding-linux-ppc64-gnu@0.79.0': + optional: true + + '@oxfmt/binding-linux-riscv64-gnu@0.79.0': + optional: true + + '@oxfmt/binding-linux-riscv64-musl@0.79.0': + optional: true + + '@oxfmt/binding-linux-s390x-gnu@0.79.0': + optional: true + + '@oxfmt/binding-linux-x64-gnu@0.79.0': + optional: true + + '@oxfmt/binding-linux-x64-musl@0.79.0': + optional: true + + '@oxfmt/binding-openharmony-arm64@0.79.0': + optional: true + + '@oxfmt/binding-win32-arm64-msvc@0.79.0': + optional: true + + '@oxfmt/binding-win32-ia32-msvc@0.79.0': + optional: true + + '@oxfmt/binding-win32-x64-msvc@0.79.0': + optional: true + + '@oxlint/binding-android-arm-eabi@1.94.0': + optional: true + + '@oxlint/binding-android-arm64@1.94.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.94.0': + optional: true + + '@oxlint/binding-darwin-x64@1.94.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.94.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.94.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.94.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.94.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.94.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.94.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.94.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.94.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.94.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.94.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.94.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.94.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.94.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.94.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.94.0': + optional: true + '@pagefind/darwin-arm64@1.6.0': optional: true @@ -6862,6 +7285,8 @@ snapshots: transitivePeerDependencies: - supports-color + '@prettier/parse-srcset@3.1.0': {} + '@rolldown/binding-android-arm-eabi@1.2.19': optional: true @@ -7006,6 +7431,8 @@ snapshots: dependencies: '@types/node': 26.6.6 + '@types/js-yaml@4.0.9': {} + '@types/mdast@4.0.4': dependencies: '@types/unist': 3.0.3 @@ -7311,6 +7738,8 @@ snapshots: arg@4.1.3: {} + argparse@3.0.4: {} + aria-query@5.3.2: {} array-buffer-byte-length@1.0.2: @@ -8999,6 +9428,10 @@ snapshots: js-tokens@4.0.0: {} + js-yaml@5.5.0: + dependencies: + argparse: 3.0.4 + json-schema-ref-resolver@3.0.1: dependencies: dequal: 2.0.3 @@ -9807,6 +10240,53 @@ snapshots: object-keys: 1.1.1 safe-push-apply: 1.0.0 + oxfmt@0.79.0(@astrojs/compiler-rs@0.5.3): + dependencies: + tinypool: 2.2.0 + optionalDependencies: + '@astrojs/compiler-rs': 0.5.3 + '@oxfmt/binding-android-arm-eabi': 0.79.0 + '@oxfmt/binding-android-arm64': 0.79.0 + '@oxfmt/binding-darwin-arm64': 0.79.0 + '@oxfmt/binding-darwin-x64': 0.79.0 + '@oxfmt/binding-freebsd-x64': 0.79.0 + '@oxfmt/binding-linux-arm-gnueabihf': 0.79.0 + '@oxfmt/binding-linux-arm-musleabihf': 0.79.0 + '@oxfmt/binding-linux-arm64-gnu': 0.79.0 + '@oxfmt/binding-linux-arm64-musl': 0.79.0 + '@oxfmt/binding-linux-ppc64-gnu': 0.79.0 + '@oxfmt/binding-linux-riscv64-gnu': 0.79.0 + '@oxfmt/binding-linux-riscv64-musl': 0.79.0 + '@oxfmt/binding-linux-s390x-gnu': 0.79.0 + '@oxfmt/binding-linux-x64-gnu': 0.79.0 + '@oxfmt/binding-linux-x64-musl': 0.79.0 + '@oxfmt/binding-openharmony-arm64': 0.79.0 + '@oxfmt/binding-win32-arm64-msvc': 0.79.0 + '@oxfmt/binding-win32-ia32-msvc': 0.79.0 + '@oxfmt/binding-win32-x64-msvc': 0.79.0 + + oxlint@1.94.0: + optionalDependencies: + '@oxlint/binding-android-arm-eabi': 1.94.0 + '@oxlint/binding-android-arm64': 1.94.0 + '@oxlint/binding-darwin-arm64': 1.94.0 + '@oxlint/binding-darwin-x64': 1.94.0 + '@oxlint/binding-freebsd-x64': 1.94.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.94.0 + '@oxlint/binding-linux-arm-musleabihf': 1.94.0 + '@oxlint/binding-linux-arm64-gnu': 1.94.0 + '@oxlint/binding-linux-arm64-musl': 1.94.0 + '@oxlint/binding-linux-ppc64-gnu': 1.94.0 + '@oxlint/binding-linux-riscv64-gnu': 1.94.0 + '@oxlint/binding-linux-riscv64-musl': 1.94.0 + '@oxlint/binding-linux-s390x-gnu': 1.94.0 + '@oxlint/binding-linux-x64-gnu': 1.94.0 + '@oxlint/binding-linux-x64-musl': 1.94.0 + '@oxlint/binding-openharmony-arm64': 1.94.0 + '@oxlint/binding-win32-arm64-msvc': 1.94.0 + '@oxlint/binding-win32-ia32-msvc': 1.94.0 + '@oxlint/binding-win32-x64-msvc': 1.94.0 + p-event@6.0.1: dependencies: p-timeout: 6.1.4 @@ -10057,6 +10537,13 @@ snapshots: precond@0.2.3: {} + prettier-plugin-astro@1.1.2(prettier@3.10.1): + dependencies: + '@astrojs/compiler-rs': 0.5.3 + '@prettier/parse-srcset': 3.1.0 + prettier: 3.10.1 + sass-formatter: 0.8.0 + prettier@3.10.1: {} pretty-ms@9.3.1: @@ -10341,6 +10828,8 @@ snapshots: dependencies: queue-microtask: 1.2.3 + s.color@0.0.15: {} + safe-array-concat@1.1.4: dependencies: call-bind: 1.0.9 @@ -10374,6 +10863,10 @@ snapshots: safer-buffer@2.1.2: {} + sass-formatter@0.8.0: + dependencies: + suf-log: 2.5.3 + satteri@0.10.5: dependencies: '@types/estree-jsx': 1.0.5 @@ -10711,6 +11204,10 @@ snapshots: stubborn-utils@1.0.2: {} + suf-log@2.5.3: + dependencies: + s.color: 0.0.15 + supports-color@10.2.2: {} supports-color@11.0.0: {} @@ -10807,6 +11304,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + tinypool@2.2.0: {} + tinyps@0.5.2: {} tmp-promise@3.0.3: diff --git a/src/components/overrides/Footer.astro b/src/components/overrides/Footer.astro new file mode 100644 index 0000000..3573c4e --- /dev/null +++ b/src/components/overrides/Footer.astro @@ -0,0 +1,8 @@ +--- +// Keeps Starlight's footer and adds the floating theme picker on every page. +import Default from '@astrojs/starlight/components/Footer.astro'; +import ThemeFab from '../theme/ThemeFab.astro'; +--- + + + diff --git a/src/components/overrides/PageTitle.astro b/src/components/overrides/PageTitle.astro new file mode 100644 index 0000000..42c7933 --- /dev/null +++ b/src/components/overrides/PageTitle.astro @@ -0,0 +1,12 @@ +--- +// The "ribbon": an accent band holding the page title and the front-matter description as subheading. +// The band background itself is painted on the parent .content-panel in custom.css (`:has(.docs-header)`). +import Default from '@astrojs/starlight/components/PageTitle.astro'; + +const { description } = Astro.locals.starlightRoute.entry.data; +--- + +
+ + {description &&

{description}

} +
diff --git a/src/components/overrides/ThemeProvider.astro b/src/components/overrides/ThemeProvider.astro new file mode 100644 index 0000000..ecb593b --- /dev/null +++ b/src/components/overrides/ThemeProvider.astro @@ -0,0 +1,53 @@ +--- +// Replaces Starlight's light/dark ThemeProvider. Renders in , so the theme is on before first paint. +// Resolution order: ?theme= (class name or id) -> localStorage -> default. +import { themes } from '../../data/themes'; + +const map = Object.fromEntries( + themes.map((t) => [t.className, [t.id, !!t.light]]), +); + +// language=JavaScript +const script = `(() => { + const MAP = ${JSON.stringify(map)}; + const KEY = 'material-theme'; + const DEFAULT = 'oceanic'; + const root = document.documentElement; + const resolve = (v) => { + if (!v) { + return null; + } + v = String(v).toLowerCase(); + return Object.keys(MAP).find((k) => k.toLowerCase() === v || MAP[k][0].toLowerCase() === v) || null; + }; + + const apply = (id, persist) => { + id = resolve(id) || DEFAULT; + root.dataset.materialTheme = id; + root.dataset.theme = MAP[id][1] ? 'light' : 'dark'; + if (persist) { + try { + localStorage.setItem(KEY, id); + } catch (e) {} + } + + document.dispatchEvent(new CustomEvent('material-theme-change', {detail: id})); + return id; + }; + + let stored = null; + try { + stored = localStorage.getItem(KEY); + } catch (e) {} + + apply(resolve(new URLSearchParams(location.search).get('theme')) || stored, false); + + window.materialTheme = { + apply, + current: () => root.dataset.materialTheme + }; +})();`; +--- + + + + diff --git a/src/content.config.ts b/src/content.config.ts index d9ee8c9..6a7b7a0 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -3,5 +3,5 @@ import { docsLoader } from '@astrojs/starlight/loaders'; import { docsSchema } from '@astrojs/starlight/schema'; export const collections = { - docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), }; diff --git a/src/data/themes.ts b/src/data/themes.ts new file mode 100644 index 0000000..bdaa6a7 --- /dev/null +++ b/src/data/themes.ts @@ -0,0 +1,49 @@ +// Single source of truth for the 32 Material themes: src/data/themes.yml (read at build time). +import fs from 'node:fs'; +import path from 'node:path'; +import { load } from 'js-yaml'; + +export interface Theme { + id: string; + name: string; + className: string; + light: boolean; + group: string; + background: string; + foreground: string; + text: string; + selectBg: string; + selectFg: string; + button: string; + second: string; + disabled: string; + contrast: string; + border: string; + hl: string; + notif: string; + accent: string; + accent2: string; + attributes: string; + white: string; + green: string; + red: string; + blue: string; + purple: string; + orange: string; +} + +export const GROUP_LABELS: Record = { + material: 'Material', + material2: 'Material (more)', + other: 'Other', + other2: 'Other (2)', + other3: 'Other (3)', +}; + +const file = path.resolve(process.cwd(), 'src/data/themes.yml'); +const raw = load(fs.readFileSync(file, 'utf8')) as Record[]>; + +export const themeGroups: Record = Object.fromEntries( + Object.entries(raw).map(([group, list]) => [group, list.map((t) => ({ ...t, group }))]), +); +export const themes: Theme[] = Object.values(themeGroups).flat(); diff --git a/_data/themes.yml b/src/data/themes.yml similarity index 100% rename from _data/themes.yml rename to src/data/themes.yml diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..c20c2db --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,3 @@ +interface Window { + materialTheme: { apply: (id: string, persist?: boolean) => string; current: () => string }; +} diff --git a/src/pages/material-themes.css.ts b/src/pages/material-themes.css.ts new file mode 100644 index 0000000..5ace2ea --- /dev/null +++ b/src/pages/material-themes.css.ts @@ -0,0 +1,53 @@ +// Build-time endpoint (/material-themes.css): maps each Material theme onto Starlight's CSS custom properties. +import { themes, type Theme } from '../data/themes'; + +const mix = (a: string, pct: number, b: string) => `color-mix(in srgb, ${a} ${pct}%, ${b})`; + +function block(t: Theme) { + const bg = t.background; + const strong = t.white; + const hue = (name: string, c: string) => + `--sl-color-${name}: ${c}; --sl-color-${name}-low: ${mix(c, 22, bg)}; --sl-color-${name}-high: ${mix(c, 70, strong)};`; + return `:root[data-material-theme='${t.className}'] { + --sl-color-white: ${strong}; + --sl-color-gray-1: ${mix(t.foreground, 50, strong)}; + --sl-color-gray-2: ${t.foreground}; + --sl-color-gray-3: ${t.text}; + --sl-color-gray-4: ${t.disabled}; + --sl-color-gray-5: ${t.hl}; + --sl-color-gray-6: ${t.second}; + --sl-color-gray-7: ${t.button}; + --sl-color-black: ${bg}; + --sl-color-accent-low: ${mix(t.accent, 25, bg)}; + --sl-color-accent: ${t.accent}; + --sl-color-accent-high: ${mix(t.accent, 70, strong)}; + --sl-color-text: ${t.foreground}; + --sl-color-text-accent: ${t.accent}; + --sl-color-text-invert: ${bg}; + --sl-color-bg: ${bg}; + --sl-color-bg-nav: ${t.contrast}; + --sl-color-bg-sidebar: ${t.contrast}; + --sl-color-bg-inline-code: ${t.button}; + --sl-color-bg-accent: ${t.accent}; + --sl-color-hairline-light: ${t.border}; + --sl-color-hairline: ${t.border}; + --sl-color-hairline-shade: ${t.contrast}; + --sl-color-backdrop-overlay: ${mix(bg, 66, 'transparent')}; + ${hue('orange', t.orange)} ${hue('green', t.green)} ${hue('blue', t.blue)} ${hue('purple', t.purple)} ${hue('red', t.red)} + --mt-code-bg: ${t.contrast}; + --mt-notif: ${t.notif}; + --mt-select-bg: ${t.selectBg}; + --mt-select-fg: ${t.selectFg}; + --mt-primary: ${t.attributes}; + --mt-accent2: ${t.accent2}; + color-scheme: ${t.light ? 'light' : 'dark'}; +}`; +} + +export function GET() { + const css = + `/* generated from src/data/themes.yml: ${themes.length} themes */\n` + + themes.map(block).join('\n') + + `\n::selection { background: var(--mt-select-bg); color: var(--mt-select-fg); }\n`; + return new Response(css, { headers: { 'Content-Type': 'text/css; charset=utf-8' } }); +} diff --git a/src/styles/custom.css b/src/styles/custom.css new file mode 100644 index 0000000..d2190b4 --- /dev/null +++ b/src/styles/custom.css @@ -0,0 +1,126 @@ +/* Per-theme colors come from /material-themes.css (generated from src/data/themes.yml). + These defaults (Oceanic / teal #009688) only matter without JS; :where() keeps them at zero + specificity so the per-theme blocks always win. */ +:where(:root) { + --sl-color-accent-low: #0b3b3a; + --sl-color-accent: #009688; + --sl-color-accent-high: #80cbc4; +} + +:where(:root[data-theme='light']) { + --sl-color-accent-low: #b2dfdb; + --sl-color-accent: #009688; + --sl-color-accent-high: #00695c; +} + +/* Fonts match the live site: Google Sans for text, Source Code Pro for code. */ +:root { + --sl-font: 'Google Sans', 'Roboto', 'Calibri', 'Arial', sans-serif; + --sl-font-mono: + 'Source Code Pro', Monaco, 'Bitstream Vera Sans Mono', 'Lucida Console', Terminal, monospace; + --mt-ribbon-fg: var(--mt-select-fg, #ffffff); +} + +/* Headings in the accent color */ +.sl-markdown-content :is(h1, h2, h3, h4, h5, h6) { + color: var(--sl-color-accent); + font-weight: 400; + transition: color 0.3s; +} + +.sl-markdown-content h2 { + font-size: clamp(1.9rem, 3.2vw, 2.6rem); +} + +/* Ribbon (.docs-header, see PageTitle override): accent band across the main pane */ +.main-pane .content-panel:has(.docs-header) { + background: var(--sl-color-accent); + color: var(--mt-ribbon-fg); + padding-block: 1rem 2rem; + border: 0; + transition: background-color 0.3s; +} + +.main-pane .content-panel:has(.docs-header) + .content-panel { + border-top: 0; +} + +.docs-header h1#_top { + color: var(--mt-ribbon-fg); + font-weight: 400; + font-size: clamp(2.5rem, 5.5vw, 3.94rem); + line-height: 1.1; + margin: 1.5rem 0 0; +} + +.docs-header .docs-subtitle { + color: var(--mt-ribbon-fg); + font-size: clamp(1.25rem, 2.6vw, 2.14rem); + line-height: 1.15; + margin: 1.75rem 0 0.5rem; +} + +@media (max-width: 37.5rem) { + .docs-header { + text-align: center; + } +} + +/* TOC links in the accent color; the active one is marked with an accent bar */ +.right-sidebar starlight-toc a { + color: var(--sl-color-accent); +} + +.right-sidebar starlight-toc a:hover { + color: var(--sl-color-accent-high); +} + +.right-sidebar starlight-toc a[aria-current='true'] { + box-shadow: inset 3px 0 0 var(--sl-color-accent); + font-weight: 500; + border-radius: 0; +} + +/* Desktop (Starlight's lg breakpoint): the ribbon reaches the viewport's right edge and the TOC floats + over it as a card pinned to the right edge. */ +@media (min-width: 72rem) { + html { + overflow-x: clip; + } + + .main-pane .content-panel:has(.docs-header) { + border-image: linear-gradient(var(--sl-color-accent) 0 0) fill 0 / 0 / 0 100vw 0 0; + } + + .right-sidebar-container { + width: var(--sl-sidebar-width); + } + + .right-sidebar { + right: 0; + width: var(--sl-sidebar-width); + box-sizing: border-box; + border-inline-start: 0; + background: transparent; + padding: calc(var(--sl-nav-height) + 1rem) 0 1rem; + height: auto; + overflow: visible; + max-height: 100vh; + } + + .right-sidebar-panel { + background: var(--sl-color-bg-nav); + border: 1px solid var(--sl-color-hairline); + border-radius: 0.75rem; + box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); + padding: 1rem; + margin-inline-end: 1rem; + box-sizing: border-box; + width: calc(100% - 1rem); + } + + .right-sidebar-panel .sl-container { + width: auto; + max-width: none; + } +}