@g4rcez/components 0.0.4 → 0.0.5

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.
@@ -0,0 +1,32 @@
1
+ declare module "src/styles/design-tokens" {
2
+ type DesignTokens = {
3
+ [K in string]: string | DesignTokens;
4
+ };
5
+ type Token = {
6
+ key: string;
7
+ value: string;
8
+ };
9
+ type DesignTokensParser = (value: string, key: string, combine: string) => string;
10
+ type DesignTokensBuilder = (value: string, key: string, combine: string) => Token;
11
+ export const parsers: {
12
+ cssVariable: (_: string, __: string, k: string) => string;
13
+ rgba: (value: string) => string;
14
+ rgb: (value: string) => string;
15
+ hsl: (value: string) => string;
16
+ hsla: (value: string) => string;
17
+ hex: (value: string) => string;
18
+ raw: (value: string) => string;
19
+ };
20
+ export const reduceTokens: <T extends DesignTokens>(colors: T, parse: DesignTokensBuilder, prefix?: string, append?: string) => Token[];
21
+ export const createDesignTokens: <T extends DesignTokens>(colors: T, parse: DesignTokensParser, prefix?: string, append?: string) => T;
22
+ export const createStyles: {
23
+ default: (tokens: Token[]) => string;
24
+ dark: (tokens: Token[]) => string;
25
+ };
26
+ }
27
+ declare module "preset.tailwind" {
28
+ import { Config } from "tailwindcss";
29
+ const config: Partial<Config>;
30
+ export default config;
31
+ }
32
+ //# sourceMappingURL=preset.tailwind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset.tailwind.d.ts","sourceRoot":"","sources":["../src/styles/design-tokens.ts","../preset.tailwind.ts"],"names":[],"mappings":";IAAA,KAAK,YAAY,GAAG;SACf,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,YAAY;KACvC,CAAC;IAEF,KAAK,KAAK,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAE5C,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAElF,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC;IAElF,MAAM,CAAC,MAAM,OAAO;;;;;;;;KAQ0B,CAAC;IAE/C,MAAM,CAAC,MAAM,YAAY,GAAI,CAAC,SAAS,YAAY,UAAU,CAAC,SAAS,mBAAmB,WAAU,MAAM,WAAe,MAAM,KAAQ,KAAK,EAQlI,CAAC;IAEX,MAAM,CAAC,MAAM,kBAAkB,GAAI,CAAC,SAAS,YAAY,UAAU,CAAC,SAAS,kBAAkB,WAAU,MAAM,WAAe,MAAM,KAAQ,CAW7H,CAAC;IAYhB,MAAM,CAAC,MAAM,YAAY;0BACH,KAAK,EAAE;uBACV,KAAK,EAAE;KACzB,CAAC;;;ICxDF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;IASrC,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,CA8B3B,CAAC;IAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,153 @@
1
+ var __importDefault = (this && this.__importDefault) || function (mod) {
2
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3
+ };
4
+ define("src/styles/design-tokens", ["require", "exports"], function (require, exports) {
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createStyles = exports.createDesignTokens = exports.reduceTokens = exports.parsers = void 0;
8
+ exports.parsers = {
9
+ cssVariable: (_, __, k) => `var(--${k})`,
10
+ rgba: (value) => `rgba(${value})`,
11
+ rgb: (value) => `rgb(${value})`,
12
+ hsl: (value) => `hsl(${value})`,
13
+ hsla: (value) => `hsla(${value})`,
14
+ hex: (value) => value,
15
+ raw: (value) => value,
16
+ };
17
+ const reduceTokens = (colors, parse, prefix = "", append = "") => Object.entries(colors).reduce((acc, [key, value]) => {
18
+ const combine = append === "" ? `${prefix}${key}` : `${append}-${key}`;
19
+ if (typeof value === "string") {
20
+ const k = append === "" ? `${prefix}${key}` : key;
21
+ return acc.concat(parse(value, k, combine));
22
+ }
23
+ return acc.concat((0, exports.reduceTokens)(value, parse, prefix, combine));
24
+ }, []);
25
+ exports.reduceTokens = reduceTokens;
26
+ const createDesignTokens = (colors, parse, prefix = "", append = "") => Object.entries(colors).reduce((acc, [key, value]) => {
27
+ const combine = append === "" ? `${prefix}${key}` : `${append}-${key}`;
28
+ if (typeof value === "string") {
29
+ const k = append === "" ? `${prefix}${key}` : key;
30
+ return Object.assign(Object.assign({}, acc), { [k]: parse(value, key, combine) });
31
+ }
32
+ return Object.assign(Object.assign({}, acc), { [key]: (0, exports.createDesignTokens)(value, parse, prefix, combine) });
33
+ }, {});
34
+ exports.createDesignTokens = createDesignTokens;
35
+ const modifiers = {
36
+ default: (variables) => `:root { ${variables} }`,
37
+ dark: (variables) => `html.dark {${variables}}`,
38
+ };
39
+ const createStyleContent = (tokens, modifier) => {
40
+ const content = tokens.map((token) => `${token.key}: ${token.value}`).join(";");
41
+ return modifier(content);
42
+ };
43
+ exports.createStyles = {
44
+ default: (tokens) => createStyleContent(tokens, modifiers.default),
45
+ dark: (tokens) => createStyleContent(tokens, modifiers.dark),
46
+ };
47
+ });
48
+ define("src/styles/dark", [], {
49
+ "name": "dark",
50
+ "spacing": {
51
+ "base": "1rem",
52
+ "lg": "1.5rem",
53
+ "sm": "0.75rem"
54
+ },
55
+ "colors": {
56
+ "foreground": "#f8fafc",
57
+ "background": "#191817",
58
+ "accent": "#0ea5e9",
59
+ "disabled": "#52525b",
60
+ "primary": {
61
+ "foreground": "#f8fafc",
62
+ "DEFAULT": "#0ea5e9",
63
+ "subtle": "#bae6fd",
64
+ "hover": "#0284c7"
65
+ },
66
+ "secondary": {
67
+ "DEFAULT": "#475569",
68
+ "subtle": "#cbd5e1",
69
+ "hover": "#334155"
70
+ },
71
+ "info": {
72
+ "DEFAULT": "#3b82f6",
73
+ "subtle": "#93c5fd",
74
+ "hover": "#1d4ed8"
75
+ },
76
+ "danger": {
77
+ "DEFAULT": "#ef4444",
78
+ "subtle": "#fca5a5",
79
+ "hover": "#dc2626"
80
+ },
81
+ "success": {
82
+ "DEFAULT": "#10b981",
83
+ "subtle": "#6ee7b7",
84
+ "hover": "#047857"
85
+ },
86
+ "input": {
87
+ "border": "#52525b",
88
+ "placeholder": "#94a3b8",
89
+ "mask-error": "#fca5a5",
90
+ "switch-bg": "#171717",
91
+ "switch": "#fff"
92
+ },
93
+ "card": {
94
+ "background": "#27272a",
95
+ "border": "#3f3f46",
96
+ "overlay": "#00000080"
97
+ },
98
+ "floating": {
99
+ "background": "#252525",
100
+ "border": "#3f3f46",
101
+ "overlay": "#00000080"
102
+ },
103
+ "tooltip": {
104
+ "background": "#141414",
105
+ "border": "#27272a"
106
+ },
107
+ "table": {
108
+ "background": "#27272a",
109
+ "border": "#52525b",
110
+ "row": "#3f3f46"
111
+ }
112
+ }
113
+ });
114
+ define("preset.tailwind", ["require", "exports", "tailwindcss/plugin", "src/styles/dark", "src/styles/design-tokens"], function (require, exports, plugin_1, dark_json_1, design_tokens_1) {
115
+ "use strict";
116
+ Object.defineProperty(exports, "__esModule", { value: true });
117
+ plugin_1 = __importDefault(plugin_1);
118
+ dark_json_1 = __importDefault(dark_json_1);
119
+ const COLORS = (0, design_tokens_1.createDesignTokens)(dark_json_1.default.colors, design_tokens_1.parsers.cssVariable);
120
+ const css = String.raw;
121
+ const config = {
122
+ theme: {
123
+ transitionTimingFunction: { DEFAULT: "cubic-bezier(1,.43,.36,.67)" },
124
+ transitionDuration: { DEFAULT: "375ms" },
125
+ extend: {
126
+ fill: COLORS,
127
+ colors: COLORS,
128
+ borderColors: COLORS,
129
+ placeholderColor: COLORS,
130
+ zIndex: {
131
+ floating: "10",
132
+ },
133
+ boxShadow: {
134
+ floating: "rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px"
135
+ }
136
+ },
137
+ },
138
+ plugins: [
139
+ (0, plugin_1.default)(function ({ addVariant }) {
140
+ addVariant("link", ["&:hover", "&:active"]);
141
+ addVariant("landing", ["&"]);
142
+ addVariant("group-assert", [css `:merge(.group):valid:has(.input:valid:not(:placeholder-shown)) &`]);
143
+ addVariant("group-error", [
144
+ css `:merge(.group):invalid:has(.input:not(:focus):invalid[data-initialized=true]) &`,
145
+ css `:merge(.group[data-error=true][data-interactive=true]):has(.input[data-initialized=true]) &`,
146
+ css `:merge(.group[data-error=true][data-interactive=true]):has(.input) &`,
147
+ css `:merge(.group[data-error=true]:has(.input[data-initialized=true])) &`,
148
+ ]);
149
+ }),
150
+ ],
151
+ };
152
+ exports.default = config;
153
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g4rcez/components",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "scripts": {
5
5
  "build": "vite build; npm run lib:types; npm run preset; npm run lib:css",
6
6
  "dev": "next dev",
@@ -30,15 +30,16 @@
30
30
  }
31
31
  },
32
32
  "./tailwind.config": {
33
- "type": "./dist/tailwind.config.d.ts",
34
- "import": "./dist/tailwind.config.js",
35
- "require": "./dist/tailwind.config.js",
36
- "default": "./dist/tailwind.config.js"
33
+ "type": "./dist/preset.tailwind.d.ts",
34
+ "import": "./dist/preset.tailwind.js",
35
+ "require": "./dist/preset.tailwind.js",
36
+ "default": "./dist/preset.tailwind.js"
37
37
  },
38
- "./index.css": "./dist/index.css"
38
+ "./dist/index.css": "./dist/index.css"
39
39
  },
40
40
  "files": [
41
- "dist"
41
+ "dist",
42
+ "dist/index.css"
42
43
  ],
43
44
  "dependencies": {
44
45
  "@dnd-kit/core": "6.1.0",