@gaurav009/chai-ui 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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gaurav009/chai-ui",
3
- "version": "1.0.0",
4
- "description": "A lightweight, **JavaScript-powered utility-first styling library** that brings a warm, chai-inspired design system to the browser — without any build tools.",
3
+ "version": "1.0.1",
4
+ "description": "Old-school chai-themed runtime CSS utility library",
5
5
  "homepage": "https://github.com/gaurav0973/css-utility-library#readme",
6
6
  "bugs": {
7
7
  "url": "https://github.com/gaurav0973/css-utility-library/issues"
@@ -13,12 +13,29 @@
13
13
  "license": "ISC",
14
14
  "author": "",
15
15
  "type": "module",
16
- "main": "index.js",
16
+ "main": "dist/chai-ui.esm.js",
17
+ "module": "dist/chai-ui.esm.js",
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/chai-ui.esm.js",
21
+ "default": "./dist/chai-ui.esm.js"
22
+ }
23
+ },
24
+ "unpkg": "dist/chai-ui.js",
25
+ "jsdelivr": "dist/chai-ui.js",
26
+ "files": [
27
+ "dist",
28
+ "readme.md"
29
+ ],
17
30
  "scripts": {
18
- "test": "echo \"Error: no test specified\" && exit 1"
31
+ "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
32
+ "build": "node scripts/build.mjs",
33
+ "prepublishOnly": "npm run build"
19
34
  },
20
- "dependencies": {
35
+ "devDependencies": {
21
36
  "esbuild": "^0.25.12"
22
37
  },
23
- "devDependencies": {}
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
24
41
  }
package/readme.md CHANGED
@@ -9,48 +9,15 @@ Retro spirit, modern utility flow: old-school look, runtime-first engine.
9
9
  ## 📦 NPM Quick Start
10
10
 
11
11
  ```bash
12
- npm install @gaurav009/chaiui
12
+ npm install @gaurav009/chai-ui
13
13
  ```
14
14
 
15
- ```html
16
- <script type="module">
17
- import "@gaurav009/chaiui";
18
- </script>
19
- ```
20
-
21
- CDN (after publish):
15
+ CDN:
22
16
 
23
17
  ```html
24
- <script src="https://unpkg.com/@gaurav009/chaiui/dist/chai-ui.js"></script>
25
- ```
26
-
27
- ---
28
-
29
- ## 🛠️ Build For dist
30
-
31
- ```bash
32
- npm install
33
- npm run build
18
+ <script src="https://unpkg.com/@gaurav009/chai-ui/dist/chai-ui.js"></script>
34
19
  ```
35
20
 
36
- Build output:
37
-
38
- - `dist/chai-ui.esm.js` (ES module for npm import)
39
- - `dist/chai-ui.js` (browser IIFE for CDN)
40
-
41
- ---
42
-
43
- ## 🚀 Publish To npm
44
-
45
- ```bash
46
- npm login
47
- npm version patch
48
- npm publish
49
- ```
50
-
51
- Tip: `prepublishOnly` script automatically runs build before publish.
52
-
53
- ---
54
21
 
55
22
  ## 🧠 What is chaiUi?
56
23
 
