TableTower/docs/SHEETS.md
RobinFiredrake 2661744b06 Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
  with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
  (blank or a template); editor with folder tabs, snap-grid canvas on the
  spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00

5.7 KiB
Raw Blame History

Sheets and the unified editor: spec and plan

Agreed with the user 2026-11-29. Mockup canvas (design only, not code): https://claude.ai/code/artifact/4311ebce-47e0-479c-bc1b-40800339b50b

1. Goal

A sheet builder for any TTRPG: odd OSR stats, point buy, a vehicle with only description boxes. Sheets can be used on their own or as a node in a spread, and tables can read and write them. The new Sheets replace today's Sheet card kind (RollTable.KIND_SHEET, a BBCode template): an old sheet card becomes a sheet with one text box.

2. Decisions

  • Main menu: Spreads / Sheets / Settings / Quit, titles only (no descriptions). Room for more.
  • Sheets standalone or in a spread. On a spread the node shows a preview of the sheet's first tab. Double-click opens it in an in-app tab (view only in Play).
  • Layout: free placement with a snap grid; Alt places freely. A sheet has tabs, each its own canvas. One Play/Build toggle; in a spread, the spread's toggle.
  • Multi-entry boxes ("repeating section" elsewhere): each box picks rows, mini table or chips.
  • Point pools: may go negative, shown red. Reuse the result cost {value, amount} variable.
  • Details: hover tooltip (short, cut with "…"); click opens an in-app side panel.
  • Field types: number, text, notes, checkbox, dropdown; current/max bars, tick rows, clocks; computed fields, dice buttons; image, heading, divider; dots, step dice, usage dice, ladders; slot inventory with encumbrance; tag/condition chips, aspects, bonds; spell slots, XP, currency.
  • Tables ↔ sheets: tables write and read fields. A field gets an @variable only when "Use in tables" is on. Each field has a lock: locked fields ignore roll writes. Later: a sheet event triggers a table roll (fumble → critical-failure table).
  • Templates and one-off sheets. New sheet = blank canvas or one of your templates.
  • Look: app theme, plus per-box colour and per-sheet tint; frameless boxes.
  • Text: all BBCode, buttons for common tags, live {@var}, links to Lore Entries.
  • Lore Index: opens in Play and Build, in spreads and sheets. Holds sheet entries and whole sheets as items (a rolled sword → a character's inventory). Gains a shared "My library" level beside "This spread". Drop copies; Shift keeps it linked.
  • Undo/redo for values and layout. Export: share file, PDF/print, PNG.
  • Phone: Play stacks boxes full width in reading order (top-down, then left-right), with a manual "Phone order" per box; a Canvas switch shows the real layout with pan/zoom.

3. Unified editor (spreads and sheets look alike)

  • Card palette replaces "+ Card ▾": a left dock with tabs Cards | List. Cards has a search box at the top, grouped kinds, templates as a group; drag onto the spread (click adds at the view centre). Roll table, Dice table and Deck are separate items (same kind, different start settings). Right-click › New card stays.
  • Play mode: the Cards tab stays, greyed, with "Cards are added in Build mode" and a Switch to Build button. This replaces the greyed "+ Card" button.
  • Right dock: Inspector | Lore Index (as today), same tab style as the left dock.
  • Top bar: "Board ▾" is renamed "Spread ▾". Later one shared top bar for spreads and sheets.
  • Open documents as tabs (needed for sheets opened from a spread node).
  • Sheet editor uses the same palette (with search) for fields.

4. Phases

  • A. Card palette — done 2026-11-29 (commit 16b34c4 on card-palette): left dock Cards | List, search, drag/click to add, Play-mode notice, remove "+ Card ▾", rename Board ▾ → Spread ▾. Phone: "+" opens a searchable list.
  • B. Sheets core — base built 2026-11-29 (branch sheets): main menu, Sheets list, New sheet dialog, sheet editor with tabs, snap canvas (Alt = free), field palette (shared PaletteList), inspector, Play/Build, snapshot undo, saving. Kinds so far: Number, Text box, Heading. Theme changes keep the screen (MainScreens.resume). Was planned as: data model + storage (sheets and templates), main menu, Sheets list, New sheet dialog, sheet editor (tabs, snap canvas, palette, inspector, Play/Build, undo).
  • C. Field types: basics → trackers → computed and dice → niche kinds.
  • D. Spread integration: sheet node (first-tab preview), variables read/write, locks, replace and migrate KIND_SHEET, document tabs.
  • E. Lore Index library + items, export (PDF, PNG, share file), phone stacked view.

5. Code map (phase B)

  • Data: core/sheet_doc.gd (tabs of boxes), core/sheet_box.gd, core/sheet_kinds.gd (the kinds list, grid step, make_box), core/sheet_store.gd (user://sheets, user://sheet_templates; a scratch folder when not saving), core/snapshot_history.gd, core/sheet_demo.gd.
  • Screens: ui/main_screens.gd (menu / spread / sheets; start screen; resume after a theme change), ui/main_menu.gd, ui/sheets_screen.gd, ui/new_sheet_dialog.gd.
  • Editor: ui/sheet_editor.gd (mode, tab, selection, edit/undo/save), ui/sheet_top_bar.gd, ui/sheet_tabs_bar.gd, ui/sheet_canvas.gd, ui/sheet_box_view.gd, ui/sheet_field_views.gd, ui/sheet_inspector.gd, ui/field_palette.gd; ui/palette_list.gd is shared with the card palette.
  • Look (2026-11-29, matched to the mockup): ui/menu_icons.gd (drawn icons), MainTopBar.make_brand (shared brand), SheetBoxView.look (tinted card, band, border), canvas and menu draw the theme's spread background (BoardBackdrop). Sheets in Play keep the greyed palette (user's rule).
  • Keys: MainLayout._shortcut_input sends keys to the screen that shows.
  • CLI: --menu, --sheets, --sheet-demo (+ --sheet-build), --new-sheet. Suites: test_sheets, test_sheet_editor.