Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e9480548e | ||
|
|
1dd4257a7d | ||
|
|
83c1947c9b | ||
|
|
a91cfd2a02 | ||
|
|
70169dd344 | ||
|
|
27892fa3a5 | ||
|
|
53edbaa1f1 | ||
|
|
c61bb12af5 | ||
|
|
b0d217f25a | ||
|
|
2888b01696 | ||
|
|
69cfdf1760 | ||
|
|
421c6d86bf | ||
|
|
ec32b6b3f2 | ||
|
|
d6badb8f3c | ||
|
|
406e335784 | ||
|
|
f518f3cdee | ||
|
|
f536c54d56 | ||
|
|
c161f9b28e | ||
|
|
b50bec70fb | ||
|
|
50866cc78f | ||
|
|
cabf14249b | ||
|
|
e64d5d06fe | ||
|
|
0b13066168 | ||
|
|
a9ca4ba5e7 | ||
|
|
6fc2fda97a | ||
|
|
70a8782935 | ||
|
|
966974b2ad | ||
|
|
7abd3a043d | ||
|
|
a3848d9bf2 | ||
|
|
c48b4a2c14 | ||
|
|
9119b18039 | ||
|
|
f0c8acb5e2 | ||
|
|
b229280dfb | ||
|
|
9e16f81f1e | ||
|
|
2b87691f18 | ||
|
|
9157e02ec6 | ||
|
|
04c248f773 | ||
|
|
284a05bf27 | ||
|
|
9b1cf5a739 | ||
|
|
f62cbe2ba5 | ||
|
|
5c2755af78 | ||
|
|
c53cb9778e | ||
|
|
93bcc496af | ||
|
|
b6e5622a04 | ||
|
|
6af9fab92a | ||
|
|
739fcbe44f | ||
|
|
cbf0c2a6ef | ||
|
|
ca377c6137 | ||
|
|
d9aa826573 | ||
|
|
03d6e6c208 | ||
|
|
abc68238ad | ||
|
|
79eacfddfd | ||
|
|
b319364262 | ||
|
|
23d1cb40b5 | ||
|
|
a51eaa5cc5 | ||
|
|
fee99dfd20 | ||
|
|
234b72c12d | ||
|
|
5fadbd1e69 | ||
|
|
bf1209e932 | ||
|
|
f77700d32d | ||
|
|
c1054bf087 | ||
|
|
838d8a6278 | ||
|
|
76fc06eac3 | ||
|
|
42afd59cb9 | ||
|
|
80dc47e92a | ||
|
|
74e8a68890 | ||
|
|
fe9ed309fb | ||
|
|
d3f49d98d2 | ||
|
|
53b5d2def4 | ||
|
|
8bc9457a5c | ||
|
|
13aa314b24 | ||
|
|
7cef132b16 | ||
|
|
8bdf1d0f0c | ||
|
|
a84e524a7a | ||
|
|
622c163aea | ||
|
|
00a4bf74e7 | ||
|
|
b5abe9dfbd | ||
|
|
76be97d7bc | ||
|
|
14d5509ef1 | ||
|
|
6528649fe8 | ||
|
|
868482e8ae | ||
|
|
c0e68efb79 | ||
|
|
88fdfaa2e6 | ||
|
|
bcc5d358e5 | ||
|
|
4a081819dd | ||
|
|
dfba804282 | ||
|
|
486b6e2d42 | ||
|
|
3e9e53aaa3 | ||
|
|
7fa0ea01cc | ||
|
|
7d51ae6b3c | ||
|
|
94f39804e2 | ||
|
|
5c83da7dae | ||
|
|
37f95ffcf9 | ||
|
|
97fe57b281 | ||
|
|
89eeb8bee1 | ||
|
|
e77f08ee41 | ||
|
|
fab8a54e1e | ||
|
|
a201b7db4f | ||
|
|
243186dc44 | ||
|
|
39c35cf448 | ||
|
|
8e4f441734 | ||
|
|
2459c209ed | ||
|
|
7f1340606f | ||
|
|
69fb9cfd41 | ||
|
|
872325ce4d | ||
|
|
ed999ce89a | ||
|
|
eb7f21d2dc | ||
|
|
d46d226722 | ||
|
|
4944f1e034 | ||
|
|
3e2ff3d4e0 | ||
|
|
4cc7dd4bcc | ||
|
|
ba68995a85 | ||
|
|
2fc3281fe8 | ||
|
|
9db68f68cf | ||
|
|
4540b8fdb5 | ||
|
|
93694e5506 | ||
|
|
ab1dc498f3 | ||
|
|
5a8d302a05 | ||
|
|
9c0a227de6 | ||
|
|
b419e7e9a0 | ||
|
|
f49b77a663 | ||
|
|
3a28257a00 | ||
|
|
60452d08d0 | ||
|
|
399a593a7f | ||
|
|
2366c16cbd | ||
|
|
2c895fa69c | ||
|
|
26499a107d | ||
|
|
7ff154498e | ||
|
|
c658889710 | ||
|
|
235ea1c3eb | ||
|
|
bbd732f084 | ||
|
|
5e9aae9d37 | ||
|
|
e15fd9956e | ||
|
|
90057de1cf | ||
|
|
85b8b91c1e | ||
|
|
90bbcbee85 | ||
|
|
b173966d8b | ||
|
|
279178a0f7 | ||
|
|
7e684040b1 | ||
|
|
f05fd429c0 | ||
|
|
1e7da05905 | ||
|
|
ba26f1935c | ||
|
|
1fe492da02 | ||
|
|
91c80d126f | ||
|
|
a07b68c0ee | ||
|
|
0cdbcdd450 | ||
|
|
55b91f4b5f | ||
|
|
ce2df116f8 | ||
|
|
2d6a74669e | ||
|
|
45c927a2eb | ||
|
|
cf2c7bf832 | ||
|
|
b35c09c0b1 | ||
|
|
ee9a3480c5 | ||
|
|
c03e5639b4 | ||
|
|
9da86fc98a | ||
|
|
b6fcdcc06a | ||
|
|
662a75bb26 | ||
|
|
e8e004f571 | ||
|
|
5bac9937d0 | ||
|
|
db5d29c6e2 | ||
|
|
6cfe471e79 | ||
|
|
5661dceabd | ||
|
|
a029a4e88b | ||
|
|
7bb496a46c | ||
|
|
932bc5f106 | ||
|
|
1e5218288b | ||
|
|
2059bff5d5 | ||
|
|
7cc17f9244 | ||
|
|
430dd47267 | ||
|
|
191025ae7c | ||
|
|
33840263e6 | ||
|
|
4b49fe9092 | ||
|
|
9e59e5f0bd |
@@ -85,6 +85,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build UI package
|
||||
run: cd pkg/ui && pnpm run build
|
||||
|
||||
- name: Run type checking
|
||||
run: |
|
||||
cd app && pnpm run typecheck
|
||||
|
||||
@@ -4,6 +4,12 @@ on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
capture_screenshots:
|
||||
description: 'Capture component screenshots (slow, optional)'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -17,6 +23,7 @@ concurrency:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -48,6 +55,16 @@ jobs:
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build @hanzo/ui package
|
||||
run: |
|
||||
cd pkg/ui && pnpm build
|
||||
|
||||
- name: Capture screenshots (optional)
|
||||
if: github.event.inputs.capture_screenshots == 'true'
|
||||
working-directory: ./app
|
||||
run: pnpm capture:registry
|
||||
timeout-minutes: 5
|
||||
|
||||
- name: Build documentation
|
||||
working-directory: ./app
|
||||
run: |
|
||||
@@ -57,6 +74,7 @@ jobs:
|
||||
NODE_ENV: production
|
||||
GITHUB_ACTIONS: true
|
||||
NEXT_PUBLIC_APP_URL: https://ui.hanzo.ai
|
||||
SKIP_SCREENSHOTS: true
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v4
|
||||
|
||||
@@ -12,6 +12,8 @@ on:
|
||||
- ui-mcp
|
||||
- auth
|
||||
- commerce
|
||||
- brand
|
||||
- react
|
||||
- all
|
||||
version_bump:
|
||||
description: 'Version bump type'
|
||||
@@ -45,7 +47,24 @@ jobs:
|
||||
- name: Build packages
|
||||
run: |
|
||||
if [ "${{ github.event.inputs.package }}" = "all" ] || [ "${{ github.event.inputs.package }}" = "ui" ]; then
|
||||
cd pkg/ui && npm run build || true
|
||||
cd pkg/ui && pnpm build
|
||||
cd ../..
|
||||
fi
|
||||
if [ "${{ github.event.inputs.package }}" = "all" ] || [ "${{ github.event.inputs.package }}" = "auth" ]; then
|
||||
cd pkg/auth && pnpm build
|
||||
cd ../..
|
||||
fi
|
||||
if [ "${{ github.event.inputs.package }}" = "all" ] || [ "${{ github.event.inputs.package }}" = "commerce" ]; then
|
||||
cd pkg/commerce && pnpm build
|
||||
cd ../..
|
||||
fi
|
||||
if [ "${{ github.event.inputs.package }}" = "all" ] || [ "${{ github.event.inputs.package }}" = "brand" ]; then
|
||||
cd pkg/brand && pnpm build
|
||||
cd ../..
|
||||
fi
|
||||
if [ "${{ github.event.inputs.package }}" = "all" ] || [ "${{ github.event.inputs.package }}" = "react" ]; then
|
||||
cd pkg/react && pnpm build
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
- name: Bump version and publish
|
||||
@@ -75,11 +94,19 @@ jobs:
|
||||
commerce)
|
||||
publish_package "pkg/commerce"
|
||||
;;
|
||||
brand)
|
||||
publish_package "pkg/brand"
|
||||
;;
|
||||
react)
|
||||
publish_package "pkg/react"
|
||||
;;
|
||||
all)
|
||||
publish_package "pkg/ui"
|
||||
publish_package "pkg/ui-mcp"
|
||||
publish_package "pkg/auth"
|
||||
publish_package "pkg/commerce"
|
||||
publish_package "pkg/brand"
|
||||
publish_package "pkg/react"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
name: Publish on Tag
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Match @hanzo/ui version (e.g., v5.1.1)
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build packages
|
||||
run: |
|
||||
cd pkg/ui && pnpm build && cd ../..
|
||||
cd pkg/auth && pnpm build && cd ../..
|
||||
cd pkg/commerce && pnpm build && cd ../..
|
||||
cd pkg/brand && pnpm build && cd ../..
|
||||
cd pkg/react && pnpm build && cd ../..
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd pkg/ui && pnpm test
|
||||
cd ../react && pnpm test
|
||||
cd ../..
|
||||
|
||||
publish:
|
||||
name: Publish to NPM
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'pnpm'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build all packages
|
||||
run: |
|
||||
cd pkg/ui && pnpm build && cd ../..
|
||||
cd pkg/auth && pnpm build && cd ../..
|
||||
cd pkg/commerce && pnpm build && cd ../..
|
||||
cd pkg/brand && pnpm build && cd ../..
|
||||
cd pkg/react && pnpm build && cd ../..
|
||||
|
||||
- name: Configure npm authentication
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
||||
run: |
|
||||
npm config set //registry.npmjs.org/:_authToken $NODE_AUTH_TOKEN
|
||||
npm whoami
|
||||
|
||||
- name: Check and publish packages
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
||||
run: |
|
||||
echo "Checking all packages for unpublished versions..."
|
||||
|
||||
PUBLISHED_COUNT=0
|
||||
SKIPPED_COUNT=0
|
||||
PUBLISHED_PACKAGES=""
|
||||
|
||||
for package in ui auth commerce brand react; do
|
||||
cd "pkg/$package"
|
||||
|
||||
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
||||
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "📦 Checking $PACKAGE_NAME@$CURRENT_VERSION"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Check if this version already exists on npm
|
||||
if npm view "$PACKAGE_NAME@$CURRENT_VERSION" version 2>/dev/null; then
|
||||
echo "⏭️ Already published - skipping"
|
||||
SKIPPED_COUNT=$((SKIPPED_COUNT + 1))
|
||||
else
|
||||
echo "🚀 Publishing to npm..."
|
||||
npm publish --access public
|
||||
echo "✅ Successfully published $PACKAGE_NAME@$CURRENT_VERSION"
|
||||
PUBLISHED_COUNT=$((PUBLISHED_COUNT + 1))
|
||||
PUBLISHED_PACKAGES="$PUBLISHED_PACKAGES\n- $PACKAGE_NAME@$CURRENT_VERSION"
|
||||
fi
|
||||
|
||||
cd ../..
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "📊 Publishing Summary"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "✅ Published: $PUBLISHED_COUNT package(s)"
|
||||
echo "⏭️ Skipped: $SKIPPED_COUNT package(s)"
|
||||
|
||||
if [ $PUBLISHED_COUNT -gt 0 ]; then
|
||||
echo ""
|
||||
echo -e "Published packages:$PUBLISHED_PACKAGES"
|
||||
fi
|
||||
|
||||
# Save for GitHub release notes
|
||||
echo "PUBLISHED_COUNT=$PUBLISHED_COUNT" >> $GITHUB_ENV
|
||||
echo "PUBLISHED_PACKAGES<<EOF" >> $GITHUB_ENV
|
||||
echo -e "$PUBLISHED_PACKAGES" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: ${{ env.PUBLISHED_COUNT > 0 }}
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
generate_release_notes: true
|
||||
body: |
|
||||
## 📦 NPM Packages Published
|
||||
|
||||
${{ env.PUBLISHED_PACKAGES }}
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Install latest versions
|
||||
npm install @hanzo/ui @hanzo/auth @hanzo/commerce @hanzo/brand @hanzo/react
|
||||
```
|
||||
files: |
|
||||
CHANGELOG.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -54,5 +54,5 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
path: tests/reports/playwright-report/
|
||||
retention-days: 30
|
||||
|
||||
@@ -47,12 +47,28 @@ package-lock.json
|
||||
# pnpm-lock.yaml - needed for CI/CD, do not ignore
|
||||
yarn.lock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# AI cruft
|
||||
AGENTS.md
|
||||
CLAUDE.md
|
||||
GEMINI.md
|
||||
GROK.md
|
||||
QWEN.md
|
||||
|
||||
.playwright-mcp
|
||||
app/out
|
||||
app/.source
|
||||
|
||||
# test artifacts
|
||||
tests/reports/
|
||||
tests/artifacts/
|
||||
|
||||
# Note: Block screenshots are pre-generated and committed
|
||||
# They cannot be generated in CI (requires display/browser)
|
||||
# app/public/r/styles/*/ -- REMOVED to allow committing screenshots
|
||||
|
||||
|
||||
# Test artifacts
|
||||
test-results/
|
||||
playwright-report/
|
||||
*BADGE_INSPECTION*.md
|
||||
*BADGE_INSPECTION*.txt
|
||||
|
||||
|
Before Width: | Height: | Size: 247 KiB |
|
Before Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 248 KiB |
|
Before Width: | Height: | Size: 248 KiB |
|
Before Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 520 KiB |
|
Before Width: | Height: | Size: 414 KiB |
|
Before Width: | Height: | Size: 412 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 351 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 427 KiB |
|
Before Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 413 KiB |
|
Before Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 247 KiB |
|
Before Width: | Height: | Size: 523 KiB |
|
Before Width: | Height: | Size: 701 KiB |
|
Before Width: | Height: | Size: 247 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 410 KiB |
|
Before Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 689 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 317 KiB |
|
Before Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 511 KiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 511 KiB |
|
Before Width: | Height: | Size: 331 KiB |
|
Before Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 229 KiB |
|
Before Width: | Height: | Size: 900 KiB |
|
Before Width: | Height: | Size: 428 KiB |
|
Before Width: | Height: | Size: 248 KiB |
|
Before Width: | Height: | Size: 231 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 425 KiB |
|
Before Width: | Height: | Size: 643 KiB |
|
Before Width: | Height: | Size: 225 KiB |
|
Before Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 372 KiB |
|
Before Width: | Height: | Size: 308 KiB |
|
Before Width: | Height: | Size: 282 KiB |
|
Before Width: | Height: | Size: 190 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 248 KiB |
|
Before Width: | Height: | Size: 282 KiB |
|
Before Width: | Height: | Size: 351 KiB |
|
Before Width: | Height: | Size: 308 KiB |
|
Before Width: | Height: | Size: 308 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 169 KiB |
|
Before Width: | Height: | Size: 340 KiB |
|
Before Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 427 KiB |
|
Before Width: | Height: | Size: 288 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 402 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 282 KiB |
|
Before Width: | Height: | Size: 332 KiB |
@@ -0,0 +1,129 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to the Hanzo UI component library will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Slot support for Badge component with `asChild` prop for composition flexibility
|
||||
- Modern focus-visible states for Badge component with ring styling
|
||||
- SVG icon support in Badge component with automatic sizing
|
||||
- Aria-invalid states for Badge form validation
|
||||
- Data-slot attributes for better styling hooks
|
||||
|
||||
### Changed
|
||||
- **THEME**: Restored electric blue primary color (`oklch(0.653 0.269 252.44)`) as default
|
||||
- **THEME**: Updated to use shadcn/ui's neutral gray color scheme for backgrounds and text
|
||||
- **THEME**: Maintained configurable theme system via theme generator
|
||||
- Badge component now uses `<span>` instead of `<div>` for better semantics
|
||||
- Badge font weight changed from `font-semibold` to `font-medium`
|
||||
- Badge padding adjusted from `px-2.5` to `px-2`
|
||||
- Badge hover states now only apply within anchor tags (`[a&]:hover`)
|
||||
- Updated both default (rounded-full) and new-york (rounded-md) badge variants
|
||||
- **Button component updated to shadcn/ui v4 patterns**:
|
||||
- Changed focus ring from `ring-2` to `ring-[3px]` with 50% opacity
|
||||
- Added SVG icon support with `[&_svg]:size-4` default sizing
|
||||
- Added `has-[>svg]:px-*` conditional padding when button contains icons
|
||||
- Added new icon size variants: `icon-sm` (size-8) and `icon-lg` (size-10)
|
||||
- Changed from `forwardRef` to regular function component
|
||||
- Added `data-slot="button"` attribute
|
||||
- Improved accessibility with `aria-invalid` states
|
||||
- Enhanced dark mode support for destructive, outline, and ghost variants
|
||||
- **Input component updated to shadcn/ui v4 patterns**:
|
||||
- Changed height from `h-10` to `h-9` (consistent with Button)
|
||||
- Changed from `forwardRef` to regular function component
|
||||
- Added `data-slot="input"` attribute
|
||||
- Changed background to transparent with `dark:bg-input/30` dark mode variant
|
||||
- Added responsive text sizing: `text-base md:text-sm`
|
||||
- Added `min-w-0` to prevent flex overflow issues
|
||||
- Enhanced file input styling with `file:inline-flex file:h-7`
|
||||
- Added selection highlighting: `selection:bg-primary selection:text-primary-foreground`
|
||||
- Changed focus ring from `ring-2` to `ring-[3px]` with 50% opacity
|
||||
- Added `aria-invalid` states for form validation
|
||||
- Changed transition to `transition-[color,box-shadow]` for smoother animations
|
||||
|
||||
### Fixed
|
||||
- Badge component styling now matches shadcn/ui v4 implementation
|
||||
- Improved accessibility with proper focus-visible states
|
||||
- Better form integration with aria-invalid support
|
||||
- **Security**: Fixed 31 of 32 vulnerabilities (96.9% reduction):
|
||||
- Upgraded happy-dom from 19.0.2 to 20.0.10 (fixes 2 critical RCE vulnerabilities)
|
||||
- Upgraded vite from 5.4.20 to 7.1.12 (fixes moderate vulnerability)
|
||||
- Applied 21 package overrides for next, axios, undici, prismjs, and other dependencies
|
||||
- All critical (5), all but 1 high (3/4), all moderate (19), and all low (5) vulnerabilities resolved
|
||||
- Remaining: 1 high severity in lodash.template (no patch available, abandoned package)
|
||||
|
||||
### Removed
|
||||
- Removed hanzo-compatibility documentation page (redundant with main docs)
|
||||
|
||||
## [5.0.0] - 2025-10-18
|
||||
|
||||
### Added
|
||||
- Next.js 16.0.0 with Turbopack support
|
||||
- React 19.2.0 support
|
||||
- 150+ components in registry
|
||||
- AI-specific components (ai-chat, ai-playground, ai-assistant, ai-vision, etc.)
|
||||
- 3D components (3d-button, 3d-card, 3d-carousel, 3d-grid, etc.)
|
||||
- Animation components (animated-beam, animated-text, animated-cursor, etc.)
|
||||
- Page builder with drag-drop functionality
|
||||
- White-label system for Zoo UI and Lux UI forks
|
||||
- External registry support (35+ sources)
|
||||
- 24+ full-page block templates
|
||||
|
||||
### Changed
|
||||
- Migrated from Contentlayer to Fumadocs for MDX processing
|
||||
- Updated documentation structure
|
||||
- Improved build process with registry-first approach
|
||||
|
||||
### Technical
|
||||
- Tailwind CSS v4.1.14
|
||||
- TypeScript 5.9.3
|
||||
- pnpm 9.0.6+ workspace support
|
||||
- Turborepo build system
|
||||
|
||||
---
|
||||
|
||||
## Version Comparison
|
||||
|
||||
**Hanzo UI vs shadcn/ui:**
|
||||
- **161 components** vs shadcn's 58 components (3x more)
|
||||
- **Unique to Hanzo UI**: AI components (12), 3D components (9), Animation components (13), specialized navigation variants (15+)
|
||||
- **100% compatible** with shadcn/ui CLI and registry system
|
||||
- **Multi-framework support**: React (100%), Vue (~90%), Svelte (~85%), React Native (~70%)
|
||||
|
||||
## Component Status
|
||||
|
||||
- **Implemented**: ~127 fully functional components
|
||||
- **Stub Components**: ~34 need implementation
|
||||
- **Blocks**: 24+ viewport-sized templates
|
||||
- **AI Components**: 12 specialized AI/ML components
|
||||
- **3D Components**: 9 three-dimensional UI elements
|
||||
- **Animation Components**: 13 motion and transition components
|
||||
|
||||
## Migration Notes
|
||||
|
||||
### From shadcn/ui
|
||||
Hanzo UI is a drop-in replacement for shadcn/ui with additional components:
|
||||
```bash
|
||||
# Instead of
|
||||
npx shadcn-ui@latest add button
|
||||
|
||||
# Use
|
||||
npx @hanzo/ui@latest add button
|
||||
```
|
||||
|
||||
All shadcn/ui components work identically in Hanzo UI, plus you get access to 100+ additional components.
|
||||
|
||||
## Links
|
||||
|
||||
- **Website**: https://ui.hanzo.ai
|
||||
- **Documentation**: https://ui.hanzo.ai/docs
|
||||
- **GitHub**: https://github.com/hanzoai/ui
|
||||
- **npm Package**: https://www.npmjs.com/package/@hanzo/ui
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see [LICENSE](LICENSE) for details
|
||||
@@ -0,0 +1,174 @@
|
||||
# NPM Publishing Guide - React 19 Packages
|
||||
|
||||
## Current Package Versions
|
||||
|
||||
All packages updated to support **React 19.2.0**:
|
||||
|
||||
- `@hanzo/ui` - v5.1.1
|
||||
- `@hanzo/auth` - Latest
|
||||
- `@hanzo/commerce` - Latest
|
||||
- `@hanzo/brand` - Latest
|
||||
- `@hanzo/react` - v1.0.0
|
||||
|
||||
## Publishing Methods
|
||||
|
||||
### 1. Automatic Publishing (Tag-based)
|
||||
|
||||
When you push a git tag starting with `v` (typically matching @hanzo/ui version), the workflow automatically checks all packages and publishes any with new versions:
|
||||
|
||||
```bash
|
||||
# Tag with @hanzo/ui version (workflow checks all packages)
|
||||
git tag v5.1.1
|
||||
git push origin v5.1.1
|
||||
```
|
||||
|
||||
**What happens:**
|
||||
1. Tests run (pkg/ui and pkg/react)
|
||||
2. All 5 packages build
|
||||
3. **Automatic version detection:**
|
||||
- Checks each package's current version in package.json
|
||||
- Queries npm to see if that version already exists
|
||||
- Only publishes packages with new versions not on npm
|
||||
4. GitHub release created (only if packages were published)
|
||||
|
||||
**Example workflow output:**
|
||||
```
|
||||
📦 Checking @hanzo/ui@5.1.1
|
||||
⏭️ Already published - skipping
|
||||
|
||||
📦 Checking @hanzo/auth@2.5.5
|
||||
🚀 Publishing to npm...
|
||||
✅ Successfully published @hanzo/auth@2.5.5
|
||||
|
||||
📊 Publishing Summary
|
||||
✅ Published: 1 package(s)
|
||||
⏭️ Skipped: 4 package(s)
|
||||
```
|
||||
|
||||
This approach means you:
|
||||
- Only need to tag once (with @hanzo/ui version)
|
||||
- Don't need to track which packages need publishing
|
||||
- Can bump any package version and it auto-publishes on next tag
|
||||
- Similar to python-sdk monorepo publishing
|
||||
|
||||
**Workflow:** `.github/workflows/publish-on-tag.yml`
|
||||
|
||||
### 2. Manual Publishing (Workflow Dispatch)
|
||||
|
||||
Use GitHub Actions UI to manually publish specific packages:
|
||||
|
||||
1. Go to **Actions** → **NPM Publish**
|
||||
2. Click **Run workflow**
|
||||
3. Select package: `ui`, `auth`, `commerce`, `brand`, `react`, or `all`
|
||||
4. Select version bump: `patch`, `minor`, or `major`
|
||||
5. Click **Run workflow**
|
||||
|
||||
**What happens:**
|
||||
- Selected package(s) build
|
||||
- Version bumped automatically
|
||||
- Package(s) published to npm
|
||||
- PR created with version bump
|
||||
|
||||
**Workflow:** `.github/workflows/npm-publish.yml`
|
||||
|
||||
### 3. Local Publishing (Manual)
|
||||
|
||||
For quick patches or testing:
|
||||
|
||||
```bash
|
||||
# Build and test
|
||||
cd pkg/ui
|
||||
pnpm build
|
||||
pnpm test
|
||||
|
||||
# Bump version
|
||||
npm version patch # or minor/major
|
||||
|
||||
# Publish
|
||||
npm publish --access public
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### NPM Authentication Token
|
||||
|
||||
The GitHub secret `NPM_AUTH_TOKEN` must be set:
|
||||
|
||||
1. Generate token at https://www.npmjs.com/settings/tokens
|
||||
2. Add to GitHub: Settings → Secrets → Actions → `NPM_AUTH_TOKEN`
|
||||
|
||||
### Package Publish Configuration
|
||||
|
||||
All packages already configured with:
|
||||
```json
|
||||
{
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## React 19 Compatibility
|
||||
|
||||
### Key Updates Made
|
||||
|
||||
1. **Type Declarations**: Added `hanzo-ui.d.ts` files for React 19 compatibility
|
||||
2. **Peer Dependencies**: Force React 19.2.0 via pnpm overrides
|
||||
3. **Test Environment**: Switched to happy-dom for better React 19 support
|
||||
4. **Build Configuration**: All packages build successfully with React 19
|
||||
|
||||
### Test Status
|
||||
|
||||
- **pkg/ui**: 206/207 tests passing (99.5%)
|
||||
- **pkg/react**: 10/10 tests passing (100%)
|
||||
|
||||
## Publishing Checklist
|
||||
|
||||
Before publishing:
|
||||
|
||||
- [ ] All packages build successfully: `pnpm build`
|
||||
- [ ] Tests pass: `pnpm test`
|
||||
- [ ] Types check: `cd app && pnpm typecheck`
|
||||
- [ ] Lint passes: `cd app && pnpm lint`
|
||||
- [ ] Update CHANGELOG.md
|
||||
- [ ] Update version in package.json (if manual)
|
||||
- [ ] Commit changes
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Build Failures
|
||||
|
||||
```bash
|
||||
# Clean install
|
||||
rm -rf node_modules pnpm-lock.yaml
|
||||
pnpm install
|
||||
|
||||
# Rebuild
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### Test Failures
|
||||
|
||||
```bash
|
||||
# Run specific package tests
|
||||
cd pkg/ui && pnpm test
|
||||
cd pkg/react && pnpm test
|
||||
```
|
||||
|
||||
### Publish Failures
|
||||
|
||||
- Check NPM_AUTH_TOKEN is valid
|
||||
- Ensure version is unique (not already published)
|
||||
- Verify package builds: `cd pkg/<name> && pnpm build`
|
||||
|
||||
## Package URLs
|
||||
|
||||
- npm: https://www.npmjs.com/org/hanzo
|
||||
- GitHub: https://github.com/hanzoai/ui
|
||||
- Docs: https://ui.hanzo.ai
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2025-10-05
|
||||
**React Version:** 19.2.0
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "react"],
|
||||
"ignorePatterns": [
|
||||
"__registry__/**",
|
||||
".source/**",
|
||||
".next/**",
|
||||
"out/**",
|
||||
"build/**",
|
||||
"dist/**",
|
||||
".turbo/**",
|
||||
"node_modules/**"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"@typescript-eslint/no-empty-object-type": "warn",
|
||||
"@typescript-eslint/ban-ts-comment": "warn",
|
||||
"@typescript-eslint/no-unused-vars": "warn",
|
||||
"@typescript-eslint/no-require-imports": "warn",
|
||||
"@typescript-eslint/no-this-alias": "warn",
|
||||
"@typescript-eslint/triple-slash-reference": "warn",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"react/no-unescaped-entities": "warn",
|
||||
"react/jsx-no-comment-textnodes": "warn",
|
||||
"react/no-find-dom-node": "warn",
|
||||
"prefer-const": "warn"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// source.config.ts
|
||||
import {
|
||||
defineConfig,
|
||||
defineDocs,
|
||||
frontmatterSchema
|
||||
} from "fumadocs-mdx/config";
|
||||
import { z } from "zod";
|
||||
var source_config_default = defineConfig({
|
||||
mdxOptions: {
|
||||
rehypePlugins: []
|
||||
}
|
||||
});
|
||||
var docs = defineDocs({
|
||||
dir: "content/docs",
|
||||
docs: {
|
||||
schema: frontmatterSchema.extend({
|
||||
links: z.object({
|
||||
doc: z.string().optional(),
|
||||
api: z.string().optional()
|
||||
}).optional(),
|
||||
toc: z.boolean().optional()
|
||||
})
|
||||
}
|
||||
});
|
||||
export {
|
||||
source_config_default as default,
|
||||
docs
|
||||
};
|
||||
@@ -0,0 +1,114 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to the Hanzo UI project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.2.0] - 2025-11-04
|
||||
|
||||
### Added
|
||||
|
||||
#### Page Builder
|
||||
- **Visual Page Builder** (`/builder`) - Drag-and-drop interface for assembling pages from blocks
|
||||
- Filterable block library with 1/4 scale previews
|
||||
- Drag-to-reorder blocks in canvas
|
||||
- Viewport controls (Desktop/Tablet/Mobile) for responsive preview
|
||||
- Export to React TSX code
|
||||
- Copy code to clipboard
|
||||
- Download as .tsx file
|
||||
- Deploy with Hanzo integration
|
||||
- Real-time block rendering with dynamic imports
|
||||
- Error handling and loading states for blocks
|
||||
|
||||
#### Syntax Highlighting
|
||||
- **Shiki Integration** - Build-time syntax highlighting via Fumadocs
|
||||
- GitHub Light/Dark themes for automatic light/dark mode support
|
||||
- Multi-color syntax highlighting for all code blocks
|
||||
- Copy-to-clipboard button on code blocks
|
||||
- Line numbers and line highlighting support
|
||||
- File name labels via meta strings
|
||||
- Zero client-side JavaScript (all highlighting is static HTML)
|
||||
|
||||
#### New Blocks
|
||||
- **Newsletter Blocks** (5 variants)
|
||||
- `newsletter-01` - Simple newsletter signup
|
||||
- `newsletter-02` - Newsletter with description
|
||||
- `newsletter-03` - Newsletter with image
|
||||
- `newsletter-04` - Newsletter with testimonial
|
||||
- `newsletter-05` - Full-width newsletter section
|
||||
- **Blog Cards** - Modern blog post card layout
|
||||
- **Photo Grid** - Responsive photo gallery grid
|
||||
- **Showcase Blocks**
|
||||
- `showcase-marketing-01` - Marketing website showcase
|
||||
- `showcase-ecommerce-01` - E-commerce site showcase
|
||||
- `showcase-app-ui-01` - App UI showcase
|
||||
|
||||
#### New AI Components
|
||||
- **AI Voice Settings** - Voice configuration interface for AI assistants
|
||||
- Voice model selection
|
||||
- Speed, pitch, and volume controls
|
||||
- Preview functionality
|
||||
- Settings persistence
|
||||
|
||||
#### New Documentation
|
||||
- **AI Components Documentation**
|
||||
- AI Actions guide
|
||||
- AI Agents guide
|
||||
- AI Assistant guide
|
||||
- AI Code editor guide
|
||||
- AI Models selector guide
|
||||
- AI Vision guide
|
||||
- AI Voice Settings guide
|
||||
- AI Voice guide
|
||||
- **Blocks Documentation**
|
||||
- Newsletter blocks guide with all variants
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Block Display Component** - Fixed registry access pattern for proper block rendering
|
||||
- Now uses `getBlock()` function with style parameter
|
||||
- Proper fallback to `BlockWrapper` for blocks
|
||||
- Correct handling of component vs block types
|
||||
- **Stub Components** - Fixed three blocks with missing `@hanzo/ui/billing` dependency
|
||||
- `invoice-manager-01` - Added placeholder with installation instructions
|
||||
- `payment-settings-01` - Added placeholder with installation instructions
|
||||
- `subscription-portal-01` - Added placeholder with installation instructions
|
||||
- **Dynamic Block Loading** - Replaced iframe-based previews with direct component rendering
|
||||
- Eliminates 404 errors in block previews
|
||||
- Better error handling and loading states
|
||||
- Proper scaling with transform CSS
|
||||
|
||||
### Changed
|
||||
|
||||
- **Page Builder Layout**
|
||||
- Reduced sidebar width from w-80 to w-64 for more canvas space
|
||||
- Removed right sidebar to maximize preview area
|
||||
- Changed block preview scale from 1/2 to 1/4 in sidebar
|
||||
- Removed gaps between stacked blocks using border-b pattern
|
||||
- Added viewport width controls for responsive testing
|
||||
|
||||
### Technical Improvements
|
||||
|
||||
- **MDX Configuration** - Enhanced with Shiki rehype plugin options
|
||||
- **MDX Components** - Integrated Fumadocs CodeBlock wrapper for code blocks
|
||||
- **Build Process** - Improved registry build with proper error handling
|
||||
- **Type Safety** - Updated component props to use React.ComponentPropsWithoutRef
|
||||
|
||||
## [0.1.0] - 2025-10-05
|
||||
|
||||
### Initial Release
|
||||
|
||||
- Base component library with 150+ components
|
||||
- Two theme variants (default, new-york)
|
||||
- 24+ viewport-sized blocks
|
||||
- Documentation site with MDX support
|
||||
- CLI for component installation
|
||||
- External registry support
|
||||
- Responsive design system
|
||||
- Dark mode support
|
||||
|
||||
---
|
||||
|
||||
[0.2.0]: https://github.com/hanzoai/ui/releases/tag/v0.2.0
|
||||
[0.1.0]: https://github.com/hanzoai/ui/releases/tag/v0.1.0
|
||||
@@ -1,361 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Repository Overview
|
||||
|
||||
This is the **Hanzo UI App** - the documentation and showcase site for the @hanzo/ui component library. It's built with Next.js 15.3.1, React 19, and Fumadocs for documentation. The site serves as both documentation and a living demo of 149+ components.
|
||||
|
||||
**Key URLs:**
|
||||
- Production: https://ui.hanzo.ai
|
||||
- Local Dev: http://localhost:3003
|
||||
- Repo: github.com/hanzoai/ui (monorepo root is parent directory)
|
||||
|
||||
## Essential Commands
|
||||
|
||||
### Development
|
||||
```bash
|
||||
# Start dev server (port 3003)
|
||||
pnpm dev
|
||||
|
||||
# Build site (includes registry build + Next.js build)
|
||||
pnpm build
|
||||
|
||||
# Build registry only (generates JSON files for CLI)
|
||||
pnpm registry:build
|
||||
|
||||
# Start production server (port 3001)
|
||||
pnpm start
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
```bash
|
||||
# Lint
|
||||
pnpm lint
|
||||
pnpm lint:fix
|
||||
|
||||
# Type check
|
||||
pnpm typecheck
|
||||
|
||||
# Format
|
||||
pnpm format:write
|
||||
pnpm format:check
|
||||
```
|
||||
|
||||
### Registry Management
|
||||
```bash
|
||||
# Validate external registries
|
||||
pnpm validate:registries
|
||||
|
||||
# Capture screenshots (for component previews)
|
||||
pnpm registry:capture
|
||||
```
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
### Three-Layer System
|
||||
|
||||
**1. Components** (`/registry/{default,new-york}/ui/`)
|
||||
- Single UI elements (Button, Input, Card, Dialog)
|
||||
- Reusable primitives that compose into larger UIs
|
||||
- Two theme variants: default and new-york
|
||||
- 149 components total (115 implemented, 34 stubs)
|
||||
|
||||
**2. Examples** (`/registry/{default,new-york}/example/`)
|
||||
- Usage demonstrations for each component
|
||||
- Shows component in isolation with typical props
|
||||
- Used in documentation via `<ComponentPreview name="..." />`
|
||||
|
||||
**3. Blocks** (`/registry/{default,new-york}/blocks/`)
|
||||
- Viewport-sized sections (Dashboard, Hero, Login, Pricing)
|
||||
- Compose multiple components into full-page layouts
|
||||
- Production-ready templates users can copy
|
||||
- 24+ blocks including dashboard-01, sidebar-07, login-03
|
||||
|
||||
### Registry Build System
|
||||
|
||||
The registry is the **core of the component distribution system**:
|
||||
|
||||
1. **Source Files**: Components in `/registry/{style}/ui/`
|
||||
2. **Build Script**: `scripts/build-registry.mts` reads components and generates:
|
||||
- JSON metadata files in `/public/registry/styles/{style}/{name}.json`
|
||||
- Includes dependencies, files, type info
|
||||
3. **CLI Consumption**: The `@hanzo/ui` CLI reads these JSON files to install components
|
||||
4. **Documentation**: MDX files in `/content/docs/components/` reference the registry
|
||||
|
||||
**CRITICAL**: Always run `pnpm registry:build` before building the app if you modify components.
|
||||
|
||||
### Documentation System
|
||||
|
||||
- **Framework**: Fumadocs (replaced Contentlayer in v4 migration)
|
||||
- **MDX Files**: `/content/docs/` contains all documentation
|
||||
- **Components in MDX**: Special components available in MDX via `mdx-components.tsx`:
|
||||
- `<ComponentPreview name="..." />` - Live component demo
|
||||
- `<ComponentSource name="..." />` - Component source code
|
||||
- `<CodeTabs>` - Installation method tabs (CLI/Manual)
|
||||
- `<Steps>` - Step-by-step instructions
|
||||
- **Navigation**: Configured in `/config/docs.ts`
|
||||
|
||||
### Page Builder (`/builder`)
|
||||
|
||||
New drag-drop visual builder for assembling pages from blocks:
|
||||
- **Left Sidebar**: Filterable block library
|
||||
- **Canvas**: Drag-drop assembly area with reordering
|
||||
- **Export**: Generates React TSX code
|
||||
- **Tech**: @dnd-kit for drag-drop, SortableContext for reordering
|
||||
|
||||
Access at `/builder` route.
|
||||
|
||||
## Key File Locations
|
||||
|
||||
### Component Development
|
||||
```
|
||||
registry/default/ui/{component}.tsx # Component implementation
|
||||
registry/default/example/{component}-demo.tsx # Usage example
|
||||
content/docs/components/{component}.mdx # Documentation
|
||||
```
|
||||
|
||||
### Configuration
|
||||
```
|
||||
config/site.ts # Site metadata, links
|
||||
config/docs.ts # Documentation navigation structure
|
||||
tailwind.config.cjs # Tailwind configuration
|
||||
components.json # hanzo CLI configuration
|
||||
```
|
||||
|
||||
### Build & Scripts
|
||||
```
|
||||
scripts/build-registry.mts # Registry JSON generator
|
||||
scripts/validate-registries.mts # External registry validator
|
||||
__registry__/index.tsx # Auto-generated registry index
|
||||
```
|
||||
|
||||
## Component Creation Workflow
|
||||
|
||||
### 1. Create Component Files
|
||||
```bash
|
||||
# Create in both variants
|
||||
touch registry/default/ui/my-component.tsx
|
||||
touch registry/new-york/ui/my-component.tsx
|
||||
|
||||
# Create demo
|
||||
touch registry/default/example/my-component-demo.tsx
|
||||
```
|
||||
|
||||
### 2. Implement Component
|
||||
Follow the standard pattern:
|
||||
```tsx
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
interface MyComponentProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
variant?: "default" | "outline"
|
||||
}
|
||||
|
||||
const MyComponent = React.forwardRef<HTMLDivElement, MyComponentProps>(
|
||||
({ className, variant = "default", ...props }, ref) => {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("base-classes", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
MyComponent.displayName = "MyComponent"
|
||||
|
||||
export { MyComponent }
|
||||
```
|
||||
|
||||
### 3. Create Documentation
|
||||
```bash
|
||||
# Create MDX file
|
||||
touch content/docs/components/my-component.mdx
|
||||
```
|
||||
|
||||
Include:
|
||||
- `<ComponentPreview name="my-component-demo" />`
|
||||
- Installation instructions with `<CodeTabs>`
|
||||
- Usage examples
|
||||
- API table with props
|
||||
|
||||
### 4. Add to Navigation
|
||||
Edit `config/docs.ts` to add component to sidebar navigation.
|
||||
|
||||
### 5. Build Registry
|
||||
```bash
|
||||
pnpm registry:build
|
||||
```
|
||||
|
||||
### 6. Test
|
||||
```bash
|
||||
pnpm dev
|
||||
# Visit http://localhost:3003/docs/components/my-component
|
||||
```
|
||||
|
||||
## Registry Architecture
|
||||
|
||||
The registry system enables the `npx hanzo-ui@latest add {component}` CLI workflow:
|
||||
|
||||
**Registry Entry Structure:**
|
||||
```json
|
||||
{
|
||||
"name": "button",
|
||||
"type": "components:ui",
|
||||
"files": ["registry/default/ui/button.tsx"],
|
||||
"dependencies": ["class-variance-authority"],
|
||||
"registryDependencies": ["utils"]
|
||||
}
|
||||
```
|
||||
|
||||
**External Registries** (`registries.json`):
|
||||
- 35+ external component sources
|
||||
- Examples: @aceternity, @magicui, @hanzo-editor
|
||||
- Validated via `pnpm validate:registries`
|
||||
|
||||
## Theme System
|
||||
|
||||
**CSS Variables** (`/styles/globals.css`):
|
||||
- Base theme colors defined in HSL
|
||||
- Primary color: `210 100% 50%` (electric blue)
|
||||
- Dark mode via `.dark` class
|
||||
- All components use `hsl(var(--primary))` pattern
|
||||
|
||||
**Two Visual Styles:**
|
||||
- **default**: More rounded, softer shadows
|
||||
- **new-york**: Flatter, sharper, minimal
|
||||
|
||||
Both styles share the same component API, only visual styling differs.
|
||||
|
||||
## Build System
|
||||
|
||||
### Production Build Process
|
||||
1. `pnpm registry:build` - Generate registry JSON files
|
||||
2. `next build` - Build Next.js app
|
||||
3. Static export to `/out` directory for GitHub Pages
|
||||
|
||||
### Local Development
|
||||
- Uses Turbopack for fast HMR
|
||||
- Port 3003 (configurable)
|
||||
- MDX hot reload via Fumadocs
|
||||
|
||||
## Component vs Block Distinction
|
||||
|
||||
**Components** (149 total):
|
||||
- Single-purpose UI elements
|
||||
- Examples: Button, Input, Card, Dialog, Dropdown
|
||||
- Used as building blocks
|
||||
- Installed individually via CLI
|
||||
|
||||
**Blocks** (24+ available):
|
||||
- Full viewport sections
|
||||
- Examples: dashboard-01 (admin layout), login-03 (auth page), sidebar-07
|
||||
- Compose multiple components
|
||||
- Ready-to-use page sections
|
||||
- Users copy entire blocks, not install via CLI
|
||||
|
||||
## Import Patterns
|
||||
|
||||
Components can be imported three ways:
|
||||
|
||||
**1. Package Import** (if using @hanzo/ui package):
|
||||
```tsx
|
||||
import { Button, Card } from "@hanzo/ui"
|
||||
```
|
||||
|
||||
**2. Registry Import** (in documentation/examples):
|
||||
```tsx
|
||||
import { Button } from "@/registry/default/ui/button"
|
||||
```
|
||||
|
||||
**3. Local Import** (after installing via CLI):
|
||||
```tsx
|
||||
import { Button } from "@/components/ui/button"
|
||||
```
|
||||
|
||||
The registry uses `@/registry/{style}/` which gets rewritten to `@/components/` during installation.
|
||||
|
||||
## MDX Component System
|
||||
|
||||
Components available in all MDX files:
|
||||
|
||||
- `<ComponentPreview name="button-demo" />` - Live demo
|
||||
- `<ComponentSource name="button" />` - Source code display
|
||||
- `<ComponentExample>` - Example wrapper
|
||||
- `<CodeTabs>` - Installation tabs (requires useConfig hook)
|
||||
- `<Steps>` / `<Step>` - Step-by-step instructions
|
||||
- `<Tabs>` / `<TabsList>` / `<TabsTrigger>` / `<TabsContent>` - Content tabs
|
||||
- `<Callout>` - Info/warning callouts
|
||||
|
||||
## Testing
|
||||
|
||||
No formal test suite currently. Testing is done via:
|
||||
1. Local dev server visual testing
|
||||
2. Build process catches type errors
|
||||
3. Registry validation ensures component metadata is correct
|
||||
|
||||
## Deployment
|
||||
|
||||
**GitHub Pages** (automatic):
|
||||
- Workflow: `.github/workflows/deploy-gh-pages.yml`
|
||||
- Triggers on push to main
|
||||
- Builds app + pkg/ui package
|
||||
- Deploys to ui.hanzo.ai
|
||||
- Requires: npm-run-all, del-cli for dependency builds
|
||||
|
||||
**Important**: The GitHub Actions workflow builds the `pkg/ui` package first, then the app, to ensure registry has latest component code.
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Stub Components
|
||||
Components marked for future implementation:
|
||||
```tsx
|
||||
export default function Component() {
|
||||
return (
|
||||
<div className="flex items-center justify-center p-8">
|
||||
<p className="text-muted-foreground">Component coming soon</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
Currently 34 stubs remaining (documented but not implemented).
|
||||
|
||||
### Component Dependencies
|
||||
- Radix UI primitives for accessible base components
|
||||
- `cn()` utility from `@/lib/utils` for className merging
|
||||
- `cva` (class-variance-authority) for variant management
|
||||
- Lucide React for icons
|
||||
- Framer Motion for animations (some components)
|
||||
|
||||
### Registry Dependencies
|
||||
Components can depend on other registry components:
|
||||
```json
|
||||
{
|
||||
"registryDependencies": ["button", "dialog", "utils"]
|
||||
}
|
||||
```
|
||||
|
||||
These are auto-installed when user adds the component.
|
||||
|
||||
## Recent Architectural Changes (2025-10-05)
|
||||
|
||||
1. **Migrated from Contentlayer to Fumadocs** for MDX processing
|
||||
2. **Upgraded to Next.js 15.3.1** with Turbopack
|
||||
3. **React 19** with new JSX transform
|
||||
4. **Added @dnd-kit** for page builder drag-drop
|
||||
5. **Synced with hanzo/ui v3.4.0** (7 new components: button-group, empty, field, input-group, item, kbd, spinner)
|
||||
6. **Electric blue primary color** (210 100% 50%)
|
||||
7. **Page builder feature** at `/builder` route
|
||||
|
||||
## Notes for AI Assistants
|
||||
|
||||
- **Registry must rebuild** after component changes: `pnpm registry:build`
|
||||
- **Two theme variants** must be kept in sync: default and new-york
|
||||
- **Import paths** in components use `@/registry/{style}/` which becomes `@/components/` after CLI install
|
||||
- **MDX components** are defined in `mdx-components.tsx`, not auto-imported
|
||||
- **Blocks are different** from components - they're full-page sections, not installable via CLI
|
||||
- **GitHub Pages deployment** requires building pkg/ui package first (workflow handles this)
|
||||