css-in-props 3.14.0 → 3.14.1
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/README.md +1 -1
- package/dist/cjs/{props/defaults.js → defaults.js} +2 -2
- package/dist/cjs/{transform/index.js → emotion.js} +15 -5
- package/dist/cjs/index.js +21 -4
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/props/animation.js +24 -93
- package/dist/cjs/props/block.js +78 -84
- package/dist/cjs/props/font.js +8 -7
- package/dist/cjs/props/index.js +7 -38
- package/dist/cjs/props/misc.js +9 -15
- package/dist/cjs/props/position.js +17 -14
- package/dist/cjs/props/theme.js +77 -77
- package/dist/cjs/props/timing.js +11 -11
- package/dist/cjs/registry.js +39 -0
- package/dist/cjs/set.js +6 -13
- package/dist/cjs/transform.js +80 -0
- package/package.json +1 -1
- package/dist/cjs/props/flex.js +0 -44
- package/dist/cjs/props/grid.js +0 -39
- package/dist/cjs/transform/executors.js +0 -131
- package/dist/cjs/transform/transformers.js +0 -156
- package/dist/esm/index.js +0 -4
- package/dist/esm/props/animation.js +0 -106
- package/dist/esm/props/block.js +0 -159
- package/dist/esm/props/defaults.js +0 -321
- package/dist/esm/props/flex.js +0 -24
- package/dist/esm/props/font.js +0 -16
- package/dist/esm/props/grid.js +0 -19
- package/dist/esm/props/index.js +0 -34
- package/dist/esm/props/misc.js +0 -22
- package/dist/esm/props/position.js +0 -31
- package/dist/esm/props/theme.js +0 -137
- package/dist/esm/props/timing.js +0 -26
- package/dist/esm/set.js +0 -16
- package/dist/esm/transform/executors.js +0 -111
- package/dist/esm/transform/index.js +0 -2
- package/dist/esm/transform/transformers.js +0 -136
- package/dist/iife/index.js +0 -1147
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var transformers_exports = {};
|
|
20
|
-
__export(transformers_exports, {
|
|
21
|
-
applyTrueProps: () => applyTrueProps,
|
|
22
|
-
transformersByPrefix: () => transformersByPrefix
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(transformers_exports);
|
|
25
|
-
var import_utils = require("@symbo.ls/utils");
|
|
26
|
-
var import_executors = require("./executors.js");
|
|
27
|
-
const DATA_THEME_RE = /^\[data-theme=(?:"([^"]+)"|'([^']+)')\]$/;
|
|
28
|
-
const applyMediaProps = (key, selectorProps, element) => {
|
|
29
|
-
const { context } = element;
|
|
30
|
-
if (!context.designSystem?.media) return;
|
|
31
|
-
const schemeKey = key.slice(1);
|
|
32
|
-
const mediaValue = context.designSystem.media[schemeKey];
|
|
33
|
-
const generatedClass = (0, import_executors.useCssInProps)(selectorProps, element);
|
|
34
|
-
if (!mediaValue) {
|
|
35
|
-
return { [key]: generatedClass };
|
|
36
|
-
}
|
|
37
|
-
if (mediaValue === "print") {
|
|
38
|
-
return { "@media print": generatedClass };
|
|
39
|
-
}
|
|
40
|
-
if (mediaValue[0] === "(") {
|
|
41
|
-
return { [`@media screen and ${mediaValue}`]: generatedClass };
|
|
42
|
-
}
|
|
43
|
-
const match = mediaValue.match(DATA_THEME_RE);
|
|
44
|
-
const scheme = match ? match[1] || match[2] : schemeKey;
|
|
45
|
-
const result = { [`${mediaValue} &`]: generatedClass };
|
|
46
|
-
if (scheme === "dark" || scheme === "light") {
|
|
47
|
-
const scopeSelector = context.designSystem?.scopeSelector || ":root";
|
|
48
|
-
const guard = scopeSelector === ":root" ? ":root:not([data-theme])" : `${scopeSelector}:not([data-theme])`;
|
|
49
|
-
result[`@media (prefers-color-scheme: ${scheme})`] = {
|
|
50
|
-
[`${guard} &`]: generatedClass
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
};
|
|
55
|
-
const applyAndProps = (key, selectorProps, element) => {
|
|
56
|
-
return { [key]: (0, import_executors.useCssInProps)(selectorProps, element) };
|
|
57
|
-
};
|
|
58
|
-
const applySelectorProps = (key, selectorProps, element) => {
|
|
59
|
-
const selectorKey = `&${key}`;
|
|
60
|
-
const resolved = (0, import_executors.useCssInProps)(selectorProps, element);
|
|
61
|
-
if (key.includes(",") && resolved) {
|
|
62
|
-
const flat = {};
|
|
63
|
-
const nested = {};
|
|
64
|
-
for (const k in resolved) {
|
|
65
|
-
if (typeof resolved[k] === "object" && resolved[k] !== null) {
|
|
66
|
-
nested[k] = resolved[k];
|
|
67
|
-
} else {
|
|
68
|
-
flat[k] = resolved[k];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (Object.keys(nested).length) {
|
|
72
|
-
const parts = selectorKey.split(",").map((p) => p.trim());
|
|
73
|
-
const result = {};
|
|
74
|
-
if (Object.keys(flat).length) {
|
|
75
|
-
result[selectorKey] = flat;
|
|
76
|
-
}
|
|
77
|
-
for (const nestedKey in nested) {
|
|
78
|
-
const distributed = parts.map((p) => `${p} ${nestedKey}`).join(", ");
|
|
79
|
-
result[distributed] = nested[nestedKey];
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return { [selectorKey]: resolved };
|
|
85
|
-
};
|
|
86
|
-
const resolveCase = (caseKey, element) => {
|
|
87
|
-
const caseFn = element.context?.cases?.[caseKey];
|
|
88
|
-
if (caseFn === void 0) return void 0;
|
|
89
|
-
if ((0, import_utils.isFunction)(caseFn)) return caseFn.call(element, element);
|
|
90
|
-
return !!caseFn;
|
|
91
|
-
};
|
|
92
|
-
const applyCaseProps = (key, selectorProps, element) => {
|
|
93
|
-
const caseKey = key.slice(1);
|
|
94
|
-
let isCaseTrue = resolveCase(caseKey, element);
|
|
95
|
-
if (isCaseTrue === void 0) {
|
|
96
|
-
isCaseTrue = !!element[caseKey];
|
|
97
|
-
}
|
|
98
|
-
if (!isCaseTrue) return;
|
|
99
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
100
|
-
};
|
|
101
|
-
const applyVariableProps = (key, selectorVal, element) => {
|
|
102
|
-
return { [key]: selectorVal };
|
|
103
|
-
};
|
|
104
|
-
const applyConditionalCaseProps = (key, selectorProps, element) => {
|
|
105
|
-
const caseKey = key.slice(1);
|
|
106
|
-
let isCaseTrue = element[caseKey] === true || element.state?.[caseKey];
|
|
107
|
-
if (!isCaseTrue) {
|
|
108
|
-
if (typeof element[caseKey] === "function") {
|
|
109
|
-
try {
|
|
110
|
-
isCaseTrue = element[caseKey](element, element.state, element.context);
|
|
111
|
-
} catch (e) {
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
const caseResult = resolveCase(caseKey, element);
|
|
115
|
-
if (caseResult !== void 0) isCaseTrue = caseResult;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (!isCaseTrue) return;
|
|
119
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
120
|
-
};
|
|
121
|
-
const applyConditionalFalsyProps = (key, selectorProps, element) => {
|
|
122
|
-
const caseKey = key.slice(1);
|
|
123
|
-
let isCaseTrue = element[caseKey] === true || element.state?.[caseKey];
|
|
124
|
-
if (!isCaseTrue) {
|
|
125
|
-
if (typeof element[caseKey] === "function") {
|
|
126
|
-
try {
|
|
127
|
-
isCaseTrue = element[caseKey](element, element.state, element.context);
|
|
128
|
-
} catch (e) {
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
const caseResult = resolveCase(caseKey, element);
|
|
132
|
-
if (caseResult !== void 0) isCaseTrue = caseResult;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (isCaseTrue) return;
|
|
136
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
137
|
-
};
|
|
138
|
-
const applyTrueProps = (selectorProps, element) => {
|
|
139
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
140
|
-
};
|
|
141
|
-
const transformersByPrefix = {
|
|
142
|
-
"@": applyMediaProps,
|
|
143
|
-
// Selector handlers
|
|
144
|
-
":": applySelectorProps,
|
|
145
|
-
"[": applySelectorProps,
|
|
146
|
-
"*": applySelectorProps,
|
|
147
|
-
"+": applySelectorProps,
|
|
148
|
-
"~": applySelectorProps,
|
|
149
|
-
"&": applyAndProps,
|
|
150
|
-
">": applyAndProps,
|
|
151
|
-
// Conditional and variable handlers
|
|
152
|
-
$: applyCaseProps,
|
|
153
|
-
"-": applyVariableProps,
|
|
154
|
-
".": applyConditionalCaseProps,
|
|
155
|
-
"!": applyConditionalFalsyProps
|
|
156
|
-
};
|
package/dist/esm/index.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { isObject, isString } from "@symbo.ls/utils";
|
|
2
|
-
import { keyframes as cssKeyframes } from "@symbo.ls/css";
|
|
3
|
-
import { getTimingByKey, getTimingFunction } from "@symbo.ls/scratch";
|
|
4
|
-
const TIMING_FUNCTIONS = ["ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"];
|
|
5
|
-
const FILL_MODES = ["none", "forwards", "backwards", "both"];
|
|
6
|
-
const DIRECTIONS = ["normal", "reverse", "alternate", "alternate-reverse"];
|
|
7
|
-
const PLAY_STATES = ["running", "paused"];
|
|
8
|
-
const isDuration = (v) => /^[\d.]+m?s$/.test(v);
|
|
9
|
-
let _animCounter = 0;
|
|
10
|
-
const applyAnimationProps = (animation, element) => {
|
|
11
|
-
const { animation: ANIMATION } = element.context && element.context.designSystem || {};
|
|
12
|
-
if (isObject(animation)) {
|
|
13
|
-
const name = `smbls-anim-${_animCounter++}`;
|
|
14
|
-
return { animationName: cssKeyframes(name, animation) };
|
|
15
|
-
}
|
|
16
|
-
const record = ANIMATION && ANIMATION[animation];
|
|
17
|
-
if (isObject(record)) {
|
|
18
|
-
return cssKeyframes(animation, record);
|
|
19
|
-
}
|
|
20
|
-
return animation;
|
|
21
|
-
};
|
|
22
|
-
const parseAnimationShorthand = (val, el) => {
|
|
23
|
-
const { animation: ANIMATION } = el.context && el.context.designSystem || {};
|
|
24
|
-
const tokens = val.split(/\s+/);
|
|
25
|
-
let name = null;
|
|
26
|
-
const durations = [];
|
|
27
|
-
let timingFunction = null;
|
|
28
|
-
let iterationCount = null;
|
|
29
|
-
let direction = null;
|
|
30
|
-
let fillMode = null;
|
|
31
|
-
let playState = null;
|
|
32
|
-
for (const token of tokens) {
|
|
33
|
-
if (ANIMATION && ANIMATION[token]) {
|
|
34
|
-
name = token;
|
|
35
|
-
} else if (isDuration(token)) {
|
|
36
|
-
durations.push(token);
|
|
37
|
-
} else if (TIMING_FUNCTIONS.includes(token) || token.startsWith("cubic-bezier") || token.startsWith("steps(")) {
|
|
38
|
-
timingFunction = token;
|
|
39
|
-
} else if (token === "infinite" || /^\d+$/.test(token)) {
|
|
40
|
-
iterationCount = token === "infinite" ? token : Number(token);
|
|
41
|
-
} else if (DIRECTIONS.includes(token)) {
|
|
42
|
-
direction = token;
|
|
43
|
-
} else if (FILL_MODES.includes(token)) {
|
|
44
|
-
fillMode = token;
|
|
45
|
-
} else if (PLAY_STATES.includes(token)) {
|
|
46
|
-
playState = token;
|
|
47
|
-
} else if (!name) {
|
|
48
|
-
name = token;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return { name, durations, timingFunction, iterationCount, direction, fillMode, playState };
|
|
52
|
-
};
|
|
53
|
-
const ANIMATION_PROPS = {
|
|
54
|
-
animation: (val, el) => {
|
|
55
|
-
if (isString(val) && val.includes(" ")) {
|
|
56
|
-
const parsed = parseAnimationShorthand(val, el);
|
|
57
|
-
return {
|
|
58
|
-
animationName: applyAnimationProps(parsed.name || val, el),
|
|
59
|
-
animationDuration: parsed.durations[0] || getTimingByKey(el.animationDuration || "A").timing,
|
|
60
|
-
animationDelay: parsed.durations[1] || getTimingByKey(el.animationDelay || "0s").timing,
|
|
61
|
-
animationTimingFunction: parsed.timingFunction || getTimingFunction(el.animationTimingFunction || "ease"),
|
|
62
|
-
animationFillMode: parsed.fillMode || el.animationFillMode || "both",
|
|
63
|
-
animationIterationCount: parsed.iterationCount != null ? parsed.iterationCount : el.animationIterationCount || 1,
|
|
64
|
-
animationPlayState: parsed.playState || el.animationPlayState,
|
|
65
|
-
animationDirection: parsed.direction || el.animationDirection
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
animationName: applyAnimationProps(val, el),
|
|
70
|
-
animationDuration: getTimingByKey(el.animationDuration || "A").timing,
|
|
71
|
-
animationDelay: getTimingByKey(el.animationDelay || "0s").timing,
|
|
72
|
-
animationTimingFunction: getTimingFunction(el.animationTimingFunction || "ease"),
|
|
73
|
-
animationFillMode: el.animationFillMode || "both",
|
|
74
|
-
animationIterationCount: el.animationIterationCount || 1,
|
|
75
|
-
animationPlayState: el.animationPlayState,
|
|
76
|
-
animationDirection: el.animationDirection
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
animationName: (val, el) => ({
|
|
80
|
-
animationName: applyAnimationProps(val, el)
|
|
81
|
-
}),
|
|
82
|
-
animationDuration: (val) => ({
|
|
83
|
-
animationDuration: getTimingByKey(val).timing
|
|
84
|
-
}),
|
|
85
|
-
animationDelay: (val) => ({
|
|
86
|
-
animationDelay: getTimingByKey(val).timing
|
|
87
|
-
}),
|
|
88
|
-
animationTimingFunction: (val) => ({
|
|
89
|
-
animationTimingFunction: getTimingFunction(val)
|
|
90
|
-
}),
|
|
91
|
-
animationIterationCount: (val) => ({
|
|
92
|
-
animationIterationCount: val
|
|
93
|
-
}),
|
|
94
|
-
animationFillMode: (val) => ({
|
|
95
|
-
animationFillMode: val
|
|
96
|
-
}),
|
|
97
|
-
animationPlayState: (val) => ({
|
|
98
|
-
animationPlayState: val
|
|
99
|
-
}),
|
|
100
|
-
animationDirection: (val) => ({
|
|
101
|
-
animationDirection: val
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
export {
|
|
105
|
-
ANIMATION_PROPS
|
|
106
|
-
};
|
package/dist/esm/props/block.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { isUndefined, isString } from "@symbo.ls/utils";
|
|
2
|
-
import {
|
|
3
|
-
getSpacingBasedOnRatio,
|
|
4
|
-
transformSize,
|
|
5
|
-
transformBorderRadius,
|
|
6
|
-
transformSizeRatio,
|
|
7
|
-
transfromGap
|
|
8
|
-
} from "@symbo.ls/scratch";
|
|
9
|
-
const BLOCK_PROPS = {
|
|
10
|
-
show: (val) => !val ? { display: "none !important" } : void 0,
|
|
11
|
-
hide: (val) => val ? { display: "none !important" } : void 0,
|
|
12
|
-
height: (val, el) => transformSizeRatio("height", val, el),
|
|
13
|
-
width: (val, el) => transformSizeRatio("width", val, el),
|
|
14
|
-
boxSizing: (val) => !isUndefined(val) ? { boxSizing: val } : { boxSizing: "border-box" },
|
|
15
|
-
boxSize: (val) => {
|
|
16
|
-
if (!isString(val)) return;
|
|
17
|
-
const [height, width] = val.split(" ");
|
|
18
|
-
return {
|
|
19
|
-
...transformSize("height", height),
|
|
20
|
-
...transformSize("width", width || height)
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
inlineSize: (val, el) => transformSizeRatio("inlineSize", val, el),
|
|
24
|
-
blockSize: (val, el) => transformSizeRatio("blockSize", val, el),
|
|
25
|
-
minWidth: (val, el) => transformSizeRatio("minWidth", val, el),
|
|
26
|
-
maxWidth: (val, el) => transformSizeRatio("maxWidth", val, el),
|
|
27
|
-
widthRange: (val) => {
|
|
28
|
-
if (!isString(val)) return;
|
|
29
|
-
const [minWidth, maxWidth] = val.split(" ");
|
|
30
|
-
return {
|
|
31
|
-
...transformSize("minWidth", minWidth),
|
|
32
|
-
...transformSize("maxWidth", maxWidth || minWidth)
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
minHeight: (val, el) => transformSizeRatio("minHeight", val, el),
|
|
36
|
-
maxHeight: (val, el) => transformSizeRatio("maxHeight", val, el),
|
|
37
|
-
heightRange: (val) => {
|
|
38
|
-
if (!isString(val)) return;
|
|
39
|
-
const [minHeight, maxHeight] = val.split(" ");
|
|
40
|
-
return {
|
|
41
|
-
...transformSize("minHeight", minHeight),
|
|
42
|
-
...transformSize("maxHeight", maxHeight || minHeight)
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
size: (val) => {
|
|
46
|
-
if (!isString(val)) return;
|
|
47
|
-
const [inlineSize, blockSize] = val.split(" ");
|
|
48
|
-
return {
|
|
49
|
-
...transformSizeRatio("inlineSize", inlineSize),
|
|
50
|
-
...transformSizeRatio("blockSize", blockSize || inlineSize)
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
minBlockSize: (val, el) => transformSizeRatio("minBlockSize", val, el),
|
|
54
|
-
minInlineSize: (val, el) => transformSizeRatio("minInlineSize", val, el),
|
|
55
|
-
maxBlockSize: (val, el) => transformSizeRatio("maxBlockSize", val, el),
|
|
56
|
-
maxInlineSize: (val, el) => transformSizeRatio("maxInlineSize", val, el),
|
|
57
|
-
minSize: (val) => {
|
|
58
|
-
if (!isString(val)) return;
|
|
59
|
-
const [minInlineSize, minBlockSize] = val.split(" ");
|
|
60
|
-
return {
|
|
61
|
-
...transformSize("minInlineSize", minInlineSize),
|
|
62
|
-
...transformSize("minBlockSize", minBlockSize || minInlineSize)
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
maxSize: (val) => {
|
|
66
|
-
if (!isString(val)) return;
|
|
67
|
-
const [maxInlineSize, maxBlockSize] = val.split(" ");
|
|
68
|
-
return {
|
|
69
|
-
...transformSize("maxInlineSize", maxInlineSize),
|
|
70
|
-
...transformSize("maxBlockSize", maxBlockSize || maxInlineSize)
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
borderWidth: (val, el) => transformSizeRatio("borderWidth", val, el),
|
|
74
|
-
padding: (val, el) => transformSizeRatio("padding", val, el),
|
|
75
|
-
scrollPadding: (val, el) => transformSizeRatio("scrollPadding", val, el),
|
|
76
|
-
paddingInline: (val) => {
|
|
77
|
-
if (!isString(val)) return;
|
|
78
|
-
const [paddingInlineStart, paddingInlineEnd] = val.split(" ");
|
|
79
|
-
return {
|
|
80
|
-
...transformSize("paddingInlineStart", paddingInlineStart),
|
|
81
|
-
...transformSize("paddingInlineEnd", paddingInlineEnd || paddingInlineStart)
|
|
82
|
-
};
|
|
83
|
-
},
|
|
84
|
-
paddingBlock: (val) => {
|
|
85
|
-
if (!isString(val)) return;
|
|
86
|
-
const [paddingBlockStart, paddingBlockEnd] = val.split(" ");
|
|
87
|
-
return {
|
|
88
|
-
...transformSize("paddingBlockStart", paddingBlockStart),
|
|
89
|
-
...transformSize("paddingBlockEnd", paddingBlockEnd || paddingBlockStart)
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
paddingTop: (val, el) => transformSizeRatio("paddingBlockStart", val, el),
|
|
93
|
-
paddingBottom: (val, el) => transformSizeRatio("paddingBlockEnd", val, el),
|
|
94
|
-
paddingLeft: (val, el) => transformSizeRatio("paddingInlineStart", val, el),
|
|
95
|
-
paddingRight: (val, el) => transformSizeRatio("paddingInlineEnd", val, el),
|
|
96
|
-
paddingBlockStart: (val, el) => transformSizeRatio("paddingBlockStart", val, el),
|
|
97
|
-
paddingBlockEnd: (val, el) => transformSizeRatio("paddingBlockEnd", val, el),
|
|
98
|
-
paddingInlineStart: (val, el) => transformSizeRatio("paddingInlineStart", val, el),
|
|
99
|
-
paddingInlineEnd: (val, el) => transformSizeRatio("paddingInlineEnd", val, el),
|
|
100
|
-
margin: (val, el) => transformSizeRatio("margin", val, el),
|
|
101
|
-
marginInline: (val) => {
|
|
102
|
-
if (!isString(val)) return;
|
|
103
|
-
const [marginInlineStart, marginInlineEnd] = val.split(" ");
|
|
104
|
-
return {
|
|
105
|
-
...transformSize("marginInlineStart", marginInlineStart),
|
|
106
|
-
...transformSize("marginInlineEnd", marginInlineEnd || marginInlineStart)
|
|
107
|
-
};
|
|
108
|
-
},
|
|
109
|
-
marginBlock: (val, el) => {
|
|
110
|
-
if (!isString(el.marginBlock)) return;
|
|
111
|
-
const [marginBlockStart, marginBlockEnd] = el.marginBlock.split(" ");
|
|
112
|
-
return {
|
|
113
|
-
...transformSize("marginBlockStart", marginBlockStart),
|
|
114
|
-
...transformSize("marginBlockEnd", marginBlockEnd || marginBlockStart)
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
marginTop: (val, el) => transformSizeRatio("marginBlockStart", val, el),
|
|
118
|
-
marginBottom: (val, el) => transformSizeRatio("marginBlockEnd", val, el),
|
|
119
|
-
marginLeft: (val, el) => transformSizeRatio("marginInlineStart", val, el),
|
|
120
|
-
marginRight: (val, el) => transformSizeRatio("marginInlineEnd", val, el),
|
|
121
|
-
marginInlineStart: (val, el) => transformSizeRatio("marginInlineStart", val, el),
|
|
122
|
-
marginInlineEnd: (val, el) => transformSizeRatio("marginInlineEnd", val, el),
|
|
123
|
-
marginBlockStart: (val, el) => transformSizeRatio("marginBlockStart", val, el),
|
|
124
|
-
marginBlockEnd: (val, el) => transformSizeRatio("marginBlockEnd", val, el),
|
|
125
|
-
gap: (val) => ({
|
|
126
|
-
gap: transfromGap(val)
|
|
127
|
-
}),
|
|
128
|
-
columnGap: (val, el) => getSpacingBasedOnRatio(el, "columnGap", val),
|
|
129
|
-
rowGap: (val, el) => getSpacingBasedOnRatio(el, "rowGap", val),
|
|
130
|
-
flexWrap: (val) => ({
|
|
131
|
-
display: "flex",
|
|
132
|
-
flexWrap: val
|
|
133
|
-
}),
|
|
134
|
-
flexFlow: (val, el) => {
|
|
135
|
-
const reverse = el.reverse;
|
|
136
|
-
if (!isString(val)) return;
|
|
137
|
-
let [direction, wrap] = (val || "row").split(" ");
|
|
138
|
-
if (val.startsWith("x") || val === "row") direction = "row";
|
|
139
|
-
if (val.startsWith("y") || val === "column") direction = "column";
|
|
140
|
-
return {
|
|
141
|
-
display: "flex",
|
|
142
|
-
flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
flexAlign: (val) => {
|
|
146
|
-
if (!isString(val)) return;
|
|
147
|
-
const [alignItems, justifyContent] = val.split(" ");
|
|
148
|
-
return {
|
|
149
|
-
display: "flex",
|
|
150
|
-
alignItems,
|
|
151
|
-
justifyContent
|
|
152
|
-
};
|
|
153
|
-
},
|
|
154
|
-
round: (val, el) => transformBorderRadius(val ?? el.borderRadius, el, "round"),
|
|
155
|
-
borderRadius: (val, el) => transformBorderRadius(val ?? el.round, el, "borderRadius")
|
|
156
|
-
};
|
|
157
|
-
export {
|
|
158
|
-
BLOCK_PROPS
|
|
159
|
-
};
|