Browser maze editor built with React + Vite + Pyodide.
Runs py_ant_maze directly in the browser by loading a local wheel into Pyodide, so YAML parsing/validation/editing behavior matches the Python package.
- Edit all maze families:
- 2D:
occupancy_grid,edge_grid,radial_arm - 3D:
occupancy_grid_3d,edge_grid_3d,radial_arm_3d
- 2D:
- Switch 2D/3D mode and maze family from one UI.
- Visual paint tools for cells/walls with click-drag editing.
- Radial-arm controls (arm count, arm size, hub angle, hub size, circular/polygon hub).
- 3D level controls (level selection and level count changes).
- Add new cell/wall elements with token shortcuts.
- YAML editor + format + parse ("Sync to Grid").
- YAML import/export and PNG export (for 3D, exports each level).
src/
├── App.tsx # Main shell and panel orchestration
├── services/pyodide.ts # Pyodide init + Python mutation helpers
├── hooks/
│ ├── useMaze.ts # Main state/actions for parse/edit/create
│ ├── useFileOperations.ts # Upload/download/export image
│ └── useKeyboardShortcuts.ts # Token key -> element selection
├── components/
│ ├── editor/ # Code panel + visual panel wrappers
│ ├── controls/ # Type, size, level, palette, add-element controls
│ ├── layout/ # Header/loading shells
│ ├── MazeGrid.tsx # Occupancy/edge rendering + paint
│ └── RadialArmGrid.tsx # SVG radial-arm rendering + paint
├── constants/defaults.ts # Default YAML templates and render constants
└── types/maze.ts # Shared TS maze types
Data flow:
useMazeloads Pyodide and installspy_ant_mazewheel.- Python-side helpers parse YAML into normalized JSON for the UI.
- UI actions call Python mutation helpers and round-trip updated YAML/data back.
Open https://maze.yihao.one.
Prerequisites:
- Node.js 18+
- Python 3.10+ (for building the wheel consumed by Pyodide)
- Build the wheel:
cd ../py_ant_maze
python -m build- Start the editor:
cd ../maze_editor
npm install
npm run devpredev copies ../py_ant_maze/dist/py_ant_maze-0.1.1-py3-none-any.whl into public/ automatically.
Then open the Vite URL shown in terminal (usually http://localhost:5173).
- Choose maze type (and radial hub shape when relevant).
- Paint cells/walls in the visual grid.
- Use element palette or keyboard token shortcuts for fast selection.
- Edit YAML directly in the code panel as needed.
FormatandSync to Gridto normalize and re-parse.- Export YAML or PNG from the toolbar.










