tailwindcss 0.0.0-insiders.bbafc8e → 0.0.0-insiders.bbc2f3f

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.
Files changed (198) hide show
  1. package/README.md +16 -13
  2. package/dist/chunk-5C7JPVMO.mjs +10 -0
  3. package/dist/chunk-AZANAYY2.mjs +1 -0
  4. package/dist/chunk-V2K3XTS4.mjs +1 -0
  5. package/dist/colors-b_6i0Oi7.d.ts +295 -0
  6. package/dist/colors.d.mts +295 -0
  7. package/dist/colors.d.ts +5 -0
  8. package/dist/colors.js +1 -0
  9. package/dist/colors.mjs +1 -0
  10. package/dist/default-theme.d.mts +1147 -0
  11. package/dist/default-theme.d.ts +1147 -0
  12. package/dist/default-theme.js +1 -0
  13. package/dist/default-theme.mjs +1 -0
  14. package/dist/flatten-color-palette.d.mts +6 -0
  15. package/dist/flatten-color-palette.d.ts +6 -0
  16. package/dist/flatten-color-palette.js +1 -0
  17. package/dist/flatten-color-palette.mjs +1 -0
  18. package/dist/lib.d.mts +260 -0
  19. package/dist/lib.d.ts +3 -0
  20. package/dist/lib.js +33 -0
  21. package/dist/lib.mjs +24 -0
  22. package/dist/plugin.d.mts +11 -0
  23. package/dist/plugin.d.ts +104 -0
  24. package/dist/plugin.js +1 -0
  25. package/dist/plugin.mjs +1 -0
  26. package/dist/resolve-config-BIFUA2FY.d.ts +29 -0
  27. package/dist/resolve-config-QUZ9b-Gn.d.mts +190 -0
  28. package/dist/types-B254mqw1.d.mts +98 -0
  29. package/index.css +865 -0
  30. package/package.json +73 -95
  31. package/preflight.css +383 -0
  32. package/theme.css +453 -0
  33. package/CHANGELOG.md +0 -2084
  34. package/base.css +0 -1
  35. package/colors.js +0 -2
  36. package/components.css +0 -1
  37. package/defaultConfig.js +0 -2
  38. package/defaultTheme.js +0 -2
  39. package/lib/cli-peer-dependencies.js +0 -15
  40. package/lib/cli.js +0 -741
  41. package/lib/constants.js +0 -37
  42. package/lib/corePluginList.js +0 -178
  43. package/lib/corePlugins.js +0 -3587
  44. package/lib/css/LICENSE +0 -25
  45. package/lib/css/preflight.css +0 -367
  46. package/lib/featureFlags.js +0 -59
  47. package/lib/index.js +0 -41
  48. package/lib/lib/cacheInvalidation.js +0 -69
  49. package/lib/lib/collapseAdjacentRules.js +0 -54
  50. package/lib/lib/collapseDuplicateDeclarations.js +0 -80
  51. package/lib/lib/defaultExtractor.js +0 -44
  52. package/lib/lib/detectNesting.js +0 -34
  53. package/lib/lib/evaluateTailwindFunctions.js +0 -171
  54. package/lib/lib/expandApplyAtRules.js +0 -433
  55. package/lib/lib/expandTailwindAtRules.js +0 -262
  56. package/lib/lib/generateRules.js +0 -631
  57. package/lib/lib/getModuleDependencies.js +0 -48
  58. package/lib/lib/normalizeTailwindDirectives.js +0 -84
  59. package/lib/lib/partitionApplyAtRules.js +0 -53
  60. package/lib/lib/resolveDefaultsAtRules.js +0 -143
  61. package/lib/lib/setupContextUtils.js +0 -859
  62. package/lib/lib/setupTrackingContext.js +0 -171
  63. package/lib/lib/sharedState.js +0 -52
  64. package/lib/lib/substituteScreenAtRules.js +0 -27
  65. package/lib/postcss-plugins/nesting/README.md +0 -42
  66. package/lib/postcss-plugins/nesting/index.js +0 -17
  67. package/lib/postcss-plugins/nesting/plugin.js +0 -85
  68. package/lib/processTailwindFeatures.js +0 -59
  69. package/lib/public/colors.js +0 -329
  70. package/lib/public/create-plugin.js +0 -13
  71. package/lib/public/default-config.js +0 -14
  72. package/lib/public/default-theme.js +0 -14
  73. package/lib/public/resolve-config.js +0 -19
  74. package/lib/util/bigSign.js +0 -8
  75. package/lib/util/buildMediaQuery.js +0 -20
  76. package/lib/util/cloneDeep.js +0 -19
  77. package/lib/util/cloneNodes.js +0 -25
  78. package/lib/util/color.js +0 -99
  79. package/lib/util/configurePlugins.js +0 -18
  80. package/lib/util/createPlugin.js +0 -29
  81. package/lib/util/createUtilityPlugin.js +0 -49
  82. package/lib/util/dataTypes.js +0 -233
  83. package/lib/util/defaults.js +0 -22
  84. package/lib/util/escapeClassName.js +0 -19
  85. package/lib/util/escapeCommas.js +0 -8
  86. package/lib/util/flattenColorPalette.js +0 -17
  87. package/lib/util/formatVariantSelector.js +0 -186
  88. package/lib/util/getAllConfigs.js +0 -29
  89. package/lib/util/hashConfig.js +0 -16
  90. package/lib/util/isKeyframeRule.js +0 -8
  91. package/lib/util/isPlainObject.js +0 -12
  92. package/lib/util/isValidArbitraryValue.js +0 -64
  93. package/lib/util/log.js +0 -51
  94. package/lib/util/nameClass.js +0 -32
  95. package/lib/util/negateValue.js +0 -19
  96. package/lib/util/normalizeConfig.js +0 -240
  97. package/lib/util/normalizeScreens.js +0 -59
  98. package/lib/util/parseAnimationValue.js +0 -89
  99. package/lib/util/parseBoxShadowValue.js +0 -117
  100. package/lib/util/parseDependency.js +0 -63
  101. package/lib/util/parseObjectStyles.js +0 -31
  102. package/lib/util/pluginUtils.js +0 -179
  103. package/lib/util/prefixSelector.js +0 -20
  104. package/lib/util/resolveConfig.js +0 -255
  105. package/lib/util/resolveConfigPath.js +0 -51
  106. package/lib/util/responsive.js +0 -19
  107. package/lib/util/tap.js +0 -9
  108. package/lib/util/toColorValue.js +0 -8
  109. package/lib/util/toPath.js +0 -14
  110. package/lib/util/transformThemeValue.js +0 -59
  111. package/lib/util/withAlphaVariable.js +0 -67
  112. package/nesting/index.js +0 -2
  113. package/peers/index.js +0 -75077
  114. package/plugin.js +0 -2
  115. package/prettier.config.js +0 -19
  116. package/resolveConfig.js +0 -2
  117. package/screens.css +0 -1
  118. package/scripts/create-plugin-list.js +0 -10
  119. package/scripts/install-integrations.js +0 -27
  120. package/scripts/rebuildFixtures.js +0 -68
  121. package/src/cli-peer-dependencies.js +0 -9
  122. package/src/cli.js +0 -815
  123. package/src/constants.js +0 -17
  124. package/src/corePluginList.js +0 -1
  125. package/src/corePlugins.js +0 -2365
  126. package/src/css/LICENSE +0 -25
  127. package/src/css/preflight.css +0 -367
  128. package/src/featureFlags.js +0 -54
  129. package/src/index.js +0 -42
  130. package/src/lib/cacheInvalidation.js +0 -52
  131. package/src/lib/collapseAdjacentRules.js +0 -54
  132. package/src/lib/collapseDuplicateDeclarations.js +0 -93
  133. package/src/lib/defaultExtractor.js +0 -50
  134. package/src/lib/detectNesting.js +0 -39
  135. package/src/lib/evaluateTailwindFunctions.js +0 -198
  136. package/src/lib/expandApplyAtRules.js +0 -480
  137. package/src/lib/expandTailwindAtRules.js +0 -292
  138. package/src/lib/generateRules.js +0 -623
  139. package/src/lib/getModuleDependencies.js +0 -39
  140. package/src/lib/normalizeTailwindDirectives.js +0 -84
  141. package/src/lib/partitionApplyAtRules.js +0 -52
  142. package/src/lib/resolveDefaultsAtRules.js +0 -146
  143. package/src/lib/setupContextUtils.js +0 -883
  144. package/src/lib/setupTrackingContext.js +0 -183
  145. package/src/lib/sharedState.js +0 -48
  146. package/src/lib/substituteScreenAtRules.js +0 -19
  147. package/src/postcss-plugins/nesting/README.md +0 -42
  148. package/src/postcss-plugins/nesting/index.js +0 -13
  149. package/src/postcss-plugins/nesting/plugin.js +0 -80
  150. package/src/processTailwindFeatures.js +0 -58
  151. package/src/public/colors.js +0 -300
  152. package/src/public/create-plugin.js +0 -2
  153. package/src/public/default-config.js +0 -4
  154. package/src/public/default-theme.js +0 -4
  155. package/src/public/resolve-config.js +0 -7
  156. package/src/util/bigSign.js +0 -3
  157. package/src/util/buildMediaQuery.js +0 -20
  158. package/src/util/cloneDeep.js +0 -11
  159. package/src/util/cloneNodes.js +0 -24
  160. package/src/util/color.js +0 -69
  161. package/src/util/configurePlugins.js +0 -23
  162. package/src/util/createPlugin.js +0 -27
  163. package/src/util/createUtilityPlugin.js +0 -37
  164. package/src/util/dataTypes.js +0 -248
  165. package/src/util/defaults.js +0 -17
  166. package/src/util/escapeClassName.js +0 -8
  167. package/src/util/escapeCommas.js +0 -3
  168. package/src/util/flattenColorPalette.js +0 -13
  169. package/src/util/formatVariantSelector.js +0 -196
  170. package/src/util/getAllConfigs.js +0 -19
  171. package/src/util/hashConfig.js +0 -5
  172. package/src/util/isKeyframeRule.js +0 -3
  173. package/src/util/isPlainObject.js +0 -8
  174. package/src/util/isValidArbitraryValue.js +0 -61
  175. package/src/util/log.js +0 -29
  176. package/src/util/nameClass.js +0 -26
  177. package/src/util/negateValue.js +0 -16
  178. package/src/util/normalizeConfig.js +0 -270
  179. package/src/util/normalizeScreens.js +0 -45
  180. package/src/util/parseAnimationValue.js +0 -68
  181. package/src/util/parseBoxShadowValue.js +0 -119
  182. package/src/util/parseDependency.js +0 -49
  183. package/src/util/parseObjectStyles.js +0 -19
  184. package/src/util/pluginUtils.js +0 -192
  185. package/src/util/prefixSelector.js +0 -14
  186. package/src/util/resolveConfig.js +0 -269
  187. package/src/util/resolveConfigPath.js +0 -55
  188. package/src/util/responsive.js +0 -10
  189. package/src/util/tap.js +0 -4
  190. package/src/util/toColorValue.js +0 -3
  191. package/src/util/toPath.js +0 -26
  192. package/src/util/transformThemeValue.js +0 -52
  193. package/src/util/withAlphaVariable.js +0 -49
  194. package/stubs/defaultConfig.stub.js +0 -950
  195. package/stubs/defaultPostCssConfig.stub.js +0 -6
  196. package/stubs/simpleConfig.stub.js +0 -7
  197. package/tailwind.css +0 -5
  198. package/variants.css +0 -1
