css-in-props 3.2.3 → 3.2.7
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 +1 -1
- package/dist/cjs/registry.js +39 -0
- package/dist/esm/_transform.js +60 -0
- package/dist/esm/emotion.js +9 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/registry.js +9 -0
- package/dist/esm/set.js +9 -0
- package/dist/iife/index.js +1042 -0
- package/package.json +29 -15
- package/src/_transform.js +1 -8
- package/src/index.js +0 -1
- package/src/props/animation.js +86 -10
- package/src/props/defaults.js +2 -2
- package/src/props/flex.js +3 -8
- package/src/props/theme.js +29 -5
- package/src/registry.js +10 -0
- package/src/transform/executors.js +6 -4
- package/src/transform/transformers.js +0 -18
- package/dist/cjs/package.json +0 -4
- package/dist/cjs/props/animation.js +0 -57
- package/dist/cjs/props/block.js +0 -179
- package/dist/cjs/props/defaults.js +0 -340
- package/dist/cjs/props/flex.js +0 -44
- package/dist/cjs/props/font.js +0 -36
- package/dist/cjs/props/grid.js +0 -39
- package/dist/cjs/props/index.js +0 -56
- package/dist/cjs/props/misc.js +0 -35
- package/dist/cjs/props/position.js +0 -51
- package/dist/cjs/props/theme.js +0 -126
- package/dist/cjs/props/timing.js +0 -42
- package/dist/cjs/transform/executors.js +0 -105
- package/dist/cjs/transform/index.js +0 -18
- package/dist/cjs/transform/transformers.js +0 -85
package/dist/cjs/props/misc.js
DELETED
|
@@ -1,35 +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 misc_exports = {};
|
|
20
|
-
__export(misc_exports, {
|
|
21
|
-
MISC_PROPS: () => MISC_PROPS
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(misc_exports);
|
|
24
|
-
const MISC_PROPS = {
|
|
25
|
-
overflow: (value) => ({
|
|
26
|
-
overflow: value,
|
|
27
|
-
scrollBehavior: "smooth"
|
|
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 };
|
|
34
|
-
}
|
|
35
|
-
};
|
|
@@ -1,51 +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: (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(" ") };
|
|
30
|
-
},
|
|
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);
|
|
38
|
-
return {
|
|
39
|
-
top: vi[0],
|
|
40
|
-
bottom: vi[1] || vi[0]
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
horizontalInset: (val) => {
|
|
44
|
-
if (typeof val !== "string") return;
|
|
45
|
-
const vi = val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
|
|
46
|
-
return {
|
|
47
|
-
left: vi[0],
|
|
48
|
-
right: vi[1] || vi[0]
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
};
|
package/dist/cjs/props/theme.js
DELETED
|
@@ -1,126 +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: (val, element) => {
|
|
33
|
-
const { props } = element;
|
|
34
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
35
|
-
if (!val) return;
|
|
36
|
-
const hasSubtheme = val.includes(" ") && !val.includes("@");
|
|
37
|
-
const globalThemeForced = `@${props.themeModifier || globalTheme}`;
|
|
38
|
-
if (hasSubtheme) {
|
|
39
|
-
const themeAppliedInVal = val.split(" ");
|
|
40
|
-
themeAppliedInVal.splice(1, 0, globalThemeForced);
|
|
41
|
-
return (0, import_scratch.getMediaTheme)(themeAppliedInVal);
|
|
42
|
-
} else if (val.includes("@{globalTheme}")) val.replace("@{globalTheme}", globalThemeForced);
|
|
43
|
-
return (0, import_scratch.getMediaTheme)(val, `@${props.themeModifier || globalTheme}`);
|
|
44
|
-
},
|
|
45
|
-
color: (val, element) => {
|
|
46
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
47
|
-
if (!val) return;
|
|
48
|
-
return {
|
|
49
|
-
color: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
background: (val, element) => {
|
|
53
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
54
|
-
if (!val) return;
|
|
55
|
-
return {
|
|
56
|
-
background: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
backgroundColor: (val, element) => {
|
|
60
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
61
|
-
if (!val) return;
|
|
62
|
-
return {
|
|
63
|
-
backgroundColor: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
backgroundImage: (val, element, s, ctx) => {
|
|
67
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
68
|
-
if (!val) return;
|
|
69
|
-
const file = ctx.files && ctx.files[val];
|
|
70
|
-
if (file && file.content) val = file.content.src;
|
|
71
|
-
return {
|
|
72
|
-
backgroundImage: (0, import_scratch.transformBackgroundImage)(val, globalTheme)
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
textStroke: (val) => ({
|
|
76
|
-
WebkitTextStroke: (0, import_scratch.transformTextStroke)(val)
|
|
77
|
-
}),
|
|
78
|
-
outline: (val) => ({
|
|
79
|
-
outline: (0, import_scratch.transformBorder)(val)
|
|
80
|
-
}),
|
|
81
|
-
outlineOffset: (val, { props }) => (0, import_scratch.transformSizeRatio)("outlineOffset", val, props),
|
|
82
|
-
border: (val) => ({
|
|
83
|
-
border: (0, import_scratch.transformBorder)(val)
|
|
84
|
-
}),
|
|
85
|
-
borderColor: (val, element) => {
|
|
86
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
87
|
-
if (!val) return;
|
|
88
|
-
return {
|
|
89
|
-
borderColor: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
borderLeft: (val) => ({
|
|
93
|
-
borderLeft: (0, import_scratch.transformBorder)(val)
|
|
94
|
-
}),
|
|
95
|
-
borderTop: (val) => ({
|
|
96
|
-
borderTop: (0, import_scratch.transformBorder)(val)
|
|
97
|
-
}),
|
|
98
|
-
borderRight: (val) => ({
|
|
99
|
-
borderRight: (0, import_scratch.transformBorder)(val)
|
|
100
|
-
}),
|
|
101
|
-
borderBottom: (val) => ({
|
|
102
|
-
borderBottom: (0, import_scratch.transformBorder)(val)
|
|
103
|
-
}),
|
|
104
|
-
shadow: (val, element) => {
|
|
105
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
106
|
-
if (!val) return;
|
|
107
|
-
return {
|
|
108
|
-
boxShadow: (0, import_scratch.transformShadow)(val, globalTheme)
|
|
109
|
-
};
|
|
110
|
-
},
|
|
111
|
-
boxShadow: (val, element) => {
|
|
112
|
-
if (!(0, import_utils.isString)(val)) return;
|
|
113
|
-
const [value, hasImportant] = val.split("!importan");
|
|
114
|
-
const globalTheme = getSystemGlobalTheme(element);
|
|
115
|
-
const important = hasImportant ? " !important" : "";
|
|
116
|
-
return {
|
|
117
|
-
boxShadow: (0, import_scratch.transformBoxShadow)(value.trim(), globalTheme) + important
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
textShadow: (val, { context }) => ({
|
|
121
|
-
textShadow: (0, import_scratch.transformBoxShadow)(val, context.designSystem.globalTheme)
|
|
122
|
-
}),
|
|
123
|
-
columnRule: (val) => ({
|
|
124
|
-
columnRule: (0, import_scratch.transformBorder)(val)
|
|
125
|
-
})
|
|
126
|
-
};
|
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: (val) => ({
|
|
27
|
-
transition: (0, import_scratch.splitTransition)(val)
|
|
28
|
-
}),
|
|
29
|
-
transitionDuration: (val) => ({
|
|
30
|
-
transitionDuration: (0, import_scratch.transformDuration)(val)
|
|
31
|
-
}),
|
|
32
|
-
transitionDelay: (val) => ({
|
|
33
|
-
transitionDelay: (0, import_scratch.transformDuration)(val)
|
|
34
|
-
}),
|
|
35
|
-
transitionTimingFunction: (val) => ({
|
|
36
|
-
transitionTimingFunction: (0, import_scratch.getTimingFunction)(val)
|
|
37
|
-
}),
|
|
38
|
-
transitionProperty: (val) => ({
|
|
39
|
-
transitionProperty: val,
|
|
40
|
-
willChange: val
|
|
41
|
-
})
|
|
42
|
-
};
|
|
@@ -1,105 +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("@domql/utils");
|
|
28
|
-
var import_props = require("../props");
|
|
29
|
-
var import_defaults = require("../props/defaults");
|
|
30
|
-
var import_transformers = require("./transformers");
|
|
31
|
-
const isProd = (0, import_utils.isProduction)();
|
|
32
|
-
const usePropsAsCSS = (sourceObj, element, opts) => {
|
|
33
|
-
let obj = {};
|
|
34
|
-
const rest = {};
|
|
35
|
-
const setToObj = (key, val) => {
|
|
36
|
-
if (opts.unpack) {
|
|
37
|
-
obj = { ...obj, ...val };
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
obj[key] = val;
|
|
41
|
-
};
|
|
42
|
-
for (const key in sourceObj) {
|
|
43
|
-
const value = sourceObj[key];
|
|
44
|
-
if (key === "class" && element.call("isString", sourceObj.class)) {
|
|
45
|
-
const val = value.split(" ");
|
|
46
|
-
if (val.length) {
|
|
47
|
-
const CLASS = element.context.designSystem.CLASS;
|
|
48
|
-
const result = val.reduce((acc, curr) => (0, import_utils.merge)(acc, CLASS[curr]), {});
|
|
49
|
-
obj.designSystemClass = result;
|
|
50
|
-
}
|
|
51
|
-
} else if (key === "true") {
|
|
52
|
-
const val = (0, import_utils.exec)(value, element);
|
|
53
|
-
(0, import_utils.merge)(obj, (0, import_transformers.applyTrueProps)(val, element));
|
|
54
|
-
} else if (element.classlist[key]) {
|
|
55
|
-
const originalFromClass = element.classlist[key];
|
|
56
|
-
const result = (0, import_utils.isFunction)(originalFromClass) ? originalFromClass(element, element.state, element.context) : originalFromClass;
|
|
57
|
-
if (result) setToObj(key, result);
|
|
58
|
-
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
59
|
-
} else if (import_props.CSS_PROPS_REGISTRY[key]) {
|
|
60
|
-
let val = (0, import_utils.exec)(value, element);
|
|
61
|
-
if ((0, import_utils.isArray)(val)) {
|
|
62
|
-
val = val.reduce((a, c) => (0, import_utils.merge)(a, c), {});
|
|
63
|
-
}
|
|
64
|
-
const result = import_props.CSS_PROPS_REGISTRY[key](val, element, element.state, element.context);
|
|
65
|
-
if (result) setToObj(key, result);
|
|
66
|
-
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
67
|
-
} else if (import_defaults.DEFAULT_CSS_PROPERTIES_LIST.includes(key)) {
|
|
68
|
-
const result = (0, import_utils.exec)(value, element);
|
|
69
|
-
setToObj(key, { [key]: result });
|
|
70
|
-
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
71
|
-
} else {
|
|
72
|
-
rest[key] = value;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return [obj, rest];
|
|
76
|
-
};
|
|
77
|
-
const useSelectorsAsCSS = (sourceObj, element) => {
|
|
78
|
-
const obj = {};
|
|
79
|
-
for (const key in sourceObj) {
|
|
80
|
-
const selectroSetter = import_transformers.transformersByPrefix[key.slice(0, 1)];
|
|
81
|
-
if (selectroSetter) {
|
|
82
|
-
const result = selectroSetter(key, sourceObj[key], element);
|
|
83
|
-
if (result) (0, import_utils.overwriteDeep)(obj, result);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return obj;
|
|
87
|
-
};
|
|
88
|
-
const useCssInProps = (selectorProps, element, opts = { unpack: true }) => {
|
|
89
|
-
const [cssObj, restProps] = usePropsAsCSS(selectorProps, element, opts);
|
|
90
|
-
const selectorsObj = useSelectorsAsCSS(restProps, element);
|
|
91
|
-
if (Object.keys(selectorsObj).length) {
|
|
92
|
-
if (opts.unpack) return (0, import_utils.overwrite)(cssObj, selectorsObj);
|
|
93
|
-
cssObj._selectors = selectorsObj;
|
|
94
|
-
}
|
|
95
|
-
return cssObj;
|
|
96
|
-
};
|
|
97
|
-
const exetuteClassPerComponent = (component, element) => {
|
|
98
|
-
const classObj = {};
|
|
99
|
-
if (component.class) {
|
|
100
|
-
for (const classProp in component.class) {
|
|
101
|
-
classObj[classProp] = component.class[classProp](element);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return classObj;
|
|
105
|
-
};
|
|
@@ -1,18 +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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var transform_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(transform_exports);
|
|
18
|
-
__reExport(transform_exports, require("./executors"), module.exports);
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var transformers_exports = {};
|
|
20
|
-
__export(transformers_exports, {
|
|
21
|
-
applyTrueProps: () => applyTrueProps,
|
|
22
|
-
transformersByPrefix: () => transformersByPrefix
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(transformers_exports);
|
|
25
|
-
var import_executors = require("./executors");
|
|
26
|
-
const applyMediaProps = (key, selectorProps, element) => {
|
|
27
|
-
var _a;
|
|
28
|
-
const { context } = element;
|
|
29
|
-
if (!((_a = context.designSystem) == null ? void 0 : _a.MEDIA)) return;
|
|
30
|
-
const mediaValue = context.designSystem.MEDIA[key.slice(1)];
|
|
31
|
-
const generatedClass = (0, import_executors.useCssInProps)(selectorProps, element);
|
|
32
|
-
const mediaKey = mediaValue ? "@media " + (mediaValue === "print" ? mediaValue : `screen and ${mediaValue}`) : key;
|
|
33
|
-
return { [mediaKey]: generatedClass };
|
|
34
|
-
};
|
|
35
|
-
const applyAndProps = (key, selectorProps, element) => {
|
|
36
|
-
return { [key]: (0, import_executors.useCssInProps)(selectorProps, element) };
|
|
37
|
-
};
|
|
38
|
-
const applySelectorProps = (key, selectorProps, element) => {
|
|
39
|
-
const selectorKey = `&${key}`;
|
|
40
|
-
return { [selectorKey]: (0, import_executors.useCssInProps)(selectorProps, element) };
|
|
41
|
-
};
|
|
42
|
-
const applyCaseProps = (key, selectorProps, element) => {
|
|
43
|
-
var _a;
|
|
44
|
-
const { CASES } = ((_a = element.context) == null ? void 0 : _a.designSystem) || {};
|
|
45
|
-
const caseKey = key.slice(1);
|
|
46
|
-
const isCaseTrue = !(CASES == null ? void 0 : CASES[caseKey]) && !element.props[caseKey];
|
|
47
|
-
if (!isCaseTrue) return;
|
|
48
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
49
|
-
};
|
|
50
|
-
const applyVariableProps = (key, selectorVal, element) => {
|
|
51
|
-
return { [key]: selectorVal };
|
|
52
|
-
};
|
|
53
|
-
const applyConditionalCaseProps = (key, selectorProps, element) => {
|
|
54
|
-
const caseKey = key.slice(1);
|
|
55
|
-
const isCaseTrue = element.props[caseKey] === true || element.state[caseKey] || element[caseKey];
|
|
56
|
-
if (!isCaseTrue) return;
|
|
57
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
58
|
-
};
|
|
59
|
-
const applyConditionalFalsyProps = (key, selectorProps, element) => {
|
|
60
|
-
const caseKey = key.slice(1);
|
|
61
|
-
const isCaseTrue = element.props[caseKey] === true || element.state[caseKey] || element[caseKey];
|
|
62
|
-
if (isCaseTrue) return;
|
|
63
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
64
|
-
};
|
|
65
|
-
const applyTrueProps = (selectorProps, element) => {
|
|
66
|
-
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
67
|
-
};
|
|
68
|
-
const transformersByPrefix = {
|
|
69
|
-
// Media and theme handlers
|
|
70
|
-
// key, props, result, element, isSubtree
|
|
71
|
-
"@": applyMediaProps,
|
|
72
|
-
// Selector handlers
|
|
73
|
-
":": applySelectorProps,
|
|
74
|
-
"[": applySelectorProps,
|
|
75
|
-
"*": applySelectorProps,
|
|
76
|
-
"+": applySelectorProps,
|
|
77
|
-
"~": applySelectorProps,
|
|
78
|
-
"&": applyAndProps,
|
|
79
|
-
">": applyAndProps,
|
|
80
|
-
// Conditional and variable handlers
|
|
81
|
-
$: applyCaseProps,
|
|
82
|
-
"-": applyVariableProps,
|
|
83
|
-
".": applyConditionalCaseProps,
|
|
84
|
-
"!": applyConditionalFalsyProps
|
|
85
|
-
};
|