Appearance
Simulator MapPlayground Refactor Plan
Background
MapPlayground.vue had accumulated page composition, rendering lifecycle, cache persistence, and editor modal logic in one file, making iterative changes costly.
Goal And Scope
Refactor to align with Vue 3 composition practices while preserving behavior and UI.
In scope:
- Move simulator state and business logic into a composable.
- Move fullscreen editor modal into a standalone component.
- Keep existing render behavior, cache behavior, and interactions unchanged.
Out of scope:
- Functional redesign.
- New features.
Chosen Approach
- Reduced
MapPlayground.vueto a page-level composition shell. - Split rendering state and pipeline into
usePlaygroundRender.ts. - Kept page interaction state in
useMapPlayground.ts. - Extracted cache, summaries, default room demo generation, auto-render debounce, and map canvas lifecycle into focused utility modules.
- Extracted preview, tabs, input field, parsed panel, action bar, and editor dialog into standalone UI components.
Impacted Files Or Modules
docs/.vitepress/theme/components/MapPlayground.vuedocs/.vitepress/theme/components/simulator/SimulatorActionBar.vuedocs/.vitepress/theme/components/simulator/useMapPlayground.tsdocs/.vitepress/theme/components/simulator/SimulatorEditorDialog.vuedocs/.vitepress/theme/components/simulator/SimulatorInputField.vuedocs/.vitepress/theme/components/simulator/SimulatorParsedPanel.vuedocs/.vitepress/theme/components/simulator/SimulatorPreviewPanel.vuedocs/.vitepress/theme/components/simulator/SimulatorTabs.vuedocs/.vitepress/theme/components/simulator/cache.tsdocs/.vitepress/theme/components/simulator/constants.tsdocs/.vitepress/theme/components/simulator/defaultRoomProperties.tsdocs/.vitepress/theme/components/simulator/summaries.tsdocs/.vitepress/theme/components/simulator/types.tsdocs/.vitepress/theme/components/simulator/useAutoRender.tsdocs/.vitepress/theme/components/simulator/useMapCanvas.tsdocs/.vitepress/theme/components/simulator/usePlaygroundRender.ts
Verification Checklist
npm run lintpasses.npx tsc --noEmitpasses.npm run docs:buildpasses.