tailwindcss 0.0.0-insiders.fe08e91 → 0.0.0-oxide.6bf5e56
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 +18 -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 +107 -611
- 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 +28 -10
- 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/{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/package.json +47 -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 +3 -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 +50 -629
- 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 +20 -1
- 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/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,17 +2,20 @@
|
|
|
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: ()=>resolveConfig
|
|
8
|
+
});
|
|
9
|
+
const _resolveConfig = /*#__PURE__*/ _interopRequireDefault(require("../util/resolveConfig"));
|
|
10
|
+
const _getAllConfigs = /*#__PURE__*/ _interopRequireDefault(require("../util/getAllConfigs"));
|
|
8
11
|
function _interopRequireDefault(obj) {
|
|
9
12
|
return obj && obj.__esModule ? obj : {
|
|
10
13
|
default: obj
|
|
11
14
|
};
|
|
12
15
|
}
|
|
13
16
|
function resolveConfig(...configs) {
|
|
14
|
-
let [, ...defaultConfigs] = (0, _getAllConfigs
|
|
15
|
-
return (0, _resolveConfig
|
|
17
|
+
let [, ...defaultConfigs] = (0, _getAllConfigs.default)(configs[0]);
|
|
18
|
+
return (0, _resolveConfig.default)([
|
|
16
19
|
...configs,
|
|
17
20
|
...defaultConfigs
|
|
18
21
|
]);
|
package/lib/util/bigSign.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>bigSign
|
|
8
|
+
});
|
|
6
9
|
function bigSign(bigIntValue) {
|
|
7
10
|
return (bigIntValue > 0n) - (bigIntValue < 0n);
|
|
8
11
|
}
|
|
@@ -2,19 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>buildMediaQuery
|
|
8
|
+
});
|
|
6
9
|
function buildMediaQuery(screens) {
|
|
7
10
|
screens = Array.isArray(screens) ? screens : [
|
|
8
11
|
screens
|
|
9
12
|
];
|
|
10
|
-
return screens.map((
|
|
13
|
+
return screens.map((screen)=>{
|
|
14
|
+
let values = screen.values.map((screen)=>{
|
|
11
15
|
if (screen.raw !== undefined) {
|
|
12
16
|
return screen.raw;
|
|
13
17
|
}
|
|
14
18
|
return [
|
|
15
19
|
screen.min && `(min-width: ${screen.min})`,
|
|
16
|
-
screen.max && `(max-width: ${screen.max})
|
|
17
|
-
].filter(Boolean).join(
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
+
screen.max && `(max-width: ${screen.max})`
|
|
21
|
+
].filter(Boolean).join(" and ");
|
|
22
|
+
});
|
|
23
|
+
return screen.not ? `not all and ${values}` : values;
|
|
24
|
+
}).join(", ");
|
|
20
25
|
}
|
package/lib/util/cloneDeep.js
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "cloneDeep", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>cloneDeep
|
|
8
|
+
});
|
|
6
9
|
function cloneDeep(value) {
|
|
7
10
|
if (Array.isArray(value)) {
|
|
8
|
-
return value.map((child)=>cloneDeep(child)
|
|
9
|
-
);
|
|
11
|
+
return value.map((child)=>cloneDeep(child));
|
|
10
12
|
}
|
|
11
|
-
if (typeof value ===
|
|
13
|
+
if (typeof value === "object" && value !== null) {
|
|
12
14
|
return Object.fromEntries(Object.entries(value).map(([k, v])=>[
|
|
13
15
|
k,
|
|
14
16
|
cloneDeep(v)
|
|
15
|
-
]
|
|
16
|
-
));
|
|
17
|
+
]));
|
|
17
18
|
}
|
|
18
19
|
return value;
|
|
19
20
|
}
|
package/lib/util/cloneNodes.js
CHANGED
|
@@ -2,12 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>cloneNodes
|
|
8
|
+
});
|
|
9
|
+
function cloneNodes(nodes, source = undefined, raws = undefined) {
|
|
7
10
|
return nodes.map((node)=>{
|
|
11
|
+
var ref;
|
|
8
12
|
let cloned = node.clone();
|
|
9
|
-
|
|
13
|
+
// We always want override the source map
|
|
14
|
+
// except when explicitly told not to
|
|
15
|
+
let shouldOverwriteSource = ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.preserveSource) !== true || !cloned.source;
|
|
16
|
+
if (source !== undefined && shouldOverwriteSource) {
|
|
10
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
|
+
};
|
|
11
29
|
}
|
|
12
30
|
return cloned;
|
|
13
31
|
});
|
package/lib/util/color.js
CHANGED
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
parseColor: ()=>parseColor,
|
|
13
|
+
formatColor: ()=>formatColor
|
|
14
|
+
});
|
|
15
|
+
const _colorName = /*#__PURE__*/ _interopRequireDefault(require("color-name"));
|
|
8
16
|
function _interopRequireDefault(obj) {
|
|
9
17
|
return obj && obj.__esModule ? obj : {
|
|
10
18
|
default: obj
|
|
@@ -12,88 +20,79 @@ function _interopRequireDefault(obj) {
|
|
|
12
20
|
}
|
|
13
21
|
let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
|
|
14
22
|
let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
15
|
-
let VALUE =
|
|
16
|
-
let SEP =
|
|
17
|
-
let ALPHA_SEP =
|
|
18
|
-
let
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
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(`^(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*\\)$`);
|
|
28
|
+
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*\\)$`);
|
|
29
|
+
function parseColor(value, { loose =false } = {}) {
|
|
30
|
+
var ref, ref1;
|
|
31
|
+
if (typeof value !== "string") {
|
|
22
32
|
return null;
|
|
23
33
|
}
|
|
24
34
|
value = value.trim();
|
|
25
|
-
if (value ===
|
|
35
|
+
if (value === "transparent") {
|
|
26
36
|
return {
|
|
27
|
-
mode:
|
|
37
|
+
mode: "rgb",
|
|
28
38
|
color: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
"0",
|
|
40
|
+
"0",
|
|
41
|
+
"0"
|
|
32
42
|
],
|
|
33
|
-
alpha:
|
|
43
|
+
alpha: "0"
|
|
34
44
|
};
|
|
35
45
|
}
|
|
36
46
|
if (value in _colorName.default) {
|
|
37
47
|
return {
|
|
38
|
-
mode:
|
|
39
|
-
color: _colorName.default[value].map((v)=>v.toString()
|
|
40
|
-
)
|
|
48
|
+
mode: "rgb",
|
|
49
|
+
color: _colorName.default[value].map((v)=>v.toString())
|
|
41
50
|
};
|
|
42
51
|
}
|
|
43
52
|
let hex = value.replace(SHORT_HEX, (_, r, g, b, a)=>[
|
|
44
|
-
|
|
53
|
+
"#",
|
|
45
54
|
r,
|
|
46
55
|
r,
|
|
47
56
|
g,
|
|
48
57
|
g,
|
|
49
58
|
b,
|
|
50
59
|
b,
|
|
51
|
-
a ? a + a :
|
|
52
|
-
].join(
|
|
53
|
-
).match(HEX);
|
|
60
|
+
a ? a + a : ""
|
|
61
|
+
].join("")).match(HEX);
|
|
54
62
|
if (hex !== null) {
|
|
55
63
|
return {
|
|
56
|
-
mode:
|
|
64
|
+
mode: "rgb",
|
|
57
65
|
color: [
|
|
58
66
|
parseInt(hex[1], 16),
|
|
59
67
|
parseInt(hex[2], 16),
|
|
60
68
|
parseInt(hex[3], 16)
|
|
61
|
-
].map((v)=>v.toString()
|
|
62
|
-
),
|
|
69
|
+
].map((v)=>v.toString()),
|
|
63
70
|
alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
|
|
64
71
|
};
|
|
65
72
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return
|
|
70
|
-
mode: 'rgb',
|
|
71
|
-
color: [
|
|
72
|
-
rgbMatch[1],
|
|
73
|
-
rgbMatch[2],
|
|
74
|
-
rgbMatch[3]
|
|
75
|
-
].map((v)=>v.toString()
|
|
76
|
-
),
|
|
77
|
-
alpha: (ref = rgbMatch[4]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
|
|
78
|
-
};
|
|
73
|
+
var ref2;
|
|
74
|
+
let match = (ref2 = value.match(RGB)) !== null && ref2 !== void 0 ? ref2 : value.match(HSL);
|
|
75
|
+
if (match === null) {
|
|
76
|
+
return null;
|
|
79
77
|
}
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
hslMatch[2],
|
|
88
|
-
hslMatch[3]
|
|
89
|
-
].map((v)=>v.toString()
|
|
90
|
-
),
|
|
91
|
-
alpha: (ref2 = hslMatch[4]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.toString) === null || ref3 === void 0 ? void 0 : ref3.call(ref2)
|
|
92
|
-
};
|
|
78
|
+
let color = [
|
|
79
|
+
match[2],
|
|
80
|
+
match[3],
|
|
81
|
+
match[4]
|
|
82
|
+
].filter(Boolean).map((v)=>v.toString());
|
|
83
|
+
if (!loose && color.length !== 3) {
|
|
84
|
+
return null;
|
|
93
85
|
}
|
|
94
|
-
|
|
86
|
+
if (color.length < 3 && !color.some((part)=>/^var\(.*?\)$/.test(part))) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
mode: match[1],
|
|
91
|
+
color,
|
|
92
|
+
alpha: (ref = match[5]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
|
|
93
|
+
};
|
|
95
94
|
}
|
|
96
95
|
function formatColor({ mode , color , alpha }) {
|
|
97
96
|
let hasAlpha = alpha !== undefined;
|
|
98
|
-
return `${mode}(${color.join(
|
|
97
|
+
return `${mode}(${color.join(" ")}${hasAlpha ? ` / ${alpha}` : ""})`;
|
|
99
98
|
}
|
|
@@ -2,7 +2,10 @@
|
|
|
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(pluginConfig, plugins) {
|
|
7
10
|
if (pluginConfig === undefined) {
|
|
8
11
|
return plugins;
|
|
@@ -12,7 +15,7 @@ function _default(pluginConfig, plugins) {
|
|
|
12
15
|
return pluginConfig !== false && pluginConfig[pluginName] !== false;
|
|
13
16
|
}).concat(Object.keys(pluginConfig).filter((pluginName)=>{
|
|
14
17
|
return pluginConfig[pluginName] !== false;
|
|
15
|
-
})))
|
|
18
|
+
})))
|
|
16
19
|
];
|
|
17
20
|
return pluginNames;
|
|
18
21
|
}
|
package/lib/util/createPlugin.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
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 createPlugin(plugin, config) {
|
|
7
10
|
return {
|
|
8
11
|
handler: plugin,
|
|
9
12
|
config
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
|
-
createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({
|
|
13
|
-
})
|
|
14
|
-
) {
|
|
15
|
+
createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {
|
|
15
16
|
const optionsFunction = function(options) {
|
|
16
17
|
return {
|
|
17
18
|
__options: options,
|
|
@@ -26,5 +27,4 @@ createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({
|
|
|
26
27
|
optionsFunction.__configFunction = configFunction;
|
|
27
28
|
return optionsFunction;
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
-
exports.default = _default;
|
|
30
|
+
const _default = createPlugin;
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>createUtilityPlugin
|
|
8
|
+
});
|
|
9
|
+
const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("./transformThemeValue"));
|
|
7
10
|
function _interopRequireDefault(obj) {
|
|
8
11
|
return obj && obj.__esModule ? obj : {
|
|
9
12
|
default: obj
|
|
@@ -16,17 +19,16 @@ function createUtilityPlugin(themeKey, utilityVariations = [
|
|
|
16
19
|
themeKey
|
|
17
20
|
]
|
|
18
21
|
]
|
|
19
|
-
], { filterDefault =false , ...options } = {
|
|
20
|
-
|
|
21
|
-
let transformValue = (0, _transformThemeValue).default(themeKey);
|
|
22
|
+
], { filterDefault =false , ...options } = {}) {
|
|
23
|
+
let transformValue = (0, _transformThemeValue.default)(themeKey);
|
|
22
24
|
return function({ matchUtilities , theme }) {
|
|
23
25
|
for (let utilityVariation of utilityVariations){
|
|
24
26
|
let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [
|
|
25
27
|
utilityVariation
|
|
26
28
|
];
|
|
27
29
|
var ref;
|
|
28
|
-
matchUtilities(group.reduce((
|
|
29
|
-
return Object.assign(
|
|
30
|
+
matchUtilities(group.reduce((obj, [classPrefix, properties])=>{
|
|
31
|
+
return Object.assign(obj, {
|
|
30
32
|
[classPrefix]: (value)=>{
|
|
31
33
|
return properties.reduce((obj, name)=>{
|
|
32
34
|
if (Array.isArray(name)) {
|
|
@@ -37,16 +39,12 @@ function createUtilityPlugin(themeKey, utilityVariations = [
|
|
|
37
39
|
return Object.assign(obj, {
|
|
38
40
|
[name]: transformValue(value)
|
|
39
41
|
});
|
|
40
|
-
}, {
|
|
41
|
-
});
|
|
42
|
+
}, {});
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
|
-
}, {
|
|
45
|
-
}), {
|
|
45
|
+
}, {}), {
|
|
46
46
|
...options,
|
|
47
|
-
values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {
|
|
48
|
-
}).filter(([modifier])=>modifier !== 'DEFAULT'
|
|
49
|
-
)) : theme(themeKey)
|
|
47
|
+
values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {}).filter(([modifier])=>modifier !== "DEFAULT")) : theme(themeKey)
|
|
50
48
|
});
|
|
51
49
|
}
|
|
52
50
|
};
|