···131131pleasant insertion workflow. No sharing/community libraries yet—just "your own".
132132133133--------------------------------------------------------------------------------
134134-S1. Stencil definition format (core)
135135---------------------------------------------------------------------------------
136136-137137-/packages/core/src/stencils:
138138-[x] Define Stencil:
139139- - id, name, category, tags[]
140140- - preview: { kind: 'svg'|'canvas', data }
141141- - spawn: function (atPoint, scale) -> ShapeRecords[] (group)
142142- (A stencil can insert 1 shape or a grouped set.)
143143-144144-[x] Create initial categories:
145145- - Flowchart: process, decision, terminator, data, document
146146- - Diagrams: server, db, queue, user, browser, mobile
147147- - UI: button, input, card, modal
148148- - Etc: Post-It style/sticky notes, index cards, speech bubble
149149-150150-(DoD): Stencils load as data and can spawn shapes deterministically.
151151-152152---------------------------------------------------------------------------------
153134S2. Insert UX
154135--------------------------------------------------------------------------------
155136156137/apps/web:
157157-[x] Stencils drawer/palette:
158158- - search (name + tags)
159159- - category filter
160160- - click inserts at viewport center OR
161161- drag ghost preview onto canvas and drop
162138[ ] Placement rules:
163163- - insert into active layer (if layers exist)
164164- - snap to grid if enabled
165165-[x] Toolbar
166166- - Open menu to insert stencils with button to open drawer
167167-[x] Drawer
168168- - Stencil selection with search, category filter, and thumbnail previews
139139+ - insert into active layer (when layers are added)
140140+ - [x] snap to grid if enabled
169141170142(DoD): Inserting stencils is faster than drawing shapes manually.
171171-172172---------------------------------------------------------------------------------
173173-S3. Grouping behavior
174174---------------------------------------------------------------------------------
175175-176176-[ ] When a stencil spawns multiple shapes:
177177- - create a GroupRecord OR a "groupId" on shapes (your existing grouping
178178- model)
179179- - allow move as one unit
180180- - ungroup command
181181-182182-(DoD): Multi-shape stencils behave like a single object until ungrouped.
183183-184184---------------------------------------------------------------------------------
185185-S4. Preview rendering
186186---------------------------------------------------------------------------------
187187-188188-[x] Render stencil previews in the panel:
189189- - small SVG thumbnails (best) & draw to offscreen canvas
190190-191191-(DoD): Users can recognize stencils instantly.
192192-193193---------------------------------------------------------------------------------
194194-S5. Persistence + versioning
195195---------------------------------------------------------------------------------
196196-197197-[ ] Stencils are "code assets":
198198- - version them with the app
199199- - inserted shapes are normal shapes (no dependency on stencil after
200200- insertion)
201201-202202-(DoD): Old docs do not break if you change stencil definitions later.
203203-204204---------------------------------------------------------------------------------
205205-S6. Tests
206206---------------------------------------------------------------------------------
207207-208208-[ ] spawn() returns valid records with unique ids and correct initial positions
209209-[ ] group insert produces expected selection and undo/redo works
210210-[ ] search indexing returns correct stencils for tag queries
211211-212212-(DoD): Stencils are reliable and don’t corrupt docs.
213143214144================================================================================
215145Parking Lot *wb-pl*