- E1: Export ▾ (share file with embedded pictures, print/PDF web page, PNG of the tab); Import a sheet file from Sheets and New sheet. - E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links ([url=lore:ID]) with hover excerpt and the details panel. - E3: Lore Index in Play and in sheets (shared LoreList); This spread | My library; item sheets on Lore Entries; drag entries into lists, slots and notes (copy, Shift keeps linked). - E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px touch sizes, bottom panels; sheet CLI flags split out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 KiB
13 KiB
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
16b34c4oncard-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 (sharedPaletteList), 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 — built 2026-11-29 (branch
sheets): every kind in §2 (SheetKinds.ITEMS, 25 palette items over 23 kinds). Values for formulas/dice/live text:core/sheet_values.gd(rule language with sheet @names; loops are errors). Views:ui/sheet_field_views.gd(basics, dispatch),sheet_fields_trackers/smart/list/niche.gd; settings:ui/sheet_kind_settings.gd; details side panel:ui/sheet_detail_panel.gd. Pictures are copied tosheets/pictures/. Not yet: per-entry variables in lists (phase D), BBCode buttons and Lore links in text (done in E2). - D. Sheets on spreads — built 2026-11-29: a sheet on a spread is a Sheet card linked to a
sheet file (
RollTable.sheet_id,sheet_prefix; JSONsheet,prefix), so threads, groups, undo, List view and the tray headline work as for any card. The card showsSheetPreview(first tab, values, gold outline on boxes the last roll changed; double-click / "Open sheet" opens it with "← spread"; the sheet editor then uses the spread's Play/Build). A roll reaching the card rollsSheetText.summary(boxes as "Title: value", linked ones as {@prefix_name}) throughRoller.sheet_text. Bridgecore/sheet_links.gd+ui/main_sheet_links.gd: before a roll "Use in tables" boxes become @name / @prefix_name; after it changed values go back unless locked or not writable. Text boxes on a sheet that is on the open spread also show spread values ({@answer}). Migration: an old template Sheet card gets a sheet file (id<spread>-<card>, one text box with its template) when the spread loads or the card arrives (not inside Help demos). The user's picks: prefix per card (blank allowed; the second sheet gets one from its name), only "Use in tables" boxes. Card palette › Sheets: "New sheet" + your sheets. Sheet canvas: grid is one tiled texture (smooth panning); boxes don't overlap (new ones take the nearest free spot, drags stop short; Alt = free). - E. Lore Index library + items, export (PDF, PNG, share file), phone stacked view.
- E1. Export and import — built 2026-11-29: sheet top bar Export ▾ (Play and Build):
"Share file…" (
*.sheet.json:{"tabletarot_sheet": 1, "sheet", "pictures"}, picture boxes' files inside as base64; no template link), "Print / PDF (web page)…" (Godot has no PDF writer: an HTML page, one<section>per tab printed on its own page, boxes as "Title: value" lines fromSheetText.tab_textwith values, through the tray'sSheetExport.to_html), "Image (PNG)…" (the window's pixels under the canvas: this tab as you see it). Import… on the Sheets list and "Import a sheet file…" in the New sheet dialog: a new id, pictures written tosheets/pictures/, saved and opened (from the card palette: placed on the spread). - E2. Text tools and Lore links — built 2026-11-29: editing a Long notes box (Play) shows
SheetTextToolbarabove it: B I U S, Colour ▾ / Size ▾ / Effect ▾ (the tags ofFormatMenu, which the TextEdit also gets as its right-click menu), {@} ▾ (the sheet's @names as live values) and "§ Link…" (Link a Lore Entry…,LoreLinkPickerwith search). Link syntax: plain BBCode[url=lore:ENTRY_ID]words[/url](no selection: the entry's name is added).RichText.decoratedraws it in REF_INK on REF_BG; hover (DetailsPopup"lore:") shows the name and an excerpt cut with "…"; a click opens it in the side panel (SheetDetailPanel.open_lore, read only). "lore:" is an internal meta (Copy as BBCode drops the link, keeps the words). Which Lore Index: the open spread's, even for a sheet not on a spread; the one lookup isSheetLoreLinks.entries(E3 adds "My library" there). - E3. Lore Index everywhere, My library, sheet items — built 2026-11-29: the Lore Index
panel is
LoreList(title, + Lore Entry, ×, This spread | My library tabs, search, list,PageEditor), shown byBookPanel(spread, Play and Build) andSheetLoreDock(sheet editor: the inspector's Lore tab in Build, top bar Lore Index toggle in both modes). Levels areLoreLevelobjects (SpreadLoreLevel: spread undo,sync_page;LibraryLoreLevel: saved at once, no undo). My library isLoreLibrary,<store root>/lore_library.json({"book": [BookPage dicts]}; user:// when saving, the sheets' scratch folder otherwise). Link refs:lore:ID= this spread,lore:lib:ID= My library (SheetLoreLinks.ref/find). Under an entry: "Copy to My library / This spread" (a new id; its item sheet copied; pictures only stay in the spread) and "Make a sheet for this entry" / "Open its sheet":BookPage.sheet(JSONsheet, a SheetStore id) →SheetItems.make_sheet(Heading, Damage, Charges, Notes). A library entry dropped on a spread card is copied into the spread first. Drops into a sheet (SheetLoreDrop, oneset_valueundo step): list box → a row (first column = name,details= plain text), Slots → an item{name, size: 1}, Long notes → a link appended. A drop copies (the item sheet too,SheetItems.copy_sheet); Shift links:lore= ref andsheet= the entry's own sheet. Marks: § before a linked row/item, ▤ opens a row's sheet (Slots: the item's menu); ⓘ on such a row has "Read the Lore Entry" / "Open its sheet". Opening a sheet from a sheet usesSheetItemNav("← previous sheet", then back to the spread). A linked row keeps its own copy of the text (it doesn't follow later edits of the entry); deleting an entry leaves its item sheet in Sheets. - E4. Phones and tablets — built 2026-11-29: in the phone layout (
MobileLayout, also--mobile) the sheet editor usesSheetPhoneLayout. Play shows the stacked view (SheetStackView): the open tab's boxes in one full-width column, each the sameSheetBoxViewat its own height or taller if its content needs it. Phone order rule (SheetStackView.order_of): boxes with a Phone order number (> 0) come first, smallest first; then the automatic ones (0) in reading order (y, then x); equal numbers also fall back to reading order. Touch size: while the stack builds a box,SheetFieldViews.touchis on andtap_sizegrows step buttons, ticks, dots and slot cells to 44 px (no second set of views). A bottom bar replaces the status strip: Undo, Stacked | Canvas (Play; Canvas is the real layout, drag to pan, no pinch zoom yet), and "+ Field" (Build, which always uses the canvas) that opens the field palette full screen; a pick goes back to the canvas. The inspector (only while a box is selected), the Lore Index and the details panel open as bottom panels. The top bar drops the brand words, hint, Lore Index and Export ▾ (both move into ☰). Not done: narrow desktop windows keep the desktop layout; a stats list in Rows style stays rows (no big tiles); Lore drops onto stacked boxes don't land.
- E1. Export and import — built 2026-11-29: sheet top bar Export ▾ (Play and Build):
"Share file…" (
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.gdis 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_inputsends keys to the screen that shows. - Export/import (E1):
core/sheet_file.gd(share file),ui/sheet_export_menu.gd(Export ▾, PNG capture),SheetExport.sheet_html,SheetStore.keep_picture_bytes,SheetsScreen.import_sheet. - Text tools and Lore links (E2):
ui/sheet_text_box.gd(the Long notes view),ui/sheet_text_toolbar.gd,ui/sheet_lore_links.gd(lookup, excerpt, hover),ui/lore_link_picker.gd;FormatMenu.colours/selection. - Lore Index everywhere (E3):
ui/lore_list.gd,ui/lore_level*.gd,core/lore_library.gd,ui/lore_entry_actions.gd,ui/sheet_lore_dock.gd,ui/sheet_lore_drop.gd,ui/sheet_item_nav.gd,core/sheet_items.gd;SheetKinds.place(a box on the grid;SheetDemouses it too). - Phones (E4):
ui/sheet_phone_layout.gd(bottom bar, bottom panels, full-screen palette),ui/sheet_stack_view.gd(stacked view,order_of);SheetFieldViews.touch/tap_size. Suite:test_mobile. - CLI (
ui/main_cli_sheets.gd):--menu,--sheets,--sheet-demo(+--sheet-build,--sheet-lore(a linked Lore Entry in the panel),--sheet-edit=TITLE(that text box open with its toolbar),--sheet-lore-index(the Lore Index beside it, with a My library item dropped in)),--new-sheet. Suites:test_sheets,test_sheet_editor.