@bigbinary/neeto-themes-frontend 2.0.6 → 2.0.8
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/index.cjs.js +32 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +33 -6
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs.js
CHANGED
|
@@ -214,10 +214,35 @@ var setVariable = function setVariable(name, value, variableNamesMap) {
|
|
|
214
214
|
if (!variableName) return;
|
|
215
215
|
root.style.setProperty(variableName, value);
|
|
216
216
|
};
|
|
217
|
+
var isPropertyIndependent = function isPropertyIndependent(key, theme, schema) {
|
|
218
|
+
var property = neetoCist.findBy({
|
|
219
|
+
key: key
|
|
220
|
+
}, schema);
|
|
221
|
+
if (neetoCist.isNotPresent(property)) return false;
|
|
222
|
+
var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
|
|
223
|
+
if (neetoCist.isNotPresent(conditionalKey)) return true;
|
|
224
|
+
var dependentPropertySchema = neetoCist.findBy({
|
|
225
|
+
key: conditionalKey
|
|
226
|
+
}, schema);
|
|
227
|
+
var dependentProperty = neetoCist.findBy({
|
|
228
|
+
key: conditionalKey
|
|
229
|
+
}, theme.properties);
|
|
230
|
+
if (dependentPropertySchema.kind === "image") {
|
|
231
|
+
var _theme$snakeToCamelCa;
|
|
232
|
+
return neetoCist.isPresent((_theme$snakeToCamelCa = theme[neetoCist.snakeToCamelCase(conditionalKey)]) === null || _theme$snakeToCamelCa === void 0 ? void 0 : _theme$snakeToCamelCa.url);
|
|
233
|
+
} else if (dependentPropertySchema.kind === "boolean") {
|
|
234
|
+
return (dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value) !== "false";
|
|
235
|
+
}
|
|
236
|
+
return neetoCist.isPresent(dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value);
|
|
237
|
+
};
|
|
217
238
|
var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
|
|
218
239
|
if (neetoCist.isNotPresent(theme === null || theme === void 0 ? void 0 : theme.properties)) return;
|
|
219
240
|
theme.properties.forEach(function (property) {
|
|
220
241
|
var attribute = neetoCist.snakeToCamelCase(property.key);
|
|
242
|
+
if (!isPropertyIndependent(property.key, theme, themeConfig)) {
|
|
243
|
+
setVariable(attribute, "", variableNamesMap);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
221
246
|
if (property.kind === "color") {
|
|
222
247
|
setVariable(attribute, hexToRgba(property.value), variableNamesMap);
|
|
223
248
|
} else if (property.kind === "overlay_opacity") {
|
|
@@ -1967,15 +1992,17 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1967
1992
|
react.useEffect(function () {
|
|
1968
1993
|
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
1969
1994
|
setThemeState({
|
|
1970
|
-
currentTheme: currentTheme,
|
|
1971
|
-
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
1972
1995
|
previewingTheme: currentTheme
|
|
1973
1996
|
});
|
|
1974
|
-
|
|
1997
|
+
setTheme(currentTheme);
|
|
1998
|
+
}, [isLoading, entityId]);
|
|
1975
1999
|
react.useEffect(function () {
|
|
1976
2000
|
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
1977
|
-
|
|
1978
|
-
|
|
2001
|
+
setThemeState({
|
|
2002
|
+
currentTheme: currentTheme,
|
|
2003
|
+
isCurrentThemeLoading: isCurrentThemeLoading
|
|
2004
|
+
});
|
|
2005
|
+
}, [currentTheme, isCurrentThemeLoading]);
|
|
1979
2006
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1980
2007
|
className: "neeto-themes__wrapper",
|
|
1981
2008
|
children: [/*#__PURE__*/jsxRuntime.jsx(Sidebar, {
|