| [9af201e] | 1 | "use strict";
|
|---|
| 2 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 3 | value: true
|
|---|
| 4 | });
|
|---|
| 5 | Object.defineProperty(exports, "default", {
|
|---|
| 6 | enumerable: true,
|
|---|
| 7 | get: function() {
|
|---|
| 8 | return transformThemeValue;
|
|---|
| 9 | }
|
|---|
| 10 | });
|
|---|
| 11 | const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|---|
| 12 | const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("./isPlainObject"));
|
|---|
| 13 | function _interop_require_default(obj) {
|
|---|
| 14 | return obj && obj.__esModule ? obj : {
|
|---|
| 15 | default: obj
|
|---|
| 16 | };
|
|---|
| 17 | }
|
|---|
| 18 | function transformThemeValue(themeSection) {
|
|---|
| 19 | if ([
|
|---|
| 20 | "fontSize",
|
|---|
| 21 | "outline"
|
|---|
| 22 | ].includes(themeSection)) {
|
|---|
| 23 | return (value)=>{
|
|---|
| 24 | if (typeof value === "function") value = value({});
|
|---|
| 25 | if (Array.isArray(value)) value = value[0];
|
|---|
| 26 | return value;
|
|---|
| 27 | };
|
|---|
| 28 | }
|
|---|
| 29 | if (themeSection === "fontFamily") {
|
|---|
| 30 | return (value)=>{
|
|---|
| 31 | if (typeof value === "function") value = value({});
|
|---|
| 32 | let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
|
|---|
| 33 | return Array.isArray(families) ? families.join(", ") : families;
|
|---|
| 34 | };
|
|---|
| 35 | }
|
|---|
| 36 | if ([
|
|---|
| 37 | "boxShadow",
|
|---|
| 38 | "transitionProperty",
|
|---|
| 39 | "transitionDuration",
|
|---|
| 40 | "transitionDelay",
|
|---|
| 41 | "transitionTimingFunction",
|
|---|
| 42 | "backgroundImage",
|
|---|
| 43 | "backgroundSize",
|
|---|
| 44 | "backgroundColor",
|
|---|
| 45 | "cursor",
|
|---|
| 46 | "animation"
|
|---|
| 47 | ].includes(themeSection)) {
|
|---|
| 48 | return (value)=>{
|
|---|
| 49 | if (typeof value === "function") value = value({});
|
|---|
| 50 | if (Array.isArray(value)) value = value.join(", ");
|
|---|
| 51 | return value;
|
|---|
| 52 | };
|
|---|
| 53 | }
|
|---|
| 54 | // For backwards compatibility reasons, before we switched to underscores
|
|---|
| 55 | // instead of commas for arbitrary values.
|
|---|
| 56 | if ([
|
|---|
| 57 | "gridTemplateColumns",
|
|---|
| 58 | "gridTemplateRows",
|
|---|
| 59 | "objectPosition"
|
|---|
| 60 | ].includes(themeSection)) {
|
|---|
| 61 | return (value)=>{
|
|---|
| 62 | if (typeof value === "function") value = value({});
|
|---|
| 63 | if (typeof value === "string") value = _postcss.default.list.comma(value).join(" ");
|
|---|
| 64 | return value;
|
|---|
| 65 | };
|
|---|
| 66 | }
|
|---|
| 67 | return (value, opts = {})=>{
|
|---|
| 68 | if (typeof value === "function") {
|
|---|
| 69 | value = value(opts);
|
|---|
| 70 | }
|
|---|
| 71 | return value;
|
|---|
| 72 | };
|
|---|
| 73 | }
|
|---|