@front10/helpers 2.0.17 → 2.0.19
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/BuildClass/BuildClass.js +36 -9
- package/dist/ThemeBuilder/ThemeBuilder.js +101 -173
- package/dist/front10-helpers.js +1 -1
- package/dist/front10-helpers.js.map +1 -1
- package/dist/front10-helpers.mjs +1 -1
- package/dist/front10-helpers.mjs.map +1 -1
- package/dist/front10-helpers.umd.js +1 -1
- package/dist/front10-helpers.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -832,21 +832,48 @@ var buildClass = function buildClass(props) {
|
|
|
832
832
|
var result = content;
|
|
833
833
|
|
|
834
834
|
if (propName === "@theme") {
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
835
|
+
if (propValue && Array.isArray(propValue)) {
|
|
836
|
+
propValue.forEach(function (item) {
|
|
837
|
+
var result = content;
|
|
838
|
+
var newItem = item;
|
|
839
|
+
newItem = (0, _ThemeProvider.getValueFromPath)("@theme:".concat(newItem), tokenTheme) || {};
|
|
840
|
+
Object.keys(newItem).map(function (k) {
|
|
841
|
+
result += "".concat(k, ":").concat(newItem[k], ";");
|
|
842
|
+
});
|
|
843
|
+
content = result;
|
|
844
|
+
});
|
|
845
|
+
result = content;
|
|
846
|
+
} else {
|
|
847
|
+
var path = propValue;
|
|
848
|
+
|
|
849
|
+
if (!propValue.startsWith("@theme:")) {
|
|
850
|
+
path = "@theme:".concat(path);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
var valueFromPath = (0, _ThemeProvider.getValueFromPath)(path, tokenTheme) || {};
|
|
854
|
+
Object.keys(valueFromPath).map(function (k) {
|
|
855
|
+
result += "".concat(k, ":").concat(valueFromPath[k], ";");
|
|
856
|
+
});
|
|
857
|
+
}
|
|
841
858
|
} else if (typeof propValue === "string" && propValue.startsWith("@theme:")) {
|
|
842
859
|
var _valueFromPath = (0, _ThemeProvider.getValueFromPath)(propValue, tokenTheme);
|
|
843
860
|
|
|
844
|
-
if (_valueFromPath)
|
|
861
|
+
if (_valueFromPath) {
|
|
862
|
+
result = "".concat(content).concat(propName, ":").concat(_valueFromPath, ";");
|
|
863
|
+
} else if ((0, _canI.canIExecuteClientCode)()) {
|
|
864
|
+
console.warn("Design token ".concat(propValue, " not found in theme."));
|
|
865
|
+
}
|
|
845
866
|
} else if (typeof propValue === "string" && propValue.includes("@palette:")) {
|
|
846
867
|
var _valueFromPalette = (0, _ThemeProvider.getFromPalette)(propValue, tokenTheme);
|
|
847
868
|
|
|
848
|
-
if (_valueFromPalette)
|
|
849
|
-
|
|
869
|
+
if (_valueFromPalette) {
|
|
870
|
+
result = "".concat(content).concat(propName, ":").concat(_valueFromPalette, ";");
|
|
871
|
+
} else if ((0, _canI.canIExecuteClientCode)()) {
|
|
872
|
+
console.warn("Palette color ".concat(propValue, " not found in theme."));
|
|
873
|
+
}
|
|
874
|
+
} else if (propValue) {
|
|
875
|
+
result = "".concat(content).concat(propName, ":").concat(propValue, ";");
|
|
876
|
+
}
|
|
850
877
|
|
|
851
878
|
return result;
|
|
852
879
|
}, ""), "}");
|
|
@@ -12,78 +12,33 @@ var _canI = require("../canI");
|
|
|
12
12
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
13
|
|
|
14
14
|
var generateTypographyStyles = function generateTypographyStyles(typography) {
|
|
15
|
-
var style
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
name: item,
|
|
30
|
-
outputType: "string"
|
|
31
|
-
};
|
|
15
|
+
var style = "";
|
|
16
|
+
|
|
17
|
+
if (typography.css && typeof typography.css === "string") {
|
|
18
|
+
style += typography.css;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (typography.fonts && _typeof(typography.fonts) === "object") {
|
|
22
|
+
Object.keys(typography.fonts).map(function (fontName) {
|
|
23
|
+
if (_typeof(typography.fonts[fontName]) === "object") {
|
|
24
|
+
if (typography.fonts[fontName].preset) style += "@import url('".concat(typography.fonts[fontName].preset, "');");else if (Array.isArray(typography.fonts[fontName].src)) {
|
|
25
|
+
style += "@font-face {\n font-family: '".concat(typography.fonts[fontName].alias ? typography.fonts[fontName].alias : fontName, "';\n ").concat(typography.fonts[fontName].fontStyle ? "font-style:".concat(typography.fonts[fontName].fontStyle, ";") : "", "\n ").concat(typography.fonts[fontName].fontWeight ? "font-weight:".concat(typography.fonts[fontName].fontWeight, ";") : "", "\n ").concat(typography.fonts[fontName].fontDisplay ? "font-display:".concat(typography.fonts[fontName].fontDisplay, ";") : "", "\n src:");
|
|
26
|
+
typography.fonts[fontName].local && typography.fonts[fontName].local.forEach(function (local) {
|
|
27
|
+
style += "local('".concat(local, "'),");
|
|
32
28
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
headers: {
|
|
36
|
-
Accept: "application/json",
|
|
37
|
-
"Content-Type": "application/json"
|
|
38
|
-
},
|
|
39
|
-
method: "POST",
|
|
40
|
-
body: JSON.stringify({
|
|
41
|
-
fonts: dataFonts
|
|
42
|
-
})
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
case 5:
|
|
46
|
-
rawResponse = _context.sent;
|
|
47
|
-
_context.next = 8;
|
|
48
|
-
return regeneratorRuntime.awrap(rawResponse.json());
|
|
49
|
-
|
|
50
|
-
case 8:
|
|
51
|
-
cssObject = _context.sent;
|
|
52
|
-
css = "";
|
|
53
|
-
Object.keys(cssObject).forEach(function (item) {
|
|
54
|
-
css += cssObject[item].css;
|
|
29
|
+
typography.fonts[fontName].src.forEach(function (fontSrc, index) {
|
|
30
|
+
style += "url('".concat(fontSrc.url, "') format('").concat(fontSrc.format, "')").concat(index < typography.fonts[fontName].src.length - 1 ? "," : "");
|
|
55
31
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Object.keys(typography.fonts).map(function (fontName) {
|
|
61
|
-
if (_typeof(typography.fonts[fontName]) === "object") {
|
|
62
|
-
if (typography.fonts[fontName].preset) style += "@import url('".concat(typography.fonts[fontName].preset, "');");else if (Array.isArray(typography.fonts[fontName].src)) {
|
|
63
|
-
style += "@font-face {\n font-family: '".concat(typography.fonts[fontName].alias ? typography.fonts[fontName].alias : fontName, "';\n ").concat(typography.fonts[fontName].fontStyle ? "font-style:".concat(typography.fonts[fontName].fontStyle, ";") : "", "\n ").concat(typography.fonts[fontName].fontWeight ? "font-weight:".concat(typography.fonts[fontName].fontWeight, ";") : "", "\n ").concat(typography.fonts[fontName].fontDisplay ? "font-display:".concat(typography.fonts[fontName].fontDisplay, ";") : "", "\n src:");
|
|
64
|
-
typography.fonts[fontName].local && typography.fonts[fontName].local.forEach(function (local) {
|
|
65
|
-
style += "local('".concat(local, "'),");
|
|
66
|
-
});
|
|
67
|
-
typography.fonts[fontName].src.forEach(function (fontSrc, index) {
|
|
68
|
-
style += "url('".concat(fontSrc.url, "') format('").concat(fontSrc.format, "')").concat(index < typography.fonts[fontName].src.length - 1 ? "," : "");
|
|
69
|
-
});
|
|
70
|
-
style += "}";
|
|
71
|
-
}
|
|
72
|
-
style += ".fr-font-name-".concat(fontName.toLocaleLowerCase().replace(/ /g, "-"), "{font-family: '").concat(typography.fonts[fontName].alias ? typography.fonts[fontName].alias : fontName, "', 'sans-serif'}");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return fontName;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
32
|
+
style += "}";
|
|
33
|
+
}
|
|
34
|
+
style += ".fr-font-name-".concat(fontName.toLocaleLowerCase().replace(/ /g, "-"), "{font-family: '").concat(typography.fonts[fontName].alias ? typography.fonts[fontName].alias : fontName, "', 'sans-serif'}");
|
|
35
|
+
}
|
|
78
36
|
|
|
79
|
-
|
|
37
|
+
return fontName;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
80
40
|
|
|
81
|
-
|
|
82
|
-
case "end":
|
|
83
|
-
return _context.stop();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
41
|
+
return style;
|
|
87
42
|
};
|
|
88
43
|
|
|
89
44
|
var generateStylesPalette = function generateStylesPalette(palette, item, i) {
|
|
@@ -110,121 +65,94 @@ var generateStylesPalette = function generateStylesPalette(palette, item, i) {
|
|
|
110
65
|
};
|
|
111
66
|
|
|
112
67
|
var initTheme = function initTheme(theme) {
|
|
113
|
-
var generatedStyles
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!theme) {
|
|
133
|
-
_context2.next = 15;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (!theme.typography) {
|
|
138
|
-
_context2.next = 13;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
_context2.t0 = generatedStyles;
|
|
143
|
-
_context2.next = 11;
|
|
144
|
-
return regeneratorRuntime.awrap(generateTypographyStyles(theme.typography));
|
|
145
|
-
|
|
146
|
-
case 11:
|
|
147
|
-
_context2.t1 = _context2.sent;
|
|
148
|
-
|
|
149
|
-
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
150
|
-
|
|
151
|
-
case 13:
|
|
152
|
-
if (theme.colors) {
|
|
153
|
-
generatedStyles.push(["button.fr-btn:disabled{\n background-color:".concat(theme.components && theme.components.button && theme.components.button.disabled && theme.components.button.disabled.bgColor ? theme.components.button.disabled.bgColor : "#d4d4d4", ";\n border-color:").concat(theme.components && theme.components.button && theme.components.button.disabled && theme.components.button.disabled.bgColor ? theme.components.button.disabled.bgColor : "#d4d4d4", ";\n color:").concat(theme.components && theme.components.button && theme.components.button.disabled && theme.components.button.disabled.bgColor ? theme.components.button.disabled.bgColor : "#afafaf", "\n }\n ")]);
|
|
154
|
-
themeColorsKeys = Object.keys(theme.colors);
|
|
155
|
-
|
|
156
|
-
for (index = 0; index < themeColorsKeys.length; index += 1) {
|
|
157
|
-
colorName = themeColorsKeys[index];
|
|
158
|
-
colorValue = theme.colors[themeColorsKeys[index]];
|
|
159
|
-
|
|
160
|
-
if (colorValue !== "none") {
|
|
161
|
-
(function () {
|
|
162
|
-
// Adding base color to palette
|
|
163
|
-
themeToken.palette["".concat(colorName)] = colorValue;
|
|
164
|
-
var palette = (0, _Color.generatePalette)(colorValue, colorName);
|
|
165
|
-
|
|
166
|
-
if (theme.config && theme.config.generatePalette) {
|
|
167
|
-
palette.forEach(function (item, i) {
|
|
168
|
-
// Adding color variations to the palette
|
|
169
|
-
themeToken.palette["".concat(item.name)] = item.color; // Avoiding executing unnecessary code that is not needed in the SSR
|
|
170
|
-
|
|
171
|
-
if ((0, _canI.canIExecuteClientCode)()) {
|
|
172
|
-
var styles = generateStylesPalette(palette, item, i);
|
|
173
|
-
generatedStyles.push(styles.replace(/\n. |\r/g, ""));
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
} else {
|
|
177
|
-
if ((0, _canI.canIExecuteClientCode)()) {
|
|
178
|
-
var styles = generateStylesPalette(palette, {
|
|
179
|
-
color: colorValue,
|
|
180
|
-
name: colorName,
|
|
181
|
-
textColor: (0, _Color.getContrast)(colorValue)
|
|
182
|
-
}, 11);
|
|
183
|
-
generatedStyles.push(styles.replace(/\n. |\r/g, ""));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
})();
|
|
187
|
-
}
|
|
188
|
-
}
|
|
68
|
+
var generatedStyles = [];
|
|
69
|
+
var themeToken = {
|
|
70
|
+
palette: {},
|
|
71
|
+
designTokens: theme.designTokens || {}
|
|
72
|
+
};
|
|
73
|
+
var outputFields = [];
|
|
74
|
+
|
|
75
|
+
if (theme.config && theme.config.outputFields) {
|
|
76
|
+
outputFields = theme.config.outputFields;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (outputFields.includes("colors")) themeToken.colors = theme.colors;
|
|
80
|
+
if (outputFields.includes("typography")) themeToken.typography = theme.typography;
|
|
81
|
+
|
|
82
|
+
if (theme) {
|
|
83
|
+
if (theme.typography) {
|
|
84
|
+
generatedStyles.push(generateTypographyStyles(theme.typography));
|
|
85
|
+
}
|
|
189
86
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
87
|
+
if (theme.colors) {
|
|
88
|
+
generatedStyles.push(["button.fr-btn:disabled{\n background-color:".concat(theme.components && theme.components.button && theme.components.button.disabled && theme.components.button.disabled.bgColor ? theme.components.button.disabled.bgColor : "#d4d4d4", ";\n border-color:").concat(theme.components && theme.components.button && theme.components.button.disabled && theme.components.button.disabled.bgColor ? theme.components.button.disabled.bgColor : "#d4d4d4", ";\n color:").concat(theme.components && theme.components.button && theme.components.button.disabled && theme.components.button.disabled.bgColor ? theme.components.button.disabled.bgColor : "#afafaf", "\n }\n ")]);
|
|
89
|
+
var themeColorsKeys = Object.keys(theme.colors);
|
|
90
|
+
|
|
91
|
+
for (var index = 0; index < themeColorsKeys.length; index += 1) {
|
|
92
|
+
var colorName = themeColorsKeys[index];
|
|
93
|
+
var colorValue = theme.colors[themeColorsKeys[index]];
|
|
94
|
+
|
|
95
|
+
if (colorValue !== "none") {
|
|
96
|
+
(function () {
|
|
97
|
+
// Adding base color to palette
|
|
98
|
+
themeToken.palette["".concat(colorName)] = colorValue;
|
|
99
|
+
var palette = (0, _Color.generatePalette)(colorValue, colorName);
|
|
195
100
|
|
|
196
|
-
|
|
197
|
-
|
|
101
|
+
if (theme.config && theme.config.generatePalette) {
|
|
102
|
+
palette.forEach(function (item, i) {
|
|
103
|
+
// Adding color variations to the palette
|
|
104
|
+
themeToken.palette["".concat(item.name)] = item.color; // Avoiding executing unnecessary code that is not needed in the SSR
|
|
198
105
|
|
|
199
|
-
|
|
200
|
-
|
|
106
|
+
if ((0, _canI.canIExecuteClientCode)()) {
|
|
107
|
+
var styles = generateStylesPalette(palette, item, i);
|
|
108
|
+
generatedStyles.push(styles.replace(/\n. |\r/g, ""));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
201
111
|
} else {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// This is required for IE8 and below.
|
|
210
|
-
style.styleSheet.cssText = themeStyleNode;
|
|
211
|
-
} else {
|
|
212
|
-
style.appendChild(document.createTextNode(themeStyleNode));
|
|
112
|
+
if ((0, _canI.canIExecuteClientCode)()) {
|
|
113
|
+
var styles = generateStylesPalette(palette, {
|
|
114
|
+
color: colorValue,
|
|
115
|
+
name: colorName,
|
|
116
|
+
textColor: (0, _Color.getContrast)(colorValue)
|
|
117
|
+
}, 11);
|
|
118
|
+
generatedStyles.push(styles.replace(/\n. |\r/g, ""));
|
|
213
119
|
}
|
|
214
|
-
|
|
215
|
-
body.appendChild(style);
|
|
216
120
|
}
|
|
217
|
-
}
|
|
121
|
+
})();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
218
124
|
|
|
219
|
-
|
|
220
|
-
|
|
125
|
+
if (theme.colors.primary) {
|
|
126
|
+
var primaryHover = (0, _Color.hexToRGBA)(theme.colors.primary, 0.25);
|
|
127
|
+
generatedStyles.push(".fr-focus:focus, .fr-form-control:focus, .fr-focus\\:focus{box-shadow: 0 0 0 0.2rem ".concat(primaryHover, ";outline: 0;}"));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
221
130
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
131
|
+
if ((0, _canI.canIExecuteClientCode)() && typeof document != "undefined") {
|
|
132
|
+
var element = document.getElementById("frTheming");
|
|
133
|
+
|
|
134
|
+
if (element) {
|
|
135
|
+
element.innerHTML = generatedStyles.join(" ");
|
|
136
|
+
} else {
|
|
137
|
+
var themeStyleNode = "".concat(generatedStyles.join(" "));
|
|
138
|
+
var body = document.body || document.getElementsByTagName("body")[0];
|
|
139
|
+
var style = document.createElement("style");
|
|
140
|
+
style.type = "text/css";
|
|
141
|
+
style.id = "frTheming";
|
|
142
|
+
|
|
143
|
+
if (style.styleSheet) {
|
|
144
|
+
// This is required for IE8 and below.
|
|
145
|
+
style.styleSheet.cssText = themeStyleNode;
|
|
146
|
+
} else {
|
|
147
|
+
style.appendChild(document.createTextNode(themeStyleNode));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
body.appendChild(style);
|
|
225
151
|
}
|
|
226
152
|
}
|
|
227
|
-
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return themeToken;
|
|
228
156
|
};
|
|
229
157
|
|
|
230
158
|
exports.initTheme = initTheme;
|
package/dist/front10-helpers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o=function(o){var n=o.toString(16);return 1===n.length?"0"+n:n},n=function(o,n){var t;return void 0===n&&(n=.5),!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(t=o.substring(1).split("")).length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]),"rgba("+((t="0x"+t.join(""))>>16&255)+","+(t>>8&255)+","+(255&t)+","+n+")")},t=function(o){var n;return!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(n=o.substring(1).split("")).length&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),{r:(n="0x"+n.join(""))>>16&255,g:n>>8&255,b:255&n})},r=function(o){var n=t(o);return!!n&&((299*n.r+587*n.g+114*n.b)/1e3>=128?"#000000":"#FFFFFF")},e=function(o,n,t){return o/n*t},a=function(n,r){var a,l,
|
|
1
|
+
var o=function(o){var n=o.toString(16);return 1===n.length?"0"+n:n},n=function(o,n){var t;return void 0===n&&(n=.5),!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(t=o.substring(1).split("")).length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]),"rgba("+((t="0x"+t.join(""))>>16&255)+","+(t>>8&255)+","+(255&t)+","+n+")")},t=function(o){var n;return!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(n=o.substring(1).split("")).length&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),{r:(n="0x"+n.join(""))>>16&255,g:n>>8&255,b:255&n})},r=function(o){var n=t(o);return!!n&&((299*n.r+587*n.g+114*n.b)/1e3>=128?"#000000":"#FFFFFF")},e=function(o,n,t){return o/n*t},a=function(n,r){var a,l,c=t(n),i={};return!!c&&(r<0?(i.r=c.r-parseInt(c.r/100*-r,10),i.g=c.g-parseInt(c.g/100*-r,10),i.b=c.b-parseInt(c.b/100*-r,10)):(i.r=parseInt(e(255-c.r,100,r),10)+c.r,i.g=parseInt(e(255-c.g,100,r),10)+c.g,i.b=parseInt(e(255-c.b,100,r),10)+c.b),a=i.g,l=i.b,"#"+o(i.r)+o(a)+o(l))},l=function(o,n,e){void 0===e&&(e=22);var l=100/Math.ceil(e/2),c=l*Math.floor(e/2),i=[];if(t(o))for(var f=0;f<e;f+=1){var s=a(o,c-f*l),d=r(s);i.push({name:f>e/2?n+"-"+f:f===e/2?n:n+"-"+(f+1),color:s,textColor:d})}return i},c=function(){return"undefined"!=typeof window},i=function(o,t,r){var e=t.color,a=t.color,l=t.color,c=t.color,i=t.color,f=t.textColor,s=t.textColor,d=t.color,b=t.textColor;return o[r+2]?a=o[r+2].color:o[r-2]&&(a=o[r-2].color),o[r+1]?l=o[r+1].color:o[r-1]&&(l=o[r-1].color),o[r+2]?c=o[r+2].color:o[r-2]&&(c=o[r-2].color),o[r+4]?i=o[r+4].color:o[r-4]&&(i=o[r-4].color),o[r+4]?f=o[r+4].textColor:o[r-4]&&(f=o[r-4].textColor),o[r+2]?e=o[r+2].color:o[r-2]&&(e=o[r-2].color),o[r+2]?s=o[r+2].textColor:o[r-2]&&(s=o[r-2].textColor),o[r+3]?d=o[r+3].color:o[r-3]&&(d=o[r-3].color),o[r+3]?b=o[r+3].textColor:o[r-3]&&(b=o[r-3].textColor),"\n button.fr-btn-"+t.name+"{\n background-color:"+t.color+";\n border-color:"+t.color+";\n color:"+t.textColor+" !important;\n }\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):hover{\n background-color:"+e+";\n border-color:"+e+";\n color:"+s+"\n }\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-"+t.name+".fr-dropdown-toggle{\n color: "+b+";\n background-color: "+d+";\n border-color: "+d+";\n }\n .fr-border-"+t.name+"{border-color: "+t.color+" !important;}\n .fr-bg-"+t.name+"{background-color: "+t.color+" !important;}\n .gradient.fr-bg-"+t.name+",fr-btn-outline-"+t.name+":hover,\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,"+t.color+","+a+");\n }\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,"+t.color+","+l+");\n color: "+t.textColor+";\n }\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,"+c+","+i+");\n color: "+f+";\n }\n .fr-text-"+t.name+"{color: "+t.color+" !important;}\n .fr-btn-outline-"+t.name+"{\n color: "+t.color+";\n border-color: "+t.color+";\n }\n .fr-btn-outline-"+t.name+":hover{\n color: "+t.textColor+";\n background-color: "+t.color+";\n border-color: "+t.color+";\n }\n .fr-btn-outline-"+t.name+".fr-disabled,\n .fr-btn-outline-"+t.name+":disabled{\n color: "+t.color+" !important;\n background-color: transparent !important;\n border-color: "+t.color+" !important;\n }\n .fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-"+t.name+".fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem "+n(t.color)+";\n }\n .fr-btn-"+t.name+":focus, .fr-btn-outline-"+t.name+":focus{\n box-shadow: 0 0 0 0.2rem "+n(t.color)+";\n }\n .fr-component-hover-"+t.name+":hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:"+t.textColor+" !important;\n }\n .fr-component-hover-"+t.name+":hover:not(button){\n background-color:"+t.color+" !important;\n border-color:"+e+" !important;\n }\n .fr-icon.fr-i-"+t.name+" path{\n fill: "+t.color+";\n }\n .fr-btn-"+t.name+" .fr-icon path{\n fill: "+t.textColor+";\n }\n"};"undefined"!=typeof window&&(window.FR||(window.FR={}),window.FR.initTheme=function(o){var t=[],e={palette:{},designTokens:o.designTokens||{}},a=[];if(o.config&&o.config.outputFields&&(a=o.config.outputFields),a.includes("colors")&&(e.colors=o.colors),a.includes("typography")&&(e.typography=o.typography),o){if(o.typography&&t.push(function(o){var n="";return o.css&&"string"==typeof o.css&&(n+=o.css),o.fonts&&"object"==typeof o.fonts&&Object.keys(o.fonts).map(function(t){return"object"==typeof o.fonts[t]&&(o.fonts[t].preset?n+="@import url('"+o.fonts[t].preset+"');":Array.isArray(o.fonts[t].src)&&(n+="@font-face {\n font-family: '"+(o.fonts[t].alias?o.fonts[t].alias:t)+"';\n "+(o.fonts[t].fontStyle?"font-style:"+o.fonts[t].fontStyle+";":"")+"\n "+(o.fonts[t].fontWeight?"font-weight:"+o.fonts[t].fontWeight+";":"")+"\n "+(o.fonts[t].fontDisplay?"font-display:"+o.fonts[t].fontDisplay+";":"")+"\n src:",o.fonts[t].local&&o.fonts[t].local.forEach(function(o){n+="local('"+o+"'),"}),o.fonts[t].src.forEach(function(r,e){n+="url('"+r.url+"') format('"+r.format+"')"+(e<o.fonts[t].src.length-1?",":"")}),n+="}"),n+=".fr-font-name-"+t.toLocaleLowerCase().replace(/ /g,"-")+"{font-family: '"+(o.fonts[t].alias?o.fonts[t].alias:t)+"', 'sans-serif'}"),t}),n}(o.typography)),o.colors){t.push(["button.fr-btn:disabled{\n background-color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#d4d4d4")+";\n border-color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#d4d4d4")+";\n color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#afafaf")+"\n }\n "]);for(var f=Object.keys(o.colors),s=0;s<f.length;s+=1){var d=f[s],b=o.colors[f[s]];if("none"!==b){e.palette[""+d]=b;var u=l(b,d);if(o.config&&o.config.generatePalette)u.forEach(function(o,n){if(e.palette[""+o.name]=o.color,c()){var r=i(u,o,n);t.push(r.replace(/\n. |\r/g,""))}});else if(c()){var m=i(u,{color:b,name:d,textColor:r(b)},11);t.push(m.replace(/\n. |\r/g,""))}}}if(o.colors.primary){var p=n(o.colors.primary,.25);t.push(".fr-focus:focus, .fr-form-control:focus, .fr-focus\\:focus{box-shadow: 0 0 0 0.2rem "+p+";outline: 0;}")}}if(c()&&"undefined"!=typeof document){var g=document.getElementById("frTheming");if(g)g.innerHTML=t.join(" ");else{var h=""+t.join(" "),v=document.body||document.getElementsByTagName("body")[0],y=document.createElement("style");y.type="text/css",y.id="frTheming",y.styleSheet?y.styleSheet.cssText=h:y.appendChild(document.createTextNode(h)),v.appendChild(y)}}}return e});
|
|
2
2
|
//# sourceMappingURL=front10-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front10-helpers.js","sources":["../src/Color/Color.js","../src/canI/canI.js","../src/ThemeBuilder/ThemeBuilder.js","../src/index.js"],"sourcesContent":["const componentToHex = c => {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n};\n\nconst rgb2Hex = (r, g, b) =>\n `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;\n\nconst hexToRGBA = (hex, alpha = 0.5) => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n return `rgba(${(c >> 16) & 255},${(c >> 8) & 255},${c & 255},${alpha})`;\n } else {\n // console.error(\"Bad Hex:\", hex, \"Alpha: \", alpha);\n return false;\n }\n};\n\nconst isColor = color => {\n if (hex2RGB(color)) return true;\n else return false;\n};\n\nconst hex2RGB = hex => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n // eslint-disable-next-line no-bitwise\n return { r: (c >> 16) & 255, g: (c >> 8) & 255, b: c & 255 };\n } else {\n return false;\n // throw new Error(\"Bad Hex\");\n }\n};\n\n// https://24ways.org/2010/calculating-color-contrast\n// https://www.w3.org/WAI/ER/WD-AERT/#color-contrast\nconst getContrast = hexColor => {\n const rgb = hex2RGB(hexColor);\n if (rgb) {\n const yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n return yiq >= 128 ? \"#000000\" : \"#FFFFFF\";\n } else return false;\n};\n\nconst variacion = (H, Z, value) => {\n return (H / Z) * value;\n};\n\n// https://www.w3.org/TR/WCAG20/#relativeluminancedef\nconst colorBrightness = (color, value) => {\n const rgb = hex2RGB(color);\n const t = {};\n if (rgb) {\n if (value < 0) {\n t.r = rgb.r - parseInt((rgb.r / 100) * -value, 10);\n t.g = rgb.g - parseInt((rgb.g / 100) * -value, 10);\n t.b = rgb.b - parseInt((rgb.b / 100) * -value, 10);\n } else {\n t.r = parseInt(variacion(255 - rgb.r, 100, value), 10) + rgb.r;\n t.g = parseInt(variacion(255 - rgb.g, 100, value), 10) + rgb.g;\n t.b = parseInt(variacion(255 - rgb.b, 100, value), 10) + rgb.b;\n }\n return rgb2Hex(t.r, t.g, t.b);\n } else return false;\n};\n\n/**\n * Function to generate a colors palette.\n * This function return a array of colors\n * in the following format: [{color: 'string', textColor: 'string', name: 'string' }]\n * @param {string} hexColor Color in hexadecimal format\n * @param {string} name Name of color\n * @param {integer} cantShape Cant of variations\n */\nconst generatePalette = (hexColor, name, cantShape = 22) => {\n const step = 100 / Math.ceil(cantShape / 2);\n const startVal = step * Math.floor(cantShape / 2);\n const colors = [];\n if (isColor(hexColor)) {\n for (let i = 0; i < cantShape; i += 1) {\n const color = colorBrightness(hexColor, startVal - i * step);\n const textColor = getContrast(color);\n let tmpName;\n if (i > cantShape / 2) tmpName = `${name}-${i}`;\n else if (i === cantShape / 2) tmpName = name;\n else tmpName = `${name}-${i + 1}`;\n colors.push({\n name: tmpName,\n color,\n textColor\n });\n }\n }\n return colors;\n};\n\nexport { generatePalette, getContrast, hex2RGB, hexToRGBA, rgb2Hex, isColor };\n","const subscribersMap = {};\nconst addedGlobalEventListeners = false;\n\n/**\n * Returns an element\n * @param {*} elementSelector\n */\nconst getElement = elementSelector => {\n return document.querySelector(elementSelector);\n};\n\n/**\n * Iterate through the listeners list and try to resolve\n * the promise if they are visible in the viewport\n * TODO: Fix the viewport detection part\n */\nconst resolveListeners = () => {\n const subscribersKeyList = Object.keys(subscribersMap);\n if (subscribersKeyList.length > 0) {\n for (let index = 0; index < subscribersKeyList.length; index++) {\n const key = subscribersKeyList[index];\n if (subscribersMap[key]) {\n //Only full load component when is visible in viewport\n if (isElementInViewport(getElement(key))) {\n subscribersMap[key].resolve(true);\n subscribersMap[key] = null;\n delete subscribersMap[key];\n }\n }\n }\n }\n};\n\n/**\n * Helper function to simulate a setInterval but\n * wthout hurting the browser performance\n * @param {*} fn\n * @param {*} delay\n */\nconst requestInterval = (fn, delay) => {\n const requestAnimFrame = (() => {\n return (\n window.requestAnimationFrame ||\n function hello(callback) {\n window.setTimeout(callback, 1000 / 60);\n }\n );\n })();\n let start = new Date().getTime();\n const handle = {};\n function loop() {\n handle.value = requestAnimFrame(loop);\n const current = new Date().getTime();\n const delta = current - start;\n if (delta >= delay) {\n fn.call();\n start = new Date().getTime();\n }\n }\n handle.value = requestAnimFrame(loop);\n return handle;\n};\n\n/**\n * Try to resolve all listeners once an\n * user wants to play with the components\n * this heuristics are very basic, we should\n * find better ones.\n */\nconst addGlobalEventListeners = () => {\n window.addEventListener(\"scroll\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"click\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"mousemove\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"keydown\", () => {\n resolveListeners();\n });\n\n requestInterval(() => {\n resolveListeners();\n }, 2000);\n};\n\n/**\n * Returns the DocElement\n */\nconst getDocElement = () => {\n if (window !== undefined) {\n return window.document.documentElement;\n }\n return false;\n};\n\n/**\n * Obtaining the viewport height\n * @method _getViewportH\n * @return ConditionalExpression\n */\nconst getViewportH = () => {\n const client = getDocElement.clientHeight;\n const inner = window.innerHeight;\n return client < inner ? inner : client;\n};\n\n/**\n * The offset of the element\n * @method _getOffset\n * @param {} el\n * @return ObjectExpression\n */\nconst getOffset = el => {\n let offsetTop = 0;\n let offsetLeft = 0;\n /* eslint-disable */\n do {\n if (!isNaN(el.offsetTop)) {\n offsetTop += el.offsetTop;\n }\n if (!isNaN(el.offsetLeft)) {\n offsetLeft += el.offsetLeft;\n }\n } while ((el = el.offsetParent));\n /* eslint-enable */\n return {\n top: offsetTop,\n left: offsetLeft\n };\n};\n\n/**\n * Return true if the element if visible in a viewport zone\n * @param {} el\n * @param {} h\n * @return LogicalExpression\n */\nconst isElementInViewport = el => {\n if (canIExecuteClientCode() && el) {\n let element = el;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n while (element.offsetParent) {\n element = element.offsetParent;\n top += element.offsetTop;\n left += element.offsetLeft;\n }\n\n return (\n top < window.pageYOffset + window.innerHeight &&\n left < window.pageXOffset + window.innerWidth &&\n top + height > window.pageYOffset &&\n left + width > window.pageXOffset\n );\n }\n};\n\n/**\n * Returns a promise that resolves once the initial\n * browser processing is done. This allows to save\n * the users that uses low cpu devices and also have\n * awesome results in Google Page Speed\n * @param {*} elementSelector\n * @param {*} inSSR\n */\nconst canILiftOff = (elementSelector, inSSR = true) => {\n return new Promise(resolve => {\n // we don't need to wait in SSR\n if (window === undefined && inSSR) {\n resolve(true);\n } else {\n // adds global listeners that will trigger\n // once a real person is interacting with the browser\n if (!addedGlobalEventListeners) {\n addGlobalEventListeners();\n }\n // saving all the component instances subscriptions\n subscribersMap[elementSelector] = {\n resolve\n };\n }\n });\n};\n\nconst canIExecuteClientCode = () => {\n return typeof window !== \"undefined\";\n};\n\nexport { canILiftOff, isElementInViewport, canIExecuteClientCode };\n","import { generatePalette, hexToRGBA, getContrast } from \"../Color\";\nimport { canIExecuteClientCode } from \"../canI\";\n\nconst generateTypographyStyles = async (typography) => {\n let style = \"\";\n if (typeof typography === \"object\" && Array.isArray(typography)) {\n const dataFonts = typography.map((item) => {\n return {\n name: item,\n outputType: \"string\"\n };\n });\n const rawResponse = await fetch(\n \"https://em-font-service-prod.airtrfx.com\",\n {\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n },\n method: \"POST\",\n body: JSON.stringify({\n fonts: dataFonts\n })\n }\n );\n\n const cssObject = await rawResponse.json();\n let css = \"\";\n Object.keys(cssObject).forEach((item) => {\n css += cssObject[item].css;\n });\n return css;\n }\n if (typography.fonts && typeof typography.fonts === \"object\") {\n Object.keys(typography.fonts).map((fontName) => {\n if (typeof typography.fonts[fontName] === \"object\") {\n if (typography.fonts[fontName].preset)\n style += `@import url('${typography.fonts[fontName].preset}');`;\n else if (Array.isArray(typography.fonts[fontName].src)) {\n style += `@font-face {\n font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }';\n ${\n typography.fonts[fontName].fontStyle\n ? `font-style:${typography.fonts[fontName].fontStyle};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontWeight\n ? `font-weight:${typography.fonts[fontName].fontWeight};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontDisplay\n ? `font-display:${typography.fonts[fontName].fontDisplay};`\n : \"\"\n }\n src:`;\n\n typography.fonts[fontName].local &&\n typography.fonts[fontName].local.forEach((local) => {\n style += `local('${local}'),`;\n });\n typography.fonts[fontName].src.forEach((fontSrc, index) => {\n style += `url('${fontSrc.url}') format('${fontSrc.format}')${\n index < typography.fonts[fontName].src.length - 1 ? \",\" : \"\"\n }`;\n });\n style += \"}\";\n }\n style += `.fr-font-name-${fontName\n .toLocaleLowerCase()\n .replace(/ /g, \"-\")}{font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }', 'sans-serif'}`;\n }\n return fontName;\n });\n }\n return style;\n};\n\nconst generateStylesPalette = (palette, item, i) => {\n let hoverBgColor = item.color;\n let gradientTo = item.color;\n let gradientButtonToHover = item.color;\n let gradientButtonFromActive = item.color;\n let gradientButtonToActive = item.color;\n let gradientButtonTextActive = item.textColor;\n let hoverColor = item.textColor;\n let activeBgColor = item.color;\n let activeColor = item.textColor;\n\n if (palette[i + 2]) gradientTo = palette[i + 2].color;\n else if (palette[i - 2]) gradientTo = palette[i - 2].color;\n\n if (palette[i + 1]) gradientButtonToHover = palette[i + 1].color;\n else if (palette[i - 1]) gradientButtonToHover = palette[i - 1].color;\n\n if (palette[i + 2]) gradientButtonFromActive = palette[i + 2].color;\n else if (palette[i - 2]) gradientButtonFromActive = palette[i - 2].color;\n\n if (palette[i + 4]) gradientButtonToActive = palette[i + 4].color;\n else if (palette[i - 4]) gradientButtonToActive = palette[i - 4].color;\n\n if (palette[i + 4]) gradientButtonTextActive = palette[i + 4].textColor;\n else if (palette[i - 4]) gradientButtonTextActive = palette[i - 4].textColor;\n\n if (palette[i + 2]) hoverBgColor = palette[i + 2].color;\n else if (palette[i - 2]) hoverBgColor = palette[i - 2].color;\n\n if (palette[i + 2]) hoverColor = palette[i + 2].textColor;\n else if (palette[i - 2]) hoverColor = palette[i - 2].textColor;\n\n if (palette[i + 3]) activeBgColor = palette[i + 3].color;\n else if (palette[i - 3]) activeBgColor = palette[i - 3].color;\n\n if (palette[i + 3]) activeColor = palette[i + 3].textColor;\n else if (palette[i - 3]) activeColor = palette[i - 3].textColor;\n const styles = `\n button.fr-btn-${item.name}{\n background-color:${item.color};\n border-color:${item.color};\n color:${item.textColor} !important;\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover{\n background-color:${hoverBgColor};\n border-color:${hoverBgColor};\n color:${hoverColor}\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle{\n color: ${activeColor};\n background-color: ${activeBgColor};\n border-color: ${activeBgColor};\n }\n .fr-border-${item.name}{border-color: ${item.color} !important;}\n .fr-bg-${item.name}{background-color: ${item.color} !important;}\n .gradient.fr-bg-${item.name},fr-btn-outline-${item.name}:hover,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,${item.color},${gradientTo});\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,${\n item.color\n },${gradientButtonToHover});\n color: ${item.textColor};\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,${gradientButtonFromActive},${gradientButtonToActive});\n color: ${gradientButtonTextActive};\n }\n .fr-text-${item.name}{color: ${item.color} !important;}\n .fr-btn-outline-${item.name}{\n color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}:hover{\n color: ${item.textColor};\n background-color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}.fr-disabled,\n .fr-btn-outline-${item.name}:disabled{\n color: ${item.color} !important;\n background-color: transparent !important;\n border-color: ${item.color} !important;\n }\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-btn-${item.name}:focus, .fr-btn-outline-${item.name}:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-component-hover-${\n item.name\n }:hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:${item.textColor} !important;\n }\n .fr-component-hover-${item.name}:hover:not(button){\n background-color:${item.color} !important;\n border-color:${hoverBgColor} !important;\n }\n .fr-icon.fr-i-${item.name} path{\n fill: ${item.color};\n }\n .fr-btn-${item.name} .fr-icon path{\n fill: ${item.textColor};\n }\n`;\n return styles;\n};\n\nconst initTheme = async (theme) => {\n const generatedStyles = [];\n const themeToken = {\n palette: {},\n designTokens: theme.designTokens || {}\n };\n\n let outputFields = [];\n if (theme.config && theme.config.outputFields) {\n outputFields = theme.config.outputFields;\n }\n if (outputFields.includes(\"colors\")) themeToken.colors = theme.colors;\n if (outputFields.includes(\"typography\"))\n themeToken.typography = theme.typography;\n if (theme) {\n if (theme.typography) {\n generatedStyles.push(await generateTypographyStyles(theme.typography));\n }\n if (theme.colors) {\n generatedStyles.push([\n `button.fr-btn:disabled{\n background-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n border-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#afafaf\"\n }\n }\n `\n ]);\n const themeColorsKeys = Object.keys(theme.colors);\n for (let index = 0; index < themeColorsKeys.length; index += 1) {\n const colorName = themeColorsKeys[index];\n const colorValue = theme.colors[themeColorsKeys[index]];\n if (colorValue !== \"none\") {\n // Adding base color to palette\n themeToken.palette[`${colorName}`] = colorValue;\n const palette = generatePalette(colorValue, colorName);\n if (theme.config && theme.config.generatePalette) {\n palette.forEach((item, i) => {\n // Adding color variations to the palette\n themeToken.palette[`${item.name}`] = item.color;\n // Avoiding executing unnecessary code that is not needed in the SSR\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(palette, item, i);\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n });\n } else {\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(\n palette,\n {\n color: colorValue,\n name: colorName,\n textColor: getContrast(colorValue)\n },\n 11\n );\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n }\n }\n }\n if (theme.colors.primary) {\n const primaryHover = hexToRGBA(theme.colors.primary, 0.25);\n generatedStyles.push(\n `.fr-focus:focus, .fr-form-control:focus, .fr-focus\\\\:focus{box-shadow: 0 0 0 0.2rem ${primaryHover};outline: 0;}`\n );\n }\n }\n if (canIExecuteClientCode() && typeof document != \"undefined\") {\n const element = document.getElementById(\"frTheming\");\n if (element) {\n element.innerHTML = generatedStyles.join(\" \");\n } else {\n const themeStyleNode = `${generatedStyles.join(\" \")}`;\n\n const body = document.body || document.getElementsByTagName(\"body\")[0];\n const style = document.createElement(\"style\");\n\n style.type = \"text/css\";\n style.id = \"frTheming\";\n if (style.styleSheet) {\n // This is required for IE8 and below.\n style.styleSheet.cssText = themeStyleNode;\n } else {\n style.appendChild(document.createTextNode(themeStyleNode));\n }\n body.appendChild(style);\n }\n }\n }\n return themeToken;\n};\n\nexport { initTheme };\n","import { initTheme } from \"./ThemeBuilder\";\nif(typeof window !== \"undefined\"){\n if(!window.FR) window.FR = {};\n window.FR.initTheme=initTheme;\n}"],"names":["const","componentToHex","c","hex","toString","length","hexToRGBA","alpha","test","substring","split","join","hex2RGB","r","g","b","getContrast","hexColor","rgb","variacion","H","Z","value","colorBrightness","color","t","parseInt","generatePalette","name","cantShape","step","Math","ceil","startVal","floor","colors","let","i","textColor","push","canIExecuteClientCode","window","generateStylesPalette","palette","item","hoverBgColor","gradientTo","gradientButtonToHover","gradientButtonFromActive","gradientButtonToActive","gradientButtonTextActive","hoverColor","activeBgColor","activeColor","FR","initTheme","theme","generatedStyles","themeToken","designTokens","outputFields","config","includes","typography","components","button","disabled","bgColor","themeColorsKeys","Object","keys","index","colorName","colorValue","forEach","styles","replace","primary","primaryHover","document","element","getElementById","innerHTML","themeStyleNode","body","getElementsByTagName","style","createElement","type","id","styleSheet","cssText","appendChild","createTextNode","fonts","map","fontName","preset","Array","isArray","src","alias","fontStyle","fontWeight","fontDisplay","local","fontSrc","toLocaleLowerCase","dataFonts","outputType","fetch","headers","Accept","method","JSON","stringify","rawResponse","json","cssObject","css","generateTypographyStyles"],"mappings":"AAAAA,IAAMC,WAAiBC,OACfC,EAAMD,EAAEE,SAAS,WACD,IAAfD,EAAIE,WAAmBF,EAAQA,GAMlCG,WAAaH,EAAKI,OAClBL,wBAD0B,MAE1B,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,eAEvCA,EAAK,KAAIA,EAAES,KAAK,MACK,GAAM,UAAQT,GAAK,EAAK,UAAW,IAAJA,OAAWK,QAY7DK,WAAUT,OACVD,UACA,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,KAIhC,CAAEW,GAFTX,EAAK,KAAIA,EAAES,KAAK,MAEE,GAAM,IAAKG,EAAIZ,GAAK,EAAK,IAAKa,EAAO,IAAJb,KASjDc,WAAcC,OACZC,EAAMN,EAAQ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,mCAGUC,MACxB,2CACA,CACEC,QAAS,CACPC,OAAQ,kCACQ,oBAElBC,OAAQ,OACR7B,KAAM8B,KAAKC,UAAU,CACnBrB,MAAOc,qBATPQ,0BAckBA,EAAYC,sBAA9BC,OACFC,EAAM,UACVlD,OAAOC,KAAKgD,GAAW5C,iBAAS9B,GAC9B2E,GAAOD,EAAU1E,GAAM2E,WAElBA,8FAyMsBC,CAAyBhE,EAAMO,qCAA1DN,wGA+FGC,IAAAA"}
|
|
1
|
+
{"version":3,"file":"front10-helpers.js","sources":["../src/Color/Color.js","../src/canI/canI.js","../src/ThemeBuilder/ThemeBuilder.js","../src/index.js"],"sourcesContent":["const componentToHex = c => {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n};\n\nconst rgb2Hex = (r, g, b) =>\n `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;\n\nconst hexToRGBA = (hex, alpha = 0.5) => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n return `rgba(${(c >> 16) & 255},${(c >> 8) & 255},${c & 255},${alpha})`;\n } else {\n // console.error(\"Bad Hex:\", hex, \"Alpha: \", alpha);\n return false;\n }\n};\n\nconst isColor = color => {\n if (hex2RGB(color)) return true;\n else return false;\n};\n\nconst hex2RGB = hex => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n // eslint-disable-next-line no-bitwise\n return { r: (c >> 16) & 255, g: (c >> 8) & 255, b: c & 255 };\n } else {\n return false;\n // throw new Error(\"Bad Hex\");\n }\n};\n\n// https://24ways.org/2010/calculating-color-contrast\n// https://www.w3.org/WAI/ER/WD-AERT/#color-contrast\nconst getContrast = hexColor => {\n const rgb = hex2RGB(hexColor);\n if (rgb) {\n const yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n return yiq >= 128 ? \"#000000\" : \"#FFFFFF\";\n } else return false;\n};\n\nconst variacion = (H, Z, value) => {\n return (H / Z) * value;\n};\n\n// https://www.w3.org/TR/WCAG20/#relativeluminancedef\nconst colorBrightness = (color, value) => {\n const rgb = hex2RGB(color);\n const t = {};\n if (rgb) {\n if (value < 0) {\n t.r = rgb.r - parseInt((rgb.r / 100) * -value, 10);\n t.g = rgb.g - parseInt((rgb.g / 100) * -value, 10);\n t.b = rgb.b - parseInt((rgb.b / 100) * -value, 10);\n } else {\n t.r = parseInt(variacion(255 - rgb.r, 100, value), 10) + rgb.r;\n t.g = parseInt(variacion(255 - rgb.g, 100, value), 10) + rgb.g;\n t.b = parseInt(variacion(255 - rgb.b, 100, value), 10) + rgb.b;\n }\n return rgb2Hex(t.r, t.g, t.b);\n } else return false;\n};\n\n/**\n * Function to generate a colors palette.\n * This function return a array of colors\n * in the following format: [{color: 'string', textColor: 'string', name: 'string' }]\n * @param {string} hexColor Color in hexadecimal format\n * @param {string} name Name of color\n * @param {integer} cantShape Cant of variations\n */\nconst generatePalette = (hexColor, name, cantShape = 22) => {\n const step = 100 / Math.ceil(cantShape / 2);\n const startVal = step * Math.floor(cantShape / 2);\n const colors = [];\n if (isColor(hexColor)) {\n for (let i = 0; i < cantShape; i += 1) {\n const color = colorBrightness(hexColor, startVal - i * step);\n const textColor = getContrast(color);\n let tmpName;\n if (i > cantShape / 2) tmpName = `${name}-${i}`;\n else if (i === cantShape / 2) tmpName = name;\n else tmpName = `${name}-${i + 1}`;\n colors.push({\n name: tmpName,\n color,\n textColor\n });\n }\n }\n return colors;\n};\n\nexport { generatePalette, getContrast, hex2RGB, hexToRGBA, rgb2Hex, isColor };\n","const subscribersMap = {};\nconst addedGlobalEventListeners = false;\n\n/**\n * Returns an element\n * @param {*} elementSelector\n */\nconst getElement = elementSelector => {\n return document.querySelector(elementSelector);\n};\n\n/**\n * Iterate through the listeners list and try to resolve\n * the promise if they are visible in the viewport\n * TODO: Fix the viewport detection part\n */\nconst resolveListeners = () => {\n const subscribersKeyList = Object.keys(subscribersMap);\n if (subscribersKeyList.length > 0) {\n for (let index = 0; index < subscribersKeyList.length; index++) {\n const key = subscribersKeyList[index];\n if (subscribersMap[key]) {\n //Only full load component when is visible in viewport\n if (isElementInViewport(getElement(key))) {\n subscribersMap[key].resolve(true);\n subscribersMap[key] = null;\n delete subscribersMap[key];\n }\n }\n }\n }\n};\n\n/**\n * Helper function to simulate a setInterval but\n * wthout hurting the browser performance\n * @param {*} fn\n * @param {*} delay\n */\nconst requestInterval = (fn, delay) => {\n const requestAnimFrame = (() => {\n return (\n window.requestAnimationFrame ||\n function hello(callback) {\n window.setTimeout(callback, 1000 / 60);\n }\n );\n })();\n let start = new Date().getTime();\n const handle = {};\n function loop() {\n handle.value = requestAnimFrame(loop);\n const current = new Date().getTime();\n const delta = current - start;\n if (delta >= delay) {\n fn.call();\n start = new Date().getTime();\n }\n }\n handle.value = requestAnimFrame(loop);\n return handle;\n};\n\n/**\n * Try to resolve all listeners once an\n * user wants to play with the components\n * this heuristics are very basic, we should\n * find better ones.\n */\nconst addGlobalEventListeners = () => {\n window.addEventListener(\"scroll\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"click\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"mousemove\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"keydown\", () => {\n resolveListeners();\n });\n\n requestInterval(() => {\n resolveListeners();\n }, 2000);\n};\n\n/**\n * Returns the DocElement\n */\nconst getDocElement = () => {\n if (window !== undefined) {\n return window.document.documentElement;\n }\n return false;\n};\n\n/**\n * Obtaining the viewport height\n * @method _getViewportH\n * @return ConditionalExpression\n */\nconst getViewportH = () => {\n const client = getDocElement.clientHeight;\n const inner = window.innerHeight;\n return client < inner ? inner : client;\n};\n\n/**\n * The offset of the element\n * @method _getOffset\n * @param {} el\n * @return ObjectExpression\n */\nconst getOffset = el => {\n let offsetTop = 0;\n let offsetLeft = 0;\n /* eslint-disable */\n do {\n if (!isNaN(el.offsetTop)) {\n offsetTop += el.offsetTop;\n }\n if (!isNaN(el.offsetLeft)) {\n offsetLeft += el.offsetLeft;\n }\n } while ((el = el.offsetParent));\n /* eslint-enable */\n return {\n top: offsetTop,\n left: offsetLeft\n };\n};\n\n/**\n * Return true if the element if visible in a viewport zone\n * @param {} el\n * @param {} h\n * @return LogicalExpression\n */\nconst isElementInViewport = el => {\n if (canIExecuteClientCode() && el) {\n let element = el;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n while (element.offsetParent) {\n element = element.offsetParent;\n top += element.offsetTop;\n left += element.offsetLeft;\n }\n\n return (\n top < window.pageYOffset + window.innerHeight &&\n left < window.pageXOffset + window.innerWidth &&\n top + height > window.pageYOffset &&\n left + width > window.pageXOffset\n );\n }\n};\n\n/**\n * Returns a promise that resolves once the initial\n * browser processing is done. This allows to save\n * the users that uses low cpu devices and also have\n * awesome results in Google Page Speed\n * @param {*} elementSelector\n * @param {*} inSSR\n */\nconst canILiftOff = (elementSelector, inSSR = true) => {\n return new Promise(resolve => {\n // we don't need to wait in SSR\n if (window === undefined && inSSR) {\n resolve(true);\n } else {\n // adds global listeners that will trigger\n // once a real person is interacting with the browser\n if (!addedGlobalEventListeners) {\n addGlobalEventListeners();\n }\n // saving all the component instances subscriptions\n subscribersMap[elementSelector] = {\n resolve\n };\n }\n });\n};\n\nconst canIExecuteClientCode = () => {\n return typeof window !== \"undefined\";\n};\n\nexport { canILiftOff, isElementInViewport, canIExecuteClientCode };\n","import { generatePalette, hexToRGBA, getContrast } from \"../Color\";\nimport { canIExecuteClientCode } from \"../canI\";\n\nconst generateTypographyStyles = (typography) => {\n let style = \"\";\n if (typography.css && typeof typography.css === \"string\") {\n style += typography.css;\n }\n if (typography.fonts && typeof typography.fonts === \"object\") {\n Object.keys(typography.fonts).map((fontName) => {\n if (typeof typography.fonts[fontName] === \"object\") {\n if (typography.fonts[fontName].preset)\n style += `@import url('${typography.fonts[fontName].preset}');`;\n else if (Array.isArray(typography.fonts[fontName].src)) {\n style += `@font-face {\n font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }';\n ${\n typography.fonts[fontName].fontStyle\n ? `font-style:${typography.fonts[fontName].fontStyle};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontWeight\n ? `font-weight:${typography.fonts[fontName].fontWeight};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontDisplay\n ? `font-display:${typography.fonts[fontName].fontDisplay};`\n : \"\"\n }\n src:`;\n\n typography.fonts[fontName].local &&\n typography.fonts[fontName].local.forEach((local) => {\n style += `local('${local}'),`;\n });\n typography.fonts[fontName].src.forEach((fontSrc, index) => {\n style += `url('${fontSrc.url}') format('${fontSrc.format}')${\n index < typography.fonts[fontName].src.length - 1 ? \",\" : \"\"\n }`;\n });\n style += \"}\";\n }\n style += `.fr-font-name-${fontName\n .toLocaleLowerCase()\n .replace(/ /g, \"-\")}{font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }', 'sans-serif'}`;\n }\n return fontName;\n });\n }\n return style;\n};\n\nconst generateStylesPalette = (palette, item, i) => {\n let hoverBgColor = item.color;\n let gradientTo = item.color;\n let gradientButtonToHover = item.color;\n let gradientButtonFromActive = item.color;\n let gradientButtonToActive = item.color;\n let gradientButtonTextActive = item.textColor;\n let hoverColor = item.textColor;\n let activeBgColor = item.color;\n let activeColor = item.textColor;\n\n if (palette[i + 2]) gradientTo = palette[i + 2].color;\n else if (palette[i - 2]) gradientTo = palette[i - 2].color;\n\n if (palette[i + 1]) gradientButtonToHover = palette[i + 1].color;\n else if (palette[i - 1]) gradientButtonToHover = palette[i - 1].color;\n\n if (palette[i + 2]) gradientButtonFromActive = palette[i + 2].color;\n else if (palette[i - 2]) gradientButtonFromActive = palette[i - 2].color;\n\n if (palette[i + 4]) gradientButtonToActive = palette[i + 4].color;\n else if (palette[i - 4]) gradientButtonToActive = palette[i - 4].color;\n\n if (palette[i + 4]) gradientButtonTextActive = palette[i + 4].textColor;\n else if (palette[i - 4]) gradientButtonTextActive = palette[i - 4].textColor;\n\n if (palette[i + 2]) hoverBgColor = palette[i + 2].color;\n else if (palette[i - 2]) hoverBgColor = palette[i - 2].color;\n\n if (palette[i + 2]) hoverColor = palette[i + 2].textColor;\n else if (palette[i - 2]) hoverColor = palette[i - 2].textColor;\n\n if (palette[i + 3]) activeBgColor = palette[i + 3].color;\n else if (palette[i - 3]) activeBgColor = palette[i - 3].color;\n\n if (palette[i + 3]) activeColor = palette[i + 3].textColor;\n else if (palette[i - 3]) activeColor = palette[i - 3].textColor;\n const styles = `\n button.fr-btn-${item.name}{\n background-color:${item.color};\n border-color:${item.color};\n color:${item.textColor} !important;\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover{\n background-color:${hoverBgColor};\n border-color:${hoverBgColor};\n color:${hoverColor}\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle{\n color: ${activeColor};\n background-color: ${activeBgColor};\n border-color: ${activeBgColor};\n }\n .fr-border-${item.name}{border-color: ${item.color} !important;}\n .fr-bg-${item.name}{background-color: ${item.color} !important;}\n .gradient.fr-bg-${item.name},fr-btn-outline-${item.name}:hover,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,${item.color},${gradientTo});\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,${\n item.color\n },${gradientButtonToHover});\n color: ${item.textColor};\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,${gradientButtonFromActive},${gradientButtonToActive});\n color: ${gradientButtonTextActive};\n }\n .fr-text-${item.name}{color: ${item.color} !important;}\n .fr-btn-outline-${item.name}{\n color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}:hover{\n color: ${item.textColor};\n background-color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}.fr-disabled,\n .fr-btn-outline-${item.name}:disabled{\n color: ${item.color} !important;\n background-color: transparent !important;\n border-color: ${item.color} !important;\n }\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-btn-${item.name}:focus, .fr-btn-outline-${item.name}:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-component-hover-${\n item.name\n }:hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:${item.textColor} !important;\n }\n .fr-component-hover-${item.name}:hover:not(button){\n background-color:${item.color} !important;\n border-color:${hoverBgColor} !important;\n }\n .fr-icon.fr-i-${item.name} path{\n fill: ${item.color};\n }\n .fr-btn-${item.name} .fr-icon path{\n fill: ${item.textColor};\n }\n`;\n return styles;\n};\n\nconst initTheme = (theme) => {\n const generatedStyles = [];\n const themeToken = {\n palette: {},\n designTokens: theme.designTokens || {}\n };\n\n let outputFields = [];\n if (theme.config && theme.config.outputFields) {\n outputFields = theme.config.outputFields;\n }\n if (outputFields.includes(\"colors\")) themeToken.colors = theme.colors;\n if (outputFields.includes(\"typography\"))\n themeToken.typography = theme.typography;\n if (theme) {\n if (theme.typography) {\n generatedStyles.push(generateTypographyStyles(theme.typography));\n }\n if (theme.colors) {\n generatedStyles.push([\n `button.fr-btn:disabled{\n background-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n border-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#afafaf\"\n }\n }\n `\n ]);\n const themeColorsKeys = Object.keys(theme.colors);\n for (let index = 0; index < themeColorsKeys.length; index += 1) {\n const colorName = themeColorsKeys[index];\n const colorValue = theme.colors[themeColorsKeys[index]];\n if (colorValue !== \"none\") {\n // Adding base color to palette\n themeToken.palette[`${colorName}`] = colorValue;\n const palette = generatePalette(colorValue, colorName);\n if (theme.config && theme.config.generatePalette) {\n palette.forEach((item, i) => {\n // Adding color variations to the palette\n themeToken.palette[`${item.name}`] = item.color;\n // Avoiding executing unnecessary code that is not needed in the SSR\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(palette, item, i);\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n });\n } else {\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(\n palette,\n {\n color: colorValue,\n name: colorName,\n textColor: getContrast(colorValue)\n },\n 11\n );\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n }\n }\n }\n if (theme.colors.primary) {\n const primaryHover = hexToRGBA(theme.colors.primary, 0.25);\n generatedStyles.push(\n `.fr-focus:focus, .fr-form-control:focus, .fr-focus\\\\:focus{box-shadow: 0 0 0 0.2rem ${primaryHover};outline: 0;}`\n );\n }\n }\n if (canIExecuteClientCode() && typeof document != \"undefined\") {\n const element = document.getElementById(\"frTheming\");\n if (element) {\n element.innerHTML = generatedStyles.join(\" \");\n } else {\n const themeStyleNode = `${generatedStyles.join(\" \")}`;\n\n const body = document.body || document.getElementsByTagName(\"body\")[0];\n const style = document.createElement(\"style\");\n\n style.type = \"text/css\";\n style.id = \"frTheming\";\n if (style.styleSheet) {\n // This is required for IE8 and below.\n style.styleSheet.cssText = themeStyleNode;\n } else {\n style.appendChild(document.createTextNode(themeStyleNode));\n }\n body.appendChild(style);\n }\n }\n }\n return themeToken;\n};\n\nexport { initTheme };\n","import { initTheme } from \"./ThemeBuilder\";\nif(typeof window !== \"undefined\"){\n if(!window.FR) window.FR = {};\n window.FR.initTheme=initTheme;\n}"],"names":["const","componentToHex","c","hex","toString","length","hexToRGBA","alpha","test","substring","split","join","hex2RGB","r","g","b","getContrast","hexColor","rgb","variacion","H","Z","value","colorBrightness","color","t","parseInt","generatePalette","name","cantShape","step","Math","ceil","startVal","floor","colors","let","i","textColor","push","canIExecuteClientCode","window","generateStylesPalette","palette","item","hoverBgColor","gradientTo","gradientButtonToHover","gradientButtonFromActive","gradientButtonToActive","gradientButtonTextActive","hoverColor","activeBgColor","activeColor","FR","initTheme","theme","generatedStyles","themeToken","designTokens","outputFields","config","includes","typography","style","css","fonts","Object","keys","map","fontName","preset","Array","isArray","src","alias","fontStyle","fontWeight","fontDisplay","local","forEach","fontSrc","index","toLocaleLowerCase","replace","generateTypographyStyles","components","button","disabled","bgColor","themeColorsKeys","colorName","colorValue","styles","primary","primaryHover","document","element","getElementById","innerHTML","themeStyleNode","body","getElementsByTagName","createElement","type","id","styleSheet","cssText","appendChild","createTextNode"],"mappings":"AAAAA,IAAMC,WAAiBC,OACfC,EAAMD,EAAEE,SAAS,WACD,IAAfD,EAAIE,WAAmBF,EAAQA,GAMlCG,WAAaH,EAAKI,OAClBL,wBAD0B,MAE1B,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,eAEvCA,EAAK,KAAIA,EAAES,KAAK,MACK,GAAM,UAAQT,GAAK,EAAK,UAAW,IAAJA,OAAWK,QAY7DK,WAAUT,OACVD,UACA,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,KAIhC,CAAEW,GAFTX,EAAK,KAAIA,EAAES,KAAK,MAEE,GAAM,IAAKG,EAAIZ,GAAK,EAAK,IAAKa,EAAO,IAAJb,KASjDc,WAAcC,OACZC,EAAMN,EAAQK,WAChBC,KACmB,IAARA,EAAIL,EAAkB,IAARK,EAAIJ,EAAkB,IAARI,EAAIH,GAAW,KAC1C,IAAM,UAAY,YAI9BI,WAAaC,EAAGC,EAAGC,UACfF,EAAIC,EAAKC,GAIbC,WAAmBC,EAAOF,OAtDZR,EAAGC,EAuDfG,EAAMN,EAAQY,GACdC,EAAI,WACNP,IACEI,EAAQ,GACVG,EAAEZ,EAAIK,EAAIL,EAAIa,SAAUR,EAAIL,EAAI,KAAQS,EAAO,IAC/CG,EAAEX,EAAII,EAAIJ,EAAIY,SAAUR,EAAIJ,EAAI,KAAQQ,EAAO,IAC/CG,EAAEV,EAAIG,EAAIH,EAAIW,SAAUR,EAAIH,EAAI,KA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WAAWC,QAAeA,EAAKpB,MAEtCgB,IAAyB,KACrBqD,EAASnD,EAAsBC,EAASC,EAAMP,GACpDoB,EAAgBlB,KAAKsD,EAAOT,QAAQ,WAAY,gBAIhD5C,IAAyB,KACrBqD,EAASnD,EACbC,EACA,CACEnB,MAAOoE,EACPhE,KAAM+D,EACNrD,UAAWtB,EAAY4E,IAEzB,IAEFnC,EAAgBlB,KAAKsD,EAAOT,QAAQ,WAAY,UAKpD5B,EAAMrB,OAAO2D,QAAS,KAClBC,EAAezF,EAAUkD,EAAMrB,OAAO2D,QAAS,KACrDrC,EAAgBlB,4FACyEwD,uBAIzFvD,KAA8C,oBAAZwD,SAAyB,KACvDC,EAAUD,SAASE,eAAe,gBACpCD,EACFA,EAAQE,UAAY1C,EAAgB9C,KAAK,SACpC,KACCyF,EAAkB,GAAE3C,EAAgB9C,KAAK,KAEzC0F,EAAOL,SAASK,MAAQL,SAASM,qBAAqB,QAAQ,GAC9DtC,EAAQgC,SAASO,cAAc,SAErCvC,EAAMwC,KAAO,WACbxC,EAAMyC,GAAK,YACPzC,EAAM0C,WAER1C,EAAM0C,WAAWC,QAAUP,EAE3BpC,EAAM4C,YAAYZ,SAASa,eAAeT,IAE5CC,EAAKO,YAAY5C,YAIhBN"}
|
package/dist/front10-helpers.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o=function(o){var n=o.toString(16);return 1===n.length?"0"+n:n},n=function(o,n){var t;return void 0===n&&(n=.5),!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(t=o.substring(1).split("")).length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]),"rgba("+((t="0x"+t.join(""))>>16&255)+","+(t>>8&255)+","+(255&t)+","+n+")")},t=function(o){var n;return!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(n=o.substring(1).split("")).length&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),{r:(n="0x"+n.join(""))>>16&255,g:n>>8&255,b:255&n})},r=function(o){var n=t(o);return!!n&&((299*n.r+587*n.g+114*n.b)/1e3>=128?"#000000":"#FFFFFF")},e=function(o,n,t){return o/n*t},a=function(n,r){var a,l,
|
|
1
|
+
var o=function(o){var n=o.toString(16);return 1===n.length?"0"+n:n},n=function(o,n){var t;return void 0===n&&(n=.5),!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(t=o.substring(1).split("")).length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]),"rgba("+((t="0x"+t.join(""))>>16&255)+","+(t>>8&255)+","+(255&t)+","+n+")")},t=function(o){var n;return!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(n=o.substring(1).split("")).length&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),{r:(n="0x"+n.join(""))>>16&255,g:n>>8&255,b:255&n})},r=function(o){var n=t(o);return!!n&&((299*n.r+587*n.g+114*n.b)/1e3>=128?"#000000":"#FFFFFF")},e=function(o,n,t){return o/n*t},a=function(n,r){var a,l,c=t(n),i={};return!!c&&(r<0?(i.r=c.r-parseInt(c.r/100*-r,10),i.g=c.g-parseInt(c.g/100*-r,10),i.b=c.b-parseInt(c.b/100*-r,10)):(i.r=parseInt(e(255-c.r,100,r),10)+c.r,i.g=parseInt(e(255-c.g,100,r),10)+c.g,i.b=parseInt(e(255-c.b,100,r),10)+c.b),a=i.g,l=i.b,"#"+o(i.r)+o(a)+o(l))},l=function(o,n,e){void 0===e&&(e=22);var l=100/Math.ceil(e/2),c=l*Math.floor(e/2),i=[];if(t(o))for(var f=0;f<e;f+=1){var s=a(o,c-f*l),d=r(s);i.push({name:f>e/2?n+"-"+f:f===e/2?n:n+"-"+(f+1),color:s,textColor:d})}return i},c=function(){return"undefined"!=typeof window},i=function(o,t,r){var e=t.color,a=t.color,l=t.color,c=t.color,i=t.color,f=t.textColor,s=t.textColor,d=t.color,b=t.textColor;return o[r+2]?a=o[r+2].color:o[r-2]&&(a=o[r-2].color),o[r+1]?l=o[r+1].color:o[r-1]&&(l=o[r-1].color),o[r+2]?c=o[r+2].color:o[r-2]&&(c=o[r-2].color),o[r+4]?i=o[r+4].color:o[r-4]&&(i=o[r-4].color),o[r+4]?f=o[r+4].textColor:o[r-4]&&(f=o[r-4].textColor),o[r+2]?e=o[r+2].color:o[r-2]&&(e=o[r-2].color),o[r+2]?s=o[r+2].textColor:o[r-2]&&(s=o[r-2].textColor),o[r+3]?d=o[r+3].color:o[r-3]&&(d=o[r-3].color),o[r+3]?b=o[r+3].textColor:o[r-3]&&(b=o[r-3].textColor),"\n button.fr-btn-"+t.name+"{\n background-color:"+t.color+";\n border-color:"+t.color+";\n color:"+t.textColor+" !important;\n }\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):hover{\n background-color:"+e+";\n border-color:"+e+";\n color:"+s+"\n }\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-"+t.name+".fr-dropdown-toggle{\n color: "+b+";\n background-color: "+d+";\n border-color: "+d+";\n }\n .fr-border-"+t.name+"{border-color: "+t.color+" !important;}\n .fr-bg-"+t.name+"{background-color: "+t.color+" !important;}\n .gradient.fr-bg-"+t.name+",fr-btn-outline-"+t.name+":hover,\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,"+t.color+","+a+");\n }\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,"+t.color+","+l+");\n color: "+t.textColor+";\n }\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,"+c+","+i+");\n color: "+f+";\n }\n .fr-text-"+t.name+"{color: "+t.color+" !important;}\n .fr-btn-outline-"+t.name+"{\n color: "+t.color+";\n border-color: "+t.color+";\n }\n .fr-btn-outline-"+t.name+":hover{\n color: "+t.textColor+";\n background-color: "+t.color+";\n border-color: "+t.color+";\n }\n .fr-btn-outline-"+t.name+".fr-disabled,\n .fr-btn-outline-"+t.name+":disabled{\n color: "+t.color+" !important;\n background-color: transparent !important;\n border-color: "+t.color+" !important;\n }\n .fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-"+t.name+".fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem "+n(t.color)+";\n }\n .fr-btn-"+t.name+":focus, .fr-btn-outline-"+t.name+":focus{\n box-shadow: 0 0 0 0.2rem "+n(t.color)+";\n }\n .fr-component-hover-"+t.name+":hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:"+t.textColor+" !important;\n }\n .fr-component-hover-"+t.name+":hover:not(button){\n background-color:"+t.color+" !important;\n border-color:"+e+" !important;\n }\n .fr-icon.fr-i-"+t.name+" path{\n fill: "+t.color+";\n }\n .fr-btn-"+t.name+" .fr-icon path{\n fill: "+t.textColor+";\n }\n"};"undefined"!=typeof window&&(window.FR||(window.FR={}),window.FR.initTheme=function(o){var t=[],e={palette:{},designTokens:o.designTokens||{}},a=[];if(o.config&&o.config.outputFields&&(a=o.config.outputFields),a.includes("colors")&&(e.colors=o.colors),a.includes("typography")&&(e.typography=o.typography),o){if(o.typography&&t.push(function(o){var n="";return o.css&&"string"==typeof o.css&&(n+=o.css),o.fonts&&"object"==typeof o.fonts&&Object.keys(o.fonts).map(function(t){return"object"==typeof o.fonts[t]&&(o.fonts[t].preset?n+="@import url('"+o.fonts[t].preset+"');":Array.isArray(o.fonts[t].src)&&(n+="@font-face {\n font-family: '"+(o.fonts[t].alias?o.fonts[t].alias:t)+"';\n "+(o.fonts[t].fontStyle?"font-style:"+o.fonts[t].fontStyle+";":"")+"\n "+(o.fonts[t].fontWeight?"font-weight:"+o.fonts[t].fontWeight+";":"")+"\n "+(o.fonts[t].fontDisplay?"font-display:"+o.fonts[t].fontDisplay+";":"")+"\n src:",o.fonts[t].local&&o.fonts[t].local.forEach(function(o){n+="local('"+o+"'),"}),o.fonts[t].src.forEach(function(r,e){n+="url('"+r.url+"') format('"+r.format+"')"+(e<o.fonts[t].src.length-1?",":"")}),n+="}"),n+=".fr-font-name-"+t.toLocaleLowerCase().replace(/ /g,"-")+"{font-family: '"+(o.fonts[t].alias?o.fonts[t].alias:t)+"', 'sans-serif'}"),t}),n}(o.typography)),o.colors){t.push(["button.fr-btn:disabled{\n background-color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#d4d4d4")+";\n border-color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#d4d4d4")+";\n color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#afafaf")+"\n }\n "]);for(var f=Object.keys(o.colors),s=0;s<f.length;s+=1){var d=f[s],b=o.colors[f[s]];if("none"!==b){e.palette[""+d]=b;var u=l(b,d);if(o.config&&o.config.generatePalette)u.forEach(function(o,n){if(e.palette[""+o.name]=o.color,c()){var r=i(u,o,n);t.push(r.replace(/\n. |\r/g,""))}});else if(c()){var m=i(u,{color:b,name:d,textColor:r(b)},11);t.push(m.replace(/\n. |\r/g,""))}}}if(o.colors.primary){var p=n(o.colors.primary,.25);t.push(".fr-focus:focus, .fr-form-control:focus, .fr-focus\\:focus{box-shadow: 0 0 0 0.2rem "+p+";outline: 0;}")}}if(c()&&"undefined"!=typeof document){var g=document.getElementById("frTheming");if(g)g.innerHTML=t.join(" ");else{var h=""+t.join(" "),v=document.body||document.getElementsByTagName("body")[0],y=document.createElement("style");y.type="text/css",y.id="frTheming",y.styleSheet?y.styleSheet.cssText=h:y.appendChild(document.createTextNode(h)),v.appendChild(y)}}}return e});
|
|
2
2
|
//# sourceMappingURL=front10-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front10-helpers.mjs","sources":["../src/Color/Color.js","../src/canI/canI.js","../src/ThemeBuilder/ThemeBuilder.js","../src/index.js"],"sourcesContent":["const componentToHex = c => {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n};\n\nconst rgb2Hex = (r, g, b) =>\n `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;\n\nconst hexToRGBA = (hex, alpha = 0.5) => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n return `rgba(${(c >> 16) & 255},${(c >> 8) & 255},${c & 255},${alpha})`;\n } else {\n // console.error(\"Bad Hex:\", hex, \"Alpha: \", alpha);\n return false;\n }\n};\n\nconst isColor = color => {\n if (hex2RGB(color)) return true;\n else return false;\n};\n\nconst hex2RGB = hex => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n // eslint-disable-next-line no-bitwise\n return { r: (c >> 16) & 255, g: (c >> 8) & 255, b: c & 255 };\n } else {\n return false;\n // throw new Error(\"Bad Hex\");\n }\n};\n\n// https://24ways.org/2010/calculating-color-contrast\n// https://www.w3.org/WAI/ER/WD-AERT/#color-contrast\nconst getContrast = hexColor => {\n const rgb = hex2RGB(hexColor);\n if (rgb) {\n const yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n return yiq >= 128 ? \"#000000\" : \"#FFFFFF\";\n } else return false;\n};\n\nconst variacion = (H, Z, value) => {\n return (H / Z) * value;\n};\n\n// https://www.w3.org/TR/WCAG20/#relativeluminancedef\nconst colorBrightness = (color, value) => {\n const rgb = hex2RGB(color);\n const t = {};\n if (rgb) {\n if (value < 0) {\n t.r = rgb.r - parseInt((rgb.r / 100) * -value, 10);\n t.g = rgb.g - parseInt((rgb.g / 100) * -value, 10);\n t.b = rgb.b - parseInt((rgb.b / 100) * -value, 10);\n } else {\n t.r = parseInt(variacion(255 - rgb.r, 100, value), 10) + rgb.r;\n t.g = parseInt(variacion(255 - rgb.g, 100, value), 10) + rgb.g;\n t.b = parseInt(variacion(255 - rgb.b, 100, value), 10) + rgb.b;\n }\n return rgb2Hex(t.r, t.g, t.b);\n } else return false;\n};\n\n/**\n * Function to generate a colors palette.\n * This function return a array of colors\n * in the following format: [{color: 'string', textColor: 'string', name: 'string' }]\n * @param {string} hexColor Color in hexadecimal format\n * @param {string} name Name of color\n * @param {integer} cantShape Cant of variations\n */\nconst generatePalette = (hexColor, name, cantShape = 22) => {\n const step = 100 / Math.ceil(cantShape / 2);\n const startVal = step * Math.floor(cantShape / 2);\n const colors = [];\n if (isColor(hexColor)) {\n for (let i = 0; i < cantShape; i += 1) {\n const color = colorBrightness(hexColor, startVal - i * step);\n const textColor = getContrast(color);\n let tmpName;\n if (i > cantShape / 2) tmpName = `${name}-${i}`;\n else if (i === cantShape / 2) tmpName = name;\n else tmpName = `${name}-${i + 1}`;\n colors.push({\n name: tmpName,\n color,\n textColor\n });\n }\n }\n return colors;\n};\n\nexport { generatePalette, getContrast, hex2RGB, hexToRGBA, rgb2Hex, isColor };\n","const subscribersMap = {};\nconst addedGlobalEventListeners = false;\n\n/**\n * Returns an element\n * @param {*} elementSelector\n */\nconst getElement = elementSelector => {\n return document.querySelector(elementSelector);\n};\n\n/**\n * Iterate through the listeners list and try to resolve\n * the promise if they are visible in the viewport\n * TODO: Fix the viewport detection part\n */\nconst resolveListeners = () => {\n const subscribersKeyList = Object.keys(subscribersMap);\n if (subscribersKeyList.length > 0) {\n for (let index = 0; index < subscribersKeyList.length; index++) {\n const key = subscribersKeyList[index];\n if (subscribersMap[key]) {\n //Only full load component when is visible in viewport\n if (isElementInViewport(getElement(key))) {\n subscribersMap[key].resolve(true);\n subscribersMap[key] = null;\n delete subscribersMap[key];\n }\n }\n }\n }\n};\n\n/**\n * Helper function to simulate a setInterval but\n * wthout hurting the browser performance\n * @param {*} fn\n * @param {*} delay\n */\nconst requestInterval = (fn, delay) => {\n const requestAnimFrame = (() => {\n return (\n window.requestAnimationFrame ||\n function hello(callback) {\n window.setTimeout(callback, 1000 / 60);\n }\n );\n })();\n let start = new Date().getTime();\n const handle = {};\n function loop() {\n handle.value = requestAnimFrame(loop);\n const current = new Date().getTime();\n const delta = current - start;\n if (delta >= delay) {\n fn.call();\n start = new Date().getTime();\n }\n }\n handle.value = requestAnimFrame(loop);\n return handle;\n};\n\n/**\n * Try to resolve all listeners once an\n * user wants to play with the components\n * this heuristics are very basic, we should\n * find better ones.\n */\nconst addGlobalEventListeners = () => {\n window.addEventListener(\"scroll\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"click\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"mousemove\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"keydown\", () => {\n resolveListeners();\n });\n\n requestInterval(() => {\n resolveListeners();\n }, 2000);\n};\n\n/**\n * Returns the DocElement\n */\nconst getDocElement = () => {\n if (window !== undefined) {\n return window.document.documentElement;\n }\n return false;\n};\n\n/**\n * Obtaining the viewport height\n * @method _getViewportH\n * @return ConditionalExpression\n */\nconst getViewportH = () => {\n const client = getDocElement.clientHeight;\n const inner = window.innerHeight;\n return client < inner ? inner : client;\n};\n\n/**\n * The offset of the element\n * @method _getOffset\n * @param {} el\n * @return ObjectExpression\n */\nconst getOffset = el => {\n let offsetTop = 0;\n let offsetLeft = 0;\n /* eslint-disable */\n do {\n if (!isNaN(el.offsetTop)) {\n offsetTop += el.offsetTop;\n }\n if (!isNaN(el.offsetLeft)) {\n offsetLeft += el.offsetLeft;\n }\n } while ((el = el.offsetParent));\n /* eslint-enable */\n return {\n top: offsetTop,\n left: offsetLeft\n };\n};\n\n/**\n * Return true if the element if visible in a viewport zone\n * @param {} el\n * @param {} h\n * @return LogicalExpression\n */\nconst isElementInViewport = el => {\n if (canIExecuteClientCode() && el) {\n let element = el;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n while (element.offsetParent) {\n element = element.offsetParent;\n top += element.offsetTop;\n left += element.offsetLeft;\n }\n\n return (\n top < window.pageYOffset + window.innerHeight &&\n left < window.pageXOffset + window.innerWidth &&\n top + height > window.pageYOffset &&\n left + width > window.pageXOffset\n );\n }\n};\n\n/**\n * Returns a promise that resolves once the initial\n * browser processing is done. This allows to save\n * the users that uses low cpu devices and also have\n * awesome results in Google Page Speed\n * @param {*} elementSelector\n * @param {*} inSSR\n */\nconst canILiftOff = (elementSelector, inSSR = true) => {\n return new Promise(resolve => {\n // we don't need to wait in SSR\n if (window === undefined && inSSR) {\n resolve(true);\n } else {\n // adds global listeners that will trigger\n // once a real person is interacting with the browser\n if (!addedGlobalEventListeners) {\n addGlobalEventListeners();\n }\n // saving all the component instances subscriptions\n subscribersMap[elementSelector] = {\n resolve\n };\n }\n });\n};\n\nconst canIExecuteClientCode = () => {\n return typeof window !== \"undefined\";\n};\n\nexport { canILiftOff, isElementInViewport, canIExecuteClientCode };\n","import { generatePalette, hexToRGBA, getContrast } from \"../Color\";\nimport { canIExecuteClientCode } from \"../canI\";\n\nconst generateTypographyStyles = async (typography) => {\n let style = \"\";\n if (typeof typography === \"object\" && Array.isArray(typography)) {\n const dataFonts = typography.map((item) => {\n return {\n name: item,\n outputType: \"string\"\n };\n });\n const rawResponse = await fetch(\n \"https://em-font-service-prod.airtrfx.com\",\n {\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n },\n method: \"POST\",\n body: JSON.stringify({\n fonts: dataFonts\n })\n }\n );\n\n const cssObject = await rawResponse.json();\n let css = \"\";\n Object.keys(cssObject).forEach((item) => {\n css += cssObject[item].css;\n });\n return css;\n }\n if (typography.fonts && typeof typography.fonts === \"object\") {\n Object.keys(typography.fonts).map((fontName) => {\n if (typeof typography.fonts[fontName] === \"object\") {\n if (typography.fonts[fontName].preset)\n style += `@import url('${typography.fonts[fontName].preset}');`;\n else if (Array.isArray(typography.fonts[fontName].src)) {\n style += `@font-face {\n font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }';\n ${\n typography.fonts[fontName].fontStyle\n ? `font-style:${typography.fonts[fontName].fontStyle};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontWeight\n ? `font-weight:${typography.fonts[fontName].fontWeight};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontDisplay\n ? `font-display:${typography.fonts[fontName].fontDisplay};`\n : \"\"\n }\n src:`;\n\n typography.fonts[fontName].local &&\n typography.fonts[fontName].local.forEach((local) => {\n style += `local('${local}'),`;\n });\n typography.fonts[fontName].src.forEach((fontSrc, index) => {\n style += `url('${fontSrc.url}') format('${fontSrc.format}')${\n index < typography.fonts[fontName].src.length - 1 ? \",\" : \"\"\n }`;\n });\n style += \"}\";\n }\n style += `.fr-font-name-${fontName\n .toLocaleLowerCase()\n .replace(/ /g, \"-\")}{font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }', 'sans-serif'}`;\n }\n return fontName;\n });\n }\n return style;\n};\n\nconst generateStylesPalette = (palette, item, i) => {\n let hoverBgColor = item.color;\n let gradientTo = item.color;\n let gradientButtonToHover = item.color;\n let gradientButtonFromActive = item.color;\n let gradientButtonToActive = item.color;\n let gradientButtonTextActive = item.textColor;\n let hoverColor = item.textColor;\n let activeBgColor = item.color;\n let activeColor = item.textColor;\n\n if (palette[i + 2]) gradientTo = palette[i + 2].color;\n else if (palette[i - 2]) gradientTo = palette[i - 2].color;\n\n if (palette[i + 1]) gradientButtonToHover = palette[i + 1].color;\n else if (palette[i - 1]) gradientButtonToHover = palette[i - 1].color;\n\n if (palette[i + 2]) gradientButtonFromActive = palette[i + 2].color;\n else if (palette[i - 2]) gradientButtonFromActive = palette[i - 2].color;\n\n if (palette[i + 4]) gradientButtonToActive = palette[i + 4].color;\n else if (palette[i - 4]) gradientButtonToActive = palette[i - 4].color;\n\n if (palette[i + 4]) gradientButtonTextActive = palette[i + 4].textColor;\n else if (palette[i - 4]) gradientButtonTextActive = palette[i - 4].textColor;\n\n if (palette[i + 2]) hoverBgColor = palette[i + 2].color;\n else if (palette[i - 2]) hoverBgColor = palette[i - 2].color;\n\n if (palette[i + 2]) hoverColor = palette[i + 2].textColor;\n else if (palette[i - 2]) hoverColor = palette[i - 2].textColor;\n\n if (palette[i + 3]) activeBgColor = palette[i + 3].color;\n else if (palette[i - 3]) activeBgColor = palette[i - 3].color;\n\n if (palette[i + 3]) activeColor = palette[i + 3].textColor;\n else if (palette[i - 3]) activeColor = palette[i - 3].textColor;\n const styles = `\n button.fr-btn-${item.name}{\n background-color:${item.color};\n border-color:${item.color};\n color:${item.textColor} !important;\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover{\n background-color:${hoverBgColor};\n border-color:${hoverBgColor};\n color:${hoverColor}\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle{\n color: ${activeColor};\n background-color: ${activeBgColor};\n border-color: ${activeBgColor};\n }\n .fr-border-${item.name}{border-color: ${item.color} !important;}\n .fr-bg-${item.name}{background-color: ${item.color} !important;}\n .gradient.fr-bg-${item.name},fr-btn-outline-${item.name}:hover,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,${item.color},${gradientTo});\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,${\n item.color\n },${gradientButtonToHover});\n color: ${item.textColor};\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,${gradientButtonFromActive},${gradientButtonToActive});\n color: ${gradientButtonTextActive};\n }\n .fr-text-${item.name}{color: ${item.color} !important;}\n .fr-btn-outline-${item.name}{\n color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}:hover{\n color: ${item.textColor};\n background-color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}.fr-disabled,\n .fr-btn-outline-${item.name}:disabled{\n color: ${item.color} !important;\n background-color: transparent !important;\n border-color: ${item.color} !important;\n }\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-btn-${item.name}:focus, .fr-btn-outline-${item.name}:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-component-hover-${\n item.name\n }:hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:${item.textColor} !important;\n }\n .fr-component-hover-${item.name}:hover:not(button){\n background-color:${item.color} !important;\n border-color:${hoverBgColor} !important;\n }\n .fr-icon.fr-i-${item.name} path{\n fill: ${item.color};\n }\n .fr-btn-${item.name} .fr-icon path{\n fill: ${item.textColor};\n }\n`;\n return styles;\n};\n\nconst initTheme = async (theme) => {\n const generatedStyles = [];\n const themeToken = {\n palette: {},\n designTokens: theme.designTokens || {}\n };\n\n let outputFields = [];\n if (theme.config && theme.config.outputFields) {\n outputFields = theme.config.outputFields;\n }\n if (outputFields.includes(\"colors\")) themeToken.colors = theme.colors;\n if (outputFields.includes(\"typography\"))\n themeToken.typography = theme.typography;\n if (theme) {\n if (theme.typography) {\n generatedStyles.push(await generateTypographyStyles(theme.typography));\n }\n if (theme.colors) {\n generatedStyles.push([\n `button.fr-btn:disabled{\n background-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n border-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#afafaf\"\n }\n }\n `\n ]);\n const themeColorsKeys = Object.keys(theme.colors);\n for (let index = 0; index < themeColorsKeys.length; index += 1) {\n const colorName = themeColorsKeys[index];\n const colorValue = theme.colors[themeColorsKeys[index]];\n if (colorValue !== \"none\") {\n // Adding base color to palette\n themeToken.palette[`${colorName}`] = colorValue;\n const palette = generatePalette(colorValue, colorName);\n if (theme.config && theme.config.generatePalette) {\n palette.forEach((item, i) => {\n // Adding color variations to the palette\n themeToken.palette[`${item.name}`] = item.color;\n // Avoiding executing unnecessary code that is not needed in the SSR\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(palette, item, i);\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n });\n } else {\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(\n palette,\n {\n color: colorValue,\n name: colorName,\n textColor: getContrast(colorValue)\n },\n 11\n );\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n }\n }\n }\n if (theme.colors.primary) {\n const primaryHover = hexToRGBA(theme.colors.primary, 0.25);\n generatedStyles.push(\n `.fr-focus:focus, .fr-form-control:focus, .fr-focus\\\\:focus{box-shadow: 0 0 0 0.2rem ${primaryHover};outline: 0;}`\n );\n }\n }\n if (canIExecuteClientCode() && typeof document != \"undefined\") {\n const element = document.getElementById(\"frTheming\");\n if (element) {\n element.innerHTML = generatedStyles.join(\" \");\n } else {\n const themeStyleNode = `${generatedStyles.join(\" \")}`;\n\n const body = document.body || document.getElementsByTagName(\"body\")[0];\n const style = document.createElement(\"style\");\n\n style.type = \"text/css\";\n style.id = \"frTheming\";\n if (style.styleSheet) {\n // This is required for IE8 and below.\n style.styleSheet.cssText = themeStyleNode;\n } else {\n style.appendChild(document.createTextNode(themeStyleNode));\n }\n body.appendChild(style);\n }\n }\n }\n return themeToken;\n};\n\nexport { initTheme };\n","import { initTheme } from \"./ThemeBuilder\";\nif(typeof window !== \"undefined\"){\n if(!window.FR) window.FR = {};\n window.FR.initTheme=initTheme;\n}"],"names":["const","componentToHex","c","hex","toString","length","hexToRGBA","alpha","test","substring","split","join","hex2RGB","r","g","b","getContrast","hexColor","rgb","variacion","H","Z","value","colorBrightness","color","t","parseInt","generatePalette","name","cantShape","step","Math","ceil","startVal","floor","colors","let","i","textColor","push","canIExecuteClientCode","window","generateStylesPalette","palette","item","hoverBgColor","gradientTo","gradientButtonToHover","gradientButtonFromActive","gradientButtonToActive","gradientButtonTextActive","hoverColor","activeBgColor","activeColor","FR","initTheme","theme","generatedStyles","themeToken","designTokens","outputFields","config","includes","typography","components","button","disabled","bgColor","themeColorsKeys","Object","keys","index","colorName","colorValue","forEach","styles","replace","primary","primaryHover","document","element","getElementById","innerHTML","themeStyleNode","body","getElementsByTagName","style","createElement","type","id","styleSheet","cssText","appendChild","createTextNode","fonts","map","fontName","preset","Array","isArray","src","alias","fontStyle","fontWeight","fontDisplay","local","fontSrc","toLocaleLowerCase","dataFonts","outputType","fetch","headers","Accept","method","JSON","stringify","rawResponse","json","cssObject","css","generateTypographyStyles"],"mappings":"AAAAA,IAAMC,WAAiBC,OACfC,EAAMD,EAAEE,SAAS,WACD,IAAfD,EAAIE,WAAmBF,EAAQA,GAMlCG,WAAaH,EAAKI,OAClBL,wBAD0B,MAE1B,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,eAEvCA,EAAK,KAAIA,EAAES,KAAK,MACK,GAAM,UAAQT,GAAK,EAAK,UAAW,IAAJA,OAAWK,QAY7DK,WAAUT,OACVD,UACA,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,KAIhC,CAAEW,GAFTX,EAAK,KAAIA,EAAES,KAAK,MAEE,GAAM,IAAKG,EAAIZ,GAAK,EAAK,IAAKa,EAAO,I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KnD,SACzB,CACLhB,KAAMgB,EACNiE,WAAY,mCAGUC,MACxB,2CACA,CACEC,QAAS,CACPC,OAAQ,kCACQ,oBAElBC,OAAQ,OACR7B,KAAM8B,KAAKC,UAAU,CACnBrB,MAAOc,qBATPQ,0BAckBA,EAAYC,sBAA9BC,OACFC,EAAM,UACVlD,OAAOC,KAAKgD,GAAW5C,iBAAS9B,GAC9B2E,GAAOD,EAAU1E,GAAM2E,WAElBA,8FAyMsBC,CAAyBhE,EAAMO,qCAA1DN,wGA+FGC,IAAAA"}
|
|
1
|
+
{"version":3,"file":"front10-helpers.mjs","sources":["../src/Color/Color.js","../src/canI/canI.js","../src/ThemeBuilder/ThemeBuilder.js","../src/index.js"],"sourcesContent":["const componentToHex = c => {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n};\n\nconst rgb2Hex = (r, g, b) =>\n `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;\n\nconst hexToRGBA = (hex, alpha = 0.5) => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n return `rgba(${(c >> 16) & 255},${(c >> 8) & 255},${c & 255},${alpha})`;\n } else {\n // console.error(\"Bad Hex:\", hex, \"Alpha: \", alpha);\n return false;\n }\n};\n\nconst isColor = color => {\n if (hex2RGB(color)) return true;\n else return false;\n};\n\nconst hex2RGB = hex => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n // eslint-disable-next-line no-bitwise\n return { r: (c >> 16) & 255, g: (c >> 8) & 255, b: c & 255 };\n } else {\n return false;\n // throw new Error(\"Bad Hex\");\n }\n};\n\n// https://24ways.org/2010/calculating-color-contrast\n// https://www.w3.org/WAI/ER/WD-AERT/#color-contrast\nconst getContrast = hexColor => {\n const rgb = hex2RGB(hexColor);\n if (rgb) {\n const yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n return yiq >= 128 ? \"#000000\" : \"#FFFFFF\";\n } else return false;\n};\n\nconst variacion = (H, Z, value) => {\n return (H / Z) * value;\n};\n\n// https://www.w3.org/TR/WCAG20/#relativeluminancedef\nconst colorBrightness = (color, value) => {\n const rgb = hex2RGB(color);\n const t = {};\n if (rgb) {\n if (value < 0) {\n t.r = rgb.r - parseInt((rgb.r / 100) * -value, 10);\n t.g = rgb.g - parseInt((rgb.g / 100) * -value, 10);\n t.b = rgb.b - parseInt((rgb.b / 100) * -value, 10);\n } else {\n t.r = parseInt(variacion(255 - rgb.r, 100, value), 10) + rgb.r;\n t.g = parseInt(variacion(255 - rgb.g, 100, value), 10) + rgb.g;\n t.b = parseInt(variacion(255 - rgb.b, 100, value), 10) + rgb.b;\n }\n return rgb2Hex(t.r, t.g, t.b);\n } else return false;\n};\n\n/**\n * Function to generate a colors palette.\n * This function return a array of colors\n * in the following format: [{color: 'string', textColor: 'string', name: 'string' }]\n * @param {string} hexColor Color in hexadecimal format\n * @param {string} name Name of color\n * @param {integer} cantShape Cant of variations\n */\nconst generatePalette = (hexColor, name, cantShape = 22) => {\n const step = 100 / Math.ceil(cantShape / 2);\n const startVal = step * Math.floor(cantShape / 2);\n const colors = [];\n if (isColor(hexColor)) {\n for (let i = 0; i < cantShape; i += 1) {\n const color = colorBrightness(hexColor, startVal - i * step);\n const textColor = getContrast(color);\n let tmpName;\n if (i > cantShape / 2) tmpName = `${name}-${i}`;\n else if (i === cantShape / 2) tmpName = name;\n else tmpName = `${name}-${i + 1}`;\n colors.push({\n name: tmpName,\n color,\n textColor\n });\n }\n }\n return colors;\n};\n\nexport { generatePalette, getContrast, hex2RGB, hexToRGBA, rgb2Hex, isColor };\n","const subscribersMap = {};\nconst addedGlobalEventListeners = false;\n\n/**\n * Returns an element\n * @param {*} elementSelector\n */\nconst getElement = elementSelector => {\n return document.querySelector(elementSelector);\n};\n\n/**\n * Iterate through the listeners list and try to resolve\n * the promise if they are visible in the viewport\n * TODO: Fix the viewport detection part\n */\nconst resolveListeners = () => {\n const subscribersKeyList = Object.keys(subscribersMap);\n if (subscribersKeyList.length > 0) {\n for (let index = 0; index < subscribersKeyList.length; index++) {\n const key = subscribersKeyList[index];\n if (subscribersMap[key]) {\n //Only full load component when is visible in viewport\n if (isElementInViewport(getElement(key))) {\n subscribersMap[key].resolve(true);\n subscribersMap[key] = null;\n delete subscribersMap[key];\n }\n }\n }\n }\n};\n\n/**\n * Helper function to simulate a setInterval but\n * wthout hurting the browser performance\n * @param {*} fn\n * @param {*} delay\n */\nconst requestInterval = (fn, delay) => {\n const requestAnimFrame = (() => {\n return (\n window.requestAnimationFrame ||\n function hello(callback) {\n window.setTimeout(callback, 1000 / 60);\n }\n );\n })();\n let start = new Date().getTime();\n const handle = {};\n function loop() {\n handle.value = requestAnimFrame(loop);\n const current = new Date().getTime();\n const delta = current - start;\n if (delta >= delay) {\n fn.call();\n start = new Date().getTime();\n }\n }\n handle.value = requestAnimFrame(loop);\n return handle;\n};\n\n/**\n * Try to resolve all listeners once an\n * user wants to play with the components\n * this heuristics are very basic, we should\n * find better ones.\n */\nconst addGlobalEventListeners = () => {\n window.addEventListener(\"scroll\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"click\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"mousemove\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"keydown\", () => {\n resolveListeners();\n });\n\n requestInterval(() => {\n resolveListeners();\n }, 2000);\n};\n\n/**\n * Returns the DocElement\n */\nconst getDocElement = () => {\n if (window !== undefined) {\n return window.document.documentElement;\n }\n return false;\n};\n\n/**\n * Obtaining the viewport height\n * @method _getViewportH\n * @return ConditionalExpression\n */\nconst getViewportH = () => {\n const client = getDocElement.clientHeight;\n const inner = window.innerHeight;\n return client < inner ? inner : client;\n};\n\n/**\n * The offset of the element\n * @method _getOffset\n * @param {} el\n * @return ObjectExpression\n */\nconst getOffset = el => {\n let offsetTop = 0;\n let offsetLeft = 0;\n /* eslint-disable */\n do {\n if (!isNaN(el.offsetTop)) {\n offsetTop += el.offsetTop;\n }\n if (!isNaN(el.offsetLeft)) {\n offsetLeft += el.offsetLeft;\n }\n } while ((el = el.offsetParent));\n /* eslint-enable */\n return {\n top: offsetTop,\n left: offsetLeft\n };\n};\n\n/**\n * Return true if the element if visible in a viewport zone\n * @param {} el\n * @param {} h\n * @return LogicalExpression\n */\nconst isElementInViewport = el => {\n if (canIExecuteClientCode() && el) {\n let element = el;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n while (element.offsetParent) {\n element = element.offsetParent;\n top += element.offsetTop;\n left += element.offsetLeft;\n }\n\n return (\n top < window.pageYOffset + window.innerHeight &&\n left < window.pageXOffset + window.innerWidth &&\n top + height > window.pageYOffset &&\n left + width > window.pageXOffset\n );\n }\n};\n\n/**\n * Returns a promise that resolves once the initial\n * browser processing is done. This allows to save\n * the users that uses low cpu devices and also have\n * awesome results in Google Page Speed\n * @param {*} elementSelector\n * @param {*} inSSR\n */\nconst canILiftOff = (elementSelector, inSSR = true) => {\n return new Promise(resolve => {\n // we don't need to wait in SSR\n if (window === undefined && inSSR) {\n resolve(true);\n } else {\n // adds global listeners that will trigger\n // once a real person is interacting with the browser\n if (!addedGlobalEventListeners) {\n addGlobalEventListeners();\n }\n // saving all the component instances subscriptions\n subscribersMap[elementSelector] = {\n resolve\n };\n }\n });\n};\n\nconst canIExecuteClientCode = () => {\n return typeof window !== \"undefined\";\n};\n\nexport { canILiftOff, isElementInViewport, canIExecuteClientCode };\n","import { generatePalette, hexToRGBA, getContrast } from \"../Color\";\nimport { canIExecuteClientCode } from \"../canI\";\n\nconst generateTypographyStyles = (typography) => {\n let style = \"\";\n if (typography.css && typeof typography.css === \"string\") {\n style += typography.css;\n }\n if (typography.fonts && typeof typography.fonts === \"object\") {\n Object.keys(typography.fonts).map((fontName) => {\n if (typeof typography.fonts[fontName] === \"object\") {\n if (typography.fonts[fontName].preset)\n style += `@import url('${typography.fonts[fontName].preset}');`;\n else if (Array.isArray(typography.fonts[fontName].src)) {\n style += `@font-face {\n font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }';\n ${\n typography.fonts[fontName].fontStyle\n ? `font-style:${typography.fonts[fontName].fontStyle};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontWeight\n ? `font-weight:${typography.fonts[fontName].fontWeight};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontDisplay\n ? `font-display:${typography.fonts[fontName].fontDisplay};`\n : \"\"\n }\n src:`;\n\n typography.fonts[fontName].local &&\n typography.fonts[fontName].local.forEach((local) => {\n style += `local('${local}'),`;\n });\n typography.fonts[fontName].src.forEach((fontSrc, index) => {\n style += `url('${fontSrc.url}') format('${fontSrc.format}')${\n index < typography.fonts[fontName].src.length - 1 ? \",\" : \"\"\n }`;\n });\n style += \"}\";\n }\n style += `.fr-font-name-${fontName\n .toLocaleLowerCase()\n .replace(/ /g, \"-\")}{font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }', 'sans-serif'}`;\n }\n return fontName;\n });\n }\n return style;\n};\n\nconst generateStylesPalette = (palette, item, i) => {\n let hoverBgColor = item.color;\n let gradientTo = item.color;\n let gradientButtonToHover = item.color;\n let gradientButtonFromActive = item.color;\n let gradientButtonToActive = item.color;\n let gradientButtonTextActive = item.textColor;\n let hoverColor = item.textColor;\n let activeBgColor = item.color;\n let activeColor = item.textColor;\n\n if (palette[i + 2]) gradientTo = palette[i + 2].color;\n else if (palette[i - 2]) gradientTo = palette[i - 2].color;\n\n if (palette[i + 1]) gradientButtonToHover = palette[i + 1].color;\n else if (palette[i - 1]) gradientButtonToHover = palette[i - 1].color;\n\n if (palette[i + 2]) gradientButtonFromActive = palette[i + 2].color;\n else if (palette[i - 2]) gradientButtonFromActive = palette[i - 2].color;\n\n if (palette[i + 4]) gradientButtonToActive = palette[i + 4].color;\n else if (palette[i - 4]) gradientButtonToActive = palette[i - 4].color;\n\n if (palette[i + 4]) gradientButtonTextActive = palette[i + 4].textColor;\n else if (palette[i - 4]) gradientButtonTextActive = palette[i - 4].textColor;\n\n if (palette[i + 2]) hoverBgColor = palette[i + 2].color;\n else if (palette[i - 2]) hoverBgColor = palette[i - 2].color;\n\n if (palette[i + 2]) hoverColor = palette[i + 2].textColor;\n else if (palette[i - 2]) hoverColor = palette[i - 2].textColor;\n\n if (palette[i + 3]) activeBgColor = palette[i + 3].color;\n else if (palette[i - 3]) activeBgColor = palette[i - 3].color;\n\n if (palette[i + 3]) activeColor = palette[i + 3].textColor;\n else if (palette[i - 3]) activeColor = palette[i - 3].textColor;\n const styles = `\n button.fr-btn-${item.name}{\n background-color:${item.color};\n border-color:${item.color};\n color:${item.textColor} !important;\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover{\n background-color:${hoverBgColor};\n border-color:${hoverBgColor};\n color:${hoverColor}\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle{\n color: ${activeColor};\n background-color: ${activeBgColor};\n border-color: ${activeBgColor};\n }\n .fr-border-${item.name}{border-color: ${item.color} !important;}\n .fr-bg-${item.name}{background-color: ${item.color} !important;}\n .gradient.fr-bg-${item.name},fr-btn-outline-${item.name}:hover,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,${item.color},${gradientTo});\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,${\n item.color\n },${gradientButtonToHover});\n color: ${item.textColor};\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,${gradientButtonFromActive},${gradientButtonToActive});\n color: ${gradientButtonTextActive};\n }\n .fr-text-${item.name}{color: ${item.color} !important;}\n .fr-btn-outline-${item.name}{\n color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}:hover{\n color: ${item.textColor};\n background-color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}.fr-disabled,\n .fr-btn-outline-${item.name}:disabled{\n color: ${item.color} !important;\n background-color: transparent !important;\n border-color: ${item.color} !important;\n }\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-btn-${item.name}:focus, .fr-btn-outline-${item.name}:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-component-hover-${\n item.name\n }:hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:${item.textColor} !important;\n }\n .fr-component-hover-${item.name}:hover:not(button){\n background-color:${item.color} !important;\n border-color:${hoverBgColor} !important;\n }\n .fr-icon.fr-i-${item.name} path{\n fill: ${item.color};\n }\n .fr-btn-${item.name} .fr-icon path{\n fill: ${item.textColor};\n }\n`;\n return styles;\n};\n\nconst initTheme = (theme) => {\n const generatedStyles = [];\n const themeToken = {\n palette: {},\n designTokens: theme.designTokens || {}\n };\n\n let outputFields = [];\n if (theme.config && theme.config.outputFields) {\n outputFields = theme.config.outputFields;\n }\n if (outputFields.includes(\"colors\")) themeToken.colors = theme.colors;\n if (outputFields.includes(\"typography\"))\n themeToken.typography = theme.typography;\n if (theme) {\n if (theme.typography) {\n generatedStyles.push(generateTypographyStyles(theme.typography));\n }\n if (theme.colors) {\n generatedStyles.push([\n `button.fr-btn:disabled{\n background-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n border-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#afafaf\"\n }\n }\n `\n ]);\n const themeColorsKeys = Object.keys(theme.colors);\n for (let index = 0; index < themeColorsKeys.length; index += 1) {\n const colorName = themeColorsKeys[index];\n const colorValue = theme.colors[themeColorsKeys[index]];\n if (colorValue !== \"none\") {\n // Adding base color to palette\n themeToken.palette[`${colorName}`] = colorValue;\n const palette = generatePalette(colorValue, colorName);\n if (theme.config && theme.config.generatePalette) {\n palette.forEach((item, i) => {\n // Adding color variations to the palette\n themeToken.palette[`${item.name}`] = item.color;\n // Avoiding executing unnecessary code that is not needed in the SSR\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(palette, item, i);\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n });\n } else {\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(\n palette,\n {\n color: colorValue,\n name: colorName,\n textColor: getContrast(colorValue)\n },\n 11\n );\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n }\n }\n }\n if (theme.colors.primary) {\n const primaryHover = hexToRGBA(theme.colors.primary, 0.25);\n generatedStyles.push(\n `.fr-focus:focus, .fr-form-control:focus, .fr-focus\\\\:focus{box-shadow: 0 0 0 0.2rem ${primaryHover};outline: 0;}`\n );\n }\n }\n if (canIExecuteClientCode() && typeof document != \"undefined\") {\n const element = document.getElementById(\"frTheming\");\n if (element) {\n element.innerHTML = generatedStyles.join(\" \");\n } else {\n const themeStyleNode = `${generatedStyles.join(\" \")}`;\n\n const body = document.body || document.getElementsByTagName(\"body\")[0];\n const style = document.createElement(\"style\");\n\n style.type = \"text/css\";\n style.id = \"frTheming\";\n if (style.styleSheet) {\n // This is required for IE8 and below.\n style.styleSheet.cssText = themeStyleNode;\n } else {\n style.appendChild(document.createTextNode(themeStyleNode));\n }\n body.appendChild(style);\n }\n }\n }\n return themeToken;\n};\n\nexport { initTheme };\n","import { initTheme } from \"./ThemeBuilder\";\nif(typeof window !== \"undefined\"){\n if(!window.FR) window.FR = {};\n window.FR.initTheme=initTheme;\n}"],"names":["const","componentToHex","c","hex","toString","length","hexToRGBA","alpha","test","substring","split","join","hex2RGB","r","g","b","getContrast","hexColor","rgb","variacion","H","Z","value","colorBrightness","color","t","parseInt","generatePalette","name","cantShape","step","Math","ceil","startVal","floor","colors","let","i","textColor","push","canIExecuteClientCode","window","generateStylesPalette","palette","item","hoverBgColor","gradientTo","gradientButtonToHover","gradientButtonFromActive","gradientButtonToActive","gradientButtonTextActive","hoverColor","activeBgColor","activeColor","FR","initTheme","theme","generatedStyles","themeToken","designTokens","outputFields","config","includes","typography","style","css","fonts","Object","keys","map","fontName","preset","Array","isArray","src","alias","fontStyle","fontWeight","fontDisplay","local","forEach","fontSrc","index","toLocaleLowerCase","replace","generateTypographyStyles","components","button","disabled","bgColor","themeColorsKeys","colorName","colorValue","styles","primary","primaryHover","document","element","getElementById","innerHTML","themeStyleNode","body","getElementsByTagName","createElement","type","id","styleSheet","cssText","appendChild","createTextNode"],"mappings":"AAAAA,IAAMC,WAAiBC,OACfC,EAAMD,EAAEE,SAAS,WACD,IAAfD,EAAIE,WAAmBF,EAAQA,GAMlCG,WAAaH,EAAKI,OAClBL,wBAD0B,MAE1B,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,eAEvCA,EAAK,KAAIA,EAAES,KAAK,MACK,GAAM,UAAQT,GAAK,EAAK,UAAW,IAAJA,OAAWK,QAY7DK,WAAUT,OACVD,UACA,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,KAIhC,CAAEW,GAFTX,EAAK,KAAIA,EAAES,KAAK,MAEE,GAAM,IAAKG,EAAIZ,GAAK,EAAK,IAAKa,EAAO,IAAJb,KASjDc,WAAcC,OACZC,EAAMN,EAAQK,WAChBC,KACmB,IAARA,EAAIL,EAAkB,IAARK,EAAIJ,EAAkB,IAARI,EAAIH,GAAW,KAC1C,IAAM,UAAY,YAI9BI,WAAaC,EAAGC,EAAGC,UACfF,EAAIC,EAAKC,GAIbC,WAAmBC,EAAOF,OAtDZR,EAAGC,EAuDfG,EAAMN,EAAQY,GACdC,EAAI,WACNP,IACEI,EAAQ,GACVG,EAAEZ,EAAIK,EAAIL,EAAIa,SAAUR,EAAIL,EAAI,KAAQS,EAAO,IAC/CG,EAAEX,EAAII,EAAIJ,EAAIY,SAAUR,EAAIJ,EAAI,KAAQQ,EAAO,IAC/CG,EAAEV,EAA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,EAAQqC,iBAASpC,EAAMP,MAErBqB,EAAWf,WAAWC,QAAeA,EAAKpB,MAEtCgB,IAAyB,KACrBqD,EAASnD,EAAsBC,EAASC,EAAMP,GACpDoB,EAAgBlB,KAAKsD,EAAOT,QAAQ,WAAY,gBAIhD5C,IAAyB,KACrBqD,EAASnD,EACbC,EACA,CACEnB,MAAOoE,EACPhE,KAAM+D,EACNrD,UAAWtB,EAAY4E,IAEzB,IAEFnC,EAAgBlB,KAAKsD,EAAOT,QAAQ,WAAY,UAKpD5B,EAAMrB,OAAO2D,QAAS,KAClBC,EAAezF,EAAUkD,EAAMrB,OAAO2D,QAAS,KACrDrC,EAAgBlB,4FACyEwD,uBAIzFvD,KAA8C,oBAAZwD,SAAyB,KACvDC,EAAUD,SAASE,eAAe,gBACpCD,EACFA,EAAQE,UAAY1C,EAAgB9C,KAAK,SACpC,KACCyF,EAAkB,GAAE3C,EAAgB9C,KAAK,KAEzC0F,EAAOL,SAASK,MAAQL,SAASM,qBAAqB,QAAQ,GAC9DtC,EAAQgC,SAASO,cAAc,SAErCvC,EAAMwC,KAAO,WACbxC,EAAMyC,GAAK,YACPzC,EAAM0C,WAER1C,EAAM0C,WAAWC,QAAUP,EAE3BpC,EAAM4C,YAAYZ,SAASa,eAAeT,IAE5CC,EAAKO,YAAY5C,YAIhBN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(o,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){var o=function(o){var n=o.toString(16);return 1===n.length?"0"+n:n},n=function(o,n){var t;return void 0===n&&(n=.5),!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(t=o.substring(1).split("")).length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]),"rgba("+((t="0x"+t.join(""))>>16&255)+","+(t>>8&255)+","+(255&t)+","+n+")")},t=function(o){var n;return!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(n=o.substring(1).split("")).length&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),{r:(n="0x"+n.join(""))>>16&255,g:n>>8&255,b:255&n})},r=function(o){var n=t(o);return!!n&&((299*n.r+587*n.g+114*n.b)/1e3>=128?"#000000":"#FFFFFF")},e=function(o,n,t){return o/n*t},a=function(n,r){var a,l,i=t(n),c={};return!!i&&(r<0?(c.r=i.r-parseInt(i.r/100*-r,10),c.g=i.g-parseInt(i.g/100*-r,10),c.b=i.b-parseInt(i.b/100*-r,10)):(c.r=parseInt(e(255-i.r,100,r),10)+i.r,c.g=parseInt(e(255-i.g,100,r),10)+i.g,c.b=parseInt(e(255-i.b,100,r),10)+i.b),a=c.g,l=c.b,"#"+o(c.r)+o(a)+o(l))},l=function(o,n,e){void 0===e&&(e=22);var l=100/Math.ceil(e/2),i=l*Math.floor(e/2),c=[];if(t(o))for(var f=0;f<e;f+=1){var
|
|
1
|
+
!function(o,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){var o=function(o){var n=o.toString(16);return 1===n.length?"0"+n:n},n=function(o,n){var t;return void 0===n&&(n=.5),!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(t=o.substring(1).split("")).length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]),"rgba("+((t="0x"+t.join(""))>>16&255)+","+(t>>8&255)+","+(255&t)+","+n+")")},t=function(o){var n;return!!/^#([A-Fa-f0-9]{3}){1,2}$/.test(o)&&(3===(n=o.substring(1).split("")).length&&(n=[n[0],n[0],n[1],n[1],n[2],n[2]]),{r:(n="0x"+n.join(""))>>16&255,g:n>>8&255,b:255&n})},r=function(o){var n=t(o);return!!n&&((299*n.r+587*n.g+114*n.b)/1e3>=128?"#000000":"#FFFFFF")},e=function(o,n,t){return o/n*t},a=function(n,r){var a,l,i=t(n),c={};return!!i&&(r<0?(c.r=i.r-parseInt(i.r/100*-r,10),c.g=i.g-parseInt(i.g/100*-r,10),c.b=i.b-parseInt(i.b/100*-r,10)):(c.r=parseInt(e(255-i.r,100,r),10)+i.r,c.g=parseInt(e(255-i.g,100,r),10)+i.g,c.b=parseInt(e(255-i.b,100,r),10)+i.b),a=c.g,l=c.b,"#"+o(c.r)+o(a)+o(l))},l=function(o,n,e){void 0===e&&(e=22);var l=100/Math.ceil(e/2),i=l*Math.floor(e/2),c=[];if(t(o))for(var f=0;f<e;f+=1){var d=a(o,i-f*l),s=r(d);c.push({name:f>e/2?n+"-"+f:f===e/2?n:n+"-"+(f+1),color:d,textColor:s})}return c},i=function(){return"undefined"!=typeof window},c=function(o,t,r){var e=t.color,a=t.color,l=t.color,i=t.color,c=t.color,f=t.textColor,d=t.textColor,s=t.color,b=t.textColor;return o[r+2]?a=o[r+2].color:o[r-2]&&(a=o[r-2].color),o[r+1]?l=o[r+1].color:o[r-1]&&(l=o[r-1].color),o[r+2]?i=o[r+2].color:o[r-2]&&(i=o[r-2].color),o[r+4]?c=o[r+4].color:o[r-4]&&(c=o[r-4].color),o[r+4]?f=o[r+4].textColor:o[r-4]&&(f=o[r-4].textColor),o[r+2]?e=o[r+2].color:o[r-2]&&(e=o[r-2].color),o[r+2]?d=o[r+2].textColor:o[r-2]&&(d=o[r-2].textColor),o[r+3]?s=o[r+3].color:o[r-3]&&(s=o[r-3].color),o[r+3]?b=o[r+3].textColor:o[r-3]&&(b=o[r-3].textColor),"\n button.fr-btn-"+t.name+"{\n background-color:"+t.color+";\n border-color:"+t.color+";\n color:"+t.textColor+" !important;\n }\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):hover{\n background-color:"+e+";\n border-color:"+e+";\n color:"+d+"\n }\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-"+t.name+".fr-dropdown-toggle{\n color: "+b+";\n background-color: "+s+";\n border-color: "+s+";\n }\n .fr-border-"+t.name+"{border-color: "+t.color+" !important;}\n .fr-bg-"+t.name+"{background-color: "+t.color+" !important;}\n .gradient.fr-bg-"+t.name+",fr-btn-outline-"+t.name+":hover,\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,"+t.color+","+a+");\n }\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,"+t.color+","+l+");\n color: "+t.textColor+";\n }\n button.gradient.fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,"+i+","+c+");\n color: "+f+";\n }\n .fr-text-"+t.name+"{color: "+t.color+" !important;}\n .fr-btn-outline-"+t.name+"{\n color: "+t.color+";\n border-color: "+t.color+";\n }\n .fr-btn-outline-"+t.name+":hover{\n color: "+t.textColor+";\n background-color: "+t.color+";\n border-color: "+t.color+";\n }\n .fr-btn-outline-"+t.name+".fr-disabled,\n .fr-btn-outline-"+t.name+":disabled{\n color: "+t.color+" !important;\n background-color: transparent !important;\n border-color: "+t.color+" !important;\n }\n .fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-"+t.name+":not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-"+t.name+":not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-"+t.name+".fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem "+n(t.color)+";\n }\n .fr-btn-"+t.name+":focus, .fr-btn-outline-"+t.name+":focus{\n box-shadow: 0 0 0 0.2rem "+n(t.color)+";\n }\n .fr-component-hover-"+t.name+":hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:"+t.textColor+" !important;\n }\n .fr-component-hover-"+t.name+":hover:not(button){\n background-color:"+t.color+" !important;\n border-color:"+e+" !important;\n }\n .fr-icon.fr-i-"+t.name+" path{\n fill: "+t.color+";\n }\n .fr-btn-"+t.name+" .fr-icon path{\n fill: "+t.textColor+";\n }\n"};"undefined"!=typeof window&&(window.FR||(window.FR={}),window.FR.initTheme=function(o){var t=[],e={palette:{},designTokens:o.designTokens||{}},a=[];if(o.config&&o.config.outputFields&&(a=o.config.outputFields),a.includes("colors")&&(e.colors=o.colors),a.includes("typography")&&(e.typography=o.typography),o){if(o.typography&&t.push(function(o){var n="";return o.css&&"string"==typeof o.css&&(n+=o.css),o.fonts&&"object"==typeof o.fonts&&Object.keys(o.fonts).map(function(t){return"object"==typeof o.fonts[t]&&(o.fonts[t].preset?n+="@import url('"+o.fonts[t].preset+"');":Array.isArray(o.fonts[t].src)&&(n+="@font-face {\n font-family: '"+(o.fonts[t].alias?o.fonts[t].alias:t)+"';\n "+(o.fonts[t].fontStyle?"font-style:"+o.fonts[t].fontStyle+";":"")+"\n "+(o.fonts[t].fontWeight?"font-weight:"+o.fonts[t].fontWeight+";":"")+"\n "+(o.fonts[t].fontDisplay?"font-display:"+o.fonts[t].fontDisplay+";":"")+"\n src:",o.fonts[t].local&&o.fonts[t].local.forEach(function(o){n+="local('"+o+"'),"}),o.fonts[t].src.forEach(function(r,e){n+="url('"+r.url+"') format('"+r.format+"')"+(e<o.fonts[t].src.length-1?",":"")}),n+="}"),n+=".fr-font-name-"+t.toLocaleLowerCase().replace(/ /g,"-")+"{font-family: '"+(o.fonts[t].alias?o.fonts[t].alias:t)+"', 'sans-serif'}"),t}),n}(o.typography)),o.colors){t.push(["button.fr-btn:disabled{\n background-color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#d4d4d4")+";\n border-color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#d4d4d4")+";\n color:"+(o.components&&o.components.button&&o.components.button.disabled&&o.components.button.disabled.bgColor?o.components.button.disabled.bgColor:"#afafaf")+"\n }\n "]);for(var f=Object.keys(o.colors),d=0;d<f.length;d+=1){var s=f[d],b=o.colors[f[d]];if("none"!==b){e.palette[""+s]=b;var u=l(b,s);if(o.config&&o.config.generatePalette)u.forEach(function(o,n){if(e.palette[""+o.name]=o.color,i()){var r=c(u,o,n);t.push(r.replace(/\n. |\r/g,""))}});else if(i()){var m=c(u,{color:b,name:s,textColor:r(b)},11);t.push(m.replace(/\n. |\r/g,""))}}}if(o.colors.primary){var p=n(o.colors.primary,.25);t.push(".fr-focus:focus, .fr-form-control:focus, .fr-focus\\:focus{box-shadow: 0 0 0 0.2rem "+p+";outline: 0;}")}}if(i()&&"undefined"!=typeof document){var g=document.getElementById("frTheming");if(g)g.innerHTML=t.join(" ");else{var h=""+t.join(" "),v=document.body||document.getElementsByTagName("body")[0],y=document.createElement("style");y.type="text/css",y.id="frTheming",y.styleSheet?y.styleSheet.cssText=h:y.appendChild(document.createTextNode(h)),v.appendChild(y)}}}return e})});
|
|
2
2
|
//# sourceMappingURL=front10-helpers.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front10-helpers.umd.js","sources":["../src/Color/Color.js","../src/canI/canI.js","../src/ThemeBuilder/ThemeBuilder.js","../src/index.js"],"sourcesContent":["const componentToHex = c => {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n};\n\nconst rgb2Hex = (r, g, b) =>\n `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;\n\nconst hexToRGBA = (hex, alpha = 0.5) => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n return `rgba(${(c >> 16) & 255},${(c >> 8) & 255},${c & 255},${alpha})`;\n } else {\n // console.error(\"Bad Hex:\", hex, \"Alpha: \", alpha);\n return false;\n }\n};\n\nconst isColor = color => {\n if (hex2RGB(color)) return true;\n else return false;\n};\n\nconst hex2RGB = hex => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n // eslint-disable-next-line no-bitwise\n return { r: (c >> 16) & 255, g: (c >> 8) & 255, b: c & 255 };\n } else {\n return false;\n // throw new Error(\"Bad Hex\");\n }\n};\n\n// https://24ways.org/2010/calculating-color-contrast\n// https://www.w3.org/WAI/ER/WD-AERT/#color-contrast\nconst getContrast = hexColor => {\n const rgb = hex2RGB(hexColor);\n if (rgb) {\n const yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n return yiq >= 128 ? \"#000000\" : \"#FFFFFF\";\n } else return false;\n};\n\nconst variacion = (H, Z, value) => {\n return (H / Z) * value;\n};\n\n// https://www.w3.org/TR/WCAG20/#relativeluminancedef\nconst colorBrightness = (color, value) => {\n const rgb = hex2RGB(color);\n const t = {};\n if (rgb) {\n if (value < 0) {\n t.r = rgb.r - parseInt((rgb.r / 100) * -value, 10);\n t.g = rgb.g - parseInt((rgb.g / 100) * -value, 10);\n t.b = rgb.b - parseInt((rgb.b / 100) * -value, 10);\n } else {\n t.r = parseInt(variacion(255 - rgb.r, 100, value), 10) + rgb.r;\n t.g = parseInt(variacion(255 - rgb.g, 100, value), 10) + rgb.g;\n t.b = parseInt(variacion(255 - rgb.b, 100, value), 10) + rgb.b;\n }\n return rgb2Hex(t.r, t.g, t.b);\n } else return false;\n};\n\n/**\n * Function to generate a colors palette.\n * This function return a array of colors\n * in the following format: [{color: 'string', textColor: 'string', name: 'string' }]\n * @param {string} hexColor Color in hexadecimal format\n * @param {string} name Name of color\n * @param {integer} cantShape Cant of variations\n */\nconst generatePalette = (hexColor, name, cantShape = 22) => {\n const step = 100 / Math.ceil(cantShape / 2);\n const startVal = step * Math.floor(cantShape / 2);\n const colors = [];\n if (isColor(hexColor)) {\n for (let i = 0; i < cantShape; i += 1) {\n const color = colorBrightness(hexColor, startVal - i * step);\n const textColor = getContrast(color);\n let tmpName;\n if (i > cantShape / 2) tmpName = `${name}-${i}`;\n else if (i === cantShape / 2) tmpName = name;\n else tmpName = `${name}-${i + 1}`;\n colors.push({\n name: tmpName,\n color,\n textColor\n });\n }\n }\n return colors;\n};\n\nexport { generatePalette, getContrast, hex2RGB, hexToRGBA, rgb2Hex, isColor };\n","const subscribersMap = {};\nconst addedGlobalEventListeners = false;\n\n/**\n * Returns an element\n * @param {*} elementSelector\n */\nconst getElement = elementSelector => {\n return document.querySelector(elementSelector);\n};\n\n/**\n * Iterate through the listeners list and try to resolve\n * the promise if they are visible in the viewport\n * TODO: Fix the viewport detection part\n */\nconst resolveListeners = () => {\n const subscribersKeyList = Object.keys(subscribersMap);\n if (subscribersKeyList.length > 0) {\n for (let index = 0; index < subscribersKeyList.length; index++) {\n const key = subscribersKeyList[index];\n if (subscribersMap[key]) {\n //Only full load component when is visible in viewport\n if (isElementInViewport(getElement(key))) {\n subscribersMap[key].resolve(true);\n subscribersMap[key] = null;\n delete subscribersMap[key];\n }\n }\n }\n }\n};\n\n/**\n * Helper function to simulate a setInterval but\n * wthout hurting the browser performance\n * @param {*} fn\n * @param {*} delay\n */\nconst requestInterval = (fn, delay) => {\n const requestAnimFrame = (() => {\n return (\n window.requestAnimationFrame ||\n function hello(callback) {\n window.setTimeout(callback, 1000 / 60);\n }\n );\n })();\n let start = new Date().getTime();\n const handle = {};\n function loop() {\n handle.value = requestAnimFrame(loop);\n const current = new Date().getTime();\n const delta = current - start;\n if (delta >= delay) {\n fn.call();\n start = new Date().getTime();\n }\n }\n handle.value = requestAnimFrame(loop);\n return handle;\n};\n\n/**\n * Try to resolve all listeners once an\n * user wants to play with the components\n * this heuristics are very basic, we should\n * find better ones.\n */\nconst addGlobalEventListeners = () => {\n window.addEventListener(\"scroll\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"click\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"mousemove\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"keydown\", () => {\n resolveListeners();\n });\n\n requestInterval(() => {\n resolveListeners();\n }, 2000);\n};\n\n/**\n * Returns the DocElement\n */\nconst getDocElement = () => {\n if (window !== undefined) {\n return window.document.documentElement;\n }\n return false;\n};\n\n/**\n * Obtaining the viewport height\n * @method _getViewportH\n * @return ConditionalExpression\n */\nconst getViewportH = () => {\n const client = getDocElement.clientHeight;\n const inner = window.innerHeight;\n return client < inner ? inner : client;\n};\n\n/**\n * The offset of the element\n * @method _getOffset\n * @param {} el\n * @return ObjectExpression\n */\nconst getOffset = el => {\n let offsetTop = 0;\n let offsetLeft = 0;\n /* eslint-disable */\n do {\n if (!isNaN(el.offsetTop)) {\n offsetTop += el.offsetTop;\n }\n if (!isNaN(el.offsetLeft)) {\n offsetLeft += el.offsetLeft;\n }\n } while ((el = el.offsetParent));\n /* eslint-enable */\n return {\n top: offsetTop,\n left: offsetLeft\n };\n};\n\n/**\n * Return true if the element if visible in a viewport zone\n * @param {} el\n * @param {} h\n * @return LogicalExpression\n */\nconst isElementInViewport = el => {\n if (canIExecuteClientCode() && el) {\n let element = el;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n while (element.offsetParent) {\n element = element.offsetParent;\n top += element.offsetTop;\n left += element.offsetLeft;\n }\n\n return (\n top < window.pageYOffset + window.innerHeight &&\n left < window.pageXOffset + window.innerWidth &&\n top + height > window.pageYOffset &&\n left + width > window.pageXOffset\n );\n }\n};\n\n/**\n * Returns a promise that resolves once the initial\n * browser processing is done. This allows to save\n * the users that uses low cpu devices and also have\n * awesome results in Google Page Speed\n * @param {*} elementSelector\n * @param {*} inSSR\n */\nconst canILiftOff = (elementSelector, inSSR = true) => {\n return new Promise(resolve => {\n // we don't need to wait in SSR\n if (window === undefined && inSSR) {\n resolve(true);\n } else {\n // adds global listeners that will trigger\n // once a real person is interacting with the browser\n if (!addedGlobalEventListeners) {\n addGlobalEventListeners();\n }\n // saving all the component instances subscriptions\n subscribersMap[elementSelector] = {\n resolve\n };\n }\n });\n};\n\nconst canIExecuteClientCode = () => {\n return typeof window !== \"undefined\";\n};\n\nexport { canILiftOff, isElementInViewport, canIExecuteClientCode };\n","import { generatePalette, hexToRGBA, getContrast } from \"../Color\";\nimport { canIExecuteClientCode } from \"../canI\";\n\nconst generateTypographyStyles = async (typography) => {\n let style = \"\";\n if (typeof typography === \"object\" && Array.isArray(typography)) {\n const dataFonts = typography.map((item) => {\n return {\n name: item,\n outputType: \"string\"\n };\n });\n const rawResponse = await fetch(\n \"https://em-font-service-prod.airtrfx.com\",\n {\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n },\n method: \"POST\",\n body: JSON.stringify({\n fonts: dataFonts\n })\n }\n );\n\n const cssObject = await rawResponse.json();\n let css = \"\";\n Object.keys(cssObject).forEach((item) => {\n css += cssObject[item].css;\n });\n return css;\n }\n if (typography.fonts && typeof typography.fonts === \"object\") {\n Object.keys(typography.fonts).map((fontName) => {\n if (typeof typography.fonts[fontName] === \"object\") {\n if (typography.fonts[fontName].preset)\n style += `@import url('${typography.fonts[fontName].preset}');`;\n else if (Array.isArray(typography.fonts[fontName].src)) {\n style += `@font-face {\n font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }';\n ${\n typography.fonts[fontName].fontStyle\n ? `font-style:${typography.fonts[fontName].fontStyle};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontWeight\n ? `font-weight:${typography.fonts[fontName].fontWeight};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontDisplay\n ? `font-display:${typography.fonts[fontName].fontDisplay};`\n : \"\"\n }\n src:`;\n\n typography.fonts[fontName].local &&\n typography.fonts[fontName].local.forEach((local) => {\n style += `local('${local}'),`;\n });\n typography.fonts[fontName].src.forEach((fontSrc, index) => {\n style += `url('${fontSrc.url}') format('${fontSrc.format}')${\n index < typography.fonts[fontName].src.length - 1 ? \",\" : \"\"\n }`;\n });\n style += \"}\";\n }\n style += `.fr-font-name-${fontName\n .toLocaleLowerCase()\n .replace(/ /g, \"-\")}{font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }', 'sans-serif'}`;\n }\n return fontName;\n });\n }\n return style;\n};\n\nconst generateStylesPalette = (palette, item, i) => {\n let hoverBgColor = item.color;\n let gradientTo = item.color;\n let gradientButtonToHover = item.color;\n let gradientButtonFromActive = item.color;\n let gradientButtonToActive = item.color;\n let gradientButtonTextActive = item.textColor;\n let hoverColor = item.textColor;\n let activeBgColor = item.color;\n let activeColor = item.textColor;\n\n if (palette[i + 2]) gradientTo = palette[i + 2].color;\n else if (palette[i - 2]) gradientTo = palette[i - 2].color;\n\n if (palette[i + 1]) gradientButtonToHover = palette[i + 1].color;\n else if (palette[i - 1]) gradientButtonToHover = palette[i - 1].color;\n\n if (palette[i + 2]) gradientButtonFromActive = palette[i + 2].color;\n else if (palette[i - 2]) gradientButtonFromActive = palette[i - 2].color;\n\n if (palette[i + 4]) gradientButtonToActive = palette[i + 4].color;\n else if (palette[i - 4]) gradientButtonToActive = palette[i - 4].color;\n\n if (palette[i + 4]) gradientButtonTextActive = palette[i + 4].textColor;\n else if (palette[i - 4]) gradientButtonTextActive = palette[i - 4].textColor;\n\n if (palette[i + 2]) hoverBgColor = palette[i + 2].color;\n else if (palette[i - 2]) hoverBgColor = palette[i - 2].color;\n\n if (palette[i + 2]) hoverColor = palette[i + 2].textColor;\n else if (palette[i - 2]) hoverColor = palette[i - 2].textColor;\n\n if (palette[i + 3]) activeBgColor = palette[i + 3].color;\n else if (palette[i - 3]) activeBgColor = palette[i - 3].color;\n\n if (palette[i + 3]) activeColor = palette[i + 3].textColor;\n else if (palette[i - 3]) activeColor = palette[i - 3].textColor;\n const styles = `\n button.fr-btn-${item.name}{\n background-color:${item.color};\n border-color:${item.color};\n color:${item.textColor} !important;\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover{\n background-color:${hoverBgColor};\n border-color:${hoverBgColor};\n color:${hoverColor}\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle{\n color: ${activeColor};\n background-color: ${activeBgColor};\n border-color: ${activeBgColor};\n }\n .fr-border-${item.name}{border-color: ${item.color} !important;}\n .fr-bg-${item.name}{background-color: ${item.color} !important;}\n .gradient.fr-bg-${item.name},fr-btn-outline-${item.name}:hover,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,${item.color},${gradientTo});\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,${\n item.color\n },${gradientButtonToHover});\n color: ${item.textColor};\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,${gradientButtonFromActive},${gradientButtonToActive});\n color: ${gradientButtonTextActive};\n }\n .fr-text-${item.name}{color: ${item.color} !important;}\n .fr-btn-outline-${item.name}{\n color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}:hover{\n color: ${item.textColor};\n background-color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}.fr-disabled,\n .fr-btn-outline-${item.name}:disabled{\n color: ${item.color} !important;\n background-color: transparent !important;\n border-color: ${item.color} !important;\n }\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-btn-${item.name}:focus, .fr-btn-outline-${item.name}:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-component-hover-${\n item.name\n }:hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:${item.textColor} !important;\n }\n .fr-component-hover-${item.name}:hover:not(button){\n background-color:${item.color} !important;\n border-color:${hoverBgColor} !important;\n }\n .fr-icon.fr-i-${item.name} path{\n fill: ${item.color};\n }\n .fr-btn-${item.name} .fr-icon path{\n fill: ${item.textColor};\n }\n`;\n return styles;\n};\n\nconst initTheme = async (theme) => {\n const generatedStyles = [];\n const themeToken = {\n palette: {},\n designTokens: theme.designTokens || {}\n };\n\n let outputFields = [];\n if (theme.config && theme.config.outputFields) {\n outputFields = theme.config.outputFields;\n }\n if (outputFields.includes(\"colors\")) themeToken.colors = theme.colors;\n if (outputFields.includes(\"typography\"))\n themeToken.typography = theme.typography;\n if (theme) {\n if (theme.typography) {\n generatedStyles.push(await generateTypographyStyles(theme.typography));\n }\n if (theme.colors) {\n generatedStyles.push([\n `button.fr-btn:disabled{\n background-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n border-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#afafaf\"\n }\n }\n `\n ]);\n const themeColorsKeys = Object.keys(theme.colors);\n for (let index = 0; index < themeColorsKeys.length; index += 1) {\n const colorName = themeColorsKeys[index];\n const colorValue = theme.colors[themeColorsKeys[index]];\n if (colorValue !== \"none\") {\n // Adding base color to palette\n themeToken.palette[`${colorName}`] = colorValue;\n const palette = generatePalette(colorValue, colorName);\n if (theme.config && theme.config.generatePalette) {\n palette.forEach((item, i) => {\n // Adding color variations to the palette\n themeToken.palette[`${item.name}`] = item.color;\n // Avoiding executing unnecessary code that is not needed in the SSR\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(palette, item, i);\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n });\n } else {\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(\n palette,\n {\n color: colorValue,\n name: colorName,\n textColor: getContrast(colorValue)\n },\n 11\n );\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n }\n }\n }\n if (theme.colors.primary) {\n const primaryHover = hexToRGBA(theme.colors.primary, 0.25);\n generatedStyles.push(\n `.fr-focus:focus, .fr-form-control:focus, .fr-focus\\\\:focus{box-shadow: 0 0 0 0.2rem ${primaryHover};outline: 0;}`\n );\n }\n }\n if (canIExecuteClientCode() && typeof document != \"undefined\") {\n const element = document.getElementById(\"frTheming\");\n if (element) {\n element.innerHTML = generatedStyles.join(\" \");\n } else {\n const themeStyleNode = `${generatedStyles.join(\" \")}`;\n\n const body = document.body || document.getElementsByTagName(\"body\")[0];\n const style = document.createElement(\"style\");\n\n style.type = \"text/css\";\n style.id = \"frTheming\";\n if (style.styleSheet) {\n // This is required for IE8 and below.\n style.styleSheet.cssText = themeStyleNode;\n } else {\n style.appendChild(document.createTextNode(themeStyleNode));\n }\n body.appendChild(style);\n }\n }\n }\n return themeToken;\n};\n\nexport { initTheme };\n","import { initTheme } from \"./ThemeBuilder\";\nif(typeof window !== \"undefined\"){\n if(!window.FR) window.FR = {};\n window.FR.initTheme=initTheme;\n}"],"names":["const","componentToHex","c","hex","toString","length","hexToRGBA","alpha","test","substring","split","join","hex2RGB","r","g","b","getContrast","hexColor","rgb","variacion","H","Z","value","colorBrightness","color","t","parseInt","generatePalette","name","cantShape","step","Math","ceil","startVal","floor","colors","let","i","textColor","push","canIExecuteClientCode","window","generateStylesPalette","palette","item","hoverBgColor","gradientTo","gradientButtonToHover","gradientButtonFromActive","gradientButtonToActive","gradientButtonTextActive","hoverColor","activeBgColor","activeColor","FR","initTheme","theme","generatedStyles","themeToken","designTokens","outputFields","config","includes","typography","components","button","disabled","bgColor","themeColorsKeys","Object","keys","index","colorName","colorValue","forEach","styles","replace","primary","primaryHover","document","element","getElementById","innerHTML","themeStyleNode","body","getElementsByTagName","style","createElement","type","id","styleSheet","cssText","appendChild","createTextNode","fonts","map","fontName","preset","Array","isArray","src","alias","fontStyle","fontWeight","fontDisplay","local","fontSrc","toLocaleLowerCase","dataFonts","outputType","fetch","headers","Accept","method","JSON","stringify","rawResponse","json","cssObject","css","generateTypographyStyles"],"mappings":"0IAAAA,IAAMC,WAAiBC,OACfC,EAAMD,EAAEE,SAAS,WACD,IAAfD,EAAIE,WAAmBF,EAAQA,GAMlCG,WAAaH,EAAKI,OAClBL,wBAD0B,MAE1B,2BAA2BM,KAAKL,KAEjB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,EAAW+B,MAAME,mBACjC,yBAIRjC,EAAW+B,MAAME,GAAUS,OACzB1C,EAAW+B,MAAME,GAAUS,MAAM/B,iBAAS+B,GACxCnB,GAAU,UAASmB,UAEvB1C,EAAW+B,MAAME,GAAUI,IAAI1B,iBAASgC,EAASnC,GAC/Ce,GAAU,QAAOoB,oBAAyBA,eACxCnC,EAAQR,EAAW+B,MAAME,GAAUI,IAAI/F,OAAS,EAAI,IAAM,MAG9DiF,GAAS,KAEXA,GAAU,iBAAgBU,EACvBW,oBACA/B,QAAQ,KAAM,wBACfb,EAAW+B,MAAME,GAAUK,MACvBtC,EAAW+B,MAAME,GAAUK,MAC3BL,uBAGDA,IAGJV,OAhFHA,EAAQ,mBACc,iBAAfvB,GAA2BmC,MAAMC,QAAQpC,QAC5C6C,EAAY7C,EAAWgC,aAAKnD,SACzB,CACLhB,KAAMgB,EACNiE,WAAY,mCAGUC,MACxB,2CACA,CACEC,QAAS,CACPC,OAAQ,kCACQ,oBAElBC,OAAQ,OACR7B,KAAM8B,KAAKC,UAAU,CACnBrB,MAAOc,qBATPQ,0BAckBA,EAAYC,sBAA9BC,OACFC,EAAM,UACVlD,OAAOC,KAAKgD,GAAW5C,iBAAS9B,GAC9B2E,GAAOD,EAAU1E,GAAM2E,WAElBA,8FAyMsBC,CAAyBhE,EAAMO,qCAA1DN,wGA+FGC,IAAAA"}
|
|
1
|
+
{"version":3,"file":"front10-helpers.umd.js","sources":["../src/Color/Color.js","../src/canI/canI.js","../src/ThemeBuilder/ThemeBuilder.js","../src/index.js"],"sourcesContent":["const componentToHex = c => {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n};\n\nconst rgb2Hex = (r, g, b) =>\n `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;\n\nconst hexToRGBA = (hex, alpha = 0.5) => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n return `rgba(${(c >> 16) & 255},${(c >> 8) & 255},${c & 255},${alpha})`;\n } else {\n // console.error(\"Bad Hex:\", hex, \"Alpha: \", alpha);\n return false;\n }\n};\n\nconst isColor = color => {\n if (hex2RGB(color)) return true;\n else return false;\n};\n\nconst hex2RGB = hex => {\n let c;\n if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {\n c = hex.substring(1).split(\"\");\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n c = `0x${c.join(\"\")}`;\n // eslint-disable-next-line no-bitwise\n return { r: (c >> 16) & 255, g: (c >> 8) & 255, b: c & 255 };\n } else {\n return false;\n // throw new Error(\"Bad Hex\");\n }\n};\n\n// https://24ways.org/2010/calculating-color-contrast\n// https://www.w3.org/WAI/ER/WD-AERT/#color-contrast\nconst getContrast = hexColor => {\n const rgb = hex2RGB(hexColor);\n if (rgb) {\n const yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n return yiq >= 128 ? \"#000000\" : \"#FFFFFF\";\n } else return false;\n};\n\nconst variacion = (H, Z, value) => {\n return (H / Z) * value;\n};\n\n// https://www.w3.org/TR/WCAG20/#relativeluminancedef\nconst colorBrightness = (color, value) => {\n const rgb = hex2RGB(color);\n const t = {};\n if (rgb) {\n if (value < 0) {\n t.r = rgb.r - parseInt((rgb.r / 100) * -value, 10);\n t.g = rgb.g - parseInt((rgb.g / 100) * -value, 10);\n t.b = rgb.b - parseInt((rgb.b / 100) * -value, 10);\n } else {\n t.r = parseInt(variacion(255 - rgb.r, 100, value), 10) + rgb.r;\n t.g = parseInt(variacion(255 - rgb.g, 100, value), 10) + rgb.g;\n t.b = parseInt(variacion(255 - rgb.b, 100, value), 10) + rgb.b;\n }\n return rgb2Hex(t.r, t.g, t.b);\n } else return false;\n};\n\n/**\n * Function to generate a colors palette.\n * This function return a array of colors\n * in the following format: [{color: 'string', textColor: 'string', name: 'string' }]\n * @param {string} hexColor Color in hexadecimal format\n * @param {string} name Name of color\n * @param {integer} cantShape Cant of variations\n */\nconst generatePalette = (hexColor, name, cantShape = 22) => {\n const step = 100 / Math.ceil(cantShape / 2);\n const startVal = step * Math.floor(cantShape / 2);\n const colors = [];\n if (isColor(hexColor)) {\n for (let i = 0; i < cantShape; i += 1) {\n const color = colorBrightness(hexColor, startVal - i * step);\n const textColor = getContrast(color);\n let tmpName;\n if (i > cantShape / 2) tmpName = `${name}-${i}`;\n else if (i === cantShape / 2) tmpName = name;\n else tmpName = `${name}-${i + 1}`;\n colors.push({\n name: tmpName,\n color,\n textColor\n });\n }\n }\n return colors;\n};\n\nexport { generatePalette, getContrast, hex2RGB, hexToRGBA, rgb2Hex, isColor };\n","const subscribersMap = {};\nconst addedGlobalEventListeners = false;\n\n/**\n * Returns an element\n * @param {*} elementSelector\n */\nconst getElement = elementSelector => {\n return document.querySelector(elementSelector);\n};\n\n/**\n * Iterate through the listeners list and try to resolve\n * the promise if they are visible in the viewport\n * TODO: Fix the viewport detection part\n */\nconst resolveListeners = () => {\n const subscribersKeyList = Object.keys(subscribersMap);\n if (subscribersKeyList.length > 0) {\n for (let index = 0; index < subscribersKeyList.length; index++) {\n const key = subscribersKeyList[index];\n if (subscribersMap[key]) {\n //Only full load component when is visible in viewport\n if (isElementInViewport(getElement(key))) {\n subscribersMap[key].resolve(true);\n subscribersMap[key] = null;\n delete subscribersMap[key];\n }\n }\n }\n }\n};\n\n/**\n * Helper function to simulate a setInterval but\n * wthout hurting the browser performance\n * @param {*} fn\n * @param {*} delay\n */\nconst requestInterval = (fn, delay) => {\n const requestAnimFrame = (() => {\n return (\n window.requestAnimationFrame ||\n function hello(callback) {\n window.setTimeout(callback, 1000 / 60);\n }\n );\n })();\n let start = new Date().getTime();\n const handle = {};\n function loop() {\n handle.value = requestAnimFrame(loop);\n const current = new Date().getTime();\n const delta = current - start;\n if (delta >= delay) {\n fn.call();\n start = new Date().getTime();\n }\n }\n handle.value = requestAnimFrame(loop);\n return handle;\n};\n\n/**\n * Try to resolve all listeners once an\n * user wants to play with the components\n * this heuristics are very basic, we should\n * find better ones.\n */\nconst addGlobalEventListeners = () => {\n window.addEventListener(\"scroll\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"click\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"mousemove\", () => {\n resolveListeners();\n });\n\n window.addEventListener(\"keydown\", () => {\n resolveListeners();\n });\n\n requestInterval(() => {\n resolveListeners();\n }, 2000);\n};\n\n/**\n * Returns the DocElement\n */\nconst getDocElement = () => {\n if (window !== undefined) {\n return window.document.documentElement;\n }\n return false;\n};\n\n/**\n * Obtaining the viewport height\n * @method _getViewportH\n * @return ConditionalExpression\n */\nconst getViewportH = () => {\n const client = getDocElement.clientHeight;\n const inner = window.innerHeight;\n return client < inner ? inner : client;\n};\n\n/**\n * The offset of the element\n * @method _getOffset\n * @param {} el\n * @return ObjectExpression\n */\nconst getOffset = el => {\n let offsetTop = 0;\n let offsetLeft = 0;\n /* eslint-disable */\n do {\n if (!isNaN(el.offsetTop)) {\n offsetTop += el.offsetTop;\n }\n if (!isNaN(el.offsetLeft)) {\n offsetLeft += el.offsetLeft;\n }\n } while ((el = el.offsetParent));\n /* eslint-enable */\n return {\n top: offsetTop,\n left: offsetLeft\n };\n};\n\n/**\n * Return true if the element if visible in a viewport zone\n * @param {} el\n * @param {} h\n * @return LogicalExpression\n */\nconst isElementInViewport = el => {\n if (canIExecuteClientCode() && el) {\n let element = el;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n const width = element.offsetWidth;\n const height = element.offsetHeight;\n\n while (element.offsetParent) {\n element = element.offsetParent;\n top += element.offsetTop;\n left += element.offsetLeft;\n }\n\n return (\n top < window.pageYOffset + window.innerHeight &&\n left < window.pageXOffset + window.innerWidth &&\n top + height > window.pageYOffset &&\n left + width > window.pageXOffset\n );\n }\n};\n\n/**\n * Returns a promise that resolves once the initial\n * browser processing is done. This allows to save\n * the users that uses low cpu devices and also have\n * awesome results in Google Page Speed\n * @param {*} elementSelector\n * @param {*} inSSR\n */\nconst canILiftOff = (elementSelector, inSSR = true) => {\n return new Promise(resolve => {\n // we don't need to wait in SSR\n if (window === undefined && inSSR) {\n resolve(true);\n } else {\n // adds global listeners that will trigger\n // once a real person is interacting with the browser\n if (!addedGlobalEventListeners) {\n addGlobalEventListeners();\n }\n // saving all the component instances subscriptions\n subscribersMap[elementSelector] = {\n resolve\n };\n }\n });\n};\n\nconst canIExecuteClientCode = () => {\n return typeof window !== \"undefined\";\n};\n\nexport { canILiftOff, isElementInViewport, canIExecuteClientCode };\n","import { generatePalette, hexToRGBA, getContrast } from \"../Color\";\nimport { canIExecuteClientCode } from \"../canI\";\n\nconst generateTypographyStyles = (typography) => {\n let style = \"\";\n if (typography.css && typeof typography.css === \"string\") {\n style += typography.css;\n }\n if (typography.fonts && typeof typography.fonts === \"object\") {\n Object.keys(typography.fonts).map((fontName) => {\n if (typeof typography.fonts[fontName] === \"object\") {\n if (typography.fonts[fontName].preset)\n style += `@import url('${typography.fonts[fontName].preset}');`;\n else if (Array.isArray(typography.fonts[fontName].src)) {\n style += `@font-face {\n font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }';\n ${\n typography.fonts[fontName].fontStyle\n ? `font-style:${typography.fonts[fontName].fontStyle};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontWeight\n ? `font-weight:${typography.fonts[fontName].fontWeight};`\n : \"\"\n }\n ${\n typography.fonts[fontName].fontDisplay\n ? `font-display:${typography.fonts[fontName].fontDisplay};`\n : \"\"\n }\n src:`;\n\n typography.fonts[fontName].local &&\n typography.fonts[fontName].local.forEach((local) => {\n style += `local('${local}'),`;\n });\n typography.fonts[fontName].src.forEach((fontSrc, index) => {\n style += `url('${fontSrc.url}') format('${fontSrc.format}')${\n index < typography.fonts[fontName].src.length - 1 ? \",\" : \"\"\n }`;\n });\n style += \"}\";\n }\n style += `.fr-font-name-${fontName\n .toLocaleLowerCase()\n .replace(/ /g, \"-\")}{font-family: '${\n typography.fonts[fontName].alias\n ? typography.fonts[fontName].alias\n : fontName\n }', 'sans-serif'}`;\n }\n return fontName;\n });\n }\n return style;\n};\n\nconst generateStylesPalette = (palette, item, i) => {\n let hoverBgColor = item.color;\n let gradientTo = item.color;\n let gradientButtonToHover = item.color;\n let gradientButtonFromActive = item.color;\n let gradientButtonToActive = item.color;\n let gradientButtonTextActive = item.textColor;\n let hoverColor = item.textColor;\n let activeBgColor = item.color;\n let activeColor = item.textColor;\n\n if (palette[i + 2]) gradientTo = palette[i + 2].color;\n else if (palette[i - 2]) gradientTo = palette[i - 2].color;\n\n if (palette[i + 1]) gradientButtonToHover = palette[i + 1].color;\n else if (palette[i - 1]) gradientButtonToHover = palette[i - 1].color;\n\n if (palette[i + 2]) gradientButtonFromActive = palette[i + 2].color;\n else if (palette[i - 2]) gradientButtonFromActive = palette[i - 2].color;\n\n if (palette[i + 4]) gradientButtonToActive = palette[i + 4].color;\n else if (palette[i - 4]) gradientButtonToActive = palette[i - 4].color;\n\n if (palette[i + 4]) gradientButtonTextActive = palette[i + 4].textColor;\n else if (palette[i - 4]) gradientButtonTextActive = palette[i - 4].textColor;\n\n if (palette[i + 2]) hoverBgColor = palette[i + 2].color;\n else if (palette[i - 2]) hoverBgColor = palette[i - 2].color;\n\n if (palette[i + 2]) hoverColor = palette[i + 2].textColor;\n else if (palette[i - 2]) hoverColor = palette[i - 2].textColor;\n\n if (palette[i + 3]) activeBgColor = palette[i + 3].color;\n else if (palette[i - 3]) activeBgColor = palette[i - 3].color;\n\n if (palette[i + 3]) activeColor = palette[i + 3].textColor;\n else if (palette[i - 3]) activeColor = palette[i - 3].textColor;\n const styles = `\n button.fr-btn-${item.name}{\n background-color:${item.color};\n border-color:${item.color};\n color:${item.textColor} !important;\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover{\n background-color:${hoverBgColor};\n border-color:${hoverBgColor};\n color:${hoverColor}\n }\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active,\n button.fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle{\n color: ${activeColor};\n background-color: ${activeBgColor};\n border-color: ${activeBgColor};\n }\n .fr-border-${item.name}{border-color: ${item.color} !important;}\n .fr-bg-${item.name}{background-color: ${item.color} !important;}\n .gradient.fr-bg-${item.name},fr-btn-outline-${item.name}:hover,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled){\n background-image: linear-gradient(to bottom,${item.color},${gradientTo});\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):hover,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):focus,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):hover{\n background-image: linear-gradient(to bottom,${\n item.color\n },${gradientButtonToHover});\n color: ${item.textColor};\n }\n button.gradient.fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active,\n button.gradient.fr-btn-outline-${\n item.name\n }:not(:disabled):not(.fr-disabled):active{\n background-image: linear-gradient(to bottom,${gradientButtonFromActive},${gradientButtonToActive});\n color: ${gradientButtonTextActive};\n }\n .fr-text-${item.name}{color: ${item.color} !important;}\n .fr-btn-outline-${item.name}{\n color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}:hover{\n color: ${item.textColor};\n background-color: ${item.color};\n border-color: ${item.color};\n }\n .fr-btn-outline-${item.name}.fr-disabled,\n .fr-btn-outline-${item.name}:disabled{\n color: ${item.color} !important;\n background-color: transparent !important;\n border-color: ${item.color} !important;\n }\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-${item.name}:not(:disabled):not(.fr-disabled):active:focus,\n .fr-btn-outline-${item.name}:not(:disabled):not(.fr-disabled).fr-active:focus,\n .fr-show > .fr-btn-outline-${item.name}.fr-dropdown-toggle:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-btn-${item.name}:focus, .fr-btn-outline-${item.name}:focus{\n box-shadow: 0 0 0 0.2rem ${hexToRGBA(item.color)};\n }\n .fr-component-hover-${\n item.name\n }:hover:not(.fr-row):not([class^=fr-col]):not(button)>*{\n color:${item.textColor} !important;\n }\n .fr-component-hover-${item.name}:hover:not(button){\n background-color:${item.color} !important;\n border-color:${hoverBgColor} !important;\n }\n .fr-icon.fr-i-${item.name} path{\n fill: ${item.color};\n }\n .fr-btn-${item.name} .fr-icon path{\n fill: ${item.textColor};\n }\n`;\n return styles;\n};\n\nconst initTheme = (theme) => {\n const generatedStyles = [];\n const themeToken = {\n palette: {},\n designTokens: theme.designTokens || {}\n };\n\n let outputFields = [];\n if (theme.config && theme.config.outputFields) {\n outputFields = theme.config.outputFields;\n }\n if (outputFields.includes(\"colors\")) themeToken.colors = theme.colors;\n if (outputFields.includes(\"typography\"))\n themeToken.typography = theme.typography;\n if (theme) {\n if (theme.typography) {\n generatedStyles.push(generateTypographyStyles(theme.typography));\n }\n if (theme.colors) {\n generatedStyles.push([\n `button.fr-btn:disabled{\n background-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n border-color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#d4d4d4\"\n };\n color:${\n theme.components &&\n theme.components.button &&\n theme.components.button.disabled &&\n theme.components.button.disabled.bgColor\n ? theme.components.button.disabled.bgColor\n : \"#afafaf\"\n }\n }\n `\n ]);\n const themeColorsKeys = Object.keys(theme.colors);\n for (let index = 0; index < themeColorsKeys.length; index += 1) {\n const colorName = themeColorsKeys[index];\n const colorValue = theme.colors[themeColorsKeys[index]];\n if (colorValue !== \"none\") {\n // Adding base color to palette\n themeToken.palette[`${colorName}`] = colorValue;\n const palette = generatePalette(colorValue, colorName);\n if (theme.config && theme.config.generatePalette) {\n palette.forEach((item, i) => {\n // Adding color variations to the palette\n themeToken.palette[`${item.name}`] = item.color;\n // Avoiding executing unnecessary code that is not needed in the SSR\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(palette, item, i);\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n });\n } else {\n if (canIExecuteClientCode()) {\n const styles = generateStylesPalette(\n palette,\n {\n color: colorValue,\n name: colorName,\n textColor: getContrast(colorValue)\n },\n 11\n );\n generatedStyles.push(styles.replace(/\\n. |\\r/g, \"\"));\n }\n }\n }\n }\n if (theme.colors.primary) {\n const primaryHover = hexToRGBA(theme.colors.primary, 0.25);\n generatedStyles.push(\n `.fr-focus:focus, .fr-form-control:focus, .fr-focus\\\\:focus{box-shadow: 0 0 0 0.2rem ${primaryHover};outline: 0;}`\n );\n }\n }\n if (canIExecuteClientCode() && typeof document != \"undefined\") {\n const element = document.getElementById(\"frTheming\");\n if (element) {\n element.innerHTML = generatedStyles.join(\" \");\n } else {\n const themeStyleNode = `${generatedStyles.join(\" \")}`;\n\n const body = document.body || document.getElementsByTagName(\"body\")[0];\n const style = document.createElement(\"style\");\n\n style.type = \"text/css\";\n style.id = \"frTheming\";\n if (style.styleSheet) {\n // This is required for IE8 and below.\n style.styleSheet.cssText = themeStyleNode;\n } else {\n style.appendChild(document.createTextNode(themeStyleNode));\n }\n body.appendChild(style);\n }\n }\n }\n return themeToken;\n};\n\nexport { initTheme };\n","import { initTheme } from \"./ThemeBuilder\";\nif(typeof window !== \"undefined\"){\n if(!window.FR) window.FR = {};\n window.FR.initTheme=initTheme;\n}"],"names":["const","componentToHex","c","hex","toString","length","hexToRGBA","alpha","test","substring","split","join","hex2RGB","r","g","b","getContrast","hexColor","rgb","variacion","H","Z","value","colorBrightness","color","t","parseInt","generatePalette","name","cantShape","step","Math","ceil","startVal","floor","colors","let","i","textColor","push","canIExecuteClientCode","window","generateStylesPalette","palette","item","hoverBgColor","gradientTo","gradientButtonToHover","gradientButtonFromActive","gradientButtonToActive","gradientButtonTextActive","hoverColor","activeBgColor","activeColor","FR","initTheme","theme","generatedStyles","themeToken","designTokens","outputFields","config","includes","typography","style","css","fonts","Object","keys","map","fontName","preset","Array","isArray","src","alias","fontStyle","fontWeight","fontDisplay","local","forEach","fontSrc","index","toLocaleLowerCase","replace","generateTypographyStyles","components","button","disabled","bgColor","themeColorsKeys","colorName","colorValue","styles","primary","primaryHover","document","element","getElementById","innerHTML","themeStyleNode","body","getElementsByTagName","createElement","type","id","styleSheet","cssText","appendChild","createTextNode"],"mappings":"0IAAAA,IAAMC,WAAiBC,OACfC,EAAMD,EAAEE,SAAS,WACD,IAAfD,EAAIE,WAAmBF,EAAQA,GAMlCG,WAAaH,EAAKI,OAClBL,wBAD0B,MAE1B,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,eAEvCA,EAAK,KAAIA,EAAES,KAAK,MACK,GAAM,UAAQT,GAAK,EAAK,UAAW,IAAJA,OAAWK,QAY7DK,WAAUT,OACVD,UACA,2BAA2BM,KAAKL,KAEjB,KADjBD,EAAIC,EAAIM,UAAU,GAAGC,MAAM,KACrBL,SACJH,EAAI,CAACA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,GAAIA,EAAE,KAIhC,CAAEW,GAFTX,EAA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