kulhadcss 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 +159 -0
- package/package.json +1 -1
- package/src/parser.js +100 -27
- package/demo/index.html +0 -17
- package/readme.md +0 -71
package/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# 🏺 KulhadCSS
|
|
2
|
+
|
|
3
|
+
A **Kadak** utility-first CSS engine brewed with pure Vanilla JS.
|
|
4
|
+
|
|
5
|
+
Apply layout, spacing, and styling beautifully using intuitive Indian terminology (Desi CSS)! KulhadCSS traverses your DOM, parsing classnames like `ghera-10` and `ghumaav-5` and rendering them instantly—without any CSS file or preprocessors.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
**Via NPM:**
|
|
10
|
+
```bash
|
|
11
|
+
npm install kulhadcss
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Via CDN (JSDelivr) in browser:**
|
|
15
|
+
```html
|
|
16
|
+
<script type="module">
|
|
17
|
+
import { scanDom } from 'https://cdn.jsdelivr.net/npm/kulhadcss/src/index.js';
|
|
18
|
+
</script>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## How It Works
|
|
22
|
+
|
|
23
|
+
KulhadCSS runs naturally in the browser without any bundler overhead:
|
|
24
|
+
1. **Parser:** Deconstructs unique class names (e.g., `ghera-10` into `padding: 40px`).
|
|
25
|
+
2. **Applier:** Scans through the DOM elements and applies the generated inline styles to the `style` object directly.
|
|
26
|
+
3. **Auto-Initialization:** It automatically listens to the `DOMContentLoaded` event, so all your styled elements are beautifully rendered once HTML is loaded.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## The Desi Dictionary
|
|
31
|
+
|
|
32
|
+
All dynamic utilities in KulhadCSS follow a strict 4-pixel base scale:
|
|
33
|
+
> **1 unit = 4px**
|
|
34
|
+
|
|
35
|
+
### Layout & Display Utilities (Static)
|
|
36
|
+
|
|
37
|
+
| Class Name | Equivalent CSS | Description |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `milkar` | `display: flex;` | Initializes a flex container |
|
|
40
|
+
| `jaali-hai` | `display: grid;` | Initializes a grid container |
|
|
41
|
+
| `beech` | `display: flex; justify-content: center; align-items: center;` | Perfectly centers the content |
|
|
42
|
+
| `gayab` | `display: none;` | Hides the element |
|
|
43
|
+
| `block` | `display: block;` | Block level element |
|
|
44
|
+
| `inline` | `display: inline;` | Inline element |
|
|
45
|
+
| `poora-parda` | `width: 100vw; height: 100vh;` | Takes the full viewport |
|
|
46
|
+
| `chipka-hua` | `position: sticky; top: 0;` | Sticky header |
|
|
47
|
+
| `shish-mahal` | `backdrop-filter: blur(12px)...` | Glassmorphism effect |
|
|
48
|
+
|
|
49
|
+
### Typography (Likhai)
|
|
50
|
+
|
|
51
|
+
| Class Prefix | Example | CSS Result | Support Values / Calculation |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| `likhai-size-{n}` | `likhai-size-16` | `font-size: 16px;` | Font size in px |
|
|
54
|
+
| `likhai-vazan-{v}` | `likhai-vazan-bhaari` | `font-weight: 700;` | `halka` (300), `theek` (400), `bhaari` (700), `zyada` (900) |
|
|
55
|
+
| `likhai-rang-{v}` | `likhai-rang-red` | `color: red;` | Any valid CSS color |
|
|
56
|
+
| `likhai-rukh-{v}` | `likhai-rukh-beech` | `text-align: center;` | `baayein` (left), `beech` (center), `daayein` (right), `patt-se` (justify) |
|
|
57
|
+
| `likhai-line-{n}` | `likhai-line-2` | `line-height: 2;` | Line height |
|
|
58
|
+
| `likhai-badi` | `likhai-badi` | `text-transform: uppercase;` | Uppercase |
|
|
59
|
+
| `likhai-choti`| `likhai-choti`| `text-transform: lowercase;` | Lowercase |
|
|
60
|
+
| `likhai-neeche`| `likhai-neeche`| `text-decoration: underline;`| Underline text |
|
|
61
|
+
| `likhai-kaato`| `likhai-kaato`| `text-decoration: line-through;`| Strikethrough text |
|
|
62
|
+
| `likhai-itallic`| `likhai-itallic`| `font-style: italic;`| Italic text |
|
|
63
|
+
| `likhai-seedhi`| `likhai-seedhi`| `font-style: normal;`| Normal text |
|
|
64
|
+
|
|
65
|
+
### Spacing (Ghera & Doori)
|
|
66
|
+
|
|
67
|
+
Padding (`ghera`) and Margin (`doori`) use the 1 unit = 4px multiplier.
|
|
68
|
+
|
|
69
|
+
| Feature | Prefix | Example | Calculation | CSS Result |
|
|
70
|
+
|---|---|---|---|---|
|
|
71
|
+
| Padding | `ghera-{n}` | `ghera-4` | 4 × 4px | `padding: 16px;` |
|
|
72
|
+
| Padding Top | `ghera-upar-{n}` | `ghera-upar-2` | 2 × 4px | `padding-top: 8px;` |
|
|
73
|
+
| Padding X | `ghera-x-{n}` | `ghera-x-5` | 5 × 4px | `padding-left: 20px; padding-right: 20px;` |
|
|
74
|
+
| Margin | `doori-{n}` | `doori-8` | 8 × 4px | `margin: 32px;` |
|
|
75
|
+
| Margin Auto | `doori-auto` | `doori-auto` | - | `margin: auto;` |
|
|
76
|
+
|
|
77
|
+
*(Available directional prefixes: `upar` (top), `neeche` (bottom), `baayein` (left), `daayein` (right), `x` (horizontal), `y` (vertical))*
|
|
78
|
+
|
|
79
|
+
### Backgrounds & Borders
|
|
80
|
+
|
|
81
|
+
| Class Prefix | Example | CSS Result | Note |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| `rang-piche-{v}` | `rang-piche-blue` | `background-color: blue;` | Any valid color |
|
|
84
|
+
| `ghumaav-{n}` | `ghumaav-5` | `border-radius: 20px;` | 5 × 4px. Use `gol` for fully rounded (`9999px`) |
|
|
85
|
+
| `lakheer-{n}` | `lakheer-2` | `border: 2px solid;` | Sets solid border with width |
|
|
86
|
+
| `lakheer-rang-{v}`| `lakheer-rang-red` | `border-color: red;` | Sets border color |
|
|
87
|
+
| `lakheer-style-{v}`| `lakheer-style-dashed`| `border-style: dashed;` | Sets border style |
|
|
88
|
+
|
|
89
|
+
### Flexbox & Grid
|
|
90
|
+
|
|
91
|
+
| Class Prefix | Example | CSS Result | Support Values |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| `dhancha-{v}` | `dhancha-khada` | `flex-direction: column;` | `khada` (column), row (default) |
|
|
94
|
+
| `faasla-{n}` | `faasla-4` | `gap: 16px;` | 4 × 4px |
|
|
95
|
+
| `milap-kaise-{v}`| `milap-kaise-beech` | `justify-content: center;`| `beech`, `door`, `aas-paas`, `chipak-ke`, `ant-mein` |
|
|
96
|
+
| `khada-milap-{v}`| `khada-milap-fail-ke`| `align-items: stretch;` | `beech`, `chipak-ke`, `neeche`, `fail-ke` |
|
|
97
|
+
| `lapait-{v}` | `lapait-haan` | `flex-wrap: wrap;` | `haan` (wrap), nowrap |
|
|
98
|
+
| `khali-jagah-{n}`| `khali-jagah-1`| `flex-grow: 1;` | Flex grow value |
|
|
99
|
+
| `dabna-{n}`| `dabna-0`| `flex-shrink: 0;` | Flex shrink value |
|
|
100
|
+
| `jaali-cols-{n}` | `jaali-cols-3` | `grid-template-columns: repeat(3, ...)`| Grid columns |
|
|
101
|
+
| `jaali-rows-{n}` | `jaali-rows-2` | `grid-template-rows: repeat(2, ...)`| Grid rows |
|
|
102
|
+
|
|
103
|
+
### Sizing
|
|
104
|
+
|
|
105
|
+
| Class Prefix | Example | CSS Result | Note |
|
|
106
|
+
|---|---|---|---|
|
|
107
|
+
| `chaudaai-{n}` | `chaudaai-10` | `width: 40px;` | Multiply by 4px. Use `poora` (100%) or `parda` (100vw) |
|
|
108
|
+
| `chaudaai-max-{n}`| `chaudaai-max-poora`| `max-width: 100%;`| Max Width |
|
|
109
|
+
| `lambai-{n}` | `lambai-20` | `height: 80px;` | Multiply by 4px. Use `poora` (100%) or `parda` (100vh) |
|
|
110
|
+
| `lambai-max-{n}` | `lambai-max-poora` | `max-height: 100%;` | Max Height |
|
|
111
|
+
|
|
112
|
+
### Effects & Interactive
|
|
113
|
+
|
|
114
|
+
| Class Prefix | Example | CSS Result | Explanation |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| `parchaayi-{n}` | `parchaayi-4` | `box-shadow: ...` | Box shadow. Append `-halki` for light shadow. |
|
|
117
|
+
| `dhundhla-{n}` | `dhundhla-5` | `opacity: 0.5;` | Divides n by 10 for opacity |
|
|
118
|
+
| `saaf-saaf-{n}`| `saaf-saaf-10` | `filter: blur(10px);`| Blur effect |
|
|
119
|
+
| `pakaayi-{n}`| `pakaayi-15` | `filter: brightness(1.5);`| Brightness effect |
|
|
120
|
+
| `shakal-{v}` | `shakal-video` | `aspect-ratio: 16/9;` | Aspect ratio: `square` (1/1), `video` (16/9), `khada` (9/16), `photo` (4/3) |
|
|
121
|
+
| `fit-kaise-{v}`| `fit-kaise-kheench-ke`| `object-fit: fill;`| Object fit: `bhar-do` (cover), `beech-mein` (contain), `kheench-ke` (fill) |
|
|
122
|
+
| `ungli-{v}` | `ungli-haan` | `cursor: pointer;` | Cursors: `haan`, `na`, `likhai`, `rok-do`, `khisko` |
|
|
123
|
+
| `raftaar-{v}` | `raftaar-tez` | `transition: all 150ms...`| Transition speeds: `tez` (150ms), `theek` (350ms), `haule` (800ms), `ekdum-slow` (2s) |
|
|
124
|
+
| `had-se-bahar-{v}`| `had-se-bahar-chupao`| `overflow: hidden;` | Overflow: `chupao` (hidden), `ghumaao` (auto) |
|
|
125
|
+
| `tikaana-{v}` | `tikaana-absolute` | `position: absolute;` | Position (absolute, relative, fixed, etc.) |
|
|
126
|
+
| `uunchai-{n}` | `uunchai-50` | `z-index: 50;` | Specifies z-index |
|
|
127
|
+
|
|
128
|
+
*(Position directions supported: `upar` (top), `neeche` (bottom), `baayein` (left), `daayein` (right))*
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Example Usage
|
|
133
|
+
|
|
134
|
+
Here is a quick example showcasing how you can build UIs with KulhadCSS!
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<!DOCTYPE html>
|
|
138
|
+
<html lang="en">
|
|
139
|
+
<head>
|
|
140
|
+
<meta charset="UTF-8">
|
|
141
|
+
<title>KulhadCSS Demo</title>
|
|
142
|
+
<script type="module">
|
|
143
|
+
import { scanDom } from 'https://cdn.jsdelivr.net/npm/kulhadcss/src/index.js';
|
|
144
|
+
</script>
|
|
145
|
+
</head>
|
|
146
|
+
<body style="background: #fdf5e6; margin: 0; min-height: 100vh;" class="beech">
|
|
147
|
+
<div class="milkar dhancha-khada beech ghera-10 ghumaav-5 parchaayi-2" style="background: #8b4513; color: white;">
|
|
148
|
+
<h1 class="doori-neeche-2 likhai-vazan-bhaari">🏺 KulhadCSS is Kadak!</h1>
|
|
149
|
+
<p class="likhai-size-14 dhundhla-8">Styling is now desi & simple.</p>
|
|
150
|
+
<button class="doori-upar-4 ghera-x-6 ghera-y-2 ghumaav-gol rang-piche-white likhai-rang-black ungli-haan raftaar-tez">
|
|
151
|
+
Piyo!
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
</body>
|
|
155
|
+
</html>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
[ISC](https://opensource.org/licenses/ISC) © Rachit
|
package/package.json
CHANGED
package/src/parser.js
CHANGED
|
@@ -1,36 +1,109 @@
|
|
|
1
1
|
const SCALE = 4;
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"justifyContent": "center",
|
|
8
|
-
"alignItems": "center"
|
|
9
|
-
}
|
|
3
|
+
const PARDAS = {
|
|
4
|
+
mobile: "(min-width: 640px)",
|
|
5
|
+
tab: "(min-width: 1024px)",
|
|
6
|
+
bade: "(min-width: 1280px)"
|
|
10
7
|
};
|
|
11
8
|
|
|
12
|
-
export function
|
|
9
|
+
export function parseKulhadClass(className) {
|
|
10
|
+
const staticStyles = {
|
|
11
|
+
"milkar": { display: "flex" },
|
|
12
|
+
"jaali-hai": { display: "grid" },
|
|
13
|
+
"beech": { display: "flex", justifyContent: "center", alignItems: "center" },
|
|
14
|
+
"gayab": { display: "none" },
|
|
15
|
+
"block": { display: "block" },
|
|
16
|
+
"inline": { display: "inline" },
|
|
17
|
+
"ungli-haan": { cursor: "pointer" },
|
|
18
|
+
"chuna-mana": { pointerEvents: "none" },
|
|
19
|
+
"likhai-neeche": { textDecoration: "underline" },
|
|
20
|
+
"likhai-kaato": { textDecoration: "line-through" },
|
|
21
|
+
"likhai-itallic": { fontStyle: "italic" },
|
|
22
|
+
"likhai-seedhi": { fontStyle: "normal" },
|
|
23
|
+
"chipka-hua": { position: "sticky", top: 0 },
|
|
24
|
+
"poora-parda": { width: "100vw", height: "100vh" },
|
|
25
|
+
"shish-mahal": { backdropFilter: "blur(12px)", backgroundColor: "rgba(255,255,255,0.1)" }
|
|
26
|
+
};
|
|
27
|
+
|
|
13
28
|
if (staticStyles[className]) return staticStyles[className];
|
|
14
29
|
const parts = className.split("-");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
const prefix = parts.slice(0, -1).join("-").toLowerCase();
|
|
31
|
+
const value = parts[parts.length - 1];
|
|
32
|
+
if (!prefix || !value) return null;
|
|
33
|
+
const numValue = Number(value);
|
|
34
|
+
const v = value.toLowerCase();
|
|
35
|
+
const rukhMap = { "baayein": "left", "beech": "center", "daayein": "right", "patt-se": "justify" };
|
|
36
|
+
const vazanMap = { "halka": "300", "theek": "400", "bhaari": "700", "zyada": "900" };
|
|
37
|
+
const milapMap = { "beech": "center", "door": "space-between", "aas-paas": "space-around", "chipak-ke": "flex-start", "ant-mein": "flex-end" };
|
|
38
|
+
const khadaMilapMap = { "beech": "center", "chipak-ke": "flex-start", "neeche": "flex-end", "fail-ke": "stretch" };
|
|
39
|
+
const raftaarMap = { "tez": "150ms", "theek": "350ms", "haule": "800ms", "ekdum-slow": "2000ms" };
|
|
40
|
+
const ungliMap = { "haan": "pointer", "na": "not-allowed", "likhai": "text", "rok-do": "wait", "khisko": "move" };
|
|
41
|
+
const shakalMap = { "square": "1/1", "video": "16/9", "khada": "9/16", "photo": "4/3" };
|
|
42
|
+
const fitMap = { "bhar-do": "cover", "beech-mein": "contain", "kheench-ke": "fill" };
|
|
43
|
+
|
|
20
44
|
switch (prefix) {
|
|
21
|
-
case "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
case "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
case "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
case "likhai-size": return { fontSize: isNaN(numValue) ? v : `${numValue}px` };
|
|
46
|
+
case "likhai-vazan": return { fontWeight: vazanMap[v] || v };
|
|
47
|
+
case "likhai-rang": return { color: v };
|
|
48
|
+
case "likhai-rukh": return { textAlign: rukhMap[v] || v };
|
|
49
|
+
case "likhai-line": return { lineHeight: isNaN(numValue) ? v : numValue };
|
|
50
|
+
case "likhai-space": return { letterSpacing: `${numValue}px` };
|
|
51
|
+
case "likhai-badi": return { textTransform: "uppercase" };
|
|
52
|
+
case "likhai-choti": return { textTransform: "lowercase" };
|
|
53
|
+
case "ghera": return { padding: `${numValue * SCALE}px` };
|
|
54
|
+
case "ghera-upar": return { paddingTop: `${numValue * SCALE}px` };
|
|
55
|
+
case "ghera-neeche": return { paddingBottom: `${numValue * SCALE}px` };
|
|
56
|
+
case "ghera-baayein": return { paddingLeft: `${numValue * SCALE}px` };
|
|
57
|
+
case "ghera-daayein": return { paddingRight: `${numValue * SCALE}px` };
|
|
58
|
+
case "ghera-x": return { paddingLeft: `${numValue * SCALE}px`, paddingRight: `${numValue * SCALE}px` };
|
|
59
|
+
case "ghera-y": return { paddingTop: `${numValue * SCALE}px`, paddingBottom: `${numValue * SCALE}px` };
|
|
60
|
+
case "doori": return { margin: `${numValue * SCALE}px` };
|
|
61
|
+
case "doori-upar": return { marginTop: `${numValue * SCALE}px` };
|
|
62
|
+
case "doori-neeche": return { marginBottom: `${numValue * SCALE}px` };
|
|
63
|
+
case "doori-baayein": return { marginLeft: `${numValue * SCALE}px` };
|
|
64
|
+
case "doori-daayein": return { marginRight: `${numValue * SCALE}px` };
|
|
65
|
+
case "doori-x": return { marginLeft: `${numValue * SCALE}px`, marginRight: `${numValue * SCALE}px` };
|
|
66
|
+
case "doori-y": return { marginTop: `${numValue * SCALE}px`, marginBottom: `${numValue * SCALE}px` };
|
|
67
|
+
case "doori-auto": return { margin: "auto" };
|
|
68
|
+
case "rang-piche": return { backgroundColor: v };
|
|
69
|
+
case "lakheer": return { borderWidth: `${numValue}px`, borderStyle: "solid" };
|
|
70
|
+
case "lakheer-rang": return { borderColor: v };
|
|
71
|
+
case "lakheer-style": return { borderStyle: v };
|
|
72
|
+
case "ghumaav": return { borderRadius: v === "gol" ? "9999px" : `${numValue * SCALE}px` };
|
|
73
|
+
case "ghumaav-upar": return { borderTopLeftRadius: `${numValue * SCALE}px`, borderTopRightRadius: `${numValue * SCALE}px` };
|
|
74
|
+
case "ghumaav-neeche": return { borderBottomLeftRadius: `${numValue * SCALE}px`, borderBottomRightRadius: `${numValue * SCALE}px` };
|
|
75
|
+
case "faasla": return { gap: `${numValue * SCALE}px` };
|
|
76
|
+
case "faasla-x": return { columnGap: `${numValue * SCALE}px` };
|
|
77
|
+
case "faasla-y": return { rowGap: `${numValue * SCALE}px` };
|
|
78
|
+
case "dhancha": return { flexDirection: v === "khada" ? "column" : "row" };
|
|
79
|
+
case "milap-kaise": return { justifyContent: milapMap[v] || v };
|
|
80
|
+
case "khada-milap": return { alignItems: khadaMilapMap[v] || v };
|
|
81
|
+
case "lapait": return { flexWrap: v === "haan" ? "wrap" : "nowrap" };
|
|
82
|
+
case "khali-jagah": return { flexGrow: numValue };
|
|
83
|
+
case "dabna": return { flexShrink: numValue };
|
|
84
|
+
case "jaali-cols": return { gridTemplateColumns: `repeat(${numValue}, minmax(0, 1fr))` };
|
|
85
|
+
case "jaali-rows": return { gridTemplateRows: `repeat(${numValue}, minmax(0, 1fr))` };
|
|
86
|
+
case "chaudaai": return { width: v === "poora" ? "100%" : (v === "parda" ? "100vw" : `${numValue * SCALE}px`) };
|
|
87
|
+
case "chaudaai-max": return { maxWidth: v === "poora" ? "100%" : `${numValue * SCALE}px` };
|
|
88
|
+
case "lambai": return { height: v === "poora" ? "100%" : (v === "parda" ? "100vh" : `${numValue * SCALE}px`) };
|
|
89
|
+
case "lambai-max": return { maxHeight: v === "poora" ? "100%" : `${numValue * SCALE}px` };
|
|
90
|
+
case "tikaana": return { position: v };
|
|
91
|
+
case "upar": return { top: `${numValue * SCALE}px` };
|
|
92
|
+
case "neeche": return { bottom: `${numValue * SCALE}px` };
|
|
93
|
+
case "baayein": return { left: `${numValue * SCALE}px` };
|
|
94
|
+
case "daayein": return { right: `${numValue * SCALE}px` };
|
|
95
|
+
case "uunchai": return { zIndex: numValue };
|
|
96
|
+
case "parchaayi": return { boxShadow: `0px ${numValue}px ${numValue * 3}px rgba(0,0,0,${v === "halki" ? 0.1 : 0.25})` };
|
|
97
|
+
case "dhundhla": return { opacity: numValue / 10 };
|
|
98
|
+
case "saaf-saaf": return { filter: `blur(${numValue}px)` };
|
|
99
|
+
case "pakaayi": return { filter: `brightness(${numValue / 10})` };
|
|
100
|
+
case "shakal": return { aspectRatio: shakalMap[v] || v };
|
|
101
|
+
case "fit-kaise": return { objectFit: fitMap[v] || v };
|
|
102
|
+
case "ungli": return { cursor: ungliMap[v] || v };
|
|
103
|
+
case "raftaar": return { transition: `all ${raftaarMap[v] || v} ease-in-out` };
|
|
104
|
+
case "had-se-bahar": return { overflow: v === "chupao" ? "hidden" : (v === "ghumaao" ? "auto" : v) };
|
|
105
|
+
case "had-se-bahar-x": return { overflowX: v === "chupao" ? "hidden" : "auto" };
|
|
106
|
+
case "had-se-bahar-y": return { overflowY: v === "chupao" ? "hidden" : "auto" };
|
|
107
|
+
default: return null;
|
|
35
108
|
}
|
|
36
109
|
}
|
package/demo/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>KulhadCSS Test</title>
|
|
6
|
-
<script type="module">
|
|
7
|
-
import { scanDom } from 'https://cdn.jsdelivr.net/npm/kulhadcss/src/index.js';
|
|
8
|
-
</script>
|
|
9
|
-
</head>
|
|
10
|
-
<body style="background: #fdf5e6; ">
|
|
11
|
-
|
|
12
|
-
<div class="milkar beech malai-10 ghumaav-5" style="background: #8b4513; color: white;"">
|
|
13
|
-
<h1 class="doori-2">🏺 KulhadCSS is Live!</h1>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
package/readme.md
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# 🏺 KulhadCSS
|
|
2
|
-
|
|
3
|
-
A **Kadak** utility-first CSS engine brewed with pure Vanilla JS.
|
|
4
|
-
|
|
5
|
-
Apply layout, spacing, and styling beautifully using intuitive Indian terminology! KulhadCSS traverses your DOM, parsing classnames like `malai-10` and `ghumaav-5` and rendering them instantly—without any CSS file or preprocessors.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
**Via NPM:**
|
|
10
|
-
```bash
|
|
11
|
-
npm install kulhadcss
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
**Via CDN (JSDelivr) in browser:**
|
|
15
|
-
```html
|
|
16
|
-
<script type="module">
|
|
17
|
-
import { scanDom } from 'https://cdn.jsdelivr.net/npm/kulhadcss/src/index.js';
|
|
18
|
-
</script>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## How It Works
|
|
22
|
-
|
|
23
|
-
KulhadCSS runs naturally in the browser without any bundler overhead:
|
|
24
|
-
1. **Parser:** Deconstructs unique class names (e.g., `malai-10` into `padding: 40px`).
|
|
25
|
-
2. **Applier:** Scans through the DOM elements and applies the generated inline styles to the `style` object directly.
|
|
26
|
-
3. **Auto-Initialization:** It automatically listens to the `DOMContentLoaded` event, so all your styled elements are beautifully rendered once HTML is loaded.
|
|
27
|
-
|
|
28
|
-
## The Desi Dictionary
|
|
29
|
-
|
|
30
|
-
All dynamic utilities in KulhadCSS follow a strict 4-pixel base scale:
|
|
31
|
-
> **1 unit = 4px**
|
|
32
|
-
|
|
33
|
-
### Layout Utilities (Static)
|
|
34
|
-
|
|
35
|
-
| Class Name | CSS Property | Description |
|
|
36
|
-
|---|---|---|
|
|
37
|
-
| `milkar` | `display: flex;` | Initializes a flex container |
|
|
38
|
-
| `beech` | `display: flex; justify-content: center; align-items: center;` | Perfectly centers the content |
|
|
39
|
-
|
|
40
|
-
### Spacing & Visual Utilities (Dynamic)
|
|
41
|
-
|
|
42
|
-
| Class Prefix | CSS Property | Example | Calculation |
|
|
43
|
-
|---|---|---|---|
|
|
44
|
-
| `malai-{n}` | `padding` | `malai-4` | 4 × 4 = **16px** |
|
|
45
|
-
| `doori-{n}` | `margin` | `doori-8` | 8 × 4 = **32px** |
|
|
46
|
-
| `ghumaav-{n}` | `border-radius` | `ghumaav-5` | 5 × 4 = **20px** |
|
|
47
|
-
|
|
48
|
-
## Example Usage
|
|
49
|
-
|
|
50
|
-
Here is a quick example showcasing how you can build UIs with KulhadCSS!
|
|
51
|
-
|
|
52
|
-
```html
|
|
53
|
-
<!DOCTYPE html>
|
|
54
|
-
<html lang="en">
|
|
55
|
-
<head>
|
|
56
|
-
<meta charset="UTF-8">
|
|
57
|
-
<title>KulhadCSS Demo</title>
|
|
58
|
-
<script type="module">
|
|
59
|
-
import { scanDom } from 'https://cdn.jsdelivr.net/npm/kulhadcss/src/index.js';
|
|
60
|
-
</script>
|
|
61
|
-
</head>
|
|
62
|
-
<body style="background: #fdf5e6; margin: 0; min-height: 100vh;" class="beech">
|
|
63
|
-
<div class="milkar beech malai-10 ghumaav-5" style="background: #8b4513; color: white;">
|
|
64
|
-
<h1 class="doori-2">🏺 KulhadCSS is Live!</h1>
|
|
65
|
-
</div>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
[ISC](https://opensource.org/licenses/ISC) © Rachit
|