tailwindcss 0.0.0-oxide-insiders.dddaded → 0.0.0-oxide-insiders.b2e3cf2

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 (112) hide show
  1. package/lib/cli/build/deps.js +10 -18
  2. package/lib/cli/build/index.js +10 -41
  3. package/lib/cli/build/plugin.js +87 -268
  4. package/lib/cli/build/utils.js +18 -40
  5. package/lib/cli/build/watching.js +35 -151
  6. package/lib/cli/help/index.js +15 -58
  7. package/lib/cli/index.js +61 -120
  8. package/lib/cli/init/index.js +21 -43
  9. package/lib/cli-peer-dependencies.js +13 -15
  10. package/lib/cli.js +1 -5
  11. package/lib/corePluginList.js +3 -4
  12. package/lib/corePlugins.js +394 -857
  13. package/lib/featureFlags.js +14 -34
  14. package/lib/index.js +1 -5
  15. package/lib/lib/cacheInvalidation.js +29 -75
  16. package/lib/lib/collapseAdjacentRules.js +22 -43
  17. package/lib/lib/collapseDuplicateDeclarations.js +27 -68
  18. package/lib/lib/content.js +37 -126
  19. package/lib/lib/defaultExtractor.js +96 -199
  20. package/lib/lib/detectNesting.js +12 -36
  21. package/lib/lib/evaluateTailwindFunctions.js +101 -188
  22. package/lib/lib/expandApplyAtRules.js +177 -482
  23. package/lib/lib/expandTailwindAtRules.js +69 -237
  24. package/lib/lib/findAtConfigPath.js +13 -30
  25. package/lib/lib/generateRules.js +349 -765
  26. package/lib/lib/getModuleDependencies.js +27 -63
  27. package/lib/lib/load-config.js +16 -24
  28. package/lib/lib/normalizeTailwindDirectives.js +26 -70
  29. package/lib/lib/offsets.js +61 -224
  30. package/lib/lib/partitionApplyAtRules.js +29 -51
  31. package/lib/lib/regex.js +22 -30
  32. package/lib/lib/remap-bitfield.js +9 -84
  33. package/lib/lib/resolveDefaultsAtRules.js +50 -116
  34. package/lib/lib/setupContextUtils.js +576 -1099
  35. package/lib/lib/setupTrackingContext.js +54 -143
  36. package/lib/lib/sharedState.js +15 -59
  37. package/lib/lib/substituteScreenAtRules.js +8 -16
  38. package/lib/oxide/cli/build/deps.js +17 -32
  39. package/lib/oxide/cli/build/index.js +10 -40
  40. package/lib/oxide/cli/build/plugin.js +87 -267
  41. package/lib/oxide/cli/build/utils.js +18 -39
  42. package/lib/oxide/cli/build/watching.js +34 -149
  43. package/lib/oxide/cli/help/index.js +15 -57
  44. package/lib/oxide/cli/index.js +66 -127
  45. package/lib/oxide/cli/init/index.js +17 -36
  46. package/lib/oxide/cli.js +2 -3
  47. package/lib/plugin.js +30 -57
  48. package/lib/postcss-plugins/nesting/index.js +6 -10
  49. package/lib/postcss-plugins/nesting/plugin.js +17 -60
  50. package/lib/processTailwindFeatures.js +8 -37
  51. package/lib/public/colors.js +15 -22
  52. package/lib/public/create-plugin.js +5 -8
  53. package/lib/public/default-config.js +5 -9
  54. package/lib/public/default-theme.js +5 -9
  55. package/lib/public/load-config.js +4 -6
  56. package/lib/public/resolve-config.js +4 -6
  57. package/lib/util/applyImportantSelector.js +15 -24
  58. package/lib/util/bigSign.js +6 -7
  59. package/lib/util/buildMediaQuery.js +10 -17
  60. package/lib/util/cloneDeep.js +9 -17
  61. package/lib/util/cloneNodes.js +14 -27
  62. package/lib/util/color.js +45 -81
  63. package/lib/util/configurePlugins.js +9 -16
  64. package/lib/util/createPlugin.js +8 -15
  65. package/lib/util/createUtilityPlugin.js +15 -27
  66. package/lib/util/dataTypes.js +23 -144
  67. package/lib/util/defaults.js +9 -19
  68. package/lib/util/escapeClassName.js +6 -10
  69. package/lib/util/escapeCommas.js +6 -7
  70. package/lib/util/flattenColorPalette.js +6 -8
  71. package/lib/util/formatVariantSelector.js +49 -190
  72. package/lib/util/getAllConfigs.js +35 -42
  73. package/lib/util/hashConfig.js +6 -8
  74. package/lib/util/isKeyframeRule.js +6 -7
  75. package/lib/util/isPlainObject.js +8 -11
  76. package/lib/util/isSyntacticallyValidPropertyValue.js +13 -42
  77. package/lib/util/log.js +7 -14
  78. package/lib/util/nameClass.js +6 -21
  79. package/lib/util/negateValue.js +10 -26
  80. package/lib/util/normalizeConfig.js +63 -240
  81. package/lib/util/normalizeScreens.js +70 -137
  82. package/lib/util/parseAnimationValue.js +13 -61
  83. package/lib/util/parseBoxShadowValue.js +12 -57
  84. package/lib/util/parseDependency.js +13 -37
  85. package/lib/util/parseGlob.js +7 -22
  86. package/lib/util/parseObjectStyles.js +17 -26
  87. package/lib/util/pluginUtils.js +69 -176
  88. package/lib/util/prefixSelector.js +11 -28
  89. package/lib/util/pseudoElements.js +29 -105
  90. package/lib/util/removeAlphaVariables.js +8 -21
  91. package/lib/util/resolveConfig.js +103 -220
  92. package/lib/util/resolveConfigPath.js +12 -38
  93. package/lib/util/responsive.js +4 -6
  94. package/lib/util/splitAtTopLevelOnly.js +10 -44
  95. package/lib/util/tap.js +6 -8
  96. package/lib/util/toColorValue.js +6 -7
  97. package/lib/util/toPath.js +8 -26
  98. package/lib/util/transformThemeValue.js +12 -45
  99. package/lib/util/validateConfig.js +14 -22
  100. package/lib/util/validateFormalSyntax.js +5 -11
  101. package/lib/util/withAlphaVariable.js +28 -48
  102. package/package.json +3 -3
  103. package/peers/index.js +14 -16
  104. package/src/cli/build/plugin.js +1 -1
  105. package/src/cli.js +1 -1
  106. package/src/corePlugins.js +16 -17
  107. package/src/featureFlags.js +2 -3
  108. package/src/index.js +1 -5
  109. package/src/lib/expandTailwindAtRules.js +2 -2
  110. package/src/lib/sharedState.js +0 -15
  111. package/src/oxide/cli/build/plugin.ts +1 -1
  112. package/src/plugin.js +1 -1
