@onereach/styles 27.0.2-beta.6103.0 → 27.0.2-beta.6105.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.
- package/MIGRATION_TAILWIND_V4.md +149 -0
- package/README.md +14 -0
- package/compat/tailwind-v3-utilities.css +1 -0
- package/main-v3.css +1 -1
- package/main-v4.css +3 -0
- package/package.json +17 -6
- package/postcss/tailwind-v4-compat.cjs +816 -0
- package/rollup-plugin-tailwindcss-cli.css +2 -1
- package/tailwind/compatibility/important.js +13 -0
- package/tailwind/compatibility/legacy-spacing.js +133 -0
- package/tailwind/plugins/theme-background.js +4 -3
- package/tailwind/plugins/theme-border.js +4 -3
- package/tailwind/plugins/theme-divider.js +7 -6
- package/tailwind/plugins/theme-foreground.js +4 -3
- package/tailwind/plugins/theme-outline.js +4 -3
- package/tailwind/plugins/theme-preset.js +17 -16
- package/tailwind.config.js +1 -3
- package/tailwind.config.json +2681 -1030
- package/tailwind.config.preset.js +1 -230
- package/tailwind.config.preset.v4.js +231 -0
- package/legacy-utilities.layer.css +0 -67219
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Migrate to Tailwind CSS 4
|
|
2
|
+
|
|
3
|
+
Toolchain and config migration is required.
|
|
4
|
+
Template and Tailwind class rewrites are not required.
|
|
5
|
+
|
|
6
|
+
Both `!class` and `class!` remain supported; `class!` is preferred for new code.
|
|
7
|
+
|
|
8
|
+
## 1. Update dependencies
|
|
9
|
+
|
|
10
|
+
Install Tailwind CSS 4 and its PostCSS plugin alongside the UI Next styles
|
|
11
|
+
package:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm add @onereach/styles tailwindcss@4.3.2
|
|
15
|
+
pnpm add --save-dev @tailwindcss/postcss@4.3.2 postcss@^8.4.32
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Remove Tailwind CSS 3 and `tailwindcss/nesting` from the consumer PostCSS
|
|
19
|
+
plugins. Keep unrelated PostCSS plugins that the application still needs.
|
|
20
|
+
|
|
21
|
+
## 2. Update PostCSS
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
// postcss.config.cjs
|
|
25
|
+
module.exports = {
|
|
26
|
+
plugins: [
|
|
27
|
+
require('@tailwindcss/postcss')({ optimize: false }),
|
|
28
|
+
require('@onereach/styles/postcss/tailwind-v4-compat.cjs'),
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The OneReach compatibility plugin runs after Tailwind CSS 4. It restores the
|
|
34
|
+
established semantic-state importance, selector composition, and Tailwind 3
|
|
35
|
+
cascade order without changing template classes. Its nesting pass is scoped to
|
|
36
|
+
generated `@layer utilities` rules and does not transform application CSS
|
|
37
|
+
outside that layer.
|
|
38
|
+
|
|
39
|
+
## 3. Update the Tailwind config
|
|
40
|
+
|
|
41
|
+
Use the explicit Tailwind CSS 4 preset. Existing application theme extensions
|
|
42
|
+
and plugins can remain in this config.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// tailwind.config.cjs
|
|
46
|
+
module.exports = {
|
|
47
|
+
presets: [
|
|
48
|
+
require('@onereach/styles/tailwind.config.preset.v4.js'),
|
|
49
|
+
],
|
|
50
|
+
theme: {
|
|
51
|
+
extend: {
|
|
52
|
+
// Keep application theme extensions here.
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
plugins: [
|
|
56
|
+
// Keep application plugins here.
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Tailwind CSS 4 source scanning is configured in CSS, so remove the Tailwind CSS
|
|
62
|
+
3 `content` array after moving each path to an `@source` directive.
|
|
63
|
+
|
|
64
|
+
## 4. Update the CSS entrypoint
|
|
65
|
+
|
|
66
|
+
The following example assumes this file is `src/tailwind.css` and the Tailwind
|
|
67
|
+
config is at the project root:
|
|
68
|
+
|
|
69
|
+
```css
|
|
70
|
+
@import "tailwindcss";
|
|
71
|
+
@import "@onereach/styles/main-v4.css";
|
|
72
|
+
|
|
73
|
+
@config "../tailwind.config.cjs";
|
|
74
|
+
@source "./";
|
|
75
|
+
@source "../node_modules/@onereach/ui-components/dist/esm";
|
|
76
|
+
@source "../node_modules/@onereach/ui-components-vue2/dist/esm";
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Remove the unused `@source` line when the application installs only Vue 2 or
|
|
80
|
+
only Vue 3. Add an `@source` for every other installed package that renders
|
|
81
|
+
Tailwind classes.
|
|
82
|
+
|
|
83
|
+
The application owns the `@import "tailwindcss"`, `@config`, and `@source`
|
|
84
|
+
directives. The `main-v4.css` entrypoint does not choose a consumer config or
|
|
85
|
+
source tree.
|
|
86
|
+
|
|
87
|
+
## 5. Opt in to legacy `+` and `*` utilities
|
|
88
|
+
|
|
89
|
+
Tailwind CSS 4 rejects class candidates whose token names contain `+` or `*`.
|
|
90
|
+
Applications that still use classes such as `px-sm+`, `px-sm+*`, or `-m-sm+`
|
|
91
|
+
must import the compatibility stylesheet:
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
@import "@onereach/styles/compat/tailwind-v3-utilities.css";
|
|
95
|
+
@import "tailwindcss";
|
|
96
|
+
@import "@onereach/styles/main-v4.css";
|
|
97
|
+
|
|
98
|
+
@config "../tailwind.config.cjs";
|
|
99
|
+
@source "./";
|
|
100
|
+
@source "../node_modules/@onereach/ui-components/dist/esm";
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This import is optional and is not included by `main-v4.css`. It preserves the
|
|
104
|
+
legacy utility names without requiring template or class changes.
|
|
105
|
+
Import the compatibility stylesheet before `tailwindcss` so responsive
|
|
106
|
+
Tailwind utilities retain the same cascade precedence they had in Tailwind CSS
|
|
107
|
+
3.
|
|
108
|
+
|
|
109
|
+
The artifact includes the legacy variant combinations used by UI Next and the
|
|
110
|
+
audited workspace consumers: important, dark, hover, mobile, desktop,
|
|
111
|
+
breakpoints, children, and positional children utilities.
|
|
112
|
+
|
|
113
|
+
If an application combines a legacy token with another custom variant, keep the
|
|
114
|
+
template class and add its safe alias candidate to the CSS entrypoint. For
|
|
115
|
+
example, `focus:px-sm+` uses:
|
|
116
|
+
|
|
117
|
+
```css
|
|
118
|
+
@source inline("focus:px-or-tw4-legacy-sm-b");
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The compatibility plugin changes only the generated selector back to
|
|
122
|
+
`focus:px-sm+`. The application template remains unchanged.
|
|
123
|
+
|
|
124
|
+
## Dark mode
|
|
125
|
+
|
|
126
|
+
The preset supports both existing dark-mode root selectors, `.dark` and
|
|
127
|
+
`[data-theme="dark"]`:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<html class="dark">
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<html data-theme="dark">
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Keep the root already used by the application. No dark-mode template rewrite is
|
|
138
|
+
required.
|
|
139
|
+
|
|
140
|
+
## Migration checklist
|
|
141
|
+
|
|
142
|
+
- Replace Tailwind CSS 3 with Tailwind CSS 4 and `@tailwindcss/postcss`.
|
|
143
|
+
- Replace the preset import with `tailwind.config.preset.v4.js`.
|
|
144
|
+
- Import `@onereach/styles/main-v4.css`.
|
|
145
|
+
- Move every Tailwind CSS 3 `content` path to an `@source` directive.
|
|
146
|
+
- Keep application theme extensions, plugins, utilities, and dark-mode roots.
|
|
147
|
+
- Add the optional compatibility import only when `+` or `*` token classes are
|
|
148
|
+
still present.
|
|
149
|
+
- Keep existing templates and Tailwind classes unchanged.
|
package/README.md
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @onereach/styles
|
|
2
|
+
|
|
3
|
+
Shared UI Next design tokens, base styles, and Tailwind presets.
|
|
4
|
+
|
|
5
|
+
## Tailwind CSS
|
|
6
|
+
|
|
7
|
+
- Tailwind CSS 3 consumers use `main-v3.css` and
|
|
8
|
+
`tailwind.config.preset.js`.
|
|
9
|
+
- Tailwind CSS 4 consumers use `main-v4.css` and
|
|
10
|
+
`tailwind.config.preset.v4.js`.
|
|
11
|
+
|
|
12
|
+
See [Migrate to Tailwind CSS 4](./MIGRATION_TAILWIND_V4.md) for copyable
|
|
13
|
+
dependency, PostCSS, config, CSS, source-scanning, dark-mode, and optional
|
|
14
|
+
legacy utility setup.
|