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,32 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: ()=>cloneNodes
8
- });
9
- function cloneNodes(nodes, source = undefined, raws = undefined) {
2
+ function cloneNodes(nodes, source, raws) {
10
3
  return nodes.map((node)=>{
11
4
  var _node_raws_tailwind;
12
- let cloned = node.clone();
13
- // We always want override the source map
14
- // except when explicitly told not to
15
- let shouldOverwriteSource = ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.preserveSource) !== true || !cloned.source;
16
- if (source !== undefined && shouldOverwriteSource) {
17
- cloned.source = source;
18
- if ("walk" in cloned) {
19
- cloned.walk((child)=>{
20
- child.source = source;
21
- });
22
- }
23
- }
24
- if (raws !== undefined) {
25
- cloned.raws.tailwind = {
26
- ...cloned.raws.tailwind,
27
- ...raws
28
- };
29
- }
30
- return cloned;
5
+ let cloned = node.clone(), shouldOverwriteSource = (null === (_node_raws_tailwind = node.raws.tailwind) || void 0 === _node_raws_tailwind ? void 0 : _node_raws_tailwind.preserveSource) !== !0 || !cloned.source;
6
+ return void 0 !== source && shouldOverwriteSource && (cloned.source = source, "walk" in cloned && cloned.walk((child)=>{
7
+ child.source = source;
8
+ })), void 0 !== raws && (cloned.raws.tailwind = {
9
+ ...cloned.raws.tailwind,
10
+ ...raws
11
+ }), cloned;
31
12
  });
32
13
  }
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: !0
16
+ }), Object.defineProperty(exports, "default", {
17
+ enumerable: !0,
18
+ get: ()=>cloneNodes
19
+ });
package/lib/util/color.js CHANGED
@@ -1,54 +1,37 @@
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
  parseColor: ()=>parseColor,
13
11
  formatColor: ()=>formatColor
14
12
  });
15
- const _colorName = /*#__PURE__*/ _interopRequireDefault(require("color-name"));
16
- function _interopRequireDefault(obj) {
13
+ const _colorName = function(obj) {
17
14
  return obj && obj.__esModule ? obj : {
18
15
  default: obj
19
16
  };
20
- }
21
- let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
22
- let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
23
- let VALUE = /(?:\d+|\d*\.\d+)%?/;
24
- let SEP = /(?:\s*,\s*|\s+)/;
25
- let ALPHA_SEP = /\s*[,/]\s*/;
26
- let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/;
27
- let RGB = new RegExp(`^(rgba?)\\(\\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*\\)$`);
28
- let HSL = new RegExp(`^(hsla?)\\(\\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*\\)$`);
29
- function parseColor(value, { loose =false } = {}) {
30
- var _match_, _match__toString;
31
- if (typeof value !== "string") {
32
- return null;
33
- }
34
- value = value.trim();
35
- if (value === "transparent") {
36
- return {
37
- mode: "rgb",
38
- color: [
39
- "0",
40
- "0",
41
- "0"
42
- ],
43
- alpha: "0"
44
- };
45
- }
46
- if (value in _colorName.default) {
47
- return {
48
- mode: "rgb",
49
- color: _colorName.default[value].map((v)=>v.toString())
50
- };
51
- }
17
+ }(require("color-name"));
18
+ let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i, VALUE = /(?:\d+|\d*\.\d+)%?/, SEP = /(?:\s*,\s*|\s+)/, ALPHA_SEP = /\s*[,/]\s*/, CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/, RGB = RegExp(`^(rgba?)\\(\\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*\\)$`), HSL = RegExp(`^(hsla?)\\(\\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*\\)$`);
19
+ function parseColor(value, { loose =!1 } = {}) {
20
+ var _match_, _match__toString, _value_match;
21
+ if ("string" != typeof value) return null;
22
+ if ("transparent" === (value = value.trim())) return {
23
+ mode: "rgb",
24
+ color: [
25
+ "0",
26
+ "0",
27
+ "0"
28
+ ],
29
+ alpha: "0"
30
+ };
31
+ if (value in _colorName.default) return {
32
+ mode: "rgb",
33
+ color: _colorName.default[value].map((v)=>v.toString())
34
+ };
52
35
  let hex = value.replace(SHORT_HEX, (_, r, g, b, a)=>[
53
36
  "#",
54
37
  r,
@@ -59,54 +42,35 @@ function parseColor(value, { loose =false } = {}) {
59
42
  b,
60
43
  a ? a + a : ""
61
44
  ].join("")).match(HEX);
62
- if (hex !== null) {
63
- return {
64
- mode: "rgb",
65
- color: [
66
- parseInt(hex[1], 16),
67
- parseInt(hex[2], 16),
68
- parseInt(hex[3], 16)
69
- ].map((v)=>v.toString()),
70
- alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
71
- };
72
- }
73
- var _value_match;
74
- let match = (_value_match = value.match(RGB)) !== null && _value_match !== void 0 ? _value_match : value.match(HSL);
75
- if (match === null) {
76
- return null;
77
- }
45
+ if (null !== hex) return {
46
+ mode: "rgb",
47
+ color: [
48
+ parseInt(hex[1], 16),
49
+ parseInt(hex[2], 16),
50
+ parseInt(hex[3], 16)
51
+ ].map((v)=>v.toString()),
52
+ alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : void 0
53
+ };
54
+ let match = null !== (_value_match = value.match(RGB)) && void 0 !== _value_match ? _value_match : value.match(HSL);
55
+ if (null === match) return null;
78
56
  let color = [
79
57
  match[2],
80
58
  match[3],
81
59
  match[4]
82
60
  ].filter(Boolean).map((v)=>v.toString());
83
- // rgba(var(--my-color), 0.1)
84
- // hsla(var(--my-color), 0.1)
85
- if (color.length === 2 && color[0].startsWith("var(")) {
86
- return {
87
- mode: match[1],
88
- color: [
89
- color[0]
90
- ],
91
- alpha: color[1]
92
- };
93
- }
94
- if (!loose && color.length !== 3) {
95
- return null;
96
- }
97
- if (color.length < 3 && !color.some((part)=>/^var\(.*?\)$/.test(part))) {
98
- return null;
99
- }
100
- return {
61
+ return 2 === color.length && color[0].startsWith("var(") ? {
62
+ mode: match[1],
63
+ color: [
64
+ color[0]
65
+ ],
66
+ alpha: color[1]
67
+ } : (loose || 3 === color.length) && (!(color.length < 3) || color.some((part)=>/^var\(.*?\)$/.test(part))) ? {
101
68
  mode: match[1],
102
69
  color,
103
- 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_)
104
- };
70
+ alpha: null === (_match_ = match[5]) || void 0 === _match_ ? void 0 : null === (_match__toString = _match_.toString) || void 0 === _match__toString ? void 0 : _match__toString.call(_match_)
71
+ } : null;
105
72
  }
106
73
  function formatColor({ mode , color , alpha }) {
107
- let hasAlpha = alpha !== undefined;
108
- if (mode === "rgba" || mode === "hsla") {
109
- return `${mode}(${color.join(", ")}${hasAlpha ? `, ${alpha}` : ""})`;
110
- }
111
- return `${mode}(${color.join(" ")}${hasAlpha ? ` / ${alpha}` : ""})`;
74
+ let hasAlpha = void 0 !== alpha;
75
+ return "rgba" === mode || "hsla" === mode ? `${mode}(${color.join(", ")}${hasAlpha ? `, ${alpha}` : ""})` : `${mode}(${color.join(" ")}${hasAlpha ? ` / ${alpha}` : ""})`;
112
76
  }
@@ -1,21 +1,14 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: ()=>_default
8
- });
9
2
  function _default(pluginConfig, plugins) {
10
- if (pluginConfig === undefined) {
11
- return plugins;
12
- }
13
- const pluginNames = Array.isArray(pluginConfig) ? pluginConfig : [
14
- ...new Set(plugins.filter((pluginName)=>{
15
- return pluginConfig !== false && pluginConfig[pluginName] !== false;
16
- }).concat(Object.keys(pluginConfig).filter((pluginName)=>{
17
- return pluginConfig[pluginName] !== false;
18
- })))
3
+ if (void 0 === pluginConfig) return plugins;
4
+ let pluginNames = Array.isArray(pluginConfig) ? pluginConfig : [
5
+ ...new Set(plugins.filter((pluginName)=>!1 !== pluginConfig && !1 !== pluginConfig[pluginName]).concat(Object.keys(pluginConfig).filter((pluginName)=>!1 !== pluginConfig[pluginName])))
19
6
  ];
20
7
  return pluginNames;
21
8
  }
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: !0
11
+ }), Object.defineProperty(exports, "default", {
12
+ enumerable: !0,
13
+ get: ()=>_default
14
+ });
@@ -1,30 +1,23 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: ()=>_default
8
- });
9
2
  function createPlugin(plugin, config) {
10
3
  return {
11
4
  handler: plugin,
12
5
  config
13
6
  };
14
7
  }
15
- createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {
16
- const optionsFunction = function(options) {
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: !0
10
+ }), Object.defineProperty(exports, "default", {
11
+ enumerable: !0,
12
+ get: ()=>_default
13
+ }), createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {
14
+ let optionsFunction = function(options) {
17
15
  return {
18
16
  __options: options,
19
17
  handler: pluginFunction(options),
20
18
  config: configFunction(options)
21
19
  };
22
20
  };
23
- optionsFunction.__isOptionsFunction = true;
24
- // Expose plugin dependencies so that `object-hash` returns a different
25
- // value if anything here changes, to ensure a rebuild is triggered.
26
- optionsFunction.__pluginFunction = pluginFunction;
27
- optionsFunction.__configFunction = configFunction;
28
- return optionsFunction;
21
+ return optionsFunction.__isOptionsFunction = !0, optionsFunction.__pluginFunction = pluginFunction, optionsFunction.__configFunction = configFunction, optionsFunction;
29
22
  };
30
23
  const _default = createPlugin;
@@ -1,17 +1,15 @@
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: ()=>createUtilityPlugin
8
7
  });
9
- const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("./transformThemeValue"));
10
- function _interopRequireDefault(obj) {
8
+ const _transformThemeValue = function(obj) {
11
9
  return obj && obj.__esModule ? obj : {
12
10
  default: obj
13
11
  };
14
- }
12
+ }(require("./transformThemeValue"));
15
13
  function createUtilityPlugin(themeKey, utilityVariations = [
16
14
  [
17
15
  themeKey,
@@ -19,32 +17,22 @@ function createUtilityPlugin(themeKey, utilityVariations = [
19
17
  themeKey
20
18
  ]
21
19
  ]
22
- ], { filterDefault =false , ...options } = {}) {
20
+ ], { filterDefault =!1 , ...options } = {}) {
23
21
  let transformValue = (0, _transformThemeValue.default)(themeKey);
24
22
  return function({ matchUtilities , theme }) {
25
23
  for (let utilityVariation of utilityVariations){
26
- let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [
27
- utilityVariation
28
- ];
29
24
  var _theme;
30
- matchUtilities(group.reduce((obj, [classPrefix, properties])=>{
31
- return Object.assign(obj, {
32
- [classPrefix]: (value)=>{
33
- return properties.reduce((obj, name)=>{
34
- if (Array.isArray(name)) {
35
- return Object.assign(obj, {
36
- [name[0]]: name[1]
37
- });
38
- }
39
- return Object.assign(obj, {
25
+ matchUtilities((Array.isArray(utilityVariation[0]) ? utilityVariation : [
26
+ utilityVariation
27
+ ]).reduce((obj, [classPrefix, properties])=>Object.assign(obj, {
28
+ [classPrefix]: (value)=>properties.reduce((obj, name)=>Array.isArray(name) ? Object.assign(obj, {
29
+ [name[0]]: name[1]
30
+ }) : Object.assign(obj, {
40
31
  [name]: transformValue(value)
41
- });
42
- }, {});
43
- }
44
- });
45
- }, {}), {
32
+ }), {})
33
+ }), {}), {
46
34
  ...options,
47
- values: filterDefault ? Object.fromEntries(Object.entries((_theme = theme(themeKey)) !== null && _theme !== void 0 ? _theme : {}).filter(([modifier])=>modifier !== "DEFAULT")) : theme(themeKey)
35
+ values: filterDefault ? Object.fromEntries(Object.entries(null !== (_theme = theme(themeKey)) && void 0 !== _theme ? _theme : {}).filter(([modifier])=>"DEFAULT" !== modifier)) : theme(themeKey)
48
36
  });
49
37
  }
50
38
  };
@@ -1,14 +1,12 @@
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
  normalize: ()=>normalize,
13
11
  url: ()=>url,
14
12
  number: ()=>number,
@@ -25,50 +23,22 @@ _export(exports, {
25
23
  absoluteSize: ()=>absoluteSize,
26
24
  relativeSize: ()=>relativeSize
27
25
  });
28
- const _color = require("./color");
29
- const _parseBoxShadowValue = require("./parseBoxShadowValue");
30
- const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
26
+ const _color = require("./color"), _parseBoxShadowValue = require("./parseBoxShadowValue"), _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
31
27
  let cssFunctions = [
32
28
  "min",
33
29
  "max",
34
30
  "clamp",
35
31
  "calc"
36
32
  ];
37
- // Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
38
33
  function isCSSFunction(value) {
39
- return cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.*\\)`).test(value));
34
+ return cssFunctions.some((fn)=>RegExp(`^${fn}\\(.*\\)`).test(value));
40
35
  }
41
- const placeholder = "--tw-placeholder";
42
- const placeholderRe = new RegExp(placeholder, "g");
43
- function normalize(value, isRoot = true) {
44
- if (value.startsWith("--")) {
45
- return `var(${value})`;
46
- }
47
- // Keep raw strings if it starts with `url(`
48
- if (value.includes("url(")) {
49
- return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
50
- if (/^url\(.*?\)$/.test(part)) {
51
- return part;
52
- }
53
- return normalize(part, false);
54
- }).join("");
55
- }
56
- // Convert `_` to ` `, except for escaped underscores `\_`
57
- value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + " ".repeat(fullMatch.length - 1)).replace(/^_/g, " ").replace(/\\_/g, "_");
58
- // Remove leftover whitespace
59
- if (isRoot) {
60
- value = value.trim();
61
- }
62
- // Add spaces around operators inside math functions like calc() that do not follow an operator
63
- // or '('.
64
- value = value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
36
+ const placeholder = "--tw-placeholder", placeholderRe = RegExp(placeholder, "g");
37
+ function normalize(value, isRoot = !0) {
38
+ return value.startsWith("--") ? `var(${value})` : value.includes("url(") ? value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>/^url\(.*?\)$/.test(part) ? part : normalize(part, !1)).join("") : (value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + " ".repeat(fullMatch.length - 1)).replace(/^_/g, " ").replace(/\\_/g, "_"), isRoot && (value = value.trim()), value = value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
65
39
  let vars = [];
66
- return match.replace(/var\((--.+?)[,)]/g, (match, g1)=>{
67
- vars.push(g1);
68
- return match.replace(g1, placeholder);
69
- }).replace(/(-?\d*\.?\d(?!\b-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(placeholderRe, ()=>vars.shift());
70
- });
71
- return value;
40
+ return match.replace(/var\((--.+?)[,)]/g, (match, g1)=>(vars.push(g1), match.replace(g1, placeholder))).replace(/(-?\d*\.?\d(?!\b-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(placeholderRe, ()=>vars.shift());
41
+ }));
72
42
  }
73
43
  function url(value) {
74
44
  return value.startsWith("url(");
@@ -79,45 +49,8 @@ function number(value) {
79
49
  function percentage(value) {
80
50
  return value.endsWith("%") && number(value.slice(0, -1)) || isCSSFunction(value);
81
51
  }
82
- // Please refer to MDN when updating this list:
83
- // https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units
84
- // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries#container_query_length_units
85
- let lengthUnits = [
86
- "cm",
87
- "mm",
88
- "Q",
89
- "in",
90
- "pc",
91
- "pt",
92
- "px",
93
- "em",
94
- "ex",
95
- "ch",
96
- "rem",
97
- "lh",
98
- "rlh",
99
- "vw",
100
- "vh",
101
- "vmin",
102
- "vmax",
103
- "vb",
104
- "vi",
105
- "svw",
106
- "svh",
107
- "lvw",
108
- "lvh",
109
- "dvw",
110
- "dvh",
111
- "cqw",
112
- "cqh",
113
- "cqi",
114
- "cqb",
115
- "cqmin",
116
- "cqmax"
117
- ];
118
- let lengthUnitsPattern = `(?:${lengthUnits.join("|")})`;
119
52
  function length(value) {
120
- return value === "0" || new RegExp(`^[+-]?[0-9]*\.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`).test(value) || isCSSFunction(value);
53
+ return "0" === value || RegExp("^[+-]?[0-9]*\\.?[0-9]+(?:[eE][+-]?[0-9]+)?(?:cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cqw|cqh|cqi|cqb|cqmin|cqmax)$").test(value) || isCSSFunction(value);
121
54
  }
122
55
  let lineWidths = new Set([
123
56
  "thin",
@@ -128,45 +61,23 @@ function lineWidth(value) {
128
61
  return lineWidths.has(value);
129
62
  }
130
63
  function shadow(value) {
131
- let parsedShadows = (0, _parseBoxShadowValue.parseBoxShadowValue)(normalize(value));
132
- for (let parsedShadow of parsedShadows){
133
- if (!parsedShadow.valid) {
134
- return false;
135
- }
136
- }
137
- return true;
64
+ for (let parsedShadow of (0, _parseBoxShadowValue.parseBoxShadowValue)(normalize(value)))if (!parsedShadow.valid) return !1;
65
+ return !0;
138
66
  }
139
67
  function color(value) {
140
68
  let colors = 0;
141
- let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, "_").every((part)=>{
142
- part = normalize(part);
143
- if (part.startsWith("var(")) return true;
144
- if ((0, _color.parseColor)(part, {
145
- loose: true
146
- }) !== null) return colors++, true;
147
- return false;
148
- });
149
- if (!result) return false;
150
- return colors > 0;
69
+ return !!(0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, "_").every((part)=>!!(part = normalize(part)).startsWith("var(") || null !== (0, _color.parseColor)(part, {
70
+ loose: !0
71
+ }) && (colors++, !0)) && colors > 0;
151
72
  }
152
73
  function image(value) {
153
74
  let images = 0;
154
- let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
155
- part = normalize(part);
156
- if (part.startsWith("var(")) return true;
157
- if (url(part) || gradient(part) || [
75
+ return !!(0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>!!(part = normalize(part)).startsWith("var(") || !!(url(part) || gradient(part) || [
158
76
  "element(",
159
77
  "image(",
160
78
  "cross-fade(",
161
79
  "image-set("
162
- ].some((fn)=>part.startsWith(fn))) {
163
- images++;
164
- return true;
165
- }
166
- return false;
167
- });
168
- if (!result) return false;
169
- return images > 0;
80
+ ].some((fn)=>part.startsWith(fn))) && (images++, !0)) && images > 0;
170
81
  }
171
82
  let gradientTypes = new Set([
172
83
  "linear-gradient",
@@ -176,13 +87,8 @@ let gradientTypes = new Set([
176
87
  "conic-gradient"
177
88
  ]);
178
89
  function gradient(value) {
179
- value = normalize(value);
180
- for (let type of gradientTypes){
181
- if (value.startsWith(`${type}(`)) {
182
- return true;
183
- }
184
- }
185
- return false;
90
+ for (let type of (value = normalize(value), gradientTypes))if (value.startsWith(`${type}(`)) return !0;
91
+ return !1;
186
92
  }
187
93
  let validPositions = new Set([
188
94
  "center",
@@ -193,38 +99,11 @@ let validPositions = new Set([
193
99
  ]);
194
100
  function position(value) {
195
101
  let positions = 0;
196
- let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, "_").every((part)=>{
197
- part = normalize(part);
198
- if (part.startsWith("var(")) return true;
199
- if (validPositions.has(part) || length(part) || percentage(part)) {
200
- positions++;
201
- return true;
202
- }
203
- return false;
204
- });
205
- if (!result) return false;
206
- return positions > 0;
102
+ return !!(0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, "_").every((part)=>!!(part = normalize(part)).startsWith("var(") || !!(validPositions.has(part) || length(part) || percentage(part)) && (positions++, !0)) && positions > 0;
207
103
  }
208
104
  function familyName(value) {
209
105
  let fonts = 0;
210
- let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
211
- part = normalize(part);
212
- if (part.startsWith("var(")) return true;
213
- // If it contains spaces, then it should be quoted
214
- if (part.includes(" ")) {
215
- if (!/(['"])([^"']+)\1/g.test(part)) {
216
- return false;
217
- }
218
- }
219
- // If it starts with a number, it's invalid
220
- if (/^\d/g.test(part)) {
221
- return false;
222
- }
223
- fonts++;
224
- return true;
225
- });
226
- if (!result) return false;
227
- return fonts > 0;
106
+ return !!(0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>!!(part = normalize(part)).startsWith("var(") || !(part.includes(" ") && !/(['"])([^"']+)\1/g.test(part) || /^\d/g.test(part)) && (fonts++, !0)) && fonts > 0;
228
107
  }
229
108
  let genericNames = new Set([
230
109
  "serif",
@@ -1,25 +1,15 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "defaults", {
6
- enumerable: true,
7
- get: ()=>defaults
8
- });
9
2
  function defaults(target, ...sources) {
10
3
  for (let source of sources){
11
- for(let k in source){
12
- var _target_hasOwnProperty;
13
- if (!(target === null || target === void 0 ? void 0 : (_target_hasOwnProperty = target.hasOwnProperty) === null || _target_hasOwnProperty === void 0 ? void 0 : _target_hasOwnProperty.call(target, k))) {
14
- target[k] = source[k];
15
- }
16
- }
17
- for (let k of Object.getOwnPropertySymbols(source)){
18
- var _target_hasOwnProperty1;
19
- if (!(target === null || target === void 0 ? void 0 : (_target_hasOwnProperty1 = target.hasOwnProperty) === null || _target_hasOwnProperty1 === void 0 ? void 0 : _target_hasOwnProperty1.call(target, k))) {
20
- target[k] = source[k];
21
- }
22
- }
4
+ var _target_hasOwnProperty, _target_hasOwnProperty1;
5
+ for(let k in source)(null == target ? void 0 : null === (_target_hasOwnProperty = target.hasOwnProperty) || void 0 === _target_hasOwnProperty ? void 0 : _target_hasOwnProperty.call(target, k)) || (target[k] = source[k]);
6
+ for (let k of Object.getOwnPropertySymbols(source))(null == target ? void 0 : null === (_target_hasOwnProperty1 = target.hasOwnProperty) || void 0 === _target_hasOwnProperty1 ? void 0 : _target_hasOwnProperty1.call(target, k)) || (target[k] = source[k]);
23
7
  }
24
8
  return target;
25
9
  }
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: !0
12
+ }), Object.defineProperty(exports, "defaults", {
13
+ enumerable: !0,
14
+ get: ()=>defaults
15
+ });
@@ -1,22 +1,18 @@
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: ()=>escapeClassName
8
7
  });
9
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
10
- const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
8
+ const _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser")), _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
11
9
  function _interopRequireDefault(obj) {
12
10
  return obj && obj.__esModule ? obj : {
13
11
  default: obj
14
12
  };
15
13
  }
16
14
  function escapeClassName(className) {
17
- var _node_raws;
15
+ var _node_raws, _node_raws_value;
18
16
  let node = _postcssSelectorParser.default.className();
19
- node.value = className;
20
- var _node_raws_value;
21
- 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);
17
+ return node.value = className, (0, _escapeCommas.default)(null !== (_node_raws_value = null == node ? void 0 : null === (_node_raws = node.raws) || void 0 === _node_raws ? void 0 : _node_raws.value) && void 0 !== _node_raws_value ? _node_raws_value : node.value);
22
18
  }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: ()=>escapeCommas
8
- });
9
2
  function escapeCommas(className) {
10
3
  return className.replace(/\\,/g, "\\2c ");
11
4
  }
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: !0
7
+ }), Object.defineProperty(exports, "default", {
8
+ enumerable: !0,
9
+ get: ()=>escapeCommas
10
+ });