š§® Retro CASIO Calculator
A beautifully designed 1980s-90s CASIO calculator built with modern web technologies. This project combines nostalgic vintage aesthetics with cutting-edge Svelte 5 reactivity patterns.
⨠Features
- Retro 1980s-90s CASIO Design: Authentic beige/gray aesthetic with LED green display and vintage button styling
- Modern Tech Stack: Built with Svelte 5, Vite 6, and TypeScript-ready architecture
- Fully Responsive: Optimized for all devices (mobile, tablet, desktop) with mobile-first design
- Svelte 5 Runes: Uses modern
$state and $derived for reactive state management
- Advanced Calculator: Supports mathematical operations with mathjs library
- Secure Dependencies: Regular security updates and vulnerability management
- Fast & Efficient: Optimized build, HMR support for development
š Quick Start
Prerequisites
- Node.js 18+ with pnpm package manager
Installation
# Install dependencies
pnpm install
# Start development server
pnpm run dev
# Build for production
pnpm run build
# Preview production build
pnpm run preview
š± Responsive Design Breakpoints
The calculator is fully responsive with three main breakpoints:
- Mobile (< 480px): Compact layout with smaller buttons
- Tablet (480px - 768px): Medium button sizes
- Desktop (ā„ 768px): Full-size calculator experience
All elements scale smoothly using CSS custom properties, ensuring perfect display on any device.
šļø Architecture
Component Structure
src/
āāā App.svelte # Main calculator component
āāā components/
ā āāā Display.svelte # Calculator display and numpad
ā āāā Button.svelte # Reusable button component
āāā app.css # Global styles and responsive layout
āāā main.js # Svelte app initialization
āāā store.js # Centralized state management
Svelte 5 Reactivity with Runes
The calculator uses modern Svelte 5 runes for reactive state:
// State declaration
let numberInput = $state('')
// Derived computed value
let total = $derived.by(() => {
try {
return numberInput ? evaluate(numberInput) : 0
} catch {
return 0
}
})
Benefits:
- ā
Fine-grained reactivity without reactive declarations
- ā
Better performance and tree-shaking
- ā
Clearer intent with explicit state management
- ā
Easier to understand data flow
šØ Design System
Color Palette (1980s CASIO Theme)
| Element |
Color |
Hex |
| Body |
Beige/Gray |
#c4b89d |
| Number Buttons |
Gray |
#9a8f82 |
| Operator Buttons |
Orange/Brown |
#d4a574 |
| Function Buttons |
Dark Gray |
#757575 |
| Equals Button |
Bright Orange |
#ff8c42 |
| Display Text |
Green (LED) |
#0cff00 |
| Display Background |
Black |
#1a1a1a |
All buttons support multiple interaction states:
- Default: Standard button appearance
- Hover: Elevated with enhanced shadow
- Active/Pressed: Inset shadow effect
- Disabled: Reduced opacity
š§ Development
Available Scripts
pnpm run dev - Start Vite dev server with HMR
pnpm run build - Optimize and bundle for production
pnpm run preview - Test production build locally
pnpm run format - Format code with Prettier
Code Quality
The project follows modern best practices:
- Svelte 5 Best Practices: Uses runes for state management
- Responsive CSS: Mobile-first with semantic media queries
- Clean Code: Well-organized components with clear responsibility
- Type Safety: Ready for TypeScript adoption
š¦ Dependencies
Production
- mathjs (^12.4.0): Advanced mathematical expression evaluation
Development
- Svelte (^5.0.0): Modern reactive framework
- Vite (^6.0.0): Next-generation build tool
- @sveltejs/vite-plugin-svelte (^5.1.0): Svelte integration for Vite
- Sass (^1.75.0): CSS preprocessing
š Security
This project includes:
- ā
Regular dependency updates via Dependabot
- ā
Security overrides in
pnpm-workspace.yaml for known vulnerabilities
- ā
No hardcoded secrets or API keys
- ā
Safe DOM handling with Svelte's built-in protections
Build output:
- HTML: 0.49 KB (gzipped: 0.32 KB)
- CSS: 7.19 KB (gzipped: 2.26 KB)
- JavaScript: 666 KB (gzipped: ~195 KB)
Note: Larger JS bundle due to mathjs library. Could be code-split for further optimization.
šÆ Features in Detail
Calculator Operations
- Basic Operations: Addition, subtraction, multiplication, division
- Advanced Math: Factorial, exponents, percentage, square root
- Memory Functions: M+, M-, MC, MR (UI ready)
- Scientific Features: Fractional conversion, exponent notation
- Error Handling: Safe expression evaluation with fallback to zero
Display
- LED-style Green Display: Authentic 1980s green phosphor aesthetic
- Real-time Calculation: Updates as you type
- Clear Input History: Shows both input and calculated result
- Responsive Font Sizes: Uses
clamp() for fluid typography
š Future Enhancements
š License
MIT
š Credits
Inspired by classic CASIO calculators from the 1980s-90s era.
Built with ā¤ļø using Svelte 5 and modern web technologies