feat(web): implement complete workspace with themes, tabs, sidebar, and mobile
Transform CalcText from a single-document calculator into a full workspace application with multi-document support, theming, and responsive mobile experience. - Theme system: 5 presets (Light, Dark, Matrix, Midnight, Warm) + accent colors - Document model with localStorage persistence and auto-save - Tab bar with keyboard shortcuts (Ctrl+N/W/Tab/1-9), rename, close - Sidebar with search, recent, favorites, folders, templates, drag-and-drop - 5 templates: Budget, Invoice, Unit Converter, Trip Planner, Loan Calculator - Status bar with cursor position, engine status, dedication to Igor Cassel - Results panel: type-specific colors, click-to-copy, error hints - Format toolbar: H, B, I, //, color labels with live preview toggle - Syntax highlighting using theme CSS variables - Error hover tooltips - Mobile: bottom results tray, sidebar drawer, touch targets, safe areas - Docker multi-stage build (Rust WASM + Vite + Nginx) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,12 +4,19 @@ use crate::lexer::tokenize;
|
||||
use crate::parser::parse;
|
||||
use crate::span::Span;
|
||||
use crate::types::CalcResult;
|
||||
use crate::variables::aggregators;
|
||||
|
||||
/// Evaluate a single line of input and return the result.
|
||||
pub fn eval_line(input: &str, ctx: &mut EvalContext) -> CalcResult {
|
||||
let trimmed = input.trim();
|
||||
if trimmed.is_empty() {
|
||||
return CalcResult::error("empty input", Span::new(0, 0));
|
||||
return CalcResult::empty(Span::new(0, 0));
|
||||
}
|
||||
|
||||
// Detect headings (# Title) and aggregator keywords (sum, total, etc.)
|
||||
// before tokenizing — the lexer misinterprets `#` as a line reference prefix.
|
||||
if aggregators::is_heading(trimmed) || aggregators::detect_aggregator(trimmed).is_some() {
|
||||
return CalcResult::non_calculable(Span::new(0, trimmed.len()));
|
||||
}
|
||||
|
||||
let tokens = tokenize(trimmed);
|
||||
@@ -24,7 +31,7 @@ pub fn eval_line(input: &str, ctx: &mut EvalContext) -> CalcResult {
|
||||
)
|
||||
});
|
||||
if !has_expr {
|
||||
return CalcResult::error("no expression found", Span::new(0, trimmed.len()));
|
||||
return CalcResult::non_calculable(Span::new(0, trimmed.len()));
|
||||
}
|
||||
|
||||
match parse(tokens) {
|
||||
|
||||
Reference in New Issue
Block a user