chi-css-engine 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -1,16 +1,133 @@
1
- # Chai CSS
1
+ Chai CSS Engine
2
2
 
3
- A lightweight utility-first CSS engine written in JavaScript.
3
+ A lightweight utility-first CSS engine built with vanilla JavaScript.
4
+ Chai CSS dynamically scans the DOM, parses chai-\* utility classes, and applies corresponding inline styles at runtime — inspired by utility-first CSS frameworks.
4
5
 
5
- ## Installation
6
+ 🚀 Features
7
+ ❌ No CSS files required
8
+ ❌ No build step
9
+ ❌ No dependencies
10
+ ✅ Pure JavaScript
11
+ ✅ Utility-first class syntax
12
+ ✅ Automatic DOM scanning
13
+ ✅ Works with npm and CDN
14
+ ✅ Easy to extend and customize
15
+ 📦 Installation (npm)
16
+ npm install chi-css-engine
17
+ 🔧 Usage (npm / Vite / Bundlers)
18
+ 1️⃣ Import the package
19
+ import "chi-css-engine";
6
20
 
7
- npm install chai-css-engine
21
+ ⚠️ No function call required.
22
+ The engine runs automatically after DOMContentLoaded.
8
23
 
9
- ## Usage
24
+ 2️⃣ Use utility classes in HTML
10
25
 
11
- import chaiCSS from "chai-css";
12
- chaiCSS();
26
+ <div class="chai-p-3 chai-bg-blue chai-text-center chai-rounded-md">
27
+ Hello Chai CSS ☕
28
+ </div>
29
+ 🌐 Usage via CDN (No Build Tools)
13
30
 
14
- ## Example
31
+ If you are not using npm or a bundler, include the CDN directly:
15
32
 
