css-in-props 3.4.5 → 3.4.9
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/props/animation.js +121 -0
- package/dist/cjs/props/block.js +179 -0
- package/dist/cjs/props/defaults.js +340 -0
- package/dist/cjs/props/flex.js +45 -0
- package/dist/cjs/props/font.js +36 -0
- package/dist/cjs/props/grid.js +39 -0
- package/dist/cjs/props/index.js +56 -0
- package/dist/cjs/props/misc.js +35 -0
- package/dist/cjs/props/position.js +51 -0
- package/dist/cjs/props/theme.js +149 -0
- package/dist/cjs/props/timing.js +42 -0
- package/dist/cjs/transform/executors.js +111 -0
- package/dist/cjs/transform/index.js +18 -0
- package/dist/cjs/transform/transformers.js +81 -0
- package/dist/esm/props/animation.js +101 -0
- package/dist/esm/props/block.js +165 -0
- package/dist/esm/props/defaults.js +321 -0
- package/dist/esm/props/flex.js +25 -0
- package/dist/esm/props/font.js +16 -0
- package/dist/esm/props/grid.js +19 -0
- package/dist/esm/props/index.js +35 -0
- package/dist/esm/props/misc.js +15 -0
- package/dist/esm/props/position.js +31 -0
- package/dist/esm/props/theme.js +139 -0
- package/dist/esm/props/timing.js +26 -0
- package/dist/esm/transform/executors.js +91 -0
- package/dist/esm/transform/index.js +1 -0
- package/dist/esm/transform/transformers.js +61 -0
- package/package.json +10 -10
|
@@ -0,0 +1,36 @@
|
|
|
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 font_exports = {};
|
|
20
|
+
__export(font_exports, {
|
|
21
|
+
FONT_PROPS: () => FONT_PROPS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(font_exports);
|
|
24
|
+
var import_scratch = require("@symbo.ls/scratch");
|
|
25
|
+
const FONT_PROPS = {
|
|
26
|
+
fontSize: (value) => {
|
|
27
|
+
return (0, import_scratch.getFontSizeByKey)(value) || value;
|
|
28
|
+
},
|
|
29
|
+
fontFamily: (value) => ({
|
|
30
|
+
fontFamily: (0, import_scratch.getFontFamily)(value) || value
|
|
31
|
+
}),
|
|
32
|
+
fontWeight: (value) => ({
|
|
33
|
+
fontWeight: value,
|
|
34
|
+
fontVariationSettings: '"wght" ' + value
|
|
35
|
+
})
|
|
36
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var grid_exports = {};
|
|
20
|
+
__export(grid_exports, {
|
|
21
|
+
GRID_PROPS: () => GRID_PROPS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(grid_exports);
|
|
24
|
+
const GRID_PROPS = {
|
|
25
|
+
area: (value) => ({ gridArea: value }),
|
|
26
|
+
template: (value) => ({ gridTemplate: value }),
|
|
27
|
+
templateAreas: (value) => ({ gridTemplateAreas: value }),
|
|
28
|
+
column: (value) => ({ gridColumn: value }),
|
|
29
|
+
columns: (value) => ({ gridTemplateColumns: value }),
|
|
30
|
+
templateColumns: (value) => ({ gridTemplateColumns: value }),
|
|
31
|
+
autoColumns: (value) => ({ gridAutoColumns: value }),
|
|
32
|
+
columnStart: (value) => ({ gridColumnStart: value }),
|
|
33
|
+
row: (value) => ({ gridRow: value }),
|
|
34
|
+
rows: (value) => ({ gridTemplateRows: value }),
|
|
35
|
+
templateRows: (value) => ({ gridTemplateRows: value }),
|
|
36
|
+
autoRows: (value) => ({ gridAutoRows: value }),
|
|
37
|
+
rowStart: (value) => ({ gridRowStart: value }),
|
|
38
|
+
autoFlow: (value) => ({ gridAutoFlow: value })
|
|
39
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var props_exports = {};
|
|
21
|
+
__export(props_exports, {
|
|
22
|
+
CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY,
|
|
23
|
+
default: () => props_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(props_exports);
|
|
26
|
+
var import_animation = require("./animation");
|
|
27
|
+
var import_block = require("./block");
|
|
28
|
+
var import_font = require("./font");
|
|
29
|
+
var import_misc = require("./misc");
|
|
30
|
+
var import_position = require("./position");
|
|
31
|
+
var import_theme = require("./theme");
|
|
32
|
+
var import_timing = require("./timing");
|
|
33
|
+
var import_flex = require("./flex");
|
|
34
|
+
var import_grid = require("./grid");
|
|
35
|
+
__reExport(props_exports, require("./animation"), module.exports);
|
|
36
|
+
__reExport(props_exports, require("./block"), module.exports);
|
|
37
|
+
__reExport(props_exports, require("./font"), module.exports);
|
|
38
|
+
__reExport(props_exports, require("./misc"), module.exports);
|
|
39
|
+
__reExport(props_exports, require("./position"), module.exports);
|
|
40
|
+
__reExport(props_exports, require("./theme"), module.exports);
|
|
41
|
+
__reExport(props_exports, require("./timing"), module.exports);
|
|
42
|
+
__reExport(props_exports, require("./flex"), module.exports);
|
|
43
|
+
__reExport(props_exports, require("./grid"), module.exports);
|
|
44
|
+
const CSS_PROPS_REGISTRY = {
|
|
45
|
+
...import_animation.ANIMATION_PROPS,
|
|
46
|
+
...import_block.BLOCK_PROPS,
|
|
47
|
+
...import_font.FONT_PROPS,
|
|
48
|
+
...import_misc.MISC_PROPS,
|
|
49
|
+
...import_misc.MISC_PROPS,
|
|
50
|
+
...import_position.POSITION_PROPS,
|
|
51
|
+
...import_theme.THEME_PROPS,
|
|
52
|
+
...import_timing.TIMING_PROPS,
|
|
53
|
+
...import_flex.FLEX_PROPS,
|
|
54
|
+
...import_grid.GRID_PROPS
|
|
55
|
+
};
|
|
56
|
+
var props_default = CSS_PROPS_REGISTRY;
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
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 theme = state?.root?.globalTheme || context.designSystem?.globalTheme;
|
|
29
|
+
return theme === "auto" ? null : theme;
|
|
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
|
+
if ((0, import_utils.isString)(val) && val.includes("gradient")) {
|
|
56
|
+
return { background: (0, import_scratch.resolveColorsInGradient)(val, globalTheme) };
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
background: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
backgroundColor: (val, element) => {
|
|
63
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
64
|
+
if (!val) return;
|
|
65
|
+
return {
|
|
66
|
+
backgroundColor: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
backgroundImage: (val, element, s, ctx) => {
|
|
70
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
71
|
+
if (!val) return;
|
|
72
|
+
const file = ctx.files && ctx.files[val];
|
|
73
|
+
if (file && file.content) val = file.content.src;
|
|
74
|
+
return {
|
|
75
|
+
backgroundImage: (0, import_scratch.transformBackgroundImage)(val, globalTheme)
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
textStroke: (val) => ({
|
|
79
|
+
WebkitTextStroke: (0, import_scratch.transformTextStroke)(val)
|
|
80
|
+
}),
|
|
81
|
+
outline: (val) => ({
|
|
82
|
+
outline: (0, import_scratch.transformBorder)(val)
|
|
83
|
+
}),
|
|
84
|
+
outlineOffset: (val, { props }) => (0, import_scratch.transformSizeRatio)("outlineOffset", val, props),
|
|
85
|
+
border: (val) => ({
|
|
86
|
+
border: (0, import_scratch.transformBorder)(val)
|
|
87
|
+
}),
|
|
88
|
+
borderColor: (val, element) => {
|
|
89
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
90
|
+
if (!val) return;
|
|
91
|
+
return {
|
|
92
|
+
borderColor: (0, import_scratch.getMediaColor)(val, globalTheme)
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
borderTopColor: (val, element) => {
|
|
96
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
97
|
+
if (!val) return;
|
|
98
|
+
return { borderTopColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
99
|
+
},
|
|
100
|
+
borderBottomColor: (val, element) => {
|
|
101
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
102
|
+
if (!val) return;
|
|
103
|
+
return { borderBottomColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
104
|
+
},
|
|
105
|
+
borderLeftColor: (val, element) => {
|
|
106
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
107
|
+
if (!val) return;
|
|
108
|
+
return { borderLeftColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
109
|
+
},
|
|
110
|
+
borderRightColor: (val, element) => {
|
|
111
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
112
|
+
if (!val) return;
|
|
113
|
+
return { borderRightColor: (0, import_scratch.getMediaColor)(val, globalTheme) };
|
|
114
|
+
},
|
|
115
|
+
borderLeft: (val) => ({
|
|
116
|
+
borderLeft: (0, import_scratch.transformBorder)(val)
|
|
117
|
+
}),
|
|
118
|
+
borderTop: (val) => ({
|
|
119
|
+
borderTop: (0, import_scratch.transformBorder)(val)
|
|
120
|
+
}),
|
|
121
|
+
borderRight: (val) => ({
|
|
122
|
+
borderRight: (0, import_scratch.transformBorder)(val)
|
|
123
|
+
}),
|
|
124
|
+
borderBottom: (val) => ({
|
|
125
|
+
borderBottom: (0, import_scratch.transformBorder)(val)
|
|
126
|
+
}),
|
|
127
|
+
shadow: (val, element) => {
|
|
128
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
129
|
+
if (!val) return;
|
|
130
|
+
return {
|
|
131
|
+
boxShadow: (0, import_scratch.transformShadow)(val, globalTheme)
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
boxShadow: (val, element) => {
|
|
135
|
+
if (!(0, import_utils.isString)(val)) return;
|
|
136
|
+
const [value, hasImportant] = val.split("!importan");
|
|
137
|
+
const globalTheme = getSystemGlobalTheme(element);
|
|
138
|
+
const important = hasImportant ? " !important" : "";
|
|
139
|
+
return {
|
|
140
|
+
boxShadow: (0, import_scratch.transformBoxShadow)(value.trim(), globalTheme) + important
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
textShadow: (val, { context }) => ({
|
|
144
|
+
textShadow: (0, import_scratch.transformBoxShadow)(val, context.designSystem.globalTheme)
|
|
145
|
+
}),
|
|
146
|
+
columnRule: (val) => ({
|
|
147
|
+
columnRule: (0, import_scratch.transformBorder)(val)
|
|
148
|
+
})
|
|
149
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
let result = import_props.CSS_PROPS_REGISTRY[key](val, element, element.state, element.context);
|
|
65
|
+
if ((0, import_utils.isArray)(result)) result = result.reduce((a, c) => (0, import_utils.merge)(a, c), {});
|
|
66
|
+
if (result) setToObj(key, result);
|
|
67
|
+
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
68
|
+
} else if (import_defaults.DEFAULT_CSS_PROPERTIES_LIST.has(key)) {
|
|
69
|
+
const result = (0, import_utils.exec)(value, element);
|
|
70
|
+
setToObj(key, { [key]: result });
|
|
71
|
+
if (!isProd && (0, import_utils.isObject)(obj[key])) obj[key].label = key;
|
|
72
|
+
} else {
|
|
73
|
+
rest[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [obj, rest];
|
|
77
|
+
};
|
|
78
|
+
const useSelectorsAsCSS = (sourceObj, element) => {
|
|
79
|
+
const obj = {};
|
|
80
|
+
for (const key in sourceObj) {
|
|
81
|
+
const selectroSetter = import_transformers.transformersByPrefix[key.slice(0, 1)];
|
|
82
|
+
if (selectroSetter) {
|
|
83
|
+
const result = selectroSetter(key, sourceObj[key], element);
|
|
84
|
+
if (result) (0, import_utils.overwriteDeep)(obj, result);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return obj;
|
|
88
|
+
};
|
|
89
|
+
const useCssInProps = (selectorProps, element, opts = { unpack: true }) => {
|
|
90
|
+
const [cssObj, restProps] = usePropsAsCSS(selectorProps, element, opts);
|
|
91
|
+
const selectorsObj = useSelectorsAsCSS(restProps, element);
|
|
92
|
+
let hasSelectors = false;
|
|
93
|
+
for (const _k in selectorsObj) {
|
|
94
|
+
hasSelectors = true;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
if (hasSelectors) {
|
|
98
|
+
if (opts.unpack) return (0, import_utils.overwrite)(cssObj, selectorsObj);
|
|
99
|
+
cssObj._selectors = selectorsObj;
|
|
100
|
+
}
|
|
101
|
+
return cssObj;
|
|
102
|
+
};
|
|
103
|
+
const exetuteClassPerComponent = (component, element) => {
|
|
104
|
+
const classObj = {};
|
|
105
|
+
if (component.class) {
|
|
106
|
+
for (const classProp in component.class) {
|
|
107
|
+
classObj[classProp] = component.class[classProp](element);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return classObj;
|
|
111
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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);
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
const { context } = element;
|
|
28
|
+
if (!context.designSystem?.MEDIA) return;
|
|
29
|
+
const mediaValue = context.designSystem.MEDIA[key.slice(1)];
|
|
30
|
+
const generatedClass = (0, import_executors.useCssInProps)(selectorProps, element);
|
|
31
|
+
const mediaKey = mediaValue ? "@media " + (mediaValue === "print" ? mediaValue : `screen and ${mediaValue}`) : key;
|
|
32
|
+
return { [mediaKey]: generatedClass };
|
|
33
|
+
};
|
|
34
|
+
const applyAndProps = (key, selectorProps, element) => {
|
|
35
|
+
return { [key]: (0, import_executors.useCssInProps)(selectorProps, element) };
|
|
36
|
+
};
|
|
37
|
+
const applySelectorProps = (key, selectorProps, element) => {
|
|
38
|
+
const selectorKey = `&${key}`;
|
|
39
|
+
return { [selectorKey]: (0, import_executors.useCssInProps)(selectorProps, element) };
|
|
40
|
+
};
|
|
41
|
+
const applyCaseProps = (key, selectorProps, element) => {
|
|
42
|
+
const { CASES } = element.context?.designSystem || {};
|
|
43
|
+
const caseKey = key.slice(1);
|
|
44
|
+
const isCaseTrue = !CASES?.[caseKey] && !element.props[caseKey];
|
|
45
|
+
if (!isCaseTrue) return;
|
|
46
|
+
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
47
|
+
};
|
|
48
|
+
const applyVariableProps = (key, selectorVal, element) => {
|
|
49
|
+
return { [key]: selectorVal };
|
|
50
|
+
};
|
|
51
|
+
const applyConditionalCaseProps = (key, selectorProps, element) => {
|
|
52
|
+
const caseKey = key.slice(1);
|
|
53
|
+
const isCaseTrue = element.props[caseKey] === true || element.state[caseKey] || element[caseKey];
|
|
54
|
+
if (!isCaseTrue) return;
|
|
55
|
+
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
56
|
+
};
|
|
57
|
+
const applyConditionalFalsyProps = (key, selectorProps, element) => {
|
|
58
|
+
const caseKey = key.slice(1);
|
|
59
|
+
const isCaseTrue = element.props[caseKey] === true || element.state[caseKey] || element[caseKey];
|
|
60
|
+
if (isCaseTrue) return;
|
|
61
|
+
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
62
|
+
};
|
|
63
|
+
const applyTrueProps = (selectorProps, element) => {
|
|
64
|
+
return (0, import_executors.useCssInProps)(selectorProps, element);
|
|
65
|
+
};
|
|
66
|
+
const transformersByPrefix = {
|
|
67
|
+
"@": applyMediaProps,
|
|
68
|
+
// Selector handlers
|
|
69
|
+
":": applySelectorProps,
|
|
70
|
+
"[": applySelectorProps,
|
|
71
|
+
"*": applySelectorProps,
|
|
72
|
+
"+": applySelectorProps,
|
|
73
|
+
"~": applySelectorProps,
|
|
74
|
+
"&": applyAndProps,
|
|
75
|
+
">": applyAndProps,
|
|
76
|
+
// Conditional and variable handlers
|
|
77
|
+
$: applyCaseProps,
|
|
78
|
+
"-": applyVariableProps,
|
|
79
|
+
".": applyConditionalCaseProps,
|
|
80
|
+
"!": applyConditionalFalsyProps
|
|
81
|
+
};
|