feat: functional gridfinity calculator app

This commit is contained in:
w33ble
2026-01-11 19:38:34 -07:00
commit 7c512f5adb
19 changed files with 3561 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# Active Context
## Current Status
- Initializing the project environment.
- Documentation phase (Memory Bank & Blueprint).
## Recent Changes
- Created `memory-bank/projectBrief.md`.
- Created `memory-bank/productContext.md`.
## Current Focus
- Completing Memory Bank initialization.
- Drafting PRD and Architecture.
- Setting up the Vite/TypeScript/Tailwind environment.
## Active Decisions
- Using **Vite** for the build tool.
- Using **Vanilla TypeScript** to avoid framework overhead.
- Using **Vitest** for unit testing calculation logic.
- Target: A single-page application that can be built into a self-contained output.

View File

@@ -0,0 +1,18 @@
# Product Context
## Why this project exists?
Gridfinity is a popular modular storage system. While the standard is well-defined (42x42x7mm), users often need to:
1. Figure out how many baseplates fit in a drawer.
2. Determine the maximum height of bins for a specific drawer depth.
3. Scale the system slightly to perfectly fill a drawer that doesn't fit a whole number of 42mm grids.
## User Experience
- **Input-First:** Users should immediately see where to enter their dimensions.
- **Instant Feedback:** Results should update as they type.
- **Flexibility:** Toggle between mm and inches easily.
- **Precision:** Clear output showing "Full Grids" and "Vertical Units".
## Success Criteria
- Accurately converts between units.
- Correctly calculates bin height while accounting for baseplate/bin-bottom thickness.
- Provides clear instructions for "fractional" fits (e.g., if a drawer is 100mm, it fits 2.38 grids).

18
memory-bank/progress.md Normal file
View File

@@ -0,0 +1,18 @@
# Progress Tracking
## Milestones
- [ ] Initial Environment & Docs Setup
- [ ] Core Calculation Engine
- [ ] Web UI & Integration
- [ ] Final Build & Polish
## Todo List
- [x] Create project structure
- [x] Initialize Memory Bank documents
- [ ] Create Blueprint documents (PRD, Architecture)
- [ ] Project setup (Vite, TS, Tailwind, Vitest)
- [ ] Implement `src/calculator.ts`
- [ ] Write tests in `src/calculator.test.ts`
- [ ] Implement `index.html` UI
- [ ] Implement `src/main.ts` glue code
- [ ] Verify build output

View File

@@ -0,0 +1,17 @@
# Project Brief: Gridfinity Calculator
A simple, lightweight web-based calculator for Gridfinity baseplates and bins.
## Core Requirements
- Enter drawer/container dimensions (width, height, depth).
- Support for both inches and millimeters.
- Custom overrides for Gridfinity specifications (default 42x42x7mm).
- Calculate required baseplates (full grids).
- Calculate bin vertical unit height (7mm increments), accounting for base thickness.
- No heavy frameworks (Vanilla TS/Vite).
- Single-page optimized build.
## Goals
- Provide an accurate and easy-to-use tool for Gridfinity makers.
- Allow for non-standard scaling to fit specific drawer sizes perfectly.
- Clean, responsive UI with Tailwind CSS.

View File

@@ -0,0 +1,28 @@
# System Patterns
## Tech Stack
- **Build Tool:** Vite
- **Language:** TypeScript
- **Styling:** Tailwind CSS
- **Testing:** Vitest
## Design Patterns
- **Modular Logic:** Calculation logic is isolated in a pure TypeScript module (`src/calculator.ts`) for easy testing.
- **Reactive UI (Vanilla):** Use DOM event listeners and a central `render()` or `update()` function to sync state to the UI.
- **Unit Normalization:** All internal calculations should be performed in **millimeters**. Inputs in inches are converted immediately upon ingestion.
## Directory Structure
- `src/`: Source code.
- `calculator.ts`: Core business logic.
- `main.ts`: Entry point and DOM manipulation.
- `style.css`: Tailwind entry point.
- `docs/`: Permanent documentation (PRD, Architecture).
- `memory-bank/`: AI operational context.
- `tests/`: Unit tests.
## Calculation Constants (Defaults)
- Grid Width/Depth: 42mm
- Grid Height Unit: 7mm
- Base Thickness: 4.8mm (typical baseplate height above surface)
- Bin Lip/Bottom: 0.7mm (typical clearance/thickness to account for in vertical units)
- *Note: These defaults will be refined during implementation based on official specs.*