tailwindcss 0.0.0-insiders.4e21639 → 0.0.0-insiders.4e62334
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 +435 -3
- package/LICENSE +1 -2
- package/README.md +13 -6
- package/colors.d.ts +3 -0
- package/colors.js +2 -1
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -1
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -1
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +460 -259
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +9 -3
- package/lib/corePlugins.js +1840 -1753
- package/lib/css/preflight.css +8 -9
- package/lib/featureFlags.js +29 -20
- package/lib/index.js +22 -11
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +58 -4
- package/lib/lib/defaultExtractor.js +231 -0
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +119 -52
- package/lib/lib/expandApplyAtRules.js +440 -161
- package/lib/lib/expandTailwindAtRules.js +130 -128
- package/lib/lib/generateRules.js +410 -171
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +43 -32
- package/lib/lib/offsets.js +199 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +91 -55
- package/lib/lib/setupContextUtils.js +453 -347
- package/lib/lib/setupTrackingContext.js +52 -44
- package/lib/lib/sharedState.js +48 -9
- package/lib/lib/substituteScreenAtRules.js +13 -8
- 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 +36 -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 +16 -25
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +54 -40
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -102
- package/lib/util/defaults.js +10 -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 +223 -40
- 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 +72 -0
- package/lib/util/log.js +22 -12
- package/lib/util/nameClass.js +17 -8
- package/lib/util/negateValue.js +22 -7
- package/lib/util/normalizeConfig.js +99 -54
- package/lib/util/normalizeScreens.js +73 -0
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- package/lib/util/parseDependency.js +18 -15
- package/lib/util/parseObjectStyles.js +10 -7
- package/lib/util/pluginUtils.js +51 -42
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +91 -66
- 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 +24 -3
- package/lib/util/transformThemeValue.js +37 -29
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/package.json +43 -43
- package/peers/index.js +11543 -8114
- package/plugin.d.ts +11 -0
- package/plugin.js +2 -1
- package/resolveConfig.d.ts +3 -0
- package/resolveConfig.js +2 -1
- package/scripts/generate-types.js +105 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +293 -36
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +428 -285
- package/src/css/preflight.css +8 -9
- package/src/featureFlags.js +9 -5
- package/src/index.js +14 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/defaultExtractor.js +208 -0
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +488 -153
- package/src/lib/expandTailwindAtRules.js +82 -80
- package/src/lib/generateRules.js +352 -120
- package/src/lib/normalizeTailwindDirectives.js +7 -1
- package/src/lib/offsets.js +239 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +59 -17
- package/src/lib/setupContextUtils.js +337 -174
- package/src/lib/setupTrackingContext.js +13 -8
- package/src/lib/sharedState.js +42 -4
- package/src/lib/substituteScreenAtRules.js +6 -3
- 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 +12 -2
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +31 -14
- package/src/util/dataTypes.js +28 -19
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +237 -23
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +11 -7
- package/src/util/nameClass.js +1 -1
- package/src/util/negateValue.js +10 -2
- package/src/util/normalizeConfig.js +16 -3
- package/src/util/normalizeScreens.js +45 -0
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/pluginUtils.js +14 -2
- package/src/util/prefixSelector.js +7 -5
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +71 -17
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +13 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +24 -3
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +334 -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 +331 -0
- package/types/index.d.ts +7 -0
- package/lib/lib/setupWatchingContext.js +0 -288
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -311
package/lib/lib/detectNesting.js
CHANGED
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
6
9
|
function _default(_context) {
|
|
7
10
|
return (root, result)=>{
|
|
8
11
|
let found = false;
|
|
9
|
-
root.walkAtRules(
|
|
12
|
+
root.walkAtRules("tailwind", (node)=>{
|
|
10
13
|
if (found) return false;
|
|
11
|
-
if (node.parent && node.parent.type !==
|
|
14
|
+
if (node.parent && node.parent.type !== "root") {
|
|
12
15
|
found = true;
|
|
13
16
|
node.warn(result, [
|
|
14
|
-
|
|
17
|
+
"Nested @tailwind rules were detected, but are not supported.",
|
|
15
18
|
"Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
|
|
16
|
-
|
|
17
|
-
].join(
|
|
19
|
+
"Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy",
|
|
20
|
+
].join("\n"));
|
|
18
21
|
return false;
|
|
19
22
|
}
|
|
20
23
|
});
|
|
@@ -23,10 +26,10 @@ function _default(_context) {
|
|
|
23
26
|
rule.walkRules((nestedRule)=>{
|
|
24
27
|
found = true;
|
|
25
28
|
nestedRule.warn(result, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
].join(
|
|
29
|
+
"Nested CSS was detected, but CSS nesting has not been configured correctly.",
|
|
30
|
+
"Please enable a CSS nesting plugin *before* Tailwind in your configuration.",
|
|
31
|
+
"See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting",
|
|
32
|
+
].join("\n"));
|
|
30
33
|
return false;
|
|
31
34
|
});
|
|
32
35
|
});
|
|
@@ -2,58 +2,63 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _dlv = /*#__PURE__*/ _interopRequireDefault(require("dlv"));
|
|
10
|
+
const _didyoumean = /*#__PURE__*/ _interopRequireDefault(require("didyoumean"));
|
|
11
|
+
const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("../util/transformThemeValue"));
|
|
12
|
+
const _postcssValueParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-value-parser"));
|
|
13
|
+
const _normalizeScreens = require("../util/normalizeScreens");
|
|
14
|
+
const _buildMediaQuery = /*#__PURE__*/ _interopRequireDefault(require("../util/buildMediaQuery"));
|
|
15
|
+
const _toPath = require("../util/toPath");
|
|
16
|
+
const _withAlphaVariable = require("../util/withAlphaVariable");
|
|
17
|
+
const _pluginUtils = require("../util/pluginUtils");
|
|
18
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
12
19
|
function _interopRequireDefault(obj) {
|
|
13
20
|
return obj && obj.__esModule ? obj : {
|
|
14
21
|
default: obj
|
|
15
22
|
};
|
|
16
23
|
}
|
|
17
24
|
function isObject(input) {
|
|
18
|
-
return typeof input ===
|
|
25
|
+
return typeof input === "object" && input !== null;
|
|
19
26
|
}
|
|
20
27
|
function findClosestExistingPath(theme, path) {
|
|
21
|
-
let parts = (0, _toPath
|
|
28
|
+
let parts = (0, _toPath.toPath)(path);
|
|
22
29
|
do {
|
|
23
30
|
parts.pop();
|
|
24
|
-
if ((0, _dlv
|
|
25
|
-
}while (parts.length)
|
|
31
|
+
if ((0, _dlv.default)(theme, parts) !== undefined) break;
|
|
32
|
+
}while (parts.length);
|
|
26
33
|
return parts.length ? parts : undefined;
|
|
27
34
|
}
|
|
28
35
|
function pathToString(path) {
|
|
29
|
-
if (typeof path ===
|
|
36
|
+
if (typeof path === "string") return path;
|
|
30
37
|
return path.reduce((acc, cur, i)=>{
|
|
31
|
-
if (cur.includes(
|
|
38
|
+
if (cur.includes(".")) return `${acc}[${cur}]`;
|
|
32
39
|
return i === 0 ? cur : `${acc}.${cur}`;
|
|
33
|
-
},
|
|
40
|
+
}, "");
|
|
34
41
|
}
|
|
35
42
|
function list(items) {
|
|
36
|
-
return items.map((key)=>`'${key}'`
|
|
37
|
-
).join(', ');
|
|
43
|
+
return items.map((key)=>`'${key}'`).join(", ");
|
|
38
44
|
}
|
|
39
45
|
function listKeys(obj) {
|
|
40
46
|
return list(Object.keys(obj));
|
|
41
47
|
}
|
|
42
|
-
function validatePath(config, path, defaultValue) {
|
|
43
|
-
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]
|
|
44
|
-
const pathSegments = Array.isArray(path) ? path : (0, _toPath
|
|
45
|
-
const value = (0, _dlv
|
|
48
|
+
function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
49
|
+
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g, "");
|
|
50
|
+
const pathSegments = Array.isArray(path) ? path : (0, _toPath.toPath)(pathString);
|
|
51
|
+
const value = (0, _dlv.default)(config.theme, pathSegments, defaultValue);
|
|
46
52
|
if (value === undefined) {
|
|
47
53
|
let error = `'${pathString}' does not exist in your theme config.`;
|
|
48
54
|
const parentSegments = pathSegments.slice(0, -1);
|
|
49
|
-
const parentValue = (0, _dlv
|
|
55
|
+
const parentValue = (0, _dlv.default)(config.theme, parentSegments);
|
|
50
56
|
if (isObject(parentValue)) {
|
|
51
57
|
const validKeys = Object.keys(parentValue).filter((key)=>validatePath(config, [
|
|
52
58
|
...parentSegments,
|
|
53
59
|
key
|
|
54
|
-
]).isValid
|
|
55
|
-
);
|
|
56
|
-
const suggestion = (0, _didyoumean).default(pathSegments[pathSegments.length - 1], validKeys);
|
|
60
|
+
]).isValid);
|
|
61
|
+
const suggestion = (0, _didyoumean.default)(pathSegments[pathSegments.length - 1], validKeys);
|
|
57
62
|
if (suggestion) {
|
|
58
63
|
error += ` Did you mean '${pathToString([
|
|
59
64
|
...parentSegments,
|
|
@@ -65,7 +70,7 @@ function validatePath(config, path, defaultValue) {
|
|
|
65
70
|
} else {
|
|
66
71
|
const closestPath = findClosestExistingPath(config.theme, pathString);
|
|
67
72
|
if (closestPath) {
|
|
68
|
-
const closestValue = (0, _dlv
|
|
73
|
+
const closestValue = (0, _dlv.default)(config.theme, closestPath);
|
|
69
74
|
if (isObject(closestValue)) {
|
|
70
75
|
error += ` '${pathToString(closestPath)}' has the following keys: ${listKeys(closestValue)}`;
|
|
71
76
|
} else {
|
|
@@ -80,79 +85,141 @@ function validatePath(config, path, defaultValue) {
|
|
|
80
85
|
error
|
|
81
86
|
};
|
|
82
87
|
}
|
|
83
|
-
if (!(typeof value ===
|
|
84
|
-
let
|
|
88
|
+
if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
|
|
89
|
+
let error1 = `'${pathString}' was found but does not resolve to a string.`;
|
|
85
90
|
if (isObject(value)) {
|
|
86
|
-
let
|
|
91
|
+
let validKeys1 = Object.keys(value).filter((key)=>validatePath(config, [
|
|
87
92
|
...pathSegments,
|
|
88
93
|
key
|
|
89
|
-
]).isValid
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
error += ` Did you mean something like '${pathToString([
|
|
94
|
+
]).isValid);
|
|
95
|
+
if (validKeys1.length) {
|
|
96
|
+
error1 += ` Did you mean something like '${pathToString([
|
|
93
97
|
...pathSegments,
|
|
94
|
-
|
|
98
|
+
validKeys1[0]
|
|
95
99
|
])}'?`;
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
102
|
return {
|
|
99
103
|
isValid: false,
|
|
100
|
-
error
|
|
104
|
+
error: error1
|
|
101
105
|
};
|
|
102
106
|
}
|
|
103
107
|
const [themeSection] = pathSegments;
|
|
104
108
|
return {
|
|
105
109
|
isValid: true,
|
|
106
|
-
value: (0, _transformThemeValue
|
|
110
|
+
value: (0, _transformThemeValue.default)(themeSection)(value, themeOpts)
|
|
107
111
|
};
|
|
108
112
|
}
|
|
109
113
|
function extractArgs(node, vNodes, functions) {
|
|
110
|
-
vNodes = vNodes.map((vNode)=>resolveVNode(node, vNode, functions)
|
|
111
|
-
);
|
|
114
|
+
vNodes = vNodes.map((vNode)=>resolveVNode(node, vNode, functions));
|
|
112
115
|
let args = [
|
|
113
|
-
|
|
116
|
+
""
|
|
114
117
|
];
|
|
115
|
-
for (let
|
|
116
|
-
if (
|
|
117
|
-
args.push(
|
|
118
|
+
for (let vNode of vNodes){
|
|
119
|
+
if (vNode.type === "div" && vNode.value === ",") {
|
|
120
|
+
args.push("");
|
|
118
121
|
} else {
|
|
119
|
-
args[args.length - 1] += _postcssValueParser.default.stringify(
|
|
122
|
+
args[args.length - 1] += _postcssValueParser.default.stringify(vNode);
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
return args;
|
|
123
126
|
}
|
|
124
127
|
function resolveVNode(node, vNode, functions) {
|
|
125
|
-
if (vNode.type ===
|
|
128
|
+
if (vNode.type === "function" && functions[vNode.value] !== undefined) {
|
|
126
129
|
let args = extractArgs(node, vNode.nodes, functions);
|
|
127
|
-
vNode.type =
|
|
130
|
+
vNode.type = "word";
|
|
128
131
|
vNode.value = functions[vNode.value](node, ...args);
|
|
129
132
|
}
|
|
130
133
|
return vNode;
|
|
131
134
|
}
|
|
132
135
|
function resolveFunctions(node, input, functions) {
|
|
133
|
-
return (0, _postcssValueParser
|
|
136
|
+
return (0, _postcssValueParser.default)(input).walk((vNode)=>{
|
|
134
137
|
resolveVNode(node, vNode, functions);
|
|
135
138
|
}).toString();
|
|
136
139
|
}
|
|
137
140
|
let nodeTypePropertyMap = {
|
|
138
|
-
atrule:
|
|
139
|
-
decl:
|
|
141
|
+
atrule: "params",
|
|
142
|
+
decl: "value"
|
|
140
143
|
};
|
|
141
|
-
|
|
144
|
+
/**
|
|
145
|
+
* @param {string} path
|
|
146
|
+
* @returns {Iterable<[path: string, alpha: string|undefined]>}
|
|
147
|
+
*/ function* toPaths(path) {
|
|
148
|
+
// Strip quotes from beginning and end of string
|
|
149
|
+
// This allows the alpha value to be present inside of quotes
|
|
150
|
+
path = path.replace(/^['"]+|['"]+$/g, "");
|
|
151
|
+
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
|
|
152
|
+
let alpha = undefined;
|
|
153
|
+
yield [
|
|
154
|
+
path,
|
|
155
|
+
undefined
|
|
156
|
+
];
|
|
157
|
+
if (matches) {
|
|
158
|
+
path = matches[1];
|
|
159
|
+
alpha = matches[2];
|
|
160
|
+
yield [
|
|
161
|
+
path,
|
|
162
|
+
alpha
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
*
|
|
168
|
+
* @param {any} config
|
|
169
|
+
* @param {string} path
|
|
170
|
+
* @param {any} defaultValue
|
|
171
|
+
*/ function resolvePath(config, path, defaultValue) {
|
|
172
|
+
const results = Array.from(toPaths(path)).map(([path, alpha])=>{
|
|
173
|
+
return Object.assign(validatePath(config, path, defaultValue, {
|
|
174
|
+
opacityValue: alpha
|
|
175
|
+
}), {
|
|
176
|
+
resolvedPath: path,
|
|
177
|
+
alpha
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
var ref;
|
|
181
|
+
return (ref = results.find((result)=>result.isValid)) !== null && ref !== void 0 ? ref : results[0];
|
|
182
|
+
}
|
|
183
|
+
function _default(context) {
|
|
184
|
+
let config = context.tailwindConfig;
|
|
142
185
|
let functions = {
|
|
143
186
|
theme: (node, path, ...defaultValue)=>{
|
|
144
|
-
|
|
187
|
+
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
|
145
188
|
if (!isValid) {
|
|
189
|
+
var ref;
|
|
190
|
+
let parentNode = node.parent;
|
|
191
|
+
let candidate = (ref = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || ref === void 0 ? void 0 : ref.candidate;
|
|
192
|
+
if (parentNode && candidate !== undefined) {
|
|
193
|
+
// Remove this utility from any caches
|
|
194
|
+
context.markInvalidUtilityNode(parentNode);
|
|
195
|
+
// Remove the CSS node from the markup
|
|
196
|
+
parentNode.remove();
|
|
197
|
+
// Show a warning
|
|
198
|
+
_log.default.warn("invalid-theme-key-in-class", [
|
|
199
|
+
`The utility \`${candidate}\` contains an invalid theme value and was not generated.`,
|
|
200
|
+
]);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
146
203
|
throw node.error(error);
|
|
147
204
|
}
|
|
205
|
+
let maybeColor = (0, _pluginUtils.parseColorFormat)(value);
|
|
206
|
+
let isColorFunction = maybeColor !== undefined && typeof maybeColor === "function";
|
|
207
|
+
if (alpha !== undefined || isColorFunction) {
|
|
208
|
+
if (alpha === undefined) {
|
|
209
|
+
alpha = 1.0;
|
|
210
|
+
}
|
|
211
|
+
value = (0, _withAlphaVariable.withAlphaValue)(maybeColor, alpha, maybeColor);
|
|
212
|
+
}
|
|
148
213
|
return value;
|
|
149
214
|
},
|
|
150
215
|
screen: (node, screen)=>{
|
|
151
|
-
screen = screen.replace(/^['"]+/g,
|
|
152
|
-
|
|
216
|
+
screen = screen.replace(/^['"]+/g, "").replace(/['"]+$/g, "");
|
|
217
|
+
let screens = (0, _normalizeScreens.normalizeScreens)(config.theme.screens);
|
|
218
|
+
let screenDefinition = screens.find(({ name })=>name === screen);
|
|
219
|
+
if (!screenDefinition) {
|
|
153
220
|
throw node.error(`The '${screen}' screen does not exist in your theme.`);
|
|
154
221
|
}
|
|
155
|
-
return (0, _buildMediaQuery
|
|
222
|
+
return (0, _buildMediaQuery.default)(screenDefinition);
|
|
156
223
|
}
|
|
157
224
|
};
|
|
158
225
|
return (root)=>{
|