Skip to content

Commit 0f585c2

Browse files
committed
refactor: reorder imports and optimize tree manipulation functions
1 parent 610a0d2 commit 0f585c2

File tree

5 files changed

+177
-132
lines changed

5 files changed

+177
-132
lines changed

QWEN.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The project follows the AGPL-3.0 license and is maintained by Jerry Bruwes.
1111
## Architecture and Implementation
1212

1313
The library transforms a JSON tree into a flat array while preserving the tree structure through computed properties added to each child object:
14+
1415
- `branch`: Array of objects representing the path from root to current node
1516
- `index`: Index of the object in the sibling array
1617
- `next`: Next object in the sibling array
@@ -23,35 +24,45 @@ The main implementation is in `src/index.ts` as a default export function that t
2324
## Building and Running
2425

2526
### Prerequisites
27+
2628
- Node.js and npm
2729

2830
### Build Process
31+
2932
To build the project:
33+
3034
```bash
3135
npm run build
3236
```
37+
3338
This command uses TypeScript compiler (tsc) to compile the source code.
3439

3540
### Linting
41+
3642
To lint the code:
43+
3744
```bash
3845
npm run lint
3946
```
4047

4148
### Development Setup
49+
4250
1. Clone the repository
4351
2. Run `npm install` to install dependencies
4452
3. Run `npm run build` to build the project
4553

4654
## Key Features and API
4755

4856
### Main Function
57+
4958
`useFlatJsonTree(tree, options?)` - The main composable function with the following return value:
59+
5060
- `nodes`: ComputedRef with the flat array of objects
5161
- `nodesMap`: ComputedRef with an object mapping unique IDs to objects
5262
- Manipulation functions: `add`, `addChild`, `remove`, `down`, `left`, `right`, `up`
5363

5464
### Manipulation Functions
65+
5566
- `add`: Add an empty object to the siblings
5667
- `addChild`: Add an empty object to the children
5768
- `remove`: Remove an object from the tree
@@ -63,16 +74,19 @@ npm run lint
6374
## Development Conventions
6475

6576
### Coding Style
77+
6678
- The project uses TypeScript with Vue 3 reactivity
6779
- Follows ESLint linting rules defined in `@vuebro/configs/eslint`
6880
- TypeScript configuration extends `@vuebro/configs/tsconfig`
6981
- Uses Prettier formatting with `@vuebro/configs/prettierrc` configuration
7082

7183
### File Structure
84+
7285
- `src/index.ts`: Main implementation file
7386
- `dist/`: Compiled output directory
7487
- Configuration files at root level (eslint.config.ts, tsconfig.json, etc.)
7588

7689
### Dependencies
90+
7791
- Vue 3 (reactivity system) as main dependency
78-
- Development dependencies include TypeScript, Node types, and VueBro configuration packages
92+
- Development dependencies include TypeScript, Node types, and VueBro configuration packages

eslint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import shared from "@vuebro/configs/eslint";
21
import { defineConfig } from "eslint/config";
2+
import shared from "@vuebro/configs/eslint";
33

44
export default defineConfig(shared, {
55
languageOptions: {

0 commit comments

Comments
 (0)