···1================================================================================
2-3- Build a Svelte-native editor core (TS) + renderer + UI.
4- Keep the "engine" framework-agnostic so Web + Tauri share it.
5- Defer collaboration until single-player is correct.
···32- 10k simple shapes pans/zooms smoothly on a typical machine.
3334================================================================================
35-Milestone M: Markdown Blocks *wb-M*
36-================================================================================
37-38-Goal:
39-Add a "Markdown block" shape with pleasant editing, predictable layout, and
40-export. Treat it as a doc-first primitive (not a hacky text element).
41-42---------------------------------------------------------------------------------
43-M1. Data model
44---------------------------------------------------------------------------------
45-46-/packages/core/src/model:
47-[ ] Add ShapeType: 'markdown'
48-[ ] MarkdownShape props:
49- - md: string
50- - w: number, h?: number " fixed width, auto height by layout
51- - style: { fontFamily, fontSize, color, bg?, border? }
52- - mode?: 'view'|'edit' " not persisted; UI-only
53-54-(DoD): Markdown blocks save/load; width preserved; content preserved verbatim.
55-56---------------------------------------------------------------------------------
57-M2. Rendering
58---------------------------------------------------------------------------------
59-60-/packages/renderer:
61-[ ] Render Markdown in canvas using a minimal subset:
62- - headings (#, ##)
63- - bold/italic/code
64- - bullet lists
65- - links (render style only; click later)
66-Strategy:
67-[ ] Parse md -> tokens -> lines; draw text runs onto canvas
68-[ ] Measure to compute auto height; cache layout per (md, w, style)
69-70-(DoD): Markdown blocks look consistent and don’t reflow unpredictably during
71-pan/zoom.
72-73---------------------------------------------------------------------------------
74-M3. Editing UX
75---------------------------------------------------------------------------------
76-77-/apps/web:
78-[ ] Double-click Markdown block opens an overlay editor (contenteditable)
79-[ ] Cmd/Ctrl+Enter toggles edit/view
80-[ ] Tab inserts spaces (not focus change) when editing
81-82-(DoD): Editing feels fast; no accidental tool switching; commit is one history
83- step.
84-85---------------------------------------------------------------------------------
86-M4. Selection + resize
87---------------------------------------------------------------------------------
88-89-[ ] Resizing adjusts width; height recomputed from layout
90-[ ] Hit-testing uses computed bounds
91-92-(DoD): Markdown blocks behave like shapes: move/resize/duplicate/undo.
93-94---------------------------------------------------------------------------------
95-M5. Export
96---------------------------------------------------------------------------------
97-98-[ ] SVG export:
99- - v0: export as <foreignObject> OR render as text lines
100-[ ] PNG export: already covered by canvas export path
101-102-(DoD): Export doesn’t lose the Markdown block content.
103-104---------------------------------------------------------------------------------
105-M6. Tests
106---------------------------------------------------------------------------------
107-108-[ ] Layout cache keying (same md/w/style => stable height)
109-[ ] Resize changes width and increases/decreases computed height appropriately
110-[ ] Undo/redo persists through refresh (ties into M persistence)
111-112-(DoD): Markdown blocks are robust and predictable.
113-114-================================================================================
115Milestone L: Layers *wb-L*
116================================================================================
117···136 - ShapeRecord.layerId: string
137 - Default layer created on new board/page
138139-(DoD): Old docs migrate to "single default layer" automatically
140-(Dexie migration).
141142--------------------------------------------------------------------------------
143L2. Rendering order + behavior
···239 - category filter
240 - click inserts at viewport center OR
241 drag ghost preview onto canvas and drop
242-243[ ] Placement rules:
244 - insert into active layer (if layers exist)
245 - snap to grid if enabled
···295- [ ] Opacity for shapes
296 - expose fill/stroke opacity controls so translucent layering is possible
297 without exporting.
00
···1================================================================================
02- Build a Svelte-native editor core (TS) + renderer + UI.
3- Keep the "engine" framework-agnostic so Web + Tauri share it.
4- Defer collaboration until single-player is correct.
···31- 10k simple shapes pans/zooms smoothly on a typical machine.
3233================================================================================
0000000000000000000000000000000000000000000000000000000000000000000000000000000034Milestone L: Layers *wb-L*
35================================================================================
36···55 - ShapeRecord.layerId: string
56 - Default layer created on new board/page
5758+(DoD): Old docs migrate to "single default layer" automatically (Dexie
59+ migration).
6061--------------------------------------------------------------------------------
62L2. Rendering order + behavior
···158 - category filter
159 - click inserts at viewport center OR
160 drag ghost preview onto canvas and drop
0161[ ] Placement rules:
162 - insert into active layer (if layers exist)
163 - snap to grid if enabled
···213- [ ] Opacity for shapes
214 - expose fill/stroke opacity controls so translucent layering is possible
215 without exporting.
216+- [ ] Markdown layout caching
217+ - cache layout per (md, w, style) to avoid re-parsing on every render