feat: Add GlowTrack mood and habit wellbeing grid specifications
- Introduced export schema for JSON data structure. - Created renderer contract detailing canvas/SVG rendering requirements. - Defined IndexedDB storage schema and migration strategies. - Documented data model including entities and relationships. - Developed implementation plan outlining execution flow and project structure. - Provided quickstart guide for development environment setup. - Compiled research documentation on performance, accessibility, and theming. - Established feature specification with user scenarios and functional requirements.
This commit is contained in:
75
specs/001-glowtrack-a-mood/contracts/export.schema.json
Normal file
75
specs/001-glowtrack-a-mood/contracts/export.schema.json
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://glowtrack.app/schema/export.json",
|
||||
"title": "GlowTrack Export",
|
||||
"type": "object",
|
||||
"required": ["version", "app", "exportedAt", "data"],
|
||||
"properties": {
|
||||
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
|
||||
"app": {
|
||||
"type": "object",
|
||||
"required": ["name", "version"],
|
||||
"properties": {
|
||||
"name": { "const": "GlowTrack" },
|
||||
"version": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"exportedAt": { "type": "string", "format": "date-time" },
|
||||
"data": {
|
||||
"type": "object",
|
||||
"required": ["settings", "habits", "days"],
|
||||
"properties": {
|
||||
"settings": { "type": "object" },
|
||||
"habits": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["id", "type", "label", "defaultWeight", "archived"],
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"type": { "enum": ["positive", "negative"] },
|
||||
"label": { "type": "string" },
|
||||
"icon": { "type": ["string", "null"] },
|
||||
"defaultWeight": { "type": "number", "minimum": 0 },
|
||||
"archived": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"days": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["date", "mood", "entries"],
|
||||
"properties": {
|
||||
"date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
|
||||
"mood": {
|
||||
"type": "object",
|
||||
"required": ["hue", "intensity"],
|
||||
"properties": {
|
||||
"hue": { "type": "number", "minimum": 0, "maximum": 360 },
|
||||
"intensity": { "type": "number", "minimum": 0, "maximum": 1 },
|
||||
"note": { "type": ["string", "null"] }
|
||||
}
|
||||
},
|
||||
"entries": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["id", "type", "habitId", "label", "weight", "timestamp"],
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"type": { "enum": ["positive", "negative"] },
|
||||
"habitId": { "type": "string" },
|
||||
"label": { "type": "string" },
|
||||
"weight": { "type": "number", "minimum": 0 },
|
||||
"timestamp": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
specs/001-glowtrack-a-mood/contracts/renderer.md
Normal file
31
specs/001-glowtrack-a-mood/contracts/renderer.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Renderer Contract — Canvas/SVG
|
||||
|
||||
## Purpose
|
||||
Render a grid of DayTiles with mood hue, glow intensity from net habit score, negative overlay static, and glyph counts.
|
||||
|
||||
## Inputs
|
||||
- containerSize: { width: px, height: px, devicePixelRatio }
|
||||
- days: DayTile[] (ordered by date)
|
||||
- theme: palette + CSS variables
|
||||
- options:
|
||||
- showLegend: boolean
|
||||
- pngScale: number (for export)
|
||||
|
||||
## Outputs
|
||||
- On-screen render at 60 fps target
|
||||
- Exported PNG at screen resolution (pngScale defaults to 1.0)
|
||||
|
||||
## Rules
|
||||
- Base hue from mood.hue; luminance curve f(netScore) with easing and clamping
|
||||
- Negative entries: apply subtle static texture overlay (non-hue-altering)
|
||||
- Glyphs: ticks = count(positive), dots = count(negative)
|
||||
- No hue change from overlays; only luminance/texture affected
|
||||
|
||||
## Performance
|
||||
- Batch draw tiles; minimize layout/paint; avoid per-frame allocations
|
||||
- Prefer Canvas for tiles; SVG for glyph overlays and interactive focus rings
|
||||
- Ensure keyboard focus indicators meet WCAG AA contrast
|
||||
|
||||
## Accessibility
|
||||
- Keyboard navigable tiles (tab/arrow); ARIA labels describing day, mood, counts
|
||||
- High-contrast theme variant; color-blind palettes via CSS variables
|
||||
34
specs/001-glowtrack-a-mood/contracts/storage.schema.md
Normal file
34
specs/001-glowtrack-a-mood/contracts/storage.schema.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Storage Schema — IndexedDB (idb)
|
||||
|
||||
## DB Name
|
||||
- glowtrack
|
||||
|
||||
## Versioning
|
||||
- Start at version 1; bump on schema changes
|
||||
- Provide forward-only migrations for v1 → v2 → ...
|
||||
|
||||
## Object Stores
|
||||
- settings (key: 'singleton')
|
||||
- value: GridSettings
|
||||
- habits (keyPath: 'id')
|
||||
- indexes: by_type (type)
|
||||
- days (keyPath: 'date')
|
||||
- value: DayTile without entries
|
||||
- entries (keyPath: 'id')
|
||||
- indexes:
|
||||
- by_date (date)
|
||||
- by_habit (habitId)
|
||||
|
||||
## Transactions
|
||||
- Log habit: readwrite on entries, days (update netScore)
|
||||
- Edit/delete: readwrite on entries, days
|
||||
- Import JSON: version check, bulk put within a single transaction per store
|
||||
|
||||
## Migrations
|
||||
- v1: create stores and indexes above
|
||||
- Future: add derived caches (e.g., monthly aggregates) — must be rebuildable
|
||||
|
||||
## Data Integrity
|
||||
- Enforce unique DayTile.date
|
||||
- Recompute DayTile.netScore after entry mutations
|
||||
- Maintain referential link of HabitEntry.habitId to habits store
|
||||
Reference in New Issue
Block a user