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/dist/cjs/props/theme.js
CHANGED
|
@@ -23,125 +23,125 @@ __export(theme_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(theme_exports);
|
|
25
25
|
var import_scratch = require("@symbo.ls/scratch");
|
|
26
|
-
var import_utils = require("@
|
|
26
|
+
var import_utils = require("@domql/utils");
|
|
27
27
|
const getSystemGlobalTheme = ({ context, state }) => {
|
|
28
|
-
const
|
|
29
|
-
return
|
|
28
|
+
const rootState = state && state.root;
|
|
29
|
+
return rootState && rootState.globalTheme ? rootState.globalTheme : context.designSystem && context.designSystem.globalTheme;
|
|
30
30
|
};
|
|
31
31
|
const THEME_PROPS = {
|
|
32
|
-
theme: (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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}`);
|
|
38
45
|
},
|
|
39
|
-
color: (
|
|
46
|
+
color: (element) => {
|
|
47
|
+
const { props } = element;
|
|
40
48
|
const globalTheme = getSystemGlobalTheme(element);
|
|
41
|
-
if (!
|
|
49
|
+
if (!props.color) return;
|
|
42
50
|
return {
|
|
43
|
-
color: (0, import_scratch.getMediaColor)(
|
|
51
|
+
color: (0, import_scratch.getMediaColor)(props.color, globalTheme)
|
|
44
52
|
};
|
|
45
53
|
},
|
|
46
|
-
background: (
|
|
54
|
+
background: (element) => {
|
|
55
|
+
const { props } = element;
|
|
47
56
|
const globalTheme = getSystemGlobalTheme(element);
|
|
48
|
-
if (!
|
|
49
|
-
if ((0, import_utils.isString)(val) && val.includes("gradient")) {
|
|
50
|
-
return { background: (0, import_scratch.resolveColorsInGradient)(val, globalTheme) };
|
|
51
|
-
}
|
|
57
|
+
if (!props.background) return;
|
|
52
58
|
return {
|
|
53
|
-
background: (0, import_scratch.getMediaColor)(
|
|
59
|
+
background: (0, import_scratch.getMediaColor)(props.background, globalTheme)
|
|
54
60
|
};
|
|
55
61
|
},
|
|
56
|
-
backgroundColor: (
|
|
62
|
+
backgroundColor: (element) => {
|
|
63
|
+
const { props } = element;
|
|
57
64
|
const globalTheme = getSystemGlobalTheme(element);
|
|
58
|
-
if (!
|
|
65
|
+
if (!props.backgroundColor) return;
|
|
59
66
|
return {
|
|
60
|
-
backgroundColor: (0, import_scratch.getMediaColor)(
|
|
67
|
+
backgroundColor: (0, import_scratch.getMediaColor)(props.backgroundColor, globalTheme)
|
|
61
68
|
};
|
|
62
69
|
},
|
|
63
|
-
backgroundImage: (
|
|
70
|
+
backgroundImage: (element, s, ctx) => {
|
|
71
|
+
const { props } = element;
|
|
64
72
|
const globalTheme = getSystemGlobalTheme(element);
|
|
73
|
+
let val = props.backgroundImage;
|
|
65
74
|
if (!val) return;
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
else {
|
|
69
|
-
const file = ctx.files && ctx.files[val];
|
|
70
|
-
if (file && file.content) val = file.content.src;
|
|
71
|
-
}
|
|
75
|
+
const file = ctx.files && ctx.files[val];
|
|
76
|
+
if (file && file.content) val = file.content.src;
|
|
72
77
|
return {
|
|
73
78
|
backgroundImage: (0, import_scratch.transformBackgroundImage)(val, globalTheme)
|
|
74
79
|
};
|
|
75
80
|
},
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
backgroundSize: ({ props }) => ({
|
|
82
|
+
backgroundSize: props.backgroundSize
|
|
78
83
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
backgroundPosition: ({ props }) => ({
|
|
85
|
+
backgroundPosition: props.backgroundPosition
|
|
81
86
|
}),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
border: (0, import_scratch.transformBorder)(val)
|
|
87
|
+
backgroundRepeat: ({ props }) => ({
|
|
88
|
+
backgroundRepeat: props.backgroundRepeat
|
|
85
89
|
}),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
borderTopColor: (val, element) => {
|
|
94
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
95
|
-
if (!val) return;
|
|
96
|
-
return { borderTopColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
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)
|
|
97
95
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return { borderBottomColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
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)
|
|
102
99
|
},
|
|
103
|
-
|
|
100
|
+
borderColor: (element) => {
|
|
101
|
+
const { props } = element;
|
|
104
102
|
const globalTheme = getSystemGlobalTheme(element);
|
|
105
|
-
if (!
|
|
106
|
-
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
110
|
-
if (!val) return;
|
|
111
|
-
return { borderRightColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
103
|
+
if (!props.borderColor) return;
|
|
104
|
+
return {
|
|
105
|
+
borderColor: (0, import_scratch.getMediaColor)(props.borderColor, globalTheme)
|
|
106
|
+
};
|
|
112
107
|
},
|
|
113
|
-
borderLeft: (
|
|
114
|
-
borderLeft: (0, import_scratch.transformBorder)(
|
|
108
|
+
borderLeft: ({ props }) => ({
|
|
109
|
+
borderLeft: (0, import_scratch.transformBorder)(props.borderLeft)
|
|
115
110
|
}),
|
|
116
|
-
borderTop: (
|
|
117
|
-
borderTop: (0, import_scratch.transformBorder)(
|
|
111
|
+
borderTop: ({ props }) => ({
|
|
112
|
+
borderTop: (0, import_scratch.transformBorder)(props.borderTop)
|
|
118
113
|
}),
|
|
119
|
-
borderRight: (
|
|
120
|
-
borderRight: (0, import_scratch.transformBorder)(
|
|
114
|
+
borderRight: ({ props }) => ({
|
|
115
|
+
borderRight: (0, import_scratch.transformBorder)(props.borderRight)
|
|
121
116
|
}),
|
|
122
|
-
borderBottom: (
|
|
123
|
-
borderBottom: (0, import_scratch.transformBorder)(
|
|
117
|
+
borderBottom: ({ props }) => ({
|
|
118
|
+
borderBottom: (0, import_scratch.transformBorder)(props.borderBottom)
|
|
124
119
|
}),
|
|
125
|
-
shadow: (
|
|
120
|
+
shadow: (element) => {
|
|
121
|
+
const { props } = element;
|
|
126
122
|
const globalTheme = getSystemGlobalTheme(element);
|
|
127
|
-
if (!
|
|
123
|
+
if (!props.backgroundImage) return;
|
|
128
124
|
return {
|
|
129
|
-
boxShadow: (0, import_scratch.transformShadow)(
|
|
125
|
+
boxShadow: (0, import_scratch.transformShadow)(props.shadow, globalTheme)
|
|
130
126
|
};
|
|
131
127
|
},
|
|
132
|
-
boxShadow: (
|
|
133
|
-
|
|
134
|
-
|
|
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");
|
|
135
132
|
const globalTheme = getSystemGlobalTheme(element);
|
|
136
133
|
const important = hasImportant ? " !important" : "";
|
|
137
134
|
return {
|
|
138
|
-
boxShadow: (0, import_scratch.transformBoxShadow)(
|
|
135
|
+
boxShadow: (0, import_scratch.transformBoxShadow)(val.trim(), globalTheme) + important
|
|
139
136
|
};
|
|
140
137
|
},
|
|
141
|
-
textShadow: (
|
|
142
|
-
textShadow: (0, import_scratch.transformBoxShadow)(
|
|
138
|
+
textShadow: ({ props, context }) => ({
|
|
139
|
+
textShadow: (0, import_scratch.transformBoxShadow)(
|
|
140
|
+
props.textShadow,
|
|
141
|
+
context.designSystem.globalTheme
|
|
142
|
+
)
|
|
143
143
|
}),
|
|
144
|
-
columnRule: (
|
|
145
|
-
columnRule: (0, import_scratch.transformBorder)(
|
|
144
|
+
columnRule: ({ props }) => ({
|
|
145
|
+
columnRule: (0, import_scratch.transformBorder)(props.columnRule)
|
|
146
146
|
})
|
|
147
147
|
};
|
package/dist/cjs/props/timing.js
CHANGED
|
@@ -23,20 +23,20 @@ __export(timing_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(timing_exports);
|
|
24
24
|
var import_scratch = require("@symbo.ls/scratch");
|
|
25
25
|
const TIMING_PROPS = {
|
|
26
|
-
transition: (
|
|
27
|
-
transition: (0, import_scratch.splitTransition)(
|
|
26
|
+
transition: ({ props }) => ({
|
|
27
|
+
transition: (0, import_scratch.splitTransition)(props.transition)
|
|
28
28
|
}),
|
|
29
|
-
transitionDuration: (
|
|
30
|
-
transitionDuration: (0, import_scratch.transformDuration)(
|
|
29
|
+
transitionDuration: ({ props }) => ({
|
|
30
|
+
transitionDuration: (0, import_scratch.transformDuration)(props.transitionDuration)
|
|
31
31
|
}),
|
|
32
|
-
transitionDelay: (
|
|
33
|
-
transitionDelay: (0, import_scratch.transformDuration)(
|
|
32
|
+
transitionDelay: ({ props }) => ({
|
|
33
|
+
transitionDelay: (0, import_scratch.transformDuration)(props.transitionDelay)
|
|
34
34
|
}),
|
|
35
|
-
transitionTimingFunction: (
|
|
36
|
-
transitionTimingFunction: (0, import_scratch.getTimingFunction)(
|
|
35
|
+
transitionTimingFunction: ({ props }) => ({
|
|
36
|
+
transitionTimingFunction: (0, import_scratch.getTimingFunction)(props.transitionTimingFunction)
|
|
37
37
|
}),
|
|
38
|
-
transitionProperty: (
|
|
39
|
-
transitionProperty:
|
|
40
|
-
willChange:
|
|
38
|
+
transitionProperty: ({ props }) => ({
|
|
39
|
+
transitionProperty: props.transitionProperty,
|
|
40
|
+
willChange: props.transitionProperty
|
|
41
41
|
})
|
|
42
42
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
CHANGED
|
@@ -18,19 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var set_exports = {};
|
|
20
20
|
__export(set_exports, {
|
|
21
|
-
setClassname: () => setClassname
|
|
22
|
-
transformClassname: () => transformClassname
|
|
21
|
+
setClassname: () => setClassname
|
|
23
22
|
});
|
|
24
23
|
module.exports = __toCommonJS(set_exports);
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return (0, import_transform.useCssInProps)(element, element);
|
|
31
|
-
};
|
|
32
|
-
const setClassname = (props, cssEngine) => {
|
|
33
|
-
const transform = transformClassname(props);
|
|
34
|
-
if (typeof cssEngine === "function") return cssEngine(transform);
|
|
35
|
-
return (0, import_css.css)(transform);
|
|
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);
|
|
36
29
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
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/package.json
CHANGED
package/dist/cjs/props/flex.js
DELETED
|
@@ -1,44 +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 flex_exports = {};
|
|
20
|
-
__export(flex_exports, {
|
|
21
|
-
FLEX_PROPS: () => FLEX_PROPS
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(flex_exports);
|
|
24
|
-
var import_utils = require("@symbo.ls/utils");
|
|
25
|
-
const FLEX_PROPS = {
|
|
26
|
-
flow: (value, el) => {
|
|
27
|
-
const reverse = el.reverse;
|
|
28
|
-
if (!(0, import_utils.isString)(value)) return;
|
|
29
|
-
let [direction, wrap] = (value || "row").split(" ");
|
|
30
|
-
if (value.startsWith("x") || value === "row") direction = "row";
|
|
31
|
-
if (value.startsWith("y") || value === "column") direction = "column";
|
|
32
|
-
return {
|
|
33
|
-
display: "flex",
|
|
34
|
-
flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
wrap: (value, el) => {
|
|
38
|
-
return { display: "flex", flexWrap: value };
|
|
39
|
-
},
|
|
40
|
-
align: (value, el) => {
|
|
41
|
-
const [alignItems, justifyContent] = value.split(" ");
|
|
42
|
-
return { display: "flex", alignItems, justifyContent };
|
|
43
|
-
}
|
|
44
|
-
};
|
package/dist/cjs/props/grid.js
DELETED
|
@@ -1,39 +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 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
|
-
};
|
|
@@ -1,131 +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 executors_exports = {};
|
|
20
|
-
__export(executors_exports, {
|
|
21
|
-
exetuteClassPerComponent: () => exetuteClassPerComponent,
|
|
22
|
-
useCssInProps: () => useCssInProps,
|
|
23
|
-
usePropsAsCSS: () => usePropsAsCSS,
|
|
24
|
-
useSelectorsAsCSS: () => useSelectorsAsCSS
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(executors_exports);
|
|
27
|
-
var import_utils = require("@symbo.ls/utils");
|
|
28
|
-
var import_scratch = require("@symbo.ls/scratch");
|
|
29
|
-
var import_props = require("../props/index.js");
|
|
30
|
-
var import_defaults = require("../props/defaults.js");
|
|
31
|
-
var import_transformers = require("./transformers.js");
|
|
32
|
-
const isProd = (0, import_utils.isProduction)();
|
|
33
|
-
const usePropsAsCSS = (sourceObj, element, opts) => {
|
|
34
|
-
const ds = element?.context?.designSystem;
|
|
35
|
-
if (ds) (0, import_scratch.pushConfig)(ds);
|
|
36
|
-
try {
|
|
37
|
-
let obj = {};
|
|
38
|
-
const rest = {};
|
|
39
|
-
const setToObj = (key, val) => {
|
|
40
|
-
if (opts.unpack) {
|
|
41
|
-
obj = { ...obj, ...val };
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
obj[key] = val;
|
|
45
|
-
};
|
|
46
|
-
for (const key in sourceObj) {
|
|
47
|
-
const value = sourceObj[key];
|
|
48
|
-
if (key === "class" && element.call("isString", sourceObj.class)) {
|
|
49
|
-
const val = value.split(" ");
|
|
50
|
-
if (val.length) {
|
|
51
|
-
const CLASS = element.context.designSystem.class;
|
|
52
|
-
const result = val.reduce((acc, curr) => (0, import_utils.merge)(acc, CLASS[curr]), {});
|
|
53
|
-
obj.designSystemClass = result;
|
|
54
|
-
}
|
|
55
|
-
} else if (key === "true") {
|
|
56
|
-
const val = (0, import_utils.exec)(value, element);
|
|
57
|
-
(0, import_utils.merge)(obj, (0, import_transformers.applyTrueProps)(val, element));
|
|
58
|
-
} else if (element.classlist[key]) {
|
|
59
|
-
const originalFromClass = element.classlist[key];
|
|
60
|
-
const result = (0, import_utils.isFunction)(originalFromClass) ? originalFromClass(element, element.state, element.context) : originalFromClass;
|
|
61
|
-
if (result) setToObj(key, result);
|
|
62
|
-
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
63
|
-
} else if (import_props.CSS_PROPS_REGISTRY[key]) {
|
|
64
|
-
let val = (0, import_utils.exec)(value, element);
|
|
65
|
-
if ((0, import_utils.isArray)(val)) {
|
|
66
|
-
val = val.reduce((a, c) => (0, import_utils.merge)(a, c), {});
|
|
67
|
-
}
|
|
68
|
-
let result = import_props.CSS_PROPS_REGISTRY[key](val, element, element.state, element.context);
|
|
69
|
-
if ((0, import_utils.isArray)(result)) result = result.reduce((a, c) => (0, import_utils.merge)(a, c), {});
|
|
70
|
-
if (result) setToObj(key, result);
|
|
71
|
-
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
72
|
-
} else if (import_defaults.DEFAULT_CSS_PROPERTIES_LIST.has(key)) {
|
|
73
|
-
let result = (0, import_utils.exec)(value, element);
|
|
74
|
-
if (typeof result === "string" && result.charCodeAt(0) === 45 && result.charCodeAt(1) === 45) {
|
|
75
|
-
result = `var(${result})`;
|
|
76
|
-
}
|
|
77
|
-
setToObj(key, { [key]: result });
|
|
78
|
-
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
79
|
-
} else {
|
|
80
|
-
rest[key] = value;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return [obj, rest];
|
|
84
|
-
} finally {
|
|
85
|
-
if (ds) (0, import_scratch.popConfig)();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const useSelectorsAsCSS = (sourceObj, element) => {
|
|
89
|
-
const obj = {};
|
|
90
|
-
for (const key in sourceObj) {
|
|
91
|
-
const selectroSetter = import_transformers.transformersByPrefix[key.slice(0, 1)];
|
|
92
|
-
if (selectroSetter) {
|
|
93
|
-
const result = selectroSetter(key, sourceObj[key], element);
|
|
94
|
-
if (result) {
|
|
95
|
-
for (const k in result) {
|
|
96
|
-
if (Object.prototype.hasOwnProperty.call(result, k)) {
|
|
97
|
-
if (obj[k] && typeof obj[k] === "object" && typeof result[k] === "object") {
|
|
98
|
-
(0, import_utils.overwriteDeep)(obj[k], result[k]);
|
|
99
|
-
} else {
|
|
100
|
-
obj[k] = result[k];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return obj;
|
|
108
|
-
};
|
|
109
|
-
const useCssInProps = (selectorProps, element, opts = { unpack: true }) => {
|
|
110
|
-
const [cssObj, restProps] = usePropsAsCSS(selectorProps, element, opts);
|
|
111
|
-
const selectorsObj = useSelectorsAsCSS(restProps, element);
|
|
112
|
-
let hasSelectors = false;
|
|
113
|
-
for (const _k in selectorsObj) {
|
|
114
|
-
hasSelectors = true;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
if (hasSelectors) {
|
|
118
|
-
if (opts.unpack) return (0, import_utils.overwrite)(cssObj, selectorsObj);
|
|
119
|
-
cssObj._selectors = selectorsObj;
|
|
120
|
-
}
|
|
121
|
-
return cssObj;
|
|
122
|
-
};
|
|
123
|
-
const exetuteClassPerComponent = (component, element) => {
|
|
124
|
-
const classObj = {};
|
|
125
|
-
if (component.class) {
|
|
126
|
-
for (const classProp in component.class) {
|
|
127
|
-
classObj[classProp] = component.class[classProp](element);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return classObj;
|
|
131
|
-
};
|