diff --git a/README.fr.md b/README.fr.md index bd300f9..febd70e 100644 --- a/README.fr.md +++ b/README.fr.md @@ -243,14 +243,17 @@ couleur, est mémorisé par navigateur. - **Interface** - *Thème* : Système (suit la préférence de l'ordinateur ou du téléphone), Clair ou Sombre. Le bouton soleil/lune de l'en-tête bascule entre clair et sombre. - - *Affichage des logs* : taille du texte (très petite, petite, moyenne, grande) et police : - la police monospace du système, ou l'une des 12 polices libres conçues pour le texte dense - (JetBrains Mono, Fira Code, Source Code Pro, IBM Plex Mono, Cascadia Code, Roboto Mono, - Ubuntu Mono, Inconsolata, Red Hat Mono, Noto Sans Mono, Victor Mono, DM Mono). Elles sont - chargées par le navigateur depuis [Bunny Fonts](https://fonts.bunny.net), un service - européen de polices respectueux de la vie privée ; sans accès à internet, la police du - système est utilisée. Les ligatures sont désactivées pour que `->` ou `!=` s'affichent tels - quels. + - *Affichage des logs* : taille du texte (très petite, petite, moyenne, grande), densité + (normale, ou compacte pour afficher environ 50 % de lignes en plus à l'écran) et police : + la police monospace du système, [Iosevka](https://github.com/be5invis/Iosevka) (étroite, + donc plus de texte par ligne ; servie par LogStream lui-même, fonctionne hors ligne), ou + l'une des 12 polices libres conçues pour le texte dense (JetBrains Mono, Fira Code, Source + Code Pro, IBM Plex Mono, Cascadia Code, Roboto Mono, Ubuntu Mono, Inconsolata, Red Hat Mono, + Noto Sans Mono, Victor Mono, DM Mono). Ces 12 polices sont chargées par le navigateur depuis + [Bunny Fonts](https://fonts.bunny.net), un service européen de polices respectueux de la vie + privée ; sans accès à internet, la police du système est utilisée. Les ligatures sont + désactivées pour que `->` ou `!=` s'affichent tels quels. Le réglage le plus dense est Très + petite + Compacte + Iosevka. - **Données** : « Supprimer tous les logs » efface définitivement tous les logs stockés (il faut taper `PURGE` pour confirmer). Les tags et les paramètres sont conservés. VictoriaLogs doit être lancé avec `-delete.enable` (déjà présent dans `docker-compose.yml`) ; mettez diff --git a/README.md b/README.md index edcf628..bb4f266 100644 --- a/README.md +++ b/README.md @@ -222,12 +222,15 @@ remembered per browser. - **Interface** - *Theme*: System (follows the computer/phone preference), Light or Dark. The sun/moon button in the header switches between light and dark. - - *Log display*: font size (tiny, small, medium, large) and font: the system monospace - font, or one of 12 free fonts made for dense text (JetBrains Mono, Fira Code, Source - Code Pro, IBM Plex Mono, Cascadia Code, Roboto Mono, Ubuntu Mono, Inconsolata, Red Hat - Mono, Noto Sans Mono, Victor Mono, DM Mono). They are loaded by the browser from - [Bunny Fonts](https://fonts.bunny.net), a privacy-friendly European font service; without - internet access, the system font is used. Ligatures are disabled so `->` or `!=` show as typed. + - *Log display*: font size (tiny, small, medium, large), density (normal, or compact to + fit about 50% more lines on screen) and font: the system monospace font, + [Iosevka](https://github.com/be5invis/Iosevka) (narrow, so more text fits on each line; + served by LogStream itself, works offline), or one of 12 free fonts made for dense text + (JetBrains Mono, Fira Code, Source Code Pro, IBM Plex Mono, Cascadia Code, Roboto Mono, + Ubuntu Mono, Inconsolata, Red Hat Mono, Noto Sans Mono, Victor Mono, DM Mono). These 12 are + loaded by the browser from [Bunny Fonts](https://fonts.bunny.net), a privacy-friendly + European font service; without internet access, the system font is used. Ligatures are + disabled so `->` or `!=` show as typed. The densest setting is Tiny + Compact + Iosevka. - **Data**: "Delete all logs" permanently erases every stored log (you must type `PURGE` to confirm). Tags and settings are kept. VictoriaLogs needs `-delete.enable` (already set in `docker-compose.yml`); set `ALLOW_PURGE=false` to disable the feature. diff --git a/web/app.js b/web/app.js index 45314a1..9243ee7 100644 --- a/web/app.js +++ b/web/app.js @@ -120,8 +120,9 @@ const I18N = { themeHelp: 'System follows the light/dark preference of your computer or phone.', logDisplay: 'Log display', fontSize: 'Font size', sizeTiny: 'Tiny', sizeSmall: 'Small', sizeMedium: 'Medium', sizeLarge: 'Large', - fontLabel: 'Font', fontSystem: 'System monospace (no download)', - fontHelp: 'Free fonts (SIL Open Font License) loaded by your browser from Bunny Fonts, a privacy-friendly European font service. Without internet access, the system font is used.', + density: 'Density', densityNormal: 'Normal', densityCompact: 'Compact', + fontLabel: 'Font', fontSystem: 'System monospace (no download)', fontBuiltin: 'built in, narrow', + fontHelp: 'Free fonts (SIL Open Font License). Iosevka is served by LogStream itself and works offline; it is narrow, so more text fits on each line. The others are loaded by your browser from Bunny Fonts, a privacy-friendly European font service; without internet access, the system font is used.', previewMsgs: ['error: link down on eth1, carrier lost', 'warning: disk /dev/sda temperature 58°C', 'backup finished: ok (12.4 GB in 00:14:32)'], dangerZone: 'Danger zone', purgeHelp: 'Permanently delete every stored log to start from scratch. Color tags and settings are kept.', @@ -273,8 +274,9 @@ const I18N = { themeHelp: 'Système suit la préférence clair/sombre de votre ordinateur ou de votre téléphone.', logDisplay: 'Affichage des logs', fontSize: 'Taille du texte', sizeTiny: 'Très petite', sizeSmall: 'Petite', sizeMedium: 'Moyenne', sizeLarge: 'Grande', - fontLabel: 'Police', fontSystem: 'Monospace du système (aucun téléchargement)', - fontHelp: 'Polices libres (licence SIL Open Font) chargées par votre navigateur depuis Bunny Fonts, un service européen respectueux de la vie privée. Sans accès à internet, la police du système est utilisée.', + density: 'Densité', densityNormal: 'Normale', densityCompact: 'Compacte', + fontLabel: 'Police', fontSystem: 'Monospace du système (aucun téléchargement)', fontBuiltin: 'intégrée, étroite', + fontHelp: 'Polices libres (licence SIL Open Font). Iosevka est servie par LogStream lui-même et fonctionne hors ligne ; elle est étroite, donc chaque ligne affiche plus de texte. Les autres sont chargées par votre navigateur depuis Bunny Fonts, un service européen respectueux de la vie privée ; sans accès à internet, la police du système est utilisée.', previewMsgs: ['error: link down on eth1, carrier lost', 'warning: disk /dev/sda temperature 58°C', 'backup finished: ok (12.4 GB in 00:14:32)'], dangerZone: 'Zone de danger', purgeHelp: 'Supprime définitivement tous les logs stockés pour repartir de zéro. Les tags de couleur et les réglages sont conservés.', @@ -537,9 +539,11 @@ $('#themeSwitch').addEventListener('click', (ev) => { /* ================= Log font and size ================= */ -// Free monospace fonts, served by Bunny Fonts (https://fonts.bunny.net). +// Free monospace fonts, served by Bunny Fonts (https://fonts.bunny.net), except the +// built-in ones (web/fonts, declared in style.css), which also work offline. const LOG_FONTS = [ { id: 'system' }, + { id: 'iosevka', family: 'Iosevka', builtin: true }, { id: 'jetbrains-mono', family: 'JetBrains Mono' }, { id: 'fira-code', family: 'Fira Code' }, { id: 'source-code-pro', family: 'Source Code Pro' }, @@ -554,7 +558,8 @@ const LOG_FONTS = [ { id: 'dm-mono', family: 'DM Mono', weights: '400,500' }, ]; const LOG_SIZES = { tiny: '10.5px', small: '11.5px', medium: '12.5px', large: '14px' }; -const ui = { font: 'system', size: 'medium' }; +const LOG_DENSITIES = ['normal', 'compact']; +const ui = { font: 'system', size: 'medium', density: 'normal' }; function applyLogFont(id) { const f = LOG_FONTS.find((x) => x.id === id) || LOG_FONTS[0]; @@ -564,6 +569,10 @@ function applyLogFont(id) { root.removeProperty('--log-font'); return; } + if (f.builtin) { + root.setProperty('--log-font', `'${f.family}', var(--mono)`); + return; + } const href = `https://fonts.bunny.net/css?family=${f.id}:${f.weights || '400,700'}&display=swap`; let link = document.getElementById('logFontCss'); if (!link) { @@ -579,13 +588,22 @@ function applyLogSize(id) { document.documentElement.style.setProperty('--log-size', LOG_SIZES[ui.size]); } +function applyLogDensity(id) { + ui.density = LOG_DENSITIES.includes(id) ? id : 'normal'; + document.documentElement.dataset.density = ui.density; +} + function renderInterface() { renderThemeSwitch(); for (const b of document.querySelectorAll('#sizeSwitch [data-size]')) { b.setAttribute('aria-checked', String(b.dataset.size === ui.size)); } + for (const b of document.querySelectorAll('#densitySwitch [data-density]')) { + b.setAttribute('aria-checked', String(b.dataset.density === ui.density)); + } const sel = $('#fontSelect'); - sel.innerHTML = LOG_FONTS.map((f) => ``).join(''); + const fontName = (f) => (!f.family ? t('fontSystem') : f.builtin ? `${f.family} (${t('fontBuiltin')})` : f.family); + sel.innerHTML = LOG_FONTS.map((f) => ``).join(''); sel.value = ui.font; renderFontPreview(); renderHistoSettings(); @@ -609,6 +627,13 @@ $('#sizeSwitch').addEventListener('click', (ev) => { store.set('logSize', ui.size); renderInterface(); }); +$('#densitySwitch').addEventListener('click', (ev) => { + const b = ev.target.closest('[data-density]'); + if (!b) return; + applyLogDensity(b.dataset.density); + store.set('logDensity', ui.density); + renderInterface(); +}); $('#fontSelect').addEventListener('change', (ev) => { applyLogFont(ev.target.value); store.set('logFont', ui.font); @@ -2190,6 +2215,7 @@ $('#settingsDlg').addEventListener('click', (ev) => { if (ev.target === ev.curre } applyLogFont(store.get('logFont', 'system')); applyLogSize(store.get('logSize', 'medium')); +applyLogDensity(store.get('logDensity', 'normal')); applyLang(); $('#range').value = store.get('range', '1h'); if (!$('#range').value) $('#range').value = '1h'; diff --git a/web/fonts/OFL-Iosevka.txt b/web/fonts/OFL-Iosevka.txt new file mode 100644 index 0000000..b2a7b6a --- /dev/null +++ b/web/fonts/OFL-Iosevka.txt @@ -0,0 +1,110 @@ +Copyright (c) 2015-2023, Renzhi Li (aka. Belleve Invis, belleve@typeof.net) + +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 v1.1 +==================================================== + + +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/fonts/iosevka-400.woff2 b/web/fonts/iosevka-400.woff2 new file mode 100644 index 0000000..80d83ab Binary files /dev/null and b/web/fonts/iosevka-400.woff2 differ diff --git a/web/fonts/iosevka-700.woff2 b/web/fonts/iosevka-700.woff2 new file mode 100644 index 0000000..cf34747 Binary files /dev/null and b/web/fonts/iosevka-700.woff2 differ diff --git a/web/index.html b/web/index.html index 89116ed..f4b0ed4 100644 --- a/web/index.html +++ b/web/index.html @@ -282,6 +282,11 @@ + Density +
+ + +
diff --git a/web/style.css b/web/style.css index 3035f8f..87a8982 100644 --- a/web/style.css +++ b/web/style.css @@ -1,3 +1,8 @@ +/* Iosevka (SIL OFL, web/fonts/OFL-Iosevka.txt): a narrow monospace font served by LogStream + itself, so it also works offline. Latin subset only; other scripts fall back to --mono. */ +@font-face { font-family: "Iosevka"; src: url("fonts/iosevka-400.woff2") format("woff2"); font-weight: 400 500; font-display: swap; } +@font-face { font-family: "Iosevka"; src: url("fonts/iosevka-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; } + /* ---------- Theme: everything goes through these variables ---------- */ :root { --bg: #f6f7f9; @@ -342,6 +347,9 @@ body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-sel cursor: pointer; } .row:last-child { border-bottom: 0; } +/* Settings > Interface > Density: compact fits about 50% more lines on screen */ +:root[data-density="compact"] .row { padding-top: 1px; padding-bottom: 1px; line-height: 1.25; } +:root[data-density="compact"] .row .sev { padding-top: 0; padding-bottom: 0; line-height: 1.3; } .row:hover { background: var(--row-hover); } .row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; } .row.new { animation: flash 1.2s ease-out; } @@ -678,8 +686,9 @@ input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2 } .set-nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; } .set-panels { padding: 0 16px 18px; } - #sizeSwitch { display: flex; } - #sizeSwitch button { flex: 1; padding: 0 4px; white-space: nowrap; font-size: 12px; } + #sizeSwitch, #densitySwitch { display: flex; } + #sizeSwitch button, #densitySwitch button { flex: 1; padding: 0 4px; white-space: nowrap; font-size: 12px; } + :root[data-density="compact"] .row { padding-top: 3px; padding-bottom: 3px; } .field-grid select { margin-bottom: 6px; } .status { padding: 6px 16px; } .tag-row { grid-template-columns: auto 38px 1fr 36px; }