tailwindcss 0.0.0-insiders.fe08e91 → 0.0.0-oxide.c7d416b
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.
- package/CHANGELOG.md +379 -3
- package/LICENSE +1 -2
- package/README.md +12 -8
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +4 -0
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +48 -0
- package/lib/cli/build/plugin.js +367 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +178 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +239 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +13 -0
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +4 -740
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +6 -3
- package/lib/corePlugins.js +2064 -1811
- package/lib/css/preflight.css +5 -5
- package/lib/featureFlags.js +31 -22
- package/lib/index.js +4 -28
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +12 -9
- package/lib/lib/content.js +176 -0
- package/lib/lib/defaultExtractor.js +225 -31
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +118 -55
- package/lib/lib/expandApplyAtRules.js +439 -190
- package/lib/lib/expandTailwindAtRules.js +151 -134
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +454 -187
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +36 -32
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +89 -67
- package/lib/lib/setupContextUtils.js +667 -376
- package/lib/lib/setupTrackingContext.js +38 -67
- package/lib/lib/sharedState.js +27 -14
- package/lib/lib/substituteScreenAtRules.js +11 -9
- package/lib/plugin.js +48 -0
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +19 -0
- package/lib/postcss-plugins/nesting/plugin.js +87 -0
- package/lib/processTailwindFeatures.js +35 -25
- package/lib/public/colors.js +247 -245
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +8 -5
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +11 -6
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +53 -54
- package/lib/util/configurePlugins.js +5 -2
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -110
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +7 -4
- package/lib/util/escapeCommas.js +5 -2
- package/lib/util/flattenColorPalette.js +9 -12
- package/lib/util/formatVariantSelector.js +184 -85
- package/lib/util/getAllConfigs.js +27 -8
- package/lib/util/hashConfig.js +6 -3
- package/lib/util/isKeyframeRule.js +5 -2
- package/lib/util/isPlainObject.js +5 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +23 -15
- package/lib/util/log.js +20 -14
- package/lib/util/nameClass.js +20 -9
- package/lib/util/negateValue.js +23 -8
- package/lib/util/normalizeConfig.js +116 -72
- package/lib/util/normalizeScreens.js +120 -11
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- package/lib/util/parseDependency.js +38 -56
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +11 -8
- package/lib/util/pluginUtils.js +147 -50
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +97 -85
- package/lib/util/resolveConfigPath.js +11 -9
- package/lib/util/responsive.js +8 -5
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +5 -3
- package/lib/util/toPath.js +20 -4
- package/lib/util/transformThemeValue.js +37 -29
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/oxide/README.md +1 -0
- package/oxide/package.json +18 -0
- package/oxide/packages/tailwindcss/dist/cli.js +2 -0
- package/oxide/packages/tailwindcss/dist/postcss-plugin.js +2 -0
- package/oxide/packages/tailwindcss/package.json +34 -0
- package/package.json +49 -42
- package/peers/index.js +11381 -7950
- package/plugin.d.ts +11 -0
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +439 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +227 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +234 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +6 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +4 -810
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +532 -217
- package/src/css/preflight.css +5 -5
- package/src/featureFlags.js +15 -9
- package/src/index.js +4 -27
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/content.js +212 -0
- package/src/lib/defaultExtractor.js +196 -33
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +482 -183
- package/src/lib/expandTailwindAtRules.js +106 -85
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +418 -129
- package/src/lib/normalizeTailwindDirectives.js +1 -0
- package/src/lib/offsets.js +270 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +51 -30
- package/src/lib/setupContextUtils.js +556 -208
- package/src/lib/setupTrackingContext.js +11 -48
- package/src/lib/sharedState.js +5 -0
- package/src/plugin.js +47 -0
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +8 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +25 -21
- package/src/util/dataTypes.js +29 -21
- package/src/util/formatVariantSelector.js +184 -61
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +8 -8
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +44 -6
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +132 -10
- package/src/util/prefixSelector.js +7 -5
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -32
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +23 -20
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +362 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -0
- package/nesting/plugin.js +0 -41
|
@@ -2,22 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
parseBoxShadowValue: ()=>parseBoxShadowValue,
|
|
13
|
+
formatBoxShadowValue: ()=>formatBoxShadowValue
|
|
14
|
+
});
|
|
15
|
+
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
|
7
16
|
let KEYWORDS = new Set([
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
"inset",
|
|
18
|
+
"inherit",
|
|
19
|
+
"initial",
|
|
20
|
+
"revert",
|
|
21
|
+
"unset"
|
|
13
22
|
]);
|
|
14
|
-
let COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
15
|
-
;
|
|
16
23
|
let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
17
24
|
;
|
|
18
|
-
let LENGTH = /^-?(\d+)(.*?)$/g;
|
|
25
|
+
let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
|
|
19
26
|
function parseBoxShadowValue(input) {
|
|
20
|
-
let shadows =
|
|
27
|
+
let shadows = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",");
|
|
21
28
|
return shadows.map((shadow)=>{
|
|
22
29
|
let value = shadow.trim();
|
|
23
30
|
let result = {
|
|
@@ -29,22 +36,22 @@ function parseBoxShadowValue(input) {
|
|
|
29
36
|
// Reset index, since the regex is stateful.
|
|
30
37
|
LENGTH.lastIndex = 0;
|
|
31
38
|
// Keyword
|
|
32
|
-
if (!seen.has(
|
|
39
|
+
if (!seen.has("KEYWORD") && KEYWORDS.has(part)) {
|
|
33
40
|
result.keyword = part;
|
|
34
|
-
seen.add(
|
|
41
|
+
seen.add("KEYWORD");
|
|
35
42
|
} else if (LENGTH.test(part)) {
|
|
36
|
-
if (!seen.has(
|
|
43
|
+
if (!seen.has("X")) {
|
|
37
44
|
result.x = part;
|
|
38
|
-
seen.add(
|
|
39
|
-
} else if (!seen.has(
|
|
45
|
+
seen.add("X");
|
|
46
|
+
} else if (!seen.has("Y")) {
|
|
40
47
|
result.y = part;
|
|
41
|
-
seen.add(
|
|
42
|
-
} else if (!seen.has(
|
|
48
|
+
seen.add("Y");
|
|
49
|
+
} else if (!seen.has("BLUR")) {
|
|
43
50
|
result.blur = part;
|
|
44
|
-
seen.add(
|
|
45
|
-
} else if (!seen.has(
|
|
51
|
+
seen.add("BLUR");
|
|
52
|
+
} else if (!seen.has("SPREAD")) {
|
|
46
53
|
result.spread = part;
|
|
47
|
-
seen.add(
|
|
54
|
+
seen.add("SPREAD");
|
|
48
55
|
}
|
|
49
56
|
} else {
|
|
50
57
|
if (!result.color) {
|
|
@@ -72,6 +79,6 @@ function formatBoxShadowValue(shadows) {
|
|
|
72
79
|
shadow.blur,
|
|
73
80
|
shadow.spread,
|
|
74
81
|
shadow.color
|
|
75
|
-
].filter(Boolean).join(
|
|
76
|
-
}).join(
|
|
82
|
+
].filter(Boolean).join(" ");
|
|
83
|
+
}).join(", ");
|
|
77
84
|
}
|
|
@@ -1,63 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {{type: 'dependency', file: string} | {type: 'dir-dependency', dir: string, glob: string}} Dependency
|
|
4
|
+
*/ /**
|
|
5
|
+
*
|
|
6
|
+
* @param {import('../lib/content.js').ContentPath} contentPath
|
|
7
|
+
* @returns {Dependency[]}
|
|
8
|
+
*/ "use strict";
|
|
2
9
|
Object.defineProperty(exports, "__esModule", {
|
|
3
10
|
value: true
|
|
4
11
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
// Based on `glob-base`
|
|
15
|
-
// https://github.com/micromatch/glob-base/blob/master/index.js
|
|
16
|
-
function parseGlob(pattern) {
|
|
17
|
-
let glob = pattern;
|
|
18
|
-
let base = (0, _globParent).default(pattern);
|
|
19
|
-
if (base !== '.') {
|
|
20
|
-
glob = pattern.substr(base.length);
|
|
21
|
-
if (glob.charAt(0) === '/') {
|
|
22
|
-
glob = glob.substr(1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (glob.substr(0, 2) === './') {
|
|
26
|
-
glob = glob.substr(2);
|
|
27
|
-
}
|
|
28
|
-
if (glob.charAt(0) === '/') {
|
|
29
|
-
glob = glob.substr(1);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
base,
|
|
33
|
-
glob
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function parseDependency(normalizedFileOrGlob) {
|
|
37
|
-
if (normalizedFileOrGlob.startsWith('!')) {
|
|
38
|
-
return null;
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: ()=>parseDependency
|
|
15
|
+
});
|
|
16
|
+
function parseDependency(contentPath) {
|
|
17
|
+
if (contentPath.ignore) {
|
|
18
|
+
return [];
|
|
39
19
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
} else {
|
|
49
|
-
message = {
|
|
50
|
-
type: 'dependency',
|
|
51
|
-
file: _path.default.resolve(normalizedFileOrGlob)
|
|
52
|
-
};
|
|
20
|
+
if (!contentPath.glob) {
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
type: "dependency",
|
|
24
|
+
file: contentPath.base
|
|
25
|
+
}
|
|
26
|
+
];
|
|
53
27
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
28
|
+
if (process.env.ROLLUP_WATCH === "true") {
|
|
29
|
+
// rollup-plugin-postcss does not support dir-dependency messages
|
|
30
|
+
// but directories can be watched in the same way as files
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
type: "dependency",
|
|
34
|
+
file: contentPath.base
|
|
35
|
+
}
|
|
36
|
+
];
|
|
61
37
|
}
|
|
62
|
-
return
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
type: "dir-dependency",
|
|
41
|
+
dir: contentPath.base,
|
|
42
|
+
glob: contentPath.glob
|
|
43
|
+
}
|
|
44
|
+
];
|
|
63
45
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "parseGlob", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>parseGlob
|
|
8
|
+
});
|
|
9
|
+
const _globParent = /*#__PURE__*/ _interopRequireDefault(require("glob-parent"));
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function parseGlob(pattern) {
|
|
16
|
+
let glob = pattern;
|
|
17
|
+
let base = (0, _globParent.default)(pattern);
|
|
18
|
+
if (base !== ".") {
|
|
19
|
+
glob = pattern.substr(base.length);
|
|
20
|
+
if (glob.charAt(0) === "/") {
|
|
21
|
+
glob = glob.substr(1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (glob.substr(0, 2) === "./") {
|
|
25
|
+
glob = glob.substr(2);
|
|
26
|
+
}
|
|
27
|
+
if (glob.charAt(0) === "/") {
|
|
28
|
+
glob = glob.substr(1);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
base,
|
|
32
|
+
glob
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>parseObjectStyles
|
|
8
|
+
});
|
|
9
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
10
|
+
const _postcssNested = /*#__PURE__*/ _interopRequireDefault(require("postcss-nested"));
|
|
11
|
+
const _postcssJs = /*#__PURE__*/ _interopRequireDefault(require("postcss-js"));
|
|
9
12
|
function _interopRequireDefault(obj) {
|
|
10
13
|
return obj && obj.__esModule ? obj : {
|
|
11
14
|
default: obj
|
|
@@ -18,12 +21,12 @@ function parseObjectStyles(styles) {
|
|
|
18
21
|
]);
|
|
19
22
|
}
|
|
20
23
|
return styles.flatMap((style)=>{
|
|
21
|
-
return (0, _postcss
|
|
22
|
-
(0, _postcssNested
|
|
24
|
+
return (0, _postcss.default)([
|
|
25
|
+
(0, _postcssNested.default)({
|
|
23
26
|
bubble: [
|
|
24
|
-
|
|
27
|
+
"screen"
|
|
25
28
|
]
|
|
26
|
-
})
|
|
29
|
+
})
|
|
27
30
|
]).process(style, {
|
|
28
31
|
parser: _postcssJs.default
|
|
29
32
|
}).root.nodes;
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -2,32 +2,58 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
updateAllClasses: ()=>updateAllClasses,
|
|
13
|
+
filterSelectorsForClass: ()=>filterSelectorsForClass,
|
|
14
|
+
asValue: ()=>asValue,
|
|
15
|
+
parseColorFormat: ()=>parseColorFormat,
|
|
16
|
+
asColor: ()=>asColor,
|
|
17
|
+
asLookupValue: ()=>asLookupValue,
|
|
18
|
+
typeMap: ()=>typeMap,
|
|
19
|
+
coerceValue: ()=>coerceValue,
|
|
20
|
+
getMatchingTypes: ()=>getMatchingTypes
|
|
21
|
+
});
|
|
22
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
23
|
+
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
|
24
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
25
|
+
const _dataTypes = require("./dataTypes");
|
|
26
|
+
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
27
|
+
const _validateFormalSyntax = require("./validateFormalSyntax");
|
|
28
|
+
const _featureFlagsJs = require("../featureFlags.js");
|
|
15
29
|
function _interopRequireDefault(obj) {
|
|
16
30
|
return obj && obj.__esModule ? obj : {
|
|
17
31
|
default: obj
|
|
18
32
|
};
|
|
19
33
|
}
|
|
20
|
-
function updateAllClasses(
|
|
21
|
-
let parser = (0, _postcssSelectorParser
|
|
34
|
+
function updateAllClasses(selectors, updateClass) {
|
|
35
|
+
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
22
36
|
selectors.walkClasses((sel)=>{
|
|
23
37
|
let updatedClass = updateClass(sel.value);
|
|
24
38
|
sel.value = updatedClass;
|
|
25
39
|
if (sel.raws && sel.raws.value) {
|
|
26
|
-
sel.raws.value = (0, _escapeCommas
|
|
40
|
+
sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
let result = parser.processSync(selectors);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
function filterSelectorsForClass(selectors, classCandidate) {
|
|
48
|
+
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
49
|
+
selectors.each((sel)=>{
|
|
50
|
+
const containsClass = sel.nodes.some((node)=>node.type === "class" && node.value === classCandidate);
|
|
51
|
+
if (!containsClass) {
|
|
52
|
+
sel.remove();
|
|
27
53
|
}
|
|
28
54
|
});
|
|
29
55
|
});
|
|
30
|
-
let result = parser.processSync(
|
|
56
|
+
let result = parser.processSync(selectors);
|
|
31
57
|
return result;
|
|
32
58
|
}
|
|
33
59
|
function resolveArbitraryValue(modifier, validate) {
|
|
@@ -38,44 +64,51 @@ function resolveArbitraryValue(modifier, validate) {
|
|
|
38
64
|
if (!validate(value)) {
|
|
39
65
|
return undefined;
|
|
40
66
|
}
|
|
41
|
-
return (0, _dataTypes
|
|
67
|
+
return (0, _dataTypes.normalize)(value);
|
|
42
68
|
}
|
|
43
|
-
function asNegativeValue(modifier, lookup = {
|
|
44
|
-
}, validate) {
|
|
69
|
+
function asNegativeValue(modifier, lookup = {}, validate) {
|
|
45
70
|
let positiveValue = lookup[modifier];
|
|
46
71
|
if (positiveValue !== undefined) {
|
|
47
|
-
return (0, _negateValue
|
|
72
|
+
return (0, _negateValue.default)(positiveValue);
|
|
48
73
|
}
|
|
49
74
|
if (isArbitraryValue(modifier)) {
|
|
50
75
|
let resolved = resolveArbitraryValue(modifier, validate);
|
|
51
76
|
if (resolved === undefined) {
|
|
52
77
|
return undefined;
|
|
53
78
|
}
|
|
54
|
-
return (0, _negateValue
|
|
79
|
+
return (0, _negateValue.default)(resolved);
|
|
55
80
|
}
|
|
56
81
|
}
|
|
57
|
-
function asValue(modifier, options = {
|
|
58
|
-
}, { validate =()=>true
|
|
59
|
-
} = {
|
|
60
|
-
}) {
|
|
82
|
+
function asValue(modifier, options = {}, { validate =()=>true } = {}) {
|
|
61
83
|
var ref;
|
|
62
84
|
let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
63
85
|
if (value !== undefined) {
|
|
64
86
|
return value;
|
|
65
87
|
}
|
|
66
|
-
if (options.supportsNegativeValues && modifier.startsWith(
|
|
88
|
+
if (options.supportsNegativeValues && modifier.startsWith("-")) {
|
|
67
89
|
return asNegativeValue(modifier.slice(1), options.values, validate);
|
|
68
90
|
}
|
|
69
91
|
return resolveArbitraryValue(modifier, validate);
|
|
70
92
|
}
|
|
71
93
|
function isArbitraryValue(input) {
|
|
72
|
-
return input.startsWith(
|
|
94
|
+
return input.startsWith("[") && input.endsWith("]");
|
|
73
95
|
}
|
|
74
|
-
function
|
|
75
|
-
let slashIdx = modifier.lastIndexOf(
|
|
96
|
+
function splitUtilityModifier(modifier) {
|
|
97
|
+
let slashIdx = modifier.lastIndexOf("/");
|
|
76
98
|
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
|
77
99
|
return [
|
|
78
|
-
modifier
|
|
100
|
+
modifier,
|
|
101
|
+
undefined
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
let arbitrary = isArbitraryValue(modifier);
|
|
105
|
+
// The modifier could be of the form `[foo]/[bar]`
|
|
106
|
+
// We want to handle this case properly
|
|
107
|
+
// without affecting `[foo/bar]`
|
|
108
|
+
if (arbitrary && !modifier.includes("]/[")) {
|
|
109
|
+
return [
|
|
110
|
+
modifier,
|
|
111
|
+
undefined
|
|
79
112
|
];
|
|
80
113
|
}
|
|
81
114
|
return [
|
|
@@ -83,16 +116,29 @@ function splitAlpha(modifier) {
|
|
|
83
116
|
modifier.slice(slashIdx + 1)
|
|
84
117
|
];
|
|
85
118
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
119
|
+
function parseColorFormat(value) {
|
|
120
|
+
if (typeof value === "string" && value.includes("<alpha-value>")) {
|
|
121
|
+
let oldValue = value;
|
|
122
|
+
return ({ opacityValue =1 })=>oldValue.replace("<alpha-value>", opacityValue);
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
function unwrapArbitraryModifier(modifier) {
|
|
127
|
+
modifier = modifier.slice(1, -1);
|
|
128
|
+
if (modifier.startsWith("--")) {
|
|
129
|
+
modifier = `var(${modifier})`;
|
|
130
|
+
}
|
|
131
|
+
return modifier;
|
|
132
|
+
}
|
|
133
|
+
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
90
134
|
var ref;
|
|
91
135
|
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
|
|
92
136
|
var ref1;
|
|
93
|
-
return (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier];
|
|
137
|
+
return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier]);
|
|
94
138
|
}
|
|
95
|
-
|
|
139
|
+
// TODO: Hoist this up to getMatchingTypes or something
|
|
140
|
+
// We do this here because we need the alpha value (if any)
|
|
141
|
+
let [color, alpha] = splitUtilityModifier(modifier);
|
|
96
142
|
if (alpha !== undefined) {
|
|
97
143
|
var ref2, ref3, ref4;
|
|
98
144
|
var ref5;
|
|
@@ -100,20 +146,20 @@ function asColor(modifier, options = {
|
|
|
100
146
|
if (normalizedColor === undefined) {
|
|
101
147
|
return undefined;
|
|
102
148
|
}
|
|
149
|
+
normalizedColor = parseColorFormat(normalizedColor);
|
|
103
150
|
if (isArbitraryValue(alpha)) {
|
|
104
|
-
return (0, _withAlphaVariable
|
|
151
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, unwrapArbitraryModifier(alpha));
|
|
105
152
|
}
|
|
106
153
|
if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
|
|
107
154
|
return undefined;
|
|
108
155
|
}
|
|
109
|
-
return (0, _withAlphaVariable
|
|
156
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
|
110
157
|
}
|
|
111
158
|
return asValue(modifier, options, {
|
|
112
159
|
validate: _dataTypes.color
|
|
113
160
|
});
|
|
114
161
|
}
|
|
115
|
-
function asLookupValue(modifier, options = {
|
|
116
|
-
}) {
|
|
162
|
+
function asLookupValue(modifier, options = {}) {
|
|
117
163
|
var ref;
|
|
118
164
|
return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
119
165
|
}
|
|
@@ -133,13 +179,14 @@ let typeMap = {
|
|
|
133
179
|
percentage: guess(_dataTypes.percentage),
|
|
134
180
|
position: guess(_dataTypes.position),
|
|
135
181
|
lookup: asLookupValue,
|
|
136
|
-
|
|
137
|
-
|
|
182
|
+
"generic-name": guess(_dataTypes.genericName),
|
|
183
|
+
"family-name": guess(_dataTypes.familyName),
|
|
138
184
|
number: guess(_dataTypes.number),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
shadow: guess(_dataTypes.shadow)
|
|
185
|
+
"line-width": guess(_dataTypes.lineWidth),
|
|
186
|
+
"absolute-size": guess(_dataTypes.absoluteSize),
|
|
187
|
+
"relative-size": guess(_dataTypes.relativeSize),
|
|
188
|
+
shadow: guess(_dataTypes.shadow),
|
|
189
|
+
size: guess(_validateFormalSyntax.backgroundSize)
|
|
143
190
|
};
|
|
144
191
|
let supportedTypes = Object.keys(typeMap);
|
|
145
192
|
function splitAtFirst(input, delim) {
|
|
@@ -154,9 +201,24 @@ function splitAtFirst(input, delim) {
|
|
|
154
201
|
];
|
|
155
202
|
}
|
|
156
203
|
function coerceValue(types, modifier, options, tailwindConfig) {
|
|
204
|
+
if (options.values && modifier in options.values) {
|
|
205
|
+
for (let { type } of types !== null && types !== void 0 ? types : []){
|
|
206
|
+
let result = typeMap[type](modifier, options, {
|
|
207
|
+
tailwindConfig
|
|
208
|
+
});
|
|
209
|
+
if (result === undefined) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
return [
|
|
213
|
+
result,
|
|
214
|
+
type,
|
|
215
|
+
null
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
157
219
|
if (isArbitraryValue(modifier)) {
|
|
158
220
|
let arbitraryValue = modifier.slice(1, -1);
|
|
159
|
-
let [explicitType, value] = splitAtFirst(arbitraryValue,
|
|
221
|
+
let [explicitType, value] = splitAtFirst(arbitraryValue, ":");
|
|
160
222
|
// It could be that this resolves to `url(https` which is not a valid
|
|
161
223
|
// identifier. We currently only support "simple" words with dashes or
|
|
162
224
|
// underscores. E.g.: family-name
|
|
@@ -168,19 +230,54 @@ function coerceValue(types, modifier, options, tailwindConfig) {
|
|
|
168
230
|
if (value.length > 0 && supportedTypes.includes(explicitType)) {
|
|
169
231
|
return [
|
|
170
232
|
asValue(`[${value}]`, options),
|
|
171
|
-
explicitType
|
|
233
|
+
explicitType,
|
|
234
|
+
null
|
|
172
235
|
];
|
|
173
236
|
}
|
|
174
237
|
}
|
|
238
|
+
let matches = getMatchingTypes(types, modifier, options, tailwindConfig);
|
|
175
239
|
// Find first matching type
|
|
176
|
-
for (let
|
|
240
|
+
for (let match of matches){
|
|
241
|
+
return match;
|
|
242
|
+
}
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
|
|
246
|
+
let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
247
|
+
let [modifier, utilityModifier] = splitUtilityModifier(rawModifier);
|
|
248
|
+
let canUseUtilityModifier = modifiersEnabled && options.modifiers != null && (options.modifiers === "any" || typeof options.modifiers === "object" && (utilityModifier && isArbitraryValue(utilityModifier) || utilityModifier in options.modifiers));
|
|
249
|
+
if (!canUseUtilityModifier) {
|
|
250
|
+
modifier = rawModifier;
|
|
251
|
+
utilityModifier = undefined;
|
|
252
|
+
}
|
|
253
|
+
if (utilityModifier !== undefined && modifier === "") {
|
|
254
|
+
modifier = "DEFAULT";
|
|
255
|
+
}
|
|
256
|
+
// Check the full value first
|
|
257
|
+
// TODO: Move to asValue… somehow
|
|
258
|
+
if (utilityModifier !== undefined) {
|
|
259
|
+
if (typeof options.modifiers === "object") {
|
|
260
|
+
var ref;
|
|
261
|
+
var ref1;
|
|
262
|
+
let configValue = (ref1 = (ref = options.modifiers) === null || ref === void 0 ? void 0 : ref[utilityModifier]) !== null && ref1 !== void 0 ? ref1 : null;
|
|
263
|
+
if (configValue !== null) {
|
|
264
|
+
utilityModifier = configValue;
|
|
265
|
+
} else if (isArbitraryValue(utilityModifier)) {
|
|
266
|
+
utilityModifier = unwrapArbitraryModifier(utilityModifier);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
for (let { type } of types !== null && types !== void 0 ? types : []){
|
|
177
271
|
let result = typeMap[type](modifier, options, {
|
|
178
272
|
tailwindConfig
|
|
179
273
|
});
|
|
180
|
-
if (result
|
|
274
|
+
if (result === undefined) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
yield [
|
|
181
278
|
result,
|
|
182
|
-
type
|
|
279
|
+
type,
|
|
280
|
+
utilityModifier !== null && utilityModifier !== void 0 ? utilityModifier : null
|
|
183
281
|
];
|
|
184
282
|
}
|
|
185
|
-
return [];
|
|
186
283
|
}
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
8
10
|
function _interopRequireDefault(obj) {
|
|
9
11
|
return obj && obj.__esModule ? obj : {
|
|
10
12
|
default: obj
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
|
-
function _default(prefix, selector) {
|
|
14
|
-
return (0, _postcssSelectorParser
|
|
15
|
+
function _default(prefix, selector, prependNegative = false) {
|
|
16
|
+
return (0, _postcssSelectorParser.default)((selectors)=>{
|
|
15
17
|
selectors.walkClasses((classSelector)=>{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
18
|
+
let baseClass = classSelector.value;
|
|
19
|
+
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
20
|
+
classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
|
|
19
21
|
});
|
|
20
22
|
}).processSync(selector);
|
|
21
23
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function removes any uses of CSS variables used as an alpha channel
|
|
3
|
+
*
|
|
4
|
+
* This is required for selectors like `:visited` which do not allow
|
|
5
|
+
* changes in opacity or external control using CSS variables.
|
|
6
|
+
*
|
|
7
|
+
* @param {import('postcss').Container} container
|
|
8
|
+
* @param {string[]} toRemove
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "removeAlphaVariables", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: ()=>removeAlphaVariables
|
|
16
|
+
});
|
|
17
|
+
function removeAlphaVariables(container, toRemove) {
|
|
18
|
+
container.walkDecls((decl)=>{
|
|
19
|
+
if (toRemove.includes(decl.prop)) {
|
|
20
|
+
decl.remove();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (let varName of toRemove){
|
|
24
|
+
if (decl.value.includes(`/ var(${varName})`)) {
|
|
25
|
+
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|