docs(editor): add run/build instructions and goView parity checklist

This commit is contained in:
clawdbot 2026-01-29 14:53:31 +08:00
parent 4a9134d91d
commit fe3d8dec98

View File

@ -1,73 +1,118 @@
# React + TypeScript + Vite
# AstralView Editor (goView-like)
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
A canvas-first BI dashboard *screen editor* (selection, multi-select transform, layers, context menu, inspector) built with React + Vite.
Currently, two official plugins are available:
This package is meant to be **directly runnable** as a product-ish demo.
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## A) Runnable dev demo
## React Compiler
### Prereqs
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
- Node.js (repo uses `pnpm@9.x`)
- `pnpm` enabled
## Expanding the ESLint configuration
### Install
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
From repo root:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```bash
pnpm install
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
### Run the editor (dev)
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```bash
pnpm -C packages/editor dev
```
Then open the URL printed by Vite (typically `http://localhost:5173`).
### Default screen size
New screens default to **1920×1080** (1080p). Import/export preserves `screen.width`/`screen.height`.
## B) Publishable build artifact
### Build
From repo root:
```bash
pnpm -C packages/editor build
```
Build output is written to:
- `packages/editor/dist/`
### Preview the built artifact locally
```bash
pnpm -C packages/editor preview
```
This serves the `dist/` folder via Vite preview (URL printed in terminal).
> Alternative: `npx serve packages/editor/dist`.
## C) goView-like UX acceptance checklist (current status)
Legend: ✅ done / 🟡 partial / ❌ missing
### Canvas / screen
- ✅ Default screen size is 1920×1080
- ✅ Export/import preserves screen size
- ✅ Pan + zoom (mouse wheel + drag)
- ✅ Bounds clamp for widget moves/resizes (keeps widgets inside screen)
### Selection
- ✅ Single select
- ✅ Multi-select (Shift)
- ✅ Box select (drag)
- ✅ Right-click selection parity (context menu works on targets)
### Transform
- ✅ Move selected
- ✅ Multi-select group bbox resize (scales selection)
- ✅ Min sizes enforced (no negative/degenerate)
### Layers
- ✅ Reorder layers (drag reorder)
- ✅ Lock / unlock
- ✅ Hide / show
### Context menu
- ✅ Copy / paste
- ✅ Z-order: bring to front / forward / backward / to back
- ✅ Align: left/center/right + top/middle/bottom
- ✅ Distribute: horizontal / vertical
### Hotkeys
- ✅ Delete
- ✅ Nudge (arrow keys)
- ✅ Duplicate
- ✅ Copy / paste
- ✅ Undo / redo
### Inspector
- ✅ Edit x/y/w/h (live)
- ✅ Media src (iframe/image/video) live update
### Demo content
- ✅ Minimal BI-like sample screen included on first load
---
If you are working on goView parity, keep the repo green:
```bash
pnpm -r lint && pnpm -r typecheck && pnpm -r build
```