teawindcss 1.0.0 → 1.0.1

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 (3) hide show
  1. package/README.md +39 -2
  2. package/package.json +2 -1
  3. package/teawind.js +6 -1
package/README.md CHANGED
@@ -6,6 +6,8 @@ CSS can be incredibly stressful. Centering a div, fighting specificity, and mana
6
6
 
7
7
  That's exactly why every class in this library starts with the prefix `chai-`. It's a built-in reminder: whenever you're styling your app and things get overwhelming, take a deep breath, take a sip of **chai (tea)** ☕️, and calm down. We've got the styles covered.
8
8
 
9
+
10
+ 🌐 **Live Demo & Full Documentation:** [Visit the TeaWind Showcase](https://preetmax85.github.io/teawindcss/)
9
11
  ---
10
12
 
11
13
  ## What is TeaWind?
@@ -34,11 +36,46 @@ npm install teawindcss
34
36
 
35
37
  ## ⚡️ Quick Start
36
38
 
37
- ### HTML / Vanilla JS
39
+ ### HTML / Vanilla JS (no bundler)
40
+
41
+ The simplest way. Load the script directly — no import needed.
42
+ ```html
43
+ <script src="./node_modules/teawindcss/teawind.js"></script>
44
+ ```
45
+
46
+ TeaWind auto-initializes on `DOMContentLoaded`. Just write your classes and it handles the rest:
47
+ ```html
48
+ <div class="chai-flex chai-p-16 chai-bg-blue-dark chai-rounded-xl">
49
+ <h1 class="chai-text-3xl chai-font-bold chai-text-white">Hello TeaWind</h1>
50
+ </div>
51
+ ```
52
+
53
+ ---
38
54
 
39
- Just import the package once. TeaWind auto-initializes and processes the entire DOM on load.
55
+ ### ES Modules
40
56
 
57
+ If you want to use a module script tag or import statement:
58
+ ```html
59
+ <script type="module" src="main.js"></script>
60
+ ```
41
61
  ```javascript
62
+ // main.js
63
+ import 'teawindcss'; // auto-initializes. done.
64
+ ```
65
+
66
+ Or with manual control via `brew()`:
67
+ ```javascript
68
+ import { brew } from 'teawindcss';
69
+ brew();
70
+ ```
71
+
72
+ ---
73
+
74
+ ### React (Vite / Create React App)
75
+
76
+ Import once at the root. The built-in `MutationObserver` handles all dynamic renders automatically — no `useEffect` needed anywhere.
77
+ ```jsx
78
+ // main.jsx
42
79
  import 'teawindcss';
43
80
  ```
44
81
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "teawindcss",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A lightweight utility-first CSS engine for the browser",
5
5
  "main": "teawind.js",
6
+ "homepage": "https://preetmax85.github.io/teawindcss",
6
7
  "files": [
7
8
  "teawind.js",
8
9
  "README.md"
package/teawind.js CHANGED
@@ -73,6 +73,7 @@ const stylesDictionary = {
73
73
  "chai-border-red": "border-color: red",
74
74
  "chai-border-green": "border-color: green",
75
75
  "chai-border-blue": "border-color: blue",
76
+ "chai-border-subtle": "border-color: #292929",
76
77
  "chai-border-solid": "border-style: solid",
77
78
  "chai-border-dashed": "border-style: dashed",
78
79
  "chai-border-dotted": "border-style: dotted",
@@ -251,6 +252,7 @@ class TeaWind {
251
252
  const multipleClasses = [...e.classList];
252
253
  multipleClasses.forEach(c => {
253
254
  if (!c.startsWith(this.prefix)) return;
255
+
254
256
  const styleString = this.resolveClass(c);
255
257
  if (styleString) {
256
258
  e.style.cssText += styleString;
@@ -262,7 +264,6 @@ class TeaWind {
262
264
  return count;
263
265
  }
264
266
 
265
- // DOM Scanner and Injector
266
267
  init() {
267
268
  const startTime = performance.now();
268
269
  let parsedCount = 0;
@@ -275,6 +276,10 @@ class TeaWind {
275
276
 
276
277
  const endTime = performance.now();
277
278
  console.log(`🍵 TeaWind initialized in ${(endTime - startTime).toFixed(2)}ms. Processed ${parsedCount} utility classes.`);
279
+
280
+ if (typeof document !== 'undefined' && document.body) {
281
+ document.body.style.visibility = 'visible';
282
+ }
278
283
 
279
284
  const observer = new MutationObserver((mutations) => {
280
285
  mutations.forEach(mutation => {