Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔤 fix: Ship the Theme Font Faces With the Package (#16485)

Marco Beretta5961f767fd37
diff --git a/client/src/fonts.css b/client/src/fonts.css
deleted file mode 100644
index ff4ab922a1..0000000000
--- a/client/src/fonts.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Faces a theme opts into rather than ones the default theme uses. Browsers fetch a declared face
- * only once text renders in it, so these cost nothing until a theme names the family.
- * Inconsolata is the ClickHouse theme's mono family (SIL OFL 1.1, see public/fonts/inconsolata-OFL.txt). */
-@font-face {
- font-display: swap;
- font-family: Inconsolata;
- font-style: normal;
- font-weight: 400;
- src: url('$fonts/inconsolata-latin-400-normal.woff2') format('woff2');
-}
-
-@font-face {
- font-display: swap;
- font-family: Inconsolata;
- font-style: normal;
- font-weight: 700;
- src: url('$fonts/inconsolata-latin-700-normal.woff2') format('woff2');
-}
diff --git a/client/src/main.jsx b/client/src/main.jsx
index 46ccc32080..945b89f166 100644
--- a/client/src/main.jsx
+++ b/client/src/main.jsx
@@ -5,7 +5,6 @@ import { initializeI18n } from './locales/i18n';
import App from './App';
import '@librechat/client/style.css';
import './style.css';
-import './fonts.css';
import './mobile.css';
import { ApiErrorBoundaryProvider } from './hooks/ApiErrorBoundaryContext';
import 'katex/dist/katex.min.css';
diff --git a/client/src/style.css b/client/src/style.css
index f10918ce0e..14816127bc 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -354,84 +354,6 @@ html.high-contrast.dark .btn-neutral:hover {
text-overflow: ellipsis;
}
-@font-face {
- font-display: swap;
- font-family: Inter;
- font-style: normal;
- font-weight: 400;
- src: url('$fonts/Inter-Regular.woff2') format('woff2');
- size-adjust: 94%;
-}
-
-@font-face {
- font-display: swap;
- font-family: Inter;
- font-style: italic;
- font-weight: 400;
- src: url('$fonts/Inter-Italic.woff2') format('woff2');
- size-adjust: 94%;
-}
-
-@font-face {
- font-display: swap;
- font-family: Inter;
- font-style: normal;
- font-weight: 500;
- src: url('$fonts/Inter-SemiBold.woff2') format('woff2');
- size-adjust: 94%;
-}
-
-@font-face {
- font-display: swap;
- font-family: Inter;
- font-style: italic;
- font-weight: 500;
- src: url('$fonts/Inter-SemiBoldItalic.woff2') format('woff2');
- size-adjust: 94%;
-}
-
-@font-face {
- font-display: swap;
- font-family: Inter;
- font-style: normal;
- font-weight: 600;
- src: url('$fonts/Inter-Bold.woff2') format('woff2');
- size-adjust: 94%;
-}
-
-@font-face {
- font-display: swap;
- font-family: Inter;
- font-style: italic;
- font-weight: 600;
- src: url('$fonts/Inter-BoldItalic.woff2') format('woff2');
- size-adjust: 94%;
-}
-
-@font-face {
- font-display: swap;
- font-family: Roboto Mono;
- font-style: normal;
- font-weight: 400;
- src: url('$fonts/roboto-mono-latin-400-normal.woff2') format('woff2');
-}
-
-@font-face {
- font-display: swap;
- font-family: Roboto Mono;
- font-style: normal;
- font-weight: 700;
- src: url('$fonts/roboto-mono-latin-700-normal.woff2') format('woff2');
-}
-
-@font-face {
- font-display: swap;
- font-family: Roboto Mono;
- font-style: italic;
- font-weight: 400;
- src: url('$fonts/roboto-mono-latin-400-italic.woff2') format('woff2');
-}
-
/* v4 puts every utility in `@layer utilities`, and an unlayered declaration outranks a
* layered one whatever its specificity. The rules below are element and bare-pseudo
* resets that utilities beat under v3 by being classes; each is layered so it keeps
diff --git a/client/vite.config.ts b/client/vite.config.ts
index 3a923b214b..91d0cac2db 100644
--- a/client/vite.config.ts
+++ b/client/vite.config.ts
@@ -450,7 +450,6 @@ export default defineConfig(({ command }) => ({
resolve: {
alias: {
'~': path.join(import.meta.dirname, 'src/'),
- $fonts: path.resolve(import.meta.dirname, 'public/fonts'),
'micromark-extension-math': 'micromark-extension-llm-math',
},
},
@@ -479,9 +478,10 @@ export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
* Production builds set `publicDir: false`, so nothing under public/ reaches dist on its
* own. This copies what the server actually has to serve: all of public/assets (the PWA
* icons plus the endpoint, tool and language logos referenced at runtime) and robots.txt.
- * The font files in public/fonts are emitted as bundle assets through the `$fonts` alias,
- * so only their licence texts are copied, next to them in assets/fonts: the SIL OFL lets a
- * font be redistributed only with its licence.
+ * The font files live in the component library (`packages/client/src/theme/fonts`) and are
+ * emitted as bundle assets through the `@font-face` rules `tokens.css` imports, so only their
+ * licence texts are copied, next to them in assets/fonts: the SIL OFL lets a font be
+ * redistributed only with its licence.
*
* The copy MUST happen inside the build. vite-plugin-pwa globs dist/ for
* `workbox.globPatterns` from its `closeBundle` hook, which runs after every plugin's
@@ -492,6 +492,7 @@ export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
*/
export function copyPublicAssets(): Plugin {
const publicDir = path.resolve(import.meta.dirname, 'public');
+ const fontsDir = path.resolve(import.meta.dirname, '../packages/client/src/theme/fonts');
let outDir = path.resolve(import.meta.dirname, 'dist');
return {
name: 'copy-public-assets',
@@ -507,14 +508,14 @@ export function copyPublicAssets(): Plugin {
path.join(publicDir, 'robots.txt'),
path.join(outDir, 'robots.txt'),
);
- const licences = (await fs.promises.readdir(path.join(publicDir, 'fonts'))).filter((name) =>
+ const licences = (await fs.promises.readdir(fontsDir)).filter((name) =>
name.endsWith('.txt'),
);
await fs.promises.mkdir(path.join(outDir, 'assets', 'fonts'), { recursive: true });
await Promise.all(
licences.map((name) =>
fs.promises.copyFile(
- path.join(publicDir, 'fonts', name),
+ path.join(fontsDir, name),
path.join(outDir, 'assets', 'fonts', name),
),
),
diff --git a/e2e/specs/mock/scenarios/published-font-faces.spec.ts b/e2e/specs/mock/scenarios/published-font-faces.spec.ts
new file mode 100644
index 0000000000..0612cb4d4a
--- /dev/null
+++ b/e2e/specs/mock/scenarios/published-font-faces.spec.ts
@@ -0,0 +1,186 @@
+import { mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
+import { extname, join, resolve } from 'node:path';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { inOneProject, repoRoot, run } from './lint.helpers';
+import { NEW_CHAT_PATH } from '../helpers';
+
+/**
+ * `@librechat/client/theme.css` names Inter, Roboto Mono and Inconsolata, and ships their faces:
+ * `fonts.css` declares them against the package's own files, which the host's bundler resolves
+ * and emits. The consumer scenario builds the documented setup with Vite and
+ * `@tailwindcss/postcss`, the combination where a relative `url()` in an imported stylesheet is
+ * read against the wrong file, and asks a browser whether each family actually loaded. The app
+ * scenario reads the same faces out of the app's own build.
+ */
+
+const PROBE_DIR = resolve(repoRoot, 'e2e/specs/.test-results/published-font-faces');
+const PACKAGE_ROOT = resolve(repoRoot, 'packages/client');
+const FONT_SOURCES = resolve(PACKAGE_ROOT, 'src/theme/fonts');
+
+const FAMILIES = ['Inter', 'Roboto Mono', 'Inconsolata'];
+
+const CONTENT_TYPES: Record<string, string> = {
+ '.css': 'text/css',
+ '.html': 'text/html',
+ '.js': 'text/javascript',
+ '.woff2': 'font/woff2',
+};
+
+/** Renders text in `family` and reports the status of each face the browser loaded for it. */
+function loadFamily(page: Page, family: string): Promise<string[]> {
+ return page.evaluate(async (name) => {
+ const faces = await document.fonts.load(`16px "${name}"`, 'probe');
+ return faces.map((face) => face.status);
+ }, family);
+}
+
+test.describe('the published font faces', () => {
+ test('a Vite consumer of theme.css loads the package fonts @scenario:a-vite-consumer-loads-the-package-fonts', async ({
+ page,
+ }) => {
+ inOneProject();
+ test.setTimeout(300_000);
+ rmSync(PROBE_DIR, { recursive: true, force: true });
+ mkdirSync(PROBE_DIR, { recursive: true });
+
+ const distFonts = resolve(PACKAGE_ROOT, 'dist/fonts');
+ const shipped = readdirSync(FONT_SOURCES);
+ let built = true;
+ try {
+ built = shipped.every((name) => readdirSync(distFonts).includes(name));
+ } catch {
+ built = false;
+ }
+ if (!built) {
+ const result = run('npm', ['run', 'build', '--prefix', PACKAGE_ROOT]);
+ expect(result.status, `the component library did not build:\n${result.output}`).toBe(0);
+ }
+
+ /** The documented consumer setup, verbatim except for where its config file lives. The
+ * package itself resolves through node_modules, as it does in a consumer's install. */
+ const readme = readFileSync(resolve(PACKAGE_ROOT, 'src/theme/README.md'), 'utf8');
+ const blocks = (lang: string) =>
+ [...readme.matchAll(new RegExp('```' + lang + '\\n([\\s\\S]*?)```', 'g'))].map((m) => m[1]);
+ const stylesheet = blocks('css').find((css) =>
+ css.includes("@import '@librechat/client/style.css';"),
+ );
+ const tailwindConfig = blocks('js').find((js) =>
+ js.includes("require('@librechat/client/tailwind-preset')"),
+ );
+ const postcssConfig = blocks('js').find((js) => js.includes("'@tailwindcss/postcss'"));
+ expect(stylesheet, 'the complete consumer stylesheet is documented').toBeDefined();
+ expect(tailwindConfig, 'the consumer preset configuration is documented').toBeDefined();
+ expect(postcssConfig, 'the consumer PostCSS configuration is documented').toBeDefined();
+
+ writeFileSync(join(PROBE_DIR, 'tailwind.config.cjs'), tailwindConfig!);
+ writeFileSync(join(PROBE_DIR, 'postcss.config.cjs'), postcssConfig!);
+ writeFileSync(
+ join(PROBE_DIR, 'style.css'),
+ stylesheet!.replace(/@config '[^']+';/, "@config './tailwind.config.cjs';"),
+ );
+ writeFileSync(join(PROBE_DIR, 'main.js'), "import './style.css';\n");
+ writeFileSync(
+ join(PROBE_DIR, 'index.html'),
+ `<!doctype html><html><head><script type="module" src="./main.js"></script></head>
+<body><p class="font-sans">Sans</p><code class="font-mono">mono</code></body></html>`,
+ );
+
+ /** Vite warns, rather than fails, when a `url()` does not resolve and leaves it to 404 at
+ * runtime, so the build reports its warnings and the test reads them. */
+ const outDir = join(PROBE_DIR, 'dist');
+ const builder = join(PROBE_DIR, 'build.mjs');
+ writeFileSync(
+ builder,
+ `import { build, createLogger } from 'vite';
+const logger = createLogger('warn');
+const warnings = [];
+logger.warn = (message) => warnings.push(message);
+logger.warnOnce = (message) => warnings.push(message);
+await build({
+ root: ${JSON.stringify(PROBE_DIR)},
+ configFile: false,
+ customLogger: logger,
+ build: { outDir: ${JSON.stringify(outDir)}, emptyOutDir: true },
+});
+console.log(JSON.stringify(warnings));
+`,
+ );
+ const bundled = run(process.execPath, [builder]);
+ expect(bundled.status, `the consumer did not build:\n${bundled.output}`).toBe(0);
+ expect(bundled.output).not.toContain("didn't resolve at build time");
+ /** An `@import` after `@config` is skipped by Vite's inliner, which would drop the
+ * component stylesheet from the documented setup. */
+ expect(bundled.output).not.toContain('@import statements must precede');
+
+ /** Every face ships from the package unchanged, beside the component stylesheet. */
+ const assets = readdirSync(join(outDir, 'assets'));
+ const bundledCss = assets
+ .filter((asset) => asset.endsWith('.css'))
+ .map((asset) => readFileSync(join(outDir, 'assets', asset), 'utf8'))
+ .join('\n');
+ expect(bundledCss).toContain('.animated-tab-panel');
+ shipped
+ .filter((name) => name.endsWith('.woff2'))
+ .forEach((name) => {
+ const stem = name.replace(/\.woff2$/, '');
+ const emitted = assets.find(
+ (asset) => asset.startsWith(`${stem}-`) && asset.endsWith('.woff2'),
+ );
+ expect(emitted, `${name} was not emitted`).toBeDefined();
+ expect(
+ readFileSync(join(outDir, 'assets', emitted!)).equals(
+ readFileSync(join(FONT_SOURCES, name)),
+ ),
+ ).toBe(true);
+ });
+
+ await page.route('http://consumer.test/**', async (route) => {
+ const { pathname } = new URL(route.request().url());
+ const path = pathname === '/' ? '/index.html' : pathname;
+ try {
+ const body = readFileSync(join(outDir, path));
+ await route.fulfill({ body, contentType: CONTENT_TYPES[extname(path)] ?? 'text/plain' });
+ } catch {
+ await route.fulfill({ status: 404 });
+ }
+ });
+ await page.goto('http://consumer.test/');
+
+ for (const family of FAMILIES) {
+ expect({ family, statuses: await loadFamily(page, family) }).toEqual({
+ family,
+ statuses: ['loaded'],
+ });
+ }
+ /** The stock families are what the plain utilities render. */
+ expect(
+ await page.locator('p.font-sans').evaluate((el) => getComputedStyle(el).fontFamily),
+ ).toMatch(/^Inter,/);
+ expect(
+ await page.locator('code.font-mono').evaluate((el) => getComputedStyle(el).fontFamily),
+ ).toMatch(/^"Roboto Mono",/);
+ });
+
+ test('the app loads its stock faces and licences from the package @scenario:the-app-loads-its-stock-faces-from-the-package', async ({
+ page,
+ }) => {
+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
+ await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible({
+ timeout: 30000,
+ });
+
+ for (const family of ['Inter', 'Roboto Mono']) {
+ expect({ family, statuses: await loadFamily(page, family) }).toEqual({
+ family,
+ statuses: ['loaded'],
+ });
+ }
+
+ for (const name of readdirSync(FONT_SOURCES)) {
+ const response = await page.request.get(`/assets/fonts/${name}`);
+ expect([name, response.status()]).toEqual([name, 200]);
+ expect((await response.body()).equals(readFileSync(join(FONT_SOURCES, name)))).toBe(true);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/suppression-baseline.spec.ts b/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
index a42ac16707..3592d01bd5 100644
--- a/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
+++ b/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
@@ -1126,9 +1126,10 @@ function syntheticRoot(): string {
/**
* What `packages/client/package.json` promises inside `dist`: its entry fields
- * and every string leaf of `exports`. A build is only finished when these are
- * there, which is what the runner checks and what the miniature repository has
- * to reproduce to stand in for one.
+ * and every string leaf of `exports` except a subpath pattern, which names no
+ * single file. A build is only finished when these are there, which is what the
+ * runner checks and what the miniature repository has to reproduce to stand in
+ * for one.
*/
function bundleEntries(): string[] {
const manifest = JSON.parse(
@@ -1138,7 +1139,7 @@ function bundleEntries(): string[] {
const collect = (value: unknown): void => {
if (typeof value === 'string') {
const path = value.replace(/^\.\//, '');
- if (path.startsWith('dist/')) declared.push(path);
+ if (path.startsWith('dist/') && !path.includes('*')) declared.push(path);
return;
}
if (typeof value === 'object' && value !== null) Object.values(value).forEach(collect);
diff --git a/packages/client/package.json b/packages/client/package.json
index 92681296b6..13b65bcaf9 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -23,6 +23,7 @@
"./tailwind-preset": "./tailwind.preset.cjs",
"./theme.css": "./dist/tokens.css",
"./style.css": "./dist/style.css",
+ "./fonts/*": "./dist/fonts/*",
"./package.json": "./package.json"
},
"files": [
diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.md
index a9526f6648..44a6674dc5 100644
--- a/packages/client/src/theme/README.md
+++ b/packages/client/src/theme/README.md
@@ -44,11 +44,14 @@ The defaults reproduce the scale those utilities had before, so a theme that nam
changes nothing. The mapping lives in `tokens.css`, which the app stylesheet imports and
`@librechat/client/theme.css` publishes, so a consumer's utilities are the app's.
-The stock families name Inter (`font-sans`, `font-theme-ui`) and Roboto Mono (`font-mono`), which
-the LibreChat app self-hosts with its own `@font-face` rules; the package does not ship the font
-files. A consumer that does not load them renders the next family in each stack (`sans-serif`, then
-`ui-monospace` and the platform monospace fonts), or sets `fontFamily` and `monoFontFamily`, or the
-`--theme-font-family` and `--theme-mono-font-family` properties, to families it does load.
+The stock families name Inter (`font-sans`, `font-theme-ui`) and Roboto Mono (`font-mono`), and
+the ClickHouse theme names Inconsolata. `theme.css` ships all three: `fonts.css` declares their
+`@font-face` rules against the package's own files by export (`@librechat/client/fonts/*`), and
+the host's bundler (Vite, webpack's css-loader, esbuild) resolves and emits them, exactly as the
+app's build does. A pipeline that serves the compiled CSS without a bundler has to serve those
+paths itself. A face downloads only once text renders in it. The SIL Open Font License of
+each family ships beside its files (`fonts/*-OFL.txt`); keep it with the files when redistributing
+them.
> **Breaking change:** the preset used to pin `rounded-sm`, `rounded-md` and `rounded-lg` to
> `--radius` (0.125rem, 0.375rem and 0.5rem by default). They now read `--theme-radius-sm`,
@@ -228,14 +231,13 @@ below are never compiled and the import fails with Tailwind's direct-plugin erro
Tailwind 4 does not look for a JavaScript config on its own, so writing the file above is not
enough: the stylesheet has to load it, next to the import that pulls Tailwind in. Without the
directive the preset, the package content glob and the `high-contrast:` variant are absent,
-and the published components render with most of their classes ungenerated. A consumer uses the same import order as the SPA's `client/src/style.css`:
+and the published components render with most of their classes ungenerated. A consumer uses the same import order as the SPA's `client/src/style.css`, with the package stylesheet among the imports: every `@import` has to precede `@config`, or Vite's CSS pipeline drops the ones after it.
```css
@import 'tailwindcss';
@import '@librechat/client/theme.css';
-@config '../tailwind.config.js';
-
@import '@librechat/client/style.css';
+@config '../tailwind.config.js';
```
The package stylesheet carries the component CSS and the one preflight rule the primitives
diff --git a/packages/client/src/theme/fonts.css b/packages/client/src/theme/fonts.css
new file mode 100644
index 0000000000..12e8f74001
--- /dev/null
+++ b/packages/client/src/theme/fonts.css
@@ -0,0 +1,106 @@
+/**
+ * The font faces the stock theme and the bundled themes name, and the single source for them.
+ *
+ * `tokens.css` imports this file, so the app and a consumer of `@librechat/client/theme.css` load
+ * the same files: Inter for `font-sans` and `font-theme-ui`, Roboto Mono for `font-mono`, and
+ * Inconsolata, which the ClickHouse theme opts into. Each `url()` names the file by its package
+ * export (`@librechat/client/fonts/*`) rather than by a relative path, and the host's bundler
+ * resolves and emits it. A relative path would be read against the wrong file: Vite inlines this
+ * stylesheet before Tailwind runs, and Tailwind reports every declaration it emits as coming from
+ * the stylesheet at the root of the import chain. Browsers fetch a declared face only once text
+ * renders in it, so a family no theme names costs nothing. Every family is under the SIL Open Font License 1.1, whose text ships beside the
+ * files (`fonts/*-OFL.txt`), as the licence requires of any redistribution.
+ */
+@font-face {
+ font-display: swap;
+ font-family: Inter;
+ font-style: normal;
+ font-weight: 400;
+ src: url('@librechat/client/fonts/Inter-Regular.woff2') format('woff2');
+ size-adjust: 94%;
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inter;
+ font-style: italic;
+ font-weight: 400;
+ src: url('@librechat/client/fonts/Inter-Italic.woff2') format('woff2');
+ size-adjust: 94%;
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inter;
+ font-style: normal;
+ font-weight: 500;
+ src: url('@librechat/client/fonts/Inter-SemiBold.woff2') format('woff2');
+ size-adjust: 94%;
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inter;
+ font-style: italic;
+ font-weight: 500;
+ src: url('@librechat/client/fonts/Inter-SemiBoldItalic.woff2') format('woff2');
+ size-adjust: 94%;
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inter;
+ font-style: normal;
+ font-weight: 600;
+ src: url('@librechat/client/fonts/Inter-Bold.woff2') format('woff2');
+ size-adjust: 94%;
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inter;
+ font-style: italic;
+ font-weight: 600;
+ src: url('@librechat/client/fonts/Inter-BoldItalic.woff2') format('woff2');
+ size-adjust: 94%;
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Roboto Mono;
+ font-style: normal;
+ font-weight: 400;
+ src: url('@librechat/client/fonts/roboto-mono-latin-400-normal.woff2') format('woff2');
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Roboto Mono;
+ font-style: normal;
+ font-weight: 700;
+ src: url('@librechat/client/fonts/roboto-mono-latin-700-normal.woff2') format('woff2');
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Roboto Mono;
+ font-style: italic;
+ font-weight: 400;
+ src: url('@librechat/client/fonts/roboto-mono-latin-400-italic.woff2') format('woff2');
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inconsolata;
+ font-style: normal;
+ font-weight: 400;
+ src: url('@librechat/client/fonts/inconsolata-latin-400-normal.woff2') format('woff2');
+}
+
+@font-face {
+ font-display: swap;
+ font-family: Inconsolata;
+ font-style: normal;
+ font-weight: 700;
+ src: url('@librechat/client/fonts/inconsolata-latin-700-normal.woff2') format('woff2');
+}
diff --git a/client/public/fonts/Inter-Bold.woff2 b/packages/client/src/theme/fonts/Inter-Bold.woff2
similarity index 100%
rename from client/public/fonts/Inter-Bold.woff2
rename to packages/client/src/theme/fonts/Inter-Bold.woff2
diff --git a/client/public/fonts/Inter-BoldItalic.woff2 b/packages/client/src/theme/fonts/Inter-BoldItalic.woff2
similarity index 100%
rename from client/public/fonts/Inter-BoldItalic.woff2
rename to packages/client/src/theme/fonts/Inter-BoldItalic.woff2
diff --git a/client/public/fonts/Inter-Italic.woff2 b/packages/client/src/theme/fonts/Inter-Italic.woff2
similarity index 100%
rename from client/public/fonts/Inter-Italic.woff2
rename to packages/client/src/theme/fonts/Inter-Italic.woff2
diff --git a/client/public/fonts/Inter-Regular.woff2 b/packages/client/src/theme/fonts/Inter-Regular.woff2
similarity index 100%
rename from client/public/fonts/Inter-Regular.woff2
rename to packages/client/src/theme/fonts/Inter-Regular.woff2
diff --git a/client/public/fonts/Inter-SemiBold.woff2 b/packages/client/src/theme/fonts/Inter-SemiBold.woff2
similarity index 100%
rename from client/public/fonts/Inter-SemiBold.woff2
rename to packages/client/src/theme/fonts/Inter-SemiBold.woff2
diff --git a/client/public/fonts/Inter-SemiBoldItalic.woff2 b/packages/client/src/theme/fonts/Inter-SemiBoldItalic.woff2
similarity index 100%
rename from client/public/fonts/Inter-SemiBoldItalic.woff2
rename to packages/client/src/theme/fonts/Inter-SemiBoldItalic.woff2
diff --git a/client/public/fonts/inconsolata-OFL.txt b/packages/client/src/theme/fonts/inconsolata-OFL.txt
similarity index 100%
rename from client/public/fonts/inconsolata-OFL.txt
rename to packages/client/src/theme/fonts/inconsolata-OFL.txt
diff --git a/client/public/fonts/inconsolata-latin-400-normal.woff2 b/packages/client/src/theme/fonts/inconsolata-latin-400-normal.woff2
similarity index 100%
rename from client/public/fonts/inconsolata-latin-400-normal.woff2
rename to packages/client/src/theme/fonts/inconsolata-latin-400-normal.woff2
diff --git a/client/public/fonts/inconsolata-latin-700-normal.woff2 b/packages/client/src/theme/fonts/inconsolata-latin-700-normal.woff2
similarity index 100%
rename from client/public/fonts/inconsolata-latin-700-normal.woff2
rename to packages/client/src/theme/fonts/inconsolata-latin-700-normal.woff2
diff --git a/packages/client/src/theme/fonts/inter-OFL.txt b/packages/client/src/theme/fonts/inter-OFL.txt
new file mode 100644
index 0000000000..9b2ca37b3f
--- /dev/null
+++ b/packages/client/src/theme/fonts/inter-OFL.txt
@@ -0,0 +1,92 @@
+Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION AND CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/packages/client/src/theme/fonts/roboto-mono-OFL.txt b/packages/client/src/theme/fonts/roboto-mono-OFL.txt
new file mode 100644
index 0000000000..8e7df338d3
--- /dev/null
+++ b/packages/client/src/theme/fonts/roboto-mono-OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2015 The Roboto Mono Project Authors (https://github.com/googlefonts/robotomono)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/client/public/fonts/roboto-mono-latin-400-italic.woff2 b/packages/client/src/theme/fonts/roboto-mono-latin-400-italic.woff2
similarity index 100%
rename from client/public/fonts/roboto-mono-latin-400-italic.woff2
rename to packages/client/src/theme/fonts/roboto-mono-latin-400-italic.woff2
diff --git a/client/public/fonts/roboto-mono-latin-400-normal.woff2 b/packages/client/src/theme/fonts/roboto-mono-latin-400-normal.woff2
similarity index 100%
rename from client/public/fonts/roboto-mono-latin-400-normal.woff2
rename to packages/client/src/theme/fonts/roboto-mono-latin-400-normal.woff2
diff --git a/client/public/fonts/roboto-mono-latin-700-normal.woff2 b/packages/client/src/theme/fonts/roboto-mono-latin-700-normal.woff2
similarity index 100%
rename from client/public/fonts/roboto-mono-latin-700-normal.woff2
rename to packages/client/src/theme/fonts/roboto-mono-latin-700-normal.woff2
diff --git a/packages/client/src/theme/themes/clickhouse.ts b/packages/client/src/theme/themes/clickhouse.ts
index 92ab538b76..3f39d788e8 100644
--- a/packages/client/src/theme/themes/clickhouse.ts
+++ b/packages/client/src/theme/themes/clickhouse.ts
@@ -298,7 +298,7 @@ export const clickHouseDarkTheme: IThemeRGB = {
* the dialog-sized steps onto `radii.2`, and the largest onto `radii.3`. `rounded-sm` takes
* `radii.1`, which LibreChat's `sm` also renders at on a 16px root; every larger step tightens.
*
- * Click UI's mono family is Inconsolata, which the client self-hosts in `client/src/fonts.css`
+ * Click UI's mono family is Inconsolata, which the component library ships in `theme/fonts.css`
* (latin 400 and 700). The tail is the same metric-matched stack the default theme uses (Click
* UI's own tail names `"SFMono Regular"`, which no platform installs).
*
diff --git a/packages/client/src/theme/tokens.css b/packages/client/src/theme/tokens.css
index f7448dca3a..5073d2614b 100644
--- a/packages/client/src/theme/tokens.css
+++ b/packages/client/src/theme/tokens.css
@@ -10,12 +10,14 @@
* modifier on top through color-mix.
*
* client/src/style.css imports this file, and `@librechat/client/theme.css` publishes it, with the
- * stock value of every property it reads (`defaults.css`, imported below).
+ * stock value of every property it reads (`defaults.css`) and the font faces those values name
+ * (`fonts.css`), both imported below.
* Declaring a token here is what makes `bg-<token>` exist; @shadcn/lint reads these
* declarations, so a name that is not here is reported rather than silently rendering
* nothing.
*/
@import './defaults.css';
+@import './fonts.css';
@theme inline {
/* brand and surfaces */
diff --git a/packages/client/tsdown.config.mjs b/packages/client/tsdown.config.mjs
index adc14f6eb6..2e87e6ab10 100644
--- a/packages/client/tsdown.config.mjs
+++ b/packages/client/tsdown.config.mjs
@@ -30,9 +30,12 @@ export default defineConfig({
// the destination directory, not the file, pointing it at `dist/theme.css` produced a
// directory of that name holding `tokens.css`, and the export resolved to a folder, so the
// file keeps its name in `dist` and the export maps `./theme.css` onto it. It imports the stock
- // values beside it by relative path, so the two ship side by side.
+ // values and the font faces beside it by relative path, and the faces load `fonts/`, so all of
+ // them ship side by side.
{ from: 'src/theme/tokens.css', to: 'dist' },
{ from: 'src/theme/defaults.css', to: 'dist' },
+ { from: 'src/theme/fonts.css', to: 'dist' },
+ { from: 'src/theme/fonts', to: 'dist' },
],
// Extract all component CSS into a single `dist/style.css` (no import left in the JS, so the
// CJS output stays valid CommonJS). Consumers import `@librechat/client/style.css` once.
diff --git a/scripts/static-checks.mts b/scripts/static-checks.mts
index a97012f956..44a0db99c6 100644
--- a/scripts/static-checks.mts
+++ b/scripts/static-checks.mts
@@ -1591,7 +1591,8 @@ function designMetadataIsFresh(): boolean {
* every string leaf of `exports`, kept to the ones inside `dist`. These are what
* a caller — and so the design rules, resolving `@librechat/client` — actually
* loads, which is what makes their absence a build that did not happen rather
- * than a build that is merely old.
+ * than a build that is merely old. A subpath pattern (`./dist/fonts/*`) names no
+ * file a caller loads as an entry, so it is not one of them.
*/
function declaredBundleFiles(): string[] {
let manifest: Record<string, unknown>;
@@ -1606,7 +1607,7 @@ function declaredBundleFiles(): string[] {
const collect = (value: unknown): void => {
if (typeof value === 'string') {
const path = value.replace(/^\.\//, '');
- if (path.startsWith('dist/')) declared.push(path);
+ if (path.startsWith('dist/') && !path.includes('*')) declared.push(path);
return;
}
if (typeof value === 'object' && value !== null) Object.values(value).forEach(collect);