@gem-sdk/core 2.1.40 → 2.1.44
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/cjs/components/Render.liquid.js +3 -3
- package/dist/cjs/components/RenderCustomCode.js +2 -1
- package/dist/cjs/helpers/custom-cdoe.js +8 -0
- package/dist/esm/components/Render.liquid.js +3 -3
- package/dist/esm/components/RenderCustomCode.js +2 -1
- package/dist/esm/helpers/custom-cdoe.js +6 -0
- package/package.json +1 -1
|
@@ -20,6 +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
|
+
var customCdoe = require('../helpers/custom-cdoe.js');
|
|
23
24
|
|
|
24
25
|
const componentsRenderWithParentId = [
|
|
25
26
|
'CarouselItem'
|
|
@@ -206,7 +207,7 @@ const RenderCustomCode = (item)=>{
|
|
|
206
207
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
207
208
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
208
209
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
209
|
-
const cssCode = render.RenderIf(!!css, render.template`
|
|
210
|
+
const cssCode = render.RenderIf(!!css && customCdoe.hasNonEmptyCSSRules(replacedCSS), render.template`
|
|
210
211
|
<style id="${`custom-css-${item?.uid}`}">
|
|
211
212
|
${replacedCSS}
|
|
212
213
|
</style>
|
|
@@ -296,8 +297,7 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
296
297
|
if (codes?.length) {
|
|
297
298
|
let tempLiquid = '';
|
|
298
299
|
let fileIndex = 0;
|
|
299
|
-
for(
|
|
300
|
-
const code = codes[i];
|
|
300
|
+
for (const code of codes){
|
|
301
301
|
if (code) {
|
|
302
302
|
const textEncoder = new TextEncoder();
|
|
303
303
|
const newTempLiquid = tempLiquid + code;
|
|
@@ -19,6 +19,7 @@ require('@gem-sdk/adapter-shopify');
|
|
|
19
19
|
require('swr/mutation');
|
|
20
20
|
require('vanilla-lazyload');
|
|
21
21
|
require('../hooks/useCartUI.js');
|
|
22
|
+
var customCdoe = require('../helpers/custom-cdoe.js');
|
|
22
23
|
|
|
23
24
|
const RenderCustomCode = ({ uid, advanced })=>{
|
|
24
25
|
const mode = shop.useEditorMode();
|
|
@@ -41,7 +42,7 @@ const RenderCustomCode = ({ uid, advanced })=>{
|
|
|
41
42
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
42
43
|
children: [
|
|
43
44
|
/*#__PURE__*/ jsxRuntime.jsx(Head, {
|
|
44
|
-
children: !!css && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
45
|
+
children: !!css && customCdoe.hasNonEmptyCSSRules(replacedCSS) && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
45
46
|
id: mapId['css'],
|
|
46
47
|
dangerouslySetInnerHTML: {
|
|
47
48
|
__html: replacedCSS
|
|
@@ -16,6 +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 { hasNonEmptyCSSRules } from '../helpers/custom-cdoe.js';
|
|
19
20
|
|
|
20
21
|
const componentsRenderWithParentId = [
|
|
21
22
|
'CarouselItem'
|
|
@@ -202,7 +203,7 @@ const RenderCustomCode = (item)=>{
|
|
|
202
203
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
203
204
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
204
205
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
205
|
-
const cssCode = RenderIf(!!css, template`
|
|
206
|
+
const cssCode = RenderIf(!!css && hasNonEmptyCSSRules(replacedCSS), template`
|
|
206
207
|
<style id="${`custom-css-${item?.uid}`}">
|
|
207
208
|
${replacedCSS}
|
|
208
209
|
</style>
|
|
@@ -292,8 +293,7 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
292
293
|
if (codes?.length) {
|
|
293
294
|
let tempLiquid = '';
|
|
294
295
|
let fileIndex = 0;
|
|
295
|
-
for(
|
|
296
|
-
const code = codes[i];
|
|
296
|
+
for (const code of codes){
|
|
297
297
|
if (code) {
|
|
298
298
|
const textEncoder = new TextEncoder();
|
|
299
299
|
const newTempLiquid = tempLiquid + code;
|
|
@@ -15,6 +15,7 @@ import '@gem-sdk/adapter-shopify';
|
|
|
15
15
|
import 'swr/mutation';
|
|
16
16
|
import 'vanilla-lazyload';
|
|
17
17
|
import '../hooks/useCartUI.js';
|
|
18
|
+
import { hasNonEmptyCSSRules } from '../helpers/custom-cdoe.js';
|
|
18
19
|
|
|
19
20
|
const RenderCustomCode = ({ uid, advanced })=>{
|
|
20
21
|
const mode = useEditorMode();
|
|
@@ -37,7 +38,7 @@ const RenderCustomCode = ({ uid, advanced })=>{
|
|
|
37
38
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
38
39
|
children: [
|
|
39
40
|
/*#__PURE__*/ jsx(Head, {
|
|
40
|
-
children: !!css && /*#__PURE__*/ jsx("style", {
|
|
41
|
+
children: !!css && hasNonEmptyCSSRules(replacedCSS) && /*#__PURE__*/ jsx("style", {
|
|
41
42
|
id: mapId['css'],
|
|
42
43
|
dangerouslySetInnerHTML: {
|
|
43
44
|
__html: replacedCSS
|