@@ -1,34 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: ()=>negateValue
8
- });
9
2
  function negateValue(value) {
10
- value = `${value}`;
11
- if (value === "0") {
12
- return "0";
13
- }
14
- // Flip sign of numbers
15
- if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
16
- return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
17
- }
18
- // What functions we support negating numeric values for
19
- // var() isn't inherently a numeric function but we support it anyway
20
- // The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
21
- // to produce generally useful results and that will be covered already
22
- let numericFunctions = [
3
+ if ("0" == (value = `${value}`)) return "0";
4
+ if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) return value.replace(/^[+-]?/, (sign)=>"-" === sign ? "" : "-");
5
+ for (let fn of [
23
6
  "var",
24
7
  "calc",
25
8
  "min",
26
9
  "max",
27
10
  "clamp"
28
- ];
29
- for (const fn of numericFunctions){
30
- if (value.includes(`${fn}(`)) {
31
- return `calc(${value} * -1)`;
32
- }
33
- }
11
+ ])if (value.includes(`${fn}(`)) return `calc(${value} * -1)`;
34
12
  }
13
+ Object.defineProperty(exports, "__esModule", {
14
+ value: !0
15
+ }), Object.defineProperty(exports, "default", {
16
+ enumerable: !0,
17
+ get: ()=>negateValue
18
+ });
@@ -1,280 +1,103 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "normalizeConfig", {
6
- enumerable: true,
3
+ value: !0
4
+ }), Object.defineProperty(exports, "normalizeConfig", {
5
+ enumerable: !0,
7
6
  get: ()=>normalizeConfig
8
7
  });
