Compare commits
3 Commits
110f5dc92e
...
9aa28a9fa3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9aa28a9fa3 | ||
| 4733916523 | |||
|
|
eb3a23ab03 |
119
README.md
119
README.md
@@ -1,73 +1,70 @@
|
|||||||
# React + TypeScript + Vite
|
# ConceptSketch
|
||||||
|
|
||||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
An interactive concept map editor for creating and exploring hierarchical graph diagrams. Build knowledge structures visually by connecting nodes into nested subgraphs.
|
||||||
|
|
||||||
Currently, two official plugins are available:
|
## Features
|
||||||
|
|
||||||
- [@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
|
- **Interactive graph editing** — click nodes to create children, ctrl+click to multi-select, click edges to remove them
|
||||||
- [@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
|
- **Nested subgraphs** — convert any node into its own subgraph layer for infinite nesting
|
||||||
|
- **Breadcrumb navigation** — navigate through graph hierarchy with breadcrumb trail
|
||||||
|
- **Sidebar tree view** — see and navigate the full hierarchical structure at a glance
|
||||||
|
- **Rename nodes** — right-click any node to rename, create subgraphs, or remove
|
||||||
|
- **Orphaned nodes** — right-click empty canvas area to create standalone nodes
|
||||||
|
- **Save & load** — export/import your entire graph as a JSON file
|
||||||
|
|
||||||
## React Compiler
|
## Getting Started
|
||||||
|
|
||||||
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).
|
### Prerequisites
|
||||||
|
|
||||||
## Expanding the ESLint configuration
|
- Node.js (v18+)
|
||||||
|
- npm
|
||||||
|
|
||||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
### Installation
|
||||||
|
|
||||||
```js
|
```bash
|
||||||
export default defineConfig([
|
npm install
|
||||||
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...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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:
|
### Development
|
||||||
|
|
||||||
```js
|
```bash
|
||||||
// eslint.config.js
|
npm run dev
|
||||||
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...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Opens at `http://localhost:5173` with hot module replacement.
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx playwright test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
| Action | Result |
|
||||||
|
|---|---|
|
||||||
|
| Click a node | Create a new child node |
|
||||||
|
| Ctrl+click nodes, then click target | Link selected nodes as parents to target |
|
||||||
|
| Click an edge | Delete that edge |
|
||||||
|
| Right-click a node | Open context menu (Rename / Subgraph / Remove) |
|
||||||
|
| Right-click empty area | Create an orphaned (unconnected) node |
|
||||||
|
| Click sidebar tree item | Navigate to that subgraph |
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
- **React 19** + **TypeScript**
|
||||||
|
- **Vite** — build tool
|
||||||
|
- **Viz.js** (Graphviz) — graph rendering
|
||||||
|
- **D3** — SVG interactivity
|
||||||
|
- **Ant Design** — UI components
|
||||||
|
- **Zustand** — state management
|
||||||
|
|
||||||
|
## File Format
|
||||||
|
|
||||||
|
Graphs are saved as `concept-sketch.json`. The format supports nested subgraphs with recursive structure, preserving the full hierarchy.
|
||||||
|
|||||||
@@ -264,12 +264,7 @@ const Graph = forwardRef<GraphHandle, { setGraphPath: React.Dispatch<React.SetSt
|
|||||||
title: selectedNodeName,
|
title: selectedNodeName,
|
||||||
key: pathSegmentId,
|
key: pathSegmentId,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
const index = graphsPath.findIndex(p => p.key === pathSegmentId);
|
setGraphsPath(prev => prev.slice(0, prev.findIndex(p => p.key === pathSegmentId) + 1));
|
||||||
setGraphsPath(prev => {
|
|
||||||
prev.splice(index + 1);
|
|
||||||
|
|
||||||
return [...prev];
|
|
||||||
});
|
|
||||||
selectGraphId(pathSegmentId);
|
selectGraphId(pathSegmentId);
|
||||||
}
|
}
|
||||||
} as BreadcrumbItemType;
|
} as BreadcrumbItemType;
|
||||||
|
|||||||
Reference in New Issue
Block a user