Widget library + manual insert + renumber โ€” the operator flow

Two paths: AI generates sections, OR the operator picks from a widget library. Both insert into the structure tree with a slot number. Renumbering is automatic โ€” slots are just addresses, not fixed IDs. The widget tree, the AI tree, and the renumbering all share one rule: slot = position-in-tree.

๐ŸŒฒ Structure tree with insert + renumber
DYNAMIC NUMBERING
Slots are addresses, not IDs. Insert anywhere โ†’ everything after renumbers. The operator sees the new index in green.
S-1 โ–ญ Hero HERO
+ Insert here
S-2 โ–ญ About TEXT
+ โ†ณ insert Services (cards) here
S-3 NEW โ–ฆ Services CARDS
+ Insert here
S-4 โ–ญ Testimonials TEXT
+ Insert here
S-5 โ–ญ CTA CTA
+ Insert here
S-6 โ–ญ Footer FOOTER
๐Ÿงฉ Widget library โ€” click to insert
23 WIDGETS
Hero
section ยท full
Cards
section ยท 2-col
Text block
section ยท text
CTA
section ยท cta
Image
widget ยท media
Gallery
section ยท 3-col
Testimonial
widget ยท quote
Pricing
section ยท 3-col
Contact form
section ยท form
Team grid
section ยท 3-col
Icon list
widget ยท list
Accordion
widget ยท faq
๐Ÿค– AI path โ€” generate or modify
LLM POWERED
AI prompt
Add a testimonials section between About and CTA, with 3 quotes from teachers.
AI plan
โœ“ Insert new section at slot 4 (after S-2 About)
โœ“ Type: TEXT (testimonial widget)
โœ“ 3 child widgets, each a Testimonial
โœ“ Renumber: S-3 โ†’ S-4, S-4 โ†’ S-5, S-5 โ†’ S-6
โœ“ Auto-detect on inserted section (override if wrong)
โœ๏ธ Manual path โ€” pick widget + position
DRAG OR CLICK

Two ways to insert

1. Click a slot in the tree
Hover any tree node โ†’ a + button appears above and below. Click it โ†’ widget library opens โ†’ pick one โ†’ inserts at that position.
2. Drag from widget library
Drag any widget card from the library onto a slot in the tree. Blue line shows where it'll land. Drop โ†’ inserts.
3. Quick-add at end
The bottom bar's + Section / + Container / + Widget appends to the end of the tree.
๐Ÿ”ข Slot addressing โ€” why renumbering is free
DATA MODEL
Old (brittle)
{
  "id": "S-3",
  "type": "section",
  "name": "Services"
}
Insert at S-2 โ†’ S-3 must move, all references break, IDs lie.
New (resilient)
{
  "slot": 3,        โ† position
  "uuid": "a7f3...", โ† stable ID
  "type": "section",
  "name": "Services"
}
Insert at slot 2 โ†’ slot 3..N renumber. UUIDs are stable. CSS selectors target UUIDs, not slots.
Display rule
function displayId(slot) {
  return `S-${slot}`;
}

// Renumber = re-index array.
// No ID changes, no CSS breaks.
// Operator sees the new slot
// in green, then it settles.
S-1, S-2, S-3 are labels, not IDs. They're regenerated from position on every render.

The full plan โ€” three things that have to work together:

1. Widget library (23 widgets across 5 categories)

2. Manual insert โ€” three entry points

3. Renumbering is automatic

4. The data model change

5. What the operator sees (the UX)