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>
96 lines
2.3 KiB
TypeScript
96 lines
2.3 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.svg', 'icons/*.svg'],
|
|
manifest: {
|
|
name: 'CalcPad',
|
|
short_name: 'CalcPad',
|
|
description: 'A modern notepad calculator powered by WebAssembly',
|
|
theme_color: '#6366f1',
|
|
background_color: '#ffffff',
|
|
display: 'standalone',
|
|
orientation: 'any',
|
|
scope: '/',
|
|
start_url: '/',
|
|
icons: [
|
|
{
|
|
src: '/icons/icon-192.svg',
|
|
sizes: '192x192',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any',
|
|
},
|
|
{
|
|
src: '/icons/icon-512.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any',
|
|
},
|
|
{
|
|
src: '/icons/icon-maskable-512.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
purpose: 'maskable',
|
|
},
|
|
],
|
|
categories: ['productivity', 'utilities'],
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,svg,wasm}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/api\./,
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-cache',
|
|
expiration: {
|
|
maxEntries: 50,
|
|
maxAgeSeconds: 60 * 60 * 24,
|
|
},
|
|
networkTimeoutSeconds: 5,
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|webp)$/,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'image-cache',
|
|
expiration: {
|
|
maxEntries: 100,
|
|
maxAgeSeconds: 60 * 60 * 24 * 30,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
devOptions: {
|
|
enabled: false,
|
|
},
|
|
}),
|
|
],
|
|
build: {
|
|
target: 'es2022',
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
react: ['react', 'react-dom'],
|
|
codemirror: [
|
|
'@codemirror/state',
|
|
'@codemirror/view',
|
|
'@codemirror/language',
|
|
'@lezer/highlight',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
worker: {
|
|
format: 'es',
|
|
},
|
|
})
|