19 Commits

Author SHA1 Message Date
Your Name
ef8a4524b9 Bump version to 1.1.0 and update README
Add accessibility section documenting WCAG 2.2 AAA compliance,
keyboard navigation, focus management, and theme support. Update
file handling with single-instance and OS association. Fix repo
URLs and version badge.
2026-02-19 22:02:21 +02:00
Your Name
5af64df152 Fix duplicate tabs on drag-and-drop and long URL overflow
Guard against Windows/WebView2 firing duplicate drop events by
tracking in-progress paths with a Set ref. Add overflow-wrap and
word-break to markdown content so long unbroken strings wrap.
2026-02-19 22:00:51 +02:00
Your Name
766f0f94f2 Add single-instance support and clean up scaffolding files
Ensure only one Vesper instance runs at a time. When a second
instance is launched with a file argument, the file is forwarded
to the existing window. Remove unused template SVGs and test file.
2026-02-19 22:00:43 +02:00
Your Name
a5c168ee9d fix: upgrade to pointer events for cancellation support, final a11y cleanup 2026-02-19 21:42:30 +02:00
Your Name
37cf83dd5c feat: add light theme with full WCAG AAA contrast compliance 2026-02-19 21:41:04 +02:00
Your Name
e8f523ad05 feat: add Content Zoom and Content Width controls to View menu 2026-02-19 21:38:29 +02:00
Your Name
f2ad745c28 fix: add non-color indicators for active tab and search highlights 2026-02-19 21:37:51 +02:00
Your Name
88964ec842 feat: highlight active heading in sidebar table of contents 2026-02-19 21:36:59 +02:00
Your Name
969aff1e25 feat: respect prefers-reduced-motion for Framer Motion animations 2026-02-19 21:35:22 +02:00
Your Name
204757bf6a feat: add focus trap to modal dialogs 2026-02-19 21:33:39 +02:00
Your Name
59b047ff25 feat: add Shift+F10 context menu trigger and keyboard navigation 2026-02-19 21:31:56 +02:00
Your Name
e7544c283e feat: add keyboard navigation for sidebar and resize handle 2026-02-19 21:29:11 +02:00
Your Name
2e0741760f feat: add keyboard navigation for tab bar 2026-02-19 21:27:24 +02:00
Your Name
7031accf17 feat: add full keyboard navigation for menu bar 2026-02-19 21:24:47 +02:00
Your Name
86d25a5823 fix: add ARIA roles, labels, and states to all interactive components 2026-02-19 21:20:27 +02:00
Your Name
f550dba3b9 fix: add skip link and semantic HTML landmarks 2026-02-19 21:16:58 +02:00
Your Name
ecb9fd867c fix: add focus indicators, fix target sizes, show hidden controls 2026-02-19 21:15:03 +02:00
Your Name
c644d7372d refactor: extract markdown typography colors into CSS variables 2026-02-19 21:13:07 +02:00
Your Name
ecde5d7f88 fix: update color contrast to meet WCAG 2.2 AAA requirements 2026-02-19 21:08:29 +02:00
13 changed files with 883 additions and 527 deletions

21
.gitignore vendored
View File

@@ -23,8 +23,7 @@ nul
data/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.vscode/
.idea
.DS_Store
*.suo
@@ -32,3 +31,21 @@ data/
*.njsproj
*.sln
*.sw?
# AI/LLM tooling
.claude/
.cursor/
.copilot/
.codeium/
.tabnine/
.aider*
.continue/
# Trash
trash/
# Docs
docs/
# This file
.gitignore

View File

