@gem-sdk/core 1.46.0 → 1.46.4
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.
|
@@ -20,7 +20,6 @@ require('dayjs');
|
|
|
20
20
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
21
21
|
var convert = require('../helpers/convert.js');
|
|
22
22
|
var render = require('../helpers/render.js');
|
|
23
|
-
var cssjson = require('cssjson');
|
|
24
23
|
|
|
25
24
|
const componentsRenderWithParentId = [
|
|
26
25
|
'CarouselItem'
|
|
@@ -182,22 +181,11 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
182
181
|
};
|
|
183
182
|
}
|
|
184
183
|
};
|
|
185
|
-
const isEmptyCSS = (cssString)=>{
|
|
186
|
-
if (!cssString) return true;
|
|
187
|
-
const cssJSON = cssjson.toJSON(cssString);
|
|
188
|
-
const isObjectEmpty = (obj)=>{
|
|
189
|
-
if (typeof obj !== 'object' || obj === null) return true;
|
|
190
|
-
return !Object.keys(obj).some((key)=>{
|
|
191
|
-
return key === 'attributes' && Object.keys(obj[key]).length > 0 || typeof obj[key] === 'object' && !isObjectEmpty(obj[key]);
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
return isObjectEmpty(cssJSON.children);
|
|
195
|
-
};
|
|
196
184
|
const RenderCustomCode = (item)=>{
|
|
197
185
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
198
186
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
199
187
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
200
|
-
const cssCode = render.RenderIf(!!css
|
|
188
|
+
const cssCode = render.RenderIf(!!css, render.template`
|
|
201
189
|
<style id="${`custom-css-${item?.uid}`}">
|
|
202
190
|
${replacedCSS}
|
|
203
191
|
</style>
|
|
@@ -16,7 +16,6 @@ import 'dayjs';
|
|
|
16
16
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
17
17
|
import { baseAssetURL, isLocalEnv } from '../helpers/convert.js';
|
|
18
18
|
import { RenderIf, template } from '../helpers/render.js';
|
|
19
|
-
import { toJSON } from 'cssjson';
|
|
20
19
|
|
|
21
20
|
const componentsRenderWithParentId = [
|
|
22
21
|
'CarouselItem'
|
|
@@ -178,22 +177,11 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
178
177
|
};
|
|
179
178
|
}
|
|
180
179
|
};
|
|
181
|
-
const isEmptyCSS = (cssString)=>{
|
|
182
|
-
if (!cssString) return true;
|
|
183
|
-
const cssJSON = toJSON(cssString);
|
|
184
|
-
const isObjectEmpty = (obj)=>{
|
|
185
|
-
if (typeof obj !== 'object' || obj === null) return true;
|
|
186
|
-
return !Object.keys(obj).some((key)=>{
|
|
187
|
-
return key === 'attributes' && Object.keys(obj[key]).length > 0 || typeof obj[key] === 'object' && !isObjectEmpty(obj[key]);
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
return isObjectEmpty(cssJSON.children);
|
|
191
|
-
};
|
|
192
180
|
const RenderCustomCode = (item)=>{
|
|
193
181
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
194
182
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
195
183
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
196
|
-
const cssCode = RenderIf(!!css
|
|
184
|
+
const cssCode = RenderIf(!!css, template`
|
|
197
185
|
<style id="${`custom-css-${item?.uid}`}">
|
|
198
186
|
${replacedCSS}
|
|
199
187
|
</style>
|