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,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.asClass = asClass;
6
- exports.default = nameClass;
7
- exports.formatClass = formatClass;
8
- var _escapeClassName = _interopRequireDefault(require("./escapeClassName"));
9
- var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
10
- function _interopRequireDefault(obj) {
11
- return obj && obj.__esModule ? obj : {
12
- default: obj
13
- };
14
- }
15
- function asClass(name) {
16
- return (0, _escapeCommas).default(`.${(0, _escapeClassName).default(name)}`);
17
- }
18
- function nameClass(classPrefix, key) {
19
- return asClass(formatClass(classPrefix, key));
20
- }
21
- function formatClass(classPrefix, key) {
22
- if (key === 'DEFAULT') {
23
- return classPrefix;
24
- }
25
- if (key === '-' || key === '-DEFAULT') {
26
- return `-${classPrefix}`;
27
- }
28
- if (key.startsWith('-')) {
29
- return `-${classPrefix}${key}`;
30
- }
31
- return `${classPrefix}-${key}`;
32
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = _default;
6
- function _default(value) {
7
- value = `${value}`;
8
- if (value === '0') {
9
- return '0';
10
- }
11
- // Flip sign of numbers
12
- if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
13
- return value.replace(/^[+-]?/, (sign)=>sign === '-' ? '' : '-'
14
- );
15
- }
16
- if (value.includes('var(') || value.includes('calc(')) {
17
- return `calc(${value} * -1)`;
18
- }
19
- }
@@ -1,240 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.normalizeConfig = normalizeConfig;
6
- var _log = _interopRequireWildcard(require("./log"));
7
- function _interopRequireWildcard(obj) {
8
- if (obj && obj.__esModule) {
9
- return obj;
10
- } else {
11
- var newObj = {};
12
- if (obj != null) {
13
- for(var key in obj){
14
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
15
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
16
- if (desc.get || desc.set) {
17
- Object.defineProperty(newObj, key, desc);
18
- } else {
19
- newObj[key] = obj[key];
20
- }
21
- }
22
- }
23
- }
24
- newObj.default = obj;
25
- return newObj;
26
- }
27
- }
28
- function normalizeConfig(config) {
29
- // Quick structure validation
30
- /**
31
- * type FilePath = string
32
- * type RawFile = { raw: string, extension?: string }
33
- * type ExtractorFn = (content: string) => Array<string>
34
- * type TransformerFn = (content: string) => string
35
- *
36
- * type Content =
37
- * | Array<FilePath | RawFile>
38
- * | {
39
- * files: Array<FilePath | RawFile>,
40
- * extract?: ExtractorFn | { [extension: string]: ExtractorFn }
41
- * transform?: TransformerFn | { [extension: string]: TransformerFn }
42
- * }
43
- */ let valid = (()=>{
44
- // `config.purge` should not exist anymore
45
- if (config.purge) {
46
- return false;
47
- }
48
- // `config.content` should exist
49
- if (!config.content) {
50
- return false;
51
- }
52
- // `config.content` should be an object or an array
53
- if (!Array.isArray(config.content) && !(typeof config.content === 'object' && config.content !== null)) {
54
- return false;
55
- }
56
- // When `config.content` is an array, it should consist of FilePaths or RawFiles
57
- if (Array.isArray(config.content)) {
58
- return config.content.every((path)=>{
59
- // `path` can be a string
60
- if (typeof path === 'string') return true;
61
- // `path` can be an object { raw: string, extension?: string }
62
- // `raw` must be a string
63
- if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== 'string') return false;
64
- // `extension` (if provided) should also be a string
65
- if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== 'string') {
66
- return false;
67
- }
68
- return true;
69
- });
70
- }
71
- // When `config.content` is an object
72
- if (typeof config.content === 'object' && config.content !== null) {
73
- // Only `files`, `extract` and `transform` can exist in `config.content`
74
- if (Object.keys(config.content).some((key)=>![
75
- 'files',
76
- 'extract',
77
- 'transform'
78
- ].includes(key)
79
- )) {
80
- return false;
81
- }
82
- // `config.content.files` should exist of FilePaths or RawFiles
83
- if (Array.isArray(config.content.files)) {
84
- if (!config.content.files.every((path)=>{
85
- // `path` can be a string
86
- if (typeof path === 'string') return true;
87
- // `path` can be an object { raw: string, extension?: string }
88
- // `raw` must be a string
89
- if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== 'string') return false;
90
- // `extension` (if provided) should also be a string
91
- if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== 'string') {
92
- return false;
93
- }
94
- return true;
95
- })) {
96
- return false;
97
- }
98
- // `config.content.extract` is optional, and can be a Function or a Record<String, Function>
99
- if (typeof config.content.extract === 'object') {
100
- for (let value of Object.values(config.content.extract)){
101
- if (typeof value !== 'function') {
102
- return false;
103
- }
104
- }
105
- } else if (!(config.content.extract === undefined || typeof config.content.extract === 'function')) {
106
- return false;
107
- }
108
- // `config.content.transform` is optional, and can be a Function or a Record<String, Function>
109
- if (typeof config.content.transform === 'object') {
110
- for (let value of Object.values(config.content.transform)){
111
- if (typeof value !== 'function') {
112
- return false;
113
- }
114
- }
115
- } else if (!(config.content.transform === undefined || typeof config.content.transform === 'function')) {
116
- return false;
117
- }
118
- }
119
- return true;
120
- }
121
- return false;
122
- })();
123
- if (!valid) {
124
- _log.default.warn('purge-deprecation', [
125
- 'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
126
- 'Update your configuration file to eliminate this warning.',
127
- 'https://tailwindcss.com/docs/upgrade-guide#configure-content-sources',
128
- ]);
129
- }
130
- // Normalize the `safelist`
131
- config.safelist = (()=>{
132
- var ref;
133
- let { content , purge , safelist } = config;
134
- if (Array.isArray(safelist)) return safelist;
135
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
136
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
137
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : (ref = purge.options) === null || ref === void 0 ? void 0 : ref.safelist)) return purge.options.safelist;
138
- return [];
139
- })();
140
- // Normalize prefix option
141
- if (typeof config.prefix === 'function') {
142
- _log.default.warn('prefix-function', [
143
- 'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
144
- 'Update `prefix` in your configuration to be a string to eliminate this warning.',
145
- 'https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function',
146
- ]);
147
- config.prefix = '';
148
- } else {
149
- var _prefix;
150
- config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix : '';
151
- }
152
- // Normalize the `content`
153
- config.content = {
154
- files: (()=>{
155
- let { content , purge } = config;
156
- if (Array.isArray(purge)) return purge;
157
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
158
- if (Array.isArray(content)) return content;
159
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
160
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
161
- return [];
162
- })(),
163
- extract: (()=>{
164
- let extract = (()=>{
165
- var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9;
166
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.extract) return config.purge.extract;
167
- if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.extract) return config.content.extract;
168
- if ((ref2 = config.purge) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.extract) === null || ref3 === void 0 ? void 0 : ref3.DEFAULT) return config.purge.extract.DEFAULT;
169
- if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.extract) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.extract.DEFAULT;
170
- if ((ref6 = config.purge) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.options) === null || ref7 === void 0 ? void 0 : ref7.extractors) return config.purge.options.extractors;
171
- if ((ref8 = config.content) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.options) === null || ref9 === void 0 ? void 0 : ref9.extractors) return config.content.options.extractors;
172
- return {};
173
- })();
174
- let extractors = {};
175
- let defaultExtractor = (()=>{
176
- var ref, ref10, ref11, ref12;
177
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref10 = ref.options) === null || ref10 === void 0 ? void 0 : ref10.defaultExtractor) {
178
- return config.purge.options.defaultExtractor;
179
- }
180
- if ((ref11 = config.content) === null || ref11 === void 0 ? void 0 : (ref12 = ref11.options) === null || ref12 === void 0 ? void 0 : ref12.defaultExtractor) {
181
- return config.content.options.defaultExtractor;
182
- }
183
- return undefined;
184
- })();
185
- if (defaultExtractor !== undefined) {
186
- extractors.DEFAULT = defaultExtractor;
187
- }
188
- // Functions
189
- if (typeof extract === 'function') {
190
- extractors.DEFAULT = extract;
191
- } else if (Array.isArray(extract)) {
192
- for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
193
- for (let extension of extensions){
194
- extractors[extension] = extractor;
195
- }
196
- }
197
- } else if (typeof extract === 'object' && extract !== null) {
198
- Object.assign(extractors, extract);
199
- }
200
- return extractors;
201
- })(),
202
- transform: (()=>{
203
- let transform = (()=>{
204
- var ref, ref13, ref14, ref15, ref16, ref17;
205
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
206
- if ((ref13 = config.content) === null || ref13 === void 0 ? void 0 : ref13.transform) return config.content.transform;
207
- if ((ref14 = config.purge) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.transform) === null || ref15 === void 0 ? void 0 : ref15.DEFAULT) return config.purge.transform.DEFAULT;
208
- if ((ref16 = config.content) === null || ref16 === void 0 ? void 0 : (ref17 = ref16.transform) === null || ref17 === void 0 ? void 0 : ref17.DEFAULT) return config.content.transform.DEFAULT;
209
- return {};
210
- })();
211
- let transformers = {};
212
- if (typeof transform === 'function') {
213
- transformers.DEFAULT = transform;
214
- }
215
- if (typeof transform === 'object' && transform !== null) {
216
- Object.assign(transformers, transform);
217
- }
218
- return transformers;
219
- })()
220
- };
221
- // Validate globs to prevent bogus globs.
222
- // E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
223
- for (let file of config.content.files){
224
- if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
225
- _log.default.warn('invalid-glob-braces', [
226
- `The glob pattern ${(0, _log).dim(file)} in your Tailwind CSS configuration is invalid.`,
227
- `Update it to ${(0, _log).dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`
228
- ]);
229
- break;
230
- }
231
- }
232
- if (config.content.files.length === 0) {
233
- _log.default.warn('content-problems', [
234
- 'The `content` option in your Tailwind CSS configuration is missing or empty.',
235
- 'Configure your content sources or your generated CSS will be missing styles.',
236
- 'https://tailwindcss.com/docs/content-configuration',
237
- ]);
238
- }
239
- return config;
240
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.normalizeScreens = normalizeScreens;
6
- function normalizeScreens(screens, root = true) {
7
- if (Array.isArray(screens)) {
8
- return screens.map((screen)=>{
9
- if (root && Array.isArray(screen)) {
10
- throw new Error('The tuple syntax is not supported for `screens`.');
11
- }
12
- if (typeof screen === 'string') {
13
- return {
14
- name: screen.toString(),
15
- values: [
16
- {
17
- min: screen,
18
- max: undefined
19
- }
20
- ]
21
- };
22
- }
23
- let [name, options] = screen;
24
- name = name.toString();
25
- if (typeof options === 'string') {
26
- return {
27
- name,
28
- values: [
29
- {
30
- min: options,
31
- max: undefined
32
- }
33
- ]
34
- };
35
- }
36
- if (Array.isArray(options)) {
37
- return {
38
- name,
39
- values: options.map((option)=>resolveValue(option)
40
- )
41
- };
42
- }
43
- return {
44
- name,
45
- values: [
46
- resolveValue(options)
47
- ]
48
- };
49
- });
50
- }
51
- return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
52
- }
53
- function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {}) {
54
- return {
55
- min,
56
- max,
57
- raw
58
- };
59
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = parseAnimationValue;
6
- const DIRECTIONS = new Set([
7
- 'normal',
8
- 'reverse',
9
- 'alternate',
10
- 'alternate-reverse'
11
- ]);
12
- const PLAY_STATES = new Set([
13
- 'running',
14
- 'paused'
15
- ]);
16
- const FILL_MODES = new Set([
17
- 'none',
18
- 'forwards',
19
- 'backwards',
20
- 'both'
21
- ]);
22
- const ITERATION_COUNTS = new Set([
23
- 'infinite'
24
- ]);
25
- const TIMINGS = new Set([
26
- 'linear',
27
- 'ease',
28
- 'ease-in',
29
- 'ease-out',
30
- 'ease-in-out',
31
- 'step-start',
32
- 'step-end',
33
- ]);
34
- const TIMING_FNS = [
35
- 'cubic-bezier',
36
- 'steps'
37
- ];
38
- const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
39
- ;
40
- const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
41
- ;
42
- const TIME = /^(-?[\d.]+m?s)$/;
43
- const DIGIT = /^(\d+)$/;
44
- function parseAnimationValue(input) {
45
- let animations = input.split(COMMA);
46
- return animations.map((animation)=>{
47
- let value = animation.trim();
48
- let result = {
49
- value
50
- };
51
- let parts = value.split(SPACE);
52
- let seen = new Set();
53
- for (let part of parts){
54
- if (!seen.has('DIRECTIONS') && DIRECTIONS.has(part)) {
55
- result.direction = part;
56
- seen.add('DIRECTIONS');
57
- } else if (!seen.has('PLAY_STATES') && PLAY_STATES.has(part)) {
58
- result.playState = part;
59
- seen.add('PLAY_STATES');
60
- } else if (!seen.has('FILL_MODES') && FILL_MODES.has(part)) {
61
- result.fillMode = part;
62
- seen.add('FILL_MODES');
63
- } else if (!seen.has('ITERATION_COUNTS') && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
64
- result.iterationCount = part;
65
- seen.add('ITERATION_COUNTS');
66
- } else if (!seen.has('TIMING_FUNCTION') && TIMINGS.has(part)) {
67
- result.timingFunction = part;
68
- seen.add('TIMING_FUNCTION');
69
- } else if (!seen.has('TIMING_FUNCTION') && TIMING_FNS.some((f)=>part.startsWith(`${f}(`)
70
- )) {
71
- result.timingFunction = part;
72
- seen.add('TIMING_FUNCTION');
73
- } else if (!seen.has('DURATION') && TIME.test(part)) {
74
- result.duration = part;
75
- seen.add('DURATION');
76
- } else if (!seen.has('DELAY') && TIME.test(part)) {
77
- result.delay = part;
78
- seen.add('DELAY');
79
- } else if (!seen.has('NAME')) {
80
- result.name = part;
81
- seen.add('NAME');
82
- } else {
83
- if (!result.unknown) result.unknown = [];
84
- result.unknown.push(part);
85
- }
86
- }
87
- return result;
88
- });
89
- }
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.parseBoxShadowValue = parseBoxShadowValue;
6
- exports.formatBoxShadowValue = formatBoxShadowValue;
7
- let KEYWORDS = new Set([
8
- 'inset',
9
- 'inherit',
10
- 'initial',
11
- 'revert',
12
- 'unset'
13
- ]);
14
- let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
15
- ;
16
- let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
17
- let SPECIALS = /[(),]/g;
18
- /**
19
- * This splits a string on top-level commas.
20
- *
21
- * Regex doesn't support recursion (at least not the JS-flavored version).
22
- * So we have to use a tiny state machine to keep track of paren vs comma
23
- * placement. Before we'd only exclude commas from the inner-most nested
24
- * set of parens rather than any commas that were not contained in parens
25
- * at all which is the intended behavior here.
26
- *
27
- * Expected behavior:
28
- * var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
29
- * ─┬─ ┬ ┬ ┬
30
- * x x x ╰──────── Split because top-level
31
- * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
32
- *
33
- * @param {string} input
34
- */ function* splitByTopLevelCommas(input) {
35
- SPECIALS.lastIndex = -1;
36
- let depth = 0;
37
- let lastIndex = 0;
38
- let found = false;
39
- // Find all parens & commas
40
- // And only split on commas if they're top-level
41
- for (let match of input.matchAll(SPECIALS)){
42
- if (match[0] === '(') depth++;
43
- if (match[0] === ')') depth--;
44
- if (match[0] === ',' && depth === 0) {
45
- found = true;
46
- yield input.substring(lastIndex, match.index);
47
- lastIndex = match.index + match[0].length;
48
- }
49
- }
50
- // Provide the last segment of the string if available
51
- // Otherwise the whole string since no commas were found
52
- // This mirrors the behavior of string.split()
53
- if (found) {
54
- yield input.substring(lastIndex);
55
- } else {
56
- yield input;
57
- }
58
- }
59
- function parseBoxShadowValue(input) {
60
- let shadows = Array.from(splitByTopLevelCommas(input));
61
- return shadows.map((shadow)=>{
62
- let value = shadow.trim();
63
- let result = {
64
- raw: value
65
- };
66
- let parts = value.split(SPACE);
67
- let seen = new Set();
68
- for (let part of parts){
69
- // Reset index, since the regex is stateful.
70
- LENGTH.lastIndex = 0;
71
- // Keyword
72
- if (!seen.has('KEYWORD') && KEYWORDS.has(part)) {
73
- result.keyword = part;
74
- seen.add('KEYWORD');
75
- } else if (LENGTH.test(part)) {
76
- if (!seen.has('X')) {
77
- result.x = part;
78
- seen.add('X');
79
- } else if (!seen.has('Y')) {
80
- result.y = part;
81
- seen.add('Y');
82
- } else if (!seen.has('BLUR')) {
83
- result.blur = part;
84
- seen.add('BLUR');
85
- } else if (!seen.has('SPREAD')) {
86
- result.spread = part;
87
- seen.add('SPREAD');
88
- }
89
- } else {
90
- if (!result.color) {
91
- result.color = part;
92
- } else {
93
- if (!result.unknown) result.unknown = [];
94
- result.unknown.push(part);
95
- }
96
- }
97
- }
98
- // Check if valid
99
- result.valid = result.x !== undefined && result.y !== undefined;
100
- return result;
101
- });
102
- }
103
- function formatBoxShadowValue(shadows) {
104
- return shadows.map((shadow)=>{
105
- if (!shadow.valid) {
106
- return shadow.raw;
107
- }
108
- return [
109
- shadow.keyword,
110
- shadow.x,
111
- shadow.y,
112
- shadow.blur,
113
- shadow.spread,
114
- shadow.color
115
- ].filter(Boolean).join(' ');
116
- }).join(', ');
117
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = parseDependency;
6
- var _isGlob = _interopRequireDefault(require("is-glob"));
7
- var _globParent = _interopRequireDefault(require("glob-parent"));
8
- var _path = _interopRequireDefault(require("path"));
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
12
- };
13
- }
14
- // Based on `glob-base`
15
- // https://github.com/micromatch/glob-base/blob/master/index.js
16
- function parseGlob(pattern) {
17
- let glob = pattern;
18
- let base = (0, _globParent).default(pattern);
19
- if (base !== '.') {
20
- glob = pattern.substr(base.length);
21
- if (glob.charAt(0) === '/') {
22
- glob = glob.substr(1);
23
- }
24
- }
25
- if (glob.substr(0, 2) === './') {
26
- glob = glob.substr(2);
27
- }
28
- if (glob.charAt(0) === '/') {
29
- glob = glob.substr(1);
30
- }
31
- return {
32
- base,
33
- glob
34
- };
35
- }
36
- function parseDependency(normalizedFileOrGlob) {
37
- if (normalizedFileOrGlob.startsWith('!')) {
38
- return null;
39
- }
40
- let message;
41
- if ((0, _isGlob).default(normalizedFileOrGlob)) {
42
- let { base , glob } = parseGlob(normalizedFileOrGlob);
43
- message = {
44
- type: 'dir-dependency',
45
- dir: _path.default.resolve(base),
46
- glob
47
- };
48
- } else {
49
- message = {
50
- type: 'dependency',
51
- file: _path.default.resolve(normalizedFileOrGlob)
52
- };
53
- }
54
- // rollup-plugin-postcss does not support dir-dependency messages
55
- // but directories can be watched in the same way as files
56
- if (message.type === 'dir-dependency' && process.env.ROLLUP_WATCH === 'true') {
57
- message = {
58
- type: 'dependency',
59
- file: message.dir
60
- };
61
- }
62
- return message;
63
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = parseObjectStyles;
6
- var _postcss = _interopRequireDefault(require("postcss"));
7
- var _postcssNested = _interopRequireDefault(require("postcss-nested"));
8
- var _postcssJs = _interopRequireDefault(require("postcss-js"));
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
12
- };
13
- }
14
- function parseObjectStyles(styles) {
15
- if (!Array.isArray(styles)) {
16
- return parseObjectStyles([
17
- styles
18
- ]);
19
- }
20
- return styles.flatMap((style)=>{
21
- return (0, _postcss).default([
22
- (0, _postcssNested).default({
23
- bubble: [
24
- 'screen'
25
- ]
26
- }),
27
- ]).process(style, {
28
- parser: _postcssJs.default
29
- }).root.nodes;
30
- });
31
- }