tailwindcss 3.1.5 → 3.1.6
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/CHANGELOG.md +10 -7
- package/lib/lib/evaluateTailwindFunctions.js +40 -12
- package/package.json +2 -2
- package/src/lib/evaluateTailwindFunctions.js +41 -15
package/CHANGELOG.md
CHANGED
|
@@ -7,21 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fix usage on Node 12.x ([b4e637e](https://github.com/tailwindlabs/tailwindcss/commit/b4e637e2e096a9d6f2210efba9541f6fd4f28e56))
|
|
13
|
+
- Handle theme keys with slashes when using `theme()` in CSS ([#8831](https://github.com/tailwindlabs/tailwindcss/pull/8831))
|
|
11
14
|
|
|
12
15
|
## [3.1.5] - 2022-07-07
|
|
13
16
|
|
|
14
17
|
### Added
|
|
15
18
|
|
|
16
|
-
- Support default `font-weight`
|
|
19
|
+
- Support configuring a default `font-weight` for each font size utility ([#8763](https://github.com/tailwindlabs/tailwindcss/pull/8763))
|
|
20
|
+
- Add support for alpha values in safe list ([#8774](https://github.com/tailwindlabs/tailwindcss/pull/8774))
|
|
17
21
|
|
|
18
22
|
### Fixed
|
|
19
23
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Fix
|
|
23
|
-
- Don’t prefix
|
|
24
|
-
- Add support for alpha values in safe list ([#8774](https://github.com/tailwindlabs/tailwindcss/pull/8774))
|
|
24
|
+
- Improve types to support fallback values in the CSS-in-JS syntax used in plugin APIs ([#8762](https://github.com/tailwindlabs/tailwindcss/pull/8762))
|
|
25
|
+
- Support including `tailwindcss` and `autoprefixer` in `postcss.config.js` in standalone CLI ([#8769](https://github.com/tailwindlabs/tailwindcss/pull/8769))
|
|
26
|
+
- Fix using special-characters as prefixes ([#8772](https://github.com/tailwindlabs/tailwindcss/pull/8772))
|
|
27
|
+
- Don’t prefix classes used within arbitrary variants ([#8773](https://github.com/tailwindlabs/tailwindcss/pull/8773))
|
|
25
28
|
- Add more explicit types for the default theme ([#8780](https://github.com/tailwindlabs/tailwindcss/pull/8780))
|
|
26
29
|
|
|
27
30
|
## [3.1.4] - 2022-06-21
|
|
@@ -137,21 +137,49 @@ let nodeTypePropertyMap = {
|
|
|
137
137
|
atrule: "params",
|
|
138
138
|
decl: "value"
|
|
139
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* @param {string} path
|
|
142
|
+
* @returns {Iterable<[path: string, alpha: string|undefined]>}
|
|
143
|
+
*/ function* toPaths(path) {
|
|
144
|
+
// Strip quotes from beginning and end of string
|
|
145
|
+
// This allows the alpha value to be present inside of quotes
|
|
146
|
+
path = path.replace(/^['"]+|['"]+$/g, "");
|
|
147
|
+
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
|
|
148
|
+
let alpha = undefined;
|
|
149
|
+
yield [
|
|
150
|
+
path,
|
|
151
|
+
undefined
|
|
152
|
+
];
|
|
153
|
+
if (matches) {
|
|
154
|
+
path = matches[1];
|
|
155
|
+
alpha = matches[2];
|
|
156
|
+
yield [
|
|
157
|
+
path,
|
|
158
|
+
alpha
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
* @param {any} config
|
|
165
|
+
* @param {string} path
|
|
166
|
+
* @param {any} defaultValue
|
|
167
|
+
*/ function resolvePath(config, path1, defaultValue) {
|
|
168
|
+
const results = Array.from(toPaths(path1)).map(([path, alpha])=>{
|
|
169
|
+
return Object.assign(validatePath(config, path, defaultValue, {
|
|
170
|
+
opacityValue: alpha
|
|
171
|
+
}), {
|
|
172
|
+
resolvedPath: path,
|
|
173
|
+
alpha
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
var ref;
|
|
177
|
+
return (ref = results.find((result)=>result.isValid)) !== null && ref !== void 0 ? ref : results[0];
|
|
178
|
+
}
|
|
140
179
|
function _default({ tailwindConfig: config }) {
|
|
141
180
|
let functions = {
|
|
142
181
|
theme: (node, path, ...defaultValue)=>{
|
|
143
|
-
|
|
144
|
-
// This allows the alpha value to be present inside of quotes
|
|
145
|
-
path = path.replace(/^['"]+|['"]+$/g, "");
|
|
146
|
-
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
|
|
147
|
-
let alpha = undefined;
|
|
148
|
-
if (matches) {
|
|
149
|
-
path = matches[1];
|
|
150
|
-
alpha = matches[2];
|
|
151
|
-
}
|
|
152
|
-
let { isValid , value , error } = validatePath(config, path, defaultValue.length ? defaultValue : undefined, {
|
|
153
|
-
opacityValue: alpha
|
|
154
|
-
});
|
|
182
|
+
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
|
155
183
|
if (!isValid) {
|
|
156
184
|
throw node.error(error);
|
|
157
185
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"postcss": "^8.4.14",
|
|
80
80
|
"postcss-import": "^14.1.0",
|
|
81
81
|
"postcss-js": "^4.0.0",
|
|
82
|
-
"postcss-load-config": "^
|
|
82
|
+
"postcss-load-config": "^3.1.4",
|
|
83
83
|
"postcss-nested": "5.0.6",
|
|
84
84
|
"postcss-selector-parser": "^6.0.10",
|
|
85
85
|
"postcss-value-parser": "^4.2.0",
|
|
@@ -157,26 +157,52 @@ let nodeTypePropertyMap = {
|
|
|
157
157
|
decl: 'value',
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
/**
|
|
161
|
+
* @param {string} path
|
|
162
|
+
* @returns {Iterable<[path: string, alpha: string|undefined]>}
|
|
163
|
+
*/
|
|
164
|
+
function* toPaths(path) {
|
|
165
|
+
// Strip quotes from beginning and end of string
|
|
166
|
+
// This allows the alpha value to be present inside of quotes
|
|
167
|
+
path = path.replace(/^['"]+|['"]+$/g, '')
|
|
166
168
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/)
|
|
170
|
+
let alpha = undefined
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
yield [path, undefined]
|
|
173
|
+
|
|
174
|
+
if (matches) {
|
|
175
|
+
path = matches[1]
|
|
176
|
+
alpha = matches[2]
|
|
177
|
+
|
|
178
|
+
yield [path, alpha]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
174
181
|
|
|
175
|
-
|
|
182
|
+
/**
|
|
183
|
+
*
|
|
184
|
+
* @param {any} config
|
|
185
|
+
* @param {string} path
|
|
186
|
+
* @param {any} defaultValue
|
|
187
|
+
*/
|
|
188
|
+
function resolvePath(config, path, defaultValue) {
|
|
189
|
+
const results = Array.from(toPaths(path)).map(([path, alpha]) => {
|
|
190
|
+
return Object.assign(validatePath(config, path, defaultValue, { opacityValue: alpha }), {
|
|
191
|
+
resolvedPath: path,
|
|
192
|
+
alpha,
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
return results.find((result) => result.isValid) ?? results[0]
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export default function ({ tailwindConfig: config }) {
|
|
200
|
+
let functions = {
|
|
201
|
+
theme: (node, path, ...defaultValue) => {
|
|
202
|
+
let { isValid, value, error, alpha } = resolvePath(
|
|
176
203
|
config,
|
|
177
204
|
path,
|
|
178
|
-
defaultValue.length ? defaultValue : undefined
|
|
179
|
-
{ opacityValue: alpha }
|
|
205
|
+
defaultValue.length ? defaultValue : undefined
|
|
180
206
|
)
|
|
181
207
|
|
|
182
208
|
if (!isValid) {
|