tailwindcss 0.0.0-insiders.ca1dfd6 → 0.0.0-insiders.cab1fce

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