tadka-css 1.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/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/tadka-css.cjs.js +1385 -0
- package/dist/tadka-css.cjs.js.map +1 -0
- package/dist/tadka-css.esm.js +1383 -0
- package/dist/tadka-css.esm.js.map +1 -0
- package/dist/tadka-css.js +1391 -0
- package/dist/tadka-css.js.map +1 -0
- package/dist/tadka-css.min.js +1 -0
- package/package.json +45 -0
- package/types/index.d.ts +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# tadka-css
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
Add spice to your styles. Utility-first CSS engine in vanilla JS.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install tadka-css
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<script src="https://unpkg.com/tadka-css/dist/tadka-css.js"></script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add tadka-css
|
|
22
|
+
pnpm add tadka-css
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<div class="tadka-p-4 tadka-bg-blue-500 tadka-text-white tadka-rounded-lg">
|
|
29
|
+
Hello World
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<script type="module">
|
|
33
|
+
import TadkaCSS from "tadka-css";
|
|
34
|
+
TadkaCSS.init();
|
|
35
|
+
</script>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## How It Works
|
|
39
|
+
|
|
40
|
+
- Scans the DOM for classes prefixed with `tadka-`.
|
|
41
|
+
- Tokenizes each class and resolves it to a JS style object.
|
|
42
|
+
- Applies styles inline, and injects responsive rules into a runtime `<style>` tag.
|
|
43
|
+
|
|
44
|
+
## API Reference
|
|
45
|
+
|
|
46
|
+
| Method | Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `init(options)` | Initialize engine, scan DOM, and start observer |
|
|
49
|
+
| `refresh()` | Re-scan DOM |
|
|
50
|
+
| `apply(element)` | Apply to one element |
|
|
51
|
+
| `applyAll(nodeList)` | Apply to many elements |
|
|
52
|
+
| `parse(className)` | Return parsed style object |
|
|
53
|
+
| `register(name, styles)` | Add custom utility |
|
|
54
|
+
| `unregister(name)` | Remove custom utility |
|
|
55
|
+
| `getConfig()` | Get active config |
|
|
56
|
+
| `setConfig(options)` | Merge new config |
|
|
57
|
+
| `reset()` | Remove generated styles and listeners |
|
|
58
|
+
| `on(event, handler)` | Listen to `ready`, `apply`, `parse-error`, `refresh` |
|
|
59
|
+
|
|
60
|
+
## init() Options
|
|
61
|
+
|
|
62
|
+
| Option | Type | Default |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `prefix` | `string` | `tadka` |
|
|
65
|
+
| `scale` | `number` | `4` |
|
|
66
|
+
| `removeClasses` | `boolean` | `false` |
|
|
67
|
+
| `watch` | `boolean` | `true` |
|
|
68
|
+
| `breakpoints` | `object` | `sm/md/lg/xl/2xl` |
|
|
69
|
+
| `extend` | `object` | `{}` |
|
|
70
|
+
| `colors` | `object` | generated 22-color palette |
|
|
71
|
+
|
|
72
|
+
## Utility Cheatsheet
|
|
73
|
+
|
|
74
|
+
- Spacing: `tadka-p-4`, `tadka-mx-auto`, `tadka-gap-6`, `tadka-p-[13px]`
|
|
75
|
+
- Colors: `tadka-bg-orange-500`, `tadka-text-slate-900`, `tadka-border-blue-300`
|
|
76
|
+
- Layout: `tadka-flex`, `tadka-items-center`, `tadka-grid`, `tadka-grid-cols-3`
|
|
77
|
+
- Typography: `tadka-text-2xl`, `tadka-font-bold`, `tadka-underline`
|
|
78
|
+
|
|
79
|
+
## Responsive Usage
|
|
80
|
+
|
|
81
|
+
| Prefix | Min Width |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `tadka-sm:` | `640px` |
|
|
84
|
+
| `tadka-md:` | `768px` |
|
|
85
|
+
| `tadka-lg:` | `1024px` |
|
|
86
|
+
| `tadka-xl:` | `1280px` |
|
|
87
|
+
| `tadka-2xl:` | `1536px` |
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<div class="tadka-w-full tadka-lg:w-1/2 tadka-xl:w-1/4"></div>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Interactivity Prefixes
|
|
94
|
+
|
|
95
|
+
- `tadka-hover:*`
|
|
96
|
+
- `tadka-focus:*`
|
|
97
|
+
- `tadka-active:*`
|
|
98
|
+
- `tadka-group-hover:*`
|
|
99
|
+
- `tadka-disabled:*`
|
|
100
|
+
- `tadka-checked:*`
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<button class="tadka-bg-orange-500 tadka-hover:bg-orange-700 tadka-active:scale-95">
|
|
104
|
+
Hover me
|
|
105
|
+
</button>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Extending tadka-css
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
import TadkaCSS from "tadka-css";
|
|
112
|
+
|
|
113
|
+
TadkaCSS.init({
|
|
114
|
+
extend: {
|
|
115
|
+
spicy: { color: "#E8550A", fontWeight: "800" },
|
|
116
|
+
btn: (value) => ({
|
|
117
|
+
padding: `${value * 0.25}rem ${value * 0.5}rem`,
|
|
118
|
+
borderRadius: "6px",
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
121
|
+
colors: {
|
|
122
|
+
masala: { 500: "#7B3F00", 300: "#C17F3C", 100: "#F5E6D0" },
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Arbitrary Values
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<div class="tadka-p-[13px] tadka-w-[420px] tadka-bg-[#FF5733]"></div>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
git clone https://github.com/your-username/tadka-css.git
|
|
137
|
+
cd tadka-css
|
|
138
|
+
npm install
|
|
139
|
+
npm run build
|
|
140
|
+
npm test
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Demo
|
|
144
|
+
|
|
145
|
+
- Main demo: [demo/index.html](demo/index.html)
|
|
146
|
+
- Playground: [demo/playground/index.html](demo/playground/index.html)
|
|
147
|
+
|
|
148
|
+
## Contributing
|
|
149
|
+
|
|
150
|
+
Issues and PRs are welcome. Please run tests before opening a PR.
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
MIT
|