{"id":50871464,"url":"https://github.com/yashoswalyo/retromorphic-calculator","last_synced_at":"2026-06-15T05:35:00.024Z","repository":{"id":359518130,"uuid":"1246441749","full_name":"yashoswalyo/retromorphic-calculator","owner":"yashoswalyo","description":"Welcome to the **Retromorphic Calculator (MODEL AG-1984)**. This project is built using the **Tauri Framework v2**, featuring a **Rust backend** for parsing/evaluation of algebraic expressions and a **React + TypeScript frontend** designed with extreme retromorphic visual fidelity.","archived":false,"fork":false,"pushed_at":"2026-05-22T08:21:15.000Z","size":466,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T05:34:58.229Z","etag":null,"topics":["antigravity","react","tauri-react"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yashoswalyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-22T07:39:29.000Z","updated_at":"2026-05-22T08:21:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yashoswalyo/retromorphic-calculator","commit_stats":null,"previous_names":["yashoswalyo/retromorphic-calculator"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yashoswalyo/retromorphic-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yashoswalyo%2Fretromorphic-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yashoswalyo%2Fretromorphic-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yashoswalyo%2Fretromorphic-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yashoswalyo%2Fretromorphic-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yashoswalyo","download_url":"https://codeload.github.com/yashoswalyo/retromorphic-calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yashoswalyo%2Fretromorphic-calculator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34349925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antigravity","react","tauri-react"],"created_at":"2026-06-15T05:34:55.807Z","updated_at":"2026-06-15T05:35:00.015Z","avatar_url":"https://github.com/yashoswalyo.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tauri + React + Typescript\n\nThis template should help get you started developing with Tauri, React and Typescript in Vite.\n\n## Recommended IDE Setup\n\n- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)\n\n\n# Retromorphic Calculator (AG-1984) — User \u0026 Architectural Manual\n\nWelcome to the **Retromorphic Calculator (MODEL AG-1984)**. This project is built using the **Tauri Framework v2**, featuring a **Rust backend** for parsing/evaluation of algebraic expressions and a **React + TypeScript frontend** designed with extreme retromorphic visual fidelity.\n\n\u003e [!NOTE]\n\u003e All calculation parsing and arithmetic operations are offloaded to high-performance, safe, and robust Rust code executing via Tauri's inter-process invoke handler.\n\n---\n\n## Local Development\n\n### Prerequisites\n\n- [Rust](https://www.rust-lang.org/tools/install) (stable toolchain)\n- [Bun](https://bun.sh/) (or Node.js 18+)\n- Tauri v2 system dependencies — see [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/)\n\n### Setup \u0026 Run\n\n```bash\n# Clone the repo\ngit clone git@github.com:yashoswalyo/retromorphic-calculator.git\ncd retromorphic-calculator\n\n# Install frontend dependencies\nbun install\n\n# Run in development mode (launches the Tauri window with hot-reload)\nbun run tauri dev\n\n# Build a production binary\nbun run tauri build\n```\n\nThe dev server starts at `http://localhost:1420` and the Tauri window opens automatically.\n\n---\n\n## 🎨 Retromorphic Aesthetic \u0026 Design System\n\nRetromorphism marries tactile 3D skeumorphism from 70s-90s hardware (like IBM Model M keyboards, retro Macintosh computers, office printing calculators, and vintage terminals) with modern, fluid, glassmorphic interfaces and responsive micro-animations.\n\nWe have implemented **three custom, beautiful skin modules** that completely transform the workspace:\n\n### 1. IBM Classic 1984 (Beige Cassette)\n*   **Chassis**: Warm computer cream beige (`#E6DFD3`) with deep 3D outlines.\n*   **Display**: Olive-green liquid crystal display (LCD) with a realistic sub-pixel matrix overlay and a subtle glass sheen.\n*   **LED Indicators**: Warm colored retro filament lamps for *Busy*, *Error*, and *Radian (RAD)* active modes.\n*   **Tactile Keys**: Chunky cherry-profile mechanical keycaps with two-tone grey/beige mapping, a bright orange clear key, and a solid crimson red equal key.\n\n![IBM Classic 1984](docs/screenshots/beige.png)\n\n### 2. Pip-Boy 3000 (Phosphor CRT Terminal)\n*   **Chassis**: Dark military textured metal alloys with mechanical rivet detailing.\n*   **Display**: Curved retro cathode-ray tube (CRT) display with high-contrast glowing green phosphor scanlines and a constant, organic phosphor refresh flicker.\n*   **LED Indicators**: High-luminescence green and amber warning filaments.\n*   **Tactile Keys**: Translucent military console buttons with glowing green labeling. Clicking them triggers a neon flash.\n\n![Pip-Boy 3000](docs/screenshots/crt.png)\n\n### 3. Cyber Sunset 1988 (Synthwave Neon Grid)\n*   **Chassis**: Deep indigo outrun casing set against a neon pink landscape grid.\n*   **Display**: Deep black screen backlighting with glowing neon cyan vector characters.\n*   **LED Indicators**: Radiant purple and blue cyber-lamps.\n*   **Tactile Keys**: Semi-transparent dark polymer keycaps glowing with hot pink and laser cyan margins.\n\n![Cyber Sunset 1988](docs/screenshots/synthwave.png)\n\n---\n\n## ⚙️ Core Engineering Architecture\n\n```mermaid\ngraph TD\n    A[React Frontend App.tsx] -- invoke('evaluate_expression', { expression, is_rad }) --\u003e B[Tauri IPC Bridge]\n    B -- Deserializes Expression --\u003e C[Rust Backend lib.rs]\n    C --\u003e D[Tokenizer \u0026 Recursive Descent Parser]\n    D -- Trims Trig Functions Deg/Rad --\u003e E[Computation Engine]\n    E -- Success: Float Result --\u003e F[Format result \u0026 return f64]\n    E -- Failure: Div by Zero/Syntax --\u003e G[Return String Error]\n    F --\u003e H[React UI Display]\n    G --\u003e I[React Display 'ERROR' + Error LED]\n    H --\u003e J[Push to LocalStorage History Tape]\n```\n\n### 1. The Rust Mathematical Parser (`src-tauri/src/lib.rs`)\nRather than relying on JavaScript's unsafe `eval()`, we wrote a **custom, recursive descent mathematical expression parser** in Rust. The parser operates with strict operator precedence:\n1.  **Parentheses \u0026 Functions**: `(expression)`, `sqrt(x)`, `sin(x)`, `cos(x)`, `tan(x)`, `ln(x)`, `log(x)`\n2.  **Powers**: `x ^ y` (right-associative)\n3.  **Multiplication, Division, Modulo**: `*`, `/`, `%`\n4.  **Addition, Subtraction**: `+`, `-`\n\n#### Degree vs Radian Trig Conversion\n*   The Rust compiler checks if the `is_rad` flag is passed from the UI.\n*   If **DEG** mode is active, the parser automatically wraps all trigonometric inputs in a degree-to-radian conversion (`val.to_radians()`) before applying standard floating-point functions.\n\n### 2. Audio Synthesis via Web Audio API (`src/App.tsx`)\nTo eliminate the overhead of external static files and ensure perfect, zero-latency feedback inside Tauri's webview, the calculator synthesizes its own physical sounds using the **Web Audio API** on the fly:\n*   **Mechanical Click (`'key'`)**: Combines a quick pitch-sweeping triangle oscillator (650Hz to 100Hz) with a transient high-pass filtered white noise burst (cut off at 3.2kHz) to simulate the physical snap of a mechanical keyboard switch.\n*   **Lever Shift (`'lever'`)**: Combines a low-frequency sawtooth wave with a quick amplitude decay to simulate a heavy spring-loaded metallic lever.\n*   **Paper Roll hum (`'paper'`)**: Uses a low-frequency square wave (50Hz) hum to emulate the electric paper feed motor in vintage adding machines.\n\n### 3. Scrollable History Paper Tape\nCalculating with the **AG-1984** prints each operation onto a scrolling physical paper tape roll feeding out of a slot at the top.\n*   **Visual Look**: Rendered in vintage typewriter fonts (`Courier Prime`), featuring authentic vertical red margin lines and a jagged serrated paper-rip edge (`clip-path`).\n*   **State Persistence**: History is cached in `localStorage` and persists across application reboots.\n\n---\n\n## ⌨️ Physical Keyboard Mapping\n\nThe application listens to global keyboard events and maps them directly to the calculator board, highlighting the buttons visually to replicate tactile feedback:\n\n| Physical Key | Calculator Action | Active Keycap Style |\n| :--- | :--- | :--- |\n| `0` - `9` | Appends digits | Outset 3D button presses down |\n| `.` | Appends decimal separator | Outset 3D button presses down |\n| `+` | Add | Operator highlighted orange/green/pink |\n| `-` | Subtract | Operator highlighted orange/green/pink |\n| `*` | Multiply | Operator highlighted orange/green/pink |\n| `/` | Divide | Operator highlighted orange/green/pink |\n| `%` | Modulo (mod) | Operator highlighted orange/green/pink |\n| `^` | Power | Operator highlighted orange/green/pink |\n| `Enter` or `=` | Evaluates expression | Equal button presses down |\n| `Backspace` | Deletes last character | AC/DEL button presses down |\n| `Escape` / `C` | Clears screen | AC/DEL button presses down |\n| `R` / `r` | Toggles Radian / Degree mode | DEG/RAD indicator LED toggles |\n\n---\n\n## 🔬 Interactive Features Walkthrough\n\n1.  **Solar Cell Power**: Hovering over the solar panel grid at the top displays a glossy sheen, representing an active solar generator feeding the board.\n2.  **Sound Switch**: Flipping the `Sound` rocker switch silences or enables keypress click synthesis.\n3.  **Scientific Lever**: Flipping the `Scientific` lever expands/collapses the extended panel containing scientific trigonometry buttons, constants ($\\pi$, $e$), and parenthesis markers with a beautiful CSS width transition.\n4.  **Tear Paper**: Clicking **Clear Tape** or **Tear** in the slide-out history paper strip resets your session logs with a satisfying sound.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyashoswalyo%2Fretromorphic-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyashoswalyo%2Fretromorphic-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyashoswalyo%2Fretromorphic-calculator/lists"}