@@ -8,7 +8,7 @@ Built for everyone. Owned by no one. Free as in freedom.
<br>
<img src="https://img.shields.io/badge/version-1.0.0-6B8AFF?style=flat-square&labelColor=282C33" alt="Version">
<img src="https://img.shields.io/badge/version-1.1.0-6B8AFF?style=flat-square&labelColor=282C33" alt="Version">
<img src="https://img.shields.io/badge/platform-Windows-6B8AFF?style=flat-square&labelColor=282C33" alt="Platform">
<img src="https://img.shields.io/badge/Tauri-v2-6B8AFF?style=flat-square&labelColor=282C33" alt="Tauri">
<img src="https://img.shields.io/badge/license-CC0_Public_Domain-6B8AFF?style=flat-square&labelColor=282C33" alt="License">
@@ -19,7 +19,7 @@ Built for everyone. Owned by no one. Free as in freedom.
## 📖 Overview
Vesper renders your markdown with carefully tuned typography and a refined dark interface, giving you the ultimate reading experience. No installation, no AppData, no registry, no telemetry, no accounts, no subscriptions - just drop the exe and go.
Vesper renders your markdown with carefully tuned typography and a refined interface, giving you the ultimate reading experience. Choose between dark and light themes, navigate entirely by keyboard, and enjoy full WCAG 2.2 AAA accessibility. No installation, no AppData, no registry, no telemetry, no accounts, no subscriptions - just drop the exe and go.
Knowledge should be accessible to all. Vesper exists to make reading a pleasure, not a product.
@@ -42,7 +42,7 @@ Full CommonMark support via **markdown-it** with extensions:
| 📄 HTML | Inline HTML passthrough |
| ↵ Breaks | Newlines preserved as line breaks |
**Premium dark-mode typography** tuned for long-form reading:
**Premium typography** tuned for long-form reading:
> - **Inter Variable** at 17px with 1.7 line-height
> - ~65 character measure for optimal readability
@@ -80,9 +80,10 @@ Full CommonMark support via **markdown-it** with extensions:
| Feature | Details |
|:--|:--|
| 🌗 Dark / Light Theme | Toggle in View menu, persisted across sessions |
| 🖥️ Focus Mode | `F11` hides title bar and menu for immersive reading |
| 🔎 Content Zoom | `Ctrl+Scroll` - 50% to 200% |
| ↔️ Content Width | `Shift+Scroll` - 400px to 1200px |
| 🔎 Content Zoom | `Ctrl+Scroll` or View menu spinner - 50% to 200% |
| ↔️ Content Width | `Shift+Scroll` or View menu spinner - 400px to 1200px |
| 🔲 UI Scale | 50%-200% via View menu spinner, persisted across sessions |
| 🏀 Kinetic Scroll | Right-mouse drag with iOS-style rubber band overscroll |
| 📜 Custom Scrollbars | Thin, auto-hiding, accent-colored on hover |
@@ -92,8 +93,9 @@ Full CommonMark support via **markdown-it** with extensions:
### 📂 File Handling
- Open via **File menu**, **`Ctrl+O`**, or **drag-and-drop** from Explorer
- Open via **File menu**, **`Ctrl+O`**, **drag-and-drop**, or **double-click** from Explorer
- Supports `.md` · `.markdown` · `.txt`
- **Single instance** - opening a file when Vesper is already running forwards it to the existing window
- Native Tauri drag-and-drop integration with real file system paths
<br>
@@ -109,6 +111,26 @@ Full CommonMark support via **markdown-it** with extensions:
<br>
## ♿ Accessibility
Vesper targets **WCAG 2.2 AAA** compliance across the entire interface.
| Area | Details |
|:--|:--|
| 🏗️ Semantic HTML | `<header>`, `<nav>`, `<main>`, `<article>`, `<search>` landmarks; proper ARIA roles for menus, tabs, dialogs, and status regions |
| ⌨️ Full Keyboard Navigation | Menu bar, tab bar, sidebar TOC, modals, and context menu all navigable with arrow keys, Home/End, Enter, Escape |
| 🔗 Skip Link | "Skip to content" link as first focusable element for screen reader users |
| 🎯 Focus Management | Visible `:focus-visible` outlines on all interactive elements; focus traps in modals with restore on close |
| 🌗 High Contrast Themes | Dark and light themes both meet AAA contrast ratios (7:1+ for normal text) |
| 🎞️ Reduced Motion | Respects `prefers-reduced-motion` OS setting — all animations disabled when active |
| 📋 Active Heading Tracking | Current section highlighted in sidebar TOC via IntersectionObserver |
| 🔲 Target Sizes | All interactive targets meet 24x24px minimum (WCAG 2.5.8) |
| 📢 Status Messages | Search results counter uses `aria-live="polite"` for screen reader announcements |
| 🎨 Non-Color Indicators | Active tabs marked with a bottom border accent; search highlights include underline in addition to background |
| ↔️ Resizable Sidebar | Keyboard-accessible resize handle (`role="separator"`) with arrow key support |
<br>
## ⌨️ Keyboard Shortcuts
| Shortcut | Action |
@@ -119,7 +141,9 @@ Full CommonMark support via **markdown-it** with extensions:
| `Ctrl+F` | 🔍 Toggle search |
| `Ctrl+Shift+S` | 📋 Toggle sidebar |
| `F11` | 🖥️ Toggle focus mode |
| `Escape` | ← Close search / sidebar |
| `Escape` | ← Close search / sidebar / context menu |
| `Shift+F10` | 📋 Open context menu |
| `Delete` | ✕ Close focused tab (when tab bar is focused) |
| `Ctrl+Scroll` | 🔎 Zoom content in / out |
| `Shift+Scroll` | ↔️ Adjust content width |
@@ -134,7 +158,7 @@ Full CommonMark support via **markdown-it** with extensions:
### Download
Download the latest **`vesper.exe`** from the [Releases](https://github.com/yourusername/vesper/releases) page.
Download the latest **`vesper.exe`** from the [Releases](https://git.lashman.live/lashman/vesper/releases) page.
No installation required - Vesper is fully portable. No gatekeepers between you and your documents.
### Build from Source
@@ -144,7 +168,7 @@ Everyone has the right to inspect, modify, and rebuild the tools they use.
> **Requires:** [Node.js](https://nodejs.org/) v18+ · [Rust](https://www.rust-lang.org/tools/install) stable · [Tauri v2 prerequisites](https://v2.tauri.app/start/prerequisites/)
```bash
git clone https://github.com/yourusername/vesper.git
git clone https://git.lashman.live/lashman/vesper.git
cd vesper
npm install
```
@@ -176,7 +200,7 @@ Built entirely on open-source foundations - no proprietary dependencies, no vend
| 🖼️ | Icons | [Lucide React](https://lucide.dev/) |
| 📜 | Scrollbars | [OverlayScrollbars](https://kingsora.github.io/OverlayScrollbars/) |
**Tauri Plugins:** `dialog` · `fs` · `opener`
**Tauri Plugins:** `dialog` · `fs` · `opener` · `single-instance`
<br>
@@ -204,8 +228,8 @@ data/
|:--|:--|
| 📖 | **Content First** - all UI chrome can be hidden; the reader is the focus |
| 🔤 | **Typography Matters** - Inter at 17px, 1.7 line-height, ~65 char measure |
| 🌙 | **Dark by Default** - deep onyx base `#282C33` reduces eye strain |
| ⌨️ | **Keyboard Driven** - every feature accessible via shortcuts |
| 🌗 | **Dark & Light** - two high-contrast themes, both WCAG AAA compliant |
| ⌨️ | **Keyboard Driven** - every feature accessible via shortcuts and arrow keys |
| ✨ | **Minimalist Chrome** - the interface gets out of your way |
| 🤝 | **No Extraction** - no ads, no tracking, no data harvesting, no paywalls |

View File

@@ -1 +1 @@
{"name":"vesper","private":true,"version":"1.0.1","type":"module","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","tauri":"tauri"},"dependencies":{"@fontsource-variable/inter":"^5.2.8","@fontsource-variable/jetbrains-mono":"^5.2.8","@tailwindcss/typography":"^0.5.19","@tailwindcss/vite":"^4.1.18","@tauri-apps/api":"^2","@tauri-apps/plugin-dialog":"^2.6.0","@tauri-apps/plugin-fs":"^2.4.5","@tauri-apps/plugin-opener":"^2","daisyui":"^5.5.18","framer-motion":"^12.34.0","highlight.js":"^11.11.1","lucide-react":"^0.564.0","markdown-it":"^14.1.1","markdown-it-mark":"^4.0.0","markdown-it-sub":"^2.0.0","markdown-it-sup":"^2.0.0","markdown-it-task-lists":"^2.1.1","overlayscrollbars":"^2.14.0","overlayscrollbars-react":"^0.5.6","react":"^19.1.0","react-dom":"^19.1.0","tailwindcss":"^4.1.18"},"devDependencies":{"@tauri-apps/cli":"^2","@types/markdown-it":"^14.1.2","@types/react":"^19.1.8","@types/react-dom":"^19.1.6","@vitejs/plugin-react":"^4.6.0","png-to-ico":"^3.0.1","puppeteer-core":"^24.37.3","sharp":"^0.34.5","typescript":"~5.8.3","vite":"^7.0.4"}}
{"name":"vesper","private":true,"version":"1.1.0","type":"module","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","tauri":"tauri"},"dependencies":{"@fontsource-variable/inter":"^5.2.8","@fontsource-variable/jetbrains-mono":"^5.2.8","@tailwindcss/typography":"^0.5.19","@tailwindcss/vite":"^4.1.18","@tauri-apps/api":"^2","@tauri-apps/plugin-dialog":"^2.6.0","@tauri-apps/plugin-fs":"^2.4.5","@tauri-apps/plugin-opener":"^2","daisyui":"^5.5.18","framer-motion":"^12.34.0","highlight.js":"^11.11.1","lucide-react":"^0.564.0","markdown-it":"^14.1.1","markdown-it-mark":"^4.0.0","markdown-it-sub":"^2.0.0","markdown-it-sup":"^2.0.0","markdown-it-task-lists":"^2.1.1","overlayscrollbars":"^2.14.0","overlayscrollbars-react":"^0.5.6","react":"^19.1.0","react-dom":"^19.1.0","tailwindcss":"^4.1.18"},"devDependencies":{"@tauri-apps/cli":"^2","@types/markdown-it":"^14.1.2","@types/react":"^19.1.8","@types/react-dom":"^19.1.6","@vitejs/plugin-react":"^4.6.0","png-to-ico":"^3.0.1","puppeteer-core":"^24.37.3","sharp":"^0.34.5","typescript":"~5.8.3","vite":"^7.0.4"}}

View File

@@ -1,6 +0,0 @@
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

18
src-tauri/Cargo.lock generated
View File

@@ -3703,6 +3703,21 @@ dependencies = [
"zbus",
]
[[package]]
name = "tauri-plugin-single-instance"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc61e4822b8f74d68278e09161d3e3fdd1b14b9eb781e24edccaabf10c420e8c"
dependencies = [
"serde",
"serde_json",
"tauri",
"thiserror 2.0.18",
"tracing",
"windows-sys 0.60.2",
"zbus",
]
[[package]]
name = "tauri-runtime"
version = "2.10.0"
@@ -4281,7 +4296,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "vesper"
version = "0.1.0"
version = "1.0.1"
dependencies = [
"serde",
"serde_json",
@@ -4290,6 +4305,7 @@ dependencies = [
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-opener",
"tauri-plugin-single-instance",
]
[[package]]

View File

@@ -1,6 +1,6 @@
[package]
name = "vesper"
version = "1.0.1"
version = "1.1.0"
description = "A beautiful markdown reader"
authors = ["you"]
edition = "2021"
@@ -22,3 +22,6 @@ tauri-plugin-fs = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2"

View File

@@ -39,6 +39,31 @@ fn save_window_state(state: &WindowState) {
}
}
#[derive(Serialize, Clone)]
struct CliFile {
path: String,
content: String,
}
/// Try to read a markdown file from the given path string.
fn read_md_file(file_arg: &str) -> Option<CliFile> {
let path = PathBuf::from(file_arg);
if !path.is_file() { return None; }
let ext = path.extension()?.to_str()?.to_lowercase();
if ext != "md" && ext != "markdown" && ext != "txt" { return None; }
let content = fs::read_to_string(&path).ok()?;
Some(CliFile {
path: path.to_string_lossy().to_string(),
content,
})
}
/// Returns the file path + content if the app was launched with a .md/.markdown/.txt argument.
#[tauri::command]
fn get_cli_file() -> Option<CliFile> {
env::args().nth(1).and_then(|a| read_md_file(&a))
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let data_dir = get_data_dir();
@@ -51,9 +76,23 @@ pub fn run() {
);
tauri::Builder::default()
.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
// Second instance launched with a file — send it to the existing window
if let Some(file_arg) = args.get(1) {
if let Some(cli_file) = read_md_file(file_arg) {
let _ = app.emit("open-file", cli_file);
}
}
// Focus the existing window
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
let _ = window.set_focus();
}
}))
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_fs::init())
.invoke_handler(tauri::generate_handler![get_cli_file])
.setup(|app| {
let state = load_window_state();
let window = app.get_webview_window("main").unwrap();
@@ -64,35 +103,12 @@ pub fn run() {
));
}
if let (Some(w), Some(h)) = (state.width, state.height) {
let _ = window.set_size(tauri::Size::Physical(
tauri::PhysicalSize::new(w, h),
));
let _ = window.set_size(tauri::Size::Physical(tauri::PhysicalSize::new(w, h)));
}
if let Some(true) = state.maximized {
let _ = window.maximize();
}
// If launched with a file argument (e.g. double-clicking a .md file),
// emit the path to the frontend so it can open it as a tab.
let args: Vec<String> = env::args().collect();
if let Some(file_arg) = args.get(1) {
let path = PathBuf::from(file_arg);
if path.is_file() {
if let Some(ext) = path.extension().and_then(|e| e.to_str()) {
let ext_lower = ext.to_lowercase();
if ext_lower == "md" || ext_lower == "markdown" || ext_lower == "txt" {
let path_str = path.to_string_lossy().to_string();
let win = window.clone();
// Emit after a short delay so the frontend has time to set up listeners
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_millis(500));
let _ = win.emit("open-file", path_str);
});
}
}
}
}
Ok(())
})
.on_window_event(|window, event| {

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Vesper",
"version": "1.0.1",
"version": "1.1.0",
"identifier": "com.vesper.reader",
"build": {
"beforeDevCommand": "npm run dev",

View File

@@ -1,12 +1,14 @@
import { useState, useEffect, useLayoutEffect, useCallback, useRef, useMemo } from "react";
import { open } from "@tauri-apps/plugin-dialog";
import { openUrl } from "@tauri-apps/plugin-opener";
import { readTextFile } from "@tauri-apps/plugin-fs";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { getCurrentWebview } from "@tauri-apps/api/webview";
import { invoke } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event";
import MarkdownIt from "markdown-it";
import hljs from "highlight.js";
import { motion, AnimatePresence } from "framer-motion";
import { motion, AnimatePresence, useReducedMotion } from "framer-motion";
import TaskLists from "markdown-it-task-lists";
import sup from "markdown-it-sup";
import sub from "markdown-it-sub";
@@ -37,7 +39,6 @@ const md: MarkdownIt = new MarkdownIt({
}).use(TaskLists).use(sup).use(sub).use(mark);
const materialEase = [0.4, 0, 0.2, 1] as const;
const smoothTransition = { duration: 0.2, ease: materialEase };
// Saved selection range — set in mousedown (before browser clears it), read in contextmenu handler
let _savedSelectionRange: Range | null = null;
@@ -239,6 +240,77 @@ function setupKineticScroll(
};
}
function useFocusTrap(isOpen: boolean, containerRef: React.RefObject<HTMLElement | null>) {
const triggerRef = useRef<HTMLElement | null>(null);
useEffect(() => {
if (!isOpen) return;
// Save the element that had focus before the modal opened
triggerRef.current = document.activeElement as HTMLElement;
// Wait for AnimatePresence to render the modal
const raf = requestAnimationFrame(() => {
const container = containerRef.current;
if (!container) return;
const focusable = container.querySelectorAll<HTMLElement>(
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
);
if (focusable.length > 0) focusable[0].focus();
});
return () => {
cancelAnimationFrame(raf);
// Restore focus to trigger element when modal closes
triggerRef.current?.focus();
triggerRef.current = null;
};
}, [isOpen, containerRef]);
useEffect(() => {
if (!isOpen) return;
const container = containerRef.current;
if (!container) return;
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
e.preventDefault();
e.stopPropagation();
// The modal's own close handler will be called separately
return;
}
if (e.key !== 'Tab') return;
const focusable = container.querySelectorAll<HTMLElement>(
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
);
if (focusable.length === 0) return;
const first = focusable[0];
const last = focusable[focusable.length - 1];
if (e.shiftKey) {
if (document.activeElement === first) {
e.preventDefault();
last.focus();
}
} else {
if (document.activeElement === last) {
e.preventDefault();
first.focus();
}
}
};
// Use capture to intercept Tab before anything else
document.addEventListener('keydown', handleKeyDown, true);
return () => document.removeEventListener('keydown', handleKeyDown, true);
}, [isOpen, containerRef]);
}
function App() {
const [tabs, setTabs] = useState<Tab[]>([]);
const [activeTabId, setActiveTabId] = useState<string | null>(null);
@@ -251,9 +323,14 @@ function App() {
const [currentMatchIndex, setCurrentMatchIndex] = useState(0);
const [headings, setHeadings] = useState<Heading[]>([]);
const [menuOpen, setMenuOpen] = useState<string | null>(null);
const [menuFocusIndex, setMenuFocusIndex] = useState(0);
const menuItems = ['file', 'view', 'help'] as const;
const [showShortcutsModal, setShowShortcutsModal] = useState(false);
const [showAboutModal, setShowAboutModal] = useState(false);
const [zoom, setZoom] = useState(100);
const [theme, setTheme] = useState<'dark' | 'light'>(() => {
return (localStorage.getItem('vesper-theme') as 'dark' | 'light') || 'dark';
});
const [uiZoom, setUiZoom] = useState(() => {
const saved = localStorage.getItem('vesper-ui-zoom');
return saved ? parseInt(saved, 10) : 100;
@@ -267,17 +344,33 @@ function App() {
const [resizeStartState, setResizeStartState] = useState<{ startX: number; startWidth: number } | null>(null);
const [contextMenu, setContextMenu] = useState<{ x: number; y: number; selectedText: string } | null>(null);
const [selectionRects, setSelectionRects] = useState<{ left: number; top: number; width: number; height: number }[]>([]);
const [tabFocusIndex, setTabFocusIndex] = useState(0);
const [sidebarFocusIndex, setSidebarFocusIndex] = useState(0);
const [activeHeadingText, setActiveHeadingText] = useState<string | null>(null);
const contentRef = useRef<HTMLDivElement>(null);
const sidebarRef = useRef<HTMLDivElement>(null);
const searchInputRef = useRef<HTMLInputElement>(null);
const menuItemRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
const menuItemRefs = useRef<{ [key: string]: HTMLButtonElement | null }>({});
const kineticDragActiveRef = useRef(false);
const contextMenuRef = useRef<HTMLDivElement>(null);
const contextMenuTriggerRef = useRef<Element | null>(null);
const tabScrollRef = useRef<HTMLDivElement>(null);
const tabRefs = useRef<(HTMLDivElement | null)[]>([]);
const sidebarItemRefs = useRef<(HTMLButtonElement | null)[]>([]);
const [tabScrollState, setTabScrollState] = useState({ canLeft: false, canRight: false });
const tabsRef = useRef(tabs);
tabsRef.current = tabs;
const shortcutsModalRef = useRef<HTMLDivElement>(null);
const aboutModalRef = useRef<HTMLDivElement>(null);
const prefersReducedMotion = useReducedMotion();
const smoothTransition = prefersReducedMotion
? { duration: 0 }
: { duration: 0.2, ease: materialEase };
useFocusTrap(showShortcutsModal, shortcutsModalRef);
useFocusTrap(showAboutModal, aboutModalRef);
const [appWindow, setAppWindow] = useState<ReturnType<typeof getCurrentWindow> | null>(null);
const activeTab = tabs.find(t => t.id === activeTabId) || null;
@@ -324,6 +417,7 @@ function App() {
}));
}
contextMenuTriggerRef.current = document.activeElement;
setContextMenu({ x, y, selectedText });
setSelectionRects(rects);
}
@@ -337,11 +431,39 @@ function App() {
};
}, [activeTab, uiZoom]);
// Open external links in default OS browser
useEffect(() => {
const handleLinkClick = (e: MouseEvent) => {
const anchor = (e.target as HTMLElement).closest('a[href]') as HTMLAnchorElement | null;
if (!anchor) return;
const href = anchor.getAttribute('href');
if (href && /^https?:\/\//.test(href)) {
e.preventDefault();
openUrl(href);
}
};
document.addEventListener('click', handleLinkClick);
return () => document.removeEventListener('click', handleLinkClick);
}, []);
// Clear selection overlay when context menu closes
useEffect(() => {
if (!contextMenu) setSelectionRects(prev => prev.length > 0 ? [] : prev);
}, [contextMenu]);
// Auto-focus first menuitem when context menu opens; restore focus on close
useEffect(() => {
if (contextMenu) {
requestAnimationFrame(() => {
const firstItem = contextMenuRef.current?.querySelector<HTMLElement>('[role="menuitem"]');
firstItem?.focus();
});
} else {
(contextMenuTriggerRef.current as HTMLElement)?.focus();
contextMenuTriggerRef.current = null;
}
}, [contextMenu]);
// Clamp context menu within window bounds after render
useLayoutEffect(() => {
const menu = contextMenuRef.current;
@@ -477,6 +599,7 @@ function App() {
}, [updateTabScrollState]);
// Tauri native drag-and-drop (bypasses browser event interception)
const pendingDropPaths = useRef<Set<string>>(new Set());
useEffect(() => {
let unlisten: (() => void) | undefined;
getCurrentWebview().onDragDropEvent(async (event) => {
@@ -489,6 +612,9 @@ function App() {
const paths = event.payload.paths;
const mdPath = paths.find((p: string) => p.endsWith('.md') || p.endsWith('.markdown') || p.endsWith('.txt'));
if (mdPath) {
// Guard against duplicate drop events (Windows/WebView2 fires twice)
if (pendingDropPaths.current.has(mdPath)) return;
pendingDropPaths.current.add(mdPath);
try {
const existing = tabsRef.current.find(t => t.path === mdPath);
if (existing) {
@@ -506,6 +632,8 @@ function App() {
}
} catch (err) {
console.error('Failed to read dropped file:', err);
} finally {
pendingDropPaths.current.delete(mdPath);
}
}
}
@@ -514,25 +642,32 @@ function App() {
}, [parseHeadings]);
// Handle file opened via OS file association (e.g. double-clicking a .md file)
useEffect(() => {
invoke<{ path: string; content: string } | null>('get_cli_file').then(result => {
if (!result) return;
const title = result.path.split(/[/\\]/).pop() || 'Untitled';
const newTab: Tab = { id: Date.now().toString(), title, content: result.content, path: result.path };
setTabs(prev => [...prev, newTab]);
setActiveTabId(newTab.id);
parseHeadings(result.content);
}).catch(err => console.error('Failed to open file from CLI args:', err));
}, []);
// Handle files opened from a second instance (single-instance plugin forwards them here)
useEffect(() => {
let unlisten: (() => void) | undefined;
listen<string>('open-file', async (event) => {
const filePath = event.payload;
try {
const existing = tabsRef.current.find(t => t.path === filePath);
if (existing) {
setActiveTabId(existing.id);
parseHeadings(existing.content);
} else {
const content = await readTextFile(filePath);
const title = filePath.split(/[/\\]/).pop() || 'Untitled';
const newTab: Tab = { id: Date.now().toString(), title, content, path: filePath };
setTabs(prev => [...prev, newTab]);
setActiveTabId(newTab.id);
parseHeadings(content);
}
} catch (err) {
console.error('Failed to open file from OS:', err);
listen<{ path: string; content: string }>('open-file', (event) => {
const { path: filePath, content } = event.payload;
const existing = tabsRef.current.find(t => t.path === filePath);
if (existing) {
setActiveTabId(existing.id);
parseHeadings(existing.content);
} else {
const title = filePath.split(/[/\\]/).pop() || 'Untitled';
const newTab: Tab = { id: Date.now().toString(), title, content, path: filePath };
setTabs(prev => [...prev, newTab]);
setActiveTabId(newTab.id);
parseHeadings(content);
}
}).then(fn => { unlisten = fn; });
return () => { unlisten?.(); };
@@ -609,10 +744,27 @@ function App() {
else if (e.shiftKey && e.key === 'S') { e.preventDefault(); setShowSidebar(s => !s); }
} else if (e.key === 'F11') { e.preventDefault(); setFocusMode(f => !f); }
else if (e.key === 'Escape') { setShowSearch(false); setShowSidebar(false); }
else if (e.key === 'F10' && e.shiftKey) {
e.preventDefault();
contextMenuTriggerRef.current = document.activeElement;
const zf = uiZoom / 100;
const focused = document.activeElement as HTMLElement;
let x: number, y: number;
if (focused && focused !== document.body) {
const rect = focused.getBoundingClientRect();
x = (rect.left + rect.width / 2) / zf;
y = (rect.top + rect.height / 2) / zf;
} else {
x = window.innerWidth / 2 / zf;
y = window.innerHeight / 2 / zf;
}
const selectedText = window.getSelection()?.toString() || '';
setContextMenu({ x, y, selectedText });
}
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, [handleOpenDialog, closeTab, activeTabId, closeWindow]);
}, [handleOpenDialog, closeTab, activeTabId, closeWindow, uiZoom]);
useEffect(() => {
const handleWheel = (e: WheelEvent) => {
@@ -683,7 +835,7 @@ function App() {
};
}, [activeTabId, showSidebar]);
const startSidebarResize = (e: React.MouseEvent) => {
const startSidebarResize = (e: React.PointerEvent) => {
e.preventDefault();
e.stopPropagation();
setResizeStartState({ startX: e.clientX, startWidth: sidebarWidth });
@@ -720,17 +872,235 @@ function App() {
localStorage.setItem('vesper-ui-zoom', String(Math.round(uiZoom)));
}, [uiZoom]);
// Persist theme to localStorage
useEffect(() => {
localStorage.setItem('vesper-theme', theme);
}, [theme]);
// Menu bar keyboard navigation (WAI-ARIA menu pattern)
const handleMenuBarKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'ArrowRight') {
e.preventDefault();
const next = (menuFocusIndex + 1) % menuItems.length;
setMenuFocusIndex(next);
menuItemRefs.current[menuItems[next]]?.focus();
if (menuOpen) setMenuOpen(menuItems[next]);
} else if (e.key === 'ArrowLeft') {
e.preventDefault();
const prev = (menuFocusIndex - 1 + menuItems.length) % menuItems.length;
setMenuFocusIndex(prev);
menuItemRefs.current[menuItems[prev]]?.focus();
if (menuOpen) setMenuOpen(menuItems[prev]);
} else if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
setMenuOpen(menuItems[menuFocusIndex]);
} else if (e.key === 'Escape') {
setMenuOpen(null);
}
};
const handleMenuDropdownKeyDown = (e: React.KeyboardEvent) => {
const menu = e.currentTarget as HTMLElement;
const items = menu.querySelectorAll<HTMLElement>('[role="menuitem"]');
if (!items.length) return;
const currentIndex = Array.from(items).indexOf(document.activeElement as HTMLElement);
if (e.key === 'ArrowDown') {
e.preventDefault();
const next = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
items[next]?.focus();
} else if (e.key === 'ArrowUp') {
e.preventDefault();
const prev = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
items[prev]?.focus();
} else if (e.key === 'Home') {
e.preventDefault();
items[0]?.focus();
} else if (e.key === 'End') {
e.preventDefault();
items[items.length - 1]?.focus();
} else if (e.key === 'Escape') {
e.preventDefault();
setMenuOpen(null);
menuItemRefs.current[menuItems[menuFocusIndex]]?.focus();
} else if (e.key === 'ArrowRight') {
e.preventDefault();
const next = (menuFocusIndex + 1) % menuItems.length;
setMenuFocusIndex(next);
setMenuOpen(menuItems[next]);
} else if (e.key === 'ArrowLeft') {
e.preventDefault();
const prev = (menuFocusIndex - 1 + menuItems.length) % menuItems.length;
setMenuFocusIndex(prev);
setMenuOpen(menuItems[prev]);
}
};
// Tab bar keyboard navigation (WAI-ARIA tabs pattern with roving tabindex)
const handleTabListKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'ArrowRight') {
e.preventDefault();
const next = (tabFocusIndex + 1) % tabs.length;
setTabFocusIndex(next);
tabRefs.current[next]?.focus();
} else if (e.key === 'ArrowLeft') {
e.preventDefault();
const prev = (tabFocusIndex - 1 + tabs.length) % tabs.length;
setTabFocusIndex(prev);
tabRefs.current[prev]?.focus();
} else if (e.key === 'Home') {
e.preventDefault();
setTabFocusIndex(0);
tabRefs.current[0]?.focus();
} else if (e.key === 'End') {
e.preventDefault();
const last = tabs.length - 1;
setTabFocusIndex(last);
tabRefs.current[last]?.focus();
} else if (e.key === 'Delete') {
e.preventDefault();
if (tabs[tabFocusIndex]) closeTab(tabs[tabFocusIndex].id);
} else if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
const tab = tabs[tabFocusIndex];
if (tab) {
setActiveTabId(tab.id);
parseHeadings(tab.content);
}
}
};
// Sidebar keyboard navigation (roving tabindex)
const handleSidebarKeyDown = (e: React.KeyboardEvent) => {
if (headings.length === 0) return;
if (e.key === 'ArrowDown') {
e.preventDefault();
const next = Math.min(sidebarFocusIndex + 1, headings.length - 1);
setSidebarFocusIndex(next);
sidebarItemRefs.current[next]?.focus();
} else if (e.key === 'ArrowUp') {
e.preventDefault();
const prev = Math.max(sidebarFocusIndex - 1, 0);
setSidebarFocusIndex(prev);
sidebarItemRefs.current[prev]?.focus();
} else if (e.key === 'Home') {
e.preventDefault();
setSidebarFocusIndex(0);
sidebarItemRefs.current[0]?.focus();
} else if (e.key === 'End') {
e.preventDefault();
const last = headings.length - 1;
setSidebarFocusIndex(last);
sidebarItemRefs.current[last]?.focus();
} else if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
const heading = headings[sidebarFocusIndex];
if (heading) scrollToHeading(heading.text);
}
};
// Context menu keyboard navigation (WAI-ARIA menu pattern)
const handleContextMenuKeyDown = (e: React.KeyboardEvent) => {
const menu = contextMenuRef.current;
if (!menu) return;
const items = menu.querySelectorAll<HTMLElement>('[role="menuitem"]');
if (!items.length) return;
const currentIndex = Array.from(items).indexOf(document.activeElement as HTMLElement);
if (e.key === 'ArrowDown') {
e.preventDefault();
const next = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
items[next]?.focus();
} else if (e.key === 'ArrowUp') {
e.preventDefault();
const prev = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
items[prev]?.focus();
} else if (e.key === 'Home') {
e.preventDefault();
items[0]?.focus();
} else if (e.key === 'End') {
e.preventDefault();
items[items.length - 1]?.focus();
} else if (e.key === 'Escape') {
e.preventDefault();
setContextMenu(null);
}
};
// Auto-focus first menuitem when a dropdown opens
useEffect(() => {
if (menuOpen) {
requestAnimationFrame(() => {
const dropdown = document.querySelector('.menu-dropdown[role="menu"]');
const firstItem = dropdown?.querySelector<HTMLElement>('[role="menuitem"]');
firstItem?.focus();
});
}
}, [menuOpen]);
// Clamp tabFocusIndex when tabs are closed
useEffect(() => {
if (tabFocusIndex >= tabs.length && tabs.length > 0) {
setTabFocusIndex(tabs.length - 1);
}
}, [tabs.length, tabFocusIndex]);
// Active heading tracking via IntersectionObserver
useEffect(() => {
if (!activeTab || headings.length === 0) {
setActiveHeadingText(null);
return;
}
const allHeadings = document.querySelectorAll(
'.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6'
);
if (allHeadings.length === 0) return;
const observer = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
if (entry.isIntersecting) {
setActiveHeadingText(entry.target.textContent?.trim() || null);
break;
}
}
},
{ rootMargin: '0px 0px -70% 0px', threshold: 0.1 }
);
allHeadings.forEach(h => observer.observe(h));
return () => observer.disconnect();
}, [activeTab, headings, highlightedHtml]);
// Reset sidebar focus index when headings change
useEffect(() => {
setSidebarFocusIndex(0);
}, [headings]);
// Scroll the focused tab into view when tabFocusIndex changes
useEffect(() => {
if (tabs.length > 1) {
scrollToTabIndex(tabFocusIndex);
}
}, [tabFocusIndex, tabs.length, scrollToTabIndex]);
const osScrollbarOptions = {
scrollbars: { autoHide: 'scroll' as const, autoHideDelay: 800, theme: 'os-theme-dark' as const }
};
return (
<div className={`app-container ${focusMode ? 'focus-mode' : ''}`} style={{ zoom: `${uiZoom}%` }}>
<div className={`app-container ${focusMode ? 'focus-mode' : ''} ${theme === 'light' ? 'theme-light' : ''}`} style={{ zoom: `${uiZoom}%` }}>
<a href="#main-content" className="skip-link">Skip to content</a>
<AnimatePresence>
{isDraggingOver && (
<motion.div className="drop-zone" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.15, ease: materialEase }}>
<motion.div className="drop-zone" role="region" aria-label="Drop zone for markdown files" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.15, ease: materialEase }}>
<motion.div className="drop-zone-content" initial={{ opacity: 0, scale: 0.92, y: 8 }} animate={{ opacity: 1, scale: 1, y: 0 }} exit={{ opacity: 0, scale: 0.92, y: 8 }} transition={{ duration: 0.2, ease: materialEase }}>
<motion.div className="drop-zone-icon-wrapper" animate={{ y: [0, -6, 0] }} transition={{ duration: 1.5, repeat: Infinity, ease: 'easeInOut' }}>
<motion.div className="drop-zone-icon-wrapper" animate={prefersReducedMotion ? {} : { y: [0, -6, 0] }} transition={prefersReducedMotion ? { duration: 0 } : { duration: 1.5, repeat: Infinity, ease: 'easeInOut' }}>
<FileDown size={40} strokeWidth={1.5} />
</motion.div>
<div className="drop-zone-text">Drop markdown file here</div>
@@ -742,56 +1112,73 @@ function App() {
<AnimatePresence initial={false}>
{!focusMode && (
<motion.div key="title-bar" className="title-bar" initial={{ height: 0, opacity: 0 }} animate={{ height: 32, opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={smoothTransition} style={{ overflow: 'hidden' }}>
<motion.header key="title-bar" className="title-bar" initial={{ height: 0, opacity: 0 }} animate={{ height: 32, opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={smoothTransition} style={{ overflow: 'hidden' }}>
<div className="title-bar-left">
<div className="title-bar-icon"><FileText size={14} /></div>
<span className="title-bar-text">Vesper</span>
</div>
<div className="title-bar-drag"></div>
<div className="title-bar-controls">
<button className="title-bar-button" onClick={() => appWindow?.minimize()}><Minus size={14} /></button>
<button className="title-bar-button" onClick={() => appWindow?.toggleMaximize()}><Square size={12} /></button>
<button className="title-bar-button close" onClick={closeWindow}><X size={14} /></button>
<button className="title-bar-button" onClick={() => appWindow?.minimize()} aria-label="Minimize"><Minus size={14} /></button>
<button className="title-bar-button" onClick={() => appWindow?.toggleMaximize()} aria-label="Maximize"><Square size={12} /></button>
<button className="title-bar-button close" onClick={closeWindow} aria-label="Close"><X size={14} /></button>
</div>
</motion.div>
</motion.header>
)}
</AnimatePresence>
<AnimatePresence initial={false}>
{!focusMode && (
<motion.div key="menu-bar" className="menu-bar" initial={{ height: 0, opacity: 0 }} animate={{ height: 28, opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={smoothTransition} style={{ overflow: 'hidden' }}>
<div className="menu-item" ref={(el) => { menuItemRefs.current['file'] = el; }} onClick={() => setMenuOpen(prev => prev === 'file' ? null : 'file')}>File</div>
<div className="menu-item" ref={(el) => { menuItemRefs.current['view'] = el; }} onClick={() => setMenuOpen(prev => prev === 'view' ? null : 'view')}>View</div>
<div className="menu-item" ref={(el) => { menuItemRefs.current['help'] = el; }} onClick={() => setMenuOpen(prev => prev === 'help' ? null : 'help')}>Help</div>
<motion.div key="menu-bar" className="menu-bar" role="menubar" onKeyDown={handleMenuBarKeyDown} initial={{ height: 0, opacity: 0 }} animate={{ height: 28, opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={smoothTransition} style={{ overflow: 'hidden' }}>
<button className="menu-item" role="menuitem" aria-haspopup="true" aria-expanded={menuOpen === 'file'} tabIndex={menuFocusIndex === 0 ? 0 : -1} ref={(el) => { menuItemRefs.current['file'] = el; }} onClick={() => { setMenuFocusIndex(0); setMenuOpen(prev => prev === 'file' ? null : 'file'); }}>File</button>
<button className="menu-item" role="menuitem" aria-haspopup="true" aria-expanded={menuOpen === 'view'} tabIndex={menuFocusIndex === 1 ? 0 : -1} ref={(el) => { menuItemRefs.current['view'] = el; }} onClick={() => { setMenuFocusIndex(1); setMenuOpen(prev => prev === 'view' ? null : 'view'); }}>View</button>
<button className="menu-item" role="menuitem" aria-haspopup="true" aria-expanded={menuOpen === 'help'} tabIndex={menuFocusIndex === 2 ? 0 : -1} ref={(el) => { menuItemRefs.current['help'] = el; }} onClick={() => { setMenuFocusIndex(2); setMenuOpen(prev => prev === 'help' ? null : 'help'); }}>Help</button>
<AnimatePresence>
{menuOpen === 'file' && menuItemRefs.current['file'] && (
<motion.div className="menu-dropdown" initial={{ opacity: 0, y: -5 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -5 }} transition={smoothTransition} style={{ position: 'fixed', left: menuItemRefs.current['file']!.getBoundingClientRect().left, top: menuItemRefs.current['file']!.getBoundingClientRect().bottom - 6 }}>
<button className="menu-dropdown-item" onClick={() => { handleOpenDialog(); setMenuOpen(null); }}>Open File <span className="menu-shortcut">Ctrl+O</span></button>
<button className="menu-dropdown-item" onClick={() => { if (activeTabId) closeTab(activeTabId); setMenuOpen(null); }}>Close Tab <span className="menu-shortcut">Ctrl+W</span></button>
<motion.div className="menu-dropdown" role="menu" onKeyDown={handleMenuDropdownKeyDown} initial={{ opacity: 0, y: -5 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -5 }} transition={smoothTransition} style={{ position: 'fixed', left: menuItemRefs.current['file']!.getBoundingClientRect().left, top: menuItemRefs.current['file']!.getBoundingClientRect().bottom - 6 }}>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { handleOpenDialog(); setMenuOpen(null); }}>Open File <span className="menu-shortcut">Ctrl+O</span></button>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { if (activeTabId) closeTab(activeTabId); setMenuOpen(null); }}>Close Tab <span className="menu-shortcut">Ctrl+W</span></button>
<div className="menu-separator"></div>
<button className="menu-dropdown-item" onClick={() => { closeWindow(); setMenuOpen(null); }}>Exit <span className="menu-shortcut">Ctrl+Q</span></button>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { closeWindow(); setMenuOpen(null); }}>Exit <span className="menu-shortcut">Ctrl+Q</span></button>
</motion.div>
)}
{menuOpen === 'view' && menuItemRefs.current['view'] && (
<motion.div className="menu-dropdown" initial={{ opacity: 0, y: -5 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -5 }} transition={smoothTransition} style={{ position: 'fixed', left: menuItemRefs.current['view']!.getBoundingClientRect().left, top: menuItemRefs.current['view']!.getBoundingClientRect().bottom - 6 }}>
<button className="menu-dropdown-item" onClick={() => { setShowSearch(s => !s); setMenuOpen(null); }}>Toggle Search <span className="menu-shortcut">Ctrl+F</span></button>
<button className="menu-dropdown-item" onClick={() => { setShowSidebar(s => !s); setMenuOpen(null); }}>Toggle Sidebar <span className="menu-shortcut">Ctrl+Shift+S</span></button>
<button className="menu-dropdown-item" onClick={() => { setFocusMode(f => !f); setMenuOpen(null); }}>Focus Mode <span className="menu-shortcut">F11</span></button>
<motion.div className="menu-dropdown" role="menu" onKeyDown={handleMenuDropdownKeyDown} initial={{ opacity: 0, y: -5 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -5 }} transition={smoothTransition} style={{ position: 'fixed', left: menuItemRefs.current['view']!.getBoundingClientRect().left, top: menuItemRefs.current['view']!.getBoundingClientRect().bottom - 6 }}>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { setShowSearch(s => !s); setMenuOpen(null); }}>Toggle Search <span className="menu-shortcut">Ctrl+F</span></button>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { setShowSidebar(s => !s); setMenuOpen(null); }}>Toggle Sidebar <span className="menu-shortcut">Ctrl+Shift+S</span></button>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { setFocusMode(f => !f); setMenuOpen(null); }}>Focus Mode <span className="menu-shortcut">F11</span></button>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { setTheme(t => t === 'dark' ? 'light' : 'dark'); setMenuOpen(null); }}>Theme: {theme === 'dark' ? 'Dark' : 'Light'} <span className="menu-shortcut">{theme === 'dark' ? 'Switch to Light' : 'Switch to Dark'}</span></button>
<div className="menu-separator"></div>
<div className="menu-dropdown-zoom" onClick={e => e.stopPropagation()}>
<span>UI Scale</span>
<div className="zoom-spinner">
<button className="zoom-spinner-btn" onClick={() => setUiZoom(z => Math.max(50, z - 10))}><Minus size={12} /></button>
<div className="zoom-spinner" aria-label="UI Scale">
<button className="zoom-spinner-btn" aria-label="Decrease UI scale" onClick={() => setUiZoom(z => Math.max(50, z - 10))}><Minus size={12} /></button>
<span className="zoom-spinner-value">{uiZoom}%</span>
<button className="zoom-spinner-btn" onClick={() => setUiZoom(z => Math.min(200, z + 10))}><Plus size={12} /></button>
<button className="zoom-spinner-btn" aria-label="Increase UI scale" onClick={() => setUiZoom(z => Math.min(200, z + 10))}><Plus size={12} /></button>
</div>
</div>
<div className="menu-dropdown-zoom" onClick={e => e.stopPropagation()}>
<span>Content Zoom</span>
<div className="zoom-spinner" aria-label="Content Zoom">
<button className="zoom-spinner-btn" aria-label="Decrease content zoom" onClick={() => setZoom(z => Math.max(50, z - 10))}><Minus size={12} /></button>
<span className="zoom-spinner-value">{zoom}%</span>
<button className="zoom-spinner-btn" aria-label="Increase content zoom" onClick={() => setZoom(z => Math.min(200, z + 10))}><Plus size={12} /></button>
</div>
</div>
<div className="menu-dropdown-zoom" onClick={e => e.stopPropagation()}>
<span>Content Width</span>
<div className="zoom-spinner" aria-label="Content Width">
<button className="zoom-spinner-btn" aria-label="Decrease content width" onClick={() => setContentWidth(w => Math.max(400, w - 40))}><Minus size={12} /></button>
<span className="zoom-spinner-value">{contentWidth}px</span>
<button className="zoom-spinner-btn" aria-label="Increase content width" onClick={() => setContentWidth(w => Math.min(1200, w + 40))}><Plus size={12} /></button>
</div>
</div>
</motion.div>
)}
{menuOpen === 'help' && menuItemRefs.current['help'] && (
<motion.div className="menu-dropdown" initial={{ opacity: 0, y: -5 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -5 }} transition={smoothTransition} style={{ position: 'fixed', left: menuItemRefs.current['help']!.getBoundingClientRect().left, top: menuItemRefs.current['help']!.getBoundingClientRect().bottom - 6 }}>
<button className="menu-dropdown-item" onClick={() => { setShowShortcutsModal(true); setMenuOpen(null); }}>Keyboard Shortcuts</button>
<button className="menu-dropdown-item" onClick={() => { setShowAboutModal(true); setMenuOpen(null); }}>About Vesper</button>
<motion.div className="menu-dropdown" role="menu" onKeyDown={handleMenuDropdownKeyDown} initial={{ opacity: 0, y: -5 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -5 }} transition={smoothTransition} style={{ position: 'fixed', left: menuItemRefs.current['help']!.getBoundingClientRect().left, top: menuItemRefs.current['help']!.getBoundingClientRect().bottom - 6 }}>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { setShowShortcutsModal(true); setMenuOpen(null); }}>Keyboard Shortcuts</button>
<button className="menu-dropdown-item" role="menuitem" onClick={() => { setShowAboutModal(true); setMenuOpen(null); }}>About Vesper</button>
</motion.div>
)}
</AnimatePresence>
@@ -802,18 +1189,18 @@ function App() {
<AnimatePresence>
{tabs.length > 1 && (
<motion.div className="tab-bar" initial={{ height: 0, opacity: 0 }} animate={{ height: 38, opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: 0.25, ease: materialEase }}>
<button className={`tab-scroll-arrow ${tabScrollState.canLeft ? 'visible' : ''}`} onMouseDown={() => startScrollingTabs('left')} onMouseUp={stopScrollingTabs} onMouseLeave={stopScrollingTabs}><ChevronLeft size={14} /></button>
<div className="tab-scroll-container" ref={tabScrollRef}>
<button className={`tab-scroll-arrow ${tabScrollState.canLeft ? 'visible' : ''}`} aria-label="Scroll tabs left" onPointerDown={() => startScrollingTabs('left')} onPointerUp={stopScrollingTabs} onPointerLeave={stopScrollingTabs}><ChevronLeft size={14} /></button>
<div className="tab-scroll-container" ref={tabScrollRef} role="tablist" onKeyDown={handleTabListKeyDown}>
<AnimatePresence initial={false}>
{tabs.map(tab => (
<motion.div layout key={tab.id} className={`tab ${tab.id === activeTabId ? 'active' : ''}`} initial={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.9 }} transition={smoothTransition} onClick={() => { setActiveTabId(tab.id); parseHeadings(tab.content); }}>
{tabs.map((tab, index) => (
<motion.div layout key={tab.id} id={`tab-${tab.id}`} role="tab" aria-selected={tab.id === activeTabId} tabIndex={index === tabFocusIndex ? 0 : -1} ref={(el) => { tabRefs.current[index] = el; }} className={`tab ${tab.id === activeTabId ? 'active' : ''}`} initial={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.9 }} transition={smoothTransition} onClick={() => { setTabFocusIndex(index); setActiveTabId(tab.id); parseHeadings(tab.content); }}>
<span className="tab-title">{tab.title}</span>
<button className="tab-close" onClick={(e) => { e.stopPropagation(); closeTab(tab.id); }}><X size={12} /></button>
<button className="tab-close" aria-label="Close tab" onClick={(e) => { e.stopPropagation(); closeTab(tab.id); }}><X size={12} /></button>
</motion.div>
))}
</AnimatePresence>
</div>
<button className={`tab-scroll-arrow ${tabScrollState.canRight ? 'visible' : ''}`} onMouseDown={() => startScrollingTabs('right')} onMouseUp={stopScrollingTabs} onMouseLeave={stopScrollingTabs}><ChevronRight size={14} /></button>
<button className={`tab-scroll-arrow ${tabScrollState.canRight ? 'visible' : ''}`} aria-label="Scroll tabs right" onPointerDown={() => startScrollingTabs('right')} onPointerUp={stopScrollingTabs} onPointerLeave={stopScrollingTabs}><ChevronRight size={14} /></button>
</motion.div>
)}
</AnimatePresence>
@@ -821,46 +1208,72 @@ function App() {
<div className="main-content">
<AnimatePresence initial={false}>
{showSidebar && (
<motion.div className="sidebar-scroll-wrapper" initial={{ width: 0, opacity: 0 }} animate={{ width: sidebarWidth, opacity: 1 }} exit={{ width: 0, opacity: 0 }} transition={resizeStartState ? { duration: 0 } : smoothTransition} style={{ height: '100%' }}>
<motion.nav className="sidebar-scroll-wrapper" aria-label="Table of Contents" initial={{ width: 0, opacity: 0 }} animate={{ width: sidebarWidth, opacity: 1 }} exit={{ width: 0, opacity: 0 }} transition={resizeStartState ? { duration: 0 } : smoothTransition} style={{ height: '100%' }}>
<OverlayScrollbarsComponent options={osScrollbarOptions} style={{ height: '100%' }}>
<div className="sidebar" ref={sidebarRef}>
<div className="sidebar-heading">Contents</div>
<div className="sidebar" ref={sidebarRef} onKeyDown={handleSidebarKeyDown}>
<h2 className="sidebar-heading">Contents</h2>
{headings.length > 0
? headings.map(h => <button key={h.id} className={`sidebar-item h${h.level}`} onClick={() => scrollToHeading(h.text)}>{h.text}</button>)
? headings.map((h, index) => (
<button
key={h.id}
ref={(el) => { sidebarItemRefs.current[index] = el; }}
className={`sidebar-item h${h.level}${h.text === activeHeadingText ? ' active' : ''}`}
tabIndex={index === sidebarFocusIndex ? 0 : -1}
onClick={() => { setSidebarFocusIndex(index); scrollToHeading(h.text); }}
>
{h.text}
</button>
))
: <div className="sidebar-empty">No headings</div>
}
</div>
</OverlayScrollbarsComponent>
<div className="sidebar-resize-handle" onMouseDown={startSidebarResize}></div>
</motion.div>
<div
className="sidebar-resize-handle"
role="separator"
aria-orientation="vertical"
aria-label="Resize sidebar"
tabIndex={0}
onPointerDown={startSidebarResize}
onKeyDown={(e) => {
if (e.key === 'ArrowRight') {
e.preventDefault();
setSidebarWidth(w => Math.min(400, w + (e.shiftKey ? 50 : 10)));
} else if (e.key === 'ArrowLeft') {
e.preventDefault();
setSidebarWidth(w => Math.max(150, w - (e.shiftKey ? 50 : 10)));
}
}}
></div>
</motion.nav>
)}
</AnimatePresence>
<div className="content-column">
<main id="main-content" className="content-column">
<AnimatePresence>
{showSearch && activeTab && (
<motion.div className="search-bar" initial={{ opacity: 0, y: -10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -10 }} transition={smoothTransition}>
<input ref={searchInputRef} type="text" className="search-input" placeholder="Search..." value={searchQuery} onChange={e => { setSearchQuery(e.target.value); }} onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); setCurrentMatchIndex(i => (i + 1) % Math.max(searchMatches.length, 1)); setSearchTriggerCount(c => c + 1); } }} autoFocus />
<motion.search className="search-bar" initial={{ opacity: 0, y: -10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -10 }} transition={smoothTransition}>
<input ref={searchInputRef} type="text" className="search-input" placeholder="Search..." value={searchQuery} onChange={e => { setSearchQuery(e.target.value); }} onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); setCurrentMatchIndex(i => (i + 1) % Math.max(searchMatches.length, 1)); setSearchTriggerCount(c => c + 1); } }} aria-label="Search document" autoFocus />
{searchMatches.length > 0 && (
<>
<button className="search-nav-btn" onClick={() => { setCurrentMatchIndex(i => (i - 1 + searchMatches.length) % searchMatches.length); setSearchTriggerCount(c => c + 1); }}><ChevronLeft size={16} /></button>
<span className="search-results">{currentMatchIndex + 1} of {searchMatches.length}</span>
<button className="search-nav-btn" onClick={() => { setCurrentMatchIndex(i => (i + 1) % searchMatches.length); setSearchTriggerCount(c => c + 1); }}><ChevronRight size={16} /></button>
<button className="search-nav-btn" aria-label="Previous match" onClick={() => { setCurrentMatchIndex(i => (i - 1 + searchMatches.length) % searchMatches.length); setSearchTriggerCount(c => c + 1); }}><ChevronLeft size={16} /></button>
<span className="search-results" role="status" aria-live="polite">{currentMatchIndex + 1} of {searchMatches.length}</span>
<button className="search-nav-btn" aria-label="Next match" onClick={() => { setCurrentMatchIndex(i => (i + 1) % searchMatches.length); setSearchTriggerCount(c => c + 1); }}><ChevronRight size={16} /></button>
</>
)}
{searchQuery && searchMatches.length === 0 && <span className="search-results">No results</span>}
</motion.div>
{searchQuery && searchMatches.length === 0 && <span className="search-results" role="status" aria-live="polite">No results</span>}
</motion.search>
)}
</AnimatePresence>
<motion.div className="content-area-scroll-wrapper" key={activeTabId} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={smoothTransition}>
<motion.div className="content-area-scroll-wrapper" role="tabpanel" aria-labelledby={activeTabId ? `tab-${activeTabId}` : undefined} key={activeTabId} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={smoothTransition}>
<OverlayScrollbarsComponent options={osScrollbarOptions} style={{ height: '100%' }}>
<div className="content-area-scroll" ref={contentRef} style={{ zoom: `${(zoom / uiZoom) * 100}%`, ...(!activeTab ? { height: '100%' } : {}) }}>
{activeTab ? (
<article className="markdown-content" style={{ maxWidth: contentWidth }} dangerouslySetInnerHTML={{ __html: highlightedHtml }} />
) : (
<motion.div className="welcome-screen" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} transition={smoothTransition}>
<motion.div className="welcome-icon" animate={{ y: [0, -5, 0] }} transition={{ duration: 2, repeat: Infinity }}><FolderOpen size={64} /></motion.div>
<motion.div className="welcome-icon" animate={prefersReducedMotion ? {} : { y: [0, -5, 0] }} transition={prefersReducedMotion ? { duration: 0 } : { duration: 2, repeat: Infinity }}><FolderOpen size={64} /></motion.div>
<h1 className="welcome-title">Vesper</h1>
<p className="welcome-subtitle">A beautiful markdown reader</p>
<button className="welcome-button" onClick={handleOpenDialog}>Open File (Ctrl+O)</button>
@@ -870,16 +1283,16 @@ function App() {
</div>
</OverlayScrollbarsComponent>
</motion.div>
</div>
</main>
</div>
<AnimatePresence>
{showShortcutsModal && (
<motion.div className="modal-overlay" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={smoothTransition} onClick={() => setShowShortcutsModal(false)}>
<motion.div className="shortcuts-dialog" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} transition={smoothTransition} onClick={e => e.stopPropagation()}>
<motion.div className="modal-overlay" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={smoothTransition} onClick={() => setShowShortcutsModal(false)} onKeyDown={(e) => { if (e.key === 'Escape') setShowShortcutsModal(false); }}>
<motion.div ref={shortcutsModalRef} className="shortcuts-dialog" role="dialog" aria-modal="true" aria-labelledby="shortcuts-title" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} transition={smoothTransition} onClick={e => e.stopPropagation()}>
<div className="shortcuts-dialog-header">
<h2 className="shortcuts-dialog-title">Keyboard Shortcuts</h2>
<button className="shortcuts-dialog-close" onClick={() => setShowShortcutsModal(false)}><X size={16} /></button>
<h2 className="shortcuts-dialog-title" id="shortcuts-title">Keyboard Shortcuts</h2>
<button className="shortcuts-dialog-close" aria-label="Close dialog" onClick={() => setShowShortcutsModal(false)}><X size={16} /></button>
</div>
<div className="shortcuts-dialog-body">
<div>
@@ -907,11 +1320,11 @@ function App() {
</motion.div>
)}
{showAboutModal && (
<motion.div className="modal-overlay" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={smoothTransition} onClick={() => setShowAboutModal(false)}>
<motion.div className="modal" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} transition={smoothTransition} onClick={e => e.stopPropagation()}>
<motion.div className="modal-overlay" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={smoothTransition} onClick={() => setShowAboutModal(false)} onKeyDown={(e) => { if (e.key === 'Escape') setShowAboutModal(false); }}>
<motion.div ref={aboutModalRef} className="modal" role="dialog" aria-modal="true" aria-labelledby="about-title" initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} transition={smoothTransition} onClick={e => e.stopPropagation()}>
<div className="modal-header">
<h2 className="modal-title">About Vesper</h2>
<button className="modal-close" onClick={() => setShowAboutModal(false)}><X size={16} /></button>
<h2 className="modal-title" id="about-title">About Vesper</h2>
<button className="modal-close" aria-label="Close dialog" onClick={() => setShowAboutModal(false)}><X size={16} /></button>
</div>
<div className="modal-content about-content">
<div className="about-icon"><FileText size={48} /></div>
@@ -927,7 +1340,7 @@ function App() {
<AnimatePresence>
{menuOpen && (
<div className="menu-backdrop" onClick={() => setMenuOpen(null)} />
<div className="menu-backdrop" aria-hidden="true" onClick={() => setMenuOpen(null)} />
)}
</AnimatePresence>
@@ -941,23 +1354,23 @@ function App() {
<AnimatePresence>
{contextMenu && (
<motion.div ref={contextMenuRef} className="context-menu" style={{ left: contextMenu.x, top: contextMenu.y }} initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} transition={smoothTransition}>
<motion.div ref={contextMenuRef} className="context-menu" role="menu" onKeyDown={handleContextMenuKeyDown} style={{ left: contextMenu.x, top: contextMenu.y }} initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.95 }} transition={smoothTransition}>
{contextMenu.selectedText && (
<>
<button className="context-menu-item" onClick={() => { navigator.clipboard.writeText(contextMenu.selectedText); setContextMenu(null); }}>Copy</button>
<button className="context-menu-item" role="menuitem" onClick={() => { navigator.clipboard.writeText(contextMenu.selectedText); setContextMenu(null); }}>Copy</button>
<div className="context-menu-separator"></div>
</>
)}
<button className="context-menu-item" onClick={() => { handleOpenDialog(); setContextMenu(null); }}>Open File</button>
<button className="context-menu-item" role="menuitem" onClick={() => { handleOpenDialog(); setContextMenu(null); }}>Open File</button>
<div className="context-menu-separator"></div>
<button className="context-menu-item" onClick={() => { setShowSearch(s => !s); setContextMenu(null); }}>Toggle Search</button>
<button className="context-menu-item" onClick={() => { setShowSidebar(s => !s); setContextMenu(null); }}>Toggle Sidebar</button>
<button className="context-menu-item" onClick={() => { setFocusMode(f => !f); setContextMenu(null); }}>Focus Mode</button>
<button className="context-menu-item" role="menuitem" onClick={() => { setShowSearch(s => !s); setContextMenu(null); }}>Toggle Search</button>
<button className="context-menu-item" role="menuitem" onClick={() => { setShowSidebar(s => !s); setContextMenu(null); }}>Toggle Sidebar</button>
<button className="context-menu-item" role="menuitem" onClick={() => { setFocusMode(f => !f); setContextMenu(null); }}>Focus Mode</button>
<div className="context-menu-separator"></div>
<button className="context-menu-item" onClick={() => { setShowShortcutsModal(true); setContextMenu(null); }}>Keyboard Shortcuts</button>
<button className="context-menu-item" onClick={() => { setShowAboutModal(true); setContextMenu(null); }}>About</button>
<button className="context-menu-item" role="menuitem" onClick={() => { setShowShortcutsModal(true); setContextMenu(null); }}>Keyboard Shortcuts</button>
<button className="context-menu-item" role="menuitem" onClick={() => { setShowAboutModal(true); setContextMenu(null); }}>About</button>
<div className="context-menu-separator"></div>
<button className="context-menu-item" onClick={() => { closeWindow(); setContextMenu(null); }}>Exit <span className="menu-shortcut">Ctrl+Q</span></button>
<button className="context-menu-item" role="menuitem" onClick={() => { closeWindow(); setContextMenu(null); }}>Exit <span className="menu-shortcut">Ctrl+Q</span></button>
</motion.div>
)}
</AnimatePresence>

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -54,16 +54,53 @@
/* Text hierarchy */
--color-text-primary: #E4E6EB;
--color-text-secondary: #ABB0B8;
--color-text-tertiary: #6B7280;
--color-text-disabled: #4A5260;
--color-text-secondary: #BCC1C8; /* was #ABB0B8, now ~7.5:1 */
--color-text-tertiary: #8B919A; /* was #6B7280, now ~4.8:1 */
--color-text-disabled: #6B7280; /* was #4A5260, now ~2.9:1 (exempt — inactive UI) */
/* Accent */
--color-accent: #6B8AFF;
--color-accent-hover: #8BA3FF;
--color-accent-small: #8BA3FF; /* for small text (11px) accent uses */
--color-accent-muted: rgba(107, 138, 255, 0.12);
--color-accent-subtle: rgba(107, 138, 255, 0.06);
/* Markdown typography */
--color-md-h1: #F5F6F7;
--color-md-h2: #EDEEF0;
--color-md-h3: #E4E5E8;
--color-md-h4: #D8DADE;
--color-md-h5: #CBCED3;
--color-md-h6: #BCC1C8;
--color-md-heading: #F0F1F3;
--color-md-paragraph: #C8CCD0;
--color-md-link: #93B8F9;
--color-md-link-underline: rgba(147, 184, 249, 0.3);
--color-md-link-hover: #A8C6FA;
--color-md-link-hover-underline: rgba(168, 198, 250, 0.7);
--color-md-marker: #93B8F9;
--color-md-blockquote-border: #93B8F9;
--color-md-blockquote-bg: rgba(147, 184, 249, 0.04);
--color-md-blockquote-text: #BFC3C8;
--color-md-code-inline: #E8B89E;
--color-md-code-inline-bg: rgba(255, 255, 255, 0.06);
--color-md-code-block-bg: #1A1D24;
--color-md-code-block-border: rgba(255, 255, 255, 0.06);
--color-md-code-text: #E4E6EB;
--color-md-table-header-bg: rgba(124, 169, 247, 0.08);
--color-md-table-border: rgba(255, 255, 255, 0.06);
--color-md-table-cell: #C8CCD0;
--color-md-table-stripe: rgba(30, 33, 40, 0.4);
--color-md-table-hover: rgba(124, 169, 247, 0.05);
--color-md-hr: rgba(255, 255, 255, 0.1);
--color-md-mark-bg: rgba(251, 191, 36, 0.2);
--color-md-mark-text: #FBBF24;
--color-md-comment: #7C8390;
--color-md-highlight-bg: rgba(251, 191, 36, 0.3);
--color-md-highlight-active-bg: rgba(251, 191, 36, 0.6);
--color-md-highlight-active-outline: rgba(251, 191, 36, 0.7);
--color-md-welcome-btn: #4A6AE5;
/* Borders */
--color-border-subtle: rgba(255, 255, 255, 0.04);
--color-border: rgba(255, 255, 255, 0.08);
@@ -116,6 +153,26 @@ html, body, #root {
overflow: visible;
}
/* Skip link — WCAG 2.4.1 */
.skip-link {
position: fixed;
top: -100%;
left: 16px;
z-index: 99999;
padding: 8px 16px;
background-color: var(--color-accent);
color: white;
font-size: 13px;
font-weight: 600;
border-radius: var(--radius-md);
text-decoration: none;
transition: top 0.2s ease;
}
.skip-link:focus {
top: 8px;
}
/* App container */
.app-container {
display: flex;
@@ -354,8 +411,8 @@ html, body, #root {
display: flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
width: 24px;
height: 24px;
background: transparent;
border: 1px solid var(--color-border-subtle);
border-radius: var(--radius-sm);
@@ -403,14 +460,18 @@ html, body, #root {
transition: all var(--transition-fast);
opacity: 0;
pointer-events: none;
visibility: hidden;
}
.tab-scroll-arrow.visible {
opacity: 1;
opacity: 0.6;
pointer-events: auto;
visibility: visible;
}
.tab-scroll-arrow:hover {
.tab-scroll-arrow.visible:hover,
.tab-scroll-arrow.visible:focus-visible {
opacity: 1;
color: var(--color-text-primary);
background-color: var(--color-bg-hover);
}
@@ -440,6 +501,7 @@ html, body, #root {
padding: 0 12px;
background: transparent;
border: none;
border-bottom: 2px solid transparent;
border-radius: var(--radius-md);
color: var(--color-text-secondary);
cursor: pointer;
@@ -457,6 +519,7 @@ html, body, #root {
.tab.active {
background-color: var(--color-bg-elevated);
color: var(--color-text-primary);
border-bottom: 2px solid var(--color-accent);
}
.tab-title {
@@ -467,8 +530,8 @@ html, body, #root {
}
.tab-close {
width: 18px;
height: 18px;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
@@ -477,12 +540,13 @@ html, body, #root {
border-radius: var(--radius-sm);
color: var(--color-text-tertiary);
cursor: pointer;
opacity: 0;
opacity: 0.5;
flex-shrink: 0;
transition: all var(--transition-fast);
}
.tab:hover .tab-close {
.tab:hover .tab-close,
.tab-close:focus-visible {
opacity: 1;
}
@@ -539,13 +603,14 @@ html, body, #root {
right: 0;
top: 0;
bottom: 0;
width: 4px;
width: 8px;
background: rgba(255, 255, 255, 0.06);
cursor: col-resize;
background: transparent;
transition: background-color var(--transition-fast);
}
.sidebar-resize-handle:hover {
.sidebar-resize-handle:hover,
.sidebar-resize-handle:focus-visible {
background-color: var(--color-accent);
}
@@ -651,9 +716,11 @@ html, body, #root {
color: var(--color-text-tertiary);
}
.search-input:focus {
.search-input:focus-visible {
border-color: var(--color-accent);
background-color: var(--color-bg-base);
outline: 2px solid var(--color-accent);
outline-offset: -2px;
}
.search-results {
@@ -781,7 +848,7 @@ html, body, #root {
.welcome-button {
padding: 12px 28px;
background-color: #6B8AFF;
background-color: var(--color-md-welcome-btn);
color: white;
border: none;
border-radius: 8px;
@@ -929,7 +996,7 @@ html, body, #root {
.shortcuts-dialog-group-title {
font-size: 11px;
font-weight: 600;
color: var(--color-accent);
color: var(--color-accent-small);
text-transform: uppercase;
letter-spacing: 0.08em;
margin-bottom: 12px;
@@ -1106,7 +1173,9 @@ html, body, #root {
max-width: 680px;
margin: 0 auto;
color: var(--color-text-primary);
overflow-wrap: break-word;
word-break: break-word;
/* Premium typography settings */
font-size: 17px;
line-height: 1.7;
@@ -1129,7 +1198,7 @@ html, body, #root {
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
color: #F0F1F3;
color: var(--color-md-heading);
font-family: 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
font-weight: 600;
line-height: 1.2;
@@ -1143,7 +1212,7 @@ html, body, #root {
font-size: 2.35rem;
font-weight: 700;
letter-spacing: -0.03em;
color: #F5F6F7;
color: var(--color-md-h1);
margin-top: 0;
margin-bottom: 0.8em;
padding-bottom: 0.55em;
@@ -1152,7 +1221,7 @@ html, body, #root {
.markdown-content h2 {
font-size: 1.7rem;
color: #EDEEF0;
color: var(--color-md-h2);
margin-top: 1.85em;
padding-bottom: 0.4em;
border-bottom: 1px solid var(--color-border-subtle);
@@ -1160,47 +1229,47 @@ html, body, #root {
.markdown-content h3 {
font-size: 1.3rem;
color: #E4E5E8;
color: var(--color-md-h3);
}
.markdown-content h4 {
font-size: 1.15rem;
font-weight: 500;
color: #D8DADE;
color: var(--color-md-h4);
}
.markdown-content h5 {
font-size: 1rem;
font-weight: 500;
color: #CBCED3;
color: var(--color-md-h5);
}
.markdown-content h6 {
font-size: 0.92rem;
font-weight: 500;
color: #ABB0B8;
color: var(--color-md-h6);
}
/* Paragraphs with refined spacing */
.markdown-content p {
margin-bottom: 1.65em;
color: #C8CCD0;
color: var(--color-md-paragraph);
line-height: 1.7;
}
/* Links with subtle persistent underline */
.markdown-content a {
color: #7CA9F7;
color: var(--color-md-link);
text-decoration: underline;
text-decoration-color: rgba(124, 169, 247, 0.3);
text-decoration-color: var(--color-md-link-underline);
text-underline-offset: 3px;
text-decoration-thickness: 1px;
transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.markdown-content a:hover {
color: #93B8F9;
text-decoration-color: rgba(147, 184, 249, 0.7);
color: var(--color-md-link-hover);
text-decoration-color: var(--color-md-link-hover-underline);
text-decoration-thickness: 1.5px;
}
@@ -1233,13 +1302,13 @@ html, body, #root {
.markdown-content li {
margin-bottom: 0.45em;
color: #C8CCD0;
color: var(--color-md-paragraph);
line-height: 1.65;
list-style-position: outside;
}
.markdown-content li::marker {
color: #7CA9F7;
color: var(--color-md-marker);
}
.markdown-content ol li::marker {
@@ -1320,17 +1389,17 @@ html, body, #root {
.markdown-content blockquote {
margin: 1.65em 0;
padding: 1.1em 1.4em;
border-left: 3px solid #7CA9F7;
background-color: rgba(124, 169, 247, 0.04);
border-left: 3px solid var(--color-md-blockquote-border);
background-color: var(--color-md-blockquote-bg);
border-radius: 0 8px 8px 0;
color: #B0B4B9;
color: var(--color-md-blockquote-text);
font-style: normal;
line-height: 1.7;
}
.markdown-content blockquote p {
margin-bottom: 0.5em;
color: #B0B4B9;
color: var(--color-md-blockquote-text);
}
.markdown-content blockquote p:last-child {
@@ -1339,26 +1408,26 @@ html, body, #root {
/* Inline code */
.markdown-content code:not(pre code) {
background-color: rgba(255, 255, 255, 0.06);
background-color: var(--color-md-code-inline-bg);
padding: 0.22em 0.48em;
border-radius: 5px;
font-family: 'JetBrains Mono Variable', 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
font-size: 0.88em;
font-weight: 400;
color: #E0A88A;
color: var(--color-md-code-inline);
letter-spacing: -0.02em;
}
/* Code blocks */
.markdown-content pre {
background-color: #1A1D24;
background-color: var(--color-md-code-block-bg);
border-radius: 10px;
padding: 1.35em 1.6em;
margin: 1.65em 0;
overflow-x: visible;
overflow-wrap: break-word;
white-space: pre-wrap;
border: 1px solid rgba(255, 255, 255, 0.06);
border: 1px solid var(--color-md-code-block-border);
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}
@@ -1366,7 +1435,7 @@ html, body, #root {
font-family: 'JetBrains Mono Variable', 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
font-size: 14px;
line-height: 1.7;
color: #E4E6EB;
color: var(--color-md-code-text);
background: none;
padding: 0;
letter-spacing: -0.02em;
@@ -1378,7 +1447,7 @@ html, body, #root {
/* Syntax highlighting - refined colors */
.hljs {
background: transparent !important;
color: #E4E6EB;
color: var(--color-md-code-text);
}
.hljs-keyword,
@@ -1408,7 +1477,7 @@ html, body, #root {
.hljs-quote,
.hljs-deletion,
.hljs-meta {
color: #5C6370;
color: var(--color-md-comment);
font-style: italic;
}
@@ -1442,7 +1511,7 @@ html, body, #root {
font-size: 14px;
border-radius: 10px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.06);
border: 1px solid var(--color-md-table-border);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
@@ -1450,11 +1519,11 @@ html, body, #root {
.markdown-content td {
padding: 14px 18px;
text-align: left;
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
border-bottom: 1px solid var(--color-border-subtle);
}
.markdown-content th {
background-color: rgba(124, 169, 247, 0.08);
background-color: var(--color-md-table-header-bg);
font-weight: 600;
color: var(--color-text-primary);
font-size: 12.5px;
@@ -1463,7 +1532,7 @@ html, body, #root {
}
.markdown-content td {
color: #C8CCD0;
color: var(--color-md-table-cell);
}
.markdown-content tr:last-child td {
@@ -1471,18 +1540,18 @@ html, body, #root {
}
.markdown-content tr:nth-child(even) td {
background-color: rgba(30, 33, 40, 0.4);
background-color: var(--color-md-table-stripe);
}
.markdown-content tr:hover td {
background-color: rgba(124, 169, 247, 0.05);
background-color: var(--color-md-table-hover);
}
/* Horizontal rule — gradient fade */
.markdown-content hr {
border: none;
height: 1px;
background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
background: linear-gradient(to right, transparent, var(--color-md-hr), transparent);
margin: 2.5em 0;
}
@@ -1525,8 +1594,8 @@ html, body, #root {
/* Mark/highlight */
.markdown-content mark {
background-color: rgba(251, 191, 36, 0.2);
color: #FBBF24;
background-color: var(--color-md-mark-bg);
color: var(--color-md-mark-text);
padding: 0.18em 0.38em;
border-radius: 4px;
font-weight: 500;
@@ -1558,16 +1627,19 @@ html, body, #root {
/* Search highlights — high specificity to override Tailwind reset */
span.search-highlight {
background-color: rgba(251, 191, 36, 0.3) !important;
background-color: var(--color-md-highlight-bg) !important;
color: inherit !important;
border-radius: 2px;
padding: 1px 0;
text-decoration: underline;
text-decoration-color: var(--color-md-mark-text);
text-underline-offset: 2px;
transition: background-color 0.15s ease, outline-color 0.15s ease;
}
span.search-highlight.search-highlight-active {
background-color: rgba(251, 191, 36, 0.6) !important;
outline: 2px solid rgba(251, 191, 36, 0.7);
background-color: var(--color-md-highlight-active-bg) !important;
outline: 2px solid var(--color-md-highlight-active-outline);
outline-offset: 1px;
}
@@ -1591,6 +1663,141 @@ span.search-highlight.search-highlight-active {
transition: background-color 0.2s ease, opacity 0.2s ease;
}
/* Global focus indicator — WCAG 2.4.7, 2.4.13 */
button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="separator"]:focus-visible {
outline: 2px solid var(--color-accent);
outline-offset: 2px;
z-index: 1;
}
/* ============================================
Light theme overrides — WCAG 1.4.8
============================================ */
.theme-light {
--color-bg-base: #F5F6F8;
--color-bg-surface: #EBEDF0;
--color-bg-elevated: #FFFFFF;
--color-bg-overlay: #FFFFFF;
--color-bg-hover: #E2E4E8;
--color-bg-active: #D5D8DD;
--color-text-primary: #1A1D24;
--color-text-secondary: #4A5060;
--color-text-tertiary: #6B7280;
--color-text-disabled: #9CA3AF;
--color-accent: #3B66E0;
--color-accent-hover: #2B52CC;
--color-accent-muted: rgba(59, 102, 224, 0.10);
--color-accent-subtle: rgba(59, 102, 224, 0.05);
--color-accent-small: #2B52CC;
--color-border-subtle: rgba(0, 0, 0, 0.06);
--color-border: rgba(0, 0, 0, 0.10);
--color-border-strong: rgba(0, 0, 0, 0.16);
/* Markdown typography — light variants */
--color-md-h1: #111318;
--color-md-h2: #1A1D24;
--color-md-h3: #252A31;
--color-md-h4: #333942;
--color-md-h5: #404754;
--color-md-h6: #4A5060;
--color-md-heading: #1A1D24;
--color-md-paragraph: #333942;
--color-md-link: #2B5BC2;
--color-md-link-underline: rgba(43, 91, 194, 0.3);
--color-md-link-hover: #1E4AAE;
--color-md-link-hover-underline: rgba(30, 74, 174, 0.5);
--color-md-marker: #3B66E0;
--color-md-blockquote-border: #3B66E0;
--color-md-blockquote-bg: rgba(59, 102, 224, 0.04);
--color-md-blockquote-text: #4A5060;
--color-md-code-inline: #B35C2A;
--color-md-code-inline-bg: rgba(0, 0, 0, 0.04);
--color-md-code-block-bg: #F0F1F3;
--color-md-code-block-border: rgba(0, 0, 0, 0.08);
--color-md-code-text: #1A1D24;
--color-md-table-header-bg: rgba(59, 102, 224, 0.06);
--color-md-table-border: rgba(0, 0, 0, 0.08);
--color-md-table-cell: #333942;
--color-md-table-stripe: rgba(0, 0, 0, 0.02);
--color-md-table-hover: rgba(59, 102, 224, 0.04);
--color-md-hr: rgba(0, 0, 0, 0.1);
--color-md-mark-bg: rgba(251, 191, 36, 0.25);
--color-md-mark-text: #92650B;
--color-md-comment: #6B7280;
--color-md-highlight-bg: rgba(251, 191, 36, 0.3);
--color-md-highlight-active-bg: rgba(251, 191, 36, 0.5);
--color-md-highlight-active-outline: rgba(200, 150, 20, 0.7);
--color-md-welcome-btn: #3B66E0;
}
/* Light theme — noise overlay should be darker */
.theme-light.app-container::before {
opacity: 0.025;
mix-blend-mode: multiply;
}
/* Light theme — title bar close button */
.theme-light .title-bar-button.close:hover {
background-color: #DC2626;
color: white;
}
/* Light theme — scrollbar colors */
.theme-light .os-theme-dark {
--os-handle-bg: rgba(0, 0, 0, 0.15);
--os-handle-bg-hover: var(--color-accent);
--os-handle-bg-active: var(--color-accent-hover);
}
/* Light theme — sidebar resize handle */
.theme-light .sidebar-resize-handle {
background: rgba(0, 0, 0, 0.06);
}
.theme-light .sidebar-resize-handle:hover,
.theme-light .sidebar-resize-handle:focus-visible {
background-color: var(--color-accent);
}
/* Light theme syntax highlighting */
.theme-light .hljs { color: #1A1D24; }
.theme-light .hljs-keyword,
.theme-light .hljs-selector-tag,
.theme-light .hljs-literal,
.theme-light .hljs-section,
.theme-light .hljs-link { color: #7C3AED; font-weight: 500; }
.theme-light .hljs-string,
.theme-light .hljs-title,
.theme-light .hljs-name,
.theme-light .hljs-type,
.theme-light .hljs-attribute,
.theme-light .hljs-symbol,
.theme-light .hljs-bullet,
.theme-light .hljs-addition,
.theme-light .hljs-variable,
.theme-light .hljs-template-tag,
.theme-light .hljs-template-variable { color: #16652B; }
.theme-light .hljs-comment,
.theme-light .hljs-quote,
.theme-light .hljs-deletion,
.theme-light .hljs-meta { color: var(--color-md-comment); font-style: italic; }
.theme-light .hljs-number { color: #C2410C; font-weight: 500; }
.theme-light .hljs-built_in { color: #2563EB; }
.theme-light .hljs-class .hljs-title { color: #B45309; }
.theme-light .hljs-attr { color: #B45309; }
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
*,

View File

@@ -1,332 +0,0 @@
# Markdown Combinations Test
This file tests all possible combinations of markdown elements.
---
## 1. Lists with Text Formatting
### Bold in List
- **Bold item 1**
- **Bold item 2** with more text
- **Bold item 3** and *italic* and `code`
### Italic in List
- *Italic item 1*
- *Italic item 2* with text
- *Italic* and **bold** together
### Code in List
- `inline code` item
- Code with `const x = 1` variable
- Command `npm install`
### Mixed Formatting in List
- **Bold** and *italic* and `code` all together
- ***Bold italic*** with normal text
- ~~Strikethrough~~ and **bold**
- ==Highlighted== and *italic*
---
## 2. Headings in Lists
- ### Heading 3 in list
- #### Heading 4 in list
- ##### Heading 5 in list
1. ### Heading 3 in ordered list
2. #### Heading 4 in ordered list
3. ##### Heading 5 in ordered list
---
## 3. Blockquotes with Lists
> ### Blockquote with list:
> - Item 1
> - Item 2
> - Item 3
> **Bold blockquote** with list:
> 1. First
> 2. Second
> 3. Third
> *Italic blockquote* with `code`:
> - Item with `inline code`
> - Another with **bold**
---
## 4. Lists in Blockquotes
> This is a blockquote with a nested list:
> - First level
> - Second level
> - Third level
> - Fourth level
> - Back to first
> Another blockquote with mixed content:
> - **Bold item**
> - *Italic item*
> - `Code item`
> - [Link item](https://example.com)
---
## 5. Links in Various Elements
### Links in Lists
- [Link](https://example.com) in list
- [Link with title](https://example.com "Title") in list
- [Reference link][ref] in list
[ref]: https://example.com
### Links in Blockquotes
> [Link in blockquote](https://example.com)
> **[Bold link](https://example.com)**
> *[[Italic link](https://example.com)*
### Links in Code
- `<a href="https://example.com">Link</a>` in list
- `[link](url)` as code
---
## 6. Images in Various Elements
### Images in Lists
- ![Image](https://via.placeholder.com/100x50.png) in list
- ![Alt text](https://via.placeholder.com/100x50.png "Image title")
### Images in Blockquotes
> ![Image in blockquote](https://via.placeholder.com/100x50.png)
---
## 7. Code Blocks with Formatting
### Code Block with Bold/Italic
```
**This is bold in code**
*This is italic in code*
`inline code in code block`
```
### Code Block Inside List
- ```
// Code block in list
const x = 1;
```
- Another item
---
## 8. Tables with Formatting
| Header | **Bold Header** | *Italic Header* |
|--------|-----------------|-----------------|
| Cell | **Bold Cell** | *Italic Cell* |
| `Code` | **Bold** + `code` | *Italic* + `code` |
---
## 9. Nested Lists with All Formatting
- Level 1 **bold**
- Level 2 *italic*
- Level 3 `code`
- Level 4 ~~strikethrough~~
- Level 5 ==highlight==
1. Ordered 1 **bold**
1. Ordered 1.1 *italic*
1. Ordered 1.1.1 `code`
---
## 10. Complex Combinations
### Blockquote > List > Blockquote
> - Item 1
> > Nested blockquote
> > With **bold**
> - Item 2
### List > Blockquote > List
- Item 1
> Blockquote inside list
> With *italic*
- Item 2
### List > Code > List
- Item 1
```
// Code block nested
const x = 1;
```
- Item 2
### Task List with Formatting
- [x] **Completed** task with *italic*
- [ ] *Incomplete* with `code`
- [x] ==Highlighted== and **bold** and *italic*
---
## 11. Heading + List Combinations
### Heading followed by formatted list
#### Subheading
- **Bold item**
- *Italic item*
- `Code item`
### Multiple headings in sequence
## Section 1
- Item 1
- Item 2
## Section 2
1. Ordered 1
2. Ordered 2
### Heading within list (edge case)
- Normal item
- #### Not a heading (just text)
- Normal item
---
## 12. Links + Code + Bold + Italic combinations
- **[Bold link](https://example.com)**
- *[Italic link](https://example.com)*
- [`Code link`](https://example.com)
- **[Link](https://example.com)** with `code` and *italic*
- ***[All combined](https://example.com)*** with `more code`
---
## 13. Tables + Lists combinations
| Table | With | Formatting |
|-------|------|-----------|
| - List in table | - Another | - Item |
| **Bold** | *Italic* | `Code` |
- Table below list:
| Col1 | Col2 |
|------|------|
| A | B |
- List below table:
| Col1 | Col2 |
|------|------|
| C | D |
---
## 14. All Elements in One Paragraph
This is a paragraph with **bold**, *italic*, ***bold italic***, `inline code`, [a link](https://example.com), ![an image](https://via.placeholder.com/50x20.png), ~~strikethrough~~, ==highlight==, and ^superscript^, all in one paragraph. It's quite long and should test how your renderer handles multiple formatting elements combined.
---
## 15. Edge Case: Empty Elements
-
- Item after empty
>
> Empty blockquote
---
## 16. Deep Nesting
1. Level 1
- Level 2
- Level 3
- Level 4
- Level 5
- Level 6
- **Deep bold**
- *Deep italic*
- `Deep code`
---
## 17. Code Blocks with Language and Formatting
```javascript
// JavaScript with **fake bold** (just text)
const greet = (name) => {
return `Hello, ${name}!`; // Template literal
};
```
```python
# Python with *italic* comments
def hello():
"""Docstring with **bold**"""
return "Hello"
```
```html
<!-- HTML comment with **bold** -->
<div class="container">
<p>Paragraph with *italic*</p>
</div>
```
---
## 18. Final Complex Example
> ### Blockquote Heading
>
> This is a blockquote that contains:
>
> - A **bold** list item
> - An *italic* list item
> - A `code` list item
> - A [link](https://example.com) item
>
> And then continues with more text that has **bold**, *italic*, and `code` formatting.
>
> It also has a nested list:
>
> 1. First nested **bold** item
> 2. Second nested *italic* item
> 3. Third nested `code` item
---
This covers virtually every possible combination of markdown elements!