@evlop/commons 1.0.103 → 1.0.104
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/helpers/index.d.ts +1 -0
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/index.js +1 -0
- package/dist/src/helpers/index.js.map +1 -1
- package/dist/src/helpers/themeHelpers.d.ts +16 -0
- package/dist/src/helpers/themeHelpers.d.ts.map +1 -0
- package/dist/src/helpers/themeHelpers.js +84 -0
- package/dist/src/helpers/themeHelpers.js.map +1 -0
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
@@ -13,4 +13,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
require("./handlebarHelpers");
|
14
14
|
__exportStar(require("./functions"), exports);
|
15
15
|
__exportStar(require("./commonStyles"), exports);
|
16
|
+
__exportStar(require("./themeHelpers"), exports);
|
16
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8BAA4B;AAC5B,8CAA4B;AAC5B,iDAA+B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8BAA4B;AAC5B,8CAA4B;AAC5B,iDAA+B;AAC/B,iDAA+B"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export declare const generateSizeScale: (baseSize: number, variants: {
|
2
|
+
scale: number;
|
3
|
+
name: string;
|
4
|
+
}[]) => {};
|
5
|
+
export declare const fontVariations: {
|
6
|
+
scale: number;
|
7
|
+
name: string;
|
8
|
+
}[];
|
9
|
+
export declare const generateFontSizes: (baseFont: number) => {};
|
10
|
+
export declare const spacingVariations: {
|
11
|
+
scale: number;
|
12
|
+
name: string;
|
13
|
+
}[];
|
14
|
+
export declare const generateSpacingSizes: (baseSpacing: number) => {};
|
15
|
+
export declare function getColorVariants(colors: Object[]): Object[];
|
16
|
+
//# sourceMappingURL=themeHelpers.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"themeHelpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/themeHelpers.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,aAAa,MAAM,YAAY;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAK,MAAM,CAAA;CAAC,EAAE,OAGpF,CAAC;AAGP,eAAO,MAAM,cAAc;;;GAa1B,CAAA;AAED,eAAO,MAAM,iBAAiB,aAAc,MAAM,OAAgD,CAAC;AAGnG,eAAO,MAAM,iBAAiB;;;GAc7B,CAAA;AAED,eAAO,MAAM,oBAAoB,gBAAiB,MAAM,OAAsD,CAAC;AAI/G,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,YAoChD"}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getColorVariants = exports.generateSpacingSizes = exports.spacingVariations = exports.generateFontSizes = exports.fontVariations = exports.generateSizeScale = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const polished_1 = require("polished");
|
6
|
+
const generateSizeScale = (baseSize, variants) => variants.reduce((sizes, { name, scale }) => {
|
7
|
+
sizes[name] = baseSize * scale;
|
8
|
+
return sizes;
|
9
|
+
}, {});
|
10
|
+
exports.generateSizeScale = generateSizeScale;
|
11
|
+
// font sizes
|
12
|
+
exports.fontVariations = [
|
13
|
+
{ scale: 7 / 16, name: 'xxxs' },
|
14
|
+
{ scale: 9 / 16, name: 'xxs' },
|
15
|
+
{ scale: 10 / 16, name: 'xs' },
|
16
|
+
{ scale: 13 / 16, name: 'sm' },
|
17
|
+
{ scale: 16 / 16, name: 'md' },
|
18
|
+
{ scale: 18 / 16, name: 'lg' },
|
19
|
+
{ scale: 24 / 16, name: 'xl' },
|
20
|
+
{ scale: 32 / 16, name: 'xxl' },
|
21
|
+
{ scale: 40 / 16, name: 'xxxl' },
|
22
|
+
{ scale: 48 / 16, name: 'xxxxl' },
|
23
|
+
{ scale: 60 / 16, name: 'xxxxxl' },
|
24
|
+
{ scale: 72 / 16, name: 'xxxxxxl' },
|
25
|
+
];
|
26
|
+
const generateFontSizes = (baseFont) => exports.generateSizeScale(baseFont, exports.fontVariations);
|
27
|
+
exports.generateFontSizes = generateFontSizes;
|
28
|
+
// spacing
|
29
|
+
exports.spacingVariations = [
|
30
|
+
{ scale: 0 / 16, name: 'none' },
|
31
|
+
{ scale: 2 / 16, name: 'xxxs' },
|
32
|
+
{ scale: 4 / 16, name: 'xxs' },
|
33
|
+
{ scale: 8 / 16, name: 'xs' },
|
34
|
+
{ scale: 12 / 16, name: 'sm' },
|
35
|
+
{ scale: 16 / 16, name: 'md' },
|
36
|
+
{ scale: 18 / 16, name: 'lg' },
|
37
|
+
{ scale: 24 / 16, name: 'xl' },
|
38
|
+
{ scale: 32 / 16, name: 'xxl' },
|
39
|
+
{ scale: 40 / 16, name: 'xxxl' },
|
40
|
+
{ scale: 48 / 16, name: 'xxxxl' },
|
41
|
+
{ scale: 64 / 16, name: 'xxxxxl' },
|
42
|
+
{ scale: 72 / 16, name: 'xxxxxxl' },
|
43
|
+
];
|
44
|
+
const generateSpacingSizes = (baseSpacing) => exports.generateSizeScale(baseSpacing, exports.spacingVariations);
|
45
|
+
exports.generateSpacingSizes = generateSpacingSizes;
|
46
|
+
// colors
|
47
|
+
function getColorVariants(colors) {
|
48
|
+
return new Proxy(colors, {
|
49
|
+
get: (target, color) => {
|
50
|
+
const colorParams = lodash_1.split(color, '-');
|
51
|
+
let resultColor = target[colorParams.shift()];
|
52
|
+
if (!resultColor)
|
53
|
+
return;
|
54
|
+
while (!lodash_1.isEmpty(colorParams) && resultColor) {
|
55
|
+
const op = colorParams.shift();
|
56
|
+
switch (op) {
|
57
|
+
case 'lighten':
|
58
|
+
const lightenAmount = +colorParams.shift() / 100;
|
59
|
+
resultColor = polished_1.lighten(lightenAmount, resultColor);
|
60
|
+
break;
|
61
|
+
case 'darken':
|
62
|
+
const darkenAmount = +colorParams.shift() / 100;
|
63
|
+
resultColor = polished_1.darken(darkenAmount, resultColor);
|
64
|
+
break;
|
65
|
+
case 'transparentize':
|
66
|
+
const transparentizeAmount = +colorParams.shift() / 100;
|
67
|
+
resultColor = polished_1.transparentize(transparentizeAmount, resultColor);
|
68
|
+
break;
|
69
|
+
case 'invert':
|
70
|
+
resultColor = lodash_1.invert(resultColor);
|
71
|
+
break;
|
72
|
+
case 'grayscale':
|
73
|
+
resultColor = polished_1.grayscale(resultColor);
|
74
|
+
break;
|
75
|
+
default:
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return resultColor;
|
79
|
+
},
|
80
|
+
set() { return false; }
|
81
|
+
});
|
82
|
+
}
|
83
|
+
exports.getColorVariants = getColorVariants;
|
84
|
+
//# sourceMappingURL=themeHelpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"themeHelpers.js","sourceRoot":"","sources":["../../../src/helpers/themeHelpers.tsx"],"names":[],"mappings":";;;AAAA,mCAAgD;AAChD,uCAAsE;AAE/D,MAAM,iBAAiB,GAAG,CAAC,QAAe,EAAE,QAAuC,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC,EAAC,EAAE;IACnI,KAAK,CAAC,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