Skip to content

Commit becfa99

Browse files
committed
add README
1 parent f535e23 commit becfa99

File tree

2 files changed

+143
-2
lines changed

2 files changed

+143
-2
lines changed

README.mbt.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,144 @@
11
# tiye/respo_css
22

33
CSS structs for Respo library
4+
5+
## Introduction
6+
7+
`respo_css` is a MoonBit package that provides type-safe CSS support for the Respo library. It offers complete CSS property type definitions, enumeration values, and style building tools, allowing you to build and manage CSS styles in a functional way.
8+
9+
## Installation
10+
11+
Add the dependency to your MoonBit project:
12+
13+
```json
14+
{
15+
"deps": {
16+
"tiye/respo_css": "*"
17+
}
18+
}
19+
```
20+
21+
Or use the moon command line tool:
22+
23+
```bash
24+
moon add tiye/respo_css
25+
```
26+
27+
## Usage
28+
29+
### Basic Usage
30+
31+
```moonbit
32+
// Create basic styles
33+
let style : RespoStyle = respo_style(
34+
color=CssColor::Red,
35+
font_size=16,
36+
margin=CssSize::Px(10.0),
37+
display=CssDisplay::Flex
38+
)
39+
40+
// Convert to CSS string
41+
let _css_string : String = style.to_string()
42+
// Output: "color:red; font-size:16px; margin:10px; display:flex; "
43+
```
44+
45+
### Style Composition
46+
47+
```moonbit
48+
// Create multiple styles
49+
let base_style : RespoStyle = respo_style(color=CssColor::Blue, font_size=14)
50+
let layout_style : RespoStyle = respo_style(display=CssDisplay::Grid, gap=CssSize::Px(20.0))
51+
52+
// Merge styles
53+
let combined : RespoStyle = base_style.merge(layout_style)
54+
55+
// Add custom properties
56+
let _extended : RespoStyle = combined.add("custom-property", "custom-value")
57+
```
58+
59+
### Supported CSS Properties
60+
61+
- **Layout**: `display`, `position`, `flex-direction`, `justify-content`, `align-items`, etc.
62+
- **Sizing**: `width`, `height`, `margin`, `padding`, etc.
63+
- **Colors**: `color`, `background-color`, `border-color`, etc.
64+
- **Typography**: `font-size`, `font-weight`, `text-align`, `text-decoration`, etc.
65+
- **Transforms**: `transform`, `transition`, `animation`, etc.
66+
- **Grid**: `grid-template-columns`, `grid-template-rows`, `grid-area`, etc.
67+
68+
## API Documentation
69+
70+
### Main Types
71+
72+
- `RespoStyle`: Style container that stores CSS property key-value pairs
73+
- `CssSize`: CSS size values (px, em, rem, %, auto, etc.)
74+
- `CssColor`: CSS color values (predefined colors, RGB, HSL, etc.)
75+
- `CssDisplay`: display property values (block, flex, grid, etc.)
76+
77+
### Main Functions
78+
79+
- `respo_style(...)`: Create new style objects
80+
- `.merge(other)`: Merge two styles
81+
- `.add(property, value)`: Add custom CSS properties
82+
- `.to_string()`: Convert to CSS string
83+
84+
## Development and Contributing
85+
86+
### About AI-Assisted Development
87+
88+
Parts of this project's code and documentation were generated with AI assistance, including:
89+
90+
- Enum type definitions and documentation
91+
- Test case generation
92+
- API documentation improvements
93+
94+
We believe AI-assisted development can improve code quality and development efficiency while maintaining code consistency and completeness.
95+
96+
### How to Contribute
97+
98+
We welcome community contributions! You can participate in the following ways:
99+
100+
1. **Report Issues**: Report bugs or feature requests in GitHub Issues
101+
2. **Submit Code**:
102+
103+
- Fork this repository
104+
- Create a feature branch (`git checkout -b feature/amazing-feature`)
105+
- Commit your changes (`git commit -m 'Add some amazing feature'`)
106+
- Push to the branch (`git push origin feature/amazing-feature`)
107+
- Create a Pull Request
108+
109+
3. **Improve Documentation**: Help improve API documentation, usage examples, or README
110+
4. **Add Tests**: Add more test cases for existing functionality
111+
5. **Performance Optimization**: Propose or implement performance improvements
112+
113+
### Development Environment
114+
115+
```bash
116+
# Clone the repository
117+
git clone https://github.com/tiye/respo_css.git
118+
cd respo_css
119+
120+
# Run tests
121+
moon test
122+
123+
# Check code
124+
moon check
125+
126+
# Build project
127+
moon build
128+
```
129+
130+
### Code Standards
131+
132+
- Follow official MoonBit code style
133+
- Add corresponding test cases for new features
134+
- Provide complete documentation comments for public APIs
135+
- Use `inspect` format to provide usage examples
136+
137+
## License
138+
139+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
140+
141+
## Related Projects
142+
143+
- [Respo](https://github.com/tiye/respo) - Main UI framework
144+
- [MoonBit](https://www.moonbitlang.com/) - Programming language official website

moon.mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "tiye/respo_css",
33
"version": "0.1.0",
44
"readme": "README.mbt.md",
5-
"repository": "",
5+
"repository": "git@github.com:Respo/respo_css.mbt.git",
66
"license": "Apache-2.0",
77
"keywords": ["respo", "CSS"],
8-
"description": "CSS structs for Respo library"
8+
"description": "Type-safe CSS styling library for Respo framework with comprehensive property definitions, enumeration values, and functional style composition tools. Provides complete CSS support including layout, typography, colors, transforms, and grid systems with MoonBit type safety."
99
}

0 commit comments

Comments
 (0)