@vertz/theme-shadcn 0.2.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.
@@ -0,0 +1,191 @@
1
+ // src/styles/badge.ts
2
+ import { variants } from "@vertz/ui";
3
+
4
+ // src/styles/_helpers.ts
5
+ function bgOpacity(token, percent) {
6
+ return {
7
+ property: "background-color",
8
+ value: `color-mix(in oklch, var(--color-${token}) ${percent}%, transparent)`
9
+ };
10
+ }
11
+ function textOpacity(token, percent) {
12
+ return {
13
+ property: "color",
14
+ value: `color-mix(in oklch, var(--color-${token}) ${percent}%, transparent)`
15
+ };
16
+ }
17
+ function animationDecl(value) {
18
+ return { property: "animation", value };
19
+ }
20
+ var DARK = '[data-theme="dark"] &';
21
+
22
+ // src/styles/badge.ts
23
+ var colorVariants = {
24
+ blue: ["bg:primary", "text:primary-foreground"],
25
+ green: ["bg:primary", "text:primary-foreground"],
26
+ yellow: ["bg:secondary", "text:secondary-foreground"],
27
+ red: [{ "&": [bgOpacity("destructive", 10)] }, "text:destructive"],
28
+ gray: ["bg:muted", "text:muted-foreground"]
29
+ };
30
+ var badgeConfig = {
31
+ base: [
32
+ "inline-flex",
33
+ "items:center",
34
+ "rounded:full",
35
+ "text:xs",
36
+ "font:medium",
37
+ "px:2",
38
+ "py:0.5",
39
+ "transition:all",
40
+ "border:1",
41
+ "border:transparent",
42
+ "whitespace-nowrap",
43
+ "shrink-0",
44
+ { "&": [{ property: "height", value: "1.25rem" }] }
45
+ ],
46
+ variants: {
47
+ color: colorVariants
48
+ },
49
+ defaultVariants: {
50
+ color: "gray"
51
+ }
52
+ };
53
+ function createBadge() {
54
+ return variants(badgeConfig);
55
+ }
56
+
57
+ // src/styles/button.ts
58
+ import { variants as variants2 } from "@vertz/ui";
59
+ var focusRing = {
60
+ "&:focus-visible": [
61
+ "outline-none",
62
+ "border:ring",
63
+ {
64
+ property: "outline",
65
+ value: "3px solid color-mix(in oklch, var(--color-ring) 50%, transparent)"
66
+ },
67
+ { property: "outline-offset", value: "2px" }
68
+ ]
69
+ };
70
+ var disabledStyles = {
71
+ "&:disabled": ["pointer-events-none", "opacity:0.5"]
72
+ };
73
+ var svgStyles = {
74
+ "& svg": ["pointer-events-none", "shrink-0"]
75
+ };
76
+ var intentVariants = {
77
+ primary: ["bg:primary", "text:primary-foreground", { "&:hover": [bgOpacity("primary", 80)] }],
78
+ secondary: [
79
+ "bg:secondary",
80
+ "text:secondary-foreground",
81
+ { "&:hover": [bgOpacity("secondary", 80)] }
82
+ ],
83
+ destructive: [
84
+ { "&": [bgOpacity("destructive", 10)] },
85
+ "text:destructive",
86
+ { "&:hover": [bgOpacity("destructive", 20)] },
87
+ {
88
+ "&:focus-visible": [
89
+ {
90
+ property: "outline",
91
+ value: "3px solid color-mix(in oklch, var(--color-destructive) 20%, transparent)"
92
+ },
93
+ {
94
+ property: "border-color",
95
+ value: "color-mix(in oklch, var(--color-destructive) 40%, transparent)"
96
+ }
97
+ ]
98
+ },
99
+ { [DARK]: [bgOpacity("destructive", 20)] },
100
+ { [`${DARK}:hover`]: [bgOpacity("destructive", 30)] }
101
+ ],
102
+ ghost: [
103
+ "bg:transparent",
104
+ "text:foreground",
105
+ { "&:hover": ["bg:muted"] },
106
+ { [`${DARK}:hover`]: [bgOpacity("muted", 50)] }
107
+ ],
108
+ outline: [
109
+ "border:border",
110
+ "bg:background",
111
+ { "&:hover": ["bg:muted", "text:foreground"] },
112
+ { [DARK]: [bgOpacity("input", 30), "border:input"] },
113
+ { [`${DARK}:hover`]: [bgOpacity("input", 50)] }
114
+ ],
115
+ link: [
116
+ "bg:transparent",
117
+ "text:primary",
118
+ { "&:hover": [{ property: "text-decoration-line", value: "underline" }] }
119
+ ]
120
+ };
121
+ var sizeVariants = {
122
+ xs: ["h:6", "gap:1", "px:2", "rounded:md"],
123
+ sm: [
124
+ "h:7",
125
+ "gap:1",
126
+ "rounded:md",
127
+ {
128
+ "&": [
129
+ { property: "padding-left", value: "0.625rem" },
130
+ { property: "padding-right", value: "0.625rem" }
131
+ ]
132
+ }
133
+ ],
134
+ md: [
135
+ "h:8",
136
+ "gap:1.5",
137
+ {
138
+ "&": [
139
+ { property: "padding-left", value: "0.625rem" },
140
+ { property: "padding-right", value: "0.625rem" }
141
+ ]
142
+ }
143
+ ],
144
+ lg: [
145
+ "h:9",
146
+ "gap:1.5",
147
+ {
148
+ "&": [
149
+ { property: "padding-left", value: "0.625rem" },
150
+ { property: "padding-right", value: "0.625rem" }
151
+ ]
152
+ }
153
+ ],
154
+ icon: ["h:8", "w:8"],
155
+ "icon-xs": ["h:6", "w:6", "rounded:md"],
156
+ "icon-sm": ["h:7", "w:7", "rounded:md"],
157
+ "icon-lg": ["h:9", "w:9"]
158
+ };
159
+ var buttonConfig = {
160
+ base: [
161
+ "inline-flex",
162
+ "items:center",
163
+ "justify:center",
164
+ "whitespace-nowrap",
165
+ "shrink-0",
166
+ "gap:2",
167
+ "rounded:lg",
168
+ "border:1",
169
+ { "&": [{ property: "border-color", value: "transparent" }] },
170
+ "text:sm",
171
+ "font:medium",
172
+ "transition:colors",
173
+ "cursor:pointer",
174
+ focusRing,
175
+ disabledStyles,
176
+ svgStyles
177
+ ],
178
+ variants: {
179
+ intent: intentVariants,
180
+ size: sizeVariants
181
+ },
182
+ defaultVariants: {
183
+ intent: "primary",
184
+ size: "md"
185
+ }
186
+ };
187
+ function createButton() {
188
+ return variants2(buttonConfig);
189
+ }
190
+
191
+ export { bgOpacity, textOpacity, animationDecl, DARK, badgeConfig, createBadge, buttonConfig, createButton };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@vertz/theme-shadcn",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "Shadcn-inspired theme for Vertz — pre-built style definitions using variants() and css()",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/vertz-dev/vertz.git",
10
+ "directory": "packages/theme-shadcn"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "provenance": true
15
+ },
16
+ "main": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./configs": {
24
+ "types": "./dist/configs.d.ts",
25
+ "import": "./dist/configs.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "scripts": {
32
+ "build": "bunup",
33
+ "test": "bun test",
34
+ "test:watch": "bun test --watch",
35
+ "typecheck": "tsc --noEmit"
36
+ },
37
+ "dependencies": {
38
+ "@vertz/ui": "workspace:*",
39
+ "@vertz/ui-primitives": "workspace:*"
40
+ },
41
+ "devDependencies": {
42
+ "@happy-dom/global-registrator": "^20.7.0",
43
+ "bunup": "latest",
44
+ "happy-dom": "^20.7.0",
45
+ "typescript": "^5.7.0"
46
+ },
47
+ "engines": {
48
+ "node": ">=22"
49
+ },
50
+ "sideEffects": false
51
+ }