CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
SilkUI is a UI component library for HarmonyOS development using the CangjieScript (仓颉) programming language. The project consists of:
- silkui: Core component library written in CangjieScript (.cj files)
- docs-vue: Vue 3-based documentation website
- entry: HarmonyOS application entry point that demonstrates component usage
Common Development Commands
Documentation Website (docs-vue/)
cd docs-vue
npm install # Install dependencies
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
HarmonyOS Application
The project uses the HarmonyOS DevEco Studio build system with hvigor. Build commands should be run through DevEco Studio or using hvigor CLI tools.
Component Library Development
Components are developed in CangjieScript and located in libs/silkui/src/main/cangjie/src/components/. Each component
typically includes:
- Main component file (.cj)
- Model/types file (model.cj)
- Package exports (pkg.cj)
- Documentation (README.md)
Project Architecture
Core Structure
libs/silkui/- Main component librarysrc/main/cangjie/src/components/- Individual UI componentssrc/main/cangjie/src/constants/- Constants and configurationsrc/main/cangjie/src/utils/- Utility functionssrc/main/resources/- Asset files (images, fonts, themes)
entry/- HarmonyOS application entry moduledocs-vue/- Vue.js documentation websitedocs/- CangjieScript language development documentation
Component Structure
Each component follows this pattern:
component_name/
├── component_name.cj # Main component implementation
├── model.cj # Types and interfaces
├── pkg.cj # Package exports
└── README.md # Component documentation
Build Configuration
build-profile.json5- Main HarmonyOS build configurationoh-package.json5- HarmonyOS package configurationcjpm.toml- CangjieScript package manager configurationhvigorfile.ts- Build script configuration
Resource Management
libs/silkui/src/main/resources/base/- Base theme resourceslibs/silkui/src/main/resources/dark/- Dark theme resourceslibs/silkui/src/main/resources/rawfile/font/- Custom fonts- Icons and media assets are in
resources/base/media/
Documentation Integration
The Vue documentation site automatically pulls component documentation from the library's README.md files. When adding new components:
- Create complete README.md in the component directory
- Add route configuration in
docs-vue/src/router/index.js - Update sidebar navigation in
docs-vue/src/components/Sidebar.vue - Add component name to
docs-vue/scripts/copy-markdown.js
Key Technologies
- CangjieScript: Primary development language for components
- HarmonyOS: Target platform with ArkUI framework
- Vue 3 + Vite: Documentation website
- CJPM: CangjieScript package manager
- Hvigor: HarmonyOS build tool
Component Development Guidelines
- Follow the existing component structure pattern
- Include comprehensive README.md documentation
- Use TypeScript-like interfaces in model.cj files
- Export public APIs through pkg.cj files
- Support both light and dark themes via resource configuration
- Include proper error handling and validation
Testing
The project includes testing infrastructure through:
@ohos/hypium: HarmonyOS testing framework@ohos/hamock: Mocking framework- Test files should be placed alongside component files or in dedicated test directories