tailwindcss 0.0.0-insiders.45e17dd → 0.0.0-insiders.48728ed
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 +69 -1
- package/LICENSE +1 -2
- package/lib/cli.js +18 -6
- package/lib/corePluginList.js +1 -0
- package/lib/corePlugins.js +85 -10
- package/lib/featureFlags.js +2 -2
- package/lib/index.js +12 -1
- package/lib/lib/cacheInvalidation.js +69 -0
- package/lib/lib/collapseAdjacentRules.js +14 -1
- package/lib/lib/defaultExtractor.js +6 -4
- package/lib/lib/expandApplyAtRules.js +173 -17
- package/lib/lib/expandTailwindAtRules.js +16 -6
- package/lib/lib/generateRules.js +158 -69
- package/lib/lib/resolveDefaultsAtRules.js +6 -2
- package/lib/lib/setupContextUtils.js +72 -34
- package/lib/lib/setupTrackingContext.js +3 -3
- package/lib/lib/sharedState.js +5 -1
- package/lib/postcss-plugins/nesting/plugin.js +32 -0
- package/lib/util/cloneNodes.js +12 -1
- package/lib/util/log.js +7 -7
- package/lib/util/parseBoxShadowValue.js +43 -3
- package/lib/util/prefixSelector.js +4 -5
- package/lib/util/resolveConfig.js +22 -0
- package/package.json +16 -19
- package/peers/index.js +2300 -3072
- package/src/cli.js +22 -10
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +88 -10
- package/src/featureFlags.js +2 -2
- package/src/index.js +15 -1
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +16 -1
- package/src/lib/defaultExtractor.js +6 -4
- package/src/lib/expandApplyAtRules.js +184 -11
- package/src/lib/expandTailwindAtRules.js +26 -6
- package/src/lib/generateRules.js +150 -71
- package/src/lib/resolveDefaultsAtRules.js +6 -2
- package/src/lib/setupContextUtils.js +77 -33
- package/src/lib/setupTrackingContext.js +3 -3
- package/src/lib/sharedState.js +2 -0
- package/src/postcss-plugins/nesting/plugin.js +36 -0
- package/src/util/cloneNodes.js +14 -1
- package/src/util/log.js +7 -7
- package/src/util/parseBoxShadowValue.js +50 -2
- package/src/util/prefixSelector.js +7 -5
- package/src/util/resolveConfig.js +30 -0
- package/stubs/defaultConfig.stub.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,8 +9,71 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Fixed
|
|
11
11
|
|
|
12
|
+
- Prevent nesting plugin from breaking other plugins ([#7563](https://github.com/tailwindlabs/tailwindcss/pull/7563))
|
|
13
|
+
- Recursively collapse adjacent rules ([#7565](https://github.com/tailwindlabs/tailwindcss/pull/7565))
|
|
14
|
+
- Preserve source maps for generated CSS ([#7588](https://github.com/tailwindlabs/tailwindcss/pull/7588))
|
|
15
|
+
- Split box shadows on top-level commas only ([#7479](https://github.com/tailwindlabs/tailwindcss/pull/7479))
|
|
16
|
+
- Use local user CSS cache for `@apply` ([#7524](https://github.com/tailwindlabs/tailwindcss/pull/7524))
|
|
17
|
+
- Invalidate context when main CSS changes ([#7626](https://github.com/tailwindlabs/tailwindcss/pull/7626))
|
|
18
|
+
- Only add `!` to selector class matching template candidate when using important modifier with mutli-class selectors ([#7664](https://github.com/tailwindlabs/tailwindcss/pull/7664))
|
|
19
|
+
- Correctly parse and prefix animation names with dots ([#7163](https://github.com/tailwindlabs/tailwindcss/pull/7163))
|
|
20
|
+
- Fix extraction from template literal/function with array ([#7481](https://github.com/tailwindlabs/tailwindcss/pull/7481))
|
|
21
|
+
- Don't output unparsable arbitrary values ([#7789](https://github.com/tailwindlabs/tailwindcss/pull/7789))
|
|
22
|
+
- Fix generation of `div:not(.foo)` if `.foo` is never defined ([#7815](https://github.com/tailwindlabs/tailwindcss/pull/7815))
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Replace `chalk` with `picocolors` ([#6039](https://github.com/tailwindlabs/tailwindcss/pull/6039))
|
|
27
|
+
- Replace `cosmiconfig` with `lilconfig` ([#6039](https://github.com/tailwindlabs/tailwindcss/pull/6038))
|
|
28
|
+
- Update `cssnano` to avoid removing empty variables when minifying ([#7818](https://github.com/tailwindlabs/tailwindcss/pull/7818))
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
33
|
+
- Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
|
|
34
|
+
- Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
|
|
35
|
+
- Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
|
|
36
|
+
- Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
|
|
37
|
+
- Add `--poll` option to the CLI ([#7725](https://github.com/tailwindlabs/tailwindcss/pull/7725))
|
|
38
|
+
- Add new `border-spacing` utilities ([#7102](https://github.com/tailwindlabs/tailwindcss/pull/7102))
|
|
39
|
+
|
|
40
|
+
## [3.0.23] - 2022-02-16
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- Remove opacity variables from `:visited` pseudo class ([#7458](https://github.com/tailwindlabs/tailwindcss/pull/7458))
|
|
45
|
+
- Support arbitrary values + calc + theme with quotes ([#7462](https://github.com/tailwindlabs/tailwindcss/pull/7462))
|
|
46
|
+
- Don't duplicate layer output when scanning content with variants + wildcards ([#7478](https://github.com/tailwindlabs/tailwindcss/pull/7478))
|
|
47
|
+
- Implement `getClassOrder` instead of `sortClassList` ([#7459](https://github.com/tailwindlabs/tailwindcss/pull/7459))
|
|
48
|
+
|
|
49
|
+
## [3.0.22] - 2022-02-11
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Temporarily move `postcss` to dependencies ([#7424](https://github.com/tailwindlabs/tailwindcss/pull/7424))
|
|
54
|
+
|
|
55
|
+
## [3.0.21] - 2022-02-10
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- Move prettier plugin to dev dependencies ([#7418](https://github.com/tailwindlabs/tailwindcss/pull/7418))
|
|
60
|
+
|
|
61
|
+
## [3.0.20] - 2022-02-10
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
- Expose `context.sortClassList(classes)` ([#7412](https://github.com/tailwindlabs/tailwindcss/pull/7412))
|
|
66
|
+
|
|
67
|
+
## [3.0.19] - 2022-02-07
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
12
71
|
- Fix preflight border color fallback ([#7288](https://github.com/tailwindlabs/tailwindcss/pull/7288))
|
|
13
72
|
- Correctly parse shadow lengths without a leading zero ([#7289](https://github.com/tailwindlabs/tailwindcss/pull/7289))
|
|
73
|
+
- Don't crash when scanning extremely long class candidates ([#7331](https://github.com/tailwindlabs/tailwindcss/pull/7331))
|
|
74
|
+
- Use less hacky fix for URLs detected as custom properties ([#7275](https://github.com/tailwindlabs/tailwindcss/pull/7275))
|
|
75
|
+
- Correctly generate negative utilities when dash is before the prefix ([#7295](https://github.com/tailwindlabs/tailwindcss/pull/7295))
|
|
76
|
+
- Detect prefixed negative utilities in the safelist ([#7295](https://github.com/tailwindlabs/tailwindcss/pull/7295))
|
|
14
77
|
|
|
15
78
|
## [3.0.18] - 2022-01-28
|
|
16
79
|
|
|
@@ -1839,7 +1902,12 @@ No release notes
|
|
|
1839
1902
|
|
|
1840
1903
|
- Everything!
|
|
1841
1904
|
|
|
1842
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.
|
|
1905
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...HEAD
|
|
1906
|
+
[3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
|
|
1907
|
+
[3.0.22]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.21...v3.0.22
|
|
1908
|
+
[3.0.21]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.20...v3.0.21
|
|
1909
|
+
[3.0.20]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.19...v3.0.20
|
|
1910
|
+
[3.0.19]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.18...v3.0.19
|
|
1843
1911
|
[3.0.18]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.17...v3.0.18
|
|
1844
1912
|
[3.0.17]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.16...v3.0.17
|
|
1845
1913
|
[3.0.16]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.15...v3.0.16
|
package/LICENSE
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
4
|
-
Copyright (c) Jonathan Reinink <jonathan@reinink.ca>
|
|
3
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
5
4
|
|
|
6
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/lib/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
6
6
|
var _arg = _interopRequireDefault(require("arg"));
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
8
8
|
var _postcssLoadConfig = _interopRequireDefault(require("postcss-load-config"));
|
|
9
|
-
var
|
|
9
|
+
var _lilconfig = require("lilconfig");
|
|
10
10
|
var _plugins // Little bit scary, looking at private/internal API
|
|
11
11
|
= _interopRequireDefault(require("postcss-load-config/src/plugins"));
|
|
12
12
|
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
|
|
@@ -159,6 +159,10 @@ let commands = {
|
|
|
159
159
|
type: Boolean,
|
|
160
160
|
description: 'Watch for changes and rebuild as needed'
|
|
161
161
|
},
|
|
162
|
+
'--poll': {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
description: 'Use polling instead of filesystem events when watching'
|
|
165
|
+
},
|
|
162
166
|
'--content': {
|
|
163
167
|
type: String,
|
|
164
168
|
description: 'Content paths to use for removing unused classes'
|
|
@@ -187,7 +191,8 @@ let commands = {
|
|
|
187
191
|
'-i': '--input',
|
|
188
192
|
'-o': '--output',
|
|
189
193
|
'-m': '--minify',
|
|
190
|
-
'-w': '--watch'
|
|
194
|
+
'-w': '--watch',
|
|
195
|
+
'-p': '--poll'
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
};
|
|
@@ -348,7 +353,12 @@ async function build() {
|
|
|
348
353
|
let input = args['--input'];
|
|
349
354
|
let output = args['--output'];
|
|
350
355
|
let shouldWatch = args['--watch'];
|
|
356
|
+
let shouldPoll = args['--poll'];
|
|
357
|
+
let shouldCoalesceWriteEvents = shouldPoll || process.platform === 'win32';
|
|
351
358
|
let includePostCss = args['--postcss'];
|
|
359
|
+
// Polling interval in milliseconds
|
|
360
|
+
// Used only when polling or coalescing add/change events on Windows
|
|
361
|
+
let pollInterval = 10;
|
|
352
362
|
// TODO: Deprecate this in future versions
|
|
353
363
|
if (!input && args['_'][1]) {
|
|
354
364
|
console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
|
|
@@ -368,8 +378,8 @@ async function build() {
|
|
|
368
378
|
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
|
|
369
379
|
let { plugins: configPlugins } = customPostCssPath ? await (async ()=>{
|
|
370
380
|
let file = _path.default.resolve(customPostCssPath);
|
|
371
|
-
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0
|
|
372
|
-
let { config ={} } = await (0,
|
|
381
|
+
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
|
|
382
|
+
let { config ={} } = await (0, _lilconfig).lilconfig('postcss').load(file);
|
|
373
383
|
if (typeof config === 'function') {
|
|
374
384
|
config = config();
|
|
375
385
|
} else {
|
|
@@ -684,10 +694,12 @@ async function build() {
|
|
|
684
694
|
...contextDependencies,
|
|
685
695
|
...extractFileGlobs(config1)
|
|
686
696
|
], {
|
|
697
|
+
usePolling: shouldPoll,
|
|
698
|
+
interval: shouldPoll ? pollInterval : undefined,
|
|
687
699
|
ignoreInitial: true,
|
|
688
|
-
awaitWriteFinish:
|
|
700
|
+
awaitWriteFinish: shouldCoalesceWriteEvents ? {
|
|
689
701
|
stabilityThreshold: 50,
|
|
690
|
-
pollInterval:
|
|
702
|
+
pollInterval: pollInterval
|
|
691
703
|
} : false
|
|
692
704
|
});
|
|
693
705
|
let chain = Promise.resolve();
|
package/lib/corePluginList.js
CHANGED
package/lib/corePlugins.js
CHANGED
|
@@ -8,6 +8,7 @@ var path = _interopRequireWildcard(require("path"));
|
|
|
8
8
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
9
9
|
var _createUtilityPlugin = _interopRequireDefault(require("./util/createUtilityPlugin"));
|
|
10
10
|
var _buildMediaQuery = _interopRequireDefault(require("./util/buildMediaQuery"));
|
|
11
|
+
var _escapeClassName = _interopRequireDefault(require("./util/escapeClassName"));
|
|
11
12
|
var _parseAnimationValue = _interopRequireDefault(require("./util/parseAnimationValue"));
|
|
12
13
|
var _flattenColorPalette = _interopRequireDefault(require("./util/flattenColorPalette"));
|
|
13
14
|
var _withAlphaVariable = _interopRequireWildcard(require("./util/withAlphaVariable"));
|
|
@@ -116,7 +117,28 @@ let variantPlugins = {
|
|
|
116
117
|
'last-of-type',
|
|
117
118
|
'only-of-type',
|
|
118
119
|
// State
|
|
119
|
-
|
|
120
|
+
[
|
|
121
|
+
'visited',
|
|
122
|
+
({ container })=>{
|
|
123
|
+
let toRemove = [
|
|
124
|
+
'--tw-text-opacity',
|
|
125
|
+
'--tw-border-opacity',
|
|
126
|
+
'--tw-bg-opacity'
|
|
127
|
+
];
|
|
128
|
+
container.walkDecls((decl)=>{
|
|
129
|
+
if (toRemove.includes(decl.prop)) {
|
|
130
|
+
decl.remove();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
for (const varName of toRemove){
|
|
134
|
+
if (decl.value.includes(`/ var(${varName})`)) {
|
|
135
|
+
decl.value = decl.value.replace(`/ var(${varName})`, '');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return ':visited';
|
|
140
|
+
},
|
|
141
|
+
],
|
|
120
142
|
'target',
|
|
121
143
|
[
|
|
122
144
|
'open',
|
|
@@ -149,13 +171,22 @@ let variantPlugins = {
|
|
|
149
171
|
]
|
|
150
172
|
);
|
|
151
173
|
for (let [variantName, state] of pseudoVariants){
|
|
152
|
-
addVariant(variantName,
|
|
174
|
+
addVariant(variantName, (ctx)=>{
|
|
175
|
+
let result = typeof state === 'function' ? state(ctx) : state;
|
|
176
|
+
return `&${result}`;
|
|
177
|
+
});
|
|
153
178
|
}
|
|
154
179
|
for (let [variantName1, state1] of pseudoVariants){
|
|
155
|
-
addVariant(`group-${variantName1}`,
|
|
180
|
+
addVariant(`group-${variantName1}`, (ctx)=>{
|
|
181
|
+
let result = typeof state1 === 'function' ? state1(ctx) : state1;
|
|
182
|
+
return `:merge(.group)${result} &`;
|
|
183
|
+
});
|
|
156
184
|
}
|
|
157
185
|
for (let [variantName2, state2] of pseudoVariants){
|
|
158
|
-
addVariant(`peer-${variantName2}`,
|
|
186
|
+
addVariant(`peer-${variantName2}`, (ctx)=>{
|
|
187
|
+
let result = typeof state2 === 'function' ? state2(ctx) : state2;
|
|
188
|
+
return `:merge(.peer)${result} ~ &`;
|
|
189
|
+
});
|
|
159
190
|
}
|
|
160
191
|
},
|
|
161
192
|
directionVariants: ({ addVariant })=>{
|
|
@@ -179,7 +210,7 @@ let variantPlugins = {
|
|
|
179
210
|
addVariant('motion-reduce', '@media (prefers-reduced-motion: reduce)');
|
|
180
211
|
},
|
|
181
212
|
darkVariants: ({ config , addVariant })=>{
|
|
182
|
-
let mode = config('darkMode', 'media');
|
|
213
|
+
let [mode, className = '.dark'] = [].concat(config('darkMode', 'media'));
|
|
183
214
|
if (mode === false) {
|
|
184
215
|
mode = 'media';
|
|
185
216
|
_log.default.warn('darkmode-false', [
|
|
@@ -189,7 +220,7 @@ let variantPlugins = {
|
|
|
189
220
|
]);
|
|
190
221
|
}
|
|
191
222
|
if (mode === 'class') {
|
|
192
|
-
addVariant('dark',
|
|
223
|
+
addVariant('dark', `${className} &`);
|
|
193
224
|
} else if (mode === 'media') {
|
|
194
225
|
addVariant('dark', '@media (prefers-color-scheme: dark)');
|
|
195
226
|
}
|
|
@@ -790,6 +821,38 @@ let corePlugins = {
|
|
|
790
821
|
}
|
|
791
822
|
});
|
|
792
823
|
},
|
|
824
|
+
borderSpacing: ({ addDefaults , matchUtilities , theme })=>{
|
|
825
|
+
addDefaults('border-spacing', {
|
|
826
|
+
'--tw-border-spacing-x': 0,
|
|
827
|
+
'--tw-border-spacing-y': 0
|
|
828
|
+
});
|
|
829
|
+
matchUtilities({
|
|
830
|
+
'border-spacing': (value)=>{
|
|
831
|
+
return {
|
|
832
|
+
'--tw-border-spacing-x': value,
|
|
833
|
+
'--tw-border-spacing-y': value,
|
|
834
|
+
'@defaults border-spacing': {},
|
|
835
|
+
'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)'
|
|
836
|
+
};
|
|
837
|
+
},
|
|
838
|
+
'border-spacing-x': (value)=>{
|
|
839
|
+
return {
|
|
840
|
+
'--tw-border-spacing-x': value,
|
|
841
|
+
'@defaults border-spacing': {},
|
|
842
|
+
'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)'
|
|
843
|
+
};
|
|
844
|
+
},
|
|
845
|
+
'border-spacing-y': (value)=>{
|
|
846
|
+
return {
|
|
847
|
+
'--tw-border-spacing-y': value,
|
|
848
|
+
'@defaults border-spacing': {},
|
|
849
|
+
'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)'
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
}, {
|
|
853
|
+
values: theme('borderSpacing')
|
|
854
|
+
});
|
|
855
|
+
},
|
|
793
856
|
transformOrigin: (0, _createUtilityPlugin).default('transformOrigin', [
|
|
794
857
|
[
|
|
795
858
|
'origin',
|
|
@@ -959,8 +1022,8 @@ let corePlugins = {
|
|
|
959
1022
|
}
|
|
960
1023
|
});
|
|
961
1024
|
},
|
|
962
|
-
animation: ({ matchUtilities , theme ,
|
|
963
|
-
let prefixName = (name)
|
|
1025
|
+
animation: ({ matchUtilities , theme , config })=>{
|
|
1026
|
+
let prefixName = (name)=>`${config('prefix')}${(0, _escapeClassName).default(name)}`
|
|
964
1027
|
;
|
|
965
1028
|
var ref;
|
|
966
1029
|
let keyframes = Object.fromEntries(Object.entries((ref = theme('keyframes')) !== null && ref !== void 0 ? ref : {}).map(([key, value])=>{
|
|
@@ -2501,6 +2564,12 @@ let corePlugins = {
|
|
|
2501
2564
|
},
|
|
2502
2565
|
'.text-justify': {
|
|
2503
2566
|
'text-align': 'justify'
|
|
2567
|
+
},
|
|
2568
|
+
'.text-start': {
|
|
2569
|
+
'text-align': 'start'
|
|
2570
|
+
},
|
|
2571
|
+
'.text-end': {
|
|
2572
|
+
'text-align': 'end'
|
|
2504
2573
|
}
|
|
2505
2574
|
});
|
|
2506
2575
|
},
|
|
@@ -3118,8 +3187,9 @@ let corePlugins = {
|
|
|
3118
3187
|
});
|
|
3119
3188
|
},
|
|
3120
3189
|
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme })=>{
|
|
3190
|
+
var ref;
|
|
3121
3191
|
let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5');
|
|
3122
|
-
let ringColorDefault = (0, _withAlphaVariable).withAlphaValue(theme('ringColor.DEFAULT
|
|
3192
|
+
let ringColorDefault = (0, _withAlphaVariable).withAlphaValue((ref = theme('ringColor')) === null || ref === void 0 ? void 0 : ref.DEFAULT, ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
|
|
3123
3193
|
addDefaults('ring-width', {
|
|
3124
3194
|
'--tw-ring-inset': ' ',
|
|
3125
3195
|
'--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
|
|
@@ -3154,9 +3224,14 @@ let corePlugins = {
|
|
|
3154
3224
|
}
|
|
3155
3225
|
});
|
|
3156
3226
|
},
|
|
3157
|
-
ringColor: ({ matchUtilities , theme })=>{
|
|
3227
|
+
ringColor: ({ matchUtilities , theme , corePlugins: corePlugins6 })=>{
|
|
3158
3228
|
matchUtilities({
|
|
3159
3229
|
ring: (value)=>{
|
|
3230
|
+
if (!corePlugins6('ringOpacity')) {
|
|
3231
|
+
return {
|
|
3232
|
+
'--tw-ring-color': (0, _toColorValue).default(value)
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3160
3235
|
return (0, _withAlphaVariable).default({
|
|
3161
3236
|
color: value,
|
|
3162
3237
|
property: '--tw-ring-color',
|
package/lib/featureFlags.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.flagEnabled = flagEnabled;
|
|
6
6
|
exports.issueFlagNotices = issueFlagNotices;
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _picocolors = _interopRequireDefault(require("picocolors"));
|
|
9
9
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
10
10
|
function _interopRequireDefault(obj) {
|
|
11
11
|
return obj && obj.__esModule ? obj : {
|
|
@@ -47,7 +47,7 @@ function issueFlagNotices(config) {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
if (experimentalFlagsEnabled(config).length > 0) {
|
|
50
|
-
let changes = experimentalFlagsEnabled(config).map((s)=>
|
|
50
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)
|
|
51
51
|
).join(', ');
|
|
52
52
|
_log.default.warn('experimental-flags-enabled', [
|
|
53
53
|
`You have enabled experimental features: ${changes}`,
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,18 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
17
17
|
return root;
|
|
18
18
|
},
|
|
19
19
|
function(root, result) {
|
|
20
|
-
|
|
20
|
+
let context = (0, _setupTrackingContext).default(configOrPath);
|
|
21
|
+
if (root.type === 'document') {
|
|
22
|
+
let roots = root.nodes.filter((node)=>node.type === 'root'
|
|
23
|
+
);
|
|
24
|
+
for (const root1 of roots){
|
|
25
|
+
if (root1.type === 'root') {
|
|
26
|
+
(0, _processTailwindFeatures).default(context)(root1, result);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
(0, _processTailwindFeatures).default(context)(root, result);
|
|
21
32
|
},
|
|
22
33
|
_sharedState.env.DEBUG && function(root) {
|
|
23
34
|
console.timeEnd('JIT TOTAL');
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.hasContentChanged = hasContentChanged;
|
|
6
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
7
|
+
var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function _interopRequireWildcard(obj) {
|
|
14
|
+
if (obj && obj.__esModule) {
|
|
15
|
+
return obj;
|
|
16
|
+
} else {
|
|
17
|
+
var newObj = {};
|
|
18
|
+
if (obj != null) {
|
|
19
|
+
for(var key in obj){
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
21
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
22
|
+
if (desc.get || desc.set) {
|
|
23
|
+
Object.defineProperty(newObj, key, desc);
|
|
24
|
+
} else {
|
|
25
|
+
newObj[key] = obj[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
newObj.default = obj;
|
|
31
|
+
return newObj;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Calculate the hash of a string.
|
|
36
|
+
*
|
|
37
|
+
* This doesn't need to be cryptographically secure or
|
|
38
|
+
* anything like that since it's used only to detect
|
|
39
|
+
* when the CSS changes to invalidate the context.
|
|
40
|
+
*
|
|
41
|
+
* This is wrapped in a try/catch because it's really dependent
|
|
42
|
+
* on how Node itself is build and the environment and OpenSSL
|
|
43
|
+
* version / build that is installed on the user's machine.
|
|
44
|
+
*
|
|
45
|
+
* Based on the environment this can just outright fail.
|
|
46
|
+
*
|
|
47
|
+
* See https://github.com/nodejs/node/issues/40455
|
|
48
|
+
*
|
|
49
|
+
* @param {string} str
|
|
50
|
+
*/ function getHash(str) {
|
|
51
|
+
try {
|
|
52
|
+
return _crypto.default.createHash('md5').update(str, 'utf-8').digest('binary');
|
|
53
|
+
} catch (err) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function hasContentChanged(sourcePath, root) {
|
|
58
|
+
let css = root.toString();
|
|
59
|
+
// We only care about files with @tailwind directives
|
|
60
|
+
// Other files use an existing context
|
|
61
|
+
if (!css.includes('@tailwind')) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
let existingHash = sharedState.sourceHashMap.get(sourcePath);
|
|
65
|
+
let rootHash = getHash(css);
|
|
66
|
+
let didChange = existingHash !== rootHash;
|
|
67
|
+
sharedState.sourceHashMap.set(sourcePath, rootHash);
|
|
68
|
+
return didChange;
|
|
69
|
+
}
|
|
@@ -14,7 +14,7 @@ let comparisonMap = {
|
|
|
14
14
|
};
|
|
15
15
|
let types = new Set(Object.keys(comparisonMap));
|
|
16
16
|
function collapseAdjacentRules() {
|
|
17
|
-
|
|
17
|
+
function collapseRulesIn(root) {
|
|
18
18
|
let currentRule = null;
|
|
19
19
|
root.each((node)=>{
|
|
20
20
|
if (!types.has(node.type)) {
|
|
@@ -37,5 +37,18 @@ function collapseAdjacentRules() {
|
|
|
37
37
|
currentRule = node;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
+
// After we've collapsed adjacent rules & at-rules, we need to collapse
|
|
41
|
+
// adjacent rules & at-rules that are children of at-rules.
|
|
42
|
+
// We do not care about nesting rules because Tailwind CSS
|
|
43
|
+
// explicitly does not handle rule nesting on its own as
|
|
44
|
+
// the user is expected to use a nesting plugin
|
|
45
|
+
root.each((node)=>{
|
|
46
|
+
if (node.type === 'atrule') {
|
|
47
|
+
collapseRulesIn(node);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return (root)=>{
|
|
52
|
+
collapseRulesIn(root);
|
|
40
53
|
};
|
|
41
54
|
}
|
|
@@ -7,14 +7,16 @@ const PATTERNS = [
|
|
|
7
7
|
/(?:\['([^'\s]+[^<>"'`\s:\\])')/.source,
|
|
8
8
|
/(?:\["([^"\s]+[^<>"'`\s:\\])")/.source,
|
|
9
9
|
/(?:\[`([^`\s]+[^<>"'`\s:\\])`)/.source,
|
|
10
|
-
/([
|
|
11
|
-
/([
|
|
10
|
+
/([^${(<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
|
|
11
|
+
/([^${(<>"'`\s]*\[\w*"[^'`\s]*"?\])/.source,
|
|
12
12
|
/([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
|
|
13
13
|
/([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
|
|
14
14
|
/([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
|
|
15
15
|
/([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
|
|
16
|
-
/([^<>"'`\s]*\['[^"
|
|
17
|
-
/([^<>"'`\s]*\["[^
|
|
16
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*\('[^"`\s]*'\)+\])/.source,
|
|
17
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*\("[^'`\s]*"\)+\])/.source,
|
|
18
|
+
/([^${(<>"'`\s]*\['[^"'`\s]*'\])/.source,
|
|
19
|
+
/([^${(<>"'`\s]*\["[^"'`\s]*"\])/.source,
|
|
18
20
|
/([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source,
|
|
19
21
|
/([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
|
|
20
22
|
/([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
|