Skip to content

Commit c3fdf10

Browse files
refactor!: Sync repository (#240)
* Fixes #235 * Fixes #235 * Fixes #235 fixes #235 fixes #234 fixes #231 fixes #230 fixes #225 fixes #193 fixes #140 fixes #50 * fixed unit tests * update package.json to reflect existing folder structure * chore(release): publish 0.2.0 * update workflow * Create deployment.yml * update workflow * chore: update build setup * chore(release): publish 0.3.0 * chore(release): publish 0.4.0 * chore(release): publish 0.5.0 * chore(release): publish 0.6.0 * chore: update esm&cjs builds * chore(release): publish 0.7.0 * chore(release): publish 0.8.0 * fix: update styles to be external, not inlined * chore(release): publish 0.9.0 * fix: add getRoot to MosaicWindow context * chore(release): publish 0.10.0 * chore: update tab styles * chore(release): publish 0.11.0 * chore: add split/remove toolbar actions for tabs * chore(release): publish 0.12.0 * chore(release): publish 0.13.0 * chore: update tab types * chore(release): publish 0.14.0 * chore: add possibility to close tab * chore(release): publish 0.15.0 * chore: use font icons instead of svg * chore(release): publish 0.16.0 * fix: do not render children with drag-drop * chore(release): publish 0.17.0 * chore(release): publish 0.18.0 * chore(release): publish 0.19.0 * chore(release): publish 0.20.0 * Add GitHub Actions workflow for Claude Code * update claude configuration * feat: implement automated changelog generation with lefthook Replace husky with lefthook for Git hooks management and implement comprehensive changelog automation using Conventional Commits. Changes: - Add lefthook.yml configuration for commit-msg validation - Add .commitlintrc.json with conventional commits rules - Update package.json with lefthook and commitlint dependencies - Add CONTRIBUTING.md with detailed contribution guidelines - Update README.md with commit message format requirements - Configure nx.json for automatic changelog generation with GitHub releases Co-authored-by: Lonli-Lokli <Lonli-Lokli@users.noreply.github.com> * chore(release): publish 0.21.0 * feat: update nx packages * feat: update package-lock.json for PR preview deployments (#9) * Add PR preview deployment workflow * chore: Remove uppercase restriction from commitlint configuration - Disabled subject-case rule in commitlintrc.json to allow any case - This allows commit subjects to start with lowercase or uppercase letters - Local validation via lefthook will now accept any letter case Co-authored-by: Lonli-Lokli <Lonli-Lokli@users.noreply.github.com> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Lonli-Lokli <Lonli-Lokli@users.noreply.github.com> * chore(release): publish 0.22.0 * chore(release): publish {version} * feat: update nx * chore(release): publish 0.24.0 * feat: code cleanup, restoring to original author * feat: update circleci workflow * fix: fixed the duplicate filters key in the publish job * fix: use exact version tags for circleci * docs: fix typo * feat: update workflow files to use NodeJS 22 * feat: restore github templates, removed obsolete workflow * feat: add beta indicator * feat: update github actions to the latest * fix: update workflow to trigger on release creation, not tag --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Lonli-Lokli <Lonli-Lokli@users.noreply.github.com>
1 parent 19d5ed4 commit c3fdf10

File tree

172 files changed

+37927
-9096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+37927
-9096
lines changed

.circleci/config.yml

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,76 @@
1-
version: 2
1+
version: 2.1
2+
3+
orbs:
4+
node: circleci/node@7.2.1
25

3-
references:
4-
js_deps_cache_key: &js_deps_cache_key v1-dependencies-{{ checksum "yarn.lock" }}
5-
workspace_root: &workspace_root .
6-
attach_workspace: &attach_workspace
7-
attach_workspace:
8-
at: *workspace_root
96
jobs:
107
build:
11-
docker:
12-
- image: circleci/node:gallium
13-
working_directory: ~/react-mosaic
8+
executor:
9+
name: node/default
10+
tag: '22.22.1'
11+
resource_class: large
1412
steps:
1513
- checkout
14+
- node/install-packages:
15+
pkg-manager: npm
16+
with-cache: true
1617
- run:
17-
name: Install Yarn
18-
command: |
19-
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.18
20-
export PATH="$HOME/.yarn/bin:$PATH"
21-
- restore_cache:
22-
keys:
23-
- *js_deps_cache_key
24-
- run: yarn install --frozen-lockfile
25-
- save_cache:
26-
paths:
27-
- node_modules
28-
- ~/.cache/yarn
29-
key: *js_deps_cache_key
30-
- run:
31-
name: Build
32-
command: yarn build
18+
name: Build library and demo app
19+
command: npm run build:lib && npm run build:app
3320
- persist_to_workspace:
34-
root: *workspace_root
21+
root: .
3522
paths:
36-
- .
23+
- dist
24+
- node_modules
25+
3726
test:
38-
docker:
39-
- image: circleci/node:dubnium
40-
working_directory: ~/react-mosaic
27+
executor:
28+
name: node/default
29+
tag: '22.22.1'
30+
resource_class: large
4131
steps:
42-
- *attach_workspace
43-
- run: mkdir reports
32+
- checkout
33+
- node/install-packages:
34+
pkg-manager: npm
35+
with-cache: true
4436
- run:
45-
name: Run unit tests
46-
command: yarn test:unit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml
37+
name: Run linting
38+
command: npm run lint
4739
- run:
48-
name: Lint
49-
command: yarn test:lint --format junit -o ./reports/tslint/tslint.xml
50-
- store_test_results:
51-
path: reports
52-
- store_artifacts:
53-
path: ./reports/mocha/test-results.xml
54-
- store_artifacts:
55-
path: ./reports/tslint/tslint.xml
56-
deploy:
57-
docker:
58-
- image: circleci/node:dubnium
59-
working_directory: ~/react-mosaic
40+
name: Run tests
41+
command: npm test
42+
43+
publish:
44+
executor:
45+
name: node/default
46+
tag: '22.22.1'
47+
resource_class: medium
6048
steps:
61-
- *attach_workspace
49+
- checkout
50+
- attach_workspace:
51+
at: .
6252
- run:
63-
name: Publish
64-
command: |
65-
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
66-
npm publish
53+
name: Authenticate with NPM registry
54+
command: npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
55+
- run:
56+
name: Publish to NPM
57+
command: npm publish dist/libs/react-mosaic-component/
58+
6759
workflows:
68-
version: 2
69-
build-test-deploy:
60+
version: 2.1
61+
build-test-publish:
7062
jobs:
7163
- build:
7264
filters:
7365
tags:
7466
only: /^v.*/
7567
- test:
76-
requires:
77-
- build
7868
filters:
7969
tags:
8070
only: /^v.*/
81-
- deploy:
71+
- publish:
8272
requires:
73+
- build
8374
- test
8475
filters:
8576
tags:

.claude/README.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Claude Code Integration for React Mosaic
2+
3+
This directory contains all the files for optimal Claude Code and LLM integration with the React Mosaic project.
4+
5+
## Directory Contents
6+
7+
### Configuration Files
8+
- **`settings.json`**: Claude Code project settings and preferences
9+
- **`.claudeignore`** (in root): Files/directories to exclude from LLM context
10+
11+
### Documentation
12+
- **`../claude.md`**: Comprehensive project documentation for LLMs (in root)
13+
- **`../CONTRIBUTING_AI.md`**: AI/LLM-specific contribution guidelines (in root)
14+
- **`../QUICKREF.md`**: Quick reference guide for common operations (in root)
15+
16+
### Slash Commands (`commands/`)
17+
Quick commands for common development tasks:
18+
19+
- `/test` - Run tests and report failures
20+
- `/build` - Build the library
21+
- `/lint` - Run linting checks
22+
- `/type-check` - Run TypeScript type checking
23+
- `/analyze-tree` - Analyze tree manipulation utilities
24+
- `/review-component` - Review a specific component
25+
- `/explain-concept` - Explain core React Mosaic concepts
26+
- `/add-feature` - Plan and implement a new feature
27+
- `/fix-issue` - Debug and fix an issue
28+
- `/refactor` - Refactor code for better quality
29+
- `/update-deps` - Check for outdated dependencies
30+
31+
### Prompt Templates (`prompts/`)
32+
Reusable templates for common scenarios:
33+
34+
- **`tree-analysis.md`**: Template for analyzing tree structures
35+
- **`code-review.md`**: Template for reviewing code
36+
- **`feature-planning.md`**: Template for planning new features
37+
- **`debugging.md`**: Template for debugging issues
38+
39+
## Quick Start for AI Assistants
40+
41+
1. **Read `claude.md` first** - This provides comprehensive context about the project
42+
2. **Check `QUICKREF.md`** - Quick reference for common operations
43+
3. **Review `.claudeignore`** - Know what files to skip
44+
4. **Use slash commands** - Quick access to common tasks
45+
5. **Follow patterns in `CONTRIBUTING_AI.md`** - Guidelines for code contributions
46+
47+
## Project Structure Overview
48+
49+
```
50+
react-mosaic/
51+
├── .claude/ # Claude Code integration files
52+
│ ├── commands/ # Slash commands
53+
│ ├── prompts/ # Prompt templates
54+
│ ├── settings.json # Project settings
55+
│ └── README.md # This file
56+
├── libs/react-mosaic-component/ # Main library [PRIMARY FOCUS]
57+
│ └── src/lib/ # Source code
58+
│ ├── types.ts # Type definitions
59+
│ ├── contextTypes.ts # Context types
60+
│ └── util/ # Utility functions
61+
├── apps/demo-app/ # Demo application
62+
├── claude.md # LLM integration guide
63+
├── CONTRIBUTING_AI.md # AI contribution guidelines
64+
├── QUICKREF.md # Quick reference
65+
├── .claudeignore # Files to ignore
66+
└── README.md # User documentation
67+
```
68+
69+
## Key Concepts
70+
71+
React Mosaic is a tiling window manager built on:
72+
73+
1. **N-ary Tree Structure**: Layout represented as a tree with split nodes, tab nodes, and leaf nodes
74+
2. **Numeric Paths**: Nodes identified by array of indices (e.g., `[0, 1, 2]`)
75+
3. **Immutable Updates**: Tree modifications always create new instances
76+
4. **React Context**: Components communicate via context API
77+
5. **Drag & Drop**: Built on react-dnd with multi-backend support
78+
79+
## Development Workflow
80+
81+
```bash
82+
# Setup
83+
npm install
84+
85+
# Development
86+
npm start # Start dev server
87+
npm test # Run tests
88+
npm run build:lib # Build library
89+
90+
# Code Quality
91+
npm run lint # Lint code
92+
npm run format # Format code
93+
```
94+
95+
## Important Files
96+
97+
| File | Description |
98+
|------|-------------|
99+
| `libs/react-mosaic-component/src/index.ts` | Public API exports |
100+
| `libs/react-mosaic-component/src/lib/types.ts` | Type definitions |
101+
| `libs/react-mosaic-component/src/lib/util/mosaicUtilities.ts` | Tree operations |
102+
| `libs/react-mosaic-component/src/lib/util/mosaicUpdates.ts` | Tree mutations |
103+
104+
## Using Slash Commands
105+
106+
Slash commands provide quick access to common tasks:
107+
108+
```
109+
/test # Run the test suite
110+
/build # Build the library
111+
/explain-concept # Learn about a core concept
112+
/add-feature # Plan and add a new feature
113+
```
114+
115+
## Using Prompt Templates
116+
117+
Prompt templates help maintain consistency:
118+
119+
1. Navigate to `.claude/prompts/`
120+
2. Choose appropriate template
121+
3. Follow the structure provided
122+
4. Adapt to your specific need
123+
124+
## Best Practices for AI
125+
126+
1. **Always read files before modifying** - Use Read tool first
127+
2. **Use utility functions** - Don't manually manipulate trees
128+
3. **Follow existing patterns** - Match code style and conventions
129+
4. **Write tests** - Add tests for new functionality
130+
5. **Check types** - Ensure TypeScript compilation passes
131+
6. **Use type guards** - Use `isSplitNode()` and `isTabsNode()`
132+
7. **Validate paths** - Check paths before tree operations
133+
8. **Handle edge cases** - Test with empty, single, and nested trees
134+
135+
## Common Patterns
136+
137+
### Tree Manipulation
138+
```typescript
139+
import { updateTree, createRemoveUpdate } from 'react-mosaic-component';
140+
141+
const newTree = updateTree(currentTree, [
142+
createRemoveUpdate(path)
143+
]);
144+
```
145+
146+
### Type Checking
147+
```typescript
148+
import { isSplitNode, isTabsNode } from 'react-mosaic-component';
149+
150+
if (isSplitNode(node)) {
151+
// node is MosaicSplitNode<T>
152+
}
153+
```
154+
155+
### Context Access
156+
```typescript
157+
import { useContext } from 'react';
158+
import { MosaicContext } from 'react-mosaic-component';
159+
160+
const { mosaicActions } = useContext(MosaicContext);
161+
mosaicActions.remove(path);
162+
```
163+
164+
## Resources
165+
166+
- **Project Documentation**: `../claude.md`
167+
- **Quick Reference**: `../QUICKREF.md`
168+
- **AI Guidelines**: `../CONTRIBUTING_AI.md`
169+
- **User Documentation**: `../README.md`
170+
- **Live Demo**: https://nomcopter.github.io/react-mosaic/
171+
- **GitHub**: https://github.com/nomcopter/react-mosaic
172+
173+
## Contributing
174+
175+
See `CONTRIBUTING_AI.md` for detailed guidelines on:
176+
- Code style and conventions
177+
- Testing requirements
178+
- Common patterns
179+
- Debugging strategies
180+
- Performance considerations
181+
182+
## Support
183+
184+
For issues or questions:
185+
- Check `claude.md` for comprehensive information
186+
- Use `/explain-concept` to understand core concepts
187+
- Review existing code for patterns
188+
- Ask specific questions about the codebase
189+
190+
## Version
191+
192+
This integration is designed for React Mosaic v0.20.0.
193+
194+
Last updated: 2025-12-04

.claude/commands/add-feature.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: Plan and implement a new feature
3+
---
4+
5+
I'll help you plan and implement a new feature for react-mosaic.
6+
7+
First, describe the feature you want to add. I will then:
8+
9+
1. Analyze the existing codebase to understand relevant patterns
10+
2. Create a detailed implementation plan
11+
3. Identify files that need to be modified or created
12+
4. Implement the feature following existing code conventions
13+
5. Add appropriate tests
14+
6. Update documentation if needed
15+
16+
What feature would you like to add?

.claude/commands/analyze-tree.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
description: Analyze the MosaicNode tree structure utilities
3+
---
4+
5+
Analyze the tree manipulation utilities in the codebase, specifically:
6+
7+
1. Read and explain the tree utilities in `libs/react-mosaic-component/src/lib/util/mosaicUtilities.ts`
8+
2. Read and explain the tree update functions in `libs/react-mosaic-component/src/lib/util/mosaicUpdates.ts`
9+
3. Provide examples of how to use these utilities for common operations
10+
4. Identify any potential improvements or edge cases to handle

.claude/commands/build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
description: Build the react-mosaic library
3+
---
4+
5+
Build the react-mosaic library using `npm run build:lib`. Report any build errors or warnings and suggest fixes if needed.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: Explain a core concept of react-mosaic
3+
---
4+
5+
Explain a core concept of the react-mosaic library. I can explain:
6+
7+
1. **Tree Structure**: How the n-ary tree layout works
8+
2. **Path System**: How paths identify nodes in the tree
9+
3. **Drag & Drop**: How the drag-and-drop system is implemented
10+
4. **Split Nodes**: How split containers divide space
11+
5. **Tab Nodes**: How tabbed interfaces work
12+
6. **Context API**: How components communicate via React context
13+
7. **Tree Updates**: How immutable tree updates work
14+
8. **Migration**: How legacy binary trees are converted to n-ary
15+
16+
Which concept would you like me to explain?

.claude/commands/fix-issue.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: Debug and fix an issue in the codebase
3+
---
4+
5+
I'll help you debug and fix an issue in the react-mosaic codebase.
6+
7+
Describe the issue you're experiencing, including:
8+
- What behavior you're seeing
9+
- What behavior you expected
10+
- Steps to reproduce (if applicable)
11+
- Error messages (if any)
12+
13+
I will then:
14+
15+
1. Investigate the relevant code
16+
2. Identify the root cause
17+
3. Propose a solution
18+
4. Implement the fix
19+
5. Add tests to prevent regression

0 commit comments

Comments
 (0)