Self-hosted AI workspace.
Python
feat(a11y): add a Text size control and an OpenDyslexic font option (#4210)
Tom49e62d9bb2c7
diff --git a/ACKNOWLEDGMENTS.md b/ACKNOWLEDGMENTS.mdindex fdf55c48a..94092c6ca 100644--- a/ACKNOWLEDGMENTS.md+++ b/ACKNOWLEDGMENTS.md@@ -86,6 +86,7 @@ Bundled in `static/fonts/`:| [Fira Code](https://github.com/tonsky/FiraCode) | SIL Open Font License 1.1 | Nikita Prokopov & contributors || [Inter](https://github.com/rsms/inter) | SIL Open Font License 1.1 | Rasmus Andersson || [GohuFont](https://font.gohu.org/) (`fonts/custom/GohuFont.ttf`) | WTFPL | Hugo Chargois |+| [OpenDyslexic](https://opendyslexic.org/) (`fonts/OpenDyslexic-{Regular,Bold}.woff2`) | SIL Open Font License 1.1 ([`licenses/OpenDyslexic-OFL.txt`](licenses/OpenDyslexic-OFL.txt)) | Abbie Gonzalez |## Python dependenciesdiff --git a/licenses/OpenDyslexic-OFL.txt b/licenses/OpenDyslexic-OFL.txtnew file mode 100644index 000000000..0a1d034b9--- /dev/null+++ b/licenses/OpenDyslexic-OFL.txt@@ -0,0 +1,94 @@+Copyright (c) 2019-07-29, Abbie Gonzalez (https://abbiecod.es|[email protected]),+with Reserved Font Name OpenDyslexic.+Copyright (c) 12/2012 - 2019+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/static/fonts/OpenDyslexic-Bold.woff2 b/static/fonts/OpenDyslexic-Bold.woff2new file mode 100644index 000000000..2f04ad119Binary files /dev/null and b/static/fonts/OpenDyslexic-Bold.woff2 differdiff --git a/static/fonts/OpenDyslexic-Regular.woff2 b/static/fonts/OpenDyslexic-Regular.woff2new file mode 100644index 000000000..47e26d82aBinary files /dev/null and b/static/fonts/OpenDyslexic-Regular.woff2 differdiff --git a/static/index.html b/static/index.htmlindex b20b73428..3718e50ae 100644--- a/static/index.html+++ b/static/index.html@@ -76,7 +76,7 @@}// Apply font earlyif (t && t.font) {- var fm = {mono:"'Fira Code', monospace",sans:"system-ui, -apple-system, 'Segoe UI', sans-serif",serif:"Georgia, 'Times New Roman', serif"};+ var fm = {mono:"'Fira Code', monospace",sans:"system-ui, -apple-system, 'Segoe UI', sans-serif",serif:"Georgia, 'Times New Roman', serif",opendyslexic:"'OpenDyslexic', sans-serif"};if (fm[t.font]) { s.setProperty('--font-family', fm[t.font]); }else { s.setProperty('--font-family', "'" + t.font.replace(/'/g,'') + "', sans-serif"); }}@@ -84,6 +84,12 @@if (t && t.density && t.density !== 'comfortable') {document.documentElement.classList.add('density-' + t.density);}+ // Apply UI text-size scale early (global accessibility pref, independent+ // of the active theme) so there's no flash on load.+ try {+ var _us = localStorage.getItem('odysseus-ui-scale');+ if (_us && _us !== '100') document.documentElement.classList.add('ui-scale-' + _us);+ } catch(e){}// Apply background pattern on body once availableif (t && t.bgPattern && t.bgPattern !== 'none') {document.addEventListener('DOMContentLoaded', function() {@@ -581,6 +587,7 @@<option value="mono">Monospace</option><option value="sans">Sans-serif</option><option value="serif">Serif</option>+ <option value="opendyslexic">OpenDyslexic (dyslexia-friendly)</option></select></div><div class="theme-fd-group">@@ -591,6 +598,13 @@<option value="spacious">Spacious</option></select></div>+ <div class="theme-fd-group">+ <label class="theme-fd-label">Text size</label>+ <select id="theme-text-size-select" class="theme-fd-select" aria-label="Text size">+ <option value="100">Default</option>+ <option value="125">Larger</option>+ </select>+ </div><div class="theme-fd-group" id="theme-frosted-group"><label class="theme-fd-label" for="theme-frosted-toggle">Frosted</label><label class="admin-switch" style="margin-top:4px;">@@ -1318,7 +1332,7 @@<!-- Cookbook Modal --><div id="cookbook-modal" class="modal hidden">- <div class="modal-content" role="dialog" aria-label="Cookbook" style="width: min(780px, 92vw); height: 94vh; max-height: 94vh; background: var(--bg);">+ <div class="modal-content" role="dialog" aria-label="Cookbook" style="width: min(780px, 92vw); background: var(--bg);"><div class="modal-header"><h4 style="margin:0;margin-right:auto"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:6px"><path d="M12 7v14"/><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"/></svg>Cookbook</h4><button class="close-btn" id="close-cookbook-modal" aria-label="Close cookbook">✖</button>diff --git a/static/js/document.js b/static/js/document.jsindex 3fb825656..f2e61f559 100644--- a/static/js/document.js+++ b/static/js/document.js@@ -666,7 +666,7 @@ import * as Modals from './modalManager.js';overlay.className = 'modal pdf-export-overlay';overlay.style.cssText = 'pointer-events:auto;background:rgba(0,0,0,0.5);backdrop-filter:blur(4px);';overlay.innerHTML = `- <div class="modal-content" style="width:min(780px,94vw);max-height:86vh;">+ <div class="modal-content" style="width:min(780px,94vw);"><div class="modal-header"><h4>Export filled PDF</h4><button id="pdf-export-close" class="modal-close" title="Close">×</button>diff --git a/static/js/documentLibrary.js b/static/js/documentLibrary.jsindex 8c632a3a9..afe0ffdad 100644--- a/static/js/documentLibrary.js+++ b/static/js/documentLibrary.js@@ -1595,7 +1595,7 @@ let _libraryArchivedView = false; // Documents tab showing archived docs?modal.className = 'modal';modal.id = 'doclib-modal';modal.innerHTML = `- <div class="modal-content doclib-modal-content" style="width:min(640px, 92vw);max-height:85vh;background:var(--bg);">+ <div class="modal-content doclib-modal-content" style="width:min(640px, 92vw);background:var(--bg);"><div class="modal-header"><!-- Header title + icon mirror the currently-active sub-tab (Chats /Documents / Research / Archive) so the user sees ONE icon atdiff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.jsindex 3735d0052..c38573e22 100644--- a/static/js/emailLibrary.js+++ b/static/js/emailLibrary.js@@ -858,7 +858,7 @@ export function openEmailLibrary(opts = {}) {modal.className = 'modal';modal.id = 'email-lib-modal';modal.innerHTML = `- <div class="modal-content doclib-modal-content" style="width:min(720px, 92vw);max-height:85vh;background:var(--bg);">+ <div class="modal-content doclib-modal-content" style="width:min(720px, 92vw);background:var(--bg);"><div class="modal-header"><h4><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;">@@ -4866,7 +4866,7 @@ async function _openEmailAsTab(em, folder) {modal.className = 'modal email-reader-tab-modal';modal.id = modalId;modal.innerHTML = `- <div class="modal-content doclib-modal-content email-reader-tab-content" style="background:var(--bg);width:min(720px, 92vw);max-height:85vh;display:flex;flex-direction:column;">+ <div class="modal-content doclib-modal-content email-reader-tab-content" style="background:var(--bg);width:min(720px, 92vw);display:flex;flex-direction:column;"><div class="modal-header"><h4 style="display:flex;align-items:center;gap:6px;min-width:0;flex:1;"><span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-left:8px;">${_esc(em.subject || '(no subject)')}</span>@@ -5101,7 +5101,7 @@ async function _openEmailWindow(em, folder) {modal.id = winId;modal.style.cssText = 'pointer-events:none;background:transparent;';modal.innerHTML = `- <div class="modal-content email-window-content" style="width:min(640px, 92vw);max-height:80vh;display:flex;flex-direction:column;background:var(--bg);">+ <div class="modal-content email-window-content" style="width:min(640px, 92vw);display:flex;flex-direction:column;background:var(--bg);"><div class="modal-header"><h4 style="display:flex;align-items:center;gap:6px;min-width:0;flex:1;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0;"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></svg>diff --git a/static/js/skills.js b/static/js/skills.jsindex 104d684a1..44f7082b6 100644--- a/static/js/skills.js+++ b/static/js/skills.js@@ -1802,7 +1802,7 @@ async function _showSkillSource(name) {wrap.className = 'modal';wrap.style.display = 'block';wrap.innerHTML = `- <div class="modal-content" style="max-width:760px;max-height:85vh;display:flex;flex-direction:column">+ <div class="modal-content" style="max-width:760px;display:flex;flex-direction:column"><div class="modal-header"><h4>SKILL.md — <code>${esc(name)}</code></h4><span style="flex:1"></span>diff --git a/static/js/storage.js b/static/js/storage.jsindex 7ff9c6bd5..1a2eeb1d9 100644--- a/static/js/storage.js+++ b/static/js/storage.js@@ -24,6 +24,7 @@ export const KEYS = {SECTION_ORDER: 'sidebar-section-order',ADMIN_LAST_TAB: 'admin-last-tab',DENSITY: 'odysseus-density',+ UI_SCALE: 'odysseus-ui-scale',WORKSPACE: 'odysseus-workspace'};diff --git a/static/js/theme.js b/static/js/theme.jsindex 77c74d07a..09b13f2b7 100644--- a/static/js/theme.js+++ b/static/js/theme.js@@ -39,6 +39,7 @@ const FONT_MAP = {mono: "'Fira Code', monospace",sans: "system-ui, -apple-system, 'Segoe UI', sans-serif",serif: "Georgia, 'Times New Roman', serif",+ opendyslexic: "'OpenDyslexic', sans-serif",};const DEFAULT_FONT = 'mono';const DEFAULT_DENSITY = 'comfortable';@@ -387,6 +388,20 @@ export function applyFontDensity(font, density) {if (d !== 'comfortable') document.documentElement.classList.add('density-' + d);}+// UI text-size scale (accessibility). Global and independent of the active+// theme, so the chosen size persists across theme switches. Stored as a plain+// percentage string ('100' | '110' | '125' | '150').+const UI_SCALE_KEY = 'odysseus-ui-scale';+const DEFAULT_UI_SCALE = '100';++export function applyUiScale(scale) {+ const s = scale || DEFAULT_UI_SCALE;+ // Only one non-default scale ('125'). Remove any legacy classes too so an+ // older stored value can't leave a stale zoom applied.+ document.documentElement.classList.remove('ui-scale-110', 'ui-scale-125', 'ui-scale-140');+ if (s === '125') document.documentElement.classList.add('ui-scale-125');+}+const _BG_CLASSES = ['bg-pattern-dots','bg-pattern-synapse', 'bg-pattern-rain', 'bg-pattern-constellations','bg-pattern-perlin-flow',@@ -1133,6 +1148,18 @@ export function initThemeUI() {const s = getSaved(); if (s) _saveFull(s.name, s.colors);});}+ const textSizeSelect = document.getElementById('theme-text-size-select');+ if (textSizeSelect) {+ const nts = textSizeSelect.cloneNode(true); textSizeSelect.parentNode.replaceChild(nts, textSizeSelect);+ let initScale = DEFAULT_UI_SCALE;+ try { initScale = localStorage.getItem(UI_SCALE_KEY) || DEFAULT_UI_SCALE; } catch (e) {}+ nts.value = initScale;+ applyUiScale(initScale);+ nts.addEventListener('change', () => {+ applyUiScale(nts.value);+ try { localStorage.setItem(UI_SCALE_KEY, nts.value); } catch (e) {}+ });+ }if (patternSelect) {const np = patternSelect.cloneNode(true); patternSelect.parentNode.replaceChild(np, patternSelect);np.value = _initPattern;diff --git a/static/style.css b/static/style.cssindex 97dec8b08..4532f7131 100644--- a/static/style.css+++ b/static/style.css@@ -114,6 +114,10 @@ body {@font-face { font-family: 'Fira Code'; font-weight: 400; font-style: normal; font-display: swap; src: url('/static/fonts/FiraCode-Regular.woff2') format('woff2'); }@font-face { font-family: 'Fira Code'; font-weight: 600; font-style: normal; font-display: swap; src: url('/static/fonts/FiraCode-SemiBold.woff2') format('woff2'); }+/* Self-hosted OpenDyslexic — dyslexia-friendly accessibility font option (SIL OFL 1.1) */+@font-face { font-family: 'OpenDyslexic'; font-weight: 400; font-style: normal; font-display: swap; src: url('/static/fonts/OpenDyslexic-Regular.woff2') format('woff2'); }+@font-face { font-family: 'OpenDyslexic'; font-weight: 700; font-style: normal; font-display: swap; src: url('/static/fonts/OpenDyslexic-Bold.woff2') format('woff2'); }+/* Code block baseline */pre, code, .hljs {font-size: 0.95em;@@ -158,6 +162,39 @@ html {:root.density-spacious .list-item { padding: 8px 12px; }:root.density-spacious .sidebar .section { padding: 0; }+/* ── UI text-size scale (accessibility) ──+ Density only changes the root font-size, which can't move the many+ hard-coded px sizes. `zoom` scales the whole UI uniformly (px text+ included) while keeping layout intact, unlike `transform: scale`. */+:root.ui-scale-125 { zoom: 1.25; }+/* `zoom` makes the 100dvh shell render taller than the real viewport, which+ pushes the bottom-pinned sidebar account/settings row below the fold (and+ body's overflow:hidden then clips it). Shrink the shell by the same factor+ so it fits the viewport exactly. */+:root.ui-scale-125 body { height: calc(100dvh / 1.25); }+/* Modals/panels under the 1.25x scale: zoom renders a centred, viewport-sized+ panel ~1.25x taller, pushing its draggable header + close button off-screen+ (a catch-22 — you can't reach the control to turn the size back down). Divide+ each max-height by the same factor to keep the original on-screen footprint.+ Desktop only — the mobile `!important` full-sheet rules win on small screens+ and stay top-anchored, so their headers are already visible. */+:root.ui-scale-125 .modal-content { max-height: calc(85dvh / 1.25); }+:root.ui-scale-125 .cal-modal-content { max-height: calc(88dvh / 1.25); }+:root.ui-scale-125 .settings-modal-content { max-height: calc(85dvh / 1.25); }+:root.ui-scale-125 #theme-popup { max-height: min(calc(85dvh / 1.25), 480px); }+/* Cookbook is the one modal that set its height inline (94vh), which beat the+ .modal-content compensation above and overflowed the viewport at 1.25x+ (header + close button pushed off-screen). Own its height here so the same+ zoom compensation applies. */+#cookbook-modal .modal-content { height: 94vh; max-height: 94vh; }+:root.ui-scale-125 #cookbook-modal .modal-content { height: calc(94dvh / 1.25); max-height: calc(94dvh / 1.25); }+/* PDF export modal also set its height inline (86vh) at v1.0; that inline cap+ beat the .modal-content compensation above and shifted ~1vh at Default when+ removed. Own its height here so Default is byte-for-byte 86vh and the same+ 1.25x compensation applies. */+.pdf-export-overlay .modal-content { max-height: 86vh; }+:root.ui-scale-125 .pdf-export-overlay .modal-content { max-height: calc(86dvh / 1.25); }+/* ── Background Patterns ── */:root { --bg-effect-intensity: 1; }