@quest-editor/editor
v0.1.5
Published
Visual React editor component for the Quest Editor — a HeroQuest dungeon editor.
Readme
@quest-editor/editor
Visual React editor component for the Quest Editor — a HeroQuest dungeon editor.
Provides an interactive canvas with drag-and-drop, zoom, pan, themes, plugin system, undo/redo, lock system, fog of war, and real-time validation.
Install
npm install @quest-editor/core @quest-editor/editor react react-dom konva react-konva zustandUsage
import { useState } from 'react'
import { QuestEditor } from '@quest-editor/editor'
import { createQuest } from '@quest-editor/core'
function App() {
const [quest, setQuest] = useState(() => createQuest({ name: 'My Quest' }))
return (
<QuestEditor
quest={quest}
onChange={setQuest}
width={800}
height={600}
theme="stone"
/>
)
}Features
- Canvas: Konva-based grid with drag-and-drop element placement
- Themes: Dark, Stone (default), Parchment, Light
- Undo/Redo: Cmd+Z / Cmd+Shift+Z with 50-step history
- Lock system:
lock()/unlock()API for plugins - Fog of War: Play mode with room reveal via door clicks and corridor ray-cast
- Validation: Real-time error/warning panel
- Events:
onEventcallback for tracking element changes, quest loads, room reveals, and the play-modemonster:killed/search:*/trap:disarmedhooks - Play-mode hooks: Clicking a monster fires
monster:killed; clicking a discovered trap firestrap:disarmed(both intercept — the editor does not remove; the host removes viaremoveElement).searchRoom(groupId, kind)reveals hidden room traps / secret doors and emitssearch:* - Plugin system: Extensible panel sections via
EditorPlugininterface - Ref API:
QuestEditorHandlewithlock,unlock,undo,redo,setMode,revealRoom,getRevealedGroups,removeElement,searchRoom
Peer Dependencies
react^18.0.0react-dom^18.0.0konva^9.0.0react-konva^18.0.0zustand^5.0.0
License
MIT
