Skip to content

Commit 041639a

Browse files
stevethomasclaude
andauthored
feat: Add Tailwind CSS v4 support with dual v3/v4 presets (#33)
* feat: Add Tailwind CSS v4 support with dual v3/v4 presets - Upgrade demo app to Tailwind v4 with @tailwindcss/vite plugin - Replace tailwindcss-animate with tw-animate-css (shadcn-vue approach) - Create versioned presets: v3 (JS config) and v4 (CSS-first) - Update slate.css to use standard CSS instead of @apply - Add prettier-plugin-tailwindcss for class ordering - Update README with installation instructions for both versions - Remove deprecated postcss.config.cjs and tailwind.config.js Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Add tw-animate-css as peer dependency and improve preset docs - Add tw-animate-css as optional peerDependency to warn consumers - Add prerequisites section to v4 preset documentation - Add prerequisites and CSS usage docs to v3 preset - Update README v3 section to use tw-animate-css instead of tailwindcss-animate Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Restore v3 plugins and add @tailwindcss/forms to both presets - Restore tailwindcss-animate and @tailwindcss/forms plugins in v3 preset - Add @plugin "@tailwindcss/forms" to v4 preset - Update README with correct dependencies for each version - Add tailwindcss-animate and @tailwindcss/forms as optional peerDependencies tw-animate-css is v4-only; v3 consumers should use tailwindcss-animate. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Remove unused @tailwindcss/forms and @tailwindcss/typography from presets - Remove @tailwindcss/forms (unused - no form-* classes in components) - Remove @tailwindcss/typography from required deps (only used in demo app) - Update README and app docs with clear v3/v4 setup instructions - Simplify preset prerequisites to essential dependencies only Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5b75ceb commit 041639a

File tree

197 files changed

+14045
-15253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+14045
-15253
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = {
33
"eslint:recommended",
44
"plugin:@typescript-eslint/eslint-recommended",
55
"plugin:vue/vue3-recommended",
6-
"plugin:tailwindcss/recommended",
76
"prettier",
87
],
98
plugins: ["unused-imports"],
@@ -39,16 +38,13 @@ module.exports = {
3938
"vue/require-default-prop": "off",
4039
"vue/valid-v-slot": "off",
4140

42-
"tailwindcss/no-custom-classname": "off",
43-
4441
"no-undef": "off",
4542
"no-unused-vars": "off",
4643
"no-console": ["warn"],
4744
"no-prototype-builtins": "off",
4845

4946
// sticking to the team's rules
5047
"vue/prefer-separate-static-class": "off",
51-
"tailwindcss/enforces-shorthand": "off",
5248
"vue/no-reserved-component-names": "off",
5349
"vue/no-setup-props-destructure": "off",
5450
"vue/prefer-true-attribute-shorthand": "off",

.prettierrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"tabWidth": 2,
44
"semi": false,
55
"singleQuote": false,
6-
"singleAttributePerLine": false
6+
"singleAttributePerLine": false,
7+
"plugins": ["prettier-plugin-tailwindcss"],
8+
"tailwindStylesheet": "./app/style.css"
79
}

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
Gooey is a Vue 3 component library built on Tailwind CSS and shadcn-vue. It contains both shadcn components and custom components, published as `@codinglabsau/gooey` on GitHub Packages.
88

9+
The library supports both Tailwind CSS v3 and v4. The demo app uses Tailwind v4, while consumers can use either version with the appropriate preset.
10+
911
## Commands
1012

1113
```bash

README.md

Lines changed: 146 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,172 @@
11
# GOOEY
2-
A collection of Vue components based on Tailwind, Shadcn-vue, and others.
2+
3+
A collection of Vue components based on Tailwind CSS, Shadcn-vue, and others.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @codinglabsau/gooey
9+
```
10+
11+
This library supports both **Tailwind CSS v3** and **Tailwind CSS v4**. Choose the setup instructions for your version.
12+
13+
### Tailwind v4 Setup
14+
15+
1. Install dependencies:
16+
17+
```bash
18+
npm install -D tailwindcss @tailwindcss/vite tw-animate-css
19+
```
20+
21+
2. Add the Tailwind plugin to your `vite.config.js`:
22+
23+
```js
24+
import tailwindcss from '@tailwindcss/vite'
25+
26+
export default defineConfig({
27+
plugins: [tailwindcss()],
28+
})
29+
```
30+
31+
3. Import the preset in your main CSS file:
32+
33+
```css
34+
@import "tailwindcss";
35+
@import "tw-animate-css";
36+
@import "@codinglabsau/gooey/presets/slate.css";
37+
38+
@custom-variant dark (&:is(.dark *));
39+
40+
@source "./node_modules/@codinglabsau/gooey";
41+
42+
@theme {
43+
--color-border: hsl(var(--border));
44+
--color-input: hsl(var(--input));
45+
--color-ring: hsl(var(--ring));
46+
--color-background: hsl(var(--background));
47+
--color-foreground: hsl(var(--foreground));
48+
49+
--color-primary: hsl(var(--primary));
50+
--color-primary-foreground: hsl(var(--primary-foreground));
51+
52+
--color-secondary: hsl(var(--secondary));
53+
--color-secondary-foreground: hsl(var(--secondary-foreground));
54+
55+
--color-destructive: hsl(var(--destructive));
56+
--color-destructive-foreground: hsl(var(--destructive-foreground));
57+
58+
--color-success: hsl(var(--success));
59+
--color-success-foreground: hsl(var(--success-foreground));
60+
61+
--color-warning: hsl(var(--warning));
62+
--color-warning-foreground: hsl(var(--warning-foreground));
63+
64+
--color-muted: hsl(var(--muted));
65+
--color-muted-foreground: hsl(var(--muted-foreground));
66+
67+
--color-accent: hsl(var(--accent));
68+
--color-accent-foreground: hsl(var(--accent-foreground));
69+
70+
--color-popover: hsl(var(--popover));
71+
--color-popover-foreground: hsl(var(--popover-foreground));
72+
73+
--color-card: hsl(var(--card));
74+
--color-card-foreground: hsl(var(--card-foreground));
75+
76+
--radius-xl: calc(var(--radius) + 4px);
77+
--radius-lg: var(--radius);
78+
--radius-md: calc(var(--radius) - 2px);
79+
--radius-sm: calc(var(--radius) - 4px);
80+
81+
--animate-accordion-down: accordion-down 0.2s ease-out;
82+
--animate-accordion-up: accordion-up 0.2s ease-out;
83+
--animate-collapsible-down: collapsible-down 0.2s ease-in-out;
84+
--animate-collapsible-up: collapsible-up 0.2s ease-in-out;
85+
}
86+
87+
@keyframes accordion-down {
88+
from { height: 0; }
89+
to { height: var(--radix-accordion-content-height); }
90+
}
91+
92+
@keyframes accordion-up {
93+
from { height: var(--radix-accordion-content-height); }
94+
to { height: 0; }
95+
}
96+
97+
@keyframes collapsible-down {
98+
from { height: 0; }
99+
to { height: var(--radix-collapsible-content-height); }
100+
}
101+
102+
@keyframes collapsible-up {
103+
from { height: var(--radix-collapsible-content-height); }
104+
to { height: 0; }
105+
}
106+
```
107+
108+
### Tailwind v3 Setup
109+
110+
1. Install dependencies:
111+
112+
```bash
113+
npm install -D tailwindcss postcss autoprefixer tailwindcss-animate
114+
```
115+
116+
2. Add the preset to your `tailwind.config.js`:
117+
118+
```js
119+
import { preset } from '@codinglabsau/gooey/presets/v3'
120+
121+
export default {
122+
darkMode: ['class'],
123+
presets: [preset],
124+
content: [
125+
'./node_modules/@codinglabsau/gooey/**/*.{js,vue}',
126+
// ... your content paths
127+
],
128+
}
129+
```
130+
131+
3. Import the theme CSS in your main stylesheet:
132+
133+
```css
134+
@tailwind base;
135+
@tailwind components;
136+
@tailwind utilities;
137+
138+
@import '@codinglabsau/gooey/dist/presets/slate.css';
139+
```
3140

4141
## Documentation
142+
5143
The documentation is available in the `./app` directory. This serves as documentation, test target, and sandbox for prototyping.
6144

7145
```bash
8-
vite
146+
npm run dev
9147
```
10148

11149
## Testing
12-
Tests are implemented with Cypress, and can be run on CLI using `npm run tests`. We are implementing end-to-end tests as most components are tested upstream.
150+
151+
Tests are implemented with Cypress, and can be run on CLI using `npm run test`. We are implementing end-to-end tests as most components are tested upstream.
13152

14153
For shadcn components, we do simple smoke tests to ensure they are not generating errors with basic usage.
15154

16155
For custom components, we are testing the functionality in depth.
17156

18157
## Security
158+
19159
If you discover any security related issues, create an issue on GitHub.
20160

21161
## Credits
162+
22163
- [Steve Thomas](https://github.com/stevethomas)
23164
- [All Contributors](../../contributors)
24165

25166
## License
167+
26168
MIT
27169

28170
## About Coding Labs
171+
29172
Coding Labs is a web app development agency based on the Gold Coast, Australia. See our open source projects [on our website](https://codinglabs.com.au/open-source).

app/components/ComponentHeading.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { Heading } from "@"
33
</script>
44

55
<template>
6-
<Heading as="h2" class="mb-3 mt-8 text-2xl"><slot /></Heading>
6+
<Heading as="h2" class="mt-8 mb-3 text-2xl"><slot /></Heading>
77
</template>

app/components/SidebarNavigation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ defineEmits<{
1313
<template>
1414
<nav class="space-y-4 px-6">
1515
<div v-for="group in items" :key="group.name">
16-
<h3 class="text-md font-bold leading-6">{{ group.name }}</h3>
16+
<h3 class="text-md leading-6 font-bold">{{ group.name }}</h3>
1717

1818
<ul role="list" class="mt-2 flex flex-1 flex-col gap-y-7">
1919
<li>
2020
<ul role="list" class="-mx-2 space-y-1.5">
2121
<li v-for="route in group.children" :key="route.name" class="flex items-center">
2222
<RouterLink
2323
:to="route.path"
24-
class="group flex gap-x-3 rounded-md px-2 text-sm font-light leading-5 hover:underline"
24+
class="group flex gap-x-3 rounded-md px-2 text-sm leading-5 font-light hover:underline"
2525
@click="$emit('navigated')"
2626
>
2727
{{ route.name }}

app/pages/components/Drawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const goal = ref(5)
4949
{{ goal }}
5050
</div>
5151

52-
<div class="text-[0.70rem] uppercase text-muted-foreground">Issues per day</div>
52+
<div class="text-[0.70rem] text-muted-foreground uppercase">Issues per day</div>
5353
</div>
5454

5555
<Button

app/pages/components/Flasher.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const props = ref<any>({})
138138
firstname: 'firstname is required',
139139
surname: 'surname must be of type: that\'s what she said',
140140
},
141-
'key'
141+
'key',
142142
)
143143
}
144144
"
@@ -156,7 +156,7 @@ const props = ref<any>({})
156156
firstname: 'firstname is required',
157157
surname: 'surname must be of type: that\'s what she said',
158158
},
159-
'both'
159+
'both',
160160
)
161161
}
162162
"

app/pages/components/Form.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as z from "zod"
1616
const formSchema = toTypedSchema(
1717
z.object({
1818
username: z.string().min(2).max(50),
19-
})
19+
}),
2020
)
2121
2222
const { handleSubmit } = useForm({

app/pages/components/Popover.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Input } from "@/components/input"
1414
<PopoverContent class="w-80">
1515
<div class="grid gap-4">
1616
<div class="space-y-2">
17-
<h4 class="font-medium leading-none">Dimensions</h4>
17+
<h4 class="leading-none font-medium">Dimensions</h4>
1818

1919
<p class="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
2020
</div>

0 commit comments

Comments
 (0)