css-in-props 3.14.1 → 3.14.4
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 +37 -0
- package/dist/cjs/index.js +1 -38
- package/dist/cjs/package.json +1 -4
- package/dist/cjs/src/index.js +1 -0
- package/dist/cjs/src/props/animation.js +1 -0
- package/dist/cjs/src/props/block.js +1 -0
- package/dist/cjs/src/props/defaults.js +1 -0
- package/dist/cjs/src/props/flex.js +1 -0
- package/dist/cjs/src/props/font.js +1 -0
- package/dist/cjs/src/props/grid.js +1 -0
- package/dist/cjs/src/props/index.js +1 -0
- package/dist/cjs/src/props/misc.js +1 -0
- package/dist/cjs/src/props/position.js +1 -0
- package/dist/cjs/src/props/theme.js +1 -0
- package/dist/cjs/src/props/timing.js +1 -0
- package/dist/cjs/src/set.js +1 -0
- package/dist/cjs/src/transform/executors.js +1 -0
- package/dist/cjs/src/transform/index.js +1 -0
- package/dist/cjs/src/transform/transformers.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/props/animation.js +1 -0
- package/dist/esm/src/props/block.js +1 -0
- package/dist/esm/src/props/defaults.js +1 -0
- package/dist/esm/src/props/flex.js +1 -0
- package/dist/esm/src/props/font.js +1 -0
- package/dist/esm/src/props/grid.js +1 -0
- package/dist/esm/src/props/index.js +1 -0
- package/dist/esm/src/props/misc.js +1 -0
- package/dist/esm/src/props/position.js +1 -0
- package/dist/esm/src/props/theme.js +1 -0
- package/dist/esm/src/props/timing.js +1 -0
- package/dist/esm/src/set.js +1 -0
- package/dist/esm/src/transform/executors.js +1 -0
- package/dist/esm/src/transform/index.js +1 -0
- package/dist/esm/src/transform/transformers.js +1 -0
- package/package.json +19 -20
- package/dist/cjs/defaults.js +0 -340
- package/dist/cjs/emotion.js +0 -29
- package/dist/cjs/props/animation.js +0 -57
- package/dist/cjs/props/block.js +0 -167
- package/dist/cjs/props/font.js +0 -37
- package/dist/cjs/props/index.js +0 -24
- package/dist/cjs/props/misc.js +0 -36
- package/dist/cjs/props/position.js +0 -54
- package/dist/cjs/props/theme.js +0 -147
- package/dist/cjs/props/timing.js +0 -42
- package/dist/cjs/registry.js +0 -39
- package/dist/cjs/set.js +0 -29
- package/dist/cjs/transform.js +0 -80
- package/index.js +0 -1
- package/src/index.js +0 -6
- package/src/props/animation.js +0 -119
- package/src/props/block.js +0 -183
- package/src/props/defaults.js +0 -318
- package/src/props/flex.js +0 -30
- package/src/props/font.js +0 -16
- package/src/props/grid.js +0 -21
- package/src/props/index.js +0 -35
- package/src/props/misc.js +0 -23
- package/src/props/position.js +0 -34
- package/src/props/theme.js +0 -155
- package/src/props/timing.js +0 -26
- package/src/set.js +0 -16
- package/src/transform/executors.js +0 -123
- package/src/transform/index.js +0 -4
- package/src/transform/transformers.js +0 -178
|
@@ -1,54 +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 position_exports = {};
|
|
20
|
-
__export(position_exports, {
|
|
21
|
-
POSITION_PROPS: () => POSITION_PROPS
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(position_exports);
|
|
24
|
-
var import_scratch = require("@symbo.ls/scratch");
|
|
25
|
-
const POSITION_PROPS = {
|
|
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(" ") };
|
|
31
|
-
},
|
|
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);
|
|
40
|
-
return {
|
|
41
|
-
top: vi[0],
|
|
42
|
-
bottom: vi[1] || vi[0]
|
|
43
|
-
};
|
|
44
|
-
},
|
|
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);
|
|
49
|
-
return {
|
|
50
|
-
left: vi[0],
|
|
51
|
-
right: vi[1] || vi[0]
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
};
|
package/dist/cjs/props/theme.js
DELETED
|
@@ -1,147 +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 theme_exports = {};
|
|
20
|
-
__export(theme_exports, {
|
|
21
|
-
THEME_PROPS: () => THEME_PROPS,
|
|
22
|
-
getSystemGlobalTheme: () => getSystemGlobalTheme
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(theme_exports);
|
|
25
|
-
var import_scratch = require("@symbo.ls/scratch");
|
|
26
|
-
var import_utils = require("@domql/utils");
|
|
27
|
-
const getSystemGlobalTheme = ({ context, state }) => {
|
|
28
|
-
const rootState = state && state.root;
|
|
29
|
-
return rootState && rootState.globalTheme ? rootState.globalTheme : context.designSystem && context.designSystem.globalTheme;
|
|
30
|
-
};
|
|
31
|
-
const THEME_PROPS = {
|
|
32
|
-
theme: (element) => {
|
|
33
|
-
const { props } = element;
|
|
34
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
35
|
-
if (!props.theme) return;
|
|
36
|
-
const hasSubtheme = props.theme.includes(" ") && !props.theme.includes("@");
|
|
37
|
-
const globalThemeForced = `@${props.themeModifier || globalTheme}`;
|
|
38
|
-
if (hasSubtheme) {
|
|
39
|
-
const themeAppliedInVal = props.theme.split(" ");
|
|
40
|
-
themeAppliedInVal.splice(1, 0, globalThemeForced);
|
|
41
|
-
return (0, import_scratch.getMediaTheme)(themeAppliedInVal);
|
|
42
|
-
} else if (props.theme.includes("@{globalTheme}"))
|
|
43
|
-
props.theme.replace("@{globalTheme}", globalThemeForced);
|
|
44
|
-
return (0, import_scratch.getMediaTheme)(props.theme, `@${props.themeModifier || globalTheme}`);
|
|
45
|
-
},
|
|
46
|
-
color: (element) => {
|
|
47
|
-
const { props } = element;
|
|
48
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
49
|
-
if (!props.color) return;
|
|
50
|
-
return {
|
|
51
|
-
color: (0, import_scratch.getMediaColor)(props.color, globalTheme)
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
background: (element) => {
|
|
55
|
-
const { props } = element;
|
|
56
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
57
|
-
if (!props.background) return;
|
|
58
|
-
return {
|
|
59
|
-
background: (0, import_scratch.getMediaColor)(props.background, globalTheme)
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
backgroundColor: (element) => {
|
|
63
|
-
const { props } = element;
|
|
64
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
65
|
-
if (!props.backgroundColor) return;
|
|
66
|
-
return {
|
|
67
|
-
backgroundColor: (0, import_scratch.getMediaColor)(props.backgroundColor, globalTheme)
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
backgroundImage: (element, s, ctx) => {
|
|
71
|
-
const { props } = element;
|
|
72
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
73
|
-
let val = props.backgroundImage;
|
|
74
|
-
if (!val) return;
|
|
75
|
-
const file = ctx.files && ctx.files[val];
|
|
76
|
-
if (file && file.content) val = file.content.src;
|
|
77
|
-
return {
|
|
78
|
-
backgroundImage: (0, import_scratch.transformBackgroundImage)(val, globalTheme)
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
backgroundSize: ({ props }) => ({
|
|
82
|
-
backgroundSize: props.backgroundSize
|
|
83
|
-
}),
|
|
84
|
-
backgroundPosition: ({ props }) => ({
|
|
85
|
-
backgroundPosition: props.backgroundPosition
|
|
86
|
-
}),
|
|
87
|
-
backgroundRepeat: ({ props }) => ({
|
|
88
|
-
backgroundRepeat: props.backgroundRepeat
|
|
89
|
-
}),
|
|
90
|
-
textStroke: ({ props }) => ({
|
|
91
|
-
WebkitTextStroke: (0, import_scratch.transformTextStroke)(props.textStroke)
|
|
92
|
-
}),
|
|
93
|
-
outline: ({ props }) => (0, import_utils.isDefined)(props.outline) && {
|
|
94
|
-
outline: (0, import_scratch.transformBorder)(props.outline)
|
|
95
|
-
},
|
|
96
|
-
outlineOffset: ({ props }) => (0, import_scratch.transformSizeRatio)("outlineOffset", props),
|
|
97
|
-
border: ({ props }) => (0, import_utils.isDefined)(props.border) && {
|
|
98
|
-
border: (0, import_scratch.transformBorder)(props.border)
|
|
99
|
-
},
|
|
100
|
-
borderColor: (element) => {
|
|
101
|
-
const { props } = element;
|
|
102
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
103
|
-
if (!props.borderColor) return;
|
|
104
|
-
return {
|
|
105
|
-
borderColor: (0, import_scratch.getMediaColor)(props.borderColor, globalTheme)
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
borderLeft: ({ props }) => ({
|
|
109
|
-
borderLeft: (0, import_scratch.transformBorder)(props.borderLeft)
|
|
110
|
-
}),
|
|
111
|
-
borderTop: ({ props }) => ({
|
|
112
|
-
borderTop: (0, import_scratch.transformBorder)(props.borderTop)
|
|
113
|
-
}),
|
|
114
|
-
borderRight: ({ props }) => ({
|
|
115
|
-
borderRight: (0, import_scratch.transformBorder)(props.borderRight)
|
|
116
|
-
}),
|
|
117
|
-
borderBottom: ({ props }) => ({
|
|
118
|
-
borderBottom: (0, import_scratch.transformBorder)(props.borderBottom)
|
|
119
|
-
}),
|
|
120
|
-
shadow: (element) => {
|
|
121
|
-
const { props } = element;
|
|
122
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
123
|
-
if (!props.backgroundImage) return;
|
|
124
|
-
return {
|
|
125
|
-
boxShadow: (0, import_scratch.transformShadow)(props.shadow, globalTheme)
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
|
-
boxShadow: (element, state, context) => {
|
|
129
|
-
const { props } = element;
|
|
130
|
-
if (!(0, import_utils.isString)(props.boxShadow)) return;
|
|
131
|
-
const [val, hasImportant] = props.boxShadow.split("!importan");
|
|
132
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
133
|
-
const important = hasImportant ? " !important" : "";
|
|
134
|
-
return {
|
|
135
|
-
boxShadow: (0, import_scratch.transformBoxShadow)(val.trim(), globalTheme) + important
|
|
136
|
-
};
|
|
137
|
-
},
|
|
138
|
-
textShadow: ({ props, context }) => ({
|
|
139
|
-
textShadow: (0, import_scratch.transformBoxShadow)(
|
|
140
|
-
props.textShadow,
|
|
141
|
-
context.designSystem.globalTheme
|
|
142
|
-
)
|
|
143
|
-
}),
|
|
144
|
-
columnRule: ({ props }) => ({
|
|
145
|
-
columnRule: (0, import_scratch.transformBorder)(props.columnRule)
|
|
146
|
-
})
|
|
147
|
-
};
|
package/dist/cjs/props/timing.js
DELETED
|
@@ -1,42 +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 timing_exports = {};
|
|
20
|
-
__export(timing_exports, {
|
|
21
|
-
TIMING_PROPS: () => TIMING_PROPS
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(timing_exports);
|
|
24
|
-
var import_scratch = require("@symbo.ls/scratch");
|
|
25
|
-
const TIMING_PROPS = {
|
|
26
|
-
transition: ({ props }) => ({
|
|
27
|
-
transition: (0, import_scratch.splitTransition)(props.transition)
|
|
28
|
-
}),
|
|
29
|
-
transitionDuration: ({ props }) => ({
|
|
30
|
-
transitionDuration: (0, import_scratch.transformDuration)(props.transitionDuration)
|
|
31
|
-
}),
|
|
32
|
-
transitionDelay: ({ props }) => ({
|
|
33
|
-
transitionDelay: (0, import_scratch.transformDuration)(props.transitionDelay)
|
|
34
|
-
}),
|
|
35
|
-
transitionTimingFunction: ({ props }) => ({
|
|
36
|
-
transitionTimingFunction: (0, import_scratch.getTimingFunction)(props.transitionTimingFunction)
|
|
37
|
-
}),
|
|
38
|
-
transitionProperty: ({ props }) => ({
|
|
39
|
-
transitionProperty: props.transitionProperty,
|
|
40
|
-
willChange: props.transitionProperty
|
|
41
|
-
})
|
|
42
|
-
};
|
package/dist/cjs/registry.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var registry_exports = {};
|
|
30
|
-
__export(registry_exports, {
|
|
31
|
-
CSS_PREPROCS_DEFAULTS: () => CSS_PREPROCS_DEFAULTS,
|
|
32
|
-
CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(registry_exports);
|
|
35
|
-
var import_utils = require("@domql/utils");
|
|
36
|
-
var preprocs = __toESM(require("./props"), 1);
|
|
37
|
-
var import_atoms = require("@symbo.ls/atoms");
|
|
38
|
-
const CSS_PROPS_REGISTRY = (0, import_utils.mergeArray)([import_atoms.Text]).class;
|
|
39
|
-
const CSS_PREPROCS_DEFAULTS = (0, import_utils.mergeArray)(Object.values(preprocs));
|
package/dist/cjs/set.js
DELETED
|
@@ -1,29 +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 set_exports = {};
|
|
20
|
-
__export(set_exports, {
|
|
21
|
-
setClassname: () => setClassname
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(set_exports);
|
|
24
|
-
var import_transform = require("./transform");
|
|
25
|
-
var import_emotion = require("./emotion");
|
|
26
|
-
const setClassname = (props, emotionCss) => {
|
|
27
|
-
const transform = (0, import_transform.transformClassname)(props);
|
|
28
|
-
return (0, import_emotion.transformEmotion)(transform, emotionCss);
|
|
29
|
-
};
|
package/dist/cjs/transform.js
DELETED
|
@@ -1,80 +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 transform_exports = {};
|
|
20
|
-
__export(transform_exports, {
|
|
21
|
-
extractCSSfromProps: () => extractCSSfromProps,
|
|
22
|
-
transformClassname: () => transformClassname
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(transform_exports);
|
|
25
|
-
var import_utils = require("@domql/utils");
|
|
26
|
-
var import_atoms = require("@symbo.ls/atoms");
|
|
27
|
-
var import_registry = require("./registry");
|
|
28
|
-
var import_defaults = require("./defaults");
|
|
29
|
-
const transformClassname = (element, restProps = {}) => {
|
|
30
|
-
const classCss = {};
|
|
31
|
-
const { props, class: elementClass } = element;
|
|
32
|
-
if (!(0, import_utils.isObject)(props)) return;
|
|
33
|
-
for (const key in props) {
|
|
34
|
-
const setter = import_atoms.keySetters[key.slice(0, 1)];
|
|
35
|
-
const hasCSS = elementClass[key];
|
|
36
|
-
if (setter) setter(key, props[key], classCss, element, true);
|
|
37
|
-
else if ((0, import_utils.isFunction)(hasCSS)) {
|
|
38
|
-
const stack = hasCSS(element, element.state, element.context);
|
|
39
|
-
const exec = (0, import_utils.isArray)(stack) ? stack.reduce((a, c) => {
|
|
40
|
-
return (0, import_utils.merge)(a, c);
|
|
41
|
-
}, {}) : stack;
|
|
42
|
-
(0, import_utils.deepMerge)(classCss, exec);
|
|
43
|
-
} else if (key === "style") {
|
|
44
|
-
(0, import_utils.deepMerge)(classCss, props[key]);
|
|
45
|
-
} else restProps[key] = props[key];
|
|
46
|
-
}
|
|
47
|
-
return classCss;
|
|
48
|
-
};
|
|
49
|
-
const extractCSSfromProps = (element) => {
|
|
50
|
-
const { props: defProps } = element;
|
|
51
|
-
const css = {};
|
|
52
|
-
const props = {};
|
|
53
|
-
for (const key in defProps) {
|
|
54
|
-
const val = defProps[key];
|
|
55
|
-
const mediaProp = import_atoms.keySetters[key.slice(0, 1)];
|
|
56
|
-
if (mediaProp) {
|
|
57
|
-
mediaProp(key, defProps[key], css, element, true);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
const preprop = import_registry.CSS_PREPROCS_DEFAULTS[key];
|
|
61
|
-
if (preprop) {
|
|
62
|
-
const stack = preprop(element, element.state, element.context);
|
|
63
|
-
const exec = (0, import_utils.isArray)(stack) ? stack.reduce((a, c) => {
|
|
64
|
-
return (0, import_utils.merge)(a, c);
|
|
65
|
-
}, {}) : stack;
|
|
66
|
-
(0, import_utils.deepMerge)(css, exec);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (key === "style") {
|
|
70
|
-
(0, import_utils.deepMerge)(css, defProps[key]);
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (import_defaults.DEFAULT_CSS_PROPERTIES_LIST.includes(key)) {
|
|
74
|
-
css[key] = val;
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
props[key] = val;
|
|
78
|
-
}
|
|
79
|
-
return { css, props };
|
|
80
|
-
};
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/index.js'
|
package/src/index.js
DELETED
package/src/props/animation.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { isObject, isString } from '@symbo.ls/utils'
|
|
4
|
-
import { keyframes as cssKeyframes } from '@symbo.ls/css'
|
|
5
|
-
import { getTimingByKey, getTimingFunction } from '@symbo.ls/scratch'
|
|
6
|
-
|
|
7
|
-
const TIMING_FUNCTIONS = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end']
|
|
8
|
-
const FILL_MODES = ['none', 'forwards', 'backwards', 'both']
|
|
9
|
-
const DIRECTIONS = ['normal', 'reverse', 'alternate', 'alternate-reverse']
|
|
10
|
-
const PLAY_STATES = ['running', 'paused']
|
|
11
|
-
const isDuration = v => /^[\d.]+m?s$/.test(v)
|
|
12
|
-
|
|
13
|
-
let _animCounter = 0
|
|
14
|
-
const applyAnimationProps = (animation, element) => {
|
|
15
|
-
const { animation: ANIMATION } = (element.context && element.context.designSystem) || {}
|
|
16
|
-
if (isObject(animation)) {
|
|
17
|
-
const name = `smbls-anim-${_animCounter++}`
|
|
18
|
-
return { animationName: cssKeyframes(name, animation) }
|
|
19
|
-
}
|
|
20
|
-
const record = ANIMATION && ANIMATION[animation]
|
|
21
|
-
if (isObject(record)) {
|
|
22
|
-
return cssKeyframes(animation, record)
|
|
23
|
-
}
|
|
24
|
-
return animation
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Parse CSS animation shorthand string into individual properties.
|
|
29
|
-
* Identifies the animation name by looking it up in the ANIMATION registry.
|
|
30
|
-
* Other tokens are classified by type: duration, timing-function, iteration-count, etc.
|
|
31
|
-
*/
|
|
32
|
-
const parseAnimationShorthand = (val, el) => {
|
|
33
|
-
const { animation: ANIMATION } = el.context && el.context.designSystem || {}
|
|
34
|
-
const tokens = val.split(/\s+/)
|
|
35
|
-
let name = null
|
|
36
|
-
const durations = []
|
|
37
|
-
let timingFunction = null
|
|
38
|
-
let iterationCount = null
|
|
39
|
-
let direction = null
|
|
40
|
-
let fillMode = null
|
|
41
|
-
let playState = null
|
|
42
|
-
|
|
43
|
-
for (const token of tokens) {
|
|
44
|
-
if (ANIMATION && ANIMATION[token]) {
|
|
45
|
-
name = token
|
|
46
|
-
} else if (isDuration(token)) {
|
|
47
|
-
durations.push(token)
|
|
48
|
-
} else if (TIMING_FUNCTIONS.includes(token) || token.startsWith('cubic-bezier') || token.startsWith('steps(')) {
|
|
49
|
-
timingFunction = token
|
|
50
|
-
} else if (token === 'infinite' || /^\d+$/.test(token)) {
|
|
51
|
-
iterationCount = token === 'infinite' ? token : Number(token)
|
|
52
|
-
} else if (DIRECTIONS.includes(token)) {
|
|
53
|
-
direction = token
|
|
54
|
-
} else if (FILL_MODES.includes(token)) {
|
|
55
|
-
fillMode = token
|
|
56
|
-
} else if (PLAY_STATES.includes(token)) {
|
|
57
|
-
playState = token
|
|
58
|
-
} else if (!name) {
|
|
59
|
-
// Fallback: treat unknown token as animation name
|
|
60
|
-
name = token
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return { name, durations, timingFunction, iterationCount, direction, fillMode, playState }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const ANIMATION_PROPS = {
|
|
68
|
-
animation: (val, el) => {
|
|
69
|
-
// Support CSS shorthand: 'animationName 2s linear infinite'
|
|
70
|
-
if (isString(val) && val.includes(' ')) {
|
|
71
|
-
const parsed = parseAnimationShorthand(val, el)
|
|
72
|
-
return {
|
|
73
|
-
animationName: applyAnimationProps(parsed.name || val, el),
|
|
74
|
-
animationDuration: parsed.durations[0] || getTimingByKey(el.animationDuration || 'A').timing,
|
|
75
|
-
animationDelay: parsed.durations[1] || getTimingByKey(el.animationDelay || '0s').timing,
|
|
76
|
-
animationTimingFunction: parsed.timingFunction || getTimingFunction(el.animationTimingFunction || 'ease'),
|
|
77
|
-
animationFillMode: parsed.fillMode || el.animationFillMode || 'both',
|
|
78
|
-
animationIterationCount: parsed.iterationCount != null ? parsed.iterationCount : (el.animationIterationCount || 1),
|
|
79
|
-
animationPlayState: parsed.playState || el.animationPlayState,
|
|
80
|
-
animationDirection: parsed.direction || el.animationDirection
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// Single name (no spaces) — original behavior
|
|
84
|
-
return {
|
|
85
|
-
animationName: applyAnimationProps(val, el),
|
|
86
|
-
animationDuration: getTimingByKey(el.animationDuration || 'A').timing,
|
|
87
|
-
animationDelay: getTimingByKey(el.animationDelay || '0s').timing,
|
|
88
|
-
animationTimingFunction: getTimingFunction(el.animationTimingFunction || 'ease'),
|
|
89
|
-
animationFillMode: el.animationFillMode || 'both',
|
|
90
|
-
animationIterationCount: el.animationIterationCount || 1,
|
|
91
|
-
animationPlayState: el.animationPlayState,
|
|
92
|
-
animationDirection: el.animationDirection
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
animationName: (val, el) => ({
|
|
96
|
-
animationName: applyAnimationProps(val, el)
|
|
97
|
-
}),
|
|
98
|
-
animationDuration: (val) => ({
|
|
99
|
-
animationDuration: getTimingByKey(val).timing
|
|
100
|
-
}),
|
|
101
|
-
animationDelay: (val) => ({
|
|
102
|
-
animationDelay: getTimingByKey(val).timing
|
|
103
|
-
}),
|
|
104
|
-
animationTimingFunction: (val) => ({
|
|
105
|
-
animationTimingFunction: getTimingFunction(val)
|
|
106
|
-
}),
|
|
107
|
-
animationIterationCount: (val) => ({
|
|
108
|
-
animationIterationCount: val
|
|
109
|
-
}),
|
|
110
|
-
animationFillMode: (val) => ({
|
|
111
|
-
animationFillMode: val
|
|
112
|
-
}),
|
|
113
|
-
animationPlayState: (val) => ({
|
|
114
|
-
animationPlayState: val
|
|
115
|
-
}),
|
|
116
|
-
animationDirection: (val) => ({
|
|
117
|
-
animationDirection: val
|
|
118
|
-
})
|
|
119
|
-
}
|