@gem-sdk/core 1.14.0-dev.521 → 1.14.0-dev.523
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.
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
${i}
|
|
13
13
|
} catch(err){}
|
|
14
14
|
</script>
|
|
15
|
-
`);return{cssCode:s,jsCode:a}},appendAnimation=(e,t)=>{let{uid:r,advanced:n,tag:d}=e,{animation:i}=n??{},s=i?.desktop?.enabled||i?.tablet?.enabled||i?.mobile?.enabled;if(!s||!i?.desktop?.triggerConfig)return t;let a=`animation-wrapper-${r}
|
|
15
|
+
`);return{cssCode:s,jsCode:a}},appendAnimation=(e,t)=>{let{uid:r,advanced:n,tag:d}=e,{animation:i}=n??{},s=i?.desktop?.enabled||i?.tablet?.enabled||i?.mobile?.enabled;if(!s||!i?.desktop?.triggerConfig)return t;let a=`animation-wrapper-${r}`,l={all:"Section"===d?"":"inherit"};return render.template`
|
|
16
16
|
${render.RenderIf(convert.isLocalEnv,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${convert.baseAssetURL}/assets/gp-animation.js" defer="defer"></script>`)}
|
|
17
17
|
<gp-animation
|
|
18
18
|
gp-data='${JSON.stringify({targetSelector:`#${a}`,config:i,tag:d})}'
|
|
19
|
-
style="
|
|
19
|
+
style="${{...l}}"
|
|
20
20
|
>
|
|
21
|
-
<div style="
|
|
21
|
+
<div style="${{...l}}" id="${a}">${t}</div>
|
|
22
22
|
</gp-animation>
|
|
23
23
|
`},RenderChildren=e=>{let t=Render(e);for(let r in t.extraFiles)Object.prototype.hasOwnProperty.call(t.extraFiles,r)&&(e.customProps.extraFiles[r]=t.extraFiles[r]);let r=new TextEncoder,n=t?.liquid?r.encode(t.liquid).length:0;if(Math.ceil(n/1024)>=180){let r=`gp-section-snippet-${e.uid}`;return e.customProps.extraFiles[r]=t.liquid,`{% render '${r}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`}return t.liquid},WrapRenderChildren=({uid:e,customProps:t},r)=>{let n="";if(r?.length)for(let d=0;d<r.length;d++){let i=r[d];if(i){let r=n+i,s=new TextEncoder,a=r?s.encode(r).length:0;if(Math.ceil(a/1024)>=180){let r=`gp-section-snippet-${e+d}`;t.extraFiles[r]=i,n+=`{% render '${r}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`}else n+=i}}return n};exports.RenderChildren=RenderChildren,exports.WrapRenderChildren=WrapRenderChildren,exports.default=Render;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import"react";import"react/jsx-runtime";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import{RenderIf as e,template as t}from"../helpers/render.js";import{baseAssetURL as
|
|
2
|
-
${e(u?.childrens?.length,()=>m({builderProps:{uid:
|
|
3
|
-
</div>`;let{cssCode:f,jsCode:v}=RenderCustomCode(u);return f&&(h+=f),v&&(h+=v),{liquid:h=appendAnimation(u,h),extraFiles:o.extraFiles}}},RenderCustomCode=
|
|
1
|
+
import"react";import"react/jsx-runtime";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import{RenderIf as e,template as t}from"../helpers/render.js";import{baseAssetURL as n,isLocalEnv as r}from"../helpers/convert.js";import{composeAdvanceStyle as i}from"../helpers/compose-advance-style.js";import{disableWrap as s,customRenderChildren as d}from"./constant.js";let componentsRenderWithParentId=["CarouselItem"],componentTexts=["Text","Heading"],componentIconList=["IconListV2","IconList"],componentUsingAdvanced=["IconList"],Render=({uid:n,builder:r,components:a,parentId:l,extraFiles:o={},pageContext:c,...p})=>{let u=r[n],m=a[u?.tag];if(!m)return console.log("Miss component: ",u),{liquid:"",extraFiles:o};if(!u||u?.type==="section")return{liquid:"",extraFiles:o};{let o={extraFiles:{}},g=i(u.advanced,u.tag),h="";h=s.includes(u.tag)?e(u?.childrens?.length,()=>m({builderProps:{uid:n,builderData:u},styles:u.styles,setting:u.settings,style:g,advanced:u.advanced,parentId:componentsRenderWithParentId.includes(u.tag)?l:null,pageContext:c,...p,rawChildren:u.childrens.map(e=>({...r[e],uid:e,builder:r,components:a,customProps:o,pageContext:c})),children:d.includes(u.tag)?"":WrapRenderChildren({uid:n,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:r,components:a,customProps:o,parentTag:u.tag,pageContext:c})))}),()=>m({builderProps:{uid:n,builderData:u},styles:u.styles,setting:u.settings,advanced:u.advanced,style:g,isText:!!componentTexts.includes(u.tag)||null,parentId:componentsRenderWithParentId.includes(u.tag)?l:null,pageContext:c,...p})):t`<div style="${componentIconList.includes(u.tag)?"":g}" class="${u.uid} ${u?.childrens?.length||"IconListItemHoz"!==u.tag?"":"hidden"}">
|
|
2
|
+
${e(u?.childrens?.length,()=>m({builderProps:{uid:n,builderData:u},styles:u.styles,setting:u.settings,advanced:{...componentUsingAdvanced.includes(u.tag)?u?.advanced:{},cssClass:u?.advanced?.cssClass},pageContext:c,...p,rawChildren:u.childrens.map(e=>({...r[e],uid:e,builder:r,components:a,customProps:o,pageContext:c})),children:d.includes(u.tag)?"":WrapRenderChildren({uid:n,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:r,components:a,customProps:o,parentTag:u.tag,pageContext:c})))}),()=>m({builderProps:{uid:n,builderData:u},styles:u.styles,setting:u.settings,advanced:{cssClass:u?.advanced?.cssClass},pageContext:c,isText:!!componentTexts.includes(u.tag)||null,style:componentIconList.includes(u.tag)?g:null,...p}))}
|
|
3
|
+
</div>`;let{cssCode:f,jsCode:v}=RenderCustomCode(u);return f&&(h+=f),v&&(h+=v),{liquid:h=appendAnimation(u,h),extraFiles:o.extraFiles}}},RenderCustomCode=n=>{let{css:r,javascript:i,rootClassName:s}=n.advanced?.editorData||{},d=r?.replaceAll(s,n.uid),a=i?.replaceAll(s,n.uid),l=e(!!r,t`
|
|
4
4
|
<style
|
|
5
|
-
id="${`custom-css-${
|
|
5
|
+
id="${`custom-css-${n?.uid}`}"
|
|
6
6
|
>${d}</style>
|
|
7
7
|
`),o=e(!!i,t`
|
|
8
8
|
<script
|
|
9
|
-
id="${`custom-js-${
|
|
9
|
+
id="${`custom-js-${n?.uid}`}"
|
|
10
10
|
>
|
|
11
11
|
try {
|
|
12
12
|
${a}
|
|
13
13
|
} catch(err){}
|
|
14
14
|
</script>
|
|
15
|
-
`);return{cssCode:l,jsCode:o}},appendAnimation=(i,s)=>{let{uid:d,advanced:a,tag:l}=i,{animation:o}=a??{},c=o?.desktop?.enabled||o?.tablet?.enabled||o?.mobile?.enabled;if(!c||!o?.desktop?.triggerConfig)return s;let p=`animation-wrapper-${d}
|
|
16
|
-
${e(
|
|
15
|
+
`);return{cssCode:l,jsCode:o}},appendAnimation=(i,s)=>{let{uid:d,advanced:a,tag:l}=i,{animation:o}=a??{},c=o?.desktop?.enabled||o?.tablet?.enabled||o?.mobile?.enabled;if(!c||!o?.desktop?.triggerConfig)return s;let p=`animation-wrapper-${d}`,u={all:"Section"===l?"":"inherit"};return t`
|
|
16
|
+
${e(r,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${n}/assets/gp-animation.js" defer="defer"></script>`)}
|
|
17
17
|
<gp-animation
|
|
18
18
|
gp-data='${JSON.stringify({targetSelector:`#${p}`,config:o,tag:l})}'
|
|
19
|
-
style="
|
|
19
|
+
style="${{...u}}"
|
|
20
20
|
>
|
|
21
|
-
<div style="
|
|
21
|
+
<div style="${{...u}}" id="${p}">${s}</div>
|
|
22
22
|
</gp-animation>
|
|
23
|
-
`},RenderChildren=e=>{let t=Render(e);for(let
|
|
23
|
+
`},RenderChildren=e=>{let t=Render(e);for(let n in t.extraFiles)Object.prototype.hasOwnProperty.call(t.extraFiles,n)&&(e.customProps.extraFiles[n]=t.extraFiles[n]);let n=new TextEncoder,r=t?.liquid?n.encode(t.liquid).length:0;if(Math.ceil(r/1024)>=180){let n=`gp-section-snippet-${e.uid}`;return e.customProps.extraFiles[n]=t.liquid,`{% render '${n}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`}return t.liquid},WrapRenderChildren=({uid:e,customProps:t},n)=>{let r="";if(n?.length)for(let i=0;i<n.length;i++){let s=n[i];if(s){let n=r+s,d=new TextEncoder,a=n?d.encode(n).length:0;if(Math.ceil(a/1024)>=180){let n=`gp-section-snippet-${e+i}`;t.extraFiles[n]=s,r+=`{% render '${n}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`}else r+=s}}return r};export{RenderChildren,WrapRenderChildren,Render as default};
|