@gem-sdk/core 1.14.0-dev.710 → 1.14.0-dev.713

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:d,jsCode:a}},appendAnimation=(e,t)=>{let{advanced:r,tag:n}=e,{animation:s}=r??{},i=s?.desktop?.enabled||s?.tablet?.enabled||s?.mobile?.enabled;if(!i||!s?.desktop?.triggerConfig)return t;let d=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",a=e=>{if("desktop"===e);else if("tablet"===e)return s?.tablet??s?.desktop;else if("mobile"===e)return s?.mobile??s?.tablet??s?.desktop;return s?.desktop},l=e=>+!(a(e)?.enabled&&!["shake","none"].includes(d(a(e),"appear"))),o={desktop:l("desktop"),tablet:l("tablet"),mobile:l("mobile")},c={all:"Section"===n?"":"inherit",position:"static",transform:"unset"};return render.template`
15
+ `);return{cssCode:d,jsCode:a}},appendAnimation=(e,t)=>{let{advanced:r,tag:n}=e,{animation:s}=r??{},i=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",d=e=>{if("desktop"===e);else if("tablet"===e)return s?.tablet??s?.desktop;else if("mobile"===e)return s?.mobile??s?.tablet??s?.desktop;return s?.desktop},a=i(d("desktop"),"appear"),l=i(d("desktop"),"hover"),o=i(d("tablet"),"appear"),c=i(d("mobile"),"appear"),p=s?.desktop?.enabled&&("none"!==a||"none"!==l)||s?.tablet?.enabled&&"none"!==o||s?.mobile?.enabled&&"none"!==c;if(!p)return t;let u=e=>+!(d(e)?.enabled&&!["shake","none"].includes(i(d(e),"appear"))),m={desktop:u("desktop"),tablet:u("tablet"),mobile:u("mobile")},g={all:"Section"===n?"":"inherit",position:"static",transform:"unset"};return render.template`
16
16
  ${render.RenderIf(convert.isLocalEnv,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
17
17
  <gp-animation
18
18
  gp-data='${JSON.stringify({config:s,tag:n})}'
19
- style="${{...c}}"
19
+ style="${{...g}}"
20
20
  >
21
- <div style="${{...makeStyle.makeStyleResponsive("op",o)}}">${t}</div>
21
+ <div class="overflow-x-hidden" style="${{...makeStyle.makeStyleResponsive("op",m)}}">${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, form: form %}`}return t.liquid},WrapRenderChildren=({uid:e,customProps:t},r)=>{let n="";if(r?.length)for(let s=0;s<r.length;s++){let i=r[s];if(i){let r=n+i,d=new TextEncoder,a=r?d.encode(r).length:0;if(Math.ceil(a/1024)>=180){let r=`gp-section-snippet-${e+s}`;t.extraFiles[r]=i,n+=`{% render '${r}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`}else n+=i}}return n};exports.RenderChildren=RenderChildren,exports.WrapRenderChildren=WrapRenderChildren,exports.default=Render;
@@ -1,10 +1,10 @@
1
- import{makeStyleResponsive as e}from"../helpers/make-style.js";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{disableWrap as t,customRenderChildren as r}from"./constant.js";import{RenderIf as n,template as i}from"../helpers/render.js";import{baseAssetURL as s,isLocalEnv as d}from"../helpers/convert.js";import{composeAdvanceStyle as a}from"../helpers/compose-advance-style.js";let componentsRenderWithParentId=["CarouselItem"],componentTexts=["Text","Heading"],componentIconList=["IconListV2","IconList"],componentUsingAdvanced=["IconList"],Render=({uid:e,builder:s,components:d,parentId:l,extraFiles:o={},pageContext:c,...p})=>{let u=s[e],m=d[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=a(u.advanced,u.tag),h="";h=t.includes(u.tag)?n(u?.childrens?.length,()=>m({builderProps:{uid:e,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=>({...s[e],uid:e,builder:s,components:d,customProps:o,pageContext:c})),children:r.includes(u.tag)?"":WrapRenderChildren({uid:e,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:s,components:d,customProps:o,parentTag:u.tag,pageContext:c})))}),()=>m({builderProps:{uid:e,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})):i`<div style="${componentIconList.includes(u.tag)?"":g}" class="${u.uid} ${u?.childrens?.length||"IconListItemHoz"!==u.tag?"":"hidden"}">
2
- ${n(u?.childrens?.length,()=>m({builderProps:{uid:e,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=>({...s[e],uid:e,builder:s,components:d,customProps:o,pageContext:c})),children:r.includes(u.tag)?"":WrapRenderChildren({uid:e,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:s,components:d,customProps:o,parentTag:u.tag,pageContext:c})))}),()=>m({builderProps:{uid:e,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=e=>{let{css:t,javascript:r,rootClassName:s}=e.advanced?.editorData||{},d=t?.replaceAll(s,e.uid),a=r?.replaceAll(s,e.uid),l=n(!!t,i`
1
+ import{makeStyleResponsive as e}from"../helpers/make-style.js";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{disableWrap as t,customRenderChildren as n}from"./constant.js";import{RenderIf as r,template as i}from"../helpers/render.js";import{baseAssetURL as s,isLocalEnv as d}from"../helpers/convert.js";import{composeAdvanceStyle as a}from"../helpers/compose-advance-style.js";let componentsRenderWithParentId=["CarouselItem"],componentTexts=["Text","Heading"],componentIconList=["IconListV2","IconList"],componentUsingAdvanced=["IconList"],Render=({uid:e,builder:s,components:d,parentId:l,extraFiles:o={},pageContext:c,...p})=>{let u=s[e],m=d[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=a(u.advanced,u.tag),h="";h=t.includes(u.tag)?r(u?.childrens?.length,()=>m({builderProps:{uid:e,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=>({...s[e],uid:e,builder:s,components:d,customProps:o,pageContext:c})),children:n.includes(u.tag)?"":WrapRenderChildren({uid:e,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:s,components:d,customProps:o,parentTag:u.tag,pageContext:c})))}),()=>m({builderProps:{uid:e,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})):i`<div style="${componentIconList.includes(u.tag)?"":g}" class="${u.uid} ${u?.childrens?.length||"IconListItemHoz"!==u.tag?"":"hidden"}">
2
+ ${r(u?.childrens?.length,()=>m({builderProps:{uid:e,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=>({...s[e],uid:e,builder:s,components:d,customProps:o,pageContext:c})),children:n.includes(u.tag)?"":WrapRenderChildren({uid:e,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:s,components:d,customProps:o,parentTag:u.tag,pageContext:c})))}),()=>m({builderProps:{uid:e,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=e=>{let{css:t,javascript:n,rootClassName:s}=e.advanced?.editorData||{},d=t?.replaceAll(s,e.uid),a=n?.replaceAll(s,e.uid),l=r(!!t,i`
4
4
  <style
5
5
  id="${`custom-css-${e?.uid}`}"
6
6
  >${d}</style>
7
- `),o=n(!!r,i`
7
+ `),o=r(!!n,i`
8
8
  <script
9
9
  id="${`custom-js-${e?.uid}`}"
10
10
  >
@@ -12,12 +12,12 @@ import{makeStyleResponsive as e}from"../helpers/make-style.js";import"react";imp
12
12
  ${a}
13
13
  } catch(err){}
14
14
  </script>
15
- `);return{cssCode:l,jsCode:o}},appendAnimation=(t,r)=>{let{advanced:a,tag:l}=t,{animation:o}=a??{},c=o?.desktop?.enabled||o?.tablet?.enabled||o?.mobile?.enabled;if(!c||!o?.desktop?.triggerConfig)return r;let p=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",u=e=>{if("desktop"===e);else if("tablet"===e)return o?.tablet??o?.desktop;else if("mobile"===e)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},m=e=>+!(u(e)?.enabled&&!["shake","none"].includes(p(u(e),"appear"))),g={desktop:m("desktop"),tablet:m("tablet"),mobile:m("mobile")},h={all:"Section"===l?"":"inherit",position:"static",transform:"unset"};return i`
16
- ${n(d,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${s}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
15
+ `);return{cssCode:l,jsCode:o}},appendAnimation=(t,n)=>{let{advanced:a,tag:l}=t,{animation:o}=a??{},c=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",p=e=>{if("desktop"===e);else if("tablet"===e)return o?.tablet??o?.desktop;else if("mobile"===e)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},u=c(p("desktop"),"appear"),m=c(p("desktop"),"hover"),g=c(p("tablet"),"appear"),h=c(p("mobile"),"appear"),f=o?.desktop?.enabled&&("none"!==u||"none"!==m)||o?.tablet?.enabled&&"none"!==g||o?.mobile?.enabled&&"none"!==h;if(!f)return n;let v=e=>+!(p(e)?.enabled&&!["shake","none"].includes(c(p(e),"appear"))),b={desktop:v("desktop"),tablet:v("tablet"),mobile:v("mobile")},y={all:"Section"===l?"":"inherit",position:"static",transform:"unset"};return i`
16
+ ${r(d,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${s}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
17
17
  <gp-animation
18
18
  gp-data='${JSON.stringify({config:o,tag:l})}'
19
- style="${{...h}}"
19
+ style="${{...y}}"
20
20
  >
21
- <div style="${{...e("op",g)}}">${r}</div>
21
+ <div class="overflow-x-hidden" style="${{...e("op",b)}}">${n}</div>
22
22
  </gp-animation>
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, form: form %}`}return t.liquid},WrapRenderChildren=({uid:e,customProps:t},r)=>{let n="";if(r?.length)for(let i=0;i<r.length;i++){let s=r[i];if(s){let r=n+s,d=new TextEncoder,a=r?d.encode(r).length:0;if(Math.ceil(a/1024)>=180){let r=`gp-section-snippet-${e+i}`;t.extraFiles[r]=s,n+=`{% render '${r}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`}else n+=s}}return n};export{RenderChildren,WrapRenderChildren,Render as default};
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, form: form %}`}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, form: form %}`}else r+=s}}return r};export{RenderChildren,WrapRenderChildren,Render as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.14.0-dev.710",
3
+ "version": "1.14.0-dev.713",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",