@melcanz85/chaincss 1.9.0 → 1.9.2

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.
Files changed (2) hide show
  1. package/README.md +57 -72
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # ChainCSS
2
2
 
3
+ ![npm downloads](https://img.shields.io/npm/dm/@melcanz85/chaincss)
3
4
  [![npm version](https://img.shields.io/npm/v/@melcanz85/chaincss.svg)](https://www.npmjs.com/package/@melcanz85/chaincss)
4
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
6
 
@@ -36,7 +37,7 @@ ChainCSS is a revolutionary CSS-in-JS solution that gives you **two powerful mod
36
37
  **Perfect for:** Static styles, layouts, design systems — anything that doesn't change.
37
38
 
38
39
  ```javascript
39
- // chaincss/button.jcss
40
+ // src/button.jcss
40
41
  const button = $()
41
42
  .backgroundColor('#667eea')
42
43
  .color('white')
@@ -47,14 +48,9 @@ ChainCSS is a revolutionary CSS-in-JS solution that gives you **two powerful mod
47
48
  module.exports = { button };
48
49
  ````
49
50
 
50
- ```javascript
51
- // chaincss/processor.js
52
- const chaincss = require('@melcanz85/chaincss');
53
-
54
- chaincss.processor('./chaincss/main.jcss', './dist/style.css');
55
- // Outputs pure CSS: .btn { background: #667eea; color: white; ... }
56
- // Zero JavaScript sent to browser
57
- // Max performance, smallest bundle
51
+ ```bash
52
+ npx chaincss ./src/main.jcss ./style --watch & node server.js
53
+ # ./style/global.css generated!
58
54
  ````
59
55
  ### Mode 2: Runtime (React Hooks)
60
56
 
@@ -79,9 +75,11 @@ ChainCSS is a revolutionary CSS-in-JS solution that gives you **two powerful mod
79
75
 
80
76
  return <button className={styles.button}>{children}</button>;
81
77
  }
82
- // Styles injected at runtime
83
- // Automatic cleanup on unmount
84
- // Fully dynamic based on props
78
+ //Styles injected at runtime
79
+ //Automatic cleanup on unmount
80
+ //Fully dynamic based on props
81
+
82
+
85
83
  ```
86
84
 
87
85
  ## Use BOTH in the Same Project!
@@ -107,25 +105,25 @@ ChainCSS is a revolutionary CSS-in-JS solution that gives you **two powerful mod
107
105
 
108
106
  ## Features at a Glance
109
107
 
110
- Feature Status Description
108
+ Feature Status Description
111
109
 
112
- Zero Runtime ✅ Pure CSS output, no JS in browser
110
+ Zero Runtime ✅ Pure CSS output, no JS in browser
113
111
 
114
- React Hooks ✅ Dynamic runtime styles when needed
112
+ React Hooks ✅ Dynamic runtime styles when needed
115
113
 
116
- Atomic CSS ✅ 90% smaller CSS files
114
+ Atomic CSS ✅ 90% smaller CSS files
117
115
 
118
- TypeScript ✅ First-class type support
116
+ TypeScript ✅ First-class type support
119
117
 
120
- Design Tokens ✅ Centralized design system
118
+ Design Tokens ✅ Centralized design system
121
119
 
122
- Auto-prefixing ✅ Built-in + full Autoprefixer
120
+ Auto-prefixing ✅ Built-in + full Autoprefixer
123
121
 
124
- Source Maps ✅ Debug your .jcss files
122
+ Source Maps ✅ Debug your .jcss files
125
123
 
126
- Watch Mode ✅ Instant recompilation
124
+ Watch Mode ✅ Instant recompilation
127
125
 
128
- VM Security ✅ Safe code execution
126
+ VM Security ✅ Safe code execution
129
127
 
130
128
 
131
129
  ## The ChainCSS API
@@ -154,13 +152,13 @@ VM Security ✅ Safe code execution
154
152
 
155
153
  ```text
156
154
  your-project/
157
- ├── chaincss/
158
- │ ├── main.jcss # Entry point - imports & compiles
159
- │ ├── processor.cjs # Build script
160
- │ └── *.jcss # Your style definitions
155
+ ├── node_module
161
156
  ├── src/
162
- └── style/
163
- └── global.css # Generated CSS
157
+ ├── main.jcss # Entry point - imports & compiles
158
+ └── chain.jcss # Your style definitions
159
+
160
+ ├── style/
161
+ │ └── global.css # Generated CSS
164
162
  └── package.json
165
163
  ```
166
164
  ### Basic Example
@@ -187,15 +185,6 @@ VM Security ✅ Safe code execution
187
185
  @>
188
186
  ````
189
187
 
190
- **chaincss/processor.js**
191
-
192
- ```javascript
193
-
194
- const chaincss = require('@melcanz85/chaincss');
195
-
196
- chaincss.processor('./chaincss/main.jcss', './src/style');
197
- // Generates ./src/style/global.css
198
- ```
199
188
  ## Advanced Features
200
189
 
201
190
  ### Design Tokens
@@ -249,22 +238,19 @@ ChainCSS uses **secure VM sandboxing** to safely execute your .jcss files. No ev
249
238
  ### With Node.js (Vanilla)
250
239
 
251
240
  ```bash
252
- # 1. Install
253
- npm install @melcanz85/chaincss
254
-
255
- # 2. Create processor.cjs
256
- echo "const chaincss = require('@melcanz85/chaincss');
257
- chaincss.processor('./chaincss/main.jcss', './dist');" > processor.js
241
+ # 1. Install
242
+ npm install @melcanz85/chaincss
258
243
 
259
- # 3. Create your first .jcss file
260
- mkdir chaincss
261
- echo "const hello = $().color('red').block('.hello');
262
- compile({ hello });" > chaincss/main.jcss
244
+ # 2. Create your first .jcss file
245
+ mkdir chaincss
246
+ echo "const hello = $().color('red').block('.hello');
247
+ compile({ hello });" > chaincss/main.jcss
263
248
 
264
- # 4. Build
265
- node processor.js
266
- # ./dist/global.css generated!
249
+ # 3. Build
250
+ npx chaincss ./src/main.jcss ./style --watch & node server.js
251
+ # ./style/global.css generated!
267
252
  ```
253
+
268
254
  ### With React + Vite
269
255
 
270
256
  ```bash
@@ -278,6 +264,7 @@ ChainCSS uses **secure VM sandboxing** to safely execute your .jcss files. No ev
278
264
  # 3. Create component with styles
279
265
  mkdir -p src/components/Button
280
266
  ```
267
+
281
268
  **src/components/Button/Button.jsx**
282
269
 
283
270
  ```jsx
@@ -304,19 +291,19 @@ ChainCSS uses **secure VM sandboxing** to safely execute your .jcss files. No ev
304
291
 
305
292
  ## Performance Comparison
306
293
 
307
- Approach Runtime Cost Bundle Size Dynamic Styles Learning Curve
294
+ Approach Runtime Cost Bundle Size Dynamic Styles Learning Curve
308
295
 
309
- **ChainCSS (Build)** **Zero** **Just CSS** Build-time Low
296
+ **ChainCSS (Build)** **Zero** **Just CSS** Build-time Low
310
297
 
311
- **ChainCSS (Runtime)** Minimal Small runtime Full Low
298
+ **ChainCSS (Runtime)** Minimal Small runtime Full Low
312
299
 
313
- Styled Components 5-10KB runtime CSS + runtime Full Medium
300
+ Styled Components 5-10KB runtime CSS + runtime Full Medium
314
301
 
315
- Emotion 8-12KB runtime CSS + runtime Full Medium
302
+ Emotion 8-12KB runtime CSS + runtime Full Medium
316
303
 
317
- Tailwind Zero Just CSS ⚠️ Limited High
304
+ Tailwind Zero Just CSS Limited High
318
305
 
319
- CSS Modules Zero Just CSS None Low
306
+ CSS Modules Zero Just CSS None Low
320
307
 
321
308
  **ChainCSS is the ONLY library that gives you BOTH worlds!**
322
309
 
@@ -346,39 +333,38 @@ Create chaincss.config.js in your project root:
346
333
  };
347
334
  ```
348
335
 
349
-
350
336
  ## API Reference
351
337
 
352
338
  ### Core Functions
353
339
 
354
- Function Description
340
+ Function Description
355
341
 
356
- `$()` Create a new chain builder
342
+ `$()` Create a new chain builder
357
343
 
358
- `.block(selector)` End chain and assign selector(s)
344
+ `.block(selector)` End chain and assign selector(s)
359
345
 
360
- `compile(styles)` Compile style objects to CSS
346
+ `compile(styles)` Compile style objects to CSS
361
347
 
362
- `run(...styles)` Process inline styles
348
+ `run(...styles)` Process inline styles
363
349
 
364
- `get(filename)` Import .jcss files
350
+ `get(filename)` Import .jcss files
365
351
 
366
- `processor(input, output)` Build-time processor
352
+ `processor(input, output)` Build-time processor
367
353
 
368
354
 
369
355
  ### React Hooks
370
356
 
371
- Hook Description
357
+ Hook Description
372
358
 
373
- `useChainStyles(styles, options)` Basic styles hook
359
+ `useChainStyles(styles, options)` Basic styles hook
374
360
 
375
- `useDynamicChainStyles(factory, deps)` Styles that depend on props/state
361
+ `useDynamicChainStyles(factory, deps)` Styles that depend on props/state
376
362
 
377
- `useThemeChainStyles(styles, theme)` Theme-aware styles
363
+ `useThemeChainStyles(styles, theme)` Theme-aware styles
378
364
 
379
- `ChainCSSGlobal` Global styles component
365
+ `ChainCSSGlobal` Global styles component
380
366
 
381
- `cx(...classes)` Conditional class merging
367
+ `cx(...classes)` Conditional class merging
382
368
 
383
369
 
384
370
  ## Editor Support
@@ -405,7 +391,6 @@ Hook Description
405
391
  au BufRead,BufNewFile `*.jcss` setfiletype javascript
406
392
  ```
407
393
 
408
-
409
394
  ## Roadmap
410
395
 
411
396
  * Zero-runtime compilation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melcanz85/chaincss",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "A simple package transpiler for js to css",
5
5
  "main": "index.js",
6
6
  "module": "index.react.js",
@@ -40,7 +40,8 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "chokidar": "^3.5.3",
43
- "clean-css": "^5.3.3"
43
+ "clean-css": "^5.3.3",
44
+ "vm2": "^3.9.19"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "autoprefixer": "^10.0.0",