9
- const _featureFlags = require("../featureFlags");
10
- const _log = /*#__PURE__*/ _interopRequireWildcard(require("./log"));
8
+ const _featureFlags = require("../featureFlags"), _log = function(obj, nodeInterop) {
9
+ if (!nodeInterop && obj && obj.__esModule) return obj;
10
+ if (null === obj || "object" != typeof obj && "function" != typeof obj) return {
11
+ default: obj
12
+ };
13
+ var cache = _getRequireWildcardCache(nodeInterop);
14
+ if (cache && cache.has(obj)) return cache.get(obj);
15
+ var newObj = {}, hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
16
+ for(var key in obj)if ("default" !== key && Object.prototype.hasOwnProperty.call(obj, key)) {
17
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
18
+ desc && (desc.get || desc.set) ? Object.defineProperty(newObj, key, desc) : newObj[key] = obj[key];
19
+ }
20
+ return newObj.default = obj, cache && cache.set(obj, newObj), newObj;
21
+ }(require("./log"));
11
22
  function _getRequireWildcardCache(nodeInterop) {
12
- if (typeof WeakMap !== "function") return null;
13
- var cacheBabelInterop = new WeakMap();
14
- var cacheNodeInterop = new WeakMap();
23
+ if ("function" != typeof WeakMap) return null;
24
+ var cacheBabelInterop = new WeakMap(), cacheNodeInterop = new WeakMap();
15
25
  return (_getRequireWildcardCache = function(nodeInterop) {
16
26
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
27
  })(nodeInterop);
18
28
  }