@@ -1,171 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = setupTrackingContext;
6
- var _fs = _interopRequireDefault(require("fs"));
7
- var _path = _interopRequireDefault(require("path"));
8
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
9
- var _quickLru = _interopRequireDefault(require("quick-lru"));
10
- var _normalizePath = _interopRequireDefault(require("normalize-path"));
11
- var _hashConfig = _interopRequireDefault(require("../util/hashConfig"));
12
- var _getModuleDependencies = _interopRequireDefault(require("../lib/getModuleDependencies"));
13
- var _resolveConfig = _interopRequireDefault(require("../public/resolve-config"));
14
- var _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPath"));
15
- var _sharedState = require("./sharedState");
16
- var _setupContextUtils = require("./setupContextUtils");
17
- var _parseDependency = _interopRequireDefault(require("../util/parseDependency"));
18
- function _interopRequireDefault(obj) {
19
- return obj && obj.__esModule ? obj : {
20
- default: obj
21
- };
22
- }
23
- let configPathCache = new _quickLru.default({
24
- maxSize: 100
25
- });
26
- let candidateFilesCache = new WeakMap();
27
- function getCandidateFiles(context, tailwindConfig) {
28
- if (candidateFilesCache.has(context)) {
29
- return candidateFilesCache.get(context);
30
- }
31
- let candidateFiles = tailwindConfig.content.files.filter((item)=>typeof item === 'string'
32
- ).map((contentPath)=>(0, _normalizePath).default(contentPath)
33
- );
34
- return candidateFilesCache.set(context, candidateFiles).get(context);
35
- }
36
- // Get the config object based on a path
37
- function getTailwindConfig(configOrPath) {
38
- let userConfigPath = (0, _resolveConfigPath).default(configOrPath);
39
- if (userConfigPath !== null) {
40
- let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
41
- let newDeps = (0, _getModuleDependencies).default(userConfigPath).map((dep)=>dep.file
42
- );
43
- let modified = false;
44
- let newModified = new Map();
45
- for (let file of newDeps){
46
- let time = _fs.default.statSync(file).mtimeMs;
47
- newModified.set(file, time);
48
- if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
49
- modified = true;
50
- }
51
- }
52
- // It hasn't changed (based on timestamps)
53
- if (!modified) {
54
- return [
55
- prevConfig,
56
- userConfigPath,
57
- prevConfigHash,
58
- prevDeps
59
- ];
60
- }
61
- // It has changed (based on timestamps), or first run
62
- for (let file1 of newDeps){
63
- delete require.cache[file1];
64
- }
65
- let newConfig = (0, _resolveConfig).default(require(userConfigPath));
66
- let newHash = (0, _hashConfig).default(newConfig);
67
- configPathCache.set(userConfigPath, [
68
- newConfig,
69
- newHash,
70
- newDeps,
71
- newModified
72
- ]);
73
- return [
74
- newConfig,
75
- userConfigPath,
76
- newHash,
77
- newDeps
78
- ];
79
- }
80
- // It's a plain object, not a path
81
- let newConfig = (0, _resolveConfig).default(configOrPath.config === undefined ? configOrPath : configOrPath.config);
82
- return [
83
- newConfig,
84
- null,
85
- (0, _hashConfig).default(newConfig),
86
- []
87
- ];
88
- }
89
- function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
90
- let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === 'string'
91
- ).map(({ raw , extension ='html' })=>({
92
- content: raw,
93
- extension
94
- })
95
- );
96
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
97
- let content = _fs.default.readFileSync(changedFile, 'utf8');
98
- let extension = _path.default.extname(changedFile).slice(1);
99
- changedContent.push({
100
- content,
101
- extension
102
- });
103
- }
104
- return changedContent;
105
- }
106
- function resolveChangedFiles(candidateFiles, fileModifiedMap) {
107
- let changedFiles = new Set();
108
- _sharedState.env.DEBUG && console.time('Finding changed files');
109
- let files = _fastGlob.default.sync(candidateFiles);
110
- for (let file of files){
111
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
112
- let modified = _fs.default.statSync(file).mtimeMs;
113
- if (modified > prevModified) {
114
- changedFiles.add(file);
115
- fileModifiedMap.set(file, modified);
116
- }
117
- }
118
- _sharedState.env.DEBUG && console.timeEnd('Finding changed files');
119
- return changedFiles;
120
- }
121
- function setupTrackingContext(configOrPath) {
122
- return ({ tailwindDirectives , registerDependency })=>{
123
- return (root, result)=>{
124
- let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
125
- let contextDependencies = new Set(configDependencies);
126
- // If there are no @tailwind or @apply rules, we don't consider this CSS
127
- // file or its dependencies to be dependencies of the context. Can reuse
128
- // the context even if they change. We may want to think about `@layer`
129
- // being part of this trigger too, but it's tough because it's impossible
130
- // for a layer in one file to end up in the actual @tailwind rule in
131
- // another file since independent sources are effectively isolated.
132
- if (tailwindDirectives.size > 0) {
133
- // Add current css file as a context dependencies.
134
- contextDependencies.add(result.opts.from);
135
- // Add all css @import dependencies as context dependencies.
136
- for (let message of result.messages){
137
- if (message.type === 'dependency') {
138
- contextDependencies.add(message.file);
139
- }
140
- }
141
- }
142
- let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
143
- let candidateFiles = getCandidateFiles(context, tailwindConfig);
144
- // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
145
- // dependencies to be dependencies of the context. Can reuse the context even if they change.
146
- // We may want to think about `@layer` being part of this trigger too, but it's tough
147
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
148
- // in another file since independent sources are effectively isolated.
149
- if (tailwindDirectives.size > 0) {
150
- let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
151
- // Add template paths as postcss dependencies.
152
- for (let fileOrGlob of candidateFiles){
153
- let dependency = (0, _parseDependency).default(fileOrGlob);
154
- if (dependency) {
155
- registerDependency(dependency);
156
- }
157
- }
158
- for (let changedContent of resolvedChangedContent(context, candidateFiles, fileModifiedMap)){
159
- context.changedContent.push(changedContent);
160
- }
161
- }
162
- for (let file of configDependencies){
163
- registerDependency({
164
- type: 'dependency',
165
- file
166
- });
167
- }
168
- return context;
169
- };
170
- };
171
- }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.resolveDebug = resolveDebug;
6
- exports.NOT_ON_DEMAND = exports.sourceHashMap = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
7
- const env = {
8
- NODE_ENV: process.env.NODE_ENV,
9
- DEBUG: resolveDebug(process.env.DEBUG)
10
- };
11
- exports.env = env;
12
- const contextMap = new Map();
13
- exports.contextMap = contextMap;
14
- const configContextMap = new Map();
15
- exports.configContextMap = configContextMap;
16
- const contextSourcesMap = new Map();
17
- exports.contextSourcesMap = contextSourcesMap;
18
- const sourceHashMap = new Map();
19
- exports.sourceHashMap = sourceHashMap;
20
- const NOT_ON_DEMAND = new String('*');
21
- exports.NOT_ON_DEMAND = NOT_ON_DEMAND;
22
- function resolveDebug(debug) {
23
- if (debug === undefined) {
24
- return false;
25
- }
26
- // Environment variables are strings, so convert to boolean
27
- if (debug === 'true' || debug === '1') {
28
- return true;
29
- }
30
- if (debug === 'false' || debug === '0') {
31
- return false;
32
- }
33
- // Keep the debug convention into account:
34
- // DEBUG=* -> This enables all debug modes
35
- // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
36
- // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
37
- // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
38
- if (debug === '*') {
39
- return true;
40
- }
41
- let debuggers = debug.split(',').map((d)=>d.split(':')[0]
42
- );
43
- // Ignoring tailwindcss
44
- if (debuggers.includes('-tailwindcss')) {
45
- return false;
46
- }
47
- // Including tailwindcss
48
- if (debuggers.includes('tailwindcss')) {
49
- return true;
50
- }
51
- return false;
52
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = _default;
6
- var _normalizeScreens = require("../util/normalizeScreens");
7
- var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
8
- function _interopRequireDefault(obj) {
9
- return obj && obj.__esModule ? obj : {
10
- default: obj
11
- };
12
- }
13
- function _default({ tailwindConfig: { theme } }) {
14
- return function(css) {
15
- css.walkAtRules('screen', (atRule)=>{
16
- let screen = atRule.params;
17
- let screens = (0, _normalizeScreens).normalizeScreens(theme.screens);
18
- let screenDefinition = screens.find(({ name })=>name === screen
19
- );
20
- if (!screenDefinition) {
21
- throw atRule.error(`No \`${screen}\` screen found.`);
22
- }
23
- atRule.name = 'media';
24
- atRule.params = (0, _buildMediaQuery).default(screenDefinition);
25
- });
26
- };
27
- }
@@ -1,42 +0,0 @@
1
- # tailwindcss/nesting
2
-
3
- This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
4
-
5
- Add it to your PostCSS configuration, somewhere before Tailwind itself:
6
-
7
- ```js
8
- // postcss.config.js
9
- module.exports = {
10
- plugins: [
11
- require('postcss-import'),
12
- require('tailwindcss/nesting'),
13
- require('tailwindcss'),
14
- require('autoprefixer'),
15
- ]
16
- }
17
- ```
18
-
19
- By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
20
-
21
- If you'd rather use [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
22
-
23
- ```shell
24
- npm install postcss-nesting
25
- ```
26
-
27
- Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
28
-
29
- ```js
30
- // postcss.config.js
31
- module.exports = {
32
- plugins: [
33
- require('postcss-import'),
34
- require('tailwindcss/nesting')(require('postcss-nesting')),
35
- require('tailwindcss'),
36
- require('autoprefixer'),
37
- ]
38
- }
39
- ```
40
-
41
- This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `tailwindcss/nesting` itself.
42
-
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = void 0;
6
- var _plugin = require("./plugin");
7
- var _default = Object.assign(function(opts) {
8
- return {
9
- postcssPlugin: 'tailwindcss/nesting',
10
- Once (root, { result }) {
11
- return (0, _plugin).nesting(opts)(root, result);
12
- }
13
- };
14
- }, {
15
- postcss: true
16
- });
17
- exports.default = _default;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.nesting = nesting;
6
- var _postcss = _interopRequireDefault(require("postcss"));
7
- var _postcssNested = _interopRequireDefault(require("postcss-nested"));
8
- function _interopRequireDefault(obj) {
9
- return obj && obj.__esModule ? obj : {
10
- default: obj
11
- };
12
- }
13
- function nesting(opts = _postcssNested.default) {
14
- return (root, result)=>{
15
- root.walkAtRules('screen', (rule)=>{
16
- rule.name = 'media';
17
- rule.params = `screen(${rule.params})`;
18
- });
19
- root.walkAtRules('apply', (rule)=>{
20
- rule.before(_postcss.default.decl({
21
- prop: '__apply',
22
- value: rule.params,
23
- source: rule.source
24
- }));
25
- rule.remove();
26
- });
27
- let plugin = (()=>{
28
- var ref;
29
- if (typeof opts === 'function' || typeof opts === 'object' && (opts === null || opts === void 0 ? void 0 : (ref = opts.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(opts, 'postcssPlugin'))) {
30
- return opts;
31
- }
32
- if (typeof opts === 'string') {
33
- return require(opts);
34
- }
35
- if (Object.keys(opts).length <= 0) {
36
- return _postcssNested.default;
37
- }
38
- throw new Error('tailwindcss/nesting should be loaded with a nesting plugin.');
39
- })();
40
- (0, _postcss).default([
41
- plugin
42
- ]).process(root, result.opts).sync();
43
- root.walkDecls('__apply', (decl)=>{
44
- decl.before(_postcss.default.atRule({
45
- name: 'apply',
46
- params: decl.value,
47
- source: decl.source
48
- }));
49
- decl.remove();
50
- });
51
- /**
52
- * Use a private PostCSS API to remove the "clean" flag from the entire AST.
53
- * This is done because running process() on the AST will set the "clean"
54
- * flag on all nodes, which we don't want.
55
- *
56
- * This causes downstream plugins using the visitor API to be skipped.
57
- *
58
- * This is guarded because the PostCSS API is not public
59
- * and may change in future versions of PostCSS.
60
- *
61
- * See https://github.com/postcss/postcss/issues/1712 for more details
62
- *
63
- * @param {import('postcss').Node} node
64
- */ function markDirty(node) {
65
- if (!('markDirty' in node)) {
66
- return;
67
- }
68
- // Traverse the tree down to the leaf nodes
69
- if (node.nodes) {
70
- node.nodes.forEach((n)=>markDirty(n)
71
- );
72
- }
73
- // If it's a leaf node mark it as dirty
74
- // We do this here because marking a node as dirty
75
- // will walk up the tree and mark all parents as dirty
76
- // resulting in a lot of unnecessary work if we did this
77
- // for every single node
78
- if (!node.nodes) {
79
- node.markDirty();
80
- }
81
- }
82
- markDirty(root);
83
- return root;
84
- };
85
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = processTailwindFeatures;
6
- var _normalizeTailwindDirectives = _interopRequireDefault(require("./lib/normalizeTailwindDirectives"));
7
- var _expandTailwindAtRules = _interopRequireDefault(require("./lib/expandTailwindAtRules"));
8
- var _expandApplyAtRules = _interopRequireDefault(require("./lib/expandApplyAtRules"));
9
- var _evaluateTailwindFunctions = _interopRequireDefault(require("./lib/evaluateTailwindFunctions"));
10
- var _substituteScreenAtRules = _interopRequireDefault(require("./lib/substituteScreenAtRules"));
11
- var _resolveDefaultsAtRules = _interopRequireDefault(require("./lib/resolveDefaultsAtRules"));
12
- var _collapseAdjacentRules = _interopRequireDefault(require("./lib/collapseAdjacentRules"));
13
- var _collapseDuplicateDeclarations = _interopRequireDefault(require("./lib/collapseDuplicateDeclarations"));
14
- var _partitionApplyAtRules = _interopRequireDefault(require("./lib/partitionApplyAtRules"));
15
- var _detectNesting = _interopRequireDefault(require("./lib/detectNesting"));
16
- var _setupContextUtils = require("./lib/setupContextUtils");
17
- var _featureFlags = require("./featureFlags");
18
- function _interopRequireDefault(obj) {
19
- return obj && obj.__esModule ? obj : {
20
- default: obj
21
- };
22
- }
23
- function processTailwindFeatures(setupContext) {
24
- return function(root, result) {
25
- let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives).default(root);
26
- (0, _detectNesting).default()(root, result);
27
- // Partition apply rules that are found in the css
28
- // itself.
29
- (0, _partitionApplyAtRules).default()(root, result);
30
- let context = setupContext({
31
- tailwindDirectives,
32
- applyDirectives,
33
- registerDependency (dependency) {
34
- result.messages.push({
35
- plugin: 'tailwindcss',
36
- parent: result.opts.from,
37
- ...dependency
38
- });
39
- },
40
- createContext (tailwindConfig, changedContent) {
41
- return (0, _setupContextUtils).createContext(tailwindConfig, changedContent, root);
42
- }
43
- })(root, result);
44
- if (context.tailwindConfig.separator === '-') {
45
- throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
46
- }
47
- (0, _featureFlags).issueFlagNotices(context.tailwindConfig);
48
- (0, _expandTailwindAtRules).default(context)(root, result);
49
- // Partition apply rules that are generated by
50
- // addComponents, addUtilities and so on.
51
- (0, _partitionApplyAtRules).default()(root, result);
52
- (0, _expandApplyAtRules).default(context)(root, result);
53
- (0, _evaluateTailwindFunctions).default(context)(root, result);
54
- (0, _substituteScreenAtRules).default(context)(root, result);
55
- (0, _resolveDefaultsAtRules).default(context)(root, result);
56
- (0, _collapseAdjacentRules).default(context)(root, result);
57
- (0, _collapseDuplicateDeclarations).default(context)(root, result);
58
- };
59
- }