package/demo/index.html DELETED
File without changes
package/scripts/build.mjs DELETED
@@ -1,29 +0,0 @@
1
- import { mkdirSync } from "node:fs";
2
- import { build } from "esbuild";
3
-
4
- mkdirSync("dist", { recursive: true });
5
-
6
- const shared = {
7
- entryPoints: ["src/index.js"],
8
- bundle: true,
9
- target: ["es2018"],
10
- legalComments: "none",
11
- };
12
-
13
- await build({
14
- ...shared,
15
- format: "esm",
16
- outfile: "dist/chai-ui.esm.js",
17
- sourcemap: true,
18
- });
19
-
20
- await build({
21
- ...shared,
22
- format: "iife",
23
- globalName: "chaiUi",
24
- outfile: "dist/chai-ui.js",
25
- sourcemap: true,
26
- minify: true,
27
- });
28
-
29
- console.log("Build complete: dist/chai-ui.esm.js and dist/chai-ui.js");
@@ -1,23 +0,0 @@
1
- import { parse } from "./02-parser.js";
2
- import { resolve } from "./03-resolver.js";
3
- import { applyStyles } from "./04-apply.js";
4
-
5
- export function init() {
6
- // 1. sare css applied ellements ko pick karo
7
- const elements = document.querySelectorAll("[chaiCss]");
8
-
9
- elements.forEach((el) => {
10
- // 2. "kinare-se-4 gol-kinara" => ["kinare-se-4", "gol-kinara"]
11
- const tokens = parse(el.getAttribute("chaiCss") || "");
12
-
13
- // 3. harr tokean ka matlab kya hai?
14
- tokens.forEach((token) => {
15
- // 4. kaun si utility kisko handover karni hai?
16
- const styles = resolve(token);
17
-
18
- if (styles)
19
- // 5. apply the css
20
- applyStyles(el, styles);
21
- });
22
- });
23
- }
@@ -1,10 +0,0 @@
1
- // "p-4 bg-chai" → ["p-4", "bg-chai"]
2
- export function parse(cssStringClass) {
3
- if (!cssStringClass) {
4
- return [];
5
- }
6
- if (typeof cssStringClass !== "string") {
7
- return [];
8
- }
9
- return cssStringClass.trim().split(/\s+/).filter(Boolean);
10
- }
@@ -1,17 +0,0 @@
1
- import { spacing } from "../utilities/spacing.js";
2
- import { layout } from "../utilities/layout.js";
3
- import { colors } from "../utilities/colors.js";
4
- import { typography } from "../utilities/typography.js";
5
- import { border } from "../utilities/border.js";
6
- import { effects } from "../utilities/effects.js";
7
- import { size } from "../utilities/size.js";
8
- import { display } from "../utilities/display.js";
9
-
10
- // Kaunsi utility kis function ko handle karegi?”
11
- export function resolve(token) {
12
- return (
13
- spacing(token) || layout(token) || colors(token) ||
14
- typography(token) || border(token) || effects(token) ||
15
- size(token) || display(token) || null
16
- );
17
- }
@@ -1,4 +0,0 @@
1
- // Yahan actual styling hoti hai
2
- export function applyStyles(el, styles) {
3
- Object.assign(el.style, styles);
4
- }
package/src/index.js DELETED
@@ -1,5 +0,0 @@
1
- import { init } from "./core/01-engine.js";
2
-
3
- document.addEventListener("DOMContentLoaded", () => {
4
- init();
5
- });
@@ -1,15 +0,0 @@
1
- export const theme = {
2
- colors: {
3
- chai: "#8b5e3c",
4
- cream: "#f6e7d0",
5
- masala: "#5a3d2b",
6
- white: "#ffffff",
7
- },
8
- border: {
9
- base: "#d9c3a5",
10
- },
11
- effects: {
12
- chaiShadow: "0 12px 24px rgba(90, 61, 43, 0.22)",
13
- softShadow: "0 6px 16px rgba(90, 61, 43, 0.12)",
14
- },
15
- };
@@ -1,32 +0,0 @@
1
- import { theme } from "../theme/theme.js";
2
-
3
- const map = {
4
- "border": {
5
- border: `1px solid ${theme.border.base}`
6
- },
7
- "kinara-rekha": {
8
- border: `1px solid ${theme.border.base}`
9
- },
10
- "rounded": {
11
- borderRadius: "8px"
12
- },
13
- "gol-kinara": {
14
- borderRadius: "8px"
15
- },
16
- "rounded-2": {
17
- borderRadius: "12px"
18
- },
19
- "gol-kinara-2": {
20
- borderRadius: "12px"
21
- },
22
- "rounded-full": {
23
- borderRadius: "9999px"
24
- },
25
- "poora-gola": {
26
- borderRadius: "9999px"
27
- },
28
- };
29
-
30
- export function border(token) {
31
- return map[token] || null;
32
- }
@@ -1,29 +0,0 @@
1
- import { theme } from "../theme/theme.js";
2
-
3
- const aliases = {
4
- "pichhe-chai": "bg-chai",
5
- "pichhe-cream": "bg-cream",
6
- "pichhe-masala": "bg-masala",
7
- "likhawat-chai": "text-chai",
8
- "likhawat-masala": "text-masala",
9
- "likhawat-safed": "text-white",
10
- };
11
-
12
- export function colors(token) {
13
- const normalizedToken = aliases[token] || token;
14
- const bgMatch = normalizedToken.match(/^bg-(chai|cream|masala)$/);
15
- if (bgMatch) {
16
- return {
17
- backgroundColor: theme.colors[bgMatch[1]]
18
- };
19
- }
20
-
21
- const textMatch = normalizedToken.match(/^text-(chai|masala|white)$/);
22
- if (textMatch) {
23
- return {
24
- color: theme.colors[textMatch[1]]
25
- };
26
- }
27
-
28
- return null;
29
- }
@@ -1,10 +0,0 @@
1
- const map = {
2
- block: { display: "block" },
3
- dikhao: { display: "block" },
4
- hidden: { display: "none" },
5
- chhupao: { display: "none" },
6
- };
7
-
8
- export function display(token) {
9
- return map[token] || null;
10
- }
@@ -1,26 +0,0 @@
1
- import { theme } from "../theme/theme.js";
2
-
3
- const map = {
4
- "chai-shadow": {
5
- boxShadow: theme.effects.chaiShadow
6
- },
7
- "chai-parchai": {
8
- boxShadow: theme.effects.chaiShadow
9
- },
10
- "soft-shadow": {
11
- boxShadow: theme.effects.softShadow
12
- },
13
- "halki-parchai": {
14
- boxShadow: theme.effects.softShadow
15
- },
16
- "sheesha-chai": {
17
- backgroundColor: "rgba(246, 231, 208, 0.45)",
18
- border: `1px solid ${theme.border.base}`,
19
- backdropFilter: "blur(8px)",
20
- WebkitBackdropFilter: "blur(8px)",
21
- },
22
- };
23
-
24
- export function effects(token) {
25
- return map[token] || null;
26
- }
@@ -1,36 +0,0 @@
1
- const map = {
2
- flex: {
3
- display: "flex"
4
- },
5
- lacheela: {
6
- display: "flex"
7
- },
8
- "flex-col": {
9
- flexDirection: "column"
10
- },
11
- "lacheela-kolam": {
12
- flexDirection: "column"
13
- },
14
- "items-center": {
15
- alignItems: "center"
16
- },
17
- "saman-beech": {
18
- alignItems: "center"
19
- },
20
- "justify-center": {
21
- justifyContent: "center"
22
- },
23
- "beech-mein": {
24
- justifyContent: "center"
25
- },
26
- "justify-between": {
27
- justifyContent: "space-between"
28
- },
29
- "dono-kinare": {
30
- justifyContent: "space-between"
31
- },
32
- };
33
-
34
- export function layout(token) {
35
- return map[token] || null;
36
- }
@@ -1,30 +0,0 @@
1
- const map = {
2
- "w-full": {
3
- width: "100%"
4
- },
5
- "chaudai-poori": {
6
- width: "100%"
7
- },
8
- "h-full": {
9
- height: "100%"
10
- },
11
- "unchai-poori": {
12
- height: "100%"
13
- },
14
- "w-screen": {
15
- width: "100vw"
16
- },
17
- "chaudai-screen": {
18
- width: "100vw"
19
- },
20
- "h-screen": {
21
- height: "100vh"
22
- },
23
- "unchai-screen": {
24
- height: "100vh"
25
- },
26
- };
27
-
28
- export function size(token) {
29
- return map[token] || null;
30
- }
@@ -1,85 +0,0 @@
1
- export function spacing(token) {
2
- const match = token.match(
3
- /^(p|m|px|py|mx|my|gap|kinare-se|kinare-x-se|kinare-y-se|bahar-se|upar-se|niche-se|daaye-se|baaye-se|fasla)-(\d+)$/,
4
- );
5
-
6
- if (!match) {
7
- return null;
8
- }
9
-
10
- const kind = match[1];
11
- const value = Number(match[2]) * 4 + "px";
12
-
13
- if (kind === "p")
14
- return {
15
- padding: value
16
- };
17
- if (kind === "kinare-se")
18
- return {
19
- padding: value
20
- };
21
- if (kind === "m")
22
- return {
23
- margin: value
24
- };
25
- if (kind === "bahar-se")
26
- return {
27
- margin: value
28
- };
29
- if (kind === "px")
30
- return {
31
- paddingLeft: value,
32
- paddingRight: value
33
- };
34
- if (kind === "kinare-x-se")
35
- return {
36
- paddingLeft: value,
37
- paddingRight: value
38
- };
39
- if (kind === "py")
40
- return {
41
- paddingTop: value,
42
- paddingBottom: value
43
- };
44
- if (kind === "kinare-y-se")
45
- return {
46
- paddingTop: value,
47
- paddingBottom: value
48
- };
49
- if (kind === "mx")
50
- return {
51
- marginLeft: value,
52
- marginRight: value
53
- };
54
- if (kind === "baaye-se")
55
- return {
56
- marginLeft: value
57
- };
58
- if (kind === "daaye-se")
59
- return {
60
- marginRight: value
61
- };
62
- if (kind === "my")
63
- return {
64
- marginTop: value,
65
- marginBottom: value
66
- };
67
- if (kind === "upar-se")
68
- return {
69
- marginTop: value
70
- };
71
- if (kind === "niche-se")
72
- return {
73
- marginBottom: value
74
- };
75
- if (kind === "gap")
76
- return {
77
- gap: value
78
- };
79
- if (kind === "fasla")
80
- return {
81
- gap: value
82
- };
83
-
84
- return null;
85
- }
@@ -1,24 +0,0 @@
1
- const map = {
2
- "text-sm": { fontSize: "14px" },
3
- "akshar-chhota": { fontSize: "14px" },
4
- "text-base": { fontSize: "16px" },
5
- "akshar-samanya": { fontSize: "16px" },
6
- "text-lg": { fontSize: "18px" },
7
- "akshar-bada": { fontSize: "18px" },
8
- "text-xl": { fontSize: "20px" },
9
- "akshar-xl": { fontSize: "20px" },
10
- "font-light": { fontWeight: "300" },
11
- "font-patla": { fontWeight: "300" },
12
- "font-bold": { fontWeight: "700" },
13
- "font-mota": { fontWeight: "700" },
14
- "text-center": { textAlign: "center" },
15
- "likhawat-beech": { textAlign: "center" },
16
- "text-left": { textAlign: "left" },
17
- "likhawat-baaye": { textAlign: "left" },
18
- "text-right": { textAlign: "right" },
19
- "likhawat-daaye": { textAlign: "right" },
20
- };
21
-
22
- export function typography(token) {
23
- return map[token] || null;
24
- }