19
- function _interopRequireWildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for(var key in obj){
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
50
29
  function normalizeConfig(config) {
51
- // Quick structure validation
52
- /**
53
- * type FilePath = string
54
- * type RawFile = { raw: string, extension?: string }
55
- * type ExtractorFn = (content: string) => Array<string>
56
- * type TransformerFn = (content: string) => string
57
- *
58
- * type Content =
59
- * | Array<FilePath | RawFile>
60
- * | {
61
- * files: Array<FilePath | RawFile>,
62
- * extract?: ExtractorFn | { [extension: string]: ExtractorFn }
63
- * transform?: TransformerFn | { [extension: string]: TransformerFn }
64
- * }
65
- */ let valid = (()=>{
66
- // `config.purge` should not exist anymore
67
- if (config.purge) {
68
- return false;
69
- }
70
- // `config.content` should exist
71
- if (!config.content) {
72
- return false;
73
- }
74
- // `config.content` should be an object or an array
75
- if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
76
- return false;
77
- }
78
- // When `config.content` is an array, it should consist of FilePaths or RawFiles
79
- if (Array.isArray(config.content)) {
80
- return config.content.every((path)=>{
81
- // `path` can be a string
82
- if (typeof path === "string") return true;
83
- // `path` can be an object { raw: string, extension?: string }
84
- // `raw` must be a string
85
- if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
86
- // `extension` (if provided) should also be a string
87
- if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
88
- return false;
89
- }
90
- return true;
91
- });
92
- }
93
- // When `config.content` is an object
94
- if (typeof config.content === "object" && config.content !== null) {
95
- // Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
30
+ var _config_prefix, _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
31
+ let transform, transformers;
32
+ for (let file of (((()=>{
33
+ if (config.purge || !config.content || !Array.isArray(config.content) && !("object" == typeof config.content && null !== config.content)) return !1;
34
+ if (Array.isArray(config.content)) return config.content.every((path)=>"string" == typeof path || "string" == typeof (null == path ? void 0 : path.raw) && (null == path || !path.extension || "string" == typeof (null == path ? void 0 : path.extension)));
35
+ if ("object" == typeof config.content && null !== config.content) {
96
36
  if (Object.keys(config.content).some((key)=>![
97
37
  "files",
98
38
  "relative",
99
39
  "extract",
100
40
  "transform"
101
- ].includes(key))) {
102
- return false;
103
- }
104
- // `config.content.files` should exist of FilePaths or RawFiles
41
+ ].includes(key))) return !1;
105
42
  if (Array.isArray(config.content.files)) {
106
- if (!config.content.files.every((path)=>{
107
- // `path` can be a string
108
- if (typeof path === "string") return true;
109
- // `path` can be an object { raw: string, extension?: string }
110
- // `raw` must be a string
111
- if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
112
- // `extension` (if provided) should also be a string
113
- if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
114
- return false;
115
- }
116
- return true;
117
- })) {
118
- return false;
119
- }
120
- // `config.content.extract` is optional, and can be a Function or a Record<String, Function>
121
- if (typeof config.content.extract === "object") {
122
- for (let value of Object.values(config.content.extract)){
123
- if (typeof value !== "function") {
124
- return false;
125
- }
126
- }
127
- } else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
128
- return false;
129
- }
130
- // `config.content.transform` is optional, and can be a Function or a Record<String, Function>
131
- if (typeof config.content.transform === "object") {
132
- for (let value of Object.values(config.content.transform)){
133
- if (typeof value !== "function") {
134
- return false;
135
- }
136
- }
137
- } else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
138
- return false;
139
- }
140
- // `config.content.relative` is optional and can be a boolean
141
- if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
142
- return false;
143
- }
43
+ if (!config.content.files.every((path)=>"string" == typeof path || "string" == typeof (null == path ? void 0 : path.raw) && (null == path || !path.extension || "string" == typeof (null == path ? void 0 : path.extension)))) return !1;
44
+ if ("object" == typeof config.content.extract) {
45
+ for (let value of Object.values(config.content.extract))if ("function" != typeof value) return !1;
46
+ } else if (!(void 0 === config.content.extract || "function" == typeof config.content.extract)) return !1;
47
+ if ("object" == typeof config.content.transform) {
48
+ for (let value of Object.values(config.content.transform))if ("function" != typeof value) return !1;
49
+ } else if (!(void 0 === config.content.transform || "function" == typeof config.content.transform)) return !1;
50
+ if ("boolean" != typeof config.content.relative && void 0 !== config.content.relative) return !1;
144
51
  }
145
- return true;
52
+ return !0;
146
53
  }
147
- return false;
148
- })();
149
- if (!valid) {
150
- _log.default.warn("purge-deprecation", [
151
- "The `purge`/`content` options have changed in Tailwind CSS v3.0.",
152
- "Update your configuration file to eliminate this warning.",
153
- "https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
154
- ]);
155
- }
156
- // Normalize the `safelist`
157
- config.safelist = (()=>{
54
+ return !1;
55
+ })() || _log.default.warn("purge-deprecation", [
56
+ "The `purge`/`content` options have changed in Tailwind CSS v3.0.",
57
+ "Update your configuration file to eliminate this warning.",
58
+ "https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
59
+ ]), config.safelist = (()=>{
158
60
  var _purge_options;
159
61
  let { content , purge , safelist } = config;
160
- if (Array.isArray(safelist)) return safelist;
161
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
162
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
163
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : (_purge_options = purge.options) === null || _purge_options === void 0 ? void 0 : _purge_options.safelist)) return purge.options.safelist;
164
- return [];
165
- })();
166
- // Normalize the `blocklist`
167
- config.blocklist = (()=>{
62
+ return Array.isArray(safelist) ? safelist : Array.isArray(null == content ? void 0 : content.safelist) ? content.safelist : Array.isArray(null == purge ? void 0 : purge.safelist) ? purge.safelist : Array.isArray(null == purge ? void 0 : null === (_purge_options = purge.options) || void 0 === _purge_options ? void 0 : _purge_options.safelist) ? purge.options.safelist : [];
63
+ })(), config.blocklist = (()=>{
168
64
  let { blocklist } = config;
169
65
  if (Array.isArray(blocklist)) {
170
- if (blocklist.every((item)=>typeof item === "string")) {
171
- return blocklist;
172
- }
66
+ if (blocklist.every((item)=>"string" == typeof item)) return blocklist;
173
67
  _log.default.warn("blocklist-invalid", [
174
68
  "The `blocklist` option must be an array of strings.",
175
69
  "https://tailwindcss.com/docs/content-configuration#discarding-classes"
176
70
  ]);
177
71
  }
178
72
  return [];
179
- })();
180
- // Normalize prefix option
181
- if (typeof config.prefix === "function") {
182
- _log.default.warn("prefix-function", [
183
- "As of Tailwind CSS v3.0, `prefix` cannot be a function.",
184
- "Update `prefix` in your configuration to be a string to eliminate this warning.",
185
- "https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
186
- ]);
187
- config.prefix = "";
188
- } else {
189
- var _config_prefix;
190
- config.prefix = (_config_prefix = config.prefix) !== null && _config_prefix !== void 0 ? _config_prefix : "";
191
- }
192
- // Normalize the `content`
193
- config.content = {
73
+ })(), "function" == typeof config.prefix) ? (_log.default.warn("prefix-function", [
74
+ "As of Tailwind CSS v3.0, `prefix` cannot be a function.",
75
+ "Update `prefix` in your configuration to be a string to eliminate this warning.",
76
+ "https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
77
+ ]), config.prefix = "") : config.prefix = null !== (_config_prefix = config.prefix) && void 0 !== _config_prefix ? _config_prefix : "", config.content = {
194
78
  relative: (()=>{
195
79
  let { content } = config;
196
- if (content === null || content === void 0 ? void 0 : content.relative) {
197
- return content.relative;
198
- }
199
- return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
80
+ return (null == content ? void 0 : content.relative) ? content.relative : (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
200
81
  })(),
201
82
  files: (()=>{
202
83
  let { content , purge } = config;
203
- if (Array.isArray(purge)) return purge;
204
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
205
- if (Array.isArray(content)) return content;
206
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
207
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
208
- return [];
84
+ return Array.isArray(purge) ? purge : Array.isArray(null == purge ? void 0 : purge.content) ? purge.content : Array.isArray(content) ? content : Array.isArray(null == content ? void 0 : content.content) ? content.content : Array.isArray(null == content ? void 0 : content.files) ? content.files : [];
209
85
  })(),
210
86
  extract: (()=>{
211
- let extract = (()=>{
212
- var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options;
213
- if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
214
- if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
215
- if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_extract = _config_purge1.extract) === null || _config_purge_extract === void 0 ? void 0 : _config_purge_extract.DEFAULT) return config.purge.extract.DEFAULT;
216
- if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_extract = _config_content1.extract) === null || _config_content_extract === void 0 ? void 0 : _config_content_extract.DEFAULT) return config.content.extract.DEFAULT;
217
- if ((_config_purge2 = config.purge) === null || _config_purge2 === void 0 ? void 0 : (_config_purge_options = _config_purge2.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.extractors) return config.purge.options.extractors;
218
- if ((_config_content2 = config.content) === null || _config_content2 === void 0 ? void 0 : (_config_content_options = _config_content2.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.extractors) return config.content.options.extractors;
219
- return {};
220
- })();
221
- let extractors = {};
222
- let defaultExtractor = (()=>{
223
- var _config_purge, _config_purge_options, _config_content, _config_content_options;
224
- if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : (_config_purge_options = _config_purge.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.defaultExtractor) {
225
- return config.purge.options.defaultExtractor;
226
- }
227
- if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : (_config_content_options = _config_content.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.defaultExtractor) {
228
- return config.content.options.defaultExtractor;
229
- }
230
- return undefined;
231
- })();
232
- if (defaultExtractor !== undefined) {
233
- extractors.DEFAULT = defaultExtractor;
234
- }
235
- // Functions
236
- if (typeof extract === "function") {
237
- extractors.DEFAULT = extract;
238
- } else if (Array.isArray(extract)) {
239
- for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
240
- for (let extension of extensions){
241
- extractors[extension] = extractor;
242
- }
243
- }
244
- } else if (typeof extract === "object" && extract !== null) {
245
- Object.assign(extractors, extract);
246
- }
87
+ var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options, _config_purge3, _config_purge_options1, _config_content3, _config_content_options1;
88
+ let extract = (null === (_config_purge = config.purge) || void 0 === _config_purge ? void 0 : _config_purge.extract) ? config.purge.extract : (null === (_config_content = config.content) || void 0 === _config_content ? void 0 : _config_content.extract) ? config.content.extract : (null === (_config_purge1 = config.purge) || void 0 === _config_purge1 ? void 0 : null === (_config_purge_extract = _config_purge1.extract) || void 0 === _config_purge_extract ? void 0 : _config_purge_extract.DEFAULT) ? config.purge.extract.DEFAULT : (null === (_config_content1 = config.content) || void 0 === _config_content1 ? void 0 : null === (_config_content_extract = _config_content1.extract) || void 0 === _config_content_extract ? void 0 : _config_content_extract.DEFAULT) ? config.content.extract.DEFAULT : (null === (_config_purge2 = config.purge) || void 0 === _config_purge2 ? void 0 : null === (_config_purge_options = _config_purge2.options) || void 0 === _config_purge_options ? void 0 : _config_purge_options.extractors) ? config.purge.options.extractors : (null === (_config_content2 = config.content) || void 0 === _config_content2 ? void 0 : null === (_config_content_options = _config_content2.options) || void 0 === _config_content_options ? void 0 : _config_content_options.extractors) ? config.content.options.extractors : {}, extractors = {}, defaultExtractor = (null === (_config_purge3 = config.purge) || void 0 === _config_purge3 ? void 0 : null === (_config_purge_options1 = _config_purge3.options) || void 0 === _config_purge_options1 ? void 0 : _config_purge_options1.defaultExtractor) ? config.purge.options.defaultExtractor : (null === (_config_content3 = config.content) || void 0 === _config_content3 ? void 0 : null === (_config_content_options1 = _config_content3.options) || void 0 === _config_content_options1 ? void 0 : _config_content_options1.defaultExtractor) ? config.content.options.defaultExtractor : void 0;
89
+ if (void 0 !== defaultExtractor && (extractors.DEFAULT = defaultExtractor), "function" == typeof extract) extractors.DEFAULT = extract;
90
+ else if (Array.isArray(extract)) for (let { extensions , extractor } of null != extract ? extract : [])for (let extension of extensions)extractors[extension] = extractor;
91
+ else "object" == typeof extract && null !== extract && Object.assign(extractors, extract);
247
92
  return extractors;
248
93
  })(),
