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
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ import { transformersByPrefix } from 'css-in-props'
|
|
|
71
71
|
|
|
72
72
|
The `$` prefix is used both by css-in-props (`$isActive` case conditional) and by the define system (e.g. `$router`). The framework resolves this by checking for define handlers before applying prefix rules. Keys with matching define handlers stay at the element root; only `$`-prefixed keys without define handlers are processed by css-in-props.
|
|
73
73
|
|
|
74
|
-
> In
|
|
74
|
+
> In v3.14, properties go directly on the element (no `props:` wrapper). The CSS engine processes design token properties internally.
|
|
75
75
|
|
|
76
76
|
## Global Cases
|
|
77
77
|
|
|
@@ -20,7 +20,7 @@ __export(defaults_exports, {
|
|
|
20
20
|
DEFAULT_CSS_PROPERTIES_LIST: () => DEFAULT_CSS_PROPERTIES_LIST
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(defaults_exports);
|
|
23
|
-
const DEFAULT_CSS_PROPERTIES_LIST =
|
|
23
|
+
const DEFAULT_CSS_PROPERTIES_LIST = [
|
|
24
24
|
"accentColor",
|
|
25
25
|
"alignContent",
|
|
26
26
|
"alignItems",
|
|
@@ -337,4 +337,4 @@ const DEFAULT_CSS_PROPERTIES_LIST = /* @__PURE__ */ new Set([
|
|
|
337
337
|
"wordWrap",
|
|
338
338
|
"writingMode",
|
|
339
339
|
"zIndex"
|
|
340
|
-
]
|
|
340
|
+
];
|
|
@@ -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))
|
|
@@ -11,9 +15,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
15
|
}
|
|
12
16
|
return to;
|
|
13
17
|
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
var emotion_exports = {};
|
|
20
|
+
__export(emotion_exports, {
|
|
21
|
+
transformEmotion: () => transformEmotion
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(emotion_exports);
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
|
+
var import_emotion = require("@symbo.ls/emotion");
|
|
26
|
+
const { css } = import_emotion.emotion;
|
|
27
|
+
const transformEmotion = (props, callback) => {
|
|
28
|
+
return (0, import_utils.isFunction)(callback) ? callback(props) : css(props);
|
|
29
|
+
};
|
package/dist/cjs/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,8 +18,21 @@ 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 index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
exetuteClassPerComponent: () => exetuteClassPerComponent
|
|
23
|
+
});
|
|
17
24
|
module.exports = __toCommonJS(index_exports);
|
|
18
|
-
__reExport(index_exports, require("./transform
|
|
19
|
-
__reExport(index_exports, require("./set
|
|
20
|
-
__reExport(index_exports, require("./
|
|
21
|
-
__reExport(index_exports, require("./
|
|
25
|
+
__reExport(index_exports, require("./transform"), module.exports);
|
|
26
|
+
__reExport(index_exports, require("./set"), module.exports);
|
|
27
|
+
__reExport(index_exports, require("./emotion"), module.exports);
|
|
28
|
+
__reExport(index_exports, require("./registry"), module.exports);
|
|
29
|
+
__reExport(index_exports, require("./defaults"), module.exports);
|
|
30
|
+
const exetuteClassPerComponent = (component, element) => {
|
|
31
|
+
const classObj = {};
|
|
32
|
+
if (component.class) {
|
|
33
|
+
for (const classProp in component.class) {
|
|
34
|
+
classObj[classProp] = component.class[classProp](element);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return classObj;
|
|
38
|
+
};
|
|
@@ -21,106 +21,37 @@ __export(animation_exports, {
|
|
|
21
21
|
ANIMATION_PROPS: () => ANIMATION_PROPS
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(animation_exports);
|
|
24
|
-
var import_utils = require("@
|
|
25
|
-
var
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
|
+
var import_emotion = require("@symbo.ls/emotion");
|
|
26
26
|
var import_scratch = require("@symbo.ls/scratch");
|
|
27
|
-
const TIMING_FUNCTIONS = ["ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"];
|
|
28
|
-
const FILL_MODES = ["none", "forwards", "backwards", "both"];
|
|
29
|
-
const DIRECTIONS = ["normal", "reverse", "alternate", "alternate-reverse"];
|
|
30
|
-
const PLAY_STATES = ["running", "paused"];
|
|
31
|
-
const isDuration = (v) => /^[\d.]+m?s$/.test(v);
|
|
32
|
-
let _animCounter = 0;
|
|
33
27
|
const applyAnimationProps = (animation, element) => {
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if ((0, import_utils.isObject)(record)) {
|
|
41
|
-
return (0, import_css.keyframes)(animation, record);
|
|
42
|
-
}
|
|
43
|
-
return animation;
|
|
44
|
-
};
|
|
45
|
-
const parseAnimationShorthand = (val, el) => {
|
|
46
|
-
const { animation: ANIMATION } = el.context && el.context.designSystem || {};
|
|
47
|
-
const tokens = val.split(/\s+/);
|
|
48
|
-
let name = null;
|
|
49
|
-
const durations = [];
|
|
50
|
-
let timingFunction = null;
|
|
51
|
-
let iterationCount = null;
|
|
52
|
-
let direction = null;
|
|
53
|
-
let fillMode = null;
|
|
54
|
-
let playState = null;
|
|
55
|
-
for (const token of tokens) {
|
|
56
|
-
if (ANIMATION && ANIMATION[token]) {
|
|
57
|
-
name = token;
|
|
58
|
-
} else if (isDuration(token)) {
|
|
59
|
-
durations.push(token);
|
|
60
|
-
} else if (TIMING_FUNCTIONS.includes(token) || token.startsWith("cubic-bezier") || token.startsWith("steps(")) {
|
|
61
|
-
timingFunction = token;
|
|
62
|
-
} else if (token === "infinite" || /^\d+$/.test(token)) {
|
|
63
|
-
iterationCount = token === "infinite" ? token : Number(token);
|
|
64
|
-
} else if (DIRECTIONS.includes(token)) {
|
|
65
|
-
direction = token;
|
|
66
|
-
} else if (FILL_MODES.includes(token)) {
|
|
67
|
-
fillMode = token;
|
|
68
|
-
} else if (PLAY_STATES.includes(token)) {
|
|
69
|
-
playState = token;
|
|
70
|
-
} else if (!name) {
|
|
71
|
-
name = token;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return { name, durations, timingFunction, iterationCount, direction, fillMode, playState };
|
|
28
|
+
const { emotion: ctxEmotion } = element.context;
|
|
29
|
+
const { keyframes } = ctxEmotion || import_emotion.emotion;
|
|
30
|
+
if ((0, import_utils.isObject)(animation)) return { animationName: keyframes(animation) };
|
|
31
|
+
const { ANIMATION } = element.context && element.context.designSystem;
|
|
32
|
+
const record = ANIMATION[animation];
|
|
33
|
+
return keyframes(record);
|
|
75
34
|
};
|
|
76
35
|
const ANIMATION_PROPS = {
|
|
77
|
-
animation: (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
animationFillMode: parsed.fillMode || el.animationFillMode || "both",
|
|
86
|
-
animationIterationCount: parsed.iterationCount != null ? parsed.iterationCount : el.animationIterationCount || 1,
|
|
87
|
-
animationPlayState: parsed.playState || el.animationPlayState,
|
|
88
|
-
animationDirection: parsed.direction || el.animationDirection
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
animationName: applyAnimationProps(val, el),
|
|
93
|
-
animationDuration: (0, import_scratch.getTimingByKey)(el.animationDuration || "A").timing,
|
|
94
|
-
animationDelay: (0, import_scratch.getTimingByKey)(el.animationDelay || "0s").timing,
|
|
95
|
-
animationTimingFunction: (0, import_scratch.getTimingFunction)(el.animationTimingFunction || "ease"),
|
|
96
|
-
animationFillMode: el.animationFillMode || "both",
|
|
97
|
-
animationIterationCount: el.animationIterationCount || 1,
|
|
98
|
-
animationPlayState: el.animationPlayState,
|
|
99
|
-
animationDirection: el.animationDirection
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
animationName: (val, el) => ({
|
|
103
|
-
animationName: applyAnimationProps(val, el)
|
|
104
|
-
}),
|
|
105
|
-
animationDuration: (val) => ({
|
|
106
|
-
animationDuration: (0, import_scratch.getTimingByKey)(val).timing
|
|
107
|
-
}),
|
|
108
|
-
animationDelay: (val) => ({
|
|
109
|
-
animationDelay: (0, import_scratch.getTimingByKey)(val).timing
|
|
110
|
-
}),
|
|
111
|
-
animationTimingFunction: (val) => ({
|
|
112
|
-
animationTimingFunction: (0, import_scratch.getTimingFunction)(val)
|
|
36
|
+
animation: (el) => ({
|
|
37
|
+
animationName: applyAnimationProps(el.props.animation, el),
|
|
38
|
+
animationDuration: (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
|
|
39
|
+
animationDelay: (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
|
|
40
|
+
animationTimingFunction: (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
|
|
41
|
+
animationFillMode: el.props.animationFillMode || "both",
|
|
42
|
+
animationPlayState: el.props.animationPlayState,
|
|
43
|
+
animationDirection: el.props.animationDirection
|
|
113
44
|
}),
|
|
114
|
-
|
|
115
|
-
|
|
45
|
+
animationName: (el) => ({
|
|
46
|
+
animationName: applyAnimationProps(el.props.animationName, el)
|
|
116
47
|
}),
|
|
117
|
-
|
|
118
|
-
|
|
48
|
+
animationDuration: ({ props, deps }) => ({
|
|
49
|
+
animationDuration: deps.getTimingByKey(props.animationDuration).timing
|
|
119
50
|
}),
|
|
120
|
-
|
|
121
|
-
|
|
51
|
+
animationDelay: ({ props, deps }) => ({
|
|
52
|
+
animationDelay: deps.getTimingByKey(props.animationDelay).timing
|
|
122
53
|
}),
|
|
123
|
-
|
|
124
|
-
|
|
54
|
+
animationTimingFunction: ({ props, deps }) => ({
|
|
55
|
+
animationTimingFunction: deps.getTimingFunction(props.animationTimingFunction)
|
|
125
56
|
})
|
|
126
57
|
};
|
package/dist/cjs/props/block.js
CHANGED
|
@@ -21,153 +21,147 @@ __export(block_exports, {
|
|
|
21
21
|
BLOCK_PROPS: () => BLOCK_PROPS
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(block_exports);
|
|
24
|
-
var import_utils = require("@
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
25
|
var import_scratch = require("@symbo.ls/scratch");
|
|
26
26
|
const BLOCK_PROPS = {
|
|
27
|
-
show: (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
show: (el, s, ctx) => !!(ctx.utils.exec(el.props.show, el, s) === false) && {
|
|
28
|
+
display: "none !important"
|
|
29
|
+
},
|
|
30
|
+
hide: (el, s, ctx) => !!ctx.utils.exec(el.props.hide, el, s) && {
|
|
31
|
+
display: "none !important"
|
|
32
|
+
},
|
|
33
|
+
height: ({ props }) => (0, import_scratch.transformSizeRatio)("height", props),
|
|
34
|
+
width: ({ props }) => (0, import_scratch.transformSizeRatio)("width", props),
|
|
35
|
+
boxSizing: ({ props }) => !(0, import_utils.isUndefined)(props.boxSizing) ? { boxSizing: props.boxSizing } : { boxSizing: "border-box" },
|
|
36
|
+
boxSize: ({ props }) => {
|
|
37
|
+
if (!(0, import_utils.isString)(props.boxSize)) return;
|
|
38
|
+
const [height, width] = props.boxSize.split(" ");
|
|
35
39
|
return {
|
|
36
40
|
...(0, import_scratch.transformSize)("height", height),
|
|
37
41
|
...(0, import_scratch.transformSize)("width", width || height)
|
|
38
42
|
};
|
|
39
43
|
},
|
|
40
|
-
inlineSize: (
|
|
41
|
-
blockSize: (
|
|
42
|
-
minWidth: (
|
|
43
|
-
maxWidth: (
|
|
44
|
-
widthRange: (
|
|
45
|
-
if (!(0, import_utils.isString)(
|
|
46
|
-
const [minWidth, maxWidth] =
|
|
44
|
+
inlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("inlineSize", props),
|
|
45
|
+
blockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("blockSize", props),
|
|
46
|
+
minWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("minWidth", props),
|
|
47
|
+
maxWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("maxWidth", props),
|
|
48
|
+
widthRange: ({ props }) => {
|
|
49
|
+
if (!(0, import_utils.isString)(props.widthRange)) return;
|
|
50
|
+
const [minWidth, maxWidth] = props.widthRange.split(" ");
|
|
47
51
|
return {
|
|
48
52
|
...(0, import_scratch.transformSize)("minWidth", minWidth),
|
|
49
53
|
...(0, import_scratch.transformSize)("maxWidth", maxWidth || minWidth)
|
|
50
54
|
};
|
|
51
55
|
},
|
|
52
|
-
minHeight: (
|
|
53
|
-
maxHeight: (
|
|
54
|
-
heightRange: (
|
|
55
|
-
if (!(0, import_utils.isString)(
|
|
56
|
-
const [minHeight, maxHeight] =
|
|
56
|
+
minHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("minHeight", props),
|
|
57
|
+
maxHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("maxHeight", props),
|
|
58
|
+
heightRange: ({ props }) => {
|
|
59
|
+
if (!(0, import_utils.isString)(props.heightRange)) return;
|
|
60
|
+
const [minHeight, maxHeight] = props.heightRange.split(" ");
|
|
57
61
|
return {
|
|
58
62
|
...(0, import_scratch.transformSize)("minHeight", minHeight),
|
|
59
63
|
...(0, import_scratch.transformSize)("maxHeight", maxHeight || minHeight)
|
|
60
64
|
};
|
|
61
65
|
},
|
|
62
|
-
size: (
|
|
63
|
-
if (!(0, import_utils.isString)(
|
|
64
|
-
const [inlineSize, blockSize] =
|
|
66
|
+
size: ({ props }) => {
|
|
67
|
+
if (!(0, import_utils.isString)(props.size)) return;
|
|
68
|
+
const [inlineSize, blockSize] = props.size.split(" ");
|
|
65
69
|
return {
|
|
66
70
|
...(0, import_scratch.transformSizeRatio)("inlineSize", inlineSize),
|
|
67
71
|
...(0, import_scratch.transformSizeRatio)("blockSize", blockSize || inlineSize)
|
|
68
72
|
};
|
|
69
73
|
},
|
|
70
|
-
minBlockSize: (
|
|
71
|
-
minInlineSize: (
|
|
72
|
-
maxBlockSize: (
|
|
73
|
-
maxInlineSize: (
|
|
74
|
-
minSize: (
|
|
75
|
-
if (!(0, import_utils.isString)(
|
|
76
|
-
const [minInlineSize, minBlockSize] =
|
|
74
|
+
minBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("minBlockSize", props),
|
|
75
|
+
minInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("minInlineSize", props),
|
|
76
|
+
maxBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxBlockSize", props),
|
|
77
|
+
maxInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxInlineSize", props),
|
|
78
|
+
minSize: ({ props }) => {
|
|
79
|
+
if (!(0, import_utils.isString)(props.minSize)) return;
|
|
80
|
+
const [minInlineSize, minBlockSize] = props.minSize.split(" ");
|
|
77
81
|
return {
|
|
78
82
|
...(0, import_scratch.transformSize)("minInlineSize", minInlineSize),
|
|
79
83
|
...(0, import_scratch.transformSize)("minBlockSize", minBlockSize || minInlineSize)
|
|
80
84
|
};
|
|
81
85
|
},
|
|
82
|
-
maxSize: (
|
|
83
|
-
if (!(0, import_utils.isString)(
|
|
84
|
-
const [maxInlineSize, maxBlockSize] =
|
|
86
|
+
maxSize: ({ props }) => {
|
|
87
|
+
if (!(0, import_utils.isString)(props.maxSize)) return;
|
|
88
|
+
const [maxInlineSize, maxBlockSize] = props.maxSize.split(" ");
|
|
85
89
|
return {
|
|
86
90
|
...(0, import_scratch.transformSize)("maxInlineSize", maxInlineSize),
|
|
87
91
|
...(0, import_scratch.transformSize)("maxBlockSize", maxBlockSize || maxInlineSize)
|
|
88
92
|
};
|
|
89
93
|
},
|
|
90
|
-
borderWidth: (
|
|
91
|
-
padding: (
|
|
92
|
-
scrollPadding: (
|
|
93
|
-
paddingInline: (
|
|
94
|
-
if (!(0, import_utils.isString)(
|
|
95
|
-
const [paddingInlineStart, paddingInlineEnd] =
|
|
94
|
+
borderWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("borderWidth", props),
|
|
95
|
+
padding: ({ props }) => (0, import_scratch.transformSizeRatio)("padding", props),
|
|
96
|
+
scrollPadding: ({ props }) => (0, import_scratch.transformSizeRatio)("scrollPadding", props),
|
|
97
|
+
paddingInline: ({ props }) => {
|
|
98
|
+
if (!(0, import_utils.isString)(props.paddingInline)) return;
|
|
99
|
+
const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(" ");
|
|
96
100
|
return {
|
|
97
101
|
...(0, import_scratch.transformSize)("paddingInlineStart", paddingInlineStart),
|
|
98
102
|
...(0, import_scratch.transformSize)("paddingInlineEnd", paddingInlineEnd || paddingInlineStart)
|
|
99
103
|
};
|
|
100
104
|
},
|
|
101
|
-
paddingBlock: (
|
|
102
|
-
if (!(0, import_utils.isString)(
|
|
103
|
-
const [paddingBlockStart, paddingBlockEnd] =
|
|
105
|
+
paddingBlock: ({ props }) => {
|
|
106
|
+
if (!(0, import_utils.isString)(props.paddingBlock)) return;
|
|
107
|
+
const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(" ");
|
|
104
108
|
return {
|
|
105
109
|
...(0, import_scratch.transformSize)("paddingBlockStart", paddingBlockStart),
|
|
106
110
|
...(0, import_scratch.transformSize)("paddingBlockEnd", paddingBlockEnd || paddingBlockStart)
|
|
107
111
|
};
|
|
108
112
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
margin: (val, el) => (0, import_scratch.transformSizeRatio)("margin", val, el),
|
|
118
|
-
marginInline: (val) => {
|
|
119
|
-
if (!(0, import_utils.isString)(val)) return;
|
|
120
|
-
const [marginInlineStart, marginInlineEnd] = val.split(" ");
|
|
113
|
+
paddingInlineStart: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", props),
|
|
114
|
+
paddingInlineEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", props),
|
|
115
|
+
paddingBlockStart: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", props),
|
|
116
|
+
paddingBlockEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", props),
|
|
117
|
+
margin: ({ props }) => (0, import_scratch.transformSizeRatio)("margin", props),
|
|
118
|
+
marginInline: ({ props }) => {
|
|
119
|
+
if (!(0, import_utils.isString)(props.marginInline)) return;
|
|
120
|
+
const [marginInlineStart, marginInlineEnd] = props.marginInline.split(" ");
|
|
121
121
|
return {
|
|
122
122
|
...(0, import_scratch.transformSize)("marginInlineStart", marginInlineStart),
|
|
123
123
|
...(0, import_scratch.transformSize)("marginInlineEnd", marginInlineEnd || marginInlineStart)
|
|
124
124
|
};
|
|
125
125
|
},
|
|
126
|
-
marginBlock: (
|
|
127
|
-
if (!(0, import_utils.isString)(
|
|
128
|
-
const [marginBlockStart, marginBlockEnd] =
|
|
126
|
+
marginBlock: ({ props }) => {
|
|
127
|
+
if (!(0, import_utils.isString)(props.marginBlock)) return;
|
|
128
|
+
const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(" ");
|
|
129
129
|
return {
|
|
130
130
|
...(0, import_scratch.transformSize)("marginBlockStart", marginBlockStart),
|
|
131
131
|
...(0, import_scratch.transformSize)("marginBlockEnd", marginBlockEnd || marginBlockStart)
|
|
132
132
|
};
|
|
133
133
|
},
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
marginBlockStart: (val, el) => (0, import_scratch.transformSizeRatio)("marginBlockStart", val, el),
|
|
141
|
-
marginBlockEnd: (val, el) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", val, el),
|
|
142
|
-
gap: (val) => ({
|
|
143
|
-
gap: (0, import_scratch.transfromGap)(val)
|
|
134
|
+
marginInlineStart: ({ props }) => (0, import_scratch.transformSizeRatio)("marginInlineStart", props),
|
|
135
|
+
marginInlineEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", props),
|
|
136
|
+
marginBlockStart: ({ props }) => (0, import_scratch.transformSizeRatio)("marginBlockStart", props),
|
|
137
|
+
marginBlockEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", props),
|
|
138
|
+
gap: ({ props }) => ({
|
|
139
|
+
gap: (0, import_scratch.transfromGap)(props.gap)
|
|
144
140
|
}),
|
|
145
|
-
columnGap: (
|
|
146
|
-
rowGap: (
|
|
147
|
-
flexWrap: (
|
|
141
|
+
columnGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "columnGap"),
|
|
142
|
+
rowGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "rowGap"),
|
|
143
|
+
flexWrap: ({ props }) => ({
|
|
148
144
|
display: "flex",
|
|
149
|
-
|
|
145
|
+
flexFlow: (props.flexFlow || "row").split(" ")[0] + " " + props.flexWrap
|
|
150
146
|
}),
|
|
151
|
-
flexFlow: (
|
|
152
|
-
const reverse =
|
|
153
|
-
if (!(0, import_utils.isString)(
|
|
154
|
-
let [direction, wrap] = (
|
|
155
|
-
if (
|
|
156
|
-
if (
|
|
147
|
+
flexFlow: ({ props }) => {
|
|
148
|
+
const { flexFlow, reverse } = props;
|
|
149
|
+
if (!(0, import_utils.isString)(flexFlow)) return;
|
|
150
|
+
let [direction, wrap] = (flexFlow || "row").split(" ");
|
|
151
|
+
if (flexFlow.startsWith("x") || flexFlow === "row") direction = "row";
|
|
152
|
+
if (flexFlow.startsWith("y") || flexFlow === "column") direction = "column";
|
|
157
153
|
return {
|
|
158
154
|
display: "flex",
|
|
159
155
|
flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
|
|
160
156
|
};
|
|
161
157
|
},
|
|
162
|
-
flexAlign: (
|
|
163
|
-
if (!(0, import_utils.isString)(
|
|
164
|
-
const [alignItems, justifyContent] =
|
|
158
|
+
flexAlign: ({ props }) => {
|
|
159
|
+
if (!(0, import_utils.isString)(props.flexAlign)) return;
|
|
160
|
+
const [alignItems, justifyContent] = props.flexAlign.split(" ");
|
|
165
161
|
return {
|
|
166
162
|
display: "flex",
|
|
167
163
|
alignItems,
|
|
168
164
|
justifyContent
|
|
169
165
|
};
|
|
170
|
-
}
|
|
171
|
-
round: (val, el) => (0, import_scratch.transformBorderRadius)(val ?? el.borderRadius, el, "round"),
|
|
172
|
-
borderRadius: (val, el) => (0, import_scratch.transformBorderRadius)(val ?? el.round, el, "borderRadius")
|
|
166
|
+
}
|
|
173
167
|
};
|
package/dist/cjs/props/font.js
CHANGED
|
@@ -23,14 +23,15 @@ __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
|
-
|
|
26
|
+
fontSize: (el) => {
|
|
27
|
+
const { props } = el;
|
|
28
|
+
return props.fontSize ? (0, import_scratch.getFontSizeByKey)(props.fontSize) : null;
|
|
28
29
|
},
|
|
29
|
-
fontFamily: (
|
|
30
|
-
fontFamily: (0, import_scratch.getFontFamily)(
|
|
30
|
+
fontFamily: ({ props }) => ({
|
|
31
|
+
fontFamily: (0, import_scratch.getFontFamily)(props.fontFamily) || props.fontFamily
|
|
31
32
|
}),
|
|
32
|
-
fontWeight: (
|
|
33
|
-
fontWeight:
|
|
34
|
-
fontVariationSettings: '"wght" ' +
|
|
33
|
+
fontWeight: ({ props }) => ({
|
|
34
|
+
fontWeight: props.fontWeight,
|
|
35
|
+
fontVariationSettings: '"wght" ' + props.fontWeight
|
|
35
36
|
})
|
|
36
37
|
};
|
package/dist/cjs/props/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))
|
|
@@ -18,38 +14,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
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
16
|
var props_exports = {};
|
|
21
|
-
__export(props_exports, {
|
|
22
|
-
CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY,
|
|
23
|
-
default: () => props_default
|
|
24
|
-
});
|
|
25
17
|
module.exports = __toCommonJS(props_exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var import_flex = require("./flex.js");
|
|
34
|
-
var import_grid = require("./grid.js");
|
|
35
|
-
__reExport(props_exports, require("./animation.js"), module.exports);
|
|
36
|
-
__reExport(props_exports, require("./block.js"), module.exports);
|
|
37
|
-
__reExport(props_exports, require("./font.js"), module.exports);
|
|
38
|
-
__reExport(props_exports, require("./misc.js"), module.exports);
|
|
39
|
-
__reExport(props_exports, require("./position.js"), module.exports);
|
|
40
|
-
__reExport(props_exports, require("./theme.js"), module.exports);
|
|
41
|
-
__reExport(props_exports, require("./timing.js"), module.exports);
|
|
42
|
-
__reExport(props_exports, require("./flex.js"), module.exports);
|
|
43
|
-
__reExport(props_exports, require("./grid.js"), 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_position.POSITION_PROPS,
|
|
50
|
-
...import_theme.THEME_PROPS,
|
|
51
|
-
...import_timing.TIMING_PROPS,
|
|
52
|
-
...import_flex.FLEX_PROPS,
|
|
53
|
-
...import_grid.GRID_PROPS
|
|
54
|
-
};
|
|
55
|
-
var props_default = CSS_PROPS_REGISTRY;
|
|
18
|
+
__reExport(props_exports, require("./animation"), module.exports);
|
|
19
|
+
__reExport(props_exports, require("./block"), module.exports);
|
|
20
|
+
__reExport(props_exports, require("./font"), module.exports);
|
|
21
|
+
__reExport(props_exports, require("./misc"), module.exports);
|
|
22
|
+
__reExport(props_exports, require("./position"), module.exports);
|
|
23
|
+
__reExport(props_exports, require("./theme"), module.exports);
|
|
24
|
+
__reExport(props_exports, require("./timing"), module.exports);
|
package/dist/cjs/props/misc.js
CHANGED
|
@@ -22,21 +22,15 @@ __export(misc_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(misc_exports);
|
|
24
24
|
const MISC_PROPS = {
|
|
25
|
-
overflow: (
|
|
26
|
-
overflow:
|
|
25
|
+
overflow: ({ props, deps }) => !deps.isUndefined(props.overflow) && {
|
|
26
|
+
overflow: props.overflow,
|
|
27
27
|
scrollBehavior: "smooth"
|
|
28
|
-
}),
|
|
29
|
-
cursor: (value, el, s, ctx) => {
|
|
30
|
-
if (!value) return;
|
|
31
|
-
const asset = ctx.assets && ctx.assets[value];
|
|
32
|
-
if (asset && asset.content) value = `url(${asset.content.src})`;
|
|
33
|
-
else {
|
|
34
|
-
const file = ctx.files && ctx.files[value];
|
|
35
|
-
if (file && file.content) value = `url(${file.content.src})`;
|
|
36
|
-
}
|
|
37
|
-
return { cursor: value };
|
|
38
28
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
cursor: (el, s, ctx) => {
|
|
30
|
+
let val = el.props.cursor;
|
|
31
|
+
if (!val) return;
|
|
32
|
+
const file = ctx.files && ctx.files[val];
|
|
33
|
+
if (file && file.content) val = `url(${file.content.src})`;
|
|
34
|
+
return { cursor: val };
|
|
35
|
+
}
|
|
42
36
|
};
|
|
@@ -23,26 +23,29 @@ __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
|
-
|
|
26
|
+
inset: ({ props, context }) => {
|
|
27
|
+
const { inset } = props;
|
|
28
|
+
if (context.utils.isNumber(inset)) return { inset };
|
|
29
|
+
if (!context.utils.isString(inset)) return;
|
|
30
|
+
return { inset: inset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k).join(" ") };
|
|
30
31
|
},
|
|
31
|
-
left: (
|
|
32
|
-
top: (
|
|
33
|
-
right: (
|
|
34
|
-
bottom: (
|
|
35
|
-
verticalInset: (
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
left: ({ props }) => (0, import_scratch.getSpacingByKey)(props.left, "left"),
|
|
33
|
+
top: ({ props }) => (0, import_scratch.getSpacingByKey)(props.top, "top"),
|
|
34
|
+
right: ({ props }) => (0, import_scratch.getSpacingByKey)(props.right, "right"),
|
|
35
|
+
bottom: ({ props }) => (0, import_scratch.getSpacingByKey)(props.bottom, "bottom"),
|
|
36
|
+
verticalInset: ({ props }) => {
|
|
37
|
+
const { verticalInset } = props;
|
|
38
|
+
if (typeof verticalInset !== "string") return;
|
|
39
|
+
const vi = verticalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
38
40
|
return {
|
|
39
41
|
top: vi[0],
|
|
40
42
|
bottom: vi[1] || vi[0]
|
|
41
43
|
};
|
|
42
44
|
},
|
|
43
|
-
horizontalInset: (
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
horizontalInset: ({ props }) => {
|
|
46
|
+
const { horizontalInset } = props;
|
|
47
|
+
if (typeof horizontalInset !== "string") return;
|
|
48
|
+
const vi = horizontalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
46
49
|
return {
|
|
47
50
|
left: vi[0],
|
|
48
51
|
right: vi[1] || vi[0]
|