css-in-props 2.11.523 → 3.0.2
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/dist/cjs/{transform.js → _transform.js} +6 -9
- package/dist/cjs/index.js +7 -22
- package/dist/cjs/props/animation.js +11 -12
- package/dist/cjs/props/block.js +84 -86
- package/dist/cjs/props/flex.js +50 -0
- package/dist/cjs/props/font.js +7 -8
- package/dist/cjs/props/grid.js +39 -0
- package/dist/cjs/props/index.js +32 -0
- package/dist/cjs/props/misc.js +8 -11
- package/dist/cjs/props/position.js +14 -21
- package/dist/cjs/props/theme.js +47 -74
- package/dist/cjs/props/timing.js +11 -11
- package/dist/cjs/set.js +1 -1
- package/dist/cjs/transform/executors.js +105 -0
- package/dist/cjs/transform/index.js +18 -0
- package/dist/cjs/transform/transformers.js +85 -0
- package/package.json +6 -6
- package/src/{transform.js → _transform.js} +3 -3
- package/src/index.js +2 -11
- package/src/props/animation.js +10 -10
- package/src/props/block.js +83 -73
- package/src/props/flex.js +32 -0
- package/src/props/font.js +7 -8
- package/src/props/grid.js +21 -0
- package/src/props/index.js +27 -0
- package/src/props/misc.js +7 -8
- package/src/props/position.js +14 -17
- package/src/props/theme.js +45 -65
- package/src/props/timing.js +11 -11
- package/src/set.js +1 -1
- package/src/transform/executors.js +100 -0
- package/src/transform/index.js +3 -0
- package/src/transform/transformers.js +105 -0
- package/dist/cjs/registry.js +0 -52
- package/src/registry.js +0 -36
- /package/dist/cjs/{defaults.js → props/defaults.js} +0 -0
- /package/src/{defaults.js → props/defaults.js} +0 -0
|
@@ -24,18 +24,16 @@ __export(transform_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(transform_exports);
|
|
25
25
|
var import_utils = require("@domql/utils");
|
|
26
26
|
var import_atoms = require("@symbo.ls/atoms");
|
|
27
|
-
var
|
|
28
|
-
var import_defaults = require("./defaults");
|
|
27
|
+
var import_props = require("./props");
|
|
28
|
+
var import_defaults = require("./props/defaults");
|
|
29
29
|
const transformClassname = (element, restProps = {}) => {
|
|
30
30
|
const classCss = {};
|
|
31
31
|
const { props, class: elementClass } = element;
|
|
32
|
-
if (!(0, import_utils.isObject)(props))
|
|
33
|
-
return;
|
|
32
|
+
if (!(0, import_utils.isObject)(props)) return;
|
|
34
33
|
for (const key in props) {
|
|
35
34
|
const setter = import_atoms.keySetters[key.slice(0, 1)];
|
|
36
35
|
const hasCSS = elementClass[key];
|
|
37
|
-
if (setter)
|
|
38
|
-
setter(key, props[key], classCss, element, true);
|
|
36
|
+
if (setter) setter(key, props[key], classCss, element, true);
|
|
39
37
|
else if ((0, import_utils.isFunction)(hasCSS)) {
|
|
40
38
|
const stack = hasCSS(element, element.state, element.context);
|
|
41
39
|
const exec = (0, import_utils.isArray)(stack) ? stack.reduce((a, c) => {
|
|
@@ -44,8 +42,7 @@ const transformClassname = (element, restProps = {}) => {
|
|
|
44
42
|
(0, import_utils.deepMerge)(classCss, exec);
|
|
45
43
|
} else if (key === "style") {
|
|
46
44
|
(0, import_utils.deepMerge)(classCss, props[key]);
|
|
47
|
-
} else
|
|
48
|
-
restProps[key] = props[key];
|
|
45
|
+
} else restProps[key] = props[key];
|
|
49
46
|
}
|
|
50
47
|
return classCss;
|
|
51
48
|
};
|
|
@@ -60,7 +57,7 @@ const extractCSSfromProps = (element) => {
|
|
|
60
57
|
mediaProp(key, defProps[key], css, element, true);
|
|
61
58
|
continue;
|
|
62
59
|
}
|
|
63
|
-
const preprop =
|
|
60
|
+
const preprop = import_props.CSS_PROPS_REGISTRY[key];
|
|
64
61
|
if (preprop) {
|
|
65
62
|
const stack = preprop(element, element.state, element.context);
|
|
66
63
|
const exec = (0, import_utils.isArray)(stack) ? stack.reduce((a, c) => {
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
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
6
|
var __copyProps = (to, from, except, desc) => {
|
|
11
7
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
8
|
for (let key of __getOwnPropNames(from))
|
|
@@ -17,21 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
13
|
};
|
|
18
14
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
module.exports
|
|
25
|
-
__reExport(
|
|
26
|
-
__reExport(
|
|
27
|
-
__reExport(src_exports, require("./emotion"), module.exports);
|
|
28
|
-
__reExport(src_exports, require("./registry"), module.exports);
|
|
29
|
-
const exetuteClassPerComponent = (component, element) => {
|
|
30
|
-
const classObj = {};
|
|
31
|
-
if (component.class) {
|
|
32
|
-
for (const classProp in component.class) {
|
|
33
|
-
classObj[classProp] = component.class[classProp](element);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return classObj;
|
|
37
|
-
};
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
__reExport(index_exports, require("./transform"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./set"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./emotion"), module.exports);
|
|
21
|
+
__reExport(index_exports, require("./props"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("./props/defaults"), module.exports);
|
|
@@ -27,15 +27,14 @@ var import_scratch = require("@symbo.ls/scratch");
|
|
|
27
27
|
const applyAnimationProps = (animation, element) => {
|
|
28
28
|
const { emotion: ctxEmotion } = element.context;
|
|
29
29
|
const { keyframes } = ctxEmotion || import_emotion.emotion;
|
|
30
|
-
if ((0, import_utils.isObject)(animation))
|
|
31
|
-
return { animationName: keyframes(animation) };
|
|
30
|
+
if ((0, import_utils.isObject)(animation)) return { animationName: keyframes(animation) };
|
|
32
31
|
const { ANIMATION } = element.context && element.context.designSystem;
|
|
33
32
|
const record = ANIMATION[animation];
|
|
34
33
|
return keyframes(record);
|
|
35
34
|
};
|
|
36
35
|
const ANIMATION_PROPS = {
|
|
37
|
-
animation: (el) => ({
|
|
38
|
-
animationName: applyAnimationProps(
|
|
36
|
+
animation: (val, el) => ({
|
|
37
|
+
animationName: applyAnimationProps(val, el),
|
|
39
38
|
animationDuration: (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
|
|
40
39
|
animationDelay: (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
|
|
41
40
|
animationTimingFunction: (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
|
|
@@ -43,16 +42,16 @@ const ANIMATION_PROPS = {
|
|
|
43
42
|
animationPlayState: el.props.animationPlayState,
|
|
44
43
|
animationDirection: el.props.animationDirection
|
|
45
44
|
}),
|
|
46
|
-
animationName: (el) => ({
|
|
47
|
-
animationName: applyAnimationProps(
|
|
45
|
+
animationName: (val, el) => ({
|
|
46
|
+
animationName: applyAnimationProps(val, el)
|
|
48
47
|
}),
|
|
49
|
-
animationDuration: (
|
|
50
|
-
animationDuration:
|
|
48
|
+
animationDuration: (val) => ({
|
|
49
|
+
animationDuration: (0, import_scratch.getTimingByKey)(val).timing
|
|
51
50
|
}),
|
|
52
|
-
animationDelay: (
|
|
53
|
-
animationDelay:
|
|
51
|
+
animationDelay: (val) => ({
|
|
52
|
+
animationDelay: (0, import_scratch.getTimingByKey)(val).timing
|
|
54
53
|
}),
|
|
55
|
-
animationTimingFunction: (
|
|
56
|
-
animationTimingFunction:
|
|
54
|
+
animationTimingFunction: (val) => ({
|
|
55
|
+
animationTimingFunction: (0, import_scratch.getTimingFunction)(val)
|
|
57
56
|
})
|
|
58
57
|
};
|
package/dist/cjs/props/block.js
CHANGED
|
@@ -24,158 +24,156 @@ module.exports = __toCommonJS(block_exports);
|
|
|
24
24
|
var import_utils = require("@domql/utils");
|
|
25
25
|
var import_scratch = require("@symbo.ls/scratch");
|
|
26
26
|
const BLOCK_PROPS = {
|
|
27
|
-
show: (el, s, ctx) => !!(ctx.utils.exec(
|
|
27
|
+
show: (val, el, s, ctx) => !!(ctx.utils.exec(val, el, s) === false) && {
|
|
28
28
|
display: "none !important"
|
|
29
29
|
},
|
|
30
|
-
hide: (el, s, ctx) => !!ctx.utils.exec(
|
|
30
|
+
hide: (val, el, s, ctx) => !!ctx.utils.exec(val, el, s) && {
|
|
31
31
|
display: "none !important"
|
|
32
32
|
},
|
|
33
|
-
height: ({ props }) => (0, import_scratch.transformSizeRatio)("height", props),
|
|
34
|
-
width: ({ props }) => (0, import_scratch.transformSizeRatio)("width", props),
|
|
35
|
-
boxSizing: (
|
|
36
|
-
boxSize: (
|
|
37
|
-
if (!(0, import_utils.isString)(
|
|
38
|
-
|
|
39
|
-
const [height, width] = props.boxSize.split(" ");
|
|
33
|
+
height: (val, { props }) => (0, import_scratch.transformSizeRatio)("height", val, props),
|
|
34
|
+
width: (val, { props }) => (0, import_scratch.transformSizeRatio)("width", val, props),
|
|
35
|
+
boxSizing: (val) => !(0, import_utils.isUndefined)(val) ? { boxSizing: val } : { boxSizing: "border-box" },
|
|
36
|
+
boxSize: (val) => {
|
|
37
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
38
|
+
const [height, width] = val.split(" ");
|
|
40
39
|
return {
|
|
41
40
|
...(0, import_scratch.transformSize)("height", height),
|
|
42
41
|
...(0, import_scratch.transformSize)("width", width || height)
|
|
43
42
|
};
|
|
44
43
|
},
|
|
45
|
-
inlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("inlineSize", props),
|
|
46
|
-
blockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("blockSize", props),
|
|
47
|
-
minWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("minWidth", props),
|
|
48
|
-
maxWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("maxWidth", props),
|
|
49
|
-
widthRange: (
|
|
50
|
-
if (!(0, import_utils.isString)(
|
|
51
|
-
|
|
52
|
-
const [minWidth, maxWidth] = props.widthRange.split(" ");
|
|
44
|
+
inlineSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("inlineSize", val, props),
|
|
45
|
+
blockSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("blockSize", val, props),
|
|
46
|
+
minWidth: (val, { props }) => (0, import_scratch.transformSizeRatio)("minWidth", val, props),
|
|
47
|
+
maxWidth: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxWidth", val, props),
|
|
48
|
+
widthRange: (val) => {
|
|
49
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
50
|
+
const [minWidth, maxWidth] = val.split(" ");
|
|
53
51
|
return {
|
|
54
52
|
...(0, import_scratch.transformSize)("minWidth", minWidth),
|
|
55
53
|
...(0, import_scratch.transformSize)("maxWidth", maxWidth || minWidth)
|
|
56
54
|
};
|
|
57
55
|
},
|
|
58
|
-
minHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("minHeight", props),
|
|
59
|
-
maxHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("maxHeight", props),
|
|
60
|
-
heightRange: (
|
|
61
|
-
if (!(0, import_utils.isString)(
|
|
62
|
-
|
|
63
|
-
const [minHeight, maxHeight] = props.heightRange.split(" ");
|
|
56
|
+
minHeight: (val, { props }) => (0, import_scratch.transformSizeRatio)("minHeight", val, props),
|
|
57
|
+
maxHeight: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxHeight", val, props),
|
|
58
|
+
heightRange: (val) => {
|
|
59
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
60
|
+
const [minHeight, maxHeight] = val.split(" ");
|
|
64
61
|
return {
|
|
65
62
|
...(0, import_scratch.transformSize)("minHeight", minHeight),
|
|
66
63
|
...(0, import_scratch.transformSize)("maxHeight", maxHeight || minHeight)
|
|
67
64
|
};
|
|
68
65
|
},
|
|
69
|
-
size: (
|
|
70
|
-
if (!(0, import_utils.isString)(
|
|
71
|
-
|
|
72
|
-
const [inlineSize, blockSize] = props.size.split(" ");
|
|
66
|
+
size: (val) => {
|
|
67
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
68
|
+
const [inlineSize, blockSize] = val.split(" ");
|
|
73
69
|
return {
|
|
74
70
|
...(0, import_scratch.transformSizeRatio)("inlineSize", inlineSize),
|
|
75
71
|
...(0, import_scratch.transformSizeRatio)("blockSize", blockSize || inlineSize)
|
|
76
72
|
};
|
|
77
73
|
},
|
|
78
|
-
minBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("minBlockSize", props),
|
|
79
|
-
minInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("minInlineSize", props),
|
|
80
|
-
maxBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxBlockSize", props),
|
|
81
|
-
maxInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxInlineSize", props),
|
|
82
|
-
minSize: (
|
|
83
|
-
if (!(0, import_utils.isString)(
|
|
84
|
-
|
|
85
|
-
const [minInlineSize, minBlockSize] = props.minSize.split(" ");
|
|
74
|
+
minBlockSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("minBlockSize", val, props),
|
|
75
|
+
minInlineSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("minInlineSize", val, props),
|
|
76
|
+
maxBlockSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxBlockSize", val, props),
|
|
77
|
+
maxInlineSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxInlineSize", val, props),
|
|
78
|
+
minSize: (val) => {
|
|
79
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
80
|
+
const [minInlineSize, minBlockSize] = val.split(" ");
|
|
86
81
|
return {
|
|
87
82
|
...(0, import_scratch.transformSize)("minInlineSize", minInlineSize),
|
|
88
83
|
...(0, import_scratch.transformSize)("minBlockSize", minBlockSize || minInlineSize)
|
|
89
84
|
};
|
|
90
85
|
},
|
|
91
|
-
maxSize: (
|
|
92
|
-
if (!(0, import_utils.isString)(
|
|
93
|
-
|
|
94
|
-
const [maxInlineSize, maxBlockSize] = props.maxSize.split(" ");
|
|
86
|
+
maxSize: (val) => {
|
|
87
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
88
|
+
const [maxInlineSize, maxBlockSize] = val.split(" ");
|
|
95
89
|
return {
|
|
96
90
|
...(0, import_scratch.transformSize)("maxInlineSize", maxInlineSize),
|
|
97
91
|
...(0, import_scratch.transformSize)("maxBlockSize", maxBlockSize || maxInlineSize)
|
|
98
92
|
};
|
|
99
93
|
},
|
|
100
|
-
borderWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("borderWidth", props),
|
|
101
|
-
padding: ({ props }) => (0, import_scratch.transformSizeRatio)("padding", props),
|
|
102
|
-
scrollPadding: ({ props }) => (0, import_scratch.transformSizeRatio)("scrollPadding", props),
|
|
103
|
-
paddingInline: (
|
|
104
|
-
if (!(0, import_utils.isString)(
|
|
105
|
-
|
|
106
|
-
const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(" ");
|
|
94
|
+
borderWidth: (val, { props }) => (0, import_scratch.transformSizeRatio)("borderWidth", val, props),
|
|
95
|
+
padding: (val, { props }) => (0, import_scratch.transformSizeRatio)("padding", val, props),
|
|
96
|
+
scrollPadding: (val, { props }) => (0, import_scratch.transformSizeRatio)("scrollPadding", val, props),
|
|
97
|
+
paddingInline: (val) => {
|
|
98
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
99
|
+
const [paddingInlineStart, paddingInlineEnd] = val.split(" ");
|
|
107
100
|
return {
|
|
108
101
|
...(0, import_scratch.transformSize)("paddingInlineStart", paddingInlineStart),
|
|
109
102
|
...(0, import_scratch.transformSize)("paddingInlineEnd", paddingInlineEnd || paddingInlineStart)
|
|
110
103
|
};
|
|
111
104
|
},
|
|
112
|
-
paddingBlock: (
|
|
113
|
-
if (!(0, import_utils.isString)(
|
|
114
|
-
|
|
115
|
-
const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(" ");
|
|
105
|
+
paddingBlock: (val) => {
|
|
106
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
107
|
+
const [paddingBlockStart, paddingBlockEnd] = val.split(" ");
|
|
116
108
|
return {
|
|
117
109
|
...(0, import_scratch.transformSize)("paddingBlockStart", paddingBlockStart),
|
|
118
110
|
...(0, import_scratch.transformSize)("paddingBlockEnd", paddingBlockEnd || paddingBlockStart)
|
|
119
111
|
};
|
|
120
112
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
// Traditional directional padding
|
|
114
|
+
paddingTop: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", val, props),
|
|
115
|
+
paddingBottom: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", val, props),
|
|
116
|
+
paddingLeft: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", val, props),
|
|
117
|
+
paddingRight: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", val, props),
|
|
118
|
+
// Logical properties (for reference)
|
|
119
|
+
paddingBlockStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", val, props),
|
|
120
|
+
// maps to top
|
|
121
|
+
paddingBlockEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", val, props),
|
|
122
|
+
// maps to bottom
|
|
123
|
+
paddingInlineStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", val, props),
|
|
124
|
+
// maps to left
|
|
125
|
+
paddingInlineEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", val, props),
|
|
126
|
+
// maps to right
|
|
127
|
+
margin: (val, { props }) => (0, import_scratch.transformSizeRatio)("margin", val, props),
|
|
128
|
+
marginInline: (val) => {
|
|
129
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
130
|
+
const [marginInlineStart, marginInlineEnd] = val.split(" ");
|
|
130
131
|
return {
|
|
131
132
|
...(0, import_scratch.transformSize)("marginInlineStart", marginInlineStart),
|
|
132
133
|
...(0, import_scratch.transformSize)("marginInlineEnd", marginInlineEnd || marginInlineStart)
|
|
133
134
|
};
|
|
134
135
|
},
|
|
135
|
-
marginBlock: ({ props }) => {
|
|
136
|
-
if (!(0, import_utils.isString)(props.marginBlock))
|
|
137
|
-
return;
|
|
136
|
+
marginBlock: (val, { props }) => {
|
|
137
|
+
if (!(0, import_utils.isString)(props.marginBlock)) return;
|
|
138
138
|
const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(" ");
|
|
139
139
|
return {
|
|
140
140
|
...(0, import_scratch.transformSize)("marginBlockStart", marginBlockStart),
|
|
141
141
|
...(0, import_scratch.transformSize)("marginBlockEnd", marginBlockEnd || marginBlockStart)
|
|
142
142
|
};
|
|
143
143
|
},
|
|
144
|
-
marginInlineStart: ({ props }) => (0, import_scratch.transformSizeRatio)("marginInlineStart", props),
|
|
145
|
-
marginInlineEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", props),
|
|
146
|
-
marginBlockStart: ({ props }) => (0, import_scratch.transformSizeRatio)("marginBlockStart", props),
|
|
147
|
-
marginBlockEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", props),
|
|
148
|
-
gap: (
|
|
149
|
-
gap: (0, import_scratch.transfromGap)(
|
|
144
|
+
marginInlineStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginInlineStart", val, props),
|
|
145
|
+
marginInlineEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", val, props),
|
|
146
|
+
marginBlockStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginBlockStart", val, props),
|
|
147
|
+
marginBlockEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", val, props),
|
|
148
|
+
gap: (val) => ({
|
|
149
|
+
gap: (0, import_scratch.transfromGap)(val)
|
|
150
150
|
}),
|
|
151
|
-
columnGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "columnGap"),
|
|
152
|
-
rowGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "rowGap"),
|
|
153
|
-
flexWrap: ({ props }) => ({
|
|
151
|
+
columnGap: (val, { props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "columnGap", val),
|
|
152
|
+
rowGap: (val, { props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "rowGap", val),
|
|
153
|
+
flexWrap: (val, { props }) => ({
|
|
154
154
|
display: "flex",
|
|
155
|
-
flexFlow: (
|
|
155
|
+
flexFlow: (val || "row").split(" ")[0] + " " + props.flexWrap
|
|
156
156
|
}),
|
|
157
|
-
flexFlow: ({ props }) => {
|
|
158
|
-
const {
|
|
159
|
-
if (!(0, import_utils.isString)(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (
|
|
163
|
-
direction = "row";
|
|
164
|
-
if (flexFlow.startsWith("y") || flexFlow === "column")
|
|
165
|
-
direction = "column";
|
|
157
|
+
flexFlow: (val, { props }) => {
|
|
158
|
+
const { reverse } = props;
|
|
159
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
160
|
+
let [direction, wrap] = (val || "row").split(" ");
|
|
161
|
+
if (val.startsWith("x") || val === "row") direction = "row";
|
|
162
|
+
if (val.startsWith("y") || val === "column") direction = "column";
|
|
166
163
|
return {
|
|
167
164
|
display: "flex",
|
|
168
165
|
flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
|
|
169
166
|
};
|
|
170
167
|
},
|
|
171
|
-
flexAlign: (
|
|
172
|
-
if (!(0, import_utils.isString)(
|
|
173
|
-
|
|
174
|
-
const [alignItems, justifyContent] = props.flexAlign.split(" ");
|
|
168
|
+
flexAlign: (val) => {
|
|
169
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
170
|
+
const [alignItems, justifyContent] = val.split(" ");
|
|
175
171
|
return {
|
|
176
172
|
display: "flex",
|
|
177
173
|
alignItems,
|
|
178
174
|
justifyContent
|
|
179
175
|
};
|
|
180
|
-
}
|
|
176
|
+
},
|
|
177
|
+
round: (val, { props }) => (0, import_scratch.transformBorderRadius)(val || props.borderRadius, props, "round"),
|
|
178
|
+
borderRadius: (val, { props }) => (0, import_scratch.transformBorderRadius)(val || props.round, props, "borderRadius")
|
|
181
179
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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 flex_exports = {};
|
|
20
|
+
__export(flex_exports, {
|
|
21
|
+
FLEX_PROPS: () => FLEX_PROPS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(flex_exports);
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
|
+
const FLEX_PROPS = {
|
|
26
|
+
flow: (value, el) => {
|
|
27
|
+
const { props } = el;
|
|
28
|
+
const DISPLAY_FLEX_ALLOWED = ["flex", "inline-flex"];
|
|
29
|
+
if (!DISPLAY_FLEX_ALLOWED.includes(props.display)) return;
|
|
30
|
+
const { reverse } = props;
|
|
31
|
+
if (!(0, import_utils.isString)(value)) return;
|
|
32
|
+
let [direction, wrap] = (value || "row").split(" ");
|
|
33
|
+
if (value.startsWith("x") || value === "row") direction = "row";
|
|
34
|
+
if (value.startsWith("y") || value === "column") direction = "column";
|
|
35
|
+
return {
|
|
36
|
+
flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
wrap: (value, { props }) => {
|
|
40
|
+
const DISPLAY_FLEX_ALLOWED = ["flex", "inline-flex"];
|
|
41
|
+
if (!DISPLAY_FLEX_ALLOWED.includes(props.display)) return;
|
|
42
|
+
return { flexWrap: value };
|
|
43
|
+
},
|
|
44
|
+
align: (value, { props }) => {
|
|
45
|
+
const DISPLAY_FLEX_ALLOWED = ["flex", "inline-flex"];
|
|
46
|
+
if (!DISPLAY_FLEX_ALLOWED.includes(props.display)) return;
|
|
47
|
+
const [alignItems, justifyContent] = value.split(" ");
|
|
48
|
+
return { alignItems, justifyContent };
|
|
49
|
+
}
|
|
50
|
+
};
|
package/dist/cjs/props/font.js
CHANGED
|
@@ -23,15 +23,14 @@ __export(font_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(font_exports);
|
|
24
24
|
var import_scratch = require("@symbo.ls/scratch");
|
|
25
25
|
const FONT_PROPS = {
|
|
26
|
-
fontSize: (
|
|
27
|
-
|
|
28
|
-
return props.fontSize ? (0, import_scratch.getFontSizeByKey)(props.fontSize) : null;
|
|
26
|
+
fontSize: (value) => {
|
|
27
|
+
return (0, import_scratch.getFontSizeByKey)(value) || value;
|
|
29
28
|
},
|
|
30
|
-
fontFamily: (
|
|
31
|
-
fontFamily: (0, import_scratch.getFontFamily)(
|
|
29
|
+
fontFamily: (value) => ({
|
|
30
|
+
fontFamily: (0, import_scratch.getFontFamily)(value) || value
|
|
32
31
|
}),
|
|
33
|
-
fontWeight: (
|
|
34
|
-
fontWeight:
|
|
35
|
-
fontVariationSettings: '"wght" ' +
|
|
32
|
+
fontWeight: (value) => ({
|
|
33
|
+
fontWeight: value,
|
|
34
|
+
fontVariationSettings: '"wght" ' + value
|
|
36
35
|
})
|
|
37
36
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 grid_exports = {};
|
|
20
|
+
__export(grid_exports, {
|
|
21
|
+
GRID_PROPS: () => GRID_PROPS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(grid_exports);
|
|
24
|
+
const GRID_PROPS = {
|
|
25
|
+
area: (value) => ({ gridArea: value }),
|
|
26
|
+
template: (value) => ({ gridTemplate: value }),
|
|
27
|
+
templateAreas: (value) => ({ gridTemplateAreas: value }),
|
|
28
|
+
column: (value) => ({ gridColumn: value }),
|
|
29
|
+
columns: (value) => ({ gridTemplateColumns: value }),
|
|
30
|
+
templateColumns: (value) => ({ gridTemplateColumns: value }),
|
|
31
|
+
autoColumns: (value) => ({ gridAutoColumns: value }),
|
|
32
|
+
columnStart: (value) => ({ gridColumnStart: value }),
|
|
33
|
+
row: (value) => ({ gridRow: value }),
|
|
34
|
+
rows: (value) => ({ gridTemplateRows: value }),
|
|
35
|
+
templateRows: (value) => ({ gridTemplateRows: value }),
|
|
36
|
+
autoRows: (value) => ({ gridAutoRows: value }),
|
|
37
|
+
rowStart: (value) => ({ gridRowStart: value }),
|
|
38
|
+
autoFlow: (value) => ({ gridAutoFlow: value })
|
|
39
|
+
};
|
package/dist/cjs/props/index.js
CHANGED
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
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
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -14,7 +18,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
18
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
20
|
var props_exports = {};
|
|
21
|
+
__export(props_exports, {
|
|
22
|
+
CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY,
|
|
23
|
+
default: () => props_default
|
|
24
|
+
});
|
|
17
25
|
module.exports = __toCommonJS(props_exports);
|
|
26
|
+
var import_animation = require("./animation");
|
|
27
|
+
var import_block = require("./block");
|
|
28
|
+
var import_font = require("./font");
|
|
29
|
+
var import_misc = require("./misc");
|
|
30
|
+
var import_position = require("./position");
|
|
31
|
+
var import_theme = require("./theme");
|
|
32
|
+
var import_timing = require("./timing");
|
|
33
|
+
var import_flex = require("./flex");
|
|
34
|
+
var import_grid = require("./grid");
|
|
18
35
|
__reExport(props_exports, require("./animation"), module.exports);
|
|
19
36
|
__reExport(props_exports, require("./block"), module.exports);
|
|
20
37
|
__reExport(props_exports, require("./font"), module.exports);
|
|
@@ -22,3 +39,18 @@ __reExport(props_exports, require("./misc"), module.exports);
|
|
|
22
39
|
__reExport(props_exports, require("./position"), module.exports);
|
|
23
40
|
__reExport(props_exports, require("./theme"), module.exports);
|
|
24
41
|
__reExport(props_exports, require("./timing"), module.exports);
|
|
42
|
+
__reExport(props_exports, require("./flex"), module.exports);
|
|
43
|
+
__reExport(props_exports, require("./grid"), module.exports);
|
|
44
|
+
const CSS_PROPS_REGISTRY = {
|
|
45
|
+
...import_animation.ANIMATION_PROPS,
|
|
46
|
+
...import_block.BLOCK_PROPS,
|
|
47
|
+
...import_font.FONT_PROPS,
|
|
48
|
+
...import_misc.MISC_PROPS,
|
|
49
|
+
...import_misc.MISC_PROPS,
|
|
50
|
+
...import_position.POSITION_PROPS,
|
|
51
|
+
...import_theme.THEME_PROPS,
|
|
52
|
+
...import_timing.TIMING_PROPS,
|
|
53
|
+
...import_flex.FLEX_PROPS,
|
|
54
|
+
...import_grid.GRID_PROPS
|
|
55
|
+
};
|
|
56
|
+
var props_default = CSS_PROPS_REGISTRY;
|
package/dist/cjs/props/misc.js
CHANGED
|
@@ -22,17 +22,14 @@ __export(misc_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(misc_exports);
|
|
24
24
|
const MISC_PROPS = {
|
|
25
|
-
overflow: (
|
|
26
|
-
overflow:
|
|
25
|
+
overflow: (value) => ({
|
|
26
|
+
overflow: value,
|
|
27
27
|
scrollBehavior: "smooth"
|
|
28
|
-
},
|
|
29
|
-
cursor: (el, s, ctx) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (file && file.content)
|
|
35
|
-
val = `url(${file.content.src})`;
|
|
36
|
-
return { cursor: val };
|
|
28
|
+
}),
|
|
29
|
+
cursor: (value, el, s, ctx) => {
|
|
30
|
+
if (!value) return;
|
|
31
|
+
const file = ctx.files && ctx.files[value];
|
|
32
|
+
if (file && file.content) value = `url(${file.content.src})`;
|
|
33
|
+
return { cursor: value };
|
|
37
34
|
}
|
|
38
35
|
};
|
|
@@ -23,33 +23,26 @@ __export(position_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(position_exports);
|
|
24
24
|
var import_scratch = require("@symbo.ls/scratch");
|
|
25
25
|
const POSITION_PROPS = {
|
|
26
|
-
inset: (
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
if (!context.utils.isString(inset))
|
|
31
|
-
return;
|
|
32
|
-
return { inset: inset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k).join(" ") };
|
|
26
|
+
inset: (val, el) => {
|
|
27
|
+
if (el.call("isNumber", val)) return { inset: val };
|
|
28
|
+
if (!el.call("isString", val)) return;
|
|
29
|
+
return { inset: val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k).join(" ") };
|
|
33
30
|
},
|
|
34
|
-
left: (
|
|
35
|
-
top: (
|
|
36
|
-
right: (
|
|
37
|
-
bottom: (
|
|
38
|
-
verticalInset: (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return;
|
|
42
|
-
const vi = verticalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
31
|
+
left: (val) => (0, import_scratch.getSpacingByKey)(val, "left"),
|
|
32
|
+
top: (val) => (0, import_scratch.getSpacingByKey)(val, "top"),
|
|
33
|
+
right: (val) => (0, import_scratch.getSpacingByKey)(val, "right"),
|
|
34
|
+
bottom: (val) => (0, import_scratch.getSpacingByKey)(val, "bottom"),
|
|
35
|
+
verticalInset: (val) => {
|
|
36
|
+
if (typeof val !== "string") return;
|
|
37
|
+
const vi = val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
43
38
|
return {
|
|
44
39
|
top: vi[0],
|
|
45
40
|
bottom: vi[1] || vi[0]
|
|
46
41
|
};
|
|
47
42
|
},
|
|
48
|
-
horizontalInset: (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
const vi = horizontalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
43
|
+
horizontalInset: (val) => {
|
|
44
|
+
if (typeof val !== "string") return;
|
|
45
|
+
const vi = val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
53
46
|
return {
|
|
54
47
|
left: vi[0],
|
|
55
48
|
right: vi[1] || vi[0]
|