249
- transform: (()=>{
250
- let transform = (()=>{
251
- var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
252
- if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
253
- if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
254
- if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_transform = _config_purge1.transform) === null || _config_purge_transform === void 0 ? void 0 : _config_purge_transform.DEFAULT) return config.purge.transform.DEFAULT;
255
- if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_transform = _config_content1.transform) === null || _config_content_transform === void 0 ? void 0 : _config_content_transform.DEFAULT) return config.content.transform.DEFAULT;
256
- return {};
257
- })();
258
- let transformers = {};
259
- if (typeof transform === "function") {
260
- transformers.DEFAULT = transform;
261
- }
262
- if (typeof transform === "object" && transform !== null) {
263
- Object.assign(transformers, transform);
264
- }
265
- return transformers;
266
- })()
267
- };
268
- // Validate globs to prevent bogus globs.
269
- // E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
270
- for (let file of config.content.files){
271
- if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
272
- _log.default.warn("invalid-glob-braces", [
273
- `The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
274
- `Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
275
- ]);
276
- break;
277
- }
94
+ transform: (transform = (null === (_config_purge = config.purge) || void 0 === _config_purge ? void 0 : _config_purge.transform) ? config.purge.transform : (null === (_config_content = config.content) || void 0 === _config_content ? void 0 : _config_content.transform) ? config.content.transform : (null === (_config_purge1 = config.purge) || void 0 === _config_purge1 ? void 0 : null === (_config_purge_transform = _config_purge1.transform) || void 0 === _config_purge_transform ? void 0 : _config_purge_transform.DEFAULT) ? config.purge.transform.DEFAULT : (null === (_config_content1 = config.content) || void 0 === _config_content1 ? void 0 : null === (_config_content_transform = _config_content1.transform) || void 0 === _config_content_transform ? void 0 : _config_content_transform.DEFAULT) ? config.content.transform.DEFAULT : {}, transformers = {}, "function" == typeof transform && (transformers.DEFAULT = transform), "object" == typeof transform && null !== transform && Object.assign(transformers, transform), transformers)
95
+ }, config.content.files))if ("string" == typeof file && /{([^,]*?)}/g.test(file)) {
96
+ _log.default.warn("invalid-glob-braces", [
97
+ `The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
98
+ `Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
99
+ ]);
100
+ break;
278
101
  }
279
102
  return config;
280
103
  }
@@ -1,145 +1,33 @@
1
- /**
2
- * @typedef {object} ScreenValue
3
- * @property {number|undefined} min
4
- * @property {number|undefined} max
5
- * @property {string|undefined} raw
6
- */ /**
7
- * @typedef {object} Screen
8
- * @property {string} name
9
- * @property {boolean} not
10
- * @property {ScreenValue[]} values
11
- */ /**
12
- * A function that normalizes the various forms that the screens object can be
13
- * provided in.
14
- *
15
- * Input(s):
16
- * - ['100px', '200px'] // Raw strings
17
- * - { sm: '100px', md: '200px' } // Object with string values
18
- * - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
19
- * - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
20
- *
21
- * Output(s):
22
- * - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
23
- *
24
- * @returns {Screen[]}
25
- */ "use strict";
26
- Object.defineProperty(exports, "__esModule", {
27
- value: true
28
- });
29
- function _export(target, all) {
30
- for(var name in all)Object.defineProperty(target, name, {
31
- enumerable: true,
32
- get: all[name]
33
- });
34
- }
35
- _export(exports, {
36
- normalizeScreens: ()=>normalizeScreens,
37
- isScreenSortable: ()=>isScreenSortable,
38
- compareScreens: ()=>compareScreens,
39
- toScreen: ()=>toScreen
40
- });
41
- function normalizeScreens(screens, root = true) {
42
- if (Array.isArray(screens)) {
43
- return screens.map((screen)=>{
44
- if (root && Array.isArray(screen)) {
45
- throw new Error("The tuple syntax is not supported for `screens`.");
46
- }
47
- if (typeof screen === "string") {
48
- return {
49
- name: screen.toString(),
50
- not: false,
51
- values: [
52
- {
53
- min: screen,
54
- max: undefined
55
- }
56
- ]
57
- };
58
- }
59
- let [name, options] = screen;
60
- name = name.toString();
61
- if (typeof options === "string") {
62
- return {
63
- name,
64
- not: false,
65
- values: [
66
- {
67
- min: options,
68
- max: undefined
69
- }
70
- ]
71
- };
72
- }
73
- if (Array.isArray(options)) {
74
- return {
75
- name,
76
- not: false,
77
- values: options.map((option)=>resolveValue(option))
78
- };
79
- }
80
- return {
81
- name,
82
- not: false,
83
- values: [
84
- resolveValue(options)
85
- ]
86
- };
87
- });
88
- }
89
- return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
90
- }
1
+ "use strict";
91
2
  function isScreenSortable(screen) {
92
- if (screen.values.length !== 1) {
93
- return {
94
- result: false,
95
- reason: "multiple-values"
96
- };
97
- } else if (screen.values[0].raw !== undefined) {
98
- return {
99
- result: false,
100
- reason: "raw-values"
101
- };
102
- } else if (screen.values[0].min !== undefined && screen.values[0].max !== undefined) {
103
- return {
104
- result: false,
105
- reason: "min-and-max"
106
- };
107
- }
108
- return {
109
- result: true,
3
+ return 1 !== screen.values.length ? {
4
+ result: !1,
5
+ reason: "multiple-values"
6
+ } : void 0 !== screen.values[0].raw ? {
7
+ result: !1,
8
+ reason: "raw-values"
9
+ } : void 0 !== screen.values[0].min && void 0 !== screen.values[0].max ? {
10
+ result: !1,
11
+ reason: "min-and-max"
12
+ } : {
13
+ result: !0,
110
14
  reason: null
111
15
  };
112
16
  }
113
17
  function compareScreens(type, a, z) {
114
- let aScreen = toScreen(a, type);
115
- let zScreen = toScreen(z, type);
116
- let aSorting = isScreenSortable(aScreen);
117
- let bSorting = isScreenSortable(zScreen);
118
- // These cases should never happen and indicate a bug in Tailwind CSS itself
119
- if (aSorting.reason === "multiple-values" || bSorting.reason === "multiple-values") {
120
- throw new Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
121
- } else if (aSorting.reason === "raw-values" || bSorting.reason === "raw-values") {
122
- throw new Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
123
- } else if (aSorting.reason === "min-and-max" || bSorting.reason === "min-and-max") {
124
- throw new Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
125
- }
126
- // Let the sorting begin
127
- let { min: aMin , max: aMax } = aScreen.values[0];
128
- let { min: zMin , max: zMax } = zScreen.values[0];
129
- // Negating screens flip their behavior. Basically `not min-width` is `max-width`
130
- if (a.not) [aMin, aMax] = [
18
+ let aScreen = toScreen(a, type), zScreen = toScreen(z, type), aSorting = isScreenSortable(aScreen), bSorting = isScreenSortable(zScreen);
19
+ if ("multiple-values" === aSorting.reason || "multiple-values" === bSorting.reason) throw Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
20
+ if ("raw-values" === aSorting.reason || "raw-values" === bSorting.reason) throw Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
21
+ if ("min-and-max" === aSorting.reason || "min-and-max" === bSorting.reason) throw Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
22
+ let { min: aMin , max: aMax } = aScreen.values[0], { min: zMin , max: zMax } = zScreen.values[0];
23
+ a.not && ([aMin, aMax] = [
131
24
  aMax,
132
25
  aMin
133
- ];
134
- if (z.not) [zMin, zMax] = [
26
+ ]), z.not && ([zMin, zMax] = [
135
27
  zMax,
136
28
  zMin
137
- ];
138
- aMin = aMin === undefined ? aMin : parseFloat(aMin);
139
- aMax = aMax === undefined ? aMax : parseFloat(aMax);
140
- zMin = zMin === undefined ? zMin : parseFloat(zMin);
141
- zMax = zMax === undefined ? zMax : parseFloat(zMax);
142
- let [aValue, zValue] = type === "min" ? [
29
+ ]), aMin = void 0 === aMin ? aMin : parseFloat(aMin), aMax = void 0 === aMax ? aMax : parseFloat(aMax), zMin = void 0 === zMin ? zMin : parseFloat(zMin), zMax = void 0 === zMax ? zMax : parseFloat(zMax);
30
+ let [aValue, zValue] = "min" === type ? [
143
31
  aMin,
144
32
  zMin
145
33
  ] : [
@@ -149,10 +37,7 @@ function compareScreens(type, a, z) {
149
37
  return aValue - zValue;
150
38
  }
151
39
  function toScreen(value, type) {
152
- if (typeof value === "object") {
153
- return value;
154
- }
155
- return {
40
+ return "object" == typeof value ? value : {
156
41
  name: "arbitrary-screen",
157
42
  values: [
158
43
  {
@@ -168,3 +53,51 @@ function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } =
168
53
  raw
169
54
  };
170
55
  }
56
+ Object.defineProperty(exports, "__esModule", {
57
+ value: !0
58
+ }), function(target, all) {
59
+ for(var name in all)Object.defineProperty(target, name, {
60
+ enumerable: !0,
61
+ get: all[name]
62
+ });
63
+ }(exports, {
64
+ normalizeScreens: ()=>function normalizeScreens(screens, root = !0) {
65
+ return Array.isArray(screens) ? screens.map((screen)=>{
66
+ if (root && Array.isArray(screen)) throw Error("The tuple syntax is not supported for `screens`.");
67
+ if ("string" == typeof screen) return {
68
+ name: screen.toString(),
69
+ not: !1,
70
+ values: [
71
+ {
72
+ min: screen,
73
+ max: void 0
74
+ }
75
+ ]
76
+ };
77
+ let [name, options] = screen;
78
+ return (name = name.toString(), "string" == typeof options) ? {
79
+ name,
80
+ not: !1,
81
+ values: [
82
+ {
83
+ min: options,
84
+ max: void 0
85
+ }
86
+ ]
87
+ } : Array.isArray(options) ? {
88
+ name,
89
+ not: !1,
90
+ values: options.map((option)=>resolveValue(option))
91
+ } : {
92
+ name,
93
+ not: !1,
94
+ values: [
95
+ resolveValue(options)
96
+ ]
97
+ };
98
+ }) : normalizeScreens(Object.entries(null != screens ? screens : {}), !1);
99
+ },
100
+ isScreenSortable: ()=>isScreenSortable,
101
+ compareScreens: ()=>compareScreens,
102
+ toScreen: ()=>toScreen
103
+ });