diff --git a/ASSETS.md b/ASSETS.md index 3566d1c..0462da5 100644 --- a/ASSETS.md +++ b/ASSETS.md @@ -6,7 +6,7 @@ Every non-code asset in this repository (icons, images, example projects, colour Generated-in-code art is original and has no file to list (default colour schemes, file-type badges, the placeholder app icon that `apps/lutra-desktop/build.rs` falls back to when `assets/app-icon/icon.png` is missing). -**Font files are never committed.** Inter and JetBrains Mono (both SIL OFL 1.1) come from the `@fontsource` npm packages and are listed in `NOTICE`. **Lucide icons** come from the `lucide-vue-next` npm package (ISC) and are listed in `NOTICE`; only icons drawn for Lutra live in `assets/icons/` with the prefix `lt-`. +**Font files are never committed.** Fonts come from `@fontsource` npm packages and are listed in `NOTICE`: IBM Plex Mono (SIL OFL 1.1, bundled as the code font for the editor and the terminal, owner decision D28; the only package allowed under OFL-1.1, see `PACKAGE_EXCEPTIONS` in `xtask/src/licences.rs`). The UI uses the system font. **Lucide icons** come from the `lucide-vue-next` npm package (ISC) and are listed in `NOTICE`; only icons drawn for Lutra live in `assets/icons/` with the prefix `lt-`. | Asset | Author | Source | Licence | Notes | |---|---|---|---|---| diff --git a/NOTICE b/NOTICE index 2c400cb..e4b42d1 100644 --- a/NOTICE +++ b/NOTICE @@ -14,7 +14,9 @@ kept up to date when one is added or removed. Bundled components (planned; update when added): * Lucide icons (@lucide/vue, formerly lucide-vue-next) — ISC License, https://lucide.dev * Inter typeface (@fontsource/inter) — SIL Open Font License 1.1 - * JetBrains Mono typeface (@fontsource/jetbrains-mono) — SIL Open Font License 1.1 + * IBM Plex Mono typeface (@fontsource/ibm-plex-mono), Lutra's code font for + the editor and the terminal — SIL Open Font License 1.1, Copyright + IBM Corp.; licence text in the package (bundled since C9 T1, D28) * CodeMirror 6 — MIT License * tree-sitter and tree-sitter-php — MIT License * Tauri — MIT OR Apache-2.0 (the Windows setup is built from an adapted diff --git a/crates/engine/src/theme.rs b/crates/engine/src/theme.rs index 36b5504..c91246c 100644 --- a/crates/engine/src/theme.rs +++ b/crates/engine/src/theme.rs @@ -47,7 +47,7 @@ const COMMON: &[(&str, &str)] = &[ ), ( "font-mono", - "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", ), ("font-size-ui", "13px"), ("font-size-small", "12px"), diff --git a/deny.toml b/deny.toml index 47934c8..546946a 100644 --- a/deny.toml +++ b/deny.toml @@ -30,5 +30,10 @@ allow = [ crate = "notify" allow = ["CC0-1.0"] +# OFL-1.1 is approved for one frontend package only: the bundled code font +# @fontsource/ibm-plex-mono (owner decision D28, 2026-11-06). It is an npm +# package, not a crate, so its exception lives in PACKAGE_EXCEPTIONS in +# xtask/src/licences.rs; no crate may use OFL-1.1. + [licenses.private] ignore = true diff --git a/docs/themes.md b/docs/themes.md index 249a174..b38877a 100644 --- a/docs/themes.md +++ b/docs/themes.md @@ -1,6 +1,6 @@ # Themes -> **Status:** six built-in themes, theme files with import, editor font settings (C9 T1) · **Last updated:** 2026-11-02 +> **Status:** six built-in themes, theme files with import, editor font settings, bundled code font IBM Plex Mono (C9 T1) · **Last updated:** 2026-11-06 Every colour and font in Lutra comes from theme tokens: CSS custom properties `--lt-` that `crates/engine/src/theme.rs` defines and the UI reads with `var(--lt-…)`. Nothing in the UI hard-codes a colour. @@ -30,7 +30,7 @@ The **Editor** section of the settings has three font settings. They apply live | Setting | Default | Meaning | |---|---|---| -| `editor.fontFamily` | empty | A CSS font list such as `"JetBrains Mono", monospace`. Empty uses Lutra's monospace stack (`ui-monospace, "Cascadia Code", Menlo, Consolas, monospace`), which also stays behind your choice as a fallback. The font must be installed. The characters `; { } < > \` are refused. Applies to the editor and other code text at once, and to terminals opened afterwards (it drives `--lt-font-mono`). | +| `editor.fontFamily` | empty | A CSS font list such as `"Fira Code", monospace`. Empty uses Lutra's own code font, IBM Plex Mono, which ships with Lutra (regular, bold and italic; comments are set in its italic). The default stack (`"IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace`) also stays behind your choice as a fallback. Any other font must be installed. The characters `; { } < > \` are refused. Applies to the editor and other code text at once, and to terminals opened afterwards (it drives `--lt-font-mono`). | | `editor.fontSize` | 14 | Size in pixels, 8 to 48. | | `editor.lineHeight` | 150 | Line height in percent of the font size, 100 to 300. | @@ -149,10 +149,11 @@ Lutra does not check the contrast of an imported theme. To check it the way the - A built-in theme is a `Theme` constant in `crates/engine/src/theme.rs`, listed in `BUILTIN`, with its name in `ui/src/i18n/en.json` (`theme.` and `settings.appearance.theme.value.`). - Every built-in theme defines exactly the tokens of `DARK` (a Rust test checks it). After changing a token, run the engine tests with `LUTRA_UPDATE_SNAPSHOTS=1` to rewrite `ui/tests/theme/themes.json`. The Vitest contrast test reads that file. - A new token needs a value in every theme, a row above, and a contrast pair in `contrast.test.ts` if text or marks are drawn with it. -- Bundling JetBrains Mono as the default (waiting for the owner to approve OFL-1.1 in `xtask/src/licences.rs` and `deny.toml`) takes three steps: add `@fontsource/jetbrains-mono` to `ui/package.json` and import it in `ui/src/main.ts`; put `"JetBrains Mono"` first in `font-mono` (`COMMON` in `theme.rs`) and in `MONO_FALLBACK` (`ui/src/stores/settings.ts`); then update the default described above. +- The code font IBM Plex Mono comes from `@fontsource/ibm-plex-mono` (Latin and Latin Extended, 400 and 700 with italics, about 118 KB), imported in `ui/src/main.ts`, and leads `font-mono` (`COMMON` in `theme.rs`) and `MONO_FALLBACK` (`ui/src/stores/settings.ts`). Daniel chose it from four candidates Amy compared (D28); OFL-1.1 is allowed for this package only (`PACKAGE_EXCEPTIONS` in `xtask/src/licences.rs`, comment in `deny.toml`). The UI font stays the system font. ## Revision history | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | IBM Plex Mono bundled as the code font, italic comments (D28) | | 2026-11-02 | major | First version: four new built-in themes, theme file format and import, editor font settings (C9 T1) | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 3ec504d..8c41a87 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -26,7 +26,7 @@ - [ ] Light and dark themes from theme tokens - M1.10 (2026-10-16): Lutra Dark and Lutra Light from Rust tokens, switched live through `appearance.theme` (no reload), `system` follows the OS preference, the first frame uses the stored theme; the editor (selection, active line, cursor, gutter, matches), tabs and notices have their own tokens; WCAG AA contrast checked by Vitest for every text pair in both themes. Covered by Vitest DOM and control-channel tests; live check pending (gaming mode). M1.9b: theme picker in the settings dialog, editor font size from `editor.fontSize`. Missing: the native title bar following the theme, colour scheme editor, high-contrast theme (the palette command came with C9 T1). - H5 (2026-10-25): both themes follow the README banner, approved by the owner from before/after screenshots (tree, PHP editor, Problems, terminal, palette, settings; Windows 11, bundled UI, control port 7955): cream-tinted light theme, faintly plum-tinted dark theme, raspberry only as the accent, retuned syntax colours, the terminal on the editor surface. Diagnostics get their own colours (`--lt-diag-*`: error, amber warning, blue info, muted hint) in the underline, gutter dot, tooltip stripe and Problems icon; `--lt-vcs-*` status colours for M4.4; completion kind icons coloured by kind. Every text colour ≥ 4.5:1 and icon colour ≥ 3:1 in both themes (Vitest contrast test). - - C9 T1 (2026-11-02): four more built-in themes designed by Amy and approved by the owner: Plum Night and River (dark), Paper and Reed (light), each with the full token set and AA contrast checked by the Vitest contrast test. "Select Theme…" (`view.selectTheme`, View menu, palette) opens a picker that previews live while moving and restores on Escape; `theme.select`, `theme.current` and `theme.list` serve agents. Theme files (JSON, every colour token, validated; `docs/themes.md`) come in through "Import Theme…" (`view.importTheme`) or `theme.import`, are stored in Lutra's data directory and appear in the picker and the settings; a broken file gives the reason, a broken stored file is skipped with a warning. Editor font family and line height settings join the font size, all live. Missing: a colour scheme editor, exporting and removing themes in the UI, per-token font styles, a high-contrast theme, a bundled JetBrains Mono (needs the OFL licence approved for the frontend check). + - C9 T1 (2026-11-02): four more built-in themes designed by Amy and approved by the owner: Plum Night and River (dark), Paper and Reed (light), each with the full token set and AA contrast checked by the Vitest contrast test. "Select Theme…" (`view.selectTheme`, View menu, palette) opens a picker that previews live while moving and restores on Escape; `theme.select`, `theme.current` and `theme.list` serve agents. Theme files (JSON, every colour token, validated; `docs/themes.md`) come in through "Import Theme…" (`view.importTheme`) or `theme.import`, are stored in Lutra's data directory and appear in the picker and the settings; a broken file gives the reason, a broken stored file is skipped with a warning. Editor font family and line height settings join the font size, all live. Missing: a colour scheme editor, exporting and removing themes in the UI, per-token font styles, a high-contrast theme. Lutra's own code font, IBM Plex Mono (owner's choice, D28), ships for the editor and the terminal, with italic comments. - [ ] Notifications and background task indicator - M1.12 (2026-10-16): toasts at the bottom right for engine and host notifications (corrupt settings and journal entries at startup, folder that cannot be opened, `unsaved_changes` when switching projects, file watching stopped, failed commands without their own UI): info dismissed after 5 s, warnings and errors stay until closed, close button and Escape, at most 5 visible with "+n more", `role="status"`/`role="alert"`; startup notifications are replayed when the page starts listening. Vitest (19 store and component tests); live check pending (gaming mode). Missing: a notification log / Notifications tool window, actions inside a toast, balloon grouping, "don't show again", background task indicator with progress. - [ ] Structure tool window diff --git a/ui/package.json b/ui/package.json index 8319b09..67be294 100644 --- a/ui/package.json +++ b/ui/package.json @@ -29,6 +29,7 @@ "@codemirror/merge": "^6.12.3", "@codemirror/state": "^6.7.6", "@codemirror/view": "^6.43.14", + "@fontsource/ibm-plex-mono": "^5.3.0", "@lezer/highlight": "^1.2.5", "@lucide/vue": "^1.57.0", "@tauri-apps/api": "^2.12.3", diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml index 31ec137..b92d5df 100644 --- a/ui/pnpm-lock.yaml +++ b/ui/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: '@codemirror/view': specifier: ^6.43.14 version: 6.43.14 + '@fontsource/ibm-plex-mono': + specifier: ^5.3.0 + version: 5.3.0 '@lezer/highlight': specifier: ^1.2.5 version: 1.2.5 @@ -284,6 +287,9 @@ packages: '@noble/hashes': optional: true + '@fontsource/ibm-plex-mono@5.3.0': + resolution: {integrity: sha512-eTgnZjZEGk1QtD3ZstF+Vclo2HLAni8YMy34/DxllwZvyz1lR/1RF/xTiAquOBO7MvqBx8D2Ig2WCPMVfdZu7Q==} + '@humanfs/core@0.19.2': resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==} engines: {node: '>=18.18.0'} @@ -1620,6 +1626,8 @@ snapshots: '@exodus/bytes@1.16.0': {} + '@fontsource/ibm-plex-mono@5.3.0': {} + '@humanfs/core@0.19.2': dependencies: '@humanfs/types': 0.15.0 diff --git a/ui/src/components/editor/extensions.ts b/ui/src/components/editor/extensions.ts index 005a958..3ffa241 100644 --- a/ui/src/components/editor/extensions.ts +++ b/ui/src/components/editor/extensions.ts @@ -22,12 +22,13 @@ import { gitGutterExtensions } from "./gitGutter"; /** * Colours of the highlight classes (`language.ts`), one `--lt-syntax-*` * token each, spelled out so the theme tests can check every token name. + * Comments are set in italic, the bundled code font's real italic (D28). */ -const syntaxColours: Record<`.${typeof SYNTAX_CLASS}${SyntaxToken}`, { color: string }> = { +const syntaxColours: Record<`.${typeof SYNTAX_CLASS}${SyntaxToken}`, { color: string; fontStyle?: string }> = { ".lt-syntax-keyword": { color: "var(--lt-syntax-keyword)" }, ".lt-syntax-string": { color: "var(--lt-syntax-string)" }, ".lt-syntax-number": { color: "var(--lt-syntax-number)" }, - ".lt-syntax-comment": { color: "var(--lt-syntax-comment)" }, + ".lt-syntax-comment": { color: "var(--lt-syntax-comment)", fontStyle: "italic" }, ".lt-syntax-variable": { color: "var(--lt-syntax-variable)" }, ".lt-syntax-function": { color: "var(--lt-syntax-function)" }, ".lt-syntax-type": { color: "var(--lt-syntax-type)" }, diff --git a/ui/src/main.ts b/ui/src/main.ts index 1d592bc..782d5e4 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -1,7 +1,18 @@ /** * Entry point of the Lutra frontend: creates the Vue app with Pinia and - * mounts it on `#app`. + * mounts it on `#app`. Loads Lutra's bundled code font, IBM Plex Mono + * (OFL-1.1, owner decision D28), for the editor and the terminal: regular, + * bold and their italics, in the Latin and Latin Extended subsets, so the + * app needs no network and comments get a real italic. */ +import "@fontsource/ibm-plex-mono/latin-400.css"; +import "@fontsource/ibm-plex-mono/latin-400-italic.css"; +import "@fontsource/ibm-plex-mono/latin-700.css"; +import "@fontsource/ibm-plex-mono/latin-700-italic.css"; +import "@fontsource/ibm-plex-mono/latin-ext-400.css"; +import "@fontsource/ibm-plex-mono/latin-ext-400-italic.css"; +import "@fontsource/ibm-plex-mono/latin-ext-700.css"; +import "@fontsource/ibm-plex-mono/latin-ext-700-italic.css"; import { createPinia } from "pinia"; import { createApp } from "vue"; import App from "./App.vue"; diff --git a/ui/src/stores/settings.ts b/ui/src/stores/settings.ts index 7161729..5232f0b 100644 --- a/ui/src/stores/settings.ts +++ b/ui/src/stores/settings.ts @@ -81,7 +81,7 @@ export const FONT_FAMILY_KEY = "editor.fontFamily"; export const FONT_FAMILY_TOKEN = "--lt-font-mono"; /** Fonts behind a chosen family, as `font-mono` in `crates/engine/src/theme.rs`. */ -export const MONO_FALLBACK = 'ui-monospace, "Cascadia Code", Menlo, Consolas, monospace'; +export const MONO_FALLBACK = '"IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace'; /** Key of the editor line height setting, in percent of the font size. */ export const LINE_HEIGHT_KEY = "editor.lineHeight"; diff --git a/ui/tests/theme/themes.json b/ui/tests/theme/themes.json index 86763c3..516e793 100644 --- a/ui/tests/theme/themes.json +++ b/ui/tests/theme/themes.json @@ -21,7 +21,7 @@ "--lt-error": "#f2836b", "--lt-fg": "#ebe5dc", "--lt-fg-muted": "#9e9499", - "--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "--lt-font-mono": "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", "--lt-font-size-editor": "14px", "--lt-font-size-small": "12px", "--lt-font-size-ui": "13px", @@ -93,7 +93,7 @@ "--lt-error": "#b23a29", "--lt-fg": "#2a2427", "--lt-fg-muted": "#675d61", - "--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "--lt-font-mono": "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", "--lt-font-size-editor": "14px", "--lt-font-size-small": "12px", "--lt-font-size-ui": "13px", @@ -165,7 +165,7 @@ "--lt-error": "#f48a78", "--lt-fg": "#f0e6dc", "--lt-fg-muted": "#a8969f", - "--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "--lt-font-mono": "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", "--lt-font-size-editor": "14px", "--lt-font-size-small": "12px", "--lt-font-size-ui": "13px", @@ -237,7 +237,7 @@ "--lt-error": "#f08a7a", "--lt-fg": "#e2e8e6", "--lt-fg-muted": "#8e9ca3", - "--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "--lt-font-mono": "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", "--lt-font-size-editor": "14px", "--lt-font-size-small": "12px", "--lt-font-size-ui": "13px", @@ -309,7 +309,7 @@ "--lt-error": "#ad3524", "--lt-fg": "#221d20", "--lt-fg-muted": "#625b5f", - "--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "--lt-font-mono": "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", "--lt-font-size-editor": "14px", "--lt-font-size-small": "12px", "--lt-font-size-ui": "13px", @@ -381,7 +381,7 @@ "--lt-error": "#a63424", "--lt-fg": "#25261f", "--lt-fg-muted": "#5b5a4f", - "--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", + "--lt-font-mono": "\"IBM Plex Mono\", ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace", "--lt-font-size-editor": "14px", "--lt-font-size-small": "12px", "--lt-font-size-ui": "13px", diff --git a/xtask/src/licences.rs b/xtask/src/licences.rs index ad7aebf..68cd492 100644 --- a/xtask/src/licences.rs +++ b/xtask/src/licences.rs @@ -21,6 +21,12 @@ pub const ALLOWED: &[&str] = &[ "Unicode-3.0", ]; +/// Package-scoped exceptions: a package and the one extra licence it may +/// carry, each approved by the owner. They do not widen [`ALLOWED`] for any +/// other package. `@fontsource/ibm-plex-mono` is Lutra's bundled code font +/// under the SIL Open Font License 1.1 (owner decision D28, 2026-11-06). +pub const PACKAGE_EXCEPTIONS: &[(&str, &str)] = &[("@fontsource/ibm-plex-mono", "OFL-1.1")]; + /// Runs the check on the production dependencies of `ui/`. /// /// # Errors @@ -61,6 +67,9 @@ pub fn check_pnpm_report(json: &str) -> TaskResult> { } for package in packages.as_array().into_iter().flatten() { let name = package.get("name").and_then(Value::as_str).unwrap_or("?"); + if PACKAGE_EXCEPTIONS.contains(&(name, licence.as_str())) { + continue; + } problems.push(format!("{name}: {licence}")); } } @@ -102,4 +111,19 @@ mod tests { vec!["bad: GPL-3.0".to_string()] ); } + + #[test] + fn the_font_exception_covers_only_its_package_and_licence() { + let json = r#"{"OFL-1.1":[{"name":"@fontsource/ibm-plex-mono"},{"name":"@fontsource/other"}],"GPL-3.0":[{"name":"@fontsource/ibm-plex-mono"}]}"#; + let mut problems = check_pnpm_report(json).unwrap(); + problems.sort(); + assert_eq!( + problems, + vec![ + "@fontsource/ibm-plex-mono: GPL-3.0".to_string(), + "@fontsource/other: OFL-1.1".to_string() + ] + ); + assert!(!is_allowed("OFL-1.1")); + } }