Skip to content

feat: add visual blueprint editor for custom blueprints#39

Draft
EpicLPer wants to merge 1 commit into
macpit:masterfrom
EpicLPer:feat/blueprint-visual-editor
Draft

feat: add visual blueprint editor for custom blueprints#39
EpicLPer wants to merge 1 commit into
macpit:masterfrom
EpicLPer:feat/blueprint-visual-editor

Conversation

@EpicLPer

Copy link
Copy Markdown

DISCLAIMER: AI generated code with Cursor. See Discussion here about this: #38


Summary

Draft PR for a visual blueprint editor — feedback welcome before merge.

Adds a self-contained editor view for user/custom blueprints (bundled blueprints remain read-only):

  • Live SVG preview with drag-to-move and resize handles (rect/circle)
  • Custom SVG path (d) button support
  • Create + edit custom blueprints with PNG upload (auto-resized to max 800×500)
  • Undo/redo and unsaved-changes warnings (cancel, browser back, refresh/close)
  • Backend blueprint/save websocket with YAML validation; blocks overwriting bundled blueprints

Architecture (v4 frontend)

  • New view: frontend/src/switch-manager-blueprint-editor.ts (standalone Lit component)
  • Routed from switch-manager-panel.ts for /switch_manager/blueprint/new and .../edit/:id only
  • Does not extend the shared HA_COMPONENTS runtime load list
  • Entry points: “Create Blueprint” + edit pencil in blueprint selector (custom blueprints only)
  • Bundle rebuilt via cd frontend && npm run build

Backend

  • blueprint/save websocket endpoint
  • Save helpers with YAML validation, PNG limits, editable guard on bundled blueprints
  • Panel reload fix (async_remove_panel on setup/unload)

Maintenance note

I may not be able to maintain this long-term; happy for ongoing upkeep to live with the project if it lands.

Test plan

  • Create new custom blueprint: upload image, place buttons, save
  • Edit existing custom blueprint; confirm bundled blueprints cannot be edited
  • Drag/resize buttons; undo/redo
  • Cancel / browser back with unsaved changes shows confirmation
  • Integration reload does not error on panel registration
  • cd frontend && npm run build produces the committed bundle

Introduce a self-contained blueprint editor view with live SVG preview, button placement, and save support for user-owned blueprints.
@EpicLPer EpicLPer marked this pull request as ready for review June 27, 2026 21:23
@EpicLPer EpicLPer marked this pull request as draft June 27, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant