tailwindcss 0.0.0-insiders.df011dc → 0.0.0-insiders.e2d5f21

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 (120) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +1 -1
  3. package/colors.js +1 -304
  4. package/defaultConfig.js +1 -4
  5. package/defaultTheme.js +1 -4
  6. package/lib/cli-peer-dependencies.js +4 -9
  7. package/lib/cli.js +646 -705
  8. package/lib/constants.js +15 -15
  9. package/lib/corePluginList.js +174 -4
  10. package/lib/corePlugins.js +3637 -2934
  11. package/lib/css/preflight.css +14 -1
  12. package/lib/featureFlags.js +44 -44
  13. package/lib/index.js +25 -24
  14. package/lib/lib/collapseAdjacentRules.js +33 -35
  15. package/lib/lib/collapseDuplicateDeclarations.js +29 -0
  16. package/lib/lib/detectNesting.js +34 -0
  17. package/lib/lib/evaluateTailwindFunctions.js +134 -155
  18. package/lib/lib/expandApplyAtRules.js +183 -200
  19. package/lib/lib/expandTailwindAtRules.js +219 -232
  20. package/lib/lib/generateRules.js +478 -311
  21. package/lib/lib/getModuleDependencies.js +36 -41
  22. package/lib/lib/normalizeTailwindDirectives.js +66 -58
  23. package/lib/lib/resolveDefaultsAtRules.js +110 -90
  24. package/lib/lib/setupContextUtils.js +740 -580
  25. package/lib/lib/setupTrackingContext.js +142 -162
  26. package/lib/lib/setupWatchingContext.js +235 -278
  27. package/lib/lib/sharedState.js +7 -17
  28. package/lib/lib/substituteScreenAtRules.js +22 -26
  29. package/lib/processTailwindFeatures.js +38 -44
  30. package/lib/public/colors.js +329 -0
  31. package/lib/public/create-plugin.js +13 -0
  32. package/lib/public/default-config.js +14 -0
  33. package/lib/public/default-theme.js +14 -0
  34. package/lib/public/resolve-config.js +19 -0
  35. package/lib/util/bigSign.js +3 -5
  36. package/lib/util/buildMediaQuery.js +15 -31
  37. package/lib/util/cloneDeep.js +14 -13
  38. package/lib/util/cloneNodes.js +9 -13
  39. package/lib/util/color.js +69 -59
  40. package/lib/util/configurePlugins.js +13 -14
  41. package/lib/util/createPlugin.js +21 -24
  42. package/lib/util/createUtilityPlugin.js +47 -45
  43. package/lib/util/dataTypes.js +231 -0
  44. package/lib/util/defaults.js +10 -14
  45. package/lib/util/escapeClassName.js +12 -14
  46. package/lib/util/escapeCommas.js +3 -5
  47. package/lib/util/flattenColorPalette.js +14 -10
  48. package/lib/util/formatVariantSelector.js +186 -0
  49. package/lib/util/getAllConfigs.js +23 -16
  50. package/lib/util/hashConfig.js +10 -10
  51. package/lib/util/isKeyframeRule.js +3 -5
  52. package/lib/util/isPlainObject.js +7 -10
  53. package/lib/util/isValidArbitraryValue.js +64 -0
  54. package/lib/util/log.js +39 -30
  55. package/lib/util/nameClass.js +23 -23
  56. package/lib/util/negateValue.js +14 -15
  57. package/lib/util/normalizeConfig.js +208 -0
  58. package/lib/util/normalizeScreens.js +58 -0
  59. package/lib/util/parseAnimationValue.js +82 -53
  60. package/lib/util/parseBoxShadowValue.js +77 -0
  61. package/lib/util/parseDependency.js +49 -60
  62. package/lib/util/parseObjectStyles.js +23 -20
  63. package/lib/util/pluginUtils.js +153 -285
  64. package/lib/util/prefixSelector.js +14 -16
  65. package/lib/util/resolveConfig.js +194 -249
  66. package/lib/util/resolveConfigPath.js +38 -45
  67. package/lib/util/responsive.js +12 -11
  68. package/lib/util/tap.js +4 -6
  69. package/lib/util/toColorValue.js +4 -5
  70. package/lib/util/toPath.js +4 -6
  71. package/lib/util/transformThemeValue.js +57 -26
  72. package/lib/util/withAlphaVariable.js +56 -54
  73. package/package.json +27 -37
  74. package/peers/index.js +73099 -84294
  75. package/plugin.js +1 -3
  76. package/resolveConfig.js +1 -7
  77. package/scripts/create-plugin-list.js +2 -2
  78. package/src/cli.js +27 -18
  79. package/src/corePluginList.js +1 -1
  80. package/src/corePlugins.js +2124 -1968
  81. package/src/css/preflight.css +14 -1
  82. package/src/featureFlags.js +12 -6
  83. package/src/lib/collapseDuplicateDeclarations.js +28 -0
  84. package/src/lib/detectNesting.js +39 -0
  85. package/src/lib/evaluateTailwindFunctions.js +5 -2
  86. package/src/lib/expandTailwindAtRules.js +24 -32
  87. package/src/lib/generateRules.js +230 -20
  88. package/src/lib/normalizeTailwindDirectives.js +3 -2
  89. package/src/lib/resolveDefaultsAtRules.js +46 -30
  90. package/src/lib/setupContextUtils.js +275 -113
  91. package/src/lib/setupTrackingContext.js +9 -8
  92. package/src/lib/setupWatchingContext.js +12 -7
  93. package/src/lib/sharedState.js +1 -4
  94. package/src/lib/substituteScreenAtRules.js +6 -3
  95. package/src/processTailwindFeatures.js +8 -1
  96. package/src/public/colors.js +300 -0
  97. package/src/public/create-plugin.js +2 -0
  98. package/src/public/default-config.js +4 -0
  99. package/src/public/default-theme.js +4 -0
  100. package/src/public/resolve-config.js +7 -0
  101. package/src/util/buildMediaQuery.js +14 -18
  102. package/src/util/createUtilityPlugin.js +2 -11
  103. package/src/util/dataTypes.js +246 -0
  104. package/src/util/formatVariantSelector.js +196 -0
  105. package/src/util/isValidArbitraryValue.js +61 -0
  106. package/src/util/log.js +18 -21
  107. package/src/util/nameClass.js +10 -6
  108. package/src/util/negateValue.js +4 -2
  109. package/src/util/normalizeConfig.js +249 -0
  110. package/src/util/normalizeScreens.js +42 -0
  111. package/src/util/parseAnimationValue.js +7 -1
  112. package/src/util/parseBoxShadowValue.js +71 -0
  113. package/src/util/parseDependency.js +4 -0
  114. package/src/util/pluginUtils.js +101 -204
  115. package/src/util/prefixSelector.js +1 -4
  116. package/src/util/resolveConfig.js +12 -65
  117. package/src/util/transformThemeValue.js +22 -7
  118. package/src/util/withAlphaVariable.js +13 -8
  119. package/stubs/defaultConfig.stub.js +163 -97
  120. package/stubs/simpleConfig.stub.js +0 -1
package/lib/util/color.js CHANGED
@@ -1,74 +1,84 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.parseColor = parseColor;
7
6
  exports.formatColor = formatColor;
8
-
9
7
  var _colorName = _interopRequireDefault(require("color-name"));
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
13
13
  let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
14
14
  let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
15
15
  let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`;
16
16
  let SEP = `(?:\\s*,\\s*|\\s+)`;
17
17
  let ALPHA_SEP = `\\s*[,/]\\s*`;
18
18
  let RGB_HSL = new RegExp(`^(rgb|hsl)a?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
19
-
20
19
  function parseColor(value) {
21
- if (typeof value !== 'string') {
20
+ if (typeof value !== 'string') {
21
+ return null;
22
+ }
23
+ value = value.trim();
24
+ if (value === 'transparent') {
25
+ return {
26
+ mode: 'rgb',
27
+ color: [
28
+ '0',
29
+ '0',
30
+ '0'
31
+ ],
32
+ alpha: '0'
33
+ };
34
+ }
35
+ if (value in _colorName.default) {
36
+ return {
37
+ mode: 'rgb',
38
+ color: _colorName.default[value].map((v)=>v.toString()
39
+ )
40
+ };
41
+ }
42
+ let hex = value.replace(SHORT_HEX, (_, r, g, b, a)=>[
43
+ '#',
44
+ r,
45
+ r,
46
+ g,
47
+ g,
48
+ b,
49
+ b,
50
+ a ? a + a : ''
51
+ ].join('')
52
+ ).match(HEX);
53
+ if (hex !== null) {
54
+ return {
55
+ mode: 'rgb',
56
+ color: [
57
+ parseInt(hex[1], 16),
58
+ parseInt(hex[2], 16),
59
+ parseInt(hex[3], 16)
60
+ ].map((v)=>v.toString()
61
+ ),
62
+ alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
63
+ };
64
+ }
65
+ let match = value.match(RGB_HSL);
66
+ if (match !== null) {
67
+ var ref, ref1;
68
+ return {
69
+ mode: match[1],
70
+ color: [
71
+ match[2],
72
+ match[3],
73
+ match[4]
74
+ ].map((v)=>v.toString()
75
+ ),
76
+ alpha: (ref = match[5]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
77
+ };
78
+ }
22
79
  return null;
23
- }
24
-
25
- value = value.trim();
26
-
27
- if (value === 'transparent') {
28
- return {
29
- mode: 'rgb',
30
- color: ['0', '0', '0'],
31
- alpha: '0'
32
- };
33
- }
34
-
35
- if (value in _colorName.default) {
36
- return {
37
- mode: 'rgb',
38
- color: _colorName.default[value].map(v => v.toString())
39
- };
40
- }
41
-
42
- let hex = value.replace(SHORT_HEX, (_, r, g, b, a) => ['#', r, r, g, g, b, b, a ? a + a : ''].join('')).match(HEX);
43
-
44
- if (hex !== null) {
45
- return {
46
- mode: 'rgb',
47
- color: [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)].map(v => v.toString()),
48
- alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
49
- };
50
- }
51
-
52
- let match = value.match(RGB_HSL);
53
-
54
- if (match !== null) {
55
- var _match$, _match$$toString;
56
-
57
- return {
58
- mode: match[1],
59
- color: [match[2], match[3], match[4]].map(v => v.toString()),
60
- alpha: (_match$ = match[5]) === null || _match$ === void 0 ? void 0 : (_match$$toString = _match$.toString) === null || _match$$toString === void 0 ? void 0 : _match$$toString.call(_match$)
61
- };
62
- }
63
-
64
- return null;
65
80
  }
66
-
67
- function formatColor({
68
- mode,
69
- color,
70
- alpha
71
- }) {
72
- let hasAlpha = alpha !== undefined;
73
- return `${mode}(${color.join(' ')}${hasAlpha ? ` / ${alpha}` : ''})`;
74
- }
81
+ function formatColor({ mode , color , alpha }) {
82
+ let hasAlpha = alpha !== undefined;
83
+ return `${mode}(${color.join(' ')}${hasAlpha ? ` / ${alpha}` : ''})`;
84
+ }
@@ -1,19 +1,18 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = _default;
7
-
8
6
  function _default(pluginConfig, plugins) {
9
- if (pluginConfig === undefined) {
10
- return plugins;
11
- }
12
-
13
- const pluginNames = Array.isArray(pluginConfig) ? pluginConfig : [...new Set(plugins.filter(pluginName => {
14
- return pluginConfig !== false && pluginConfig[pluginName] !== false;
15
- }).concat(Object.keys(pluginConfig).filter(pluginName => {
16
- return pluginConfig[pluginName] !== false;
17
- })))];
18
- return pluginNames;
19
- }
7
+ if (pluginConfig === undefined) {
8
+ return plugins;
9
+ }
10
+ const pluginNames = Array.isArray(pluginConfig) ? pluginConfig : [
11
+ ...new Set(plugins.filter((pluginName)=>{
12
+ return pluginConfig !== false && pluginConfig[pluginName] !== false;
13
+ }).concat(Object.keys(pluginConfig).filter((pluginName)=>{
14
+ return pluginConfig[pluginName] !== false;
15
+ }))),
16
+ ];
17
+ return pluginNames;
18
+ }
@@ -1,33 +1,30 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = void 0;
7
-
8
6
  function createPlugin(plugin, config) {
9
- return {
10
- handler: plugin,
11
- config
12
- };
13
- }
14
-
15
- createPlugin.withOptions = function (pluginFunction, configFunction = () => ({})) {
16
- const optionsFunction = function (options) {
17
7
  return {
18
- __options: options,
19
- handler: pluginFunction(options),
20
- config: configFunction(options)
8
+ handler: plugin,
9
+ config
10
+ };
11
+ }
12
+ createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({
13
+ })
14
+ ) {
15
+ const optionsFunction = function(options) {
16
+ return {
17
+ __options: options,
18
+ handler: pluginFunction(options),
19
+ config: configFunction(options)
20
+ };
21
21
  };
22
- };
23
-
24
- optionsFunction.__isOptionsFunction = true; // Expose plugin dependencies so that `object-hash` returns a different
25
- // value if anything here changes, to ensure a rebuild is triggered.
26
-
27
- optionsFunction.__pluginFunction = pluginFunction;
28
- optionsFunction.__configFunction = configFunction;
29
- return optionsFunction;
22
+ optionsFunction.__isOptionsFunction = true;
23
+ // Expose plugin dependencies so that `object-hash` returns a different
24
+ // value if anything here changes, to ensure a rebuild is triggered.
25
+ optionsFunction.__pluginFunction = pluginFunction;
26
+ optionsFunction.__configFunction = configFunction;
27
+ return optionsFunction;
30
28
  };
31
-
32
29
  var _default = createPlugin;
33
- exports.default = _default;
30
+ exports.default = _default;
@@ -1,51 +1,53 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = createUtilityPlugin;
7
-
8
6
  var _transformThemeValue = _interopRequireDefault(require("./transformThemeValue"));
9
-
10
- var _pluginUtils = require("../util/pluginUtils");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- let asMap = new Map([[_pluginUtils.asValue, 'any'], [_pluginUtils.asColor, 'color'], [_pluginUtils.asAngle, 'angle'], [_pluginUtils.asLength, 'length'], [_pluginUtils.asLookupValue, 'lookup']]);
15
-
16
- function createUtilityPlugin(themeKey, utilityVariations = [[themeKey, [themeKey]]], {
17
- filterDefault = false,
18
- resolveArbitraryValue = _pluginUtils.asValue
19
- } = {}) {
20
- let transformValue = (0, _transformThemeValue.default)(themeKey);
21
- return function ({
22
- matchUtilities,
23
- theme
24
- }) {
25
- for (let utilityVariation of utilityVariations) {
26
- var _theme, _asMap$get;
27
-
28
- let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [utilityVariation];
29
- matchUtilities(group.reduce((obj, [classPrefix, properties]) => {
30
- return Object.assign(obj, {
31
- [classPrefix]: value => {
32
- return properties.reduce((obj, name) => {
33
- if (Array.isArray(name)) {
34
- return Object.assign(obj, {
35
- [name[0]]: name[1]
7
+ function _interopRequireDefault(obj) {
8
+ return obj && obj.__esModule ? obj : {
9
+ default: obj
10
+ };
11
+ }
12
+ function createUtilityPlugin(themeKey, utilityVariations = [
13
+ [
14
+ themeKey,
15
+ [
16
+ themeKey
17
+ ]
18
+ ]
19
+ ], { filterDefault =false , ...options } = {
20
+ }) {
21
+ let transformValue = (0, _transformThemeValue).default(themeKey);
22
+ return function({ matchUtilities , theme }) {
23
+ for (let utilityVariation of utilityVariations){
24
+ let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [
25
+ utilityVariation
26
+ ];
27
+ var ref;
28
+ matchUtilities(group.reduce((obj1, [classPrefix, properties])=>{
29
+ return Object.assign(obj1, {
30
+ [classPrefix]: (value)=>{
31
+ return properties.reduce((obj, name)=>{
32
+ if (Array.isArray(name)) {
33
+ return Object.assign(obj, {
34
+ [name[0]]: name[1]
35
+ });
36
+ }
37
+ return Object.assign(obj, {
38
+ [name]: transformValue(value)
39
+ });
40
+ }, {
41
+ });
42
+ }
36
43
  });
37
- }
38
-
39
- return Object.assign(obj, {
40
- [name]: transformValue(value)
41
- });
42
- }, {});
43
- }
44
- });
45
- }, {}), {
46
- values: filterDefault ? Object.fromEntries(Object.entries((_theme = theme(themeKey)) !== null && _theme !== void 0 ? _theme : {}).filter(([modifier]) => modifier !== 'DEFAULT')) : theme(themeKey),
47
- type: (_asMap$get = asMap.get(resolveArbitraryValue)) !== null && _asMap$get !== void 0 ? _asMap$get : 'any'
48
- });
49
- }
50
- };
51
- }
44
+ }, {
45
+ }), {
46
+ ...options,
47
+ values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {
48
+ }).filter(([modifier])=>modifier !== 'DEFAULT'
49
+ )) : theme(themeKey)
50
+ });
51
+ }
52
+ };
53
+ }
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.normalize = normalize;
6
+ exports.url = url;
7
+ exports.number = number;
8
+ exports.percentage = percentage;
9
+ exports.length = length;
10
+ exports.lineWidth = lineWidth;
11
+ exports.shadow = shadow;
12
+ exports.color = color;
13
+ exports.image = image;
14
+ exports.gradient = gradient;
15
+ exports.position = position;
16
+ exports.familyName = familyName;
17
+ exports.genericName = genericName;
18
+ exports.absoluteSize = absoluteSize;
19
+ exports.relativeSize = relativeSize;
20
+ var _color = require("./color");
21
+ var _parseBoxShadowValue = require("./parseBoxShadowValue");
22
+ let cssFunctions = [
23
+ 'min',
24
+ 'max',
25
+ 'clamp',
26
+ 'calc'
27
+ ];
28
+ // Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
29
+ let COMMA = /,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
30
+ ;
31
+ let UNDERSCORE = /_(?![^(]*\))/g // Underscore separator that is not located between brackets. E.g.: `rgba(255,_255,_255)_black` these don't count.
32
+ ;
33
+ function normalize(value, isRoot = true) {
34
+ // Keep raw strings if it starts with `url(`
35
+ if (value.includes('url(')) {
36
+ return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
37
+ if (/^url\(.*?\)$/.test(part)) {
38
+ return part;
39
+ }
40
+ return normalize(part, false);
41
+ }).join('');
42
+ }
43
+ // Convert `_` to ` `, except for escaped underscores `\_`
44
+ value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + ' '.repeat(fullMatch.length - 1)
45
+ ).replace(/^_/g, ' ').replace(/\\_/g, '_');
46
+ // Remove leftover whitespace
47
+ if (isRoot) {
48
+ value = value.trim();
49
+ }
50
+ // Add spaces around operators inside calc() that do not follow an operator
51
+ // or '('.
52
+ return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, '$1 $2 ');
53
+ }
54
+ function url(value) {
55
+ return value.startsWith('url(');
56
+ }
57
+ function number(value) {
58
+ return !isNaN(Number(value)) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?`).test(value)
59
+ );
60
+ }
61
+ function percentage(value) {
62
+ return /%$/g.test(value) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?%`).test(value)
63
+ );
64
+ }
65
+ let lengthUnits = [
66
+ 'cm',
67
+ 'mm',
68
+ 'Q',
69
+ 'in',
70
+ 'pc',
71
+ 'pt',
72
+ 'px',
73
+ 'em',
74
+ 'ex',
75
+ 'ch',
76
+ 'rem',
77
+ 'lh',
78
+ 'vw',
79
+ 'vh',
80
+ 'vmin',
81
+ 'vmax',
82
+ ];
83
+ let lengthUnitsPattern = `(?:${lengthUnits.join('|')})`;
84
+ function length(value) {
85
+ return value === '0' || new RegExp(`${lengthUnitsPattern}$`).test(value) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?${lengthUnitsPattern}`).test(value)
86
+ );
87
+ }
88
+ let lineWidths = new Set([
89
+ 'thin',
90
+ 'medium',
91
+ 'thick'
92
+ ]);
93
+ function lineWidth(value) {
94
+ return lineWidths.has(value);
95
+ }
96
+ function shadow(value) {
97
+ let parsedShadows = (0, _parseBoxShadowValue).parseBoxShadowValue(normalize(value));
98
+ for (let parsedShadow of parsedShadows){
99
+ if (!parsedShadow.valid) {
100
+ return false;
101
+ }
102
+ }
103
+ return true;
104
+ }
105
+ function color(value) {
106
+ let colors = 0;
107
+ let result = value.split(UNDERSCORE).every((part)=>{
108
+ part = normalize(part);
109
+ if (part.startsWith('var(')) return true;
110
+ if ((0, _color).parseColor(part) !== null) return colors++, true;
111
+ return false;
112
+ });
113
+ if (!result) return false;
114
+ return colors > 0;
115
+ }
116
+ function image(value) {
117
+ let images = 0;
118
+ let result = value.split(COMMA).every((part)=>{
119
+ part = normalize(part);
120
+ if (part.startsWith('var(')) return true;
121
+ if (url(part) || gradient(part) || [
122
+ 'element(',
123
+ 'image(',
124
+ 'cross-fade(',
125
+ 'image-set('
126
+ ].some((fn)=>part.startsWith(fn)
127
+ )) {
128
+ images++;
129
+ return true;
130
+ }
131
+ return false;
132
+ });
133
+ if (!result) return false;
134
+ return images > 0;
135
+ }
136
+ let gradientTypes = new Set([
137
+ 'linear-gradient',
138
+ 'radial-gradient',
139
+ 'repeating-linear-gradient',
140
+ 'repeating-radial-gradient',
141
+ 'conic-gradient',
142
+ ]);
143
+ function gradient(value) {
144
+ value = normalize(value);
145
+ for (let type of gradientTypes){
146
+ if (value.startsWith(`${type}(`)) {
147
+ return true;
148
+ }
149
+ }
150
+ return false;
151
+ }
152
+ let validPositions = new Set([
153
+ 'center',
154
+ 'top',
155
+ 'right',
156
+ 'bottom',
157
+ 'left'
158
+ ]);
159
+ function position(value) {
160
+ let positions = 0;
161
+ let result = value.split(UNDERSCORE).every((part)=>{
162
+ part = normalize(part);
163
+ if (part.startsWith('var(')) return true;
164
+ if (validPositions.has(part) || length(part) || percentage(part)) {
165
+ positions++;
166
+ return true;
167
+ }
168
+ return false;
169
+ });
170
+ if (!result) return false;
171
+ return positions > 0;
172
+ }
173
+ function familyName(value) {
174
+ let fonts = 0;
175
+ let result = value.split(COMMA).every((part)=>{
176
+ part = normalize(part);
177
+ if (part.startsWith('var(')) return true;
178
+ // If it contains spaces, then it should be quoted
179
+ if (part.includes(' ')) {
180
+ if (!/(['"])([^"']+)\1/g.test(part)) {
181
+ return false;
182
+ }
183
+ }
184
+ // If it starts with a number, it's invalid
185
+ if (/^\d/g.test(part)) {
186
+ return false;
187
+ }
188
+ fonts++;
189
+ return true;
190
+ });
191
+ if (!result) return false;
192
+ return fonts > 0;
193
+ }
194
+ let genericNames = new Set([
195
+ 'serif',
196
+ 'sans-serif',
197
+ 'monospace',
198
+ 'cursive',
199
+ 'fantasy',
200
+ 'system-ui',
201
+ 'ui-serif',
202
+ 'ui-sans-serif',
203
+ 'ui-monospace',
204
+ 'ui-rounded',
205
+ 'math',
206
+ 'emoji',
207
+ 'fangsong',
208
+ ]);
209
+ function genericName(value) {
210
+ return genericNames.has(value);
211
+ }
212
+ let absoluteSizes = new Set([
213
+ 'xx-small',
214
+ 'x-small',
215
+ 'small',
216
+ 'medium',
217
+ 'large',
218
+ 'x-large',
219
+ 'x-large',
220
+ 'xxx-large',
221
+ ]);
222
+ function absoluteSize(value) {
223
+ return absoluteSizes.has(value);
224
+ }
225
+ let relativeSizes = new Set([
226
+ 'larger',
227
+ 'smaller'
228
+ ]);
229
+ function relativeSize(value) {
230
+ return relativeSizes.has(value);
231
+ }
@@ -1,20 +1,16 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.defaults = defaults;
7
-
8
6
  function defaults(target, ...sources) {
9
- for (let source of sources) {
10
- for (let k in source) {
11
- var _target$hasOwnPropert;
12
-
13
- if (!(target !== null && target !== void 0 && (_target$hasOwnPropert = target.hasOwnProperty) !== null && _target$hasOwnPropert !== void 0 && _target$hasOwnPropert.call(target, k))) {
14
- target[k] = source[k];
15
- }
7
+ for (let source of sources){
8
+ for(let k in source){
9
+ var ref;
10
+ if (!(target === null || target === void 0 ? void 0 : (ref = target.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(target, k))) {
11
+ target[k] = source[k];
12
+ }
13
+ }
16
14
  }
17
- }
18
-
19
- return target;
20
- }
15
+ return target;
16
+ }
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = escapeClassName;
7
-
8
6
  var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
9
-
10
7
  var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
14
13
  function escapeClassName(className) {
15
- var _node$raws$value, _node$raws;
16
-
17
- let node = _postcssSelectorParser.default.className();
18
-
19
- node.value = className;
20
- return (0, _escapeCommas.default)((_node$raws$value = node === null || node === void 0 ? void 0 : (_node$raws = node.raws) === null || _node$raws === void 0 ? void 0 : _node$raws.value) !== null && _node$raws$value !== void 0 ? _node$raws$value : node.value);
21
- }
14
+ var ref;
15
+ let node = _postcssSelectorParser.default.className();
16
+ node.value = className;
17
+ var ref1;
18
+ return (0, _escapeCommas).default((ref1 = node === null || node === void 0 ? void 0 : (ref = node.raws) === null || ref === void 0 ? void 0 : ref.value) !== null && ref1 !== void 0 ? ref1 : node.value);
19
+ }
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = escapeCommas;
7
-
8
6
  function escapeCommas(className) {
9
- return className.replace(/\\,/g, '\\2c ');
10
- }
7
+ return className.replace(/\\,/g, '\\2c ');
8
+ }
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = void 0;
7
-
8
- const flattenColorPalette = colors => Object.assign({}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {}).flatMap(([color, values]) => typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
9
- [color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex
10
- })) : [{
11
- [`${color}`]: values
12
- }]));
13
-
6
+ const flattenColorPalette = (colors)=>Object.assign({
7
+ }, ...Object.entries(colors !== null && colors !== void 0 ? colors : {
8
+ }).flatMap(([color, values])=>typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
9
+ [color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex
10
+ })
11
+ ) : [
12
+ {
13
+ [`${color}`]: values
14
+ }
15
+ ]
16
+ ))
17
+ ;
14
18
  var _default = flattenColorPalette;
15
- exports.default = _default;
19
+ exports.default = _default;