🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(web): use IBM Plex Mono for monospace text (#17557)
Trang Nguyend7a16df9b0f0
diff --git a/knip.jsonc b/knip.jsoncindex ff8f0e30a0..d7624fcd05 100644--- a/knip.jsonc+++ b/knip.jsonc@@ -42,6 +42,7 @@"ignoreFiles": [// Standalone benchmark invoked directly with Node rather than imported by the application."src/features/traces/components/AdvancedJsonViewer/lazy/benchByteJsonIndex.ts",+ "src/__tests__/mocks/**",],// Include runtime JavaScript modules such as src/env.mjs in dependency analysis."project": ["src/**/*.{ts,tsx,mjs}"],diff --git a/web/public/fonts/IBMPlexMono-Bold.woff2 b/web/public/fonts/IBMPlexMono-Bold.woff2new file mode 100644index 0000000000..262a671625Binary files /dev/null and b/web/public/fonts/IBMPlexMono-Bold.woff2 differdiff --git a/web/public/fonts/IBMPlexMono-OFL.txt b/web/public/fonts/IBMPlexMono-OFL.txtnew file mode 100644index 0000000000..046fc66490--- /dev/null+++ b/web/public/fonts/IBMPlexMono-OFL.txt@@ -0,0 +1,93 @@+Google Inc.++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 & 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/web/public/fonts/IBMPlexMono-Regular.woff2 b/web/public/fonts/IBMPlexMono-Regular.woff2new file mode 100644index 0000000000..a6c77d653dBinary files /dev/null and b/web/public/fonts/IBMPlexMono-Regular.woff2 differdiff --git a/web/src/__tests__/mocks/nextFontLocal.ts b/web/src/__tests__/mocks/nextFontLocal.tsnew file mode 100644index 0000000000..28109dd4ed--- /dev/null+++ b/web/src/__tests__/mocks/nextFontLocal.ts@@ -0,0 +1,7 @@+export default function localFont() {+ return {+ className: "",+ variable: "",+ style: { fontFamily: "monospace" },+ };+}diff --git a/web/src/pages/_app.tsx b/web/src/pages/_app.tsxindex 872af9b87f..1a5181ef21 100644--- a/web/src/pages/_app.tsx+++ b/web/src/pages/_app.tsx@@ -21,6 +21,7 @@ import { NextAdapterPagesWithReadyGuard } from "@/src/utils/nextAdapterPagesWithimport { QueryParamProvider } from "use-query-params";import "@/src/styles/globals.css";+import { plexMono } from "@/src/styles/fonts";import { AppLayout } from "@/src/components/layouts/app-layout";import { DefaultHead } from "@/src/components/layouts/default-head/DefaultHead";import { useEffect, useRef } from "react";@@ -171,7 +172,7 @@ const MyApp: AppType<{ session: Session | null }> = ({);return (- <>+ <div className={`${plexMono.variable} contents`}>{/* Replaces Next's default `width=device-width` (next/head dedupes byname). `maximum-scale=1` stops iOS Safari auto-zooming a focusedsub-16px field; iOS ignores `user-scalable=no` for user gestures, so@@ -233,7 +234,7 @@ const MyApp: AppType<{ session: Session | null }> = ({</TooltipProvider></QueryParamProvider></LayerProvider>- </>+ </div>);};diff --git a/web/src/pages/_document.tsx b/web/src/pages/_document.tsxindex 9f6db9de05..e4d351c6f4 100644--- a/web/src/pages/_document.tsx+++ b/web/src/pages/_document.tsx@@ -1,4 +1,5 @@import { Html, Head, Main, NextScript } from "next/document";+import { plexMono } from "@/src/styles/fonts";export default function Document() {return (@@ -7,7 +8,7 @@ export default function Document() {// language — WCAG 2.1 SC 3.1.1.// next-themes mutates class/style on <html> before hydration; suppress the// expected mismatch one level deep (React 19 logs it and can re-render).- <Html lang="en" suppressHydrationWarning>+ <Html lang="en" suppressHydrationWarning className={plexMono.variable}><Head /><body><Main />diff --git a/web/src/styles/fonts.ts b/web/src/styles/fonts.tsnew file mode 100644index 0000000000..c0f53fe8bc--- /dev/null+++ b/web/src/styles/fonts.ts@@ -0,0 +1,18 @@+import localFont from "next/font/local";++export const plexMono = localFont({+ src: [+ {+ path: "../../public/fonts/IBMPlexMono-Regular.woff2",+ weight: "400",+ style: "normal",+ },+ {+ path: "../../public/fonts/IBMPlexMono-Bold.woff2",+ weight: "600",+ style: "normal",+ },+ ],+ variable: "--font-plex-mono",+ display: "swap",+});diff --git a/web/src/styles/globals.css b/web/src/styles/globals.cssindex 7d2302359c..abafb77ec7 100644--- a/web/src/styles/globals.css+++ b/web/src/styles/globals.css@@ -26,8 +26,8 @@ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji","Segoe UI Symbol", "Noto Color Emoji";--font-mono:- ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",- "Courier New", monospace;+ var(--font-plex-mono, "IBM Plex Mono"), ui-monospace, SFMono-Regular, Menlo,+ Monaco, Consolas, "Liberation Mono", "Courier New", monospace;/* Weight ROLES — exactly TWO weights exist in this app: regular and bold.Both are font-relative, so components never hardcode numbers.diff --git a/web/vitest.config.mts b/web/vitest.config.mtsindex 64a732e7cc..934128a75b 100644--- a/web/vitest.config.mts+++ b/web/vitest.config.mts@@ -177,6 +177,13 @@ export default defineConfig({"node_modules/next-query-params/dist/pages.esm.js",),},+ {+ find: /^next\/font\/local$/,+ replacement: join(+ import.meta.dirname,+ "src/__tests__/mocks/nextFontLocal.ts",+ ),+ },],},test: {