16
- <div class="chai-p-2 chai-bg-red">Hello</div>
33
+ <script src="https://unpkg.com/chi-css-engine@latest"></script>
34
+
35
+ Full CDN Example
36
+
37
+ <!DOCTYPE html>
38
+ <html>
39
+ <head>
40
+ <title>Chai CSS CDN Demo</title>
41
+ </head>
42
+ <body>
43
+
44
+ <div class="chai-p-3 chai-bg-blue chai-text-center chai-rounded-md">
45
+ Hello Chai CSS ☕
46
+ </div>
47
+
48
+ <script src="https://unpkg.com/chi-css-engine@latest"></script>
49
+ </body>
50
+ </html>
51
+
52
+ ✅ No Node.js
53
+ ✅ No npm
54
+ ✅ No bundler
55
+
56
+ 🧠 How It Works
57
+ Waits for DOMContentLoaded
58
+ Traverses all DOM elements
59
+ Detects class names starting with chai-
60
+ Parses utility patterns
61
+ Applies inline styles dynamically
62
+ 📐 Supported Utilities
63
+ 🧱 Spacing
64
+ Class Effect
65
+ chai-p-0 padding: 0px
66
+ chai-p-1 padding: 4px
67
+ chai-p-2 padding: 8px
68
+ chai-p-3 padding: 12px
69
+ chai-p-4 padding: 16px
70
+ chai-m-2 margin: 8px
71
+ 🎨 Colors
72
+ Class Effect
73
+ chai-bg-red background-color: red
74
+ chai-bg-blue background-color: blue
75
+ chai-text-black color: black
76
+
77
+ ✔ Any valid CSS color value is supported.
78
+
79
+ ✍ Typography
80
+ Text Alignment
81
+ Class Effect
82
+ chai-text-center text-align: center
83
+ chai-text-left text-align: left
84
+ chai-text-right text-align: right
85
+ Font Size
86
+ Class Font Size
87
+ chai-text-sm 12px
88
+ chai-text-md 16px
89
+ chai-text-lg 18px
90
+ chai-text-xl 24px
91
+ 🧩 Borders
92
+ Class Effect
93
+ chai-border-1 1px solid black
94
+ chai-border-2 2px solid black
95
+ 🔵 Border Radius
96
+ Class Radius
97
+ chai-rounded-sm 4px
98
+ chai-rounded-md 6px
99
+ chai-rounded-lg 12px
100
+ chai-rounded-10 10px
101
+ 📦 Layout Utilities
102
+ Class Effect
103
+ chai-flex display: flex
104
+ chai-items-center align-items: center
105
+ chai-justify-center justify-content: center
106
+ 🧪 Example Layout
107
+
108
+ <div class="chai-flex chai-justify-center chai-items-center chai-p-4 chai-bg-gray">
109
+ <p class="chai-text-lg chai-text-center">
110
+ Centered Content
111
+ </p>
112
+ </div>
113
+ 🛠 Customization
114
+
115
+ You can extend Chai CSS by modifying:
116
+
117
+ spacingScale
118
+ fontSizeMap
119
+ radiusMap
120
+
121
+ Add new rules inside the applyUtility() switch to support additional utilities.
122
+
123
+ ⚠️ Limitations
124
+ Uses inline styles (overrides external CSS)
125
+ No responsive utilities (yet)
126
+ No hover / pseudo-class support (yet)
127
+ 📄 License
128
+
129
+ MIT License © 2026
130
+
131
+ ⭐ Author
132
+
133
+ Built with ☕ by Nitesh Shedge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chi-css-engine",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Lightweight utility-first CSS engine",
5
5
  "keywords": [
6
6
  "\"css\"",
package/test/index.html DELETED
File without changes
@@ -1,12 +0,0 @@
1
- {
2
- "lockfileVersion": 3,
3
- "requires": true,
4
- "packages": {
5
- "node_modules/chi-css-engine": {
6
- "version": "1.0.0",
7
- "resolved": "https://registry.npmjs.org/chi-css-engine/-/chi-css-engine-1.0.0.tgz",
8
- "integrity": "sha512-4Yuy7XvbtpJ2e60GfmH44AO4yfJzRx6547knHg4quJd0eGM0UFySNPq0GSJfoXLYCKIcr3csVqvAAApBoL5zng==",
9
- "license": "MIT"
10
- }
11
- }
12
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 nitesh011y
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,16 +0,0 @@
1
- # Chai CSS ☕
2
-
3
- A lightweight utility-first CSS engine written in JavaScript.
4
-
5
- ## Installation
6
-
7
- npm install chai-css
8
-
9
- ## Usage
10
-
11
- import chaiCSS from "chai-css";
12
- chaiCSS();
13
-
14
- ## Example
15
-
16
- <div class="chai-p-2 chai-bg-red">Hello</div>
@@ -1,94 +0,0 @@
1
- const spacingScale = {
2
- 0: "0px",
3
- 1: "4px",
4
- 2: "8px",
5
- 3: "12px",
6
- 4: "16px",
7
- };
8
-
9
- const fontSizeMap = {
10
- sm: "12px",
11
- md: "16px",
12
- lg: "18px",
13
- xl: "24px",
14
- };
15
-
16
- const radiusMap = {
17
- sm: "4px",
18
- md: "6px",
19
- lg: "12px",
20
- };
21
-
22
- document.addEventListener("DOMContentLoaded", () => {
23
- const elements = document.querySelectorAll("*");
24
-
25
- elements.forEach((el) => {
26
- [...el.classList].forEach((className) => {
27
- if (!className.startsWith("chai-")) return;
28
-
29
- const parts = className.replace("chai-", "").split("-");
30
-
31
- applyUtility(el, parts);
32
- });
33
- });
34
- });
35
-
36
- function applyUtility(el, parts) {
37
- const [type, value] = parts;
38
-
39
- switch (type) {
40
- /* SPACING */
41
- case "p":
42
- el.style.padding = spacingScale[value] || value + "px";
43
- break;
44
-
45
- case "m":
46
- el.style.margin = spacingScale[value] || value + "px";
47
- break;
48
-
49
- /* COLORS */
50
- case "bg":
51
- el.style.backgroundColor = value;
52
- break;
53
-
54
- case "text":
55
- if (value === "center" || value === "left" || value === "right") {
56
- el.style.textAlign = value;
57
- } else {
58
- el.style.color = value;
59
- }
60
- break;
61
-
62
- /* TYPOGRAPHY */
63
- case "text":
64
- if (fontSizeMap[value]) {
65
- el.style.fontSize = fontSizeMap[value];
66
- }
67
- break;
68
-
69
- /* BORDERS */
70
- case "border":
71
- el.style.border = `${value}px solid black`;
72
- break;
73
-
74
- case "rounded":
75
- el.style.borderRadius = radiusMap[value] || value + "px";
76
- break;
77
-
78
- /* LAYOUT */
79
- case "flex":
80
- el.style.display = "flex";
81
- break;
82
-
83
- case "items":
84
- el.style.alignItems = value;
85
- break;
86
-
87
- case "justify":
88
- el.style.justifyContent = value;
89
- break;
90
-
91
- default:
92
- console.warn("Unknown utility:", parts.join("-"));
93
- }
94
- }
@@ -1,26 +0,0 @@
1
- {
2
- "name": "chi-css-engine",
3
- "version": "1.0.0",
4
- "description": "Lightweight utility-first CSS engine",
5
- "keywords": [
6
- "\"css\"",
7
- "\"utility\"",
8
- "\"tailwind\"",
9
- "\"dom\""
10
- ],
11
- "homepage": "https://github.com/nitesh011y/Chai-tailwind#readme",
12
- "bugs": {
13
- "url": "https://github.com/nitesh011y/Chai-tailwind/issues"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/nitesh011y/Chai-tailwind.git"
18
- },
19
- "license": "MIT",
20
- "author": "nitesh011y",
21
- "type": "commonjs",
22
- "main": "index.js",
23
- "scripts": {
24
- "test": "echo \"Error: no test specified\" && exit 1"
25
- }
26
- }
package/test/package.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "name": "test",
3
- "version": "1.0.0",
4
- "main": "index.js",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
7
- },
8
- "keywords": [],
9
- "author": "",
10
- "license": "ISC",
11
- "type": "commonjs",
12
- "description": "",
13
- "dependencies": {
14
- "chi-css-engine": "^1.0.0"
15
- }
16
- }