chaincss 1.13.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/LICENSE +2 -3
- package/README.md +239 -114
- package/dist/cli/commands/build.d.ts +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/compile.d.ts +3 -0
- package/dist/cli/commands/compile.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/timeline.d.ts +2 -0
- package/dist/cli/commands/timeline.d.ts.map +1 -0
- package/dist/cli/commands/watch.d.ts +6 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +5960 -0
- package/dist/cli/types.d.ts +51 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/utils/config-loader.d.ts +8 -0
- package/dist/cli/utils/config-loader.d.ts.map +1 -0
- package/dist/cli/utils/file-utils.d.ts +9 -0
- package/dist/cli/utils/file-utils.d.ts.map +1 -0
- package/dist/cli/utils/logger.d.ts +17 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/compiler/atomic-optimizer.d.ts +76 -0
- package/dist/compiler/atomic-optimizer.d.ts.map +1 -0
- package/dist/compiler/btt.d.ts +138 -0
- package/dist/compiler/btt.d.ts.map +1 -0
- package/dist/compiler/cache-manager.d.ts +20 -0
- package/dist/compiler/cache-manager.d.ts.map +1 -0
- package/dist/compiler/commonProps.d.ts +2 -0
- package/dist/compiler/commonProps.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +12 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +5177 -0
- package/dist/compiler/prefixer.d.ts +42 -0
- package/dist/compiler/prefixer.d.ts.map +1 -0
- package/dist/compiler/theme-contract.d.ts +61 -0
- package/dist/compiler/theme-contract.d.ts.map +1 -0
- package/dist/compiler/tokens.d.ts +52 -0
- package/dist/compiler/tokens.d.ts.map +1 -0
- package/dist/compiler/types.d.ts +57 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/core/compiler.d.ts +32 -0
- package/dist/core/compiler.d.ts.map +1 -0
- package/dist/core/constants.d.ts +129 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/types.d.ts +88 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/utils.d.ts +37 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5667 -0
- package/dist/plugins/vite.d.ts +11 -0
- package/dist/plugins/vite.d.ts.map +1 -0
- package/dist/plugins/vite.js +25839 -0
- package/dist/plugins/webpack.d.ts +45 -0
- package/dist/plugins/webpack.d.ts.map +1 -0
- package/dist/plugins/webpack.js +107 -0
- package/dist/runtime/hmr.d.ts +3 -0
- package/dist/runtime/hmr.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +15 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +552 -0
- package/dist/runtime/injector.d.ts +85 -0
- package/dist/runtime/injector.d.ts.map +1 -0
- package/dist/runtime/react.d.ts +54 -0
- package/dist/runtime/react.d.ts.map +1 -0
- package/dist/runtime/react.js +270 -0
- package/dist/runtime/types.d.ts +45 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/utils.d.ts +62 -0
- package/dist/runtime/utils.d.ts.map +1 -0
- package/dist/runtime/vue.d.ts +52 -0
- package/dist/runtime/vue.d.ts.map +1 -0
- package/dist/runtime/vue.js +232 -0
- package/package.json +90 -109
- package/browser/commonProps.js +0 -14
- package/browser/index.js +0 -3
- package/browser/react-hooks.js +0 -162
- package/browser/rtt.js +0 -370
- package/node/atomic-optimizer.js +0 -391
- package/node/btt.js +0 -962
- package/node/cache-manager.js +0 -56
- package/node/chaincss.js +0 -489
- package/node/css-properties.json +0 -633
- package/node/index.js +0 -2
- package/node/loaders/chaincss-loader.js +0 -62
- package/node/plugins/next-plugin.js +0 -120
- package/node/plugins/vite-plugin.js +0 -383
- package/node/plugins/webpack-plugin.js +0 -41
- package/node/prefixer.js +0 -237
- package/node/strVal.js +0 -106
- package/node/theme-validator.js +0 -32
- package/shared/theme-contract.js +0 -98
- package/shared/tokens.cjs +0 -256
- package/shared/tokens.mjs +0 -320
- package/types.d.ts +0 -277
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ChainCSS will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.0.0] - 2026-04-10
|
|
9
|
+
|
|
10
|
+
### 🎉 Major Release: Zero-Runtime Architecture
|
|
11
|
+
|
|
12
|
+
ChainCSS 2.0 is a complete rewrite focused on **zero-runtime CSS-in-JS** with optional runtime for development.
|
|
13
|
+
|
|
14
|
+
### ✨ Added
|
|
15
|
+
|
|
16
|
+
- **Zero-runtime mode**: Styles compile to static CSS at build time (0KB in production)
|
|
17
|
+
- **Shorthand properties**: `$.bg()`, `$.c()`, `$.p()`, `$.m()`, `$.rounded()`, etc. (write less, do more)
|
|
18
|
+
- **Responsive breakpoint methods**: `.mobile()`, `.tablet()`, `.desktop()`, `.sm()`, `.md()`, `.lg()`, `.xl()`
|
|
19
|
+
- **Animation presets**: `.fadeIn()`, `.slideInUp()`, `.pulse()`, `.spin()`, `.bounce()`, `.shake()`, etc.
|
|
20
|
+
- **Math/Calc helpers**: `$.calc()`, `$.add()`, `$.subtract()`, `$.multiply()`, `$.divide()`
|
|
21
|
+
- **Debug mode**: `.debug()` with console output showing source file and line number
|
|
22
|
+
- **Style versioning**: Source comments in CSS (`/* Generated from: nav.chain.js:15 */`)
|
|
23
|
+
- **Timeline/Diff viewer**: Track style changes with `chaincss build --timeline` and `chaincss timeline diff`
|
|
24
|
+
- **Configurable breakpoints**: Custom breakpoints in `chaincss.config.js`
|
|
25
|
+
- **Environment-aware defaults**: `readable` class names in development, `hash` in production
|
|
26
|
+
- **Atomic CSS optimization**: Automatic detection and reuse of common styles (opt-in)
|
|
27
|
+
- **CLI tool**: `chaincss init`, `chaincss build`, `chaincss watch`, `chaincss clean`
|
|
28
|
+
- **Vite plugin**: Seamless integration with Vite
|
|
29
|
+
- **Webpack plugin**: Webpack loader for .chain.js files
|
|
30
|
+
- **TypeScript support**: Full type definitions with generated types
|
|
31
|
+
- **Recipe system**: Variant-based component styling
|
|
32
|
+
- **Design tokens**: Built-in token system with theme contracts
|
|
33
|
+
- **Optional runtime**: 3.2KB runtime for development and dynamic theming
|
|
34
|
+
- **React hooks**: `useChainStyles`, `useDynamicChainStyles`, `useThemeChainStyles`, `createStyledComponent`
|
|
35
|
+
- **Vue composables**: `useAtomicClasses`, `createStyledComponent`
|
|
36
|
+
- **Improved file structure**: Each component has its own `styles/` folder with `.chain.js`, `.class.js`, and `.css` files
|
|
37
|
+
- **Global styles separation**: `global-style/` folder for global CSS
|
|
38
|
+
- **Better minification**: `global.css` minified for production, component CSS unminified for debugging
|
|
39
|
+
|
|
40
|
+
### 🔧 Changed
|
|
41
|
+
|
|
42
|
+
- Complete rewrite from runtime-only to hybrid architecture
|
|
43
|
+
- New package structure with ESM support
|
|
44
|
+
- Better tree-shaking for smaller bundles
|
|
45
|
+
- Improved CSS property validation
|
|
46
|
+
- Class name generation now uses `readable` format by default in development
|
|
47
|
+
|
|
48
|
+
### 🗑️ Removed
|
|
49
|
+
|
|
50
|
+
- `@melcanz85/chaincss` legacy package reference (now unified under `chaincss`)
|
|
51
|
+
|
|
52
|
+
### 📚 Documentation
|
|
53
|
+
|
|
54
|
+
- New documentation site with interactive playground
|
|
55
|
+
- Migration guide from v1.x
|
|
56
|
+
- API reference with examples
|
|
57
|
+
- CLI reference with all commands
|
|
58
|
+
- Configuration guide with all options
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## [1.13.3] - 2026-03-30
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
- Bug fixes and performance improvements
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- Updated dependencies
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## [1.0.0] - 2023-01-01
|
|
73
|
+
|
|
74
|
+
### 🎉 Initial Release
|
|
75
|
+
|
|
76
|
+
- Chainable CSS API
|
|
77
|
+
- Runtime style injection
|
|
78
|
+
- React hooks
|
|
79
|
+
- Vue composables
|
|
80
|
+
- Token system
|
|
81
|
+
- Recipe variants
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2006 Rommel Caneos
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,5 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
EOF
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,146 +4,271 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://chaincss.dev)
|
|
6
6
|
|
|
7
|
-
>
|
|
7
|
+
> **ChainCSS** The JavaScript-native styling engine for the modern web.
|
|
8
8
|
|
|
9
9
|
> **Note:** The previous package `@melcanz85/chaincss` is no longer supported.
|
|
10
|
-
> **Please install `chaincss` instead:** `npm install chaincss`
|
|
10
|
+
> **Please install this updated `chaincss` instead:** `npm install chaincss`
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## ✨ Features
|
|
13
13
|
|
|
14
|
-
### Core Styling
|
|
14
|
+
### Core Styling
|
|
15
15
|
|
|
16
|
-
| Feature | Description |
|
|
17
|
-
|
|
18
|
-
| **Chainable API** |
|
|
19
|
-
| **
|
|
20
|
-
| **
|
|
21
|
-
| **
|
|
22
|
-
| **Hover
|
|
23
|
-
| **
|
|
24
|
-
| **
|
|
25
|
-
| **CSS Property Validation** | Warns on invalid CSS properties |
|
|
26
|
-
|
|
27
|
-
### At-Rules (CSS Rules)
|
|
28
|
-
|
|
29
|
-
| At-Rule | Method | Example |
|
|
30
|
-
|---------|--------|---------|
|
|
31
|
-
| **Media Queries** | `.media()` | `.media('(max-width: 768px)', (css) => {...})` |
|
|
32
|
-
| **Keyframes** | `.keyframes()` | `.keyframes('slide', (kf) => {...})` |
|
|
33
|
-
| **Font Face** | `.fontFace()` | `.fontFace((css) => {...})` |
|
|
34
|
-
| **Supports** | `.supports()` | `.supports('display: grid', (css) => {...})` |
|
|
35
|
-
| **Container Queries** | `.container()` | `.container('(min-width: 400px)', (css) => {...})` |
|
|
36
|
-
| **CSS Layers** | `.layer()` | `.layer('components', (css) => {...})` |
|
|
37
|
-
| **Counter Styles** | `.counterStyle()` | `.counterStyle('circled', (css) => {...})` |
|
|
38
|
-
| **Custom Properties** | `.property()` | `.property('--my-color', (css) => {...})` |
|
|
39
|
-
|
|
40
|
-
### Design System
|
|
41
|
-
|
|
42
|
-
| Feature | Description |
|
|
43
|
-
|---------|-------------|
|
|
44
|
-
| **Design Tokens** | `createTokens()` with colors, spacing, typography |
|
|
45
|
-
| **Token Getter** | `tokens.get('colors.primary')` |
|
|
46
|
-
| **Token Resolution in Styles** | `$colors.primary` syntax |
|
|
47
|
-
| **Responsive Values** | `responsive({ base: '16px', sm: '14px', lg: '18px' })` |
|
|
48
|
-
| **Theme Switching** | Dynamic token updates at runtime |
|
|
49
|
-
| **CSS Variables Output** | `tokens.toCSSVariables()` |
|
|
16
|
+
| Feature | Description | Example |
|
|
17
|
+
|---------|-------------|---------|
|
|
18
|
+
| **Chainable API** | Intuitive method chaining | `$.color('red').padding('10px')` |
|
|
19
|
+
| **Shorthand Properties** | Write less, do more | `$.bg('blue').c('white').p('20px')` |
|
|
20
|
+
| **CSS Properties** | All standard CSS properties | `$.display('flex').gap('1rem')` |
|
|
21
|
+
| **Multiple Selectors** | Style multiple elements | `.$el('.btn', '.button')` |
|
|
22
|
+
| **Hover States** | Interactive styles | `.hover().bg('darkblue').end()` |
|
|
23
|
+
| **Responsive Breakpoints** | Built-in breakpoint methods | `.mobile(css => css.p('1rem'))` |
|
|
24
|
+
| **Media Queries** | Custom media queries | `.media('(max-width: 768px)', ...)` |
|
|
50
25
|
|
|
51
|
-
###
|
|
26
|
+
### 🚀 Advanced Features
|
|
52
27
|
|
|
53
|
-
| Feature | Description |
|
|
54
|
-
|
|
55
|
-
| **
|
|
56
|
-
| **
|
|
57
|
-
| **
|
|
58
|
-
| **
|
|
59
|
-
| **
|
|
60
|
-
| **
|
|
61
|
-
| **Variant Combination** | `button({ color: 'primary', size: 'lg' })` |
|
|
62
|
-
| **Compile All Variants** | `button.compileAll()` |
|
|
28
|
+
| Feature | Description | Example |
|
|
29
|
+
|---------|-------------|---------|
|
|
30
|
+
| **Animation Presets** | Pre-built animations | `.fadeIn().duration('0.3s')` |
|
|
31
|
+
| **Math Helpers** | CSS calc() helpers | `$.width($.calc('100% - 20px'))` |
|
|
32
|
+
| **Design Tokens** | Centralized design values | `tokens.get('colors.primary')` |
|
|
33
|
+
| **Debug Mode** | Console debugging for styles | `$.debug().bg('red')` |
|
|
34
|
+
| **Source Comments** | Track style origins | `/* Generated from: nav.chain.js:15 */` |
|
|
35
|
+
| **Style Timeline** | Track style changes | `chaincss build --timeline` |
|
|
63
36
|
|
|
64
|
-
### Build
|
|
37
|
+
### 🏗️ Build System
|
|
65
38
|
|
|
66
39
|
| Feature | Command/Flag |
|
|
67
40
|
|---------|--------------|
|
|
68
|
-
| **CSS Compilation** | `chaincss
|
|
69
|
-
| **Watch Mode** |
|
|
70
|
-
| **
|
|
71
|
-
| **
|
|
72
|
-
| **Minification** |
|
|
73
|
-
| **
|
|
74
|
-
| **
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
|
83
|
-
|
|
84
|
-
| **
|
|
85
|
-
| **useDynamicChainStyles** | For dynamic styles with dependencies |
|
|
86
|
-
| **useThemeChainStyles** | For theme-aware styles |
|
|
87
|
-
| **ChainCSSGlobal** | Global style injection component |
|
|
88
|
-
| **withChainStyles** | HOC for class components |
|
|
89
|
-
| **cx** | Class name utility (like clsx) |
|
|
41
|
+
| **CSS Compilation** | `chaincss build` |
|
|
42
|
+
| **Watch Mode** | `chaincss watch` |
|
|
43
|
+
| **Config File** | `chaincss.config.js` |
|
|
44
|
+
| **Auto-prefixer** | Built-in via `--prefixer` |
|
|
45
|
+
| **Minification** | Global.css minified, components unminified |
|
|
46
|
+
| **TypeScript Support** | Full type definitions |
|
|
47
|
+
| **Source Maps** | For debugging |
|
|
48
|
+
|
|
49
|
+
### ⚛️ Framework Support
|
|
50
|
+
|
|
51
|
+
| Framework | Support |
|
|
52
|
+
|-----------|---------|
|
|
53
|
+
| **React** | ✅ `useChainStyles` hook, `createStyledComponent` |
|
|
54
|
+
| **Vue** | ✅ `useAtomicClasses` composable |
|
|
55
|
+
| **Solid** | ✅ Coming soon |
|
|
56
|
+
| **Svelte** | ✅ Coming soon |
|
|
57
|
+
| **Vanilla** | ✅ Runtime mode |
|
|
90
58
|
|
|
91
|
-
###
|
|
59
|
+
### 🔌 Plugins
|
|
92
60
|
|
|
93
61
|
| Plugin | Description |
|
|
94
62
|
|--------|-------------|
|
|
95
|
-
| **Vite
|
|
96
|
-
| **Webpack
|
|
97
|
-
| **Next.js
|
|
98
|
-
| **Webpack Loader** | ChainCSS loader for webpack |
|
|
63
|
+
| **Vite** | Automatic `.chain.js` compilation |
|
|
64
|
+
| **Webpack** | Build-time integration |
|
|
65
|
+
| **Next.js** | SSR support |
|
|
99
66
|
|
|
100
|
-
###
|
|
67
|
+
### 📁 File Structure
|
|
101
68
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
69
|
+
```
|
|
70
|
+
src/
|
|
71
|
+
├── components/
|
|
72
|
+
│ └── Button/
|
|
73
|
+
│ ├── Button.tsx
|
|
74
|
+
│ └── styles/
|
|
75
|
+
│ ├── button.chain.js # Source styles
|
|
76
|
+
│ ├── button.class.js # Generated class names
|
|
77
|
+
│ └── button.css # Generated CSS
|
|
78
|
+
├── global-style/
|
|
79
|
+
│ ├── global.chain.js # Global styles
|
|
80
|
+
│ └── global.css # Combined CSS
|
|
81
|
+
└── chaincss.config.js # Configuration
|
|
82
|
+
```
|
|
110
83
|
|
|
111
|
-
|
|
84
|
+
## 📦 Installation
|
|
112
85
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
| **Atomic CSS Output** | Reusable atomic classes |
|
|
117
|
-
| **Source Maps** | `.map` files for debugging |
|
|
118
|
-
| **Class Mapping** | Selector → atomic class map |
|
|
119
|
-
| **Minified Output** | Via CleanCSS |
|
|
120
|
-
| **Vendor Prefixing** | Via Autoprefixer |
|
|
86
|
+
```bash
|
|
87
|
+
npm install chaincss
|
|
88
|
+
```
|
|
121
89
|
|
|
122
|
-
|
|
90
|
+
## 🚀 Quick Start
|
|
123
91
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
92
|
+
### 1. Initialize configuration
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx chaincss init
|
|
96
|
+
# or for full configuration
|
|
97
|
+
npx chaincss init --full
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 2. Create your first style
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
// src/components/Button/styles/button.chain.js
|
|
104
|
+
import { $ } from 'chaincss';
|
|
105
|
+
|
|
106
|
+
export const button = $
|
|
107
|
+
.bg('#667eea')
|
|
108
|
+
.c('white')
|
|
109
|
+
.p('12px 24px')
|
|
110
|
+
.rounded('8px')
|
|
111
|
+
.cursor('pointer')
|
|
112
|
+
.hover()
|
|
113
|
+
.bg('#5a67d8')
|
|
114
|
+
.end()
|
|
115
|
+
.$el('.btn');
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 3. Build styles
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx chaincss build
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 4. Use in React
|
|
125
|
+
|
|
126
|
+
```jsx
|
|
127
|
+
import { button } from './styles/button.class.js';
|
|
128
|
+
import './styles/button.css';
|
|
129
|
+
|
|
130
|
+
function Button() {
|
|
131
|
+
return <button className={button}>Click me</button>;
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 📝 Examples
|
|
136
|
+
|
|
137
|
+
### Responsive Design
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
export const title = $
|
|
141
|
+
.fontSize('3rem')
|
|
142
|
+
.mobile(css => css.fontSize('1.5rem'))
|
|
143
|
+
.tablet(css => css.fontSize('2rem'))
|
|
144
|
+
.desktop(css => css.fontSize('2.5rem'))
|
|
145
|
+
.$el('.title');
|
|
146
|
+
```
|
|
131
147
|
|
|
132
|
-
###
|
|
148
|
+
### Animations
|
|
133
149
|
|
|
134
|
-
|
|
150
|
+
```javascript
|
|
151
|
+
export const card = $
|
|
152
|
+
.fadeInUp({ duration: '0.5s' })
|
|
153
|
+
.pulse({ duration: '2s', iteration: 'infinite' })
|
|
154
|
+
.bg('white')
|
|
155
|
+
.rounded('12px')
|
|
156
|
+
.$el('.card');
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Math Helpers
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
export const container = $
|
|
163
|
+
.width($.calc('100% - 40px'))
|
|
164
|
+
.padding($.add($.rem(2), $.px(10)))
|
|
165
|
+
.margin($.subtract('100vw', '20px'))
|
|
166
|
+
.$el('.container');
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Shorthand Properties
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
export const card = $
|
|
173
|
+
.bg('white')
|
|
174
|
+
.c('gray-800')
|
|
175
|
+
.p('20px')
|
|
176
|
+
.m('10px')
|
|
177
|
+
.rounded('8px')
|
|
178
|
+
.shadow('lg')
|
|
179
|
+
.$el('.card');
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## ⚙️ Configuration
|
|
183
|
+
|
|
184
|
+
Create `chaincss.config.js`:
|
|
185
|
+
|
|
186
|
+
```javascript
|
|
187
|
+
export default {
|
|
188
|
+
inputs: ['src/**/*.chain.js'],
|
|
189
|
+
output: 'dist/styles',
|
|
190
|
+
atomic: {
|
|
191
|
+
enabled: false, // Enable atomic CSS optimization
|
|
192
|
+
naming: 'readable' // or 'hash' for production
|
|
193
|
+
},
|
|
194
|
+
prefixer: {
|
|
195
|
+
enabled: true // Auto-prefixer for cross-browser support
|
|
196
|
+
},
|
|
197
|
+
breakpoints: {
|
|
198
|
+
mobile: '(max-width: 768px)',
|
|
199
|
+
tablet: '(min-width: 769px) and (max-width: 1024px)',
|
|
200
|
+
desktop: '(min-width: 1025px)'
|
|
201
|
+
},
|
|
202
|
+
debug: false,
|
|
203
|
+
verbose: false
|
|
204
|
+
};
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## 🎯 Runtime Mode (Optional)
|
|
208
|
+
|
|
209
|
+
For dynamic styles without build step:
|
|
210
|
+
|
|
211
|
+
```jsx
|
|
212
|
+
import { useChainStyles } from 'chaincss/runtime';
|
|
213
|
+
|
|
214
|
+
function DynamicButton() {
|
|
215
|
+
const styles = useChainStyles({
|
|
216
|
+
button: {
|
|
217
|
+
backgroundColor: '#667eea',
|
|
218
|
+
color: 'white',
|
|
219
|
+
padding: '12px 24px'
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
return <button className={styles.button}>Click me</button>;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 📊 CLI Commands
|
|
228
|
+
|
|
229
|
+
| Command | Description |
|
|
135
230
|
|---------|-------------|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
231
|
+
| `chaincss init` | Create config file |
|
|
232
|
+
| `chaincss init --full` | Create full config with all options |
|
|
233
|
+
| `chaincss build` | Build all styles |
|
|
234
|
+
| `chaincss build --timeline` | Build with timeline tracking |
|
|
235
|
+
| `chaincss watch` | Watch for changes |
|
|
236
|
+
| `chaincss clean` | Remove generated files |
|
|
237
|
+
|
|
238
|
+
## 🔧 Package.json Scripts
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"scripts": {
|
|
243
|
+
"dev": "concurrently \"npm:css:watch\" \"vite\"",
|
|
244
|
+
"build": "npm run css:build && vite build",
|
|
245
|
+
"css:build": "chaincss build",
|
|
246
|
+
"css:watch": "chaincss watch",
|
|
247
|
+
"css:clean": "chaincss clean"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 📚 Documentation
|
|
141
253
|
|
|
142
|
-
|
|
254
|
+
For complete guide, API reference, and examples:
|
|
143
255
|
|
|
144
|
-
|
|
145
|
-
just go to the docs section of [https://chaincss.dev](https://www.chaincss.dev)
|
|
256
|
+
### [Documentation](https://chaincss.dev/docs)
|
|
146
257
|
|
|
147
|
-
|
|
258
|
+
- [Getting Started](https://chaincss.dev/docs)
|
|
259
|
+
- [Chainable API](https://chaincss.dev/docs/chainable-api)
|
|
260
|
+
- [Responsive Design](https://chaincss.dev/docs/responsive)
|
|
261
|
+
- [Animations](https://chaincss.dev/docs/animations)
|
|
262
|
+
- [Configuration](https://chaincss.dev/docs/configuration)
|
|
263
|
+
|
|
264
|
+
## 🤝 Contributing
|
|
265
|
+
|
|
266
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md).
|
|
267
|
+
|
|
268
|
+
## 📄 License
|
|
148
269
|
|
|
149
270
|
MIT © [Rommel Caneos](https://github.com/melcanz08)
|
|
271
|
+
|
|
272
|
+
## 🌟 Star History
|
|
273
|
+
|
|
274
|
+
[](https://star-history.com/#melcanz08/chaincss&Date)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/compile.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuF3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAOA,wBAAsB,WAAW,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyGhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/timeline.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAkEjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0LvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|