Skip to content

Commit eb390f4

Browse files
committed
docs: fix core concepts documentation
- Fix N/M base character for 27/37 - Remove misleading CSS optimization examples - Simplify type inference system explanation with csstype property
1 parent 97cb1d8 commit eb390f4

File tree

3 files changed

+17
-82
lines changed

3 files changed

+17
-82
lines changed

apps/landing/src/app/(detail)/docs/core-concepts/nm-base/page.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ Devup UI uses a custom N/M base numbering system to generate compact, collision-
2121

2222
The N/M base system uses two character sets:
2323

24-
- **N Base**: `a-z` (26 characters)
25-
- **M Base**: `a-z` (26 characters)
26-
27-
This creates a base-26 system that can represent any number using only lowercase letters.
24+
- **N Base**: `a-z, _` (27 characters)
25+
- **M Base**: `a-z, 0-9, _` (37 characters)
2826

2927
### **Number Conversion**
3028

apps/landing/src/app/(detail)/docs/core-concepts/optimize-css/page.mdx

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Devup UI optimizes CSS values by:
1818
- **Removing unnecessary zeros**: `0px` becomes `0`
1919
- **Shortening decimals**: `0.5000` becomes `0.5`
2020
- **Optimizing units**: `0px` becomes `0` when appropriate
21-
- **Converting to smallest units**: `px` values are converted to `%` when more appropriate
21+
- **Converting to alternative units**: `0px` is converted to `0%` in CSS functions where unit-less zero is not allowed
2222
- **Removing redundant spaces**: `margin: 0 0 0 0` becomes `margin:0`
2323

2424
```
@@ -104,7 +104,6 @@ Global CSS blocks are optimized by:
104104
- **Removing comments**: `/* comment */` is stripped
105105
- **Minifying whitespace**: Multiple spaces become single spaces
106106
- **Removing semicolons**: Last property in a block doesn't need semicolon
107-
- **Optimizing selectors**: Redundant selectors are merged
108107

109108
```css
110109
/* Before optimization */
@@ -155,28 +154,14 @@ Values are converted to their most appropriate units:
155154
Numeric values are automatically interpreted as pixel units, while string-based values with explicit units (e.g., rem, %) are preserved for accurate rendering.
156155

157156
```
158-
// Numbers without units are treated as pixels
159-
<Box w={16} /> // width: 16px
157+
// Numbers without units are treated as pixels (multiplied by 4)
158+
<Box w={16} /> // width: 64px
160159
161160
// Strings with units are preserved
162161
<Box w="16rem" /> // width: 16rem
163162
<Box w="100%" /> // width: 100%
164163
```
165164

166-
### **Mathematical Optimization**
167-
168-
Mathematical expressions are optimized to their most efficient form:
169-
170-
```
171-
// Before
172-
<Box w="calc(100% - 32px)" />
173-
<Box w="calc(50% + 16px)" />
174-
175-
// After (optimized)
176-
<Box w="calc(100% - 2rem)" /> // px converted to rem for better scalability
177-
<Box w="calc(50% + 1rem)" /> // px converted to rem for better scalability
178-
```
179-
180165
### **Zero Value Optimization**
181166

182167
Zero values are optimized:
@@ -207,24 +192,6 @@ Identical style rules across multiple components are automatically merged into a
207192
// .red-white{background:red;color:white}
208193
```
209194

210-
### **Property Deduplication**
211-
212-
Duplicate CSS properties within the same rule are automatically removed, keeping only the last valid declaration for consistency and cleaner output.
213-
214-
```
215-
// Input
216-
<Box
217-
style={{
218-
margin: '0',
219-
padding: '0',
220-
margin: '0', // duplicate
221-
}}
222-
/>
223-
224-
// Output: Duplicate margin removed
225-
<Box style={{ margin: '0', padding: '0' }} />
226-
```
227-
228195
### **Advantages**
229196

230197
Devup UI offers complete flexibility in how you implement and optimize styles — while maintaining measurable performance gains.

apps/landing/src/app/(detail)/docs/core-concepts/type-inference-system/page.mdx

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,28 @@ Unlike traditional CSS-in-JS libraries, Devup UI **derives types directly from C
1212

1313
## How It Works
1414

15-
The type inference process consists of four main steps:
15+
Devup UI uses the **csstype** package to automatically generate types for CSS properties. Instead of manually defining types, Devup UI reads the standard CSS definitions from csstype and uses them directly.
1616

17-
1. **Parsing** – analyzes JSX/TSX code
18-
2. **Property Lookup** – checks against the CSS property map
19-
3. **Type Generation** – produces corresponding TypeScript types
20-
4. **Validation** – enforces compile-time correctness
17+
### 1. Reading CSS Standards
2118

22-
### 1. CSS Property Mapping
19+
Devup UI reads all CSS property definitions from the **csstype** package, which contains the official CSS standards. This includes both regular properties (like `width`, `color`) and shorthand properties (like `margin`, `padding`).
2320

24-
All CSS properties are defined in a Rust-based mapping table.
21+
### 2. Auto-Converting Selectors
2522

26-
```rust
27-
pub(super) static GLOBAL_STYLE_PROPERTY: phf::Map<&str, &[&str]> = phf_map! {
28-
"bg" => &["background"],
29-
"bgColor" => &["background-color"],
30-
"m" => &["margin"],
31-
"w" => &["width"],
32-
"h" => &["height"],
33-
// ...
34-
};
23+
When you use CSS states like `:hover` or `:focus`, Devup UI automatically converts them into props you can use. For example, `:hover` becomes `_hover` so you can write `<Box _hover={{ bg: 'red' }} />`.
3524

36-
```
25+
When `csstype` is updated with new CSS standards, Devup UI automatically gets these updates without needing a library update.
3726

38-
### 2. Type Generation
27+
### 3. Catching Mistakes Early
3928

40-
TypeScript types are automatically derived from CSS property names and value patterns.
41-
42-
It supports various value types — such as lengths, colors, and percentages — and
43-
44-
ensures **type-safe responsive arrays** for breakpoint-based styles.
45-
46-
```tsx
47-
<Box w={[100, 200, 300]} />
48-
```
49-
50-
### 3. Special Property Handling
51-
52-
Certain properties are excluded from inference, such as React-specific or HTML attributes.
53-
54-
```rust
55-
static SPECIAL_PROPERTIES: phf::Set<&str> = phf_set! {
56-
"children", "ref", "key", "className", "id", "style",
57-
};
58-
59-
```
29+
TypeScript checks your CSS properties while you're coding. If you try to use an invalid property or value, you'll get an error right away instead of discovering it later.
6030

6131
## Advantages
6232

63-
Devup UIs type inference system provides several key benefits:
33+
Devup UI's type inference system provides several key benefits:
6434

65-
- **Automatic updates** – New CSS properties are supported immediately when standards evolve, without requiring library updates.
66-
- **Type safety** – All properties and values are strictly typed, preventing invalid or misspelled declarations at compile time.
67-
- **Extensibility**Experimental or custom CSS features can be easily extended within the system.
35+
- **Automatic updates** – New CSS properties are supported immediately when the csstype package is updated. Simply update the package without requiring devup-ui library updates.
36+
- **Type safety** – All properties and values are strictly typed based on CSS standards, preventing invalid or misspelled declarations at compile time.
37+
- **Standards compliance**Types are always aligned with official CSS specifications, ensuring accuracy and consistency across all CSS standards.
6838

6939
This type inference system is automatic, reliable, and future-ready, allowing developers to focus on design and logic rather than manual type management.

0 commit comments

Comments
 (0)