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,254 +1,137 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
3
+ value: !0
4
+ }), Object.defineProperty(exports, "default", {
5
+ enumerable: !0,
7
6
  get: ()=>resolveConfig
8
7
  });
9
- const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
10
- const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
11
- const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
12
- const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
13
- const _defaults = require("./defaults");
14
- const _toPath = require("./toPath");
15
- const _normalizeConfig = require("./normalizeConfig");
16
- const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
17
- const _cloneDeep = require("./cloneDeep");
18
- const _pluginUtils = require("./pluginUtils");
19
- const _withAlphaVariable = require("./withAlphaVariable");
20
- const _toColorValue = /*#__PURE__*/ _interopRequireDefault(require("./toColorValue"));
8
+ const _negateValue = _interopRequireDefault(require("./negateValue")), _corePluginList = _interopRequireDefault(require("../corePluginList")), _configurePlugins = _interopRequireDefault(require("./configurePlugins")), _colors = _interopRequireDefault(require("../public/colors")), _defaults = require("./defaults"), _toPath = require("./toPath"), _normalizeConfig = require("./normalizeConfig"), _isPlainObject = _interopRequireDefault(require("./isPlainObject")), _cloneDeep = require("./cloneDeep"), _pluginUtils = require("./pluginUtils"), _withAlphaVariable = require("./withAlphaVariable"), _toColorValue = _interopRequireDefault(require("./toColorValue"));
21
9
  function _interopRequireDefault(obj) {
22
10
  return obj && obj.__esModule ? obj : {
23
11
  default: obj
24
12
  };
25
13
  }
26
14
  function isFunction(input) {
27
- return typeof input === "function";
15
+ return "function" == typeof input;
28
16
  }
29
17
  function mergeWith(target, ...sources) {
30
18
  let customizer = sources.pop();
31
- for (let source of sources){
32
- for(let k in source){
33
- let merged = customizer(target[k], source[k]);
34
- if (merged === undefined) {
35
- if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
36
- target[k] = mergeWith({}, target[k], source[k], customizer);
37
- } else {
38
- target[k] = source[k];
39
- }
40
- } else {
41
- target[k] = merged;
42
- }
43
- }
19
+ for (let source of sources)for(let k in source){
20
+ let merged = customizer(target[k], source[k]);
21
+ void 0 === merged ? (0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k]) ? target[k] = mergeWith({}, target[k], source[k], customizer) : target[k] = source[k] : target[k] = merged;
44
22
  }
45
23
  return target;
46
24
  }
47
25
  const configUtils = {
48
26
  colors: _colors.default,
49
- negative (scale) {
50
- // TODO: Log that this function isn't really needed anymore?
51
- return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
27
+ negative: (scale)=>Object.keys(scale).filter((key)=>"0" !== scale[key]).reduce((negativeScale, key)=>{
52
28
  let negativeValue = (0, _negateValue.default)(scale[key]);
53
- if (negativeValue !== undefined) {
54
- negativeScale[`-${key}`] = negativeValue;
55
- }
56
- return negativeScale;
57
- }, {});
58
- },
59
- breakpoints (screens) {
60
- return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
29
+ return void 0 !== negativeValue && (negativeScale[`-${key}`] = negativeValue), negativeScale;
30
+ }, {}),
31
+ breakpoints: (screens)=>Object.keys(screens).filter((key)=>"string" == typeof screens[key]).reduce((breakpoints, key)=>({
61
32
  ...breakpoints,
62
33
  [`screen-${key}`]: screens[key]
63
- }), {});
64
- }
34
+ }), {})
65
35
  };
66
- function value(valueToResolve, ...args) {
67
- return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
68
- }
69
- function collectExtends(items) {
70
- return items.reduce((merged, { extend })=>{
71
- return mergeWith(merged, extend, (mergedValue, extendValue)=>{
72
- if (mergedValue === undefined) {
73
- return [
74
- extendValue
75
- ];
76
- }
77
- if (Array.isArray(mergedValue)) {
78
- return [
79
- extendValue,
80
- ...mergedValue
81
- ];
82
- }
83
- return [
84
- extendValue,
85
- mergedValue
86
- ];
87
- });
88
- }, {});
89
- }
90
- function mergeThemes(themes) {
91
- return {
92
- ...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
93
- // In order to resolve n config objects, we combine all of their `extend` properties
94
- // into arrays instead of objects so they aren't overridden.
95
- extend: collectExtends(themes)
96
- };
97
- }
98
36
  function mergeExtensionCustomizer(merged, value) {
99
- // When we have an array of objects, we do want to merge it
100
- if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
101
- return merged.concat(value);
102
- }
103
- // When the incoming value is an array, and the existing config is an object, prepend the existing object
104
- if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
105
- return [
106
- merged,
107
- ...value
108
- ];
109
- }
110
- // Override arrays (for example for font-families, box-shadows, ...)
111
- if (Array.isArray(value)) {
112
- return value;
113
- }
114
- // Execute default behaviour
115
- return undefined;
116
- }
117
- function mergeExtensions({ extend , ...theme }) {
118
- return mergeWith(theme, extend, (themeValue, extensions)=>{
119
- // The `extend` property is an array, so we need to check if it contains any functions
120
- if (!isFunction(themeValue) && !extensions.some(isFunction)) {
121
- return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
122
- }
123
- return (resolveThemePath, utils)=>mergeWith({}, ...[
124
- themeValue,
125
- ...extensions
126
- ].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
127
- });
128
- }
129
- /**
130
- *
131
- * @param {string} key
132
- * @return {Iterable<string[] & {alpha: string | undefined}>}
133
- */ function* toPaths(key) {
134
- let path = (0, _toPath.toPath)(key);
135
- if (path.length === 0) {
136
- return;
137
- }
138
- yield path;
139
- if (Array.isArray(key)) {
140
- return;
141
- }
142
- let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
143
- let matches = key.match(pattern);
144
- if (matches !== null) {
145
- let [, prefix, alpha] = matches;
146
- let newPath = (0, _toPath.toPath)(prefix);
147
- newPath.alpha = alpha;
148
- yield newPath;
149
- }
150
- }
151
- function resolveFunctionKeys(object) {
152
- // theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
153
- const resolvePath = (key, defaultValue)=>{
154
- for (const path of toPaths(key)){
155
- let index = 0;
156
- let val = object;
157
- while(val !== undefined && val !== null && index < path.length){
158
- val = val[path[index++]];
159
- let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
160
- val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
161
- }
162
- if (val !== undefined) {
163
- if (path.alpha !== undefined) {
164
- let normalized = (0, _pluginUtils.parseColorFormat)(val);
165
- return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
166
- }
167
- if ((0, _isPlainObject.default)(val)) {
168
- return (0, _cloneDeep.cloneDeep)(val);
169
- }
170
- return val;
171
- }
172
- }
173
- return defaultValue;
174
- };
175
- Object.assign(resolvePath, {
176
- theme: resolvePath,
177
- ...configUtils
178
- });
179
- return Object.keys(object).reduce((resolved, key)=>{
180
- resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
181
- return resolved;
182
- }, {});
183
- }
184
- function extractPluginConfigs(configs) {
185
- let allConfigs = [];
186
- configs.forEach((config)=>{
187
- allConfigs = [
188
- ...allConfigs,
189
- config
190
- ];
191
- var _config_plugins;
192
- const plugins = (_config_plugins = config === null || config === void 0 ? void 0 : config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [];
193
- if (plugins.length === 0) {
194
- return;
195
- }
196
- plugins.forEach((plugin)=>{
197
- if (plugin.__isOptionsFunction) {
198
- plugin = plugin();
199
- }
200
- var _plugin_config;
201
- allConfigs = [
202
- ...allConfigs,
203
- ...extractPluginConfigs([
204
- (_plugin_config = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && _plugin_config !== void 0 ? _plugin_config : {}
205
- ])
206
- ];
207
- });
208
- });
209
- return allConfigs;
210
- }
211
- function resolveCorePlugins(corePluginConfigs) {
212
- const result = [
213
- ...corePluginConfigs
214
- ].reduceRight((resolved, corePluginConfig)=>{
215
- if (isFunction(corePluginConfig)) {
216
- return corePluginConfig({
217
- corePlugins: resolved
218
- });
219
- }
220
- return (0, _configurePlugins.default)(corePluginConfig, resolved);
221
- }, _corePluginList.default);
222
- return result;
223
- }
224
- function resolvePluginLists(pluginLists) {
225
- const result = [
226
- ...pluginLists
227
- ].reduceRight((resolved, pluginList)=>{
228
- return [
229
- ...resolved,
230
- ...pluginList
231
- ];
232
- }, []);
233
- return result;
37
+ return Array.isArray(merged) && (0, _isPlainObject.default)(merged[0]) ? merged.concat(value) : Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged) ? [
38
+ merged,
39
+ ...value
40
+ ] : Array.isArray(value) ? value : void 0;
234
41
  }
235
42
  function resolveConfig(configs) {
43
+ var _t_theme, _c_plugins, themes;
236
44
  let allConfigs = [
237
- ...extractPluginConfigs(configs),
45
+ ...function extractPluginConfigs(configs) {
46
+ let allConfigs = [];
47
+ return configs.forEach((config)=>{
48
+ var _config_plugins;
49
+ allConfigs = [
50
+ ...allConfigs,
51
+ config
52
+ ];
53
+ let plugins = null !== (_config_plugins = null == config ? void 0 : config.plugins) && void 0 !== _config_plugins ? _config_plugins : [];
54
+ 0 !== plugins.length && plugins.forEach((plugin)=>{
55
+ var _plugin_config;
56
+ plugin.__isOptionsFunction && (plugin = plugin()), allConfigs = [
57
+ ...allConfigs,
58
+ ...extractPluginConfigs([
59
+ null !== (_plugin_config = null == plugin ? void 0 : plugin.config) && void 0 !== _plugin_config ? _plugin_config : {}
60
+ ])
61
+ ];
62
+ });
63
+ }), allConfigs;
64
+ }(configs),
238
65
  {
239
66
  prefix: "",
240
- important: false,
67
+ important: !1,
241
68
  separator: ":"
242
69
  }
243
70
  ];
244
- var _t_theme, _c_plugins;
245
71
  return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
246
- theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
247
- return (_t_theme = t === null || t === void 0 ? void 0 : t.theme) !== null && _t_theme !== void 0 ? _t_theme : {};
248
- })))),
249
- corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
250
- plugins: resolvePluginLists(configs.map((c)=>{
251
- return (_c_plugins = c === null || c === void 0 ? void 0 : c.plugins) !== null && _c_plugins !== void 0 ? _c_plugins : [];
252
- }))
72
+ theme: function(object) {
73
+ let resolvePath = (key, defaultValue)=>{
74
+ for (let path of function*(key) {
75
+ let path = (0, _toPath.toPath)(key);
76
+ if (0 === path.length || (yield path, Array.isArray(key))) return;
77
+ let matches = key.match(/^(.*?)\s*\/\s*([^/]+)$/);
78
+ if (null !== matches) {
79
+ let [, prefix, alpha] = matches, newPath = (0, _toPath.toPath)(prefix);
80
+ newPath.alpha = alpha, yield newPath;
81
+ }
82
+ }(key)){
83
+ let index = 0, val = object;
84
+ for(; null != val && index < path.length;)val = isFunction(val = val[path[index++]]) && (void 0 === path.alpha || index <= path.length - 1) ? val(resolvePath, configUtils) : val;
85
+ if (void 0 !== val) {
86
+ if (void 0 !== path.alpha) {
87
+ let normalized = (0, _pluginUtils.parseColorFormat)(val);
88
+ return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
89
+ }
90
+ if ((0, _isPlainObject.default)(val)) return (0, _cloneDeep.cloneDeep)(val);
91
+ return val;
92
+ }
93
+ }
94
+ return defaultValue;
95
+ };
96
+ return Object.assign(resolvePath, {
97
+ theme: resolvePath,
98
+ ...configUtils
99
+ }), Object.keys(object).reduce((resolved, key)=>(resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key], resolved), {});
100
+ }(function({ extend , ...theme }) {
101
+ return mergeWith(theme, extend, (themeValue, extensions)=>isFunction(themeValue) || extensions.some(isFunction) ? (resolveThemePath, utils)=>mergeWith({}, ...[
102
+ themeValue,
103
+ ...extensions
104
+ ].map((e)=>(function(valueToResolve, ...args) {
105
+ return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
106
+ })(e, resolveThemePath, utils)), mergeExtensionCustomizer) : mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer));
107
+ }({
108
+ ...(themes = allConfigs.map((t)=>null !== (_t_theme = null == t ? void 0 : t.theme) && void 0 !== _t_theme ? _t_theme : {})).reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
109
+ extend: themes.reduce((merged, { extend })=>mergeWith(merged, extend, (mergedValue, extendValue)=>void 0 === mergedValue ? [
110
+ extendValue
111
+ ] : Array.isArray(mergedValue) ? [
112
+ extendValue,
113
+ ...mergedValue
114
+ ] : [
115
+ extendValue,
116
+ mergedValue
117
+ ]), {})
118
+ })),
119
+ corePlugins: function(corePluginConfigs) {
120
+ let result = [
121
+ ...corePluginConfigs
122
+ ].reduceRight((resolved, corePluginConfig)=>isFunction(corePluginConfig) ? corePluginConfig({
123
+ corePlugins: resolved
124
+ }) : (0, _configurePlugins.default)(corePluginConfig, resolved), _corePluginList.default);
125
+ return result;
126
+ }(allConfigs.map((c)=>c.corePlugins)),
127
+ plugins: function(pluginLists) {
128
+ let result = [
129
+ ...pluginLists
130
+ ].reduceRight((resolved, pluginList)=>[
131
+ ...resolved,
132
+ ...pluginList
133
+ ], []);
134
+ return result;
135
+ }(configs.map((c)=>null !== (_c_plugins = null == c ? void 0 : c.plugins) && void 0 !== _c_plugins ? _c_plugins : []))
253
136
  }, ...allConfigs));
254
137
  }
@@ -1,19 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
3
+ value: !0
4
+ }), function(target, all) {
6
5
  for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
6
+ enumerable: !0,
8
7
  get: all[name]
9
8
  });
10
- }
11
- _export(exports, {
9
+ }(exports, {
12
10
  default: ()=>resolveConfigPath,
13
11
  resolveDefaultConfigPath: ()=>resolveDefaultConfigPath
14
12
  });
15
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
16
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
13
+ const _fs = _interopRequireDefault(require("fs")), _path = _interopRequireDefault(require("path"));
17
14
  function _interopRequireDefault(obj) {
18
15
  return obj && obj.__esModule ? obj : {
19
16
  default: obj
@@ -26,41 +23,18 @@ const defaultConfigFiles = [
26
23
  "./tailwind.config.ts"
27
24
  ];
28
25
  function isObject(value) {
29
- return typeof value === "object" && value !== null;
30
- }
31
- function isEmpty(obj) {
32
- return Object.keys(obj).length === 0;
26
+ return "object" == typeof value && null !== value;
33
27
  }
34
28
  function isString(value) {
35
- return typeof value === "string" || value instanceof String;
29
+ return "string" == typeof value || value instanceof String;
36
30
  }
37
31
  function resolveConfigPath(pathOrConfig) {
38
- // require('tailwindcss')({ theme: ..., variants: ... })
39
- if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
40
- return null;
41
- }
42
- // require('tailwindcss')({ config: 'custom-config.js' })
43
- if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
44
- return _path.default.resolve(pathOrConfig.config);
45
- }
46
- // require('tailwindcss')({ config: { theme: ..., variants: ... } })
47
- if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
48
- return null;
49
- }
50
- // require('tailwindcss')('custom-config.js')
51
- if (isString(pathOrConfig)) {
52
- return _path.default.resolve(pathOrConfig);
53
- }
54
- // require('tailwindcss')
55
- return resolveDefaultConfigPath();
32
+ return isObject(pathOrConfig) && void 0 === pathOrConfig.config && 0 !== Object.keys(pathOrConfig).length ? null : isObject(pathOrConfig) && void 0 !== pathOrConfig.config && isString(pathOrConfig.config) ? _path.default.resolve(pathOrConfig.config) : isObject(pathOrConfig) && void 0 !== pathOrConfig.config && isObject(pathOrConfig.config) ? null : isString(pathOrConfig) ? _path.default.resolve(pathOrConfig) : resolveDefaultConfigPath();
56
33
  }
57
34
  function resolveDefaultConfigPath() {
58
- for (const configFile of defaultConfigFiles){
59
- try {
60
- const configPath = _path.default.resolve(configFile);
61
- _fs.default.accessSync(configPath);
62
- return configPath;
63
- } catch (err) {}
64
- }
35
+ for (let configFile of defaultConfigFiles)try {
36
+ let configPath = _path.default.resolve(configFile);
37
+ return _fs.default.accessSync(configPath), configPath;
38
+ } catch (err) {}
65
39
  return null;
66
40
  }
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
3
+ value: !0
4
+ }), Object.defineProperty(exports, "default", {
5
+ enumerable: !0,
7
6
  get: ()=>responsive
8
7
  });
9
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
- const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("./cloneNodes"));
8
+ const _postcss = _interopRequireDefault(require("postcss")), _cloneNodes = _interopRequireDefault(require("./cloneNodes"));
11
9
  function _interopRequireDefault(obj) {
12
10
  return obj && obj.__esModule ? obj : {
13
11
  default: obj
@@ -1,49 +1,15 @@
1
- /**
2
- * This splits a string on a top-level character.
3
- *
4
- * Regex doesn't support recursion (at least not the JS-flavored version).
5
- * So we have to use a tiny state machine to keep track of paren placement.
6
- *
7
- * Expected behavior using commas:
8
- * var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
9
- * ─┬─ ┬ ┬ ┬
10
- * x x x ╰──────── Split because top-level
11
- * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
12
- *
13
- * @param {string} input
14
- * @param {string} separator
15
- */ "use strict";
16
- Object.defineProperty(exports, "__esModule", {
17
- value: true
18
- });
19
- Object.defineProperty(exports, "splitAtTopLevelOnly", {
20
- enumerable: true,
21
- get: ()=>splitAtTopLevelOnly
22
- });
1
+ "use strict";
23
2
  function splitAtTopLevelOnly(input, separator) {
24
- let stack = [];
25
- let parts = [];
26
- let lastPos = 0;
27
- let isEscaped = false;
3
+ let stack = [], parts = [], lastPos = 0, isEscaped = !1;
28
4
  for(let idx = 0; idx < input.length; idx++){
29
5
  let char = input[idx];
30
- if (stack.length === 0 && char === separator[0] && !isEscaped) {
31
- if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
32
- parts.push(input.slice(lastPos, idx));
33
- lastPos = idx + separator.length;
34
- }
35
- }
36
- if (isEscaped) {
37
- isEscaped = false;
38
- } else if (char === "\\") {
39
- isEscaped = true;
40
- }
41
- if (char === "(" || char === "[" || char === "{") {
42
- stack.push(char);
43
- } else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
44
- stack.pop();
45
- }
6
+ 0 !== stack.length || char !== separator[0] || isEscaped || 1 !== separator.length && input.slice(idx, idx + separator.length) !== separator || (parts.push(input.slice(lastPos, idx)), lastPos = idx + separator.length), isEscaped ? isEscaped = !1 : "\\" === char && (isEscaped = !0), "(" === char || "[" === char || "{" === char ? stack.push(char) : (")" === char && "(" === stack[stack.length - 1] || "]" === char && "[" === stack[stack.length - 1] || "}" === char && "{" === stack[stack.length - 1]) && stack.pop();
46
7
  }
47
- parts.push(input.slice(lastPos));
48
- return parts;
8
+ return parts.push(input.slice(lastPos)), parts;
49
9
  }
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: !0
12
+ }), Object.defineProperty(exports, "splitAtTopLevelOnly", {
13
+ enumerable: !0,
14
+ get: ()=>splitAtTopLevelOnly
15
+ });
package/lib/util/tap.js CHANGED
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
+ function tap(value, mutator) {
3
+ return mutator(value), value;
4
+ }
2
5
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "tap", {
6
- enumerable: true,
6
+ value: !0
7
+ }), Object.defineProperty(exports, "tap", {
8
+ enumerable: !0,
7
9
  get: ()=>tap
8
10
  });
9
- function tap(value, mutator) {
10
- mutator(value);
11
- return value;
12
- }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
+ function toColorValue(maybeFunction) {
3
+ return "function" == typeof maybeFunction ? maybeFunction({}) : maybeFunction;
4
+ }
2
5
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
6
+ value: !0
7
+ }), Object.defineProperty(exports, "default", {
8
+ enumerable: !0,
7
9
  get: ()=>toColorValue
8
10
  });
9
- function toColorValue(maybeFunction) {
10
- return typeof maybeFunction === "function" ? maybeFunction({}) : maybeFunction;
11
- }
@@ -1,30 +1,12 @@
1
- /**
2
- * Parse a path string into an array of path segments.
3
- *
4
- * Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
5
- *
6
- * Example:
7
- * a -> ['a']
8
- * a.b.c -> ['a', 'b', 'c']
9
- * a[b].c -> ['a', 'b', 'c']
10
- * a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
11
- * a[b][c][d] -> ['a', 'b', 'c', 'd']
12
- *
13
- * @param {string|string[]} path
14
- **/ "use strict";
15
- Object.defineProperty(exports, "__esModule", {
16
- value: true
17
- });
18
- Object.defineProperty(exports, "toPath", {
19
- enumerable: true,
20
- get: ()=>toPath
21
- });
1
+ "use strict";
22
2
  function toPath(path) {
23
3
  if (Array.isArray(path)) return path;
24
- let openBrackets = path.split("[").length - 1;
25
- let closedBrackets = path.split("]").length - 1;
26
- if (openBrackets !== closedBrackets) {
27
- throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
28
- }
4
+ if (path.split("[").length - 1 != path.split("]").length - 1) throw Error(`Path is invalid. Has unbalanced brackets: ${path}`);
29
5
  return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
30
6
  }
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: !0
9
+ }), Object.defineProperty(exports, "toPath", {
10
+ enumerable: !0,
11
+ get: ()=>toPath
12
+ });
@@ -1,37 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
3
+ value: !0
4
+ }), Object.defineProperty(exports, "default", {
5
+ enumerable: !0,
7
6
  get: ()=>transformThemeValue
8
7
  });
9
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
- const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
8
+ const _postcss = _interopRequireDefault(require("postcss")), _isPlainObject = _interopRequireDefault(require("./isPlainObject"));
11
9
  function _interopRequireDefault(obj) {
12
10
  return obj && obj.__esModule ? obj : {
13
11
  default: obj
14
12
  };
15
13
  }
16
14
  function transformThemeValue(themeSection) {
17
- if ([
15
+ return [
18
16
  "fontSize",
19
17
  "outline"
20
- ].includes(themeSection)) {
21
- return (value)=>{
22
- if (typeof value === "function") value = value({});
23
- if (Array.isArray(value)) value = value[0];
24
- return value;
25
- };
26
- }
27
- if (themeSection === "fontFamily") {
28
- return (value)=>{
29
- if (typeof value === "function") value = value({});
30
- let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
31
- return Array.isArray(families) ? families.join(", ") : families;
32
- };
33
- }
34
- if ([
18
+ ].includes(themeSection) ? (value)=>("function" == typeof value && (value = value({})), Array.isArray(value) && (value = value[0]), value) : "fontFamily" === themeSection ? (value)=>{
19
+ "function" == typeof value && (value = value({}));
20
+ let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
21
+ return Array.isArray(families) ? families.join(", ") : families;
22
+ } : [
35
23
  "boxShadow",
36
24
  "transitionProperty",
37
25
  "transitionDuration",
@@ -42,30 +30,9 @@ function transformThemeValue(themeSection) {
42
30
  "backgroundColor",
43
31
  "cursor",
44
32
  "animation"
45
- ].includes(themeSection)) {
46
- return (value)=>{
47
- if (typeof value === "function") value = value({});
48
- if (Array.isArray(value)) value = value.join(", ");
49
- return value;
50
- };
51
- }
52
- // For backwards compatibility reasons, before we switched to underscores
53
- // instead of commas for arbitrary values.
54
- if ([
33
+ ].includes(themeSection) ? (value)=>("function" == typeof value && (value = value({})), Array.isArray(value) && (value = value.join(", ")), value) : [
55
34
  "gridTemplateColumns",
56
35
  "gridTemplateRows",
57
36
  "objectPosition"
58
- ].includes(themeSection)) {
59
- return (value)=>{
60
- if (typeof value === "function") value = value({});
61
- if (typeof value === "string") value = _postcss.default.list.comma(value).join(" ");
62
- return value;
63
- };
64
- }
65
- return (value, opts = {})=>{
66
- if (typeof value === "function") {
67
- value = value(opts);
68
- }
69
- return value;
70
- };
37
+ ].includes(themeSection) ? (value)=>("function" == typeof value && (value = value({})), "string" == typeof value && (value = _postcss.default.list.comma(value).join(" ")), value) : (value, opts = {})=>("function" == typeof value && (value = value(opts)), value);
71
38
  }