@gem-sdk/core 1.46.0 → 1.47.0-staging.0
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,7 @@ 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
|
-
|
|
23
|
+
require('cssjson');
|
|
24
24
|
|
|
25
25
|
const componentsRenderWithParentId = [
|
|
26
26
|
'CarouselItem'
|
|
@@ -182,22 +182,11 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
};
|
|
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
185
|
const RenderCustomCode = (item)=>{
|
|
197
186
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
198
187
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
199
188
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
200
|
-
const cssCode = render.RenderIf(!!css
|
|
189
|
+
const cssCode = render.RenderIf(!!css, render.template`
|
|
201
190
|
<style id="${`custom-css-${item?.uid}`}">
|
|
202
191
|
${replacedCSS}
|
|
203
192
|
</style>
|
|
@@ -16,7 +16,7 @@ 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
|
|
19
|
+
import 'cssjson';
|
|
20
20
|
|
|
21
21
|
const componentsRenderWithParentId = [
|
|
22
22
|
'CarouselItem'
|
|
@@ -178,22 +178,11 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
};
|
|
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
181
|
const RenderCustomCode = (item)=>{
|
|
193
182
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
194
183
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
195
184
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
196
|
-
const cssCode = RenderIf(!!css
|
|
185
|
+
const cssCode = RenderIf(!!css, template`
|
|
197
186
|
<style id="${`custom-css-${item?.uid}`}">
|
|
198
187
|
${replacedCSS}
|
|
199
188
|
</style>
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0-staging.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"type-check": "yarn tsc --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/adapter-shopify": "1.
|
|
31
|
-
"@gem-sdk/styles": "1.
|
|
30
|
+
"@gem-sdk/adapter-shopify": "1.47.0-staging.0",
|
|
31
|
+
"@gem-sdk/styles": "1.47.0-staging.0",
|
|
32
32
|
